Index: lams_tool_survey/conf/language/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/conf/language/Attic/ApplicationResources.properties,v diff -u -r1.6 -r1.7 --- lams_tool_survey/conf/language/ApplicationResources.properties 22 Sep 2006 04:21:52 -0000 1.6 +++ lams_tool_survey/conf/language/ApplicationResources.properties 22 Sep 2006 05:25:33 -0000 1.7 @@ -71,7 +71,7 @@ label.append.text=Append text: label.next=Next label.previous=Previous - +label.of=of error.upload.failed =Upload file failed: {0} error.msg.upload.file.not.found =Could not find upload file {0}. error.msg.zip.file.exception =Could not handle zip file when uploading file. Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java,v diff -u -r1.6 -r1.7 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java 22 Sep 2006 04:21:50 -0000 1.6 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/SurveyConstants.java 22 Sep 2006 05:25:33 -0000 1.7 @@ -89,6 +89,8 @@ public static final String PREFIX_QUESTION_CHOICE = "optionChoice"; public static final String PREFIX_QUESTION_TEXT= "optionText"; public static final String ERROR_MSG_KEY = "questionError"; + public static final String ATTR_TOTAL_QUESTIONS = "totalQuestions"; + public static final String ATTR_CURRENT_QUESTIONS_IDX = "currentIdx"; //POSITION public static int POSITION_INSIDE = 0; Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/LearningAction.java,v diff -u -r1.7 -r1.8 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/LearningAction.java 22 Sep 2006 04:21:50 -0000 1.7 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/action/LearningAction.java 22 Sep 2006 05:25:33 -0000 1.8 @@ -196,11 +196,14 @@ answerForm.setQuestionSeqID(surveyItemList.firstKey()); } } + sessionMap.put(SurveyConstants.ATTR_TOTAL_QUESTIONS,surveyItemList.size()); + answerForm.setCurrentIdx(1); + if(surveyItemList.size() < 2) answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); - else + else{ answerForm.setPosition(SurveyConstants.POSITION_FIRST); - + } //if page is locked, only go to result pages. if(lock){ return mapping.findForward(SurveyConstants.FORWARD_RESULT); @@ -216,6 +219,7 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); SortedMap surveyItemMap = getQuestionList(sessionMap); + ActionErrors errors = getAnswer(request, surveyItemMap.get(questionSeqID)); if(!errors.isEmpty()){ return mapping.getInputForward(); @@ -235,6 +239,9 @@ break; } } + //get current question index of total questions + int currIdx = new ArrayList(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; + answerForm.setCurrentIdx(currIdx); //failure tolerance if(questionSeqID.equals(surveyItemMap.lastKey())) answerForm.setPosition(SurveyConstants.POSITION_LAST); @@ -263,6 +270,11 @@ questionSeqID = surveyItemMap.firstKey(); else questionSeqID = subMap.lastKey(); + + //get current question index of total questions + int currIdx = new ArrayList(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; + answerForm.setCurrentIdx(currIdx); + if(questionSeqID.equals(surveyItemMap.firstKey())){ answerForm.setPosition(SurveyConstants.POSITION_FIRST); }else{ @@ -275,7 +287,16 @@ private ActionForward retake(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { AnswerForm answerForm = (AnswerForm) form; + Integer questionSeqID = answerForm.getQuestionSeqID(); answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE); + String sessionMapID = answerForm.getSessionMapID(); + + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SortedMap surveyItemMap = getQuestionList(sessionMap); + //get current question index of total questions + int currIdx = new ArrayList(surveyItemMap.keySet()).indexOf(questionSeqID) + 1; + answerForm.setCurrentIdx(currIdx); + return mapping.findForward(SurveyConstants.SUCCESS); } Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java,v diff -u -r1.1 -r1.2 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java 21 Sep 2006 07:46:40 -0000 1.1 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/form/AnswerForm.java 22 Sep 2006 05:25:33 -0000 1.2 @@ -35,6 +35,7 @@ private String sessionMapID; private Integer questionSeqID; private int position; + private int currentIdx; public int getPosition() { return position; @@ -54,6 +55,12 @@ public void setSessionMapID(String sessionMapID) { this.sessionMapID = sessionMapID; } + public int getCurrentIdx() { + return currentIdx; + } + public void setCurrentIdx(int currentIdx) { + this.currentIdx = currentIdx; + } } Index: lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/servlet/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/servlet/ExportServlet.java,v diff -u -r1.2 -r1.3 --- lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/servlet/ExportServlet.java 12 Sep 2006 04:35:46 -0000 1.2 +++ lams_tool_survey/src/java/org/lamsfoundation/lams/tool/survey/web/servlet/ExportServlet.java 22 Sep 2006 05:25:33 -0000 1.3 @@ -56,7 +56,7 @@ private static Logger logger = Logger.getLogger(ExportServlet.class); - private final String FILENAME = "shared_surveys_main.html"; + private final String FILENAME = "survey_main.html"; public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { Index: lams_tool_survey/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_survey/web/pages/learning/learning.jsp,v diff -u -r1.5 -r1.6 --- lams_tool_survey/web/pages/learning/learning.jsp 22 Sep 2006 04:21:51 -0000 1.5 +++ lams_tool_survey/web/pages/learning/learning.jsp 22 Sep 2006 05:25:33 -0000 1.6 @@ -28,10 +28,12 @@ + +

${sessionMap.title} @@ -56,6 +58,8 @@ + ${currentIdx} ${sessionMap.totalQuestions} +

<%@ include file="/pages/learning/question.jsp"%>