Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5 -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -267,17 +267,10 @@ public static final String USER_EXCEPTION_MODE_INVALID ="userExceptionModeInvalid"; public static final String USER_EXCEPTION_QUESTION_EMPTY ="userExceptionQuestionEmpty"; public static final String USER_EXCEPTION_ANSWER_EMPTY ="userExceptionAnswerEmpty"; - public static final String USER_EXCEPTION_WEIGHT_TOTAL ="userExceptionWeightTotal"; - public static final String USER_EXCEPTION_WEIGHT_EMPTY ="userExceptionWeightEmpty"; - public static final String USER_EXCEPTION_WEIGHT_NOTINTEGER ="userExceptionWeightNotInteger"; - public static final String USER_EXCEPTION_WEIGHT_ZERO ="userExceptionWeightZero"; public static final String USER_EXCEPTION_ANSWERS_DUPLICATE ="userExceptionAnswersDuplicate"; public static final String USER_EXCEPTION_OPTIONS_COUNT_ZERO ="userExceptionOptionsCountZero"; public static final String USER_EXCEPTION_CHKBOXES_EMPTY ="userExceptionChkboxesEmpty"; public static final String USER_EXCEPTION_SUBMIT_NONE ="userExceptionSubmitNone"; - public static final String USER_EXCEPTION_PASSMARK_NOTINTEGER ="userExceptionPassmarkNotInteger"; - public static final String USER_EXCEPTION_PASSMARK_EMPTY ="userExceptionPassmarkEmpty"; - public static final String USER_EXCEPTION_PASSMARK_GREATER100 ="userExceptionPassmarkGreater100"; public static final String USER_EXCEPTION_FILENAME_EMPTY ="userExceptionFilenameEmpty"; public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 ="userExceptionWeightMustEqual100"; public static final String USER_EXCEPTION_SINGLE_OPTION ="userExceptionSingleOption"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r261d9a36d11a99322125fa55faaddffc16a041b3 -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 261d9a36d11a99322125fa55faaddffc16a041b3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -485,18 +485,11 @@ request.getSession().removeAttribute(USER_EXCEPTION_MODE_INVALID); request.getSession().removeAttribute(USER_EXCEPTION_QUESTION_EMPTY); request.getSession().removeAttribute(USER_EXCEPTION_ANSWER_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_TOTAL); - request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_NOTINTEGER); - request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_ZERO); request.getSession().removeAttribute(USER_EXCEPTION_ANSWERS_DUPLICATE); request.getSession().removeAttribute(USER_EXCEPTION_OPTIONS_COUNT_ZERO); request.getSession().removeAttribute(USER_EXCEPTION_CHKBOXES_EMPTY); request.getSession().removeAttribute(USER_EXCEPTION_SUBMIT_NONE); - request.getSession().removeAttribute(USER_EXCEPTION_PASSMARK_NOTINTEGER); request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); - request.getSession().removeAttribute(USER_EXCEPTION_PASSMARK_EMPTY); - request.getSession().removeAttribute(USER_EXCEPTION_PASSMARK_GREATER100); request.getSession().removeAttribute(USER_EXCEPTION_FILENAME_EMPTY); request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_MUST_EQUAL100); request.getSession().removeAttribute(USER_EXCEPTION_SINGLE_OPTION); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java =================================================================== diff -u -r14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5 -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 14e58bcc3bb8b0639bd32c4e5cf2467bb276c3d5) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -62,7 +62,7 @@ public class AuthoringUtil implements VoteAppConstants { static Logger logger = Logger.getLogger(AuthoringUtil.class.getName()); - public static boolean verifyDuplicatesOptionsMap(Map mapOptionsContent) + public static boolean verifyDuplicateNominations(Map mapOptionsContent) { Map originalMapOptionsContent=mapOptionsContent; Map backupMapOptionsContent=mapOptionsContent; @@ -87,11 +87,11 @@ } if (optionCount > 1) - return false; + return true; } } } - return true; + return false; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -r0ec38b0c90a821a6e5732546f5e035b3c223c12f -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 0ec38b0c90a821a6e5732546f5e035b3c223c12f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -121,10 +121,6 @@ IVoteService voteService =VoteUtils.getToolService(request); VoteUtils.persistRichText(request); voteAuthoringForm.resetUserAction(); - - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); return null; } @@ -134,10 +130,7 @@ logger.debug("doing isNewOptionAdded"); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); AuthoringUtil authoringUtil= new AuthoringUtil(); Map mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT); @@ -213,10 +206,7 @@ logger.debug("starting isOptionRemoved "); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); VoteUtils.persistRichText(request); @@ -288,11 +278,8 @@ VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(true).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); - + request.setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); if (voteService == null) @@ -323,12 +310,12 @@ ActionMessages errors= new ActionMessages(); errors=validateSubmit(request, errors, voteAuthoringForm); - + if (errors.size() > 0) { logger.debug("returning back to from to fix errors:"); request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(true).toString()); + request.setAttribute(VALIDATION_ERROR, new Boolean(true).toString()); //return mapping.findForward(destination); return false; } @@ -343,6 +330,16 @@ mapOptionsContent= new TreeMap(new VoteComparator()); logger.debug("mapOptionsContent :" +mapOptionsContent); + boolean nominationsDuplicate=AuthoringUtil.verifyDuplicateNominations(mapOptionsContent); + logger.debug("nominationsDuplicate :" +nominationsDuplicate); + + if (nominationsDuplicate == true) + { + logger.debug("back to user, nominationsDuplicate :" +nominationsDuplicate); + request.setAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE, new Boolean(true).toString()); + return false; + } + int maxIndex=mapOptionsContent.size(); request.getSession().setAttribute(MAX_OPTION_INDEX, new Integer(maxIndex)); @@ -379,9 +376,7 @@ { if (maxNomCount.equals("0")) { - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(true).toString()); - persistError(request,"error.maxNominationCount.invalid"); - //return (mapping.findForward(LOAD_QUESTIONS)); + request.setAttribute(USER_EXCEPTION_MAXNOMINATION_INVALID, new Boolean(true).toString()); return false; } @@ -392,9 +387,7 @@ } catch(NumberFormatException e) { - persistError(request,"error.maxNominationCount.invalid"); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(true).toString()); - //return (mapping.findForward(LOAD_QUESTIONS)); + request.setAttribute(USER_EXCEPTION_MAXNOMINATION_INVALID, new Boolean(true).toString()); return false; } } @@ -419,8 +412,7 @@ errors.clear(); errors.add(Globals.ERROR_KEY, new ActionMessage("sbmt.successful")); - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(1)); - voteAuthoringForm.setSbmtSuccess(new Boolean(true).toString()); + request.setAttribute(SUBMIT_SUCCESS, new Boolean(true).toString()); logger.debug("setting SUBMIT_SUCCESS to 1."); Long strToolContentId=(Long)request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); @@ -444,8 +436,6 @@ VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); - /* determine whether the request is from Monitoring url Edit Activity*/ String sourceVoteStarter = (String) request.getAttribute(SOURCE_VOTE_STARTER); @@ -461,6 +451,8 @@ voteAuthoringForm.setSbmtSuccess(new Boolean(true).toString()); logger.debug("final submit status :" +voteAuthoringForm.getSbmtSuccess()); + logger.debug("final duplicate status :" +request.getAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE)); + logger.debug("fwding to destination :" +destination); return (mapping.findForward(destination)); } @@ -475,12 +467,8 @@ logger.debug("dispatching moveOptionDown..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); - - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); + IVoteService voteService =VoteUtils.getToolService(request); VoteUtils.persistRichText(request); @@ -569,12 +557,10 @@ VoteUtils.cleanUpUserExceptions(request); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); + IVoteService voteService =VoteUtils.getToolService(request); /* determine whether the request is from Monitoring url Edit Activity*/ @@ -662,8 +648,6 @@ protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, VoteAuthoringForm voteAuthoringForm) { - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); String title = voteAuthoringForm.getTitle(); logger.debug("title: " + title); @@ -711,12 +695,8 @@ logger.debug("dispatching submitOfflineFile..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); + IVoteService voteService =VoteUtils.getToolService(request); /* determine whether the request is from Monitoring url Edit Activity*/ @@ -767,11 +747,7 @@ logger.debug("dispatching submitOnlineFiles..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); IVoteService voteService =VoteUtils.getToolService(request); @@ -822,11 +798,7 @@ logger.debug("dispatching deleteOfflineFile..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); IVoteService voteService =VoteUtils.getToolService(request); @@ -864,11 +836,7 @@ logger.debug("dispatching deleteOnlineFile..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - //request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); IVoteService voteService =VoteUtils.getToolService(request); @@ -905,10 +873,7 @@ logger.debug("dispatching editActivityQuestions..."); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); - voteAuthoringForm.setExceptionMaxNominationInvalid(new Boolean(false).toString()); voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - request.getSession().setAttribute(VALIDATION_ERROR, new Boolean(false).toString()); - voteAuthoringForm.setSbmtSuccess(new Boolean(false).toString()); IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); logger.debug("voteService: " + voteService); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java =================================================================== diff -u -r0ec38b0c90a821a6e5732546f5e035b3c223c12f -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision 0ec38b0c90a821a6e5732546f5e035b3c223c12f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningStarterAction.java (.../VoteLearningStarterAction.java) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -135,6 +135,7 @@ voteLearningForm.setUserEntry(""); voteLearningForm.setCastVoteCount(0); voteLearningForm.setMaxNominationCountReached(new Boolean(false).toString()); + voteLearningForm.setActivityRunOffline(new Boolean(false).toString()); /* * persist time zone information to session scope. @@ -304,6 +305,7 @@ VoteUtils.cleanUpSessionAbsolute(request); logger.debug("warning to learner: the activity is offline."); request.getSession().setAttribute(USER_EXCEPTION_CONTENT_RUNOFFLINE, new Boolean(true).toString()); + voteLearningForm.setActivityRunOffline(new Boolean(true).toString()); persistError(request,"label.learning.runOffline"); return (mapping.findForward(ERROR_LIST)); } @@ -341,7 +343,6 @@ logger.debug("userID:" + userID); logger.debug("voteSession uid :" + voteSession.getUid()); - //VoteQueUsr voteQueUsr=voteService.retrieveVoteQueUsr(new Long(userID)); VoteQueUsr voteQueUsr=voteService.getVoteUserBySession(new Long(userID), voteSession.getUid()); logger.debug("voteQueUsr:" + voteQueUsr); @@ -416,8 +417,6 @@ request.getSession().setAttribute(MAP_GENERAL_CHECKED_OPTIONS_CONTENT, localMapQuestionsContent); logger.debug("end building MAP_GENERAL_CHECKED_OPTIONS_CONTENT: " + localMapQuestionsContent); - - boolean isSessionCompleted=isSessionCompleted(userSessionId, voteService); logger.debug("isSessionCompleted: " + isSessionCompleted); Index: lams_tool_vote/web/WEB-INF/struts-config.xml =================================================================== diff -u -rb523c049772bec9396882cecd81fdb23a91b5c19 -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision b523c049772bec9396882cecd81fdb23a91b5c19) +++ lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -54,43 +54,43 @@ @@ -122,31 +122,31 @@ @@ -176,13 +176,13 @@ @@ -401,7 +401,7 @@ @@ -441,7 +441,7 @@ Index: lams_tool_vote/web/authoring/BasicContent.jsp =================================================================== diff -u -r0ec38b0c90a821a6e5732546f5e035b3c223c12f -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision 0ec38b0c90a821a6e5732546f5e035b3c223c12f) +++ lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -32,26 +32,27 @@ -VoteAuthoringForm.sbmtSuccess: -VoteMonitoringForm.sbmtSuccess: -

- + images/success.gif" align="left" width=20 height=20> - + images/error.jpg" align="left" width=20 height=20> images/error.jpg" align="left" width=20 height=20> + + images/error.jpg" align="left" width=20 height=20> + +
Index: lams_tool_vote/web/learning/AnswersContent.jsp =================================================================== diff -u -r0ec38b0c90a821a6e5732546f5e035b3c223c12f -re6fd15100d6bd9a0196f6a086a2df9b6df1aed40 --- lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 0ec38b0c90a821a6e5732546f5e035b3c223c12f) +++ lams_tool_vote/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision e6fd15100d6bd9a0196f6a086a2df9b6df1aed40) @@ -71,9 +71,6 @@ -mapQuestionContentLearner: -sessionScope.mapGeneralCheckedOptionsContent: - @@ -82,7 +79,6 @@ - queIndex: