Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml =================================================================== diff -u -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml (.../VoteQueContent.hbm.xml) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) +++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml (.../VoteQueContent.hbm.xml) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -27,7 +27,7 @@ name="question" type="java.lang.String" column="question" - length="255" + length="65535" > Index: lams_tool_vote/db/model/lams_tool_vote.clay =================================================================== diff -u -rc5172424555b18ee103dd5609fd36e2d886d035a -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision c5172424555b18ee103dd5609fd36e2d886d035a) +++ lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -84,8 +84,8 @@ - + @@ -228,11 +228,10 @@ - + - - - + + Index: lams_tool_vote/db/sql/create_lams_tool_vote.sql =================================================================== diff -u -rc5172424555b18ee103dd5609fd36e2d886d035a -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision c5172424555b18ee103dd5609fd36e2d886d035a) +++ lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -23,7 +23,7 @@ CREATE TABLE tl_vote11_que_content ( uid BIGINT(20) NOT NULL AUTO_INCREMENT - , question VARCHAR(255) + , question TEXT , display_order INT(5) , vote_content_id BIGINT(20) NOT NULL , PRIMARY KEY (uid) @@ -90,7 +90,6 @@ REFERENCES tl_vote11_content (uid) )TYPE=InnoDB; - INSERT INTO tl_vote11_content(uid, content_id , title , instructions , creation_date , questions_sequenced , created_by , run_offline , define_later, offline_instructions, online_instructions, content_in_use, retries) VALUES (1, ${default_content_id} ,'Voting Title','Voting Instructions', NOW(), 0, 1,0, 0, 'offline instructions','online instructions', 0, 0); INSERT INTO tl_vote11_que_content (uid,question, display_order, vote_content_id) VALUES (1, 'sample nomination', 1, 1); \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -rafd9f8463f033997ae0deaa55116a875d9da776f -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision afd9f8463f033997ae0deaa55116a875d9da776f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -59,6 +59,7 @@ public static final String AUTHORING ="authoring"; public static final String SOURCE_VOTE_STARTER ="sourceVoteStarter"; + public static final String REMOVABLE_OPTION_INDEX ="removableOptionIndex"; public static final String AUTHORING_CANCELLED ="authoringCancelled"; public static final String DEFINE_LATER_EDIT_ACTIVITY ="defineLaterEditActivity"; public static final String ACTIVE_MODULE ="activeModule"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -rf9e3bb1e954f24078531d9a9114952f84cad4bb2 -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision f9e3bb1e954f24078531d9a9114952f84cad4bb2) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -132,6 +132,12 @@ { logger.debug("dispathcing addNewOption"); + /* determine whether the request is from Monitoring url Edit Activity*/ + String sourceVoteStarter = (String) request.getAttribute(SOURCE_VOTE_STARTER); + logger.debug("sourceVoteStarter: " + sourceVoteStarter); + String destination=VoteUtils.getDestination(sourceVoteStarter); + logger.debug("destination: " + destination); + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); AuthoringUtil authoringUtil= new AuthoringUtil(); Map mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT); @@ -158,7 +164,7 @@ logger.debug("firstEntry: " + firstEntry); request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(destination)); } @@ -168,6 +174,12 @@ logger.debug("doing removeOption "); request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); + /* determine whether the request is from Monitoring url Edit Activity*/ + String sourceVoteStarter = (String) request.getAttribute(SOURCE_VOTE_STARTER); + logger.debug("sourceVoteStarter: " + sourceVoteStarter); + String destination=VoteUtils.getDestination(sourceVoteStarter); + logger.debug("destination: " + destination); + VoteUtils.persistRichText(request); AuthoringUtil authoringUtil= new AuthoringUtil(); @@ -189,7 +201,7 @@ logger.debug("firstEntry: " + firstEntry); request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, firstEntry); - return (mapping.findForward(LOAD_QUESTIONS)); + return (mapping.findForward(destination)); } @@ -201,6 +213,12 @@ VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); + /* determine whether the request is from Monitoring url Edit Activity*/ + String sourceVoteStarter = (String) request.getAttribute(SOURCE_VOTE_STARTER); + logger.debug("sourceVoteStarter: " + sourceVoteStarter); + String destination=VoteUtils.getDestination(sourceVoteStarter); + logger.debug("destination: " + destination); + IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); if (voteService == null) voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); @@ -294,7 +312,7 @@ logger.debug("define later set to false"); voteAuthoringForm.resetUserAction(); - return mapping.findForward(LOAD_QUESTIONS); + return mapping.findForward(destination); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java =================================================================== diff -u -rafd9f8463f033997ae0deaa55116a875d9da776f -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision afd9f8463f033997ae0deaa55116a875d9da776f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -37,6 +37,7 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.VoteUtils; @@ -335,9 +336,97 @@ logger.debug("countSessionComplete: " + countSessionComplete); request.getSession().setAttribute(COUNT_SESSION_COMPLETE, new Integer(countSessionComplete).toString()); } + + public ActionForward editActivityQuestions(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException, + ToolException + { + logger.debug("dispatching editActivityQuestions..."); + request.getSession().setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(false).toString()); + request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true)); + VoteUtils.setDefineLater(request, true); + return (mapping.findForward(LOAD_MONITORING)); + } + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching proxy submitAllContent..."); + request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); + + request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); + logger.debug("SOURCE_VOTE_STARTER: monitoring"); + + VoteAction voteAction= new VoteAction(); + return voteAction.submitAllContent(mapping, form, request, response); + + } + public ActionForward addNewOption(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispatching proxy editActivityQuestions..."); + + request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); + logger.debug("SOURCE_VOTE_STARTER: monitoring"); + + VoteAction voteAction= new VoteAction(); + return voteAction.addNewOption(mapping, form, request, response); + } + + + public ActionForward removeOption(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispatching proxy removeOption..."); + VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; + logger.debug("voteMonitoringForm: " + voteMonitoringForm); + String optIndex=voteMonitoringForm.getOptIndex() ; + logger.debug("optIndex: " + optIndex); + request.getSession().setAttribute(REMOVABLE_QUESTION_INDEX, optIndex); + + request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); + logger.debug("SOURCE_VOTE_STARTER: monitoring"); + + VoteAction voteAction= new VoteAction(); + return voteAction.removeOption(mapping, form, request, response); + } + + + public ActionForward moveOptionDown(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + logger.debug("dispatching proxy moveOptionDown..."); + + request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); + logger.debug("SOURCE_VOTE_STARTER: monitoring"); + + VoteAction voteAction= new VoteAction(); + return voteAction.moveOptionDown(mapping, form, request, response); + } + + public ActionForward moveOptionUp(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + logger.debug("dispatching proxy moveOptionUp..."); + + request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); + logger.debug("SOURCE_VOTE_STARTER: monitoring"); + + VoteAction voteAction= new VoteAction(); + return voteAction.moveOptionUp(mapping, form, request, response); + } + + /** * persists error messages to request scope * @param request Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java =================================================================== diff -u -rafd9f8463f033997ae0deaa55116a875d9da776f -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision afd9f8463f033997ae0deaa55116a875d9da776f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -103,37 +103,37 @@ VoteContent voteContent=voteService.retrieveVote(toolContentId); logger.debug("existing voteContent:" + voteContent); - Map mapQuestionContent= new TreeMap(new VoteComparator()); - logger.debug("mapQuestionContent: " + mapQuestionContent); - /* - * get the existing question content - */ + Map mapOptionsContent= new TreeMap(new VoteComparator()); + logger.debug("mapOptionsContent: " + mapOptionsContent); + logger.debug("setting existing content data from the db"); - mapQuestionContent.clear(); + mapOptionsContent.clear(); Iterator queIterator=voteContent.getVoteQueContents().iterator(); Long mapIndex=new Long(1); - logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapOptionsContent: " + mapOptionsContent); while (queIterator.hasNext()) { VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); if (voteQueContent != null) { logger.debug("question: " + voteQueContent.getQuestion()); - mapQuestionContent.put(mapIndex.toString(),voteQueContent.getQuestion()); + mapOptionsContent.put(mapIndex.toString(),voteQueContent.getQuestion()); /** * make the first entry the default(first) one for jsp */ if (mapIndex.longValue() == 1) - request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, voteQueContent.getQuestion()); + { + request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, voteQueContent.getQuestion()); + } + mapIndex=new Long(mapIndex.longValue()+1); } } - logger.debug("Map initialized with existing contentid to: " + mapQuestionContent); - logger.debug("callling presentInitialUserInterface for the existing content."); + logger.debug("Map initialized with existing contentid to: " + mapOptionsContent); + request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); + logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT) ); + - request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent); - logger.debug("execute initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") ); - /*true means there is at least 1 response*/ if (voteService.studentActivityOccurredGlobal(voteContent)) { @@ -159,6 +159,8 @@ request.getSession().setAttribute(TOOL_SERVICE, voteService); request.getSession().setAttribute(CURRENT_MONITORING_TAB, "summary"); + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); + request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); request.getSession().setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true).toString()); /* Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java =================================================================== diff -u -rafd9f8463f033997ae0deaa55116a875d9da776f -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision afd9f8463f033997ae0deaa55116a875d9da776f) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -345,21 +345,22 @@ logger.debug("student activity occurred on this content:" + voteContent); request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString()); persistError(request, "error.content.inUse"); - logger.debug("add error.content.inUse to ActionMessages."); return (mapping.findForward(ERROR_LIST)); } - boolean isDefineLater=VoteUtils.isDefineLater(voteContent); - logger.debug("isDefineLater:" + isDefineLater); - if (isDefineLater == true) + if (servletPath.indexOf("authoringStarter") > 0) { - VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("student activity occurred on this content:" + voteContent); - request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString()); - persistError(request, "error.content.inUse"); - logger.debug("add error.content.inUse to ActionMessages."); - return (mapping.findForward(ERROR_LIST)); - + boolean isDefineLater=VoteUtils.isDefineLater(voteContent); + logger.debug("isDefineLater:" + isDefineLater); + if (isDefineLater == true) + { + VoteUtils.cleanUpSessionAbsolute(request); + logger.debug("student activity occurred on this content:" + voteContent); + request.getSession().setAttribute(USER_EXCEPTION_CONTENT_IN_USE, new Boolean(true).toString()); + persistError(request, "error.content.inUse"); + return (mapping.findForward(ERROR_LIST)); + + } } logger.debug("will get content for strToolContentId:" + strToolContentId); Index: lams_tool_vote/web/WEB-INF/struts-config.xml =================================================================== diff -u -rafd9f8463f033997ae0deaa55116a875d9da776f -rf92fcda740b6473979111a76d36f0b9180c06a86 --- lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision afd9f8463f033997ae0deaa55116a875d9da776f) +++ lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision f92fcda740b6473979111a76d36f0b9180c06a86) @@ -332,6 +332,12 @@ path="/monitoring/MonitoringMaincontent.jsp" redirect="false" /> + + @@ -89,17 +88,24 @@ submitMonitoringMethod(actionMethod); } - function deleteOption(deletableOptionIndex, actionMethod) { - document.VoteMonitoringForm.deletableOptionIndex.value=deletableOptionIndex; + function deleteOption(optIndex, actionMethod) { + document.VoteMonitoringForm.optIndex.value=optIndex; submitMethod(actionMethod); } function submitSession(selectedToolSessionId, actionMethod) { document.VoteMonitoringForm.selectedToolSessionId.value=selectedToolSessionId; submitMonitoringMethod(actionMethod); } + + + function submitModifyOption(optionIndexValue, actionMethod) + { + document.VoteMonitoringForm.optIndex.value=optionIndexValue; + submitMethod(actionMethod); + } + - var imgRoot="${lams}images/"; var themeName="aqua";