Index: lams_tool_vote/conf/language/ApplicationResources.properties =================================================================== diff -u -r261d9a36d11a99322125fa55faaddffc16a041b3 -rd753b209cbc5f2a8e105e111b12143222eed8761 --- lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 261d9a36d11a99322125fa55faaddffc16a041b3) +++ lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision d753b209cbc5f2a8e105e111b12143222eed8761) @@ -117,6 +117,7 @@ label.cancel =Cancel feedback =Please address the following issues before submit.
+error.maxNominationCount.invalid =Please correct this: The "Max Nominations" field in Advanced section is invalid. error.default.content.notSetup =The tool initialization error: The tool default content has not been set up properly. error.questions.submitted.none =Please correct this: No questions have been submitted. Please also note that the questions with no candidate answers are being automatically removed. error.question.empty =Please correct this: The question text can not be empty. Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -r261d9a36d11a99322125fa55faaddffc16a041b3 -rd753b209cbc5f2a8e105e111b12143222eed8761 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 261d9a36d11a99322125fa55faaddffc16a041b3) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision d753b209cbc5f2a8e105e111b12143222eed8761) @@ -261,15 +261,16 @@ logger.debug("verifyDuplicatesOptionsMap: " + verifyDuplicatesOptionsMap); request.getSession().removeAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE); if (verifyDuplicatesOptionsMap == false) - { + { errors= new ActionMessages(); errors.add(Globals.ERROR_KEY,new ActionMessage("error.options.duplicate")); request.getSession().setAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE, new Boolean(true).toString()); logger.debug("add error.options.duplicate to ActionMessages"); saveErrors(request,errors); voteAuthoringForm.resetUserAction(); return (mapping.findForward(LOAD_QUESTIONS)); - } + } + logger.debug("submitting mapOptionsContent:" + mapOptionsContent); @@ -280,6 +281,33 @@ VoteContent voteContent=authoringUtil.saveOrUpdateVoteContent(mapOptionsContent, voteService, voteAuthoringForm, request); logger.debug("voteContent: " + voteContent); + String maxNomCount=voteAuthoringForm.getMaxNominationCount(); + logger.debug("maxNomCount:" + maxNomCount); + + if (maxNomCount.equals("0")) + { + errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY,new ActionMessage("error.maxNominationCount.invalid")); + logger.debug("add error.maxNominationCount.invalid to ActionMessages"); + saveErrors(request,errors); + voteAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + try + { + int intMaxNomCount=new Integer(maxNomCount).intValue(); + logger.debug("intMaxNomCount : " +intMaxNomCount); + } + catch(NumberFormatException e) + { + errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY,new ActionMessage("error.maxNominationCount.invalid")); + saveErrors(request,errors); + voteAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + } + logger.debug("start persisting offline files metadata"); AuthoringUtil.persistFilesMetaData(request, true, voteContent);