Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml =================================================================== diff -u -rae28185f07883077586773f760d1bde953e2d9bf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml (.../VoteUploadedFile.hbm.xml) (revision ae28185f07883077586773f760d1bde953e2d9bf) +++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteUploadedFile.hbm.xml (.../VoteUploadedFile.hbm.xml) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -9,48 +9,40 @@ name="org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile" table="tl_lavote11_uploadedfile" > + - + - - - + /> + - - - - + + + + Index: lams_tool_vote/db/model/lams_tool_vote.clay =================================================================== diff -u -r5399ff761841ef5f7a767b9df7828fdb4f783aa6 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision 5399ff761841ef5f7a767b9df7828fdb4f783aa6) +++ lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -211,80 +211,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -528,8 +454,8 @@ - + @@ -656,6 +582,80 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index: lams_tool_vote/db/sql/create_lams_tool_vote.sql =================================================================== diff -u -r5399ff761841ef5f7a767b9df7828fdb4f783aa6 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision 5399ff761841ef5f7a767b9df7828fdb4f783aa6) +++ lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -80,17 +80,18 @@ )TYPE=InnoDB; CREATE TABLE tl_lavote11_uploadedfile ( - uid BIGINT(20) NOT NULL AUTO_INCREMENT + submissionId BIGINT(20) NOT NULL AUTO_INCREMENT , uuid VARCHAR(255) NOT NULL - , vote_content_id BIGINT(20) NOT NULL , isOnline_File TINYINT(1) NOT NULL , filename VARCHAR(255) NOT NULL - , PRIMARY KEY (uid) + , vote_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (submissionId) , INDEX (vote_content_id) - , CONSTRAINT FK_tl_lavote11_uploadedfile_1 FOREIGN KEY (vote_content_id) + , CONSTRAINT FK_tablex_111 FOREIGN KEY (vote_content_id) REFERENCES tl_lavote11_content (uid) )TYPE=InnoDB; + INSERT INTO tl_lavote11_content(uid, content_id , title , instructions , creation_date , created_by , run_offline , define_later, offline_instructions, online_instructions, content_in_use, retries) VALUES (1, ${default_content_id} ,'Voting Title','Voting Instructions', NOW(), 1,0, 0, 'offline instructions','online instructions', 0, 0); INSERT INTO tl_lavote11_nomination_content (uid,nomination, display_order, vote_content_id) VALUES (1, 'Sample Nomination 1', 1, 1); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/EditActivityDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/EditActivityDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/EditActivityDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,69 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *

DTO that holds question and user attempts data for jsp purposes + *

+ * + * @author Ozgur Demirtas + */ +public class EditActivityDTO implements Comparable +{ + private String monitoredContentInUse; + + + /** + * @return Returns the monitoredContentInUse. + */ + public String getMonitoredContentInUse() { + return monitoredContentInUse; + } + /** + * @param monitoredContentInUse The monitoredContentInUse to set. + */ + public void setMonitoredContentInUse(String monitoredContentInUse) { + this.monitoredContentInUse = monitoredContentInUse; + } + public String toString() { + return new ToStringBuilder(this) + .append("monitoredContentInUse", monitoredContentInUse) + .toString(); + } + + public int compareTo(Object o) + { + EditActivityDTO editActivityDTO = (EditActivityDTO) o; + + if (editActivityDTO == null) + return 1; + else + return 0; + } + +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAllGroupsDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,104 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import java.util.List; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *

DTO that holds question and user attempts data for jsp purposes + *

+ * + * @author Ozgur Demirtas + */ +public class VoteAllGroupsDTO implements Comparable +{ + + private String sessionId; + + private String sessionName; + + private List groupData; + + + + public String toString() { + return new ToStringBuilder(this) + .append("sessionId:", sessionId) + .append("sessionName:", sessionName) + .append("groupData: ", groupData) + .toString(); + } + + public int compareTo(Object o) + { + VoteAllGroupsDTO qaAllGroupsDTO = (VoteAllGroupsDTO) o; + + if (qaAllGroupsDTO == null) + return 1; + else + return 0; + } + + + /** + * @return Returns the groupData. + */ + public List getGroupData() { + return groupData; + } + /** + * @param groupData The groupData to set. + */ + public void setGroupData(List groupData) { + this.groupData = groupData; + } + /** + * @return Returns the sessionName. + */ + public String getSessionName() { + return sessionName; + } + /** + * @param sessionName The sessionName to set. + */ + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + /** + * @param sessionId The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -74,6 +74,12 @@ public static final String SELECTED_TOOL_SESSION_ID ="selectedToolSessionId"; public static final String DEFAULT_VOTING_TITLE ="Voting Title"; public static final String DEFAULT_VOTING_INSTRUCTIONS ="Voting Instructions"; + public static final String NOTEBOOK_ENTRIES_EXIST ="notebookEntriesExist"; + public static final String NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST ="noSessionsNotebookEntriesExist"; + public static final String UUID ="uuid"; + public static final String VOTE_STATS_DTO ="voteStatsDTO"; + public static final String LIST_ALL_GROUPS_DTO ="listAllGroupsDTO"; + public static final String CURRENT_SESSION_NAME ="currentSessionName"; public static final String ATTACHMENT_LIST_KEY = "attachmentListKey"; public static final String DELETED_ATTACHMENT_LIST_KEY = "deletedAttachmentListKey"; @@ -82,6 +88,7 @@ public static final String VOTE_GENERAL_MONITORING_DTO = "voteGeneralMonitoringDTO"; public static final String LEARNER_NOTEBOOK ="learnerNotebook"; + public static final String AUTHORING ="authoring"; public static final String SOURCE_VOTE_STARTER ="sourceVoteStarter"; public static final String REMOVABLE_OPTION_INDEX ="removableOptionIndex"; @@ -95,11 +102,16 @@ public static final String VOTE_GENERAL_AUTHORING_DTO ="voteGeneralAuthoringDTO"; public static final String MAP_OPTIONS_CONTENT_KEY ="mapOptionsContentKey"; public static final String HTTP_SESSION_ID ="httpSessionID"; + public static final String LIST_NOMINATION_CONTENT_DTO = "listNominationContentDTO"; + public static final String LIST_NOMINATION_CONTENT_DTO_KEY = "listNominationContentDTOKey"; public static final String DEFAULT_ONLINE_INST ="online instructions"; public static final String DEFAULT_OFFLINE_INST ="offline instructions"; + public static final String ONLINE_INSTRUCTIONS ="onlineInstructions"; + public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions"; public static final String ONLINE_INSTRUCTIONS_KEY = "onlineInstructionsKey"; public static final String OFFLINE_INSTRUCTIONS_KEY = "offlineInstructionsKey"; + public static final String TOTAL_NOMINATION_COUNT = "totalNominationCount"; public static final String EXPORT_PORTFOLIO_DTO = "exportPortfolioDto"; public static final String NOTEBOOK ="notebook"; @@ -185,6 +197,8 @@ public static final String CREATION_DATE ="creationDate"; public static final String DEFINE_LATER ="defineLater"; public static final String VIEW_ANSWERS ="viewAnswers"; + + public static final String EDIT_ACTIVITY_DTO ="editActivityDTO"; public static final String REFLECT ="reflect"; public static final String ON ="ON"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralAuthoringDTO.java (.../VoteGeneralAuthoringDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -75,6 +75,22 @@ protected String validationError; protected String userExceptionOptionsDuplicate; protected String httpSessionID; + + protected String contentFolderID; + protected String editableQuestionText; + protected String editableQuestionFeedback; + + protected List attachmentList; + protected List deletedAttachmentList; + protected String reflect; + protected String reflectionSubject; + + protected Map mapNominationContent; + protected String editableNominationText; + protected String editableNominationFeedback; + protected String isToolSessionChanged; + protected String responseId; + protected String currentUid; /** @@ -514,13 +530,18 @@ public String toString() { return new ToStringBuilder(this) .append("activeModule: ", activeModule) + .append("contentFolderID: ", contentFolderID) + .append("editableQuestionText: ", editableQuestionText) .append("defineLaterInEditMode: ", defineLaterInEditMode) + .append("reflectionSubject: ", reflectionSubject) .append("submissionAttempt: ", submissionAttempt) + .append("mapNominationContent: ", mapNominationContent) .append("sbmtSuccess: ", sbmtSuccess) .append("exceptionMaxNominationInvalid: ", exceptionMaxNominationInvalid) .append("toolContentID: ", toolContentID) .append("defaultContentId: ", defaultContentId) - .append("defaultContentIdStr: ", defaultContentIdStr) + .append("defaultContentIdStr: ", defaultContentIdStr) + .append("reflect: ", reflect) .append("isDefineLater: ", isDefineLater) .append("allowText: ", allowText) .append("voteChangable: ", voteChangable) @@ -549,4 +570,162 @@ .append("editActivityEditMode: ", editActivityEditMode) .toString(); } + + /** + * @return Returns the contentFolderID. + */ + public String getContentFolderID() { + return contentFolderID; + } + /** + * @param contentFolderID The contentFolderID to set. + */ + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + /** + * @return Returns the editableQuestionFeedback. + */ + public String getEditableQuestionFeedback() { + return editableQuestionFeedback; + } + /** + * @param editableQuestionFeedback The editableQuestionFeedback to set. + */ + public void setEditableQuestionFeedback(String editableQuestionFeedback) { + this.editableQuestionFeedback = editableQuestionFeedback; + } + /** + * @return Returns the editableQuestionText. + */ + public String getEditableQuestionText() { + return editableQuestionText; + } + /** + * @param editableQuestionText The editableQuestionText to set. + */ + public void setEditableQuestionText(String editableQuestionText) { + this.editableQuestionText = editableQuestionText; + } + + /** + * @return Returns the attachmentList. + */ + public List getAttachmentList() { + return attachmentList; + } + /** + * @param attachmentList The attachmentList to set. + */ + public void setAttachmentList(List attachmentList) { + this.attachmentList = attachmentList; + } + /** + * @return Returns the deletedAttachmentList. + */ + public List getDeletedAttachmentList() { + return deletedAttachmentList; + } + /** + * @param deletedAttachmentList The deletedAttachmentList to set. + */ + public void setDeletedAttachmentList(List deletedAttachmentList) { + this.deletedAttachmentList = deletedAttachmentList; + } + /** + * @return Returns the reflect. + */ + public String getReflect() { + return reflect; + } + /** + * @param reflect The reflect to set. + */ + public void setReflect(String reflect) { + this.reflect = reflect; + } + /** + * @return Returns the reflectionSubject. + */ + public String getReflectionSubject() { + return reflectionSubject; + } + /** + * @param reflectionSubject The reflectionSubject to set. + */ + public void setReflectionSubject(String reflectionSubject) { + this.reflectionSubject = reflectionSubject; + } + /** + * @return Returns the editableNominationFeedback. + */ + public String getEditableNominationFeedback() { + return editableNominationFeedback; + } + /** + * @param editableNominationFeedback The editableNominationFeedback to set. + */ + public void setEditableNominationFeedback(String editableNominationFeedback) { + this.editableNominationFeedback = editableNominationFeedback; + } + /** + * @return Returns the editableNominationText. + */ + public String getEditableNominationText() { + return editableNominationText; + } + /** + * @param editableNominationText The editableNominationText to set. + */ + public void setEditableNominationText(String editableNominationText) { + this.editableNominationText = editableNominationText; + } + /** + * @return Returns the mapNominationContent. + */ + public Map getMapNominationContent() { + return mapNominationContent; + } + /** + * @param mapNominationContent The mapNominationContent to set. + */ + public void setMapNominationContent(Map mapNominationContent) { + this.mapNominationContent = mapNominationContent; + } + /** + * @return Returns the isToolSessionChanged. + */ + public String getIsToolSessionChanged() { + return isToolSessionChanged; + } + /** + * @param isToolSessionChanged The isToolSessionChanged to set. + */ + public void setIsToolSessionChanged(String isToolSessionChanged) { + this.isToolSessionChanged = isToolSessionChanged; + } + /** + * @return Returns the currentUid. + */ + public String getCurrentUid() { + return currentUid; + } + /** + * @param currentUid The currentUid to set. + */ + public void setCurrentUid(String currentUid) { + this.currentUid = currentUid; + } + /** + * @return Returns the responseId. + */ + public String getResponseId() { + return responseId; + } + /** + * @param responseId The responseId to set. + */ + public void setResponseId(String responseId) { + this.responseId = responseId; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java (.../VoteGeneralMonitoringDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteGeneralMonitoringDTO.java (.../VoteGeneralMonitoringDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -46,6 +46,7 @@ protected String userExceptionContentDoesNotExist; protected String userExceptionNoStudentActivity; protected String isMonitoredContentInUse; + protected String monitoredContentInUse; protected String activeModule; protected String currentTab; @@ -92,6 +93,15 @@ protected String completedSessionUserPercent; protected List mapStudentsVoted; + protected String onlineInstructions; + protected String offlineInstructions; + protected List attachmentList; + protected List deletedAttachmentList; + + protected String contentFolderID; + + + /** * @return Returns the listOfflineFilesMetadata. */ @@ -698,6 +708,7 @@ return new ToStringBuilder(this) .append("toolContentID: ", toolContentID) .append("activeModule: ", activeModule) + .append("monitoredContentInUse: ", monitoredContentInUse) .append("currentMonitoringTab: ", currentMonitoringTab) .append("selectionCase: ", selectionCase) .append("isToolSessionChanged: ", isToolSessionChanged) @@ -750,5 +761,79 @@ else return 0; } + + /** + * @return Returns the monitoredContentInUse. + */ + public String getMonitoredContentInUse() { + return monitoredContentInUse; + } + /** + * @param monitoredContentInUse The monitoredContentInUse to set. + */ + public void setMonitoredContentInUse(String monitoredContentInUse) { + this.monitoredContentInUse = monitoredContentInUse; + } + /** + * @return Returns the offlineInstructions. + */ + public String getOfflineInstructions() { + return offlineInstructions; + } + /** + * @param offlineInstructions The offlineInstructions to set. + */ + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + /** + * @return Returns the onlineInstructions. + */ + public String getOnlineInstructions() { + return onlineInstructions; + } + /** + * @param onlineInstructions The onlineInstructions to set. + */ + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + /** + * @return Returns the attachmentList. + */ + public List getAttachmentList() { + return attachmentList; + } + /** + * @param attachmentList The attachmentList to set. + */ + public void setAttachmentList(List attachmentList) { + this.attachmentList = attachmentList; + } + /** + * @return Returns the contentFolderID. + */ + public String getContentFolderID() { + return contentFolderID; + } + /** + * @param contentFolderID The contentFolderID to set. + */ + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + /** + * @return Returns the deletedAttachmentList. + */ + public List getDeletedAttachmentList() { + return deletedAttachmentList; + } + /** + * @param deletedAttachmentList The deletedAttachmentList to set. + */ + public void setDeletedAttachmentList(List deletedAttachmentList) { + this.deletedAttachmentList = deletedAttachmentList; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java (.../VoteMonitoredAnswersDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredAnswersDTO.java (.../VoteMonitoredAnswersDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -46,6 +46,34 @@ private Map questionAttempts; + private String sessionId; + + private String sessionName; + + /** + * @return Returns the sessionId. + */ + public String getSessionId() { + return sessionId; + } + /** + * @param sessionId The sessionId to set. + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + /** + * @return Returns the sessionName. + */ + public String getSessionName() { + return sessionName; + } + /** + * @param sessionName The sessionName to set. + */ + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } /** * @return Returns the candidateAnswers. */ Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java (.../VoteMonitoredUserDTO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteMonitoredUserDTO.java (.../VoteMonitoredUserDTO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -59,6 +59,10 @@ private String questionUid; private Map usersAttempts; + + private String responsePresentable; + + /** * @return Returns the queUsrId. @@ -220,4 +224,16 @@ public void setAttemptTime(Date attemptTime) { this.attemptTime = attemptTime; } + /** + * @return Returns the responsePresentable. + */ + public String getResponsePresentable() { + return responsePresentable; + } + /** + * @param responsePresentable The responsePresentable to set. + */ + public void setResponsePresentable(String responsePresentable) { + this.responsePresentable = responsePresentable; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteNominationContentDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,107 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import org.apache.commons.lang.builder.ToStringBuilder; + + + +/** + *

Votes dto + *

+ * + * @author Ozgur Demirtas + */ +public class VoteNominationContentDTO implements Comparable +{ + private String question; + private String displayOrder; + private String feedback; + + public String toString() { + return new ToStringBuilder(this) + .append("question:", question) + .append("feedback:", feedback) + .append("displayOrder:", displayOrder) + .toString(); + } + + public int compareTo(Object o) + { + VoteMonitoredUserDTO voteMonitoredUserDTO = (VoteMonitoredUserDTO) o; + + if (voteMonitoredUserDTO == null) + return 1; + else + return 0; + } + /** + * @return Returns the displayOrder. + */ + public String getDisplayOrder() { + return displayOrder; + } + /** + * @param displayOrder The displayOrder to set. + */ + public void setDisplayOrder(String displayOrder) { + this.displayOrder = displayOrder; + } + /** + * @return Returns the feedback. + */ + public String getFeedback() { + return feedback; + } + /** + * @param feedback The feedback to set. + */ + public void setFeedback(String feedback) { + this.feedback = feedback; + } + /** + * @return Returns the question. + */ + public String getNomination() { + return question; + } + /** + * @param question The question to set. + */ + public void setNomination(String question) { + this.question = question; + } + /** + * @return Returns the question. + */ + public String getQuestion() { + return question; + } + /** + * @param question The question to set. + */ + public void setQuestion(String question) { + this.question = question; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java =================================================================== diff -u --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java (revision 0) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteStatsDTO.java (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,84 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.vote; + +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + *

DTO that holds stats data + *

+ * + * @author Ozgur Demirtas + */ +public class VoteStatsDTO implements Comparable +{ + private String countAllUsers; + + private String countSessionComplete; + + public String toString() { + return new ToStringBuilder(this) + .append("question", countAllUsers) + .append("countSessionComplete", countSessionComplete) + .toString(); + } + + public int compareTo(Object o) + { + VoteStatsDTO qaStatsDTO = (VoteStatsDTO) o; + + if (qaStatsDTO == null) + return 1; + else + return 0; + } + + + /** + * @return Returns the countAllUsers. + */ + public String getCountAllUsers() { + return countAllUsers; + } + /** + * @param countAllUsers The countAllUsers to set. + */ + public void setCountAllUsers(String countAllUsers) { + this.countAllUsers = countAllUsers; + } + /** + * @return Returns the countSessionComplete. + */ + public String getCountSessionComplete() { + return countSessionComplete; + } + /** + * @param countSessionComplete The countSessionComplete to set. + */ + public void setCountSessionComplete(String countSessionComplete) { + this.countSessionComplete = countSessionComplete; + } +} Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,6 +23,7 @@ package org.lamsfoundation.lams.tool.vote; import java.text.DateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; @@ -36,6 +37,7 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; +import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.web.VoteAuthoringForm; import org.lamsfoundation.lams.usermanagement.User; @@ -63,7 +65,26 @@ return newText; } + public static String getCurrentLearnerID() + { + String userID = ""; + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + + if (ss != null) + { + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user != null) && (user.getUserID() != null)) + { + userID = user.getUserID().toString(); + logger.debug("retrieved userId: " + userID); + } + } + return userID; + } + + /** * * getGMTDateTime(HttpServletRequest request) @@ -539,4 +560,154 @@ request.getSession().removeAttribute(USER_EXCEPTION_WEIGHT_MUST_EQUAL100); request.getSession().removeAttribute(USER_EXCEPTION_SINGLE_OPTION); } + + + + public static void setFormProperties(HttpServletRequest request, IVoteService voteService, + VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO, String strToolContentID, + String defaultContentIdStr, String activeModule, SessionMap sessionMap, String httpSessionID) + { + logger.debug("setFormProperties: "); + logger.debug("using strToolContentID: " + strToolContentID); + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + logger.debug("using activeModule: " + activeModule); + logger.debug("using httpSessionID: " + httpSessionID); + + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + + voteAuthoringForm.setToolContentID(strToolContentID); + + if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) + voteAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); + + voteAuthoringForm.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + String voteChangable=request.getParameter("voteChangable"); + logger.debug("voteChangable: " + voteChangable); + voteAuthoringForm.setVoteChangable(voteChangable); + voteGeneralAuthoringDTO.setVoteChangable(voteChangable); + + String lockOnFinish=request.getParameter("lockOnFinish"); + logger.debug("lockOnFinish: " + lockOnFinish); + voteAuthoringForm.setLockOnFinish(lockOnFinish); + voteGeneralAuthoringDTO.setLockOnFinish(lockOnFinish); + + String allowText=request.getParameter("allowText"); + logger.debug("allowText: " + allowText); + voteAuthoringForm.setAllowText(allowText); + voteGeneralAuthoringDTO.setAllowText(allowText); + + String maxNominationCount=request.getParameter("maxNominationCount"); + logger.debug("maxNominationCount: " + maxNominationCount); + voteAuthoringForm.setMaxNominationCount(maxNominationCount); + voteGeneralAuthoringDTO.setMaxNominationCount(maxNominationCount); + + String reflect=request.getParameter("reflect"); + logger.debug("reflect: " + maxNominationCount); + voteAuthoringForm.setReflect(reflect); + voteGeneralAuthoringDTO.setReflect(reflect); + + String reflectionSubject=request.getParameter("reflectionSubject"); + logger.debug("reflectionSubject: " + reflectionSubject); + voteAuthoringForm.setReflectionSubject(reflectionSubject); + voteGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + + + String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + voteAuthoringForm.setOfflineInstructions(offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + logger.debug("onlineInstructions: " + onlineInstructions); + voteAuthoringForm.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + logger.debug("ending setFormProperties with voteAuthoringForm: " + voteAuthoringForm); + logger.debug("ending setFormProperties with voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + } + + + public static void setDefineLater(HttpServletRequest request, boolean value, String strToolContentID, IVoteService voteService) + { + logger.debug("voteService: " + voteService); + logger.debug("value:" + value); + logger.debug("strToolContentID:" + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + + logger.debug("voteContent:" + voteContent); + if (voteContent != null) + { + voteContent.setDefineLater(value); + logger.debug("defineLater has been set to:" + value); + voteService.updateVote(voteContent); + } + } + + + + /** If this file exists in attachments map, move it to the deleted attachments map. + * Returns the updated deletedAttachments map, creating a new one if needed. If uuid supplied + * then tries to match on that, otherwise uses filename and isOnline. */ + public static List moveToDelete(String uuid, List attachmentsList, List deletedAttachmentsList ) { + + logger.debug("doing moveToDelete: " + attachmentsList); + logger.debug("doing moveToDelete: " + deletedAttachmentsList); + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); + + logger.debug("deletedList: " + deletedList); + + if ( attachmentsList != null ) { + logger.debug("attachmentsList not null: " + attachmentsList); + Iterator iter = attachmentsList.iterator(); + VoteUploadedFile attachment = null; + while ( iter.hasNext() && attachment == null ) { + VoteUploadedFile value = (VoteUploadedFile) iter.next(); + logger.debug("value: " + value); + + if ( uuid.equals(value.getUuid()) ) { + logger.debug("value made attachment:"); + attachment = value; + } + + } + if ( attachment != null ) { + logger.debug("attachment not null"); + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + logger.debug("final attachmentsList: " + attachmentsList); + logger.debug("final deletedAttachmentsList: " + deletedAttachmentsList); + return deletedList; + } + + + public static List moveToDelete(String filename, boolean isOnline, List attachmentsList, List deletedAttachmentsList ) { + + List deletedList = deletedAttachmentsList != null ? deletedAttachmentsList : new ArrayList(); + + if ( attachmentsList != null ) { + Iterator iter = attachmentsList.iterator(); + VoteUploadedFile attachment = null; + while ( iter.hasNext() && attachment == null ) { + VoteUploadedFile value = (VoteUploadedFile) iter.next(); + if ( filename.equals(value.getFileName()) && isOnline == value.isFileOnline()) { + attachment = value; + } + + } + if ( attachment != null ) { + deletedList.add(attachment); + attachmentsList.remove(attachment); + } + } + + return deletedList; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteContentDAO.java (.../IVoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -35,21 +35,23 @@ public interface IVoteContentDAO { public VoteContent getVoteContentByUID(Long uid); - public VoteContent findVoteContentById(Long mcContentId); + public VoteContent findVoteContentById(Long voteContentId); - public VoteContent getVoteContentBySession(Long mcSessionId); + public VoteContent getVoteContentBySession(Long voteSessionId); - public void saveVoteContent(VoteContent mcContent); + public void saveVoteContent(VoteContent voteContent); - public void updateVoteContent(VoteContent mcContent); + public void updateVoteContent(VoteContent voteContent); + + public void saveOrUpdateVote(VoteContent voteContent); - public void removeVote(VoteContent mcContent); + public void removeVote(VoteContent voteContent); - public void removeVoteById(Long mcContentId); + public void removeVoteById(Long voteContentId); - public void removeVoteSessions(VoteContent mcContent); + public void removeVoteSessions(VoteContent voteContent); - public void addVoteSession(Long mcContentId, VoteSession mcSession); + public void addVoteSession(Long voteContentId, VoteSession voteSession); public List findAll(Class objClass); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -63,5 +63,7 @@ public void removeVoteQueContent(VoteQueContent voteQueContent); + public List getAllQuestionEntriesSorted(final long voteContentId); + public void flush(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java (.../IVoteUploadedFileDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUploadedFileDAO.java (.../IVoteUploadedFileDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,60 +23,34 @@ import java.util.List; +import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; /** * @author Ozgur Demirtas * *

Interface that defines the contract for IVoteUploadedFile access

*/ + public interface IVoteUploadedFileDAO { - public VoteUploadedFile getUploadedFileById(long submissionId); - - public VoteUploadedFile loadUploadedFileById(long uid); - - public void updateUploadFile(VoteUploadedFile voteUploadedFile); - - public void saveUploadFile(VoteUploadedFile voteUploadedFile); - - public void createUploadFile(VoteUploadedFile voteUploadedFile); - - public void UpdateUploadFile(VoteUploadedFile voteUploadedFile); + public VoteUploadedFile loadUploadedFileById(long submissionId); - public void removeOffLineFile(String filename, Long voteContentId); + public void updateUploadFile(VoteUploadedFile voteUploadedFile); + + public void saveUploadFile(VoteUploadedFile voteUploadedFile); + + public void createUploadFile(VoteUploadedFile voteUploadedFile); + + public void UpdateUploadFile(VoteUploadedFile voteUploadedFile); - public void removeOnLineFile(String filename, Long voteContentId); - - public boolean isOffLineFilePersisted(String filename); - - public boolean isOnLineFilePersisted(String filename); - - public List getOnlineFilesMetaData(Long voteContentId); - - public List getOfflineFilesMetaData(Long voteContentId); - - public boolean isUuidPersisted(String uuid); - - public void cleanUploadedFilesMetaData(); - - public String getFileUuid(String filename); - - public void removeUploadFile(Long uid); - - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline); - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId); - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId); - - public List retrieveVoteUploadedOfflineFilesUuidPlusFilename(Long voteContentId); - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId); - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId); - - public void deleteUploadFile(VoteUploadedFile voteUploadedFile); - - public void flush(); + public void removeUploadFile(Long submissionId); + + public void deleteUploadFile(VoteUploadedFile voteUploadedFile); + + public List retrieveVoteUploadedFiles(VoteContent vote); + + public void cleanUploadedFilesMetaData(); + + public void flush(); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteUsrAttemptDAO.java (.../IVoteUsrAttemptDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -84,7 +84,7 @@ public int getLastNominationCount(Long userId); - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); + //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId); @@ -101,6 +101,8 @@ public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId); public Set getAttemptsForUserAndSessionUseOpenAnswer(final Long queUsrId, final Long voteSessionId); + + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteContentDAO.java (.../VoteContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -53,6 +53,14 @@ return (VoteContent) this.getHibernateTemplate().get(VoteContent.class, uid); } + public void saveOrUpdateVote(VoteContent vote) + { + this.getSession().setFlushMode(FlushMode.AUTO); + logger.debug("before saveOrUpdateVote: " + vote); + this.getHibernateTemplate().saveOrUpdate(vote); + } + + public VoteContent findVoteContentById(Long voteContentId) { String query = "from VoteContent as vote where vote.voteContentId = ?"; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -48,6 +48,8 @@ private static final String LOAD_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from voteQueContent in class VoteQueContent where voteQueContent.displayOrder=:displayOrder and voteQueContent.voteContentId=:voteContentUid"; + private static final String SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER = "from voteQueContent in class VoteQueContent where voteQueContent.voteContentId=:voteContentId order by voteQueContent.displayOrder"; + public VoteQueContent getVoteQueContentByUID(Long uid) { @@ -197,6 +199,18 @@ } + public List getAllQuestionEntriesSorted(final long voteContentId) + { + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(SORT_QUESTION_CONTENT_BY_DISPLAY_ORDER) + .setLong("voteContentId", voteContentId) + .list(); + + return list; + } + + + public void saveVoteQueContent(VoteQueContent voteQueContent) { this.getHibernateTemplate().save(voteQueContent); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java (.../VoteUploadedFileDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUploadedFileDAO.java (.../VoteUploadedFileDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -28,6 +28,7 @@ import org.apache.log4j.Logger; import org.hibernate.FlushMode; import org.lamsfoundation.lams.tool.vote.dao.IVoteUploadedFileDAO; +import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; @@ -37,44 +38,29 @@ * @author ozgurd *

Hibernate implementation for database access to VoteUploadedFile for the voting tool.

*/ + + public class VoteUploadedFileDAO extends HibernateDaoSupport implements IVoteUploadedFileDAO { static Logger logger = Logger.getLogger(VoteUploadedFileDAO.class.getName()); + - private static final String GET_ONLINE_FILENAMES_FOR_CONTENT = "select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - private static final String GET_OFFLINE_FILENAMES_FOR_CONTENT = "select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; + private static final String GET_UPLOADED_FILES = "from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContent.voteContentId = :contentId"; + + private static final String DELETE_FILES_META_DATA = "from voteUploadedFile in class VoteUploadedFile"; - private static final String GET_ONLINE_FILES_UUID = "select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - private static final String GET_ONLINE_FILES_NAME ="select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1 order by voteUploadedFile.uuid"; - - private static final String GET_OFFLINE_FILES_UUID = "select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - private static final String GET_OFFLINE_FILES_NAME ="select voteUploadedFile.filename from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0 order by voteUploadedFile.uuid"; - - private static final String GET_FILES_UUID ="select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.filename=:filename"; - - private static final String GET_OFFLINE_FILES_UUIDPLUSFILENAME = "select (voteUploadedFile.uuid + '~' + voteUploadedFile.filename) from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - - private static final String FIND_ALL_UPLOADED_FILE_DATA = "from voteUploadedFile in class VoteUploadedFile"; - - private static final String IS_UUID_PERSISTED ="select voteUploadedFile.uuid from VoteUploadedFile voteUploadedFile where voteUploadedFile.uuid=:uuid"; - - private static final String GET_ONLINE_FILES_METADATA = "from voteUploadedFile in class VoteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=1"; - - private static final String GET_OFFLINE_FILES_METADATA = "from voteUploadedFile in class VoteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.fileOnline=0"; - - private static final String IS_OFFLINE_FILENAME_PERSISTED ="select voteUploadedFile from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.filename=:filename and voteUploadedFile.fileOnline=0"; - - private static final String IS_ONLINE_FILENAME_PERSISTED ="select voteUploadedFile from VoteUploadedFile voteUploadedFile where voteUploadedFile.voteContentId = :voteContentId and voteUploadedFile.filename=:filename and voteUploadedFile.fileOnline=1"; - - public VoteUploadedFile getUploadedFileById(long submissionId) { return (VoteUploadedFile) this.getHibernateTemplate() .load(VoteUploadedFile.class, new Long(submissionId)); } - public VoteUploadedFile loadUploadedFileById(long uid) + /** + * + * return null if not found + */ + public VoteUploadedFile loadUploadedFileById(long submissionId) { - return (VoteUploadedFile) this.getHibernateTemplate().get(VoteUploadedFile.class, new Long(uid)); + return (VoteUploadedFile) this.getHibernateTemplate().get(VoteUploadedFile.class, new Long(submissionId)); } @@ -83,15 +69,13 @@ { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().update(voteUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); } public void saveUploadFile(VoteUploadedFile voteUploadedFile) { this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().save(voteUploadedFile); - this.getSession().setFlushMode(FlushMode.AUTO); } public void createUploadFile(VoteUploadedFile voteUploadedFile) @@ -107,245 +91,47 @@ } - public void removeOffLineFile(String filename, Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_OFFLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); - templ.flush(); - } - } - } - - public void removeOnLineFile(String filename, Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_ONLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - if(list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); - this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); - templ.flush(); - } - } - } - - public boolean isOffLineFilePersisted(String filename) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_OFFLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - - public boolean isOnLineFilePersisted(String filename) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_ONLINE_FILENAME_PERSISTED) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - - public List getOnlineFilesMetaData(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_METADATA) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List getOfflineFilesMetaData(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_METADATA) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public boolean isUuidPersisted(String uuid) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(IS_UUID_PERSISTED) - .setString("uuid", uuid) - .list(); - - if (list != null && list.size() > 0) - { - return true; - } - return false; - } - - public void cleanUploadedFilesMetaData() { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(FIND_ALL_UPLOADED_FILE_DATA) + HibernateTemplate templ = this.getHibernateTemplate(); + List list = getSession().createQuery(DELETE_FILES_META_DATA) .list(); if(list != null && list.size() > 0){ Iterator listIterator=list.iterator(); while (listIterator.hasNext()) { - VoteUploadedFile voteFile=(VoteUploadedFile)listIterator.next(); + VoteUploadedFile mcFile=(VoteUploadedFile)listIterator.next(); this.getSession().setFlushMode(FlushMode.AUTO); - templ.delete(voteFile); + templ.delete(mcFile); templ.flush(); } } } - - public String getFileUuid(String filename) + public void removeUploadFile(Long submissionId) { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_FILES_UUID) - .setString("filename", filename) - .list(); - - if (list != null && list.size() > 0){ - Iterator listIterator=list.iterator(); - while (listIterator.hasNext()) - { - String uuid=(String)listIterator.next(); - logger.debug("uuid :" + uuid); - return uuid; - } - } - else - { - return null; - } - return null; - } - - - public void removeUploadFile(Long uid) - { - if (uid != null ) { + if (submissionId != null ) { - String query = "from uploadedFile in class org.lamsfoundation.lams.tool.vote.VoteUploadedFile" - + " where uploadedFile.uid = ?"; + String query = "from uploadedFile in class org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile" + + " where uploadedFile.submissionId = ?"; Object obj = this.getSession().createQuery(query) - .setLong(0,uid.longValue()) + .setLong(0,submissionId.longValue()) .uniqueResult(); if ( obj != null ) { + this.getSession().setFlushMode(FlushMode.AUTO); this.getHibernateTemplate().delete(obj); } } } - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) + public List retrieveVoteUploadedFiles(VoteContent vote) { List listFilenames=null; - - if (fileOnline) - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILENAMES_FOR_CONTENT, - "voteContentId", - voteContentId)); - } - else - { - listFilenames=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILENAMES_FOR_CONTENT, - "voteContentId", - voteContentId)); - } + listFilenames=(getHibernateTemplate().findByNamedParam(GET_UPLOADED_FILES, "contentId", vote.getVoteContentId())); return listFilenames; } - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUID) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - - return list; - } - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_UUID) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - public List retrieveVoteUploadedOfflineFilesUuidPlusFilename(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_UUIDPLUSFILENAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_OFFLINE_FILES_NAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) - { - HibernateTemplate templ = this.getHibernateTemplate(); - List list = getSession().createQuery(GET_ONLINE_FILES_NAME) - .setLong("voteContentId", voteContentId.longValue()) - .list(); - - return list; - } - - public void deleteUploadFile(VoteUploadedFile voteUploadedFile) { this.getSession().setFlushMode(FlushMode.AUTO); @@ -356,4 +142,5 @@ { this.getHibernateTemplate().flush(); } + } \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteUsrAttemptDAO.java (.../VoteUsrAttemptDAO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -443,24 +443,18 @@ } - - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) { HibernateTemplate templ = this.getHibernateTemplate(); List list = getSession().createQuery(LOAD_ATTEMPT_FOR_USER_AND_QUESTION_CONTENT) .setLong("queUsrId", queUsrId.longValue()) .setLong("voteQueContentId", voteQueContentId.longValue()) .list(); - if(list != null && list.size() > 0){ - VoteUsrAttempt voteA = (VoteUsrAttempt) list.get(0); - return voteA; - } - - return null; + return list; } - + public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long voteSessionId) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteContent.java (.../VoteContent.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -369,6 +369,9 @@ * @return Returns the voteAttachments. */ public Set getVoteAttachments() { + if(voteAttachments == null) + voteAttachments = new TreeSet(); + return voteAttachments; } /** Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java (.../VoteUploadedFile.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/pojos/VoteUploadedFile.java (.../VoteUploadedFile.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -25,6 +25,8 @@ import java.io.Serializable; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.log4j.Logger; import org.lamsfoundation.lams.contentrepository.ItemNotFoundException; @@ -43,9 +45,8 @@ public class VoteUploadedFile implements Serializable, Comparable { static Logger logger = Logger.getLogger(VoteUploadedFile.class.getName()); - /** identifier field */ - private Long uid; + private Long submissionId; /** persistent field */ private String uuid; @@ -54,71 +55,46 @@ private boolean fileOnline; /** persistent field */ - private String filename; + private String fileName; - - private Long voteContentId; - /** persistent field */ private VoteContent voteContent; public VoteUploadedFile(){}; /** full constructor */ - public VoteUploadedFile(Long uid, + public VoteUploadedFile(Long submissionId, String uuid, boolean fileOnline, - String filename, + String fileName, VoteContent voteContent) { - this.uid=uid; + this.submissionId=submissionId; this.uuid = uuid; this.fileOnline = fileOnline; - this.filename = filename; + this.fileName = fileName; this.voteContent=voteContent; } - - public VoteUploadedFile(String uuid, - boolean fileOnline, - String filename, - VoteContent voteContent) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.voteContent=voteContent; - } - public VoteUploadedFile(String uuid, - boolean fileOnline, - String filename, - Long voteContentId) - { - this.uuid = uuid; - this.fileOnline = fileOnline; - this.filename = filename; - this.voteContentId=voteContentId; - } - - public static VoteUploadedFile newInstance(IToolContentHandler toolContentHandler, VoteUploadedFile mcUploadedFile, + public static VoteUploadedFile newInstance(IToolContentHandler toolContentHandler, VoteUploadedFile voteUploadedFile, VoteContent newMcContent) throws ItemNotFoundException, RepositoryCheckedException { VoteUploadedFile newMcUploadedFile=null; try { - String fileUuid = mcUploadedFile.getUuid(); + String fileUuid = voteUploadedFile.getUuid(); if(toolContentHandler != null){ - NodeKey copiedNodeKey = toolContentHandler.copyFile(new Long(mcUploadedFile.getUuid())); + NodeKey copiedNodeKey = toolContentHandler.copyFile(new Long(voteUploadedFile.getUuid())); logger.debug("copied NodeKey: " + copiedNodeKey); logger.debug("copied NodeKey uuid: " + copiedNodeKey.getUuid().toString()); fileUuid = copiedNodeKey.getUuid().toString(); } newMcUploadedFile = new VoteUploadedFile(fileUuid, - mcUploadedFile.isFileOnline(), - mcUploadedFile.getFilename(), + voteUploadedFile.isFileOnline(), + voteUploadedFile.getFileName(), newMcContent); } @@ -131,24 +107,79 @@ } + + public VoteUploadedFile(String uuid, + boolean fileOnline, + String fileName, + VoteContent voteContent) + { + logger.debug("constructor gets called."); + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.voteContent=voteContent; + } + + public String toString() { return new ToStringBuilder(this) .append("uuid: ", getUuid()) + .append("fileName: ", getFileName()) .toString(); } + + public boolean equals(Object other) { + if ( !(other instanceof VoteUploadedFile) ) return false; + VoteUploadedFile castOther = (VoteUploadedFile) other; + return new EqualsBuilder() + .append(this.getUuid(), castOther.getUuid()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getUuid()) + .toHashCode(); + } + + /** + * @return Returns the fileName. + */ + public String getFileName() { + return fileName; + } + /** + * @param fileName The fileName to set. + */ + public void setFileName(String fileName) { + this.fileName = fileName; + } /** - * @return Returns the uid. + * @return Returns the voteContent. */ + public VoteContent getVoteContent() { + return voteContent; + } + /** + * @param voteContent The voteContent to set. + */ + public void setVoteContent(VoteContent voteContent) { + this.voteContent = voteContent; + } + + /** + * @return Returns the submissionId. + */ public Long getSubmissionId() { - return uid; + return submissionId; } /** - * @param uid The uid to set. + * @param submissionId The submissionId to set. */ - public void setSubmissionId(Long uid) { - this.uid = uid; + public void setSubmissionId(Long submissionId) { + this.submissionId = submissionId; } /** * @return Returns the uuid. @@ -174,65 +205,16 @@ public void setFileOnline(boolean fileOnline) { this.fileOnline = fileOnline; } - /** - * @return Returns the uid. - */ - public Long getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(Long uid) { - this.uid = uid; - } - /** - * @return Returns the filename. - */ - public String getFilename() { - return filename; - } - /** - * @param filename The filename to set. - */ - public void setFilename(String filename) { - this.filename = filename; - } public int compareTo(Object o) { - VoteUploadedFile optContent = (VoteUploadedFile) o; + VoteUploadedFile file = (VoteUploadedFile) o; //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. - if (uid == null) + if (submissionId == null) return 1; else - return (int) (uid.longValue() - optContent.uid.longValue()); + return (int) (submissionId.longValue() - file.submissionId.longValue()); } - /** - * @return Returns the voteContentId. - */ - public Long getVoteContentId() { - return voteContentId; - } - /** - * @param voteContentId The voteContentId to set. - */ - public void setVoteContentId(Long voteContentId) { - this.voteContentId = voteContentId; - } - /** - * @return Returns the voteContent. - */ - public VoteContent getVoteContent() { - return voteContent; - } - /** - * @param voteContent The voteContent to set. - */ - public void setVoteContent(VoteContent voteContent) { - this.voteContent = voteContent; - } - public String getFileProperty() { if (isFileOnline()) { Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueUsr; import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; +import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.usermanagement.User; @@ -120,8 +121,10 @@ public int getUserRecordsEntryCount(final String userEntry) throws VoteApplicationException; - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException; + //public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException; + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long qaQueContentId) throws VoteApplicationException; + public VoteUsrAttempt getAttemptsForUserAndQuestionContentAndSession(final Long queUsrId, final Long voteQueContentId, final Long toolSessionUid) throws VoteApplicationException; public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException; @@ -249,18 +252,6 @@ public InputStream downloadFile(Long uuid, Long versionID) throws VoteApplicationException; - public String getFileUuid(String filename) throws VoteApplicationException; - - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) throws VoteApplicationException; - - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) throws VoteApplicationException; - public void cleanUploadedFilesMetaData() throws VoteApplicationException; public void persistFile(String uuid, boolean isOnlineFile, String fileName, VoteContent voteContent) throws VoteApplicationException; @@ -279,20 +270,8 @@ public NodeKey copyFile(Long uuid) throws RepositoryCheckedException; - public void removeOffLineFile(String filename, Long voteContentId) throws VoteApplicationException; + public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException; - public void removeOnLineFile(String filename, Long voteContentId) throws VoteApplicationException; - - public boolean isOffLineFilePersisted(String filename) throws VoteApplicationException; - - public boolean isOnLineFilePersisted(String filename) throws VoteApplicationException; - - public boolean isUuidPersisted(String uuid) throws VoteApplicationException; - - public List getOnlineFilesMetaData(Long voteContentId) throws VoteApplicationException; - - public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException; - public List getSessionsFromContent(VoteContent mcContent) throws VoteApplicationException; public Set getAttemptsForUserAndSession(final Long queUsrId, final Long voteSessionId) throws VoteApplicationException; @@ -304,6 +283,10 @@ public NotebookEntry getEntry(Long id, Integer idType, String signature, Integer userID); - + public void removeFile(Long submissionId) throws VoteApplicationException; + + public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException; + + public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -58,10 +58,12 @@ import org.lamsfoundation.lams.tool.ToolContentManager; import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.lamsfoundation.lams.tool.vote.util.VoteToolContentHandler; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; import org.lamsfoundation.lams.tool.exception.ToolException; + import org.lamsfoundation.lams.tool.service.ILamsToolService; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; @@ -100,10 +102,11 @@ { static Logger logger = Logger.getLogger(VoteServicePOJO.class.getName()); - /*repository access related constants */ - private final String repositoryUser = "vote11"; - private final char[] repositoryId = {'v','o','t','e','_','1', '1'}; - private final String repositoryWorkspace = "vote11"; + private static String repositoryWorkspaceName = "vote11"; + private final String repositoryUser = "vote11"; + private final char[] repositoryId = {'v','o','t','e','_','1', '1'}; + + private IRepositoryService repositoryService; private ICredentials cred; @@ -133,7 +136,7 @@ { repositoryService.createCredentials(cred); logger.debug("created credentails."); - repositoryService.addWorkspace(cred,repositoryWorkspace); + repositoryService.addWorkspace(cred,repositoryWorkspaceName); logger.debug("created workspace."); } catch (ItemExistsException ie) { logger.warn("Tried to configure repository but it " @@ -147,6 +150,7 @@ } + public void createVote(VoteContent voteContent) throws VoteApplicationException { try @@ -739,24 +743,9 @@ e); } } - - public VoteUsrAttempt getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException - { - try - { - return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is getting vote UsrAttempt by user id and que content id: " - + e.getMessage(), - e); - } - } - public List getUserRecords(final String userEntry) throws VoteApplicationException { try @@ -1362,6 +1351,21 @@ } + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long voteQueContentId) throws VoteApplicationException + { + try + { + return voteUsrAttemptDAO.getAttemptsForUserAndQuestionContent(queUsrId, voteQueContentId); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is getting vote voteUsrRespDAO by user id and que content id: " + + e.getMessage(), + e); + } + } + + /** * checks the parameter content in the user responses table * @param voteContent @@ -1410,7 +1414,6 @@ public int countIncompleteSession(VoteContent vote) throws VoteApplicationException { - //int countIncompleteSession=voteSessionDAO.countIncompleteSession(vote); int countIncompleteSession=2; return countIncompleteSession; } @@ -1426,7 +1429,7 @@ */ public boolean studentActivityOccurred(VoteContent vote) throws VoteApplicationException { - //int countStudentActivity=voteSessionDAO.studentActivityOccurred(vote); + int countStudentActivity=2; if (countStudentActivity > 0) @@ -2060,12 +2063,13 @@ repositoryService = RepositoryProxy.getRepositoryService(); logger.debug("retrieved repositoryService : " + repositoryService); + ICredentials credentials = new SimpleCredentials( repositoryUser, repositoryId); try { ITicket ticket = repositoryService.login(credentials, - repositoryWorkspace); + repositoryWorkspaceName); logger.debug("retrieved ticket: " + ticket); return ticket; } catch (AccessDeniedException e) { @@ -2080,6 +2084,7 @@ } + /** * This method deletes the content with the given uuid and * versionID from the content repository @@ -2104,7 +2109,9 @@ } } + + /** * This method is called everytime a new content has to be added to the * repository. In order to do so first of all a valid ticket is obtained @@ -2153,94 +2160,8 @@ } - public void removeOffLineFile(String filename, Long voteContentId) throws VoteApplicationException - { - try - { - voteUploadedFileDAO.removeOffLineFile(filename, voteContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is removing offline filename" - + e.getMessage(), - e); - } - } - - public void removeOnLineFile(String filename, Long voteContentId) throws VoteApplicationException - { - try - { - voteUploadedFileDAO.removeOnLineFile(filename, voteContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is removing online filename" - + e.getMessage(), - e); - } - } - public boolean isOffLineFilePersisted(String filename) throws VoteApplicationException - { - try - { - return voteUploadedFileDAO.isOffLineFilePersisted(filename); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is checking if offline filename is persisted: " - + e.getMessage(), - e); - } - } - - public boolean isOnLineFilePersisted(String filename) throws VoteApplicationException - { - try - { - return voteUploadedFileDAO.isOnLineFilePersisted(filename); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is checking if online filename is persisted: " - + e.getMessage(), - e); - } - } - - public String getFileUuid(String filename) throws VoteApplicationException - { - try - { - return voteUploadedFileDAO.getFileUuid(filename); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading uuid by filename: " - + e.getMessage(), - e); - } - } - - - public List getOnlineFilesMetaData(Long voteContentId) throws VoteApplicationException - { - return voteUploadedFileDAO.getOnlineFilesMetaData(voteContentId); - } - - - public List getOfflineFilesMetaData(Long voteContentId) throws VoteApplicationException - { - return voteUploadedFileDAO.getOfflineFilesMetaData(voteContentId); - } - - public boolean isUuidPersisted(String uuid) throws VoteApplicationException - { - return voteUploadedFileDAO.isUuidPersisted(uuid); - } - /** * adds a new entry to the uploaded files table */ @@ -2263,74 +2184,148 @@ logger.debug("files meta data has been cleaned up"); } + - public List retrieveVoteUploadedFiles(Long voteContentId, boolean fileOnline) throws VoteApplicationException { - try - { - return voteUploadedFileDAO.retrieveVoteUploadedFiles(voteContentId, fileOnline); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: " - + e.getMessage(), - e); - } - } + /* ===============Methods implemented from ToolContentImport102Manager =============== */ + - public List retrieveVoteUploadedOfflineFilesUuid(Long voteContentId) throws VoteApplicationException { - try - { - return voteUploadedFileDAO.retrieveVoteUploadedOfflineFilesUuid(voteContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: offline + uuids " - + e.getMessage(), - e); - } + /** + * Import the data for a 1.0.2 Chat + */ + public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) + { + Date now = new Date(); + VoteContent toolContentObj = new VoteContent(); + toolContentObj.setContentInUse(Boolean.FALSE); + toolContentObj.setCreatedBy(user.getUserID().longValue()); + toolContentObj.setCreationDate(now); + toolContentObj.setDefineLater(Boolean.FALSE); + toolContentObj.setInstructions((String)importValues.get(ToolContentImport102Manager.CONTENT_BODY)); + toolContentObj.setOfflineInstructions(null); + toolContentObj.setOnlineInstructions(null); + toolContentObj.setReflectionSubject(null); + toolContentObj.setReflect(Boolean.FALSE); + toolContentObj.setRunOffline(Boolean.FALSE); + toolContentObj.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); + + toolContentObj.setContent(null); + toolContentObj.setUpdateDate(now); + toolContentObj.setVoteContentId(toolContentId); + toolContentObj.setVoteChangable(Boolean.FALSE); + + try { + Boolean bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_VOTE_ALLOW_POLL_NOMINATIONS); + toolContentObj.setAllowText(bool!=null?bool:false); + + bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_MB_REUSABLE); + toolContentObj.setLockOnFinish(bool!=null?bool:true); + + Integer maxCount = WDDXProcessor.convertToInteger(importValues, ToolContentImport102Manager.CONTENT_VOTE_MAXCHOOSE); + toolContentObj.setMaxNominationCount(maxCount != null ? maxCount.toString() : "1"); + + } catch (WDDXProcessorConversionException e) { + logger.error("Unable to content for activity "+toolContentObj.getTitle()+"properly due to a WDDXProcessorConversionException.",e); + throw new ToolException("Invalid import data format for activity "+toolContentObj.getTitle()+"- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); + } + + // leave as empty, no need to set them to anything. + //setVoteUploadedFiles(Set voteAttachments); + //setVoteSessions(Set voteSessions); + + // set up question from body + Vector nominations = (Vector) importValues.get(CONTENT_VOTE_NOMINATIONS); + if ( nominations != null ) { + Iterator iter = nominations.iterator(); + int order = 1; + while (iter.hasNext()) { + String element = (String) iter.next(); + VoteQueContent nomination = new VoteQueContent(element, toolContentObj, null); + nomination.setDisplayOrder(order++); + toolContentObj.getVoteQueContents().add(nomination); + } + } + + voteContentDAO.saveVoteContent(toolContentObj); + } + + /** Set the description, throws away the title value as this is not supported in 2.0 */ + public void setReflectiveData(Long toolContentId, String title, String description) + throws ToolException, DataMissingException { + + VoteContent toolContentObj = null; + if ( toolContentId != null ) { + toolContentObj=retrieveVote(toolContentId); + } + if ( toolContentObj == null ) { + throw new DataMissingException("Unable to set reflective data titled "+title + +" on activity toolContentId "+toolContentId + +" as the tool content does not exist."); + } + + toolContentObj.setReflect(Boolean.TRUE); + toolContentObj.setReflectionSubject(description); + } + + public Long createNotebookEntry(Long id, Integer idType, String signature, + Integer userID, String entry) { + logger.debug("coreNotebookService: " + coreNotebookService); + return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); } - public List retrieveVoteUploadedOnlineFilesUuid(Long voteContentId) throws VoteApplicationException { - try - { - return voteUploadedFileDAO.retrieveVoteUploadedOnlineFilesUuid(voteContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: online + uuids " - + e.getMessage(), - e); - } + + + public NotebookEntry getEntry(Long id, Integer idType, String signature, + Integer userID) { + + List list = coreNotebookService.getEntry(id, idType, signature, userID); + if (list == null || list.isEmpty()) { + return null; + } else { + return list.get(0); + } } - - public List retrieveVoteUploadedOfflineFilesName(Long voteContentId) throws VoteApplicationException { - try - { - return voteUploadedFileDAO.retrieveVoteUploadedOfflineFilesName(voteContentId); - } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: offline + fileNames " - + e.getMessage(), + public List getAllQuestionEntriesSorted(final long voteContentId) throws VoteApplicationException + { + try + { + return voteQueContentDAO.getAllQuestionEntriesSorted(voteContentId); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is getting all question entries: " + + e.getMessage(), e); - } + } } - - public List retrieveVoteUploadedOnlineFilesName(Long voteContentId) throws VoteApplicationException { - try - { - return voteUploadedFileDAO.retrieveVoteUploadedOnlineFilesName(voteContentId); + public void removeFile(Long submissionId) throws VoteApplicationException { + voteUploadedFileDAO.removeUploadFile(submissionId); + logger.debug("removed voteUploadedFile: " + submissionId); + } + + + public void persistFile(VoteContent content, VoteUploadedFile file) throws VoteApplicationException { + logger.debug("in persistFile: " + file); + content.getVoteAttachments().add(file); + file.setVoteContent(content); + voteContentDAO.saveOrUpdateVote(content); + logger.debug("persisted voteUploadedFile: " + file); + + } + + + public List retrieveVoteUploadedFiles(VoteContent Vote) throws VoteApplicationException { + try { + return voteUploadedFileDAO.retrieveVoteUploadedFiles(Vote); } - catch (DataAccessException e) - { - throw new VoteApplicationException("Exception occured when lams is loading vote uploaded files: online + fileNames " - + e.getMessage(), - e); + catch (DataAccessException e) { + throw new VoteApplicationException("Exception occured when lams is loading Vote uploaded files: " + + e.getMessage(), + e); } - } + } @@ -2366,12 +2361,6 @@ public String getRepositoryUser() { return repositoryUser; } - /** - * @return Returns the repositoryWorkspace. - */ - public String getRepositoryWorkspace() { - return repositoryWorkspace; - } /** * @return Returns the toolService. @@ -2623,107 +2612,4 @@ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; } - - - /* ===============Methods implemented from ToolContentImport102Manager =============== */ - - - /** - * Import the data for a 1.0.2 Chat - */ - public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) - { - Date now = new Date(); - VoteContent toolContentObj = new VoteContent(); - toolContentObj.setContentInUse(Boolean.FALSE); - toolContentObj.setCreatedBy(user.getUserID().longValue()); - toolContentObj.setCreationDate(now); - toolContentObj.setDefineLater(Boolean.FALSE); - toolContentObj.setInstructions((String)importValues.get(ToolContentImport102Manager.CONTENT_BODY)); - toolContentObj.setOfflineInstructions(null); - toolContentObj.setOnlineInstructions(null); - toolContentObj.setReflectionSubject(null); - toolContentObj.setReflect(Boolean.FALSE); - toolContentObj.setRunOffline(Boolean.FALSE); - toolContentObj.setTitle((String)importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); - - toolContentObj.setContent(null); - toolContentObj.setUpdateDate(now); - toolContentObj.setVoteContentId(toolContentId); - toolContentObj.setVoteChangable(Boolean.FALSE); - - try { - Boolean bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_VOTE_ALLOW_POLL_NOMINATIONS); - toolContentObj.setAllowText(bool!=null?bool:false); - - bool = WDDXProcessor.convertToBoolean(importValues, ToolContentImport102Manager.CONTENT_MB_REUSABLE); - toolContentObj.setLockOnFinish(bool!=null?bool:true); - - Integer maxCount = WDDXProcessor.convertToInteger(importValues, ToolContentImport102Manager.CONTENT_VOTE_MAXCHOOSE); - toolContentObj.setMaxNominationCount(maxCount != null ? maxCount.toString() : "1"); - - } catch (WDDXProcessorConversionException e) { - logger.error("Unable to content for activity "+toolContentObj.getTitle()+"properly due to a WDDXProcessorConversionException.",e); - throw new ToolException("Invalid import data format for activity "+toolContentObj.getTitle()+"- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); - } - - // leave as empty, no need to set them to anything. - //setVoteUploadedFiles(Set voteAttachments); - //setVoteSessions(Set voteSessions); - - // set up question from body - Vector nominations = (Vector) importValues.get(CONTENT_VOTE_NOMINATIONS); - if ( nominations != null ) { - Iterator iter = nominations.iterator(); - int order = 1; - while (iter.hasNext()) { - String element = (String) iter.next(); - VoteQueContent nomination = new VoteQueContent(element, toolContentObj, null); - nomination.setDisplayOrder(order++); - toolContentObj.getVoteQueContents().add(nomination); - } - } - - voteContentDAO.saveVoteContent(toolContentObj); - } - - /** Set the description, throws away the title value as this is not supported in 2.0 */ - public void setReflectiveData(Long toolContentId, String title, String description) - throws ToolException, DataMissingException { - - VoteContent toolContentObj = null; - if ( toolContentId != null ) { - toolContentObj=retrieveVote(toolContentId); - } - if ( toolContentObj == null ) { - throw new DataMissingException("Unable to set reflective data titled "+title - +" on activity toolContentId "+toolContentId - +" as the tool content does not exist."); - } - - toolContentObj.setReflect(Boolean.TRUE); - toolContentObj.setReflectionSubject(description); - } - - public Long createNotebookEntry(Long id, Integer idType, String signature, - Integer userID, String entry) { - logger.debug("coreNotebookService: " + coreNotebookService); - return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); - } - - - - - public NotebookEntry getEntry(Long id, Integer idType, String signature, - Integer userID) { - - List list = coreNotebookService.getEntry(id, idType, signature, userID); - if (list == null || list.isEmpty()) { - return null; - } else { - return list.get(0); - } - } - - } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/util/VoteToolContentHandler.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/util/VoteToolContentHandler.java (.../VoteToolContentHandler.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/util/VoteToolContentHandler.java (.../VoteToolContentHandler.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -26,29 +26,36 @@ /** * Simple client for accessing the content repository. - * - * @author Ozgur Demirtas */ public class VoteToolContentHandler extends ToolContentHandler { private static String repositoryWorkspaceName = "vote11"; private final String repositoryUser = "vote11"; private final char[] repositoryId = {'v','o','t','e','_','1', '1'}; - - public VoteToolContentHandler() { + private VoteToolContentHandler() { super(); } + /* (non-Javadoc) + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName() + */ public String getRepositoryWorkspaceName() { return repositoryWorkspaceName; } + /* (non-Javadoc) + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser() + */ public String getRepositoryUser() { return repositoryUser; } + /* (non-Javadoc) + * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId() + */ public char[] getRepositoryId() { return repositoryId; } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml =================================================================== diff -u -rfadef2b7b1f00478057ecade707ca37aa24ebe15 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision fadef2b7b1f00478057ecade707ca37aa24ebe15) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -75,7 +75,7 @@ - + @@ -89,12 +89,9 @@ PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED, -VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException - PROPAGATION_REQUIRED,readOnly,-VoteApplicationException + PROPAGATION_REQUIRED, -QacpApplicationException PROPAGATION_REQUIRED,-VoteApplicationException - PROPAGATION_REQUIRED,-VoteApplicationException - PROPAGATION_REQUIRED,-VoteApplicationException - PROPAGATION_REQUIRED,-VoteApplicationException - PROPAGATION_REQUIRED,-VoteApplicationException + PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException PROPAGATION_REQUIRED,-VoteApplicationException Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -43,6 +43,7 @@ import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteAttachmentDTO; import org.lamsfoundation.lams.tool.vote.VoteComparator; +import org.lamsfoundation.lams.tool.vote.VoteNominationContentDTO; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; @@ -119,9 +120,9 @@ } - public static boolean validateQuestionsNotEmpty(Map mapQuestionsContent) + public static boolean validateNominationsNotEmpty(Map mapNominationsContent) { - Iterator itMap = mapQuestionsContent.entrySet().iterator(); + Iterator itMap = mapNominationsContent.entrySet().iterator(); while (itMap.hasNext()) { Map.Entry pairs = (Map.Entry)itMap.next(); logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); @@ -136,14 +137,14 @@ public static Map repopulateMap(HttpServletRequest request, String parameterType) { - Map mapTempQuestionsContent= new TreeMap(new VoteComparator()); + Map mapTempNominationsContent= new TreeMap(new VoteComparator()); logger.debug("parameterType: " + parameterType); long mapCounter=0; String optionContent0=request.getParameter("optionContent0"); logger.debug("optionContent0: " + optionContent0); mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), optionContent0); + mapTempNominationsContent.put(new Long(mapCounter).toString(), optionContent0); for (long i=1; i <= MAX_QUESTION_COUNT ; i++) @@ -155,11 +156,11 @@ ) { mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); + mapTempNominationsContent.put(new Long(mapCounter).toString(), candidateEntry); } } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; + logger.debug("return repopulated Map: " + mapTempNominationsContent); + return mapTempNominationsContent; } public static Map shiftMap(Map mapOptionsContent, String optIndex , String movableOptionEntry, String direction) @@ -187,10 +188,10 @@ if (shiftableEntry != null) { - Iterator itQuestionsMap = mapOptionsContent.entrySet().iterator(); + Iterator itNominationsMap = mapOptionsContent.entrySet().iterator(); long mapCounter=0; - while (itQuestionsMap.hasNext()) { - Map.Entry pairs = (Map.Entry)itQuestionsMap.next(); + while (itNominationsMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itNominationsMap.next(); logger.debug("comparing the pair: " + pairs.getKey() + " = " + pairs.getValue()); mapCounter++; logger.debug("mapCounter: " + mapCounter); @@ -368,15 +369,15 @@ { VoteUploadedFile voteUploadedFile=(VoteUploadedFile)itList.next(); logger.debug("voteUploadedFile:" + voteUploadedFile); - logger.debug("voteUploadedFile details, uid" + voteUploadedFile.getUid().toString()); + logger.debug("voteUploadedFile details, uid" + voteUploadedFile.getSubmissionId().toString()); logger.debug("voteUploadedFile details, uuid" + voteUploadedFile.getUuid()); - logger.debug("voteUploadedFile details, filename" + voteUploadedFile.getFilename()); + logger.debug("voteUploadedFile details, filename" + voteUploadedFile.getFileName()); logger.debug("voteUploadedFile details, isOfflineFile" + !voteUploadedFile.isFileOnline()); VoteAttachmentDTO voteAttachmentDTO= new VoteAttachmentDTO(); - voteAttachmentDTO.setUid(voteUploadedFile.getUid().toString()); + voteAttachmentDTO.setUid(voteUploadedFile.getSubmissionId().toString()); voteAttachmentDTO.setUuid(voteUploadedFile.getUuid()); - voteAttachmentDTO.setFilename(voteUploadedFile.getFilename()); + voteAttachmentDTO.setFilename(voteUploadedFile.getFileName()); voteAttachmentDTO.setOfflineFile(!voteUploadedFile.isFileOnline()); listAttachments.add(voteAttachmentDTO); @@ -498,54 +499,7 @@ return listFilesMetaData; } - - /** - * Online and offline files metadata is stored into the database - * @param request - * @param isOfflineFile - * @param voteContent - */ - public static void persistFilesMetaData(HttpServletRequest request, IVoteService voteService, - boolean isOfflineFile, VoteContent voteContent, SessionMap sessionMap) - { - logger.debug("doing persistFilesMetaData... sessionMap" + sessionMap); - List listFilesMetaData=null; - logger.debug("isOfflineFile:" + isOfflineFile); - - if (isOfflineFile) - { - listFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - } - else - { - listFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - - } - logger.debug("listFilesMetaData:" + listFilesMetaData); - - Iterator itListFilesMetaData = listFilesMetaData.iterator(); - while (itListFilesMetaData.hasNext()) - { - VoteAttachmentDTO voteAttachmentDTO=(VoteAttachmentDTO)itListFilesMetaData.next(); - logger.debug("voteAttachmentDTO:" + voteAttachmentDTO); - String uid=voteAttachmentDTO.getUid(); - logger.debug("uid:" + uid); - - String uuid=voteAttachmentDTO.getUuid(); - boolean isOnlineFile=!voteAttachmentDTO.isOfflineFile(); - String fileName=voteAttachmentDTO.getFilename(); - - if (uid == null) - { - logger.debug("persisting files metadata..."); - if (!voteService.isUuidPersisted(uuid)) - { - voteService.persistFile(uuid, isOnlineFile, fileName, voteContent); - } - } - } - } - + public static List extractFileNames(List listFilesMetaData) { Iterator itList = listFilesMetaData.iterator(); @@ -562,112 +516,7 @@ return listFilenames; } - /** - * used if an offline file item is no more referenced - * @param request - * @param voteContent - */ - public static void removeRedundantOfflineFileItems(HttpServletRequest request, IVoteService voteService, - VoteContent voteContent, SessionMap sessionMap) - { - logger.debug("starting removeRedundantOfflineFileItems:" + sessionMap); - List allOfflineFilenames=voteService.retrieveVoteUploadedOfflineFilesName(voteContent.getUid()); - logger.debug("allOfflineFilenames:" + allOfflineFilenames); - - //List listOfflineFilesMetaData =(List)request.getSession().getAttribute(LIST_OFFLINEFILES_METADATA); - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - - List listUploadedOfflineFileNames=extractFileNames(listOfflineFilesMetaData); - logger.debug("listUploadedOfflineFileNames:" + listUploadedOfflineFileNames); - - boolean matchFound=false; - Iterator itAllOfflineFiles = allOfflineFilenames.iterator(); - while (itAllOfflineFiles.hasNext()) - { - String filename =(String)itAllOfflineFiles.next(); - logger.debug("filename: " + filename); - - matchFound=false; - Iterator itFiles = listUploadedOfflineFileNames.iterator(); - while (itFiles.hasNext()) - { - matchFound=false; - String currentFilename =(String)itFiles.next(); - logger.debug("currentFilename: " + currentFilename); - - if (filename.equals(currentFilename)) - { - logger.debug("filename match found : " + currentFilename); - matchFound=true; - break; - } - } - - logger.debug("matchFound : " + matchFound); - if (matchFound == false) - { - logger.debug("matchFound is false for filename: " + filename); - voteService.removeOffLineFile(filename, voteContent.getUid()); - logger.debug("filename removed: " + filename); - } - } - } - /** - * used if an online file item is no more referenced - * @param request - * @param voteContent - */ - public static void removeRedundantOnlineFileItems(HttpServletRequest request, IVoteService voteService, - VoteContent voteContent, SessionMap sessionMap) - { - logger.debug("starting removeRedundantOnlineFileItems:" + sessionMap); - - List allOnlineFilenames=voteService.retrieveVoteUploadedOnlineFilesName(voteContent.getUid()); - logger.debug("allOnlineFilenames:" + allOnlineFilenames); - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - - List listUploadedOnlineFileNames=extractFileNames(listOnlineFilesMetaData); - logger.debug("listUploadedOnlineFileNames:" + listUploadedOnlineFileNames); - - - boolean matchFound=false; - Iterator itAllOnlineFiles = allOnlineFilenames.iterator(); - while (itAllOnlineFiles.hasNext()) - { - String filename =(String)itAllOnlineFiles.next(); - logger.debug("filename: " + filename); - - matchFound=false; - Iterator itFiles = listUploadedOnlineFileNames.iterator(); - while (itFiles.hasNext()) - { - matchFound=false; - String currentFilename =(String)itFiles.next(); - logger.debug("currentFilename: " + currentFilename); - - if (filename.equals(currentFilename)) - { - logger.debug("filename match found : " + currentFilename); - matchFound=true; - break; - } - } - - logger.debug("matchFound : " + matchFound); - if (matchFound == false) - { - logger.debug("matchFound is false for filename: " + filename); - voteService.removeOnLineFile(filename, voteContent.getUid()); - logger.debug("filename removed: " + filename); - } - } - } - - protected Map reconstructOptionContentMapForAdd(Map mapOptionsContent, HttpServletRequest request) { logger.debug("doing reconstructOptionContentMapForAdd."); @@ -677,7 +526,6 @@ mapOptionsContent=repopulateMap(mapOptionsContent, request); logger.debug("mapOptionsContent: " + mapOptionsContent); mapOptionsContent.put(new Long(mapOptionsContent.size()+1).toString(), ""); - //request.getSession().setAttribute("mapOptionsContent", mapOptionsContent); logger.debug("post-add Map is: " + mapOptionsContent); logger.debug("post-add count " + mapOptionsContent.size()); @@ -736,7 +584,7 @@ if (i==0) { request.getSession().setAttribute("defaultOptionContent", candidateOptionEntry); - logger.debug("defaultQuestionContent set to: " + candidateOptionEntry); + logger.debug("defaultNominationContent set to: " + candidateOptionEntry); } if ((candidateOptionEntry != null) && (candidateOptionEntry.length() > 0)) { @@ -791,10 +639,10 @@ if (voteContent != null) { logger.debug("voteContent uid: " + voteContent.getUid()); - List allQuestions=voteService.getAllQuestionEntries(voteContent.getUid()); - logger.debug("allQuestions: " + allQuestions); + List allNominations=voteService.getAllQuestionEntries(voteContent.getUid()); + logger.debug("allNominations: " + allNominations); - Iterator listIterator=allQuestions.iterator(); + Iterator listIterator=allNominations.iterator(); Long mapIndex=new Long(1); boolean entryUsed=false; while (listIterator.hasNext()) @@ -1029,9 +877,9 @@ if (pairs.getValue().toString().length() != 0) { - logger.debug("starting createQuestionContent: pairs.getValue().toString():" + pairs.getValue().toString()); - logger.debug("starting createQuestionContent: voteContent: " + voteContent); - logger.debug("starting createQuestionContent: diplayOrder: " + diplayOrder); + logger.debug("starting createNominationContent: pairs.getValue().toString():" + pairs.getValue().toString()); + logger.debug("starting createNominationContent: voteContent: " + voteContent); + logger.debug("starting createNominationContent: diplayOrder: " + diplayOrder); diplayOrder=new Integer(pairs.getKey().toString()).intValue(); logger.debug("int diplayOrder: " + diplayOrder); @@ -1074,4 +922,684 @@ } return voteContent; } + + + protected static List swapNodes(List listNominationContentDTO, String questionIndex, String direction) + { + logger.debug("swapNodes:"); + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + logger.debug("questionIndex:" + questionIndex); + logger.debug("direction:" + direction); + + int intNominationIndex=new Integer(questionIndex).intValue(); + int intOriginalNominationIndex=intNominationIndex; + logger.debug("intNominationIndex:" + intNominationIndex); + + int replacedNodeIndex=0; + if (direction.equals("down")) + { + logger.debug("direction down:"); + replacedNodeIndex=++intNominationIndex; + } + else + { + logger.debug("direction up:"); + replacedNodeIndex=--intNominationIndex; + + } + logger.debug("replacedNodeIndex:" + replacedNodeIndex); + logger.debug("replacing nodes:" + intOriginalNominationIndex + " and " + replacedNodeIndex); + + VoteNominationContentDTO mainNode=extractNodeAtDisplayOrder(listNominationContentDTO, intOriginalNominationIndex); + logger.debug("mainNode:" + mainNode); + + + VoteNominationContentDTO replacedNode=extractNodeAtDisplayOrder(listNominationContentDTO, replacedNodeIndex); + logger.debug("replacedNode:" + replacedNode); + + List listFinalNominationContentDTO=new LinkedList(); + + listFinalNominationContentDTO=reorderSwappedListNominationContentDTO(listNominationContentDTO, intOriginalNominationIndex, + replacedNodeIndex, mainNode, replacedNode); + + + logger.debug("listFinalNominationContentDTO:" + listFinalNominationContentDTO); + return listFinalNominationContentDTO; + } + + protected static VoteNominationContentDTO extractNodeAtDisplayOrder(List listNominationContentDTO, int intOriginalNominationIndex) + { + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + logger.debug("intOriginalNominationIndex:" + intOriginalNominationIndex); + + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO=(VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + logger.debug("intOriginalNominationIndex versus displayOrder:" + new Integer(intOriginalNominationIndex).toString() + " versus " + + voteNominationContentDTO.getDisplayOrder()); + if (new Integer(intOriginalNominationIndex).toString().equals(voteNominationContentDTO.getDisplayOrder())) + { + logger.debug("node found:" + voteNominationContentDTO); + return voteNominationContentDTO; + } + } + return null; + } + + + protected static List reorderSwappedListNominationContentDTO(List listNominationContentDTO, int intOriginalNominationIndex, + int replacedNodeIndex, VoteNominationContentDTO mainNode, VoteNominationContentDTO replacedNode) + { + logger.debug("reorderSwappedListNominationContentDTO: intOriginalNominationIndex:" + intOriginalNominationIndex); + logger.debug("reorderSwappedListNominationContentDTO: replacedNodeIndex:" + replacedNodeIndex); + logger.debug("mainNode: " + mainNode); + logger.debug("replacedNode: " + replacedNode); + + + List listFinalNominationContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + queIndex++; + VoteNominationContentDTO tempNode=new VoteNominationContentDTO(); + + if ((!voteNominationContentDTO.getDisplayOrder().equals(new Integer(intOriginalNominationIndex).toString())) && + !voteNominationContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) + { + logger.debug("normal copy "); + tempNode.setNomination(voteNominationContentDTO.getNomination()); + tempNode.setDisplayOrder(voteNominationContentDTO.getDisplayOrder()); + tempNode.setFeedback(voteNominationContentDTO.getFeedback()); + } + else if (voteNominationContentDTO.getDisplayOrder().equals(new Integer(intOriginalNominationIndex).toString())) + { + logger.debug("move type 1 "); + tempNode.setNomination(replacedNode.getNomination()); + tempNode.setDisplayOrder(replacedNode.getDisplayOrder()); + tempNode.setFeedback(replacedNode.getFeedback()); + } + else if (voteNominationContentDTO.getDisplayOrder().equals(new Integer(replacedNodeIndex).toString())) + { + logger.debug("move type 1 "); + tempNode.setNomination(mainNode.getNomination()); + tempNode.setDisplayOrder(mainNode.getDisplayOrder()); + tempNode.setFeedback(mainNode.getFeedback()); + } + + + listFinalNominationContentDTO.add(tempNode); + } + + logger.debug("final listFinalNominationContentDTO:" + listFinalNominationContentDTO); + return listFinalNominationContentDTO; + } + + + protected static List reorderSimpleListNominationContentDTO(List listNominationContentDTO) + { + logger.debug("reorderListNominationContentDTO"); + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + List listFinalNominationContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + String question=voteNominationContentDTO.getNomination(); + logger.debug("question:" + question); + + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=voteNominationContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + if ((question != null) && (!question.equals(""))) + { + ++queIndex; + logger.debug("using queIndex:" + queIndex); + + voteNominationContentDTO.setNomination(question); + voteNominationContentDTO.setDisplayOrder(new Integer(queIndex).toString()); + voteNominationContentDTO.setFeedback(feedback); + + listFinalNominationContentDTO.add(voteNominationContentDTO); + } + } + + + logger.debug("final listFinalNominationContentDTO:" + listFinalNominationContentDTO); + return listFinalNominationContentDTO; + } + + + protected static List reorderListNominationContentDTO(List listNominationContentDTO, String excludeNominationIndex) + { + logger.debug("reorderListNominationContentDTO"); + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + logger.debug("excludeNominationIndex:" + excludeNominationIndex); + + List listFinalNominationContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + String question=voteNominationContentDTO.getNomination(); + logger.debug("question:" + question); + + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=voteNominationContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + logger.debug("displayOrder versus excludeNominationIndex :" + displayOrder + " versus " + excludeNominationIndex); + + if ((question != null) && (!question.equals(""))) + { + if (!displayOrder.equals(excludeNominationIndex)) + { + ++queIndex; + logger.debug("using queIndex:" + queIndex); + + voteNominationContentDTO.setNomination(question); + voteNominationContentDTO.setDisplayOrder(new Integer(queIndex).toString()); + voteNominationContentDTO.setFeedback(feedback); + + listFinalNominationContentDTO.add(voteNominationContentDTO); + } + } + } + + + logger.debug("final listFinalNominationContentDTO:" + listFinalNominationContentDTO); + return listFinalNominationContentDTO; + } + + + + public static boolean checkDuplicateNominations(List listNominationContentDTO, String newNomination) + { + logger.debug("checkDuplicateNominations: " + listNominationContentDTO); + logger.debug("newNomination: " + newNomination); + + Map mapNominationContent=extractMapNominationContent(listNominationContentDTO); + logger.debug("mapNominationContent: " + mapNominationContent); + + Iterator itMap = mapNominationContent.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) + { + logger.debug("checking the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().equals(newNomination)) + { + logger.debug("entry found: " + newNomination); + return true; + } + } + } + return false; + } + + + protected static Map extractMapNominationContent(List listNominationContentDTO) + { + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + Map mapNominationContent= new TreeMap(new VoteComparator()); + + Iterator listIterator=listNominationContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO=(VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapNominationContent.put(new Integer(queIndex).toString(), voteNominationContentDTO.getNomination()); + } + logger.debug("mapNominationContent:" + mapNominationContent); + return mapNominationContent; + } + + + protected static List reorderUpdateListNominationContentDTO(List listNominationContentDTO, + VoteNominationContentDTO voteNominationContentDTONew, + String editableNominationIndex) + { + logger.debug("reorderUpdateListNominationContentDTO"); + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + logger.debug("voteNominationContentDTONew:" + voteNominationContentDTONew); + logger.debug("editableNominationIndex:" + editableNominationIndex); + + + List listFinalNominationContentDTO=new LinkedList(); + + int queIndex=0; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + ++queIndex; + logger.debug("using queIndex:" + queIndex); + String question=voteNominationContentDTO.getNomination(); + logger.debug("question:" + question); + + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + String feedback=voteNominationContentDTO.getFeedback(); + logger.debug("feedback:" + feedback); + + if (displayOrder.equals(editableNominationIndex)) + { + logger.debug("displayOrder equals editableNominationIndex:" + editableNominationIndex); + voteNominationContentDTO.setNomination(voteNominationContentDTONew.getNomination()); + voteNominationContentDTO.setDisplayOrder(voteNominationContentDTONew.getDisplayOrder()); + voteNominationContentDTO.setFeedback(voteNominationContentDTONew.getFeedback()); + + listFinalNominationContentDTO.add(voteNominationContentDTO); + } + else + { + logger.debug("displayOrder does not equal editableNominationIndex:" + editableNominationIndex); + voteNominationContentDTO.setNomination(question); + voteNominationContentDTO.setDisplayOrder(displayOrder); + voteNominationContentDTO.setFeedback(feedback); + + listFinalNominationContentDTO.add(voteNominationContentDTO); + } + } + + logger.debug("listFinalNominationContentDTO:" + listFinalNominationContentDTO); + return listFinalNominationContentDTO; + } + + + protected static Map extractMapFeedback(List listNominationContentDTO) + { + logger.debug("listNominationContentDTO:" + listNominationContentDTO); + Map mapFeedbackContent= new TreeMap(new VoteComparator()); + + Iterator listIterator=listNominationContentDTO.iterator(); + int queIndex=0; + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO=(VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO feedback:" + voteNominationContentDTO.getFeedback()); + + queIndex++; + logger.debug("queIndex:" + queIndex); + mapFeedbackContent.put(new Integer(queIndex).toString(), voteNominationContentDTO.getFeedback()); + } + logger.debug("mapFeedbackContent:" + mapFeedbackContent); + return mapFeedbackContent; + } + + + public void removeRedundantNominations (Map mapNominationContent, IVoteService voteService, VoteAuthoringForm voteAuthoringForm, + HttpServletRequest request, String toolContentID) + { + logger.debug("removing unused entries... "); + logger.debug("mapNominationContent: " + mapNominationContent); + logger.debug("toolContentID: " + toolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); + logger.debug("voteContent: " + voteContent); + + if (voteContent != null) + { + logger.debug("voteContent uid: " + voteContent.getUid()); + List allNominations=voteService.getAllQuestionEntries(voteContent.getUid()); + logger.debug("allNominations: " + allNominations); + + Iterator listIterator=allNominations.iterator(); + int mapIndex=0; + boolean entryUsed=false; + while (listIterator.hasNext()) + { + ++mapIndex; + logger.debug("current mapIndex: " + mapIndex); + + VoteQueContent queContent=(VoteQueContent)listIterator.next(); + logger.debug("queContent data: " + queContent); + logger.debug("queContent: " + queContent.getQuestion() + " " + queContent.getDisplayOrder()); + + entryUsed=false; + Iterator itMap = mapNominationContent.entrySet().iterator(); + int displayOrder=0; + while (itMap.hasNext()) + { + ++displayOrder; + logger.debug("current displayOrder: " + displayOrder); + entryUsed=false; + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().toString().length() != 0) + { + logger.debug("text from map:" + pairs.getValue().toString()); + logger.debug("text from db:" + queContent.getQuestion()); + + logger.debug("mapIndex versus displayOrder:" + mapIndex + " versus " + displayOrder); + if (mapIndex == displayOrder) + { + logger.debug("used displayOrder position:" + displayOrder); + entryUsed=true; + break; + } + + } + } + + if (entryUsed == false) + { + logger.debug("removing unused entry in db:" + queContent.getQuestion()); + + VoteQueContent removeableVoteQueContent=voteService.getQuestionContentByQuestionText(queContent.getQuestion(), voteContent.getUid()); + logger.debug("removeableVoteQueContent" + removeableVoteQueContent); + if (removeableVoteQueContent != null) + { + voteService.removeVoteQueContent(removeableVoteQueContent); + logger.debug("removed removeableVoteQueContent from the db: " + removeableVoteQueContent); + } + + } + } + } + + } + + + + public VoteContent saveOrUpdateVoteContent(Map mapQuestionContent, Map mapFeedback, IVoteService voteService, VoteAuthoringForm voteAuthoringForm, + HttpServletRequest request, VoteContent voteContent, String strToolContentID) + { + UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + + boolean isVoteChangable=false; + boolean isLockOnFinish=false; + boolean isAllowTextEntry=false; + boolean isReflect=false; + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + + String voteChangable = request.getParameter("voteChangable"); + logger.debug("voteChangable: " + voteChangable); + + String lockOnFinish = request.getParameter("lockOnFinish"); + logger.debug("lockOnFinish: " + lockOnFinish); + + String allowTextEntry = request.getParameter("allowText"); + logger.debug("allowTextEntry: " + allowTextEntry); + + String reflect=request.getParameter(REFLECT); + logger.debug("reflect: " + reflect); + + String reflectionSubject=voteAuthoringForm.getReflectionSubject(); + logger.debug("reflectionSubject: " + reflectionSubject); + + String maxNomcount= voteAuthoringForm.getMaxNominationCount(); + logger.debug("maxNomcount: " + maxNomcount); + + String richTextOfflineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + String richTextOnlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + + boolean setCommonContent=true; + if ((voteChangable == null) || (lockOnFinish == null) || + (allowTextEntry == null) || (reflect == null) || + (reflectionSubject == null) || (maxNomcount == null)) + + { + setCommonContent=false; + } + logger.debug("setCommonContent: " + setCommonContent); + + boolean voteChangableBoolean=false; + boolean lockOnFinishBoolean=false; + boolean allowTextEntryBoolean=false; + boolean reflectBoolean=false; + + if ((voteChangable != null) && (voteChangable.equalsIgnoreCase("1"))) + voteChangableBoolean=true; + + if ((lockOnFinish != null) && (lockOnFinish.equalsIgnoreCase("1"))) + lockOnFinishBoolean=true; + + if ((allowTextEntry != null) && (allowTextEntry.equalsIgnoreCase("1"))) + allowTextEntryBoolean=true; + + if ((reflect != null) && (reflect.equalsIgnoreCase("1"))) + reflectBoolean=true; + + + logger.debug("voteChangableBoolean: " + voteChangableBoolean); + logger.debug("lockOnFinishBoolean: " + lockOnFinishBoolean); + logger.debug("allowTextEntryBoolean: " + allowTextEntryBoolean); + logger.debug("reflectBoolean: " + reflectBoolean); + + long userId=0; + if (toolUser != null) + { + userId = toolUser.getUserID().longValue(); + } + else + { + HttpSession ss = SessionManager.getSession(); + logger.debug("ss: " + ss); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("user" + user); + if (user != null) + { + userId = user.getUserID().longValue(); + } + else + { + logger.debug("should not reach here"); + userId=0; + } + } + logger.debug("userId: " + userId); + logger.debug("voteContent: " + voteContent); + + boolean newContent=false; + if(voteContent == null) + { + voteContent = new VoteContent(); + newContent=true; + } + + + logger.debug("setting common content values..." + richTextTitle + " " + richTextInstructions); + voteContent.setVoteContentId(new Long(strToolContentID)); + voteContent.setTitle(richTextTitle); + voteContent.setInstructions(richTextInstructions); + voteContent.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/ + logger.debug("userId: " + userId); + voteContent.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/ + logger.debug("end of setting common content values..."); + + + + logger.debug("activeModule:" + activeModule); + if (activeModule.equals(AUTHORING)) + { + logger.debug("setting other content values..."); + voteContent.setVoteChangable(voteChangableBoolean); + voteContent.setLockOnFinish(lockOnFinishBoolean); + voteContent.setAllowText(allowTextEntryBoolean); + voteContent.setReflect(reflectBoolean); + voteContent.setMaxNominationCount(maxNomcount); + + voteContent.setOnlineInstructions(richTextOnlineInstructions); + voteContent.setOfflineInstructions(richTextOfflineInstructions); + + voteContent.setReflectionSubject(reflectionSubject); + } + + + if (newContent) + { + logger.debug("will create: " + voteContent); + voteService.createVote(voteContent); + } + else + { + logger.debug("will update: " + voteContent); + voteService.updateVote(voteContent); + } + + voteContent=voteService.retrieveVote(new Long(strToolContentID)); + + + logger.debug("voteContent: " + voteContent); + + voteContent=createQuestionContent(mapQuestionContent, mapFeedback, voteService, voteContent); + + return voteContent; + } + + + + protected VoteContent createQuestionContent(Map mapQuestionContent, Map mapFeedback, IVoteService voteService, VoteContent voteContent) + { + logger.debug("createQuestionContent: "); + logger.debug("content uid is: " + voteContent.getUid()); + List questions=voteService.retrieveVoteQueContentsByToolContentId(voteContent.getUid().longValue()); + logger.debug("questions: " + questions); + + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapFeedback: " + mapFeedback); + + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + int displayOrder=0; + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (pairs.getValue().toString().length() != 0) + { + logger.debug("starting createQuestionContent: pairs.getValue().toString():" + pairs.getValue().toString()); + logger.debug("starting createQuestionContent: voteContent: " + voteContent); + + ++displayOrder; + logger.debug("starting createQuestionContent: displayOrder: " + displayOrder); + String currentFeedback=(String)mapFeedback.get(new Integer(displayOrder).toString()); + logger.debug("currentFeedback: " + currentFeedback); + + VoteQueContent queContent= new VoteQueContent(pairs.getValue().toString(), + displayOrder, + voteContent, + null); + + + logger.debug("queContent: " + queContent); + + /* checks if the question is already recorded*/ + logger.debug("question text is: " + pairs.getValue().toString()); + logger.debug("content uid is: " + voteContent.getUid()); + logger.debug("question display order is: " + displayOrder); + VoteQueContent existingVoteQueContent=voteService.getQuestionContentByDisplayOrder(new Long(displayOrder), voteContent.getUid()); + logger.debug("existingVoteQueContent: " + existingVoteQueContent); + + if (existingVoteQueContent == null) + { + /*make sure a question with the same question text is not already saved*/ + VoteQueContent duplicateVoteQueContent=voteService.getQuestionContentByQuestionText(pairs.getValue().toString(), voteContent.getUid()); + logger.debug("duplicateVoteQueContent: " + duplicateVoteQueContent); + logger.debug("adding a new question to content: " + queContent); + voteContent.getVoteQueContents().add(queContent); + queContent.setVoteContent(voteContent); + + voteService.createVoteQue(queContent); + } + else + { + + String existingQuestion=existingVoteQueContent.getQuestion(); + logger.debug("existingQuestion: " + existingQuestion); + + logger.debug("map question versus existingQuestion: " + pairs.getValue().toString() + + " versus db question value: " + existingQuestion); + + existingVoteQueContent.setQuestion(pairs.getValue().toString()); + //existingVoteQueContent.setFeedback(currentFeedback); + existingVoteQueContent.setDisplayOrder(displayOrder); + + logger.debug("updating the existing question content: " + existingVoteQueContent); + voteService.updateVoteQueContent(existingVoteQueContent); + } + } + } + return voteContent; + } + + + + public void reOrganizeDisplayOrder(Map mapQuestionContent, IVoteService voteService, VoteAuthoringForm voteAuthoringForm, VoteContent voteContent) + { + logger.debug("voteContent: " + voteContent); + if (voteContent != null) + { + logger.debug("content uid: " + voteContent.getUid()); + List sortedQuestions=voteService.getAllQuestionEntriesSorted(voteContent.getUid().longValue()); + logger.debug("sortedQuestions: " + sortedQuestions); + + Iterator listIterator=sortedQuestions.iterator(); + int displayOrder=1; + while (listIterator.hasNext()) + { + VoteQueContent queContent=(VoteQueContent)listIterator.next(); + logger.debug("queContent data: " + queContent); + logger.debug("queContent: " + queContent.getQuestion() + " " + queContent.getDisplayOrder()); + + VoteQueContent existingVoteQueContent=voteService.getQuestionContentByQuestionText(queContent.getQuestion(), voteContent.getUid()); + logger.debug("existingVoteQueContent: " + existingVoteQueContent); + existingVoteQueContent.setDisplayOrder(displayOrder); + logger.debug("updating the existing question content for displayOrder: " + existingVoteQueContent); + voteService.updateVoteQueContent(existingVoteQueContent); + displayOrder++; + } + } + logger.debug("done with reOrganizeDisplayOrder..."); + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java (.../ExportServlet.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/ExportServlet.java (.../ExportServlet.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -142,7 +142,7 @@ logger.debug("final exportPortfolioDTO userExceptionNoToolSessions: " + exportPortfolioDTO.getUserExceptionNoToolSessions() ); request.getSession().setAttribute(EXPORT_PORTFOLIO_DTO, exportPortfolioDTO); - voteMonitoringAction.prepareReflectionData(request, content, voteService, userID.toString(),true); + // voteMonitoringAction.prepareReflectionData(request, content, voteService, userID.toString(),true); logger.debug("ending learner mode: "); } @@ -189,7 +189,7 @@ logger.debug("final exportPortfolioDTO userExceptionNoToolSessions: " + exportPortfolioDTO.getUserExceptionNoToolSessions() ); request.getSession().setAttribute(EXPORT_PORTFOLIO_DTO, exportPortfolioDTO); - voteMonitoringAction.prepareReflectionData(request, content, voteService, null,true); + voteMonitoringAction.prepareReflectionData(request, content, voteService, null, true, "All"); logger.debug("ending teacher mode: "); } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/MonitoringUtil.java (.../MonitoringUtil.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -33,14 +33,18 @@ import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.vote.ExportPortfolioDTO; +import org.lamsfoundation.lams.tool.vote.VoteAllGroupsDTO; import org.lamsfoundation.lams.tool.vote.VoteAllSessionsDTO; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteComparator; import org.lamsfoundation.lams.tool.vote.VoteGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.vote.VoteGeneralMonitoringDTO; import org.lamsfoundation.lams.tool.vote.VoteMonitoredAnswersDTO; import org.lamsfoundation.lams.tool.vote.VoteMonitoredUserDTO; +import org.lamsfoundation.lams.tool.vote.VoteStatsDTO; import org.lamsfoundation.lams.tool.vote.VoteStringComparator; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; @@ -1237,5 +1241,532 @@ } logger.debug("ending prepareChartDataForExportTeacher, exportPortfolioDTO: " + exportPortfolioDTO); } + + public static boolean notebookEntriesExist(IVoteService voteService, VoteContent voteContent) + { + logger.debug("finding out about content level notebook entries: " + voteContent); + Iterator iteratorSession= voteContent.getVoteSessions().iterator(); + while (iteratorSession.hasNext()) + { + VoteSession voteSession=(VoteSession) iteratorSession.next(); + logger.debug("voteSession: " + voteSession); + + if (voteSession != null) + { + logger.debug("voteSession id: " + voteSession.getVoteSessionId()); + + Iterator iteratorUser=voteSession.getVoteQueUsers().iterator(); + while (iteratorUser.hasNext()) + { + VoteQueUsr voteQueUsr=(VoteQueUsr) iteratorUser.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("voteQueUsr id: " + voteQueUsr.getQueUsrId()); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = voteService.getEntry(voteSession.getVoteSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(voteQueUsr.getQueUsrId().intValue())); + + logger.debug("notebookEntry: " + notebookEntry); + if (notebookEntry != null) + { + logger.debug("found at least one notebookEntry: " + notebookEntry.getEntry()); + return true; + } + + } + } + } + } + return false; + } + + public static void buildVoteStatsDTO(HttpServletRequest request, IVoteService voteService, VoteContent voteContent) + { + logger.debug("building voteStatsDTO: " + voteContent); + VoteStatsDTO voteStatsDTO= new VoteStatsDTO(); + + int countSessionComplete=0; + int countAllUsers=0; + logger.debug("finding out about content level notebook entries: " + voteContent); + Iterator iteratorSession= voteContent.getVoteSessions().iterator(); + while (iteratorSession.hasNext()) + { + VoteSession voteSession=(VoteSession) iteratorSession.next(); + logger.debug("voteSession: " + voteSession); + + if (voteSession != null) + { + logger.debug("voteSession id: " + voteSession.getVoteSessionId()); + + if (voteSession.getSessionStatus().equals(COMPLETED)) + { + ++countSessionComplete; + } + + Iterator iteratorUser=voteSession.getVoteQueUsers().iterator(); + while (iteratorUser.hasNext()) + { + VoteQueUsr voteQueUsr=(VoteQueUsr) iteratorUser.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("voteQueUsr foundid"); + ++countAllUsers; + } + } + } + } + logger.debug("countAllUsers: " + countAllUsers); + logger.debug("countSessionComplete: " + countSessionComplete); + + + voteStatsDTO.setCountAllUsers(new Integer(countAllUsers).toString()); + voteStatsDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); + + logger.debug("voteStatsDTO: " + voteStatsDTO); + + request.setAttribute(VOTE_STATS_DTO, voteStatsDTO); + } + + public static void generateGroupsSessionData(HttpServletRequest request, IVoteService voteService, VoteContent voteContent) + { + logger.debug("generateGroupsSessionData: " + voteContent); + + List listAllGroupsDTO=buildGroupBasedSessionData(request, voteContent, voteService); + logger.debug("listAllGroupsDTO: " + listAllGroupsDTO); + + request.setAttribute(LIST_ALL_GROUPS_DTO, listAllGroupsDTO); + } + + + + public static List buildGroupBasedSessionData(HttpServletRequest request, VoteContent voteContent, IVoteService voteService) + { + logger.debug("buildGroupBasedSessionData" + voteContent); + logger.debug("will be building groups question data for content:..." + voteContent); + List listQuestions=voteService.getAllQuestionEntries(voteContent.getUid()); + logger.debug("listQuestions:..." + listQuestions); + + List listAllGroupsContainerDTO= new LinkedList(); + + + Iterator iteratorSession= voteContent.getVoteSessions().iterator(); + while (iteratorSession.hasNext()) + { + VoteSession voteSession=(VoteSession) iteratorSession.next(); + logger.debug("iteration for group based session data: " + voteSession); + String currentSessionId=voteSession.getVoteSessionId().toString(); + logger.debug("currentSessionId: " + currentSessionId); + + String currentSessionName=voteSession.getSession_name(); + logger.debug("currentSessionName: " + currentSessionName); + + VoteAllGroupsDTO voteAllGroupsDTO= new VoteAllGroupsDTO(); + List listMonitoredAnswersContainerDTO= new LinkedList(); + + if (voteSession != null) + { + Iterator itListQuestions = listQuestions.iterator(); + while (itListQuestions.hasNext()) + { + VoteQueContent voteQueContent =(VoteQueContent)itListQuestions.next(); + logger.debug("voteQueContent:..." + voteQueContent); + + if (voteQueContent != null) + { + logger.debug("populating VoteMonitoredAnswersDTO for : " + voteQueContent); + VoteMonitoredAnswersDTO voteMonitoredAnswersDTO= new VoteMonitoredAnswersDTO(); + voteMonitoredAnswersDTO.setQuestionUid(voteQueContent.getUid().toString()); + voteMonitoredAnswersDTO.setQuestion(voteQueContent.getQuestion()); + voteMonitoredAnswersDTO.setSessionId(currentSessionId); + voteMonitoredAnswersDTO.setSessionName(currentSessionName); + + Map questionAttemptData= buildGroupsAttemptData(request, voteContent, voteService, voteQueContent, voteQueContent.getUid().toString(), + true,false, currentSessionId, null); + logger.debug("generated questionAttemptData: " + questionAttemptData); + voteMonitoredAnswersDTO.setQuestionAttempts(questionAttemptData); + + logger.debug("adding voteMonitoredAnswersDTO to the listMonitoredAnswersContainerDTO: " + voteMonitoredAnswersDTO); + listMonitoredAnswersContainerDTO.add(voteMonitoredAnswersDTO); + } + } + } + logger.debug("listMonitoredAnswersContainerDTO:" + listMonitoredAnswersContainerDTO); + + logger.debug("adding listMonitoredAnswersContainerDTO to the voteAllGroupsDTO:" + listMonitoredAnswersContainerDTO); + voteAllGroupsDTO.setGroupData(listMonitoredAnswersContainerDTO); + voteAllGroupsDTO.setSessionName(currentSessionName); + voteAllGroupsDTO.setSessionId(currentSessionId); + + logger.debug("built voteAllGroupsDTO:" + voteAllGroupsDTO); + listAllGroupsContainerDTO.add(voteAllGroupsDTO); + + } + + + logger.debug("final listAllGroupsContainerDTO:..." + listAllGroupsContainerDTO); + return listAllGroupsContainerDTO; + } + + + public static Map buildGroupsAttemptData(HttpServletRequest request, VoteContent voteContent, IVoteService voteService, VoteQueContent voteQueContent, String questionUid, + boolean isUserNamesVisible, boolean isLearnerRequest, String currentSessionId, String userId) + { + logger.debug("doing buildGroupsAttemptData..."); + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + logger.debug("currentSessionId: " + currentSessionId); + logger.debug("userId: " + userId); + + + logger.debug("voteService: " + voteService); + + Map mapMonitoredAttemptsContainerDTO= new TreeMap(new VoteStringComparator()); + List listMonitoredAttemptsContainerDTO= new LinkedList(); + + Map summaryToolSessions=populateToolSessionsId(request, voteContent, voteService); + logger.debug("summaryToolSessions: " + summaryToolSessions); + + Iterator itMap = summaryToolSessions.entrySet().iterator(); + + + /*request is for monitoring summary */ + if (!isLearnerRequest) + { + + if (currentSessionId != null) + { + if (currentSessionId.equals("All")) + { + logger.debug("**summary request is for All**:"); + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (!(pairs.getValue().toString().equals("None")) && !(pairs.getValue().toString().equals("All"))) + { + logger.debug("using the numerical summary tool sessions pair: " + " = " + pairs.getValue()); + VoteSession voteSession= voteService.retrieveVoteSession(new Long(pairs.getValue().toString())); + logger.debug("voteSession: " + " = " + voteSession); + if (voteSession != null) + { + List listUsers=voteService.getUserBySessionOnly(voteSession); + logger.debug("listMcUsers for session id:" + voteSession.getVoteSessionId() + " = " + listUsers); + Map sessionUsersAttempts=populateSessionUsersAttempts(request, voteService, voteSession.getVoteSessionId(), listUsers, questionUid, + isUserNamesVisible, isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); + } + } + } + } + else if (!currentSessionId.equals("All")) + { + logger.debug("**summary request is for currentSessionId**:" + currentSessionId); + VoteSession voteSession= voteService.retrieveVoteSession(new Long(currentSessionId.toString())); + logger.debug("voteSession: " + " = " + voteSession); + + List listUsers=voteService.getUserBySessionOnly(voteSession); + logger.debug("listUsers: " + " = " + listUsers); + + Map sessionUsersAttempts=populateSessionUsersAttempts(request, voteService, new Long(currentSessionId), listUsers, questionUid, + isUserNamesVisible, isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); + } + } + } + else + { + /*request is for learner report, use only the passed tool session in the report*/ + logger.debug("using currentSessionId for the learner report:" + currentSessionId); + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the summary tool sessions pair: " + pairs.getKey() + " = " + pairs.getValue()); + + if (!(pairs.getValue().toString().equals("None")) && !(pairs.getValue().toString().equals("All"))) + { + logger.debug("using the numerical summary tool sessions pair: " + " = " + pairs.getValue()); + + if (currentSessionId.equals(pairs.getValue())) + { + logger.debug("only using this tool session for the learner report: " + " = " + pairs.getValue()); + VoteSession voteSession= voteService.retrieveVoteSession(new Long(pairs.getValue().toString())); + logger.debug("voteSession: " + " = " + voteSession); + if (voteSession != null) + { + List listUsers=voteService.getUserBySessionOnly(voteSession); + logger.debug("listVoteUsers for session id:" + voteSession.getVoteSessionId() + " = " + listUsers); + Map sessionUsersAttempts=populateSessionUsersAttempts(request, voteService, voteSession.getVoteSessionId(), listUsers, questionUid, + isUserNamesVisible, isLearnerRequest, userId); + listMonitoredAttemptsContainerDTO.add(sessionUsersAttempts); + } + } + } + } + } + + logger.debug("final listMonitoredAttemptsContainerDTO:..." + listMonitoredAttemptsContainerDTO); + mapMonitoredAttemptsContainerDTO=convertToMap(listMonitoredAttemptsContainerDTO); + logger.debug("final mapMonitoredAttemptsContainerDTO:..." + mapMonitoredAttemptsContainerDTO); + return mapMonitoredAttemptsContainerDTO; + } + + + + public static Map populateSessionUsersAttempts(HttpServletRequest request,IVoteService voteService, Long sessionId, + List listUsers, String questionUid, boolean isUserNamesVisible, boolean isLearnerRequest, String userId) + { + logger.debug("isUserNamesVisible: " + isUserNamesVisible); + logger.debug("isLearnerRequest: " + isLearnerRequest); + logger.debug("userId: " + userId); + + logger.debug("doing populateSessionUsersAttempts..."); + logger.debug("voteService: " + voteService); + + Map mapMonitoredUserContainerDTO= new TreeMap(new VoteStringComparator()); + List listMonitoredUserContainerDTO= new LinkedList(); + Iterator itUsers=listUsers.iterator(); + + + if (userId == null) + { + logger.debug("request is not for learner progress report"); + if ((isUserNamesVisible) && (!isLearnerRequest)) + { + logger.debug("isUserNamesVisible true, isLearnerRequest false" ); + logger.debug("getting alll the user' data"); + while (itUsers.hasNext()) + { + VoteQueUsr voteQueUsr=(VoteQueUsr)itUsers.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid); + List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid)); + logger.debug("listUserAttempts: " + listUserAttempts); + + Iterator itAttempts=listUserAttempts.iterator(); + while (itAttempts.hasNext()) + { + VoteUsrAttempt voteUsrResp=(VoteUsrAttempt)itAttempts.next(); + logger.debug("voteUsrResp: " + voteUsrResp); + + if (voteUsrResp != null) + { + VoteMonitoredUserDTO voteMonitoredUserDTO = new VoteMonitoredUserDTO(); + voteMonitoredUserDTO.setAttemptTime(voteUsrResp.getAttemptTime()); + //voteMonitoredUserDTO.setTimeZone(voteUsrResp.getTimezone()); + voteMonitoredUserDTO.setUid(voteUsrResp.getUid().toString()); + voteMonitoredUserDTO.setUserName(voteQueUsr.getFullname()); + voteMonitoredUserDTO.setQueUsrId(voteQueUsr.getUid().toString()); + voteMonitoredUserDTO.setSessionId(sessionId.toString()); + voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry()); + + String responsePresentable=VoteUtils.replaceNewLines(voteUsrResp.getUserEntry()); + logger.debug("responsePresentable: " + responsePresentable); + voteMonitoredUserDTO.setResponsePresentable(responsePresentable); + + voteMonitoredUserDTO.setQuestionUid(questionUid); + voteMonitoredUserDTO.setVisible(new Boolean(voteUsrResp.isVisible()).toString()); + listMonitoredUserContainerDTO.add(voteMonitoredUserDTO); + } + } + } + } + } + else if ((isUserNamesVisible) && (isLearnerRequest)) + { + logger.debug("just populating data normally just like monitoring summary, except that the data is ony for a specific session" ); + logger.debug("isUserNamesVisible true, isLearnerRequest true" ); + + String userID = VoteUtils.getCurrentLearnerID(); + logger.debug("userID: " + userID); + VoteQueUsr voteQueUsr=voteService.getVoteQueUsrById(new Long(userID).longValue()); + logger.debug("the current user voteQueUsr " + voteQueUsr + " and username: " + voteQueUsr.getUsername()); + + while (itUsers.hasNext()) + { + voteQueUsr=(VoteQueUsr)itUsers.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid); + List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid)); + logger.debug("listUserAttempts: " + listUserAttempts); + + Iterator itAttempts=listUserAttempts.iterator(); + while (itAttempts.hasNext()) + { + VoteUsrAttempt voteUsrResp=(VoteUsrAttempt)itAttempts.next(); + logger.debug("voteUsrResp: " + voteUsrResp); + + if (voteUsrResp != null) + { + VoteMonitoredUserDTO voteMonitoredUserDTO = new VoteMonitoredUserDTO(); + voteMonitoredUserDTO.setAttemptTime(voteUsrResp.getAttemptTime()); + //voteMonitoredUserDTO.setTimeZone(voteUsrResp.getTimezone()); + voteMonitoredUserDTO.setUid(voteUsrResp.getUid().toString()); + voteMonitoredUserDTO.setUserName(voteQueUsr.getFullname()); + voteMonitoredUserDTO.setQueUsrId(voteQueUsr.getUid().toString()); + voteMonitoredUserDTO.setSessionId(sessionId.toString()); + voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry()); + + String responsePresentable=VoteUtils.replaceNewLines(voteUsrResp.getUserEntry()); + logger.debug("responsePresentable: " + responsePresentable); + voteMonitoredUserDTO.setResponsePresentable(responsePresentable); + + voteMonitoredUserDTO.setQuestionUid(questionUid); + voteMonitoredUserDTO.setVisible(new Boolean(voteUsrResp.isVisible()).toString()); + listMonitoredUserContainerDTO.add(voteMonitoredUserDTO); + } + } + } + } + } + else if ((!isUserNamesVisible) && (isLearnerRequest)) + { + logger.debug("populating data normally exception are for a specific session and other user names are not visible."); + logger.debug("isUserNamesVisible false, isLearnerRequest true" ); + logger.debug("getting only current user's data" ); + + String userID = VoteUtils.getCurrentLearnerID(); + logger.debug("userID: " + userID); + + while (itUsers.hasNext()) + { + VoteQueUsr voteQueUsr=(VoteQueUsr)itUsers.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid); + List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid)); + logger.debug("listUserAttempts: " + listUserAttempts); + + Iterator itAttempts=listUserAttempts.iterator(); + while (itAttempts.hasNext()) + { + VoteUsrAttempt voteUsrResp=(VoteUsrAttempt)itAttempts.next(); + logger.debug("voteUsrResp: " + voteUsrResp); + + if (voteUsrResp != null) + { + VoteMonitoredUserDTO voteMonitoredUserDTO = new VoteMonitoredUserDTO(); + voteMonitoredUserDTO.setAttemptTime(voteUsrResp.getAttemptTime()); + //voteMonitoredUserDTO.setTimeZone(voteUsrResp.getTimezone()); + voteMonitoredUserDTO.setUid(voteUsrResp.getUid().toString()); + + logger.debug("userID versus queUsrId: " + userID + "-" + voteQueUsr.getQueUsrId()); + if (userID.equals(voteQueUsr.getQueUsrId().toString())) + { + logger.debug("this is current user, put his name normally."); + voteMonitoredUserDTO.setUserName(voteQueUsr.getFullname()); + } + else + { + logger.debug("this is not current user, put his name as blank."); + voteMonitoredUserDTO.setUserName(" "); + } + + voteMonitoredUserDTO.setQueUsrId(voteQueUsr.getUid().toString()); + voteMonitoredUserDTO.setSessionId(sessionId.toString()); + voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry()); + + String responsePresentable=VoteUtils.replaceNewLines(voteUsrResp.getUserEntry()); + logger.debug("responsePresentable: " + responsePresentable); + voteMonitoredUserDTO.setResponsePresentable(responsePresentable); + + voteMonitoredUserDTO.setQuestionUid(questionUid); + voteMonitoredUserDTO.setVisible(new Boolean(voteUsrResp.isVisible()).toString()); + listMonitoredUserContainerDTO.add(voteMonitoredUserDTO); + } + } + } + } + } + } + else + { + logger.debug("request is for learner progress report: " + userId); + while (itUsers.hasNext()) + { + VoteQueUsr voteQueUsr=(VoteQueUsr)itUsers.next(); + logger.debug("voteQueUsr: " + voteQueUsr); + + if (voteQueUsr != null) + { + logger.debug("getting listUserAttempts for user id: " + voteQueUsr.getUid() + " and que content id: " + questionUid); + List listUserAttempts=voteService.getAttemptsForUserAndQuestionContent(voteQueUsr.getUid(), new Long(questionUid)); + logger.debug("listUserAttempts: " + listUserAttempts); + + Iterator itAttempts=listUserAttempts.iterator(); + while (itAttempts.hasNext()) + { + VoteUsrAttempt voteUsrResp=(VoteUsrAttempt)itAttempts.next(); + logger.debug("voteUsrResp: " + voteUsrResp); + + if (voteUsrResp != null) + { + logger.debug("userID versus queUsrId: " + userId + "-" + voteQueUsr.getQueUsrId()); + if (userId.equals(voteQueUsr.getQueUsrId().toString())) + { + logger.debug("this is the user requested , include his name for learner progress."); + VoteMonitoredUserDTO voteMonitoredUserDTO = new VoteMonitoredUserDTO(); + voteMonitoredUserDTO.setAttemptTime(voteUsrResp.getAttemptTime()); + //voteMonitoredUserDTO.setTimeZone(voteUsrResp.getTimezone()); + voteMonitoredUserDTO.setUid(voteUsrResp.getUid().toString()); + voteMonitoredUserDTO.setUserName(voteQueUsr.getFullname()); + voteMonitoredUserDTO.setQueUsrId(voteQueUsr.getUid().toString()); + voteMonitoredUserDTO.setSessionId(sessionId.toString()); + voteMonitoredUserDTO.setResponse(voteUsrResp.getUserEntry()); + + String responsePresentable=VoteUtils.replaceNewLines(voteUsrResp.getUserEntry()); + logger.debug("responsePresentable: " + responsePresentable); + voteMonitoredUserDTO.setResponsePresentable(responsePresentable); + + voteMonitoredUserDTO.setQuestionUid(questionUid); + voteMonitoredUserDTO.setVisible(new Boolean(voteUsrResp.isVisible()).toString()); + listMonitoredUserContainerDTO.add(voteMonitoredUserDTO); + } + } + } + } + } + + } + + + logger.debug("final listMonitoredUserContainerDTO: " + listMonitoredUserContainerDTO); + mapMonitoredUserContainerDTO=convertToMcMonitoredUserDTOMap(listMonitoredUserContainerDTO); + logger.debug("final mapMonitoredUserContainerDTO:..." + mapMonitoredUserContainerDTO); + return mapMonitoredUserContainerDTO; + } + + + public static Map convertToMcMonitoredUserDTOMap(List list) + { + logger.debug("using convertToVoteMonitoredUserDTOMap: " + list); + Map map= new TreeMap(new VoteStringComparator()); + + Iterator listIterator=list.iterator(); + Long mapIndex=new Long(1); + + while (listIterator.hasNext()) + { + VoteMonitoredUserDTO data=(VoteMonitoredUserDTO)listIterator.next(); + map.put(mapIndex.toString(), data); + mapIndex=new Long(mapIndex.longValue()+1); + } + return map; + } + } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -22,11 +22,13 @@ package org.lamsfoundation.lams.tool.vote.web; +import java.io.FileNotFoundException; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -39,21 +41,30 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.contentrepository.NodeKey; import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; 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.VoteAttachmentDTO; -import org.lamsfoundation.lams.tool.vote.VoteComparator; import org.lamsfoundation.lams.tool.vote.VoteGeneralAuthoringDTO; +import org.lamsfoundation.lams.tool.vote.VoteNominationContentDTO; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; +import org.lamsfoundation.lams.tool.vote.pojos.VoteUploadedFile; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; +import org.lamsfoundation.lams.tool.vote.util.VoteToolContentHandler; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; /** * * @author Ozgur Demirtas @@ -103,6 +114,18 @@ path="/learning/Preview.jsp" redirect="false" /> + + + + Default struts dispatch method.

* @@ -167,900 +187,9 @@ voteAuthoringForm.resetUserAction(); return null; } - - - public boolean isNewNominationAdded(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) - { - logger.debug("doing isNewNominationAdded"); - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - IVoteService voteService=null; - if (getServlet() != null) - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - else - voteService = voteAuthoringForm.getVoteService(); - logger.debug("voteService :" +voteService); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); - - repopulateRequestParameters(request, voteAuthoringForm,voteGeneralAuthoringDTO); - - String httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - /* if httpSessionID is null that indicates the request is from Monitoring interface*/ - SessionMap sessionMap=null; - if (httpSessionID == null) - { - sessionMap = new SessionMap(); - voteAuthoringForm.setHttpSessionID(sessionMap.getSessionID()); - } - else - { - sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); - } - logger.debug("final sessionMap: " + sessionMap); - - voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(false).toString()); - - AuthoringUtil authoringUtil= new AuthoringUtil(); - - VoteUtils.saveRichText(request, voteGeneralAuthoringDTO, sessionMap); - - String toolContentID=voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("voteContent: " + voteContent); - - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); - logger.debug("mapOptionsContent : " + mapOptionsContent); - logger.debug("mapOptionsContent size: " + mapOptionsContent.size()); - - - mapOptionsContent=authoringUtil.reconstructOptionContentMapForAdd(mapOptionsContent, request); - logger.debug("final mapOptionsContent: " + mapOptionsContent); - - int maxIndex=mapOptionsContent.size(); - logger.debug("maxIndex: " + maxIndex); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - String firstEntry=(String)mapOptionsContent.get("1"); - logger.debug("firstEntry: " + firstEntry); - voteGeneralAuthoringDTO.setDefaultOptionContent(firstEntry); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - logger.debug("before fwd: mapOptionsContent: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - voteGeneralAuthoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - voteGeneralAuthoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - logger.debug("persisting sessionMap into session: " + sessionMap); - request.getSession().setAttribute(httpSessionID, sessionMap); - - return true; - - } /** - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward addNewNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException - { - logger.debug("dispathcing addNewNomination"); - boolean isNewNominationAdded=isNewNominationAdded(mapping, form, request, response); - logger.debug("isNewNominationAdded:" + isNewNominationAdded); - - /* 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); - - return (mapping.findForward(destination)); - } - - - public boolean isNominationRemoved(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - { - logger.debug("starting isNominationRemoved"); - - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - IVoteService voteService=null; - if (getServlet() != null) - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - else - voteService = voteAuthoringForm.getVoteService(); - logger.debug("voteService :" +voteService); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); - - String httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - /* if httpSessionID is null that indicates the request is from Monitoring interface*/ - SessionMap sessionMap=null; - if (httpSessionID == null) - { - sessionMap = new SessionMap(); - voteAuthoringForm.setHttpSessionID(sessionMap.getSessionID()); - } - else - { - sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); - } - logger.debug("final sessionMap: " + sessionMap); - - voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(false).toString()); - - AuthoringUtil authoringUtil= new AuthoringUtil(); - VoteUtils.saveRichText(request, voteGeneralAuthoringDTO,sessionMap); - - String toolContentID =voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); - logger.debug("mapOptionsContent : " + mapOptionsContent); - logger.debug("mapOptionsContent size: " + mapOptionsContent.size()); - - authoringUtil.reconstructOptionContentMapForRemove(mapOptionsContent, request, voteAuthoringForm); - - int maxIndex=mapOptionsContent.size(); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - String firstEntry=(String)mapOptionsContent.get("1"); - logger.debug("firstEntry: " + firstEntry); - voteGeneralAuthoringDTO.setDefaultOptionContent(firstEntry); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - logger.debug("before fwd: mapOptionsContent: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - voteGeneralAuthoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - voteGeneralAuthoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - logger.debug("persisting sessionMap into session: " + sessionMap); - request.getSession().setAttribute(httpSessionID, sessionMap); - - - return true; - } - - - public ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException - { - logger.debug("starting removeNomination "); - boolean isNominationRemoved=isNominationRemoved(mapping, form, request, response); - logger.debug("isNominationRemoved:" + isNominationRemoved); - - /* 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); - - return (mapping.findForward(destination)); - } - - - /** - * persists the content into the database - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public boolean submitContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - { - logger.debug("doing submitContent.."); - boolean validationErrors=false; - - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - IVoteService voteService=null; - if (getServlet() != null) - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - else - voteService = voteAuthoringForm.getVoteService(); - logger.debug("voteService :" +voteService); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); - - String httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - /* if httpSessionID is null that indicates the request is from Monitoring interface*/ - SessionMap sessionMap=null; - if (httpSessionID == null) - { - sessionMap = new SessionMap(); - voteAuthoringForm.setHttpSessionID(sessionMap.getSessionID()); - logger.debug("created new sessionMap with : " + sessionMap.getSessionID()); - //voteGeneralAuthoringDTO.setActiveModule(MONITORING); - } - else - { - sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); - } - - voteAuthoringForm.setSubmissionAttempt(new Boolean(true).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(true).toString()); - - voteGeneralAuthoringDTO.setValidationError(new Boolean(false).toString()); - - String toolContentID=voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("voteContent: " + voteContent); - - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - VoteUtils.saveRichText(request, voteGeneralAuthoringDTO,sessionMap); - - ActionMessages errors= new ActionMessages(); - /* - errors=validateSubmit(request, errors, voteAuthoringForm); - if (errors.size() > 0) - { - logger.debug("returning back to from to fix errors:"); - voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); - voteGeneralAuthoringDTO.setValidationError(new Boolean(true).toString()); - return false; - } - */ - - List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); - logger.debug("attachmentList :" +attachmentList); - - List deletedAttachmentList = (List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); - logger.debug("deletedAttachmentList :" +deletedAttachmentList); - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); - logger.debug("mapOptionsContent : " + mapOptionsContent); - logger.debug("mapOptionsContent size: " + mapOptionsContent.size()); - - 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()); - voteGeneralAuthoringDTO.setUserExceptionOptionsDuplicate(new Boolean(true).toString()); - validationErrors=true; - //return false; - } - - - int maxIndex=mapOptionsContent.size(); - logger.debug("maxIndex :" +maxIndex); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - - String firstEntry=(String)mapOptionsContent.get("1"); - logger.debug("firstEntry: " + firstEntry); - voteGeneralAuthoringDTO.setDefaultOptionContent(firstEntry); - - AuthoringUtil authoringUtil= new AuthoringUtil(); - mapOptionsContent=authoringUtil.reconstructOptionsContentMapForSubmit(mapOptionsContent, request); - logger.debug("before saveOrUpdateVoteContent, mapOptionsContent" + mapOptionsContent); - - - String maxNomCount=voteAuthoringForm.getMaxNominationCount(); - logger.debug("maxNomCount:" + maxNomCount); - - String activeModule=voteAuthoringForm.getActiveModule(); - logger.debug("activeModule:" + activeModule); - - if (activeModule != null) - { - if (activeModule.equals(AUTHORING)) - { - if (maxNomCount != null) - { - if (maxNomCount.equals("0")) - { - voteGeneralAuthoringDTO.setUserExceptionMaxNominationInvalid(new Boolean(true).toString()); - validationErrors=true; - //return false; - } - - try - { - int intMaxNomCount=new Integer(maxNomCount).intValue(); - logger.debug("intMaxNomCount : " +intMaxNomCount); - } - catch(NumberFormatException e) - { - voteGeneralAuthoringDTO.setUserExceptionMaxNominationInvalid(new Boolean(true).toString()); - validationErrors=true; - //return false; - } - } - } - } - - logger.debug("final validationErrors:" + validationErrors); - if (validationErrors == false) - { - /*to remove deleted entries in the questions table based on mapQuestionContent */ - authoringUtil.removeRedundantOptions(mapOptionsContent, voteService, voteAuthoringForm, request); - logger.debug("end of removing unused entries... "); - - voteContent=authoringUtil.saveOrUpdateVoteContent(mapOptionsContent, voteService, voteAuthoringForm, request, sessionMap); - logger.debug("voteContent: " + voteContent); - - - if (activeModule != null) - { - if (activeModule.equals(AUTHORING)) - { - logger.debug("start persisting offline files metadata"); - AuthoringUtil.persistFilesMetaData(request, voteService, true, voteContent, sessionMap); - logger.debug("start persisting online files metadata"); - AuthoringUtil.persistFilesMetaData(request, voteService, false, voteContent, sessionMap ); - - - /* making sure only the filenames in the session cache are persisted and the others in the db are removed*/ - logger.debug("start removing redundant offline files metadata"); - AuthoringUtil.removeRedundantOfflineFileItems(request, voteService, voteContent, sessionMap); - - logger.debug("start removing redundant online files metadata"); - AuthoringUtil.removeRedundantOnlineFileItems(request, voteService, voteContent, sessionMap); - logger.debug("done removing redundant files"); - } - } - - - logger.debug("toolContentID: " + toolContentID); - VoteUtils.setDefineLater(request, false, voteService, toolContentID); - logger.debug("define later set to false"); - - errors.clear(); - errors.add(Globals.ERROR_KEY, new ActionMessage("sbmt.successful")); - voteAuthoringForm.setSbmtSuccess(new Boolean(true).toString()); - voteGeneralAuthoringDTO.setSbmtSuccess(new Boolean(true).toString()); - logger.debug("setting SUBMIT_SUCCESS to 1."); - } - - saveErrors(request,errors); - - voteAuthoringForm.resetUserAction(); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - logger.debug("before fwd: mapOptionsContent: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - voteGeneralAuthoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - voteGeneralAuthoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - voteAuthoringForm.setDefineLaterInEditMode(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - logger.debug("persisting sessionMap into session: " + sessionMap); - request.getSession().setAttribute(httpSessionID, sessionMap); - - - return true; - } - - - public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { - - logger.debug("starting submitAllContent :" +form); - - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO=new VoteGeneralAuthoringDTO(); - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); - - /* 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); - - - boolean isContentSubmitted=submitContent(mapping, form, request, response); - logger.debug("isContentSubmitted :" +isContentSubmitted); - - if (isContentSubmitted == true) - { - voteAuthoringForm.setSbmtSuccess(new Boolean(true).toString()); - } - - - logger.debug("final submit status :" +voteAuthoringForm.getSbmtSuccess()); - logger.debug("fwding to destination :" +destination); - - request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE); - return (mapping.findForward(destination)); - } - - - public boolean isMoveNominationDown(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) - { - logger.debug("starting isMoveNominationDown..."); - - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - IVoteService voteService=null; - if (getServlet() != null) - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - else - voteService = voteAuthoringForm.getVoteService(); - logger.debug("voteService :" +voteService); - - VoteUtils.cleanUpUserExceptions(request); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); - - - String toolContentID=voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("voteContent: " + voteContent); - - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - String httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - /* if httpSessionID is null that indicates the request is from Monitoring interface*/ - SessionMap sessionMap=null; - if (httpSessionID == null) - { - sessionMap = new SessionMap(); - voteAuthoringForm.setHttpSessionID(sessionMap.getSessionID()); - } - else - { - sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); - } - logger.debug("final sessionMap: " + sessionMap); - - voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(false).toString()); - - VoteUtils.saveRichText(request, voteGeneralAuthoringDTO, sessionMap); - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); - logger.debug("mapOptionsContent : " + mapOptionsContent); - logger.debug("mapOptionsContent size: " + mapOptionsContent.size()); - - /* perform a move down if there are at least 2 nominations*/ - if (mapOptionsContent.size() > 1) - { - String optIndex =voteAuthoringForm.getOptIndex(); - logger.debug("optIndex:" + optIndex); - String movableOptionEntry=(String)mapOptionsContent.get(optIndex); - logger.debug("movableOptionEntry:" + movableOptionEntry); - - if (movableOptionEntry != null && (!movableOptionEntry.equals(""))) - { - mapOptionsContent= AuthoringUtil.shiftMap(mapOptionsContent, optIndex,movableOptionEntry, "down"); - logger.debug("mapOptionsContent after move down: " + mapOptionsContent); - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - } - } - - voteAuthoringForm.resetUserAction(); - - - int maxIndex=mapOptionsContent.size(); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - String firstEntry=(String)mapOptionsContent.get("1"); - logger.debug("firstEntry: " + firstEntry); - voteGeneralAuthoringDTO.setDefaultOptionContent(firstEntry); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - logger.debug("before fwd: mapOptionsContent: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - voteGeneralAuthoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - voteGeneralAuthoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - logger.debug("persisting sessionMap into session: " + sessionMap); - request.getSession().setAttribute(httpSessionID, sessionMap); - - return true; - } - - - /** - * shifts the nominations map for moving down - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws IOException - * @throws ServletException - */ - public ActionForward moveNominationDown(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - /* 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); - - boolean isMoveNominationDown=isMoveNominationDown(mapping, form, request, response); - logger.debug("isMoveNominationDown:" + isMoveNominationDown); - - return (mapping.findForward(destination)); - } - - - /** - * shifts the nominations map for moving up - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public boolean isMoveNominationUp(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) - { - logger.debug("starting isMoveNominationUp..."); - - VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - - IVoteService voteService=null; - if (getServlet() != null) - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - else - voteService = voteAuthoringForm.getVoteService(); - logger.debug("voteService :" +voteService); - VoteUtils.cleanUpUserExceptions(request); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); - - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); - - String toolContentID=voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("voteContent: " + voteContent); - - - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - voteGeneralAuthoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - String httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - /* if httpSessionID is null that indicates the request is from Monitoring interface*/ - SessionMap sessionMap=null; - if (httpSessionID == null) - { - sessionMap = new SessionMap(); - voteAuthoringForm.setHttpSessionID(sessionMap.getSessionID()); - } - else - { - sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); - logger.debug("sessionMap: " + sessionMap); - - } - - voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(false).toString()); - - /* 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.saveRichText(request, voteGeneralAuthoringDTO, sessionMap); - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - mapOptionsContent=AuthoringUtil.repopulateMap(request, "optionContent"); - logger.debug("mapOptionsContent : " + mapOptionsContent); - logger.debug("mapOptionsContent size: " + mapOptionsContent.size()); - - - /* perform a move down if there are at least 2 nominations */ - if (mapOptionsContent.size() > 1) - { - String optIndex =voteAuthoringForm.getOptIndex(); - logger.debug("optIndex:" + optIndex); - String movableOptionEntry=(String)mapOptionsContent.get(optIndex); - logger.debug("movableOptionEntry:" + movableOptionEntry); - - if (movableOptionEntry != null && (!movableOptionEntry.equals(""))) - { - mapOptionsContent= AuthoringUtil.shiftMap(mapOptionsContent, optIndex,movableOptionEntry, "up"); - logger.debug("mapOptionsContent after move down: " + mapOptionsContent); - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - } - } - - voteAuthoringForm.resetUserAction(); - - - mapOptionsContent=(Map)sessionMap.get(MAP_OPTIONS_CONTENT_KEY); - logger.debug("mapOptionsContent: " + mapOptionsContent); - - int maxIndex=mapOptionsContent.size(); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - String firstEntry=(String)mapOptionsContent.get("1"); - logger.debug("firstEntry: " + firstEntry); - voteGeneralAuthoringDTO.setDefaultOptionContent(firstEntry); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - logger.debug("before fwd: mapOptionsContent: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - - sessionMap.put(MAP_OPTIONS_CONTENT_KEY, mapOptionsContent); - - List listOnlineFilesMetaData =(List)sessionMap.get(LIST_ONLINEFILES_METADATA_KEY); - logger.debug("listOnlineFilesMetaData:" + listOnlineFilesMetaData); - voteGeneralAuthoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listOfflineFilesMetaData =(List)sessionMap.get(LIST_OFFLINEFILES_METADATA_KEY); - logger.debug("listOfflineFilesMetaData:" + listOfflineFilesMetaData); - voteGeneralAuthoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - httpSessionID=voteAuthoringForm.getHttpSessionID(); - logger.debug("httpSessionID: " + httpSessionID); - - logger.debug("persisting sessionMap into session: " + sessionMap); - request.getSession().setAttribute(httpSessionID, sessionMap); - - return true; - } - - - public ActionForward moveNominationUp(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - /* 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); - - boolean isMoveNominationUp=isMoveNominationUp(mapping, form, request, response); - logger.debug("isMoveNominationUp:" + isMoveNominationUp); - - return (mapping.findForward(destination)); - } - - - /** - * checks the user entries before submit is performed - * @param request - * @param errors - * @param voteAuthoringForm - * @return - */ - protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, VoteAuthoringForm voteAuthoringForm) - { - logger.debug("starting validateSubmit"); - String title = voteAuthoringForm.getTitle(); - logger.debug("title: " + title); - - String instructions = voteAuthoringForm.getInstructions(); - logger.debug("instructions: " + instructions); - - boolean validateSuccess=true; - if ((title == null) || (title.trim().length() == 0) || title.equalsIgnoreCase(RICHTEXT_BLANK)) - { - validateSuccess=false; - } - - if ((instructions == null) || (instructions.trim().length() == 0) || instructions.equalsIgnoreCase(RICHTEXT_BLANK)) - { - validateSuccess=false; - } - - /* - * enforce that the first (default) question entry is not empty - */ - String defaultOptionEntry =request.getParameter("optionContent0"); - if ((defaultOptionEntry == null) || (defaultOptionEntry.length() == 0)) - { - validateSuccess=false; } - - if (validateSuccess == false) - { - errors.add(Globals.ERROR_KEY, new ActionMessage("error.fields.mandatory")); - logger.debug("validate success is false"); - } - - saveErrors(request,errors); - return errors; - } - - - /** * persists offline files * * @param mapping @@ -1089,6 +218,11 @@ logger.debug("voteAuthoringForm :" +voteAuthoringForm); VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); String httpSessionID=voteAuthoringForm.getHttpSessionID(); @@ -1202,6 +336,11 @@ VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + String httpSessionID=voteAuthoringForm.getHttpSessionID(); logger.debug("httpSessionID: " + httpSessionID); @@ -1312,7 +451,11 @@ VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); - + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); String httpSessionID=voteAuthoringForm.getHttpSessionID(); @@ -1401,6 +544,10 @@ VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; logger.debug("voteAuthoringForm :" +voteAuthoringForm); VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); @@ -1464,7 +611,7 @@ } /** - * used in define later to switch from view-only to editable mode + * used in define later mode to switch from view-only to editable screen * * @param mapping * @param form @@ -1483,95 +630,107 @@ ToolException { logger.debug("dispatching editActivityQuestions..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; - logger.debug("voteAuthoringForm :" +voteAuthoringForm); - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO = new VoteGeneralAuthoringDTO(); - - repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("voteAuthoringForm: " + voteAuthoringForm); + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); - voteAuthoringForm.setSubmissionAttempt(new Boolean(false).toString()); - voteGeneralAuthoringDTO.setSubmissionAttempt(new Boolean(false).toString()); + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + voteAuthoringForm.setHttpSessionID(httpSessionID); - - /* 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); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); - voteAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString()); - voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + String activeModule=DEFINE_LATER; - String toolContentID=voteAuthoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); - VoteUtils.readContentValues(request, voteContent, voteAuthoringForm, voteGeneralAuthoringDTO); - logger.debug("form title is: : " + voteAuthoringForm.getTitle()); - /* - * get the nominations - */ - Map mapOptionsContent= new TreeMap(new VoteComparator()); - logger.debug("setting existing content data from the db"); + logger.debug("title: " + voteContent.getTitle()); + logger.debug("instructions: " + voteContent.getInstructions()); + + voteGeneralAuthoringDTO.setActivityTitle(voteContent.getTitle()); + voteAuthoringForm.setTitle(voteContent.getTitle()); + + voteGeneralAuthoringDTO.setActivityInstructions(voteContent.getInstructions()); + + sessionMap.put(ACTIVITY_TITLE_KEY, voteContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, voteContent.getInstructions()); + + voteAuthoringForm.setDefineLaterInEditMode(new Boolean(true).toString()); + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + + VoteUtils.setDefineLater(request, true, strToolContentID, voteService); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + List listNominationContentDTO= new LinkedList(); + Iterator queIterator=voteContent.getVoteQueContents().iterator(); - Long mapIndex=new Long(1); - logger.debug("mapOptionsContent: " + mapOptionsContent); while (queIterator.hasNext()) { + VoteNominationContentDTO voteNominationContentDTO=new VoteNominationContentDTO(); + VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); - logger.debug("voteQueContent : " + voteQueContent); if (voteQueContent != null) { logger.debug("question: " + voteQueContent.getQuestion()); - mapOptionsContent.put(mapIndex.toString(),voteQueContent.getQuestion()); - /** - * make the first entry the default(first) one for jsp - */ - if (mapIndex.longValue() == 1) - { - voteGeneralAuthoringDTO.setDefaultOptionContent(voteQueContent.getQuestion()); - } + logger.debug("displayorder: " + new Integer(voteQueContent.getDisplayOrder()).toString()); - mapIndex=new Long(mapIndex.longValue()+1); + voteNominationContentDTO.setQuestion(voteQueContent.getQuestion()); + voteNominationContentDTO.setDisplayOrder(new Integer(voteQueContent.getDisplayOrder()).toString()); + //voteNominationContentDTO.setFeedback(voteQueContent.getFeedback()); + listNominationContentDTO.add(voteNominationContentDTO); } } - logger.debug("Map initialized with existing contentid to: " + mapOptionsContent); - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); - int maxIndex=mapOptionsContent.size(); - logger.debug("maxIndex: " + maxIndex); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + request.getSession().setAttribute(httpSessionID, sessionMap); - boolean isContentInUse=VoteUtils.isContentInUse(voteContent); - logger.debug("isContentInUse:" + isContentInUse); - - voteGeneralAuthoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - if (isContentInUse == true) - { - logger.debug("monitoring url does not allow editActivity since the content is in use."); - persistInRequestError(request,"error.content.inUse"); - voteGeneralAuthoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); - } - - VoteUtils.setDefineLater(request, true, voteService, toolContentID); - - logger.debug("active module is: " + voteAuthoringForm.getActiveModule()); - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + logger.debug("before fwding to jsp, voteAuthoringForm: " + voteAuthoringForm); + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - logger.debug("forwarding to : " + destination); - return mapping.findForward(destination); + + logger.debug("forwarding to : " + LOAD_QUESTIONS); + return mapping.findForward(LOAD_QUESTIONS); } + /** + * repopulateRequestParameters + * reads and saves request parameters + * + * @param request + * @param voteAuthoringForm + * @param voteGeneralAuthoringDTO + */ protected void repopulateRequestParameters(HttpServletRequest request, VoteAuthoringForm voteAuthoringForm, VoteGeneralAuthoringDTO voteGeneralAuthoringDTO) { @@ -1592,11 +751,6 @@ voteAuthoringForm.setHttpSessionID(httpSessionID); voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); - String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); - logger.debug("defaultContentIdStr: " + defaultContentIdStr); - voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - String defineLaterInEditMode=request.getParameter(DEFINE_LATER_IN_EDIT_MODE); logger.debug("defineLaterInEditMode: " + defineLaterInEditMode); voteAuthoringForm.setDefineLaterInEditMode(defineLaterInEditMode); @@ -1621,6 +775,27 @@ logger.debug("maxNominationCount: " + maxNominationCount); voteAuthoringForm.setMaxNominationCount(maxNominationCount); voteGeneralAuthoringDTO.setMaxNominationCount(maxNominationCount); + + String reflect=request.getParameter("reflect"); + logger.debug("reflect: " + reflect); + voteAuthoringForm.setReflect(reflect); + voteGeneralAuthoringDTO.setReflect(reflect); + + String reflectionSubject=request.getParameter("reflectionSubject"); + logger.debug("reflectionSubject: " + reflectionSubject); + voteAuthoringForm.setReflectionSubject(reflectionSubject); + voteGeneralAuthoringDTO.setReflectionSubject(reflectionSubject); + + + String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + voteAuthoringForm.setOfflineInstructions(offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + logger.debug("onlineInstructions: " + onlineInstructions); + voteAuthoringForm.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); } @@ -1636,5 +811,1752 @@ logger.debug("add " + message +" to ActionMessages:"); saveErrors(request,errors); } + + + /** + * moveNominationDown + * + * moves a nomination down in the authoring list + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward moveNominationDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveNominationDown"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.swapNodes(listNominationContentDTO, questionIndex, "down"); + logger.debug("listNominationContentDTO after swap: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.reorderSimpleListNominationContentDTO(listNominationContentDTO); + logger.debug("listNominationContentDTO after reordersimple: " + listNominationContentDTO); + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + logger.debug("fwd ing to LOAD_NOMINATIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * moveNominationUp + * + * moves a nomination up in the authoring list + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward moveNominationUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveNominationUp"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.swapNodes(listNominationContentDTO, questionIndex, "up"); + logger.debug("listNominationContentDTO after swap: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.reorderSimpleListNominationContentDTO(listNominationContentDTO); + logger.debug("listNominationContentDTO after reordersimple: " + listNominationContentDTO); + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + logger.debug("fwd ing to LOAD_NOMINATIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * removeNomination + * + * removes a nomination from the authoring list + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching removeNomination"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + break; + } + + } + } + + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + voteNominationContentDTO.setNomination(""); + logger.debug("listNominationContentDTO after remove:" + listNominationContentDTO); + + + listNominationContentDTO=AuthoringUtil.reorderListNominationContentDTO(listNominationContentDTO, questionIndex ); + logger.debug("listNominationContentDTO reordered:" + listNominationContentDTO); + + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("voteNominationContentDTO now: " + voteNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /** + * newEditableNominationBox + * + * enables editing a nomination + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward newEditableNominationBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispathcing newEditableNominationBox"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + voteAuthoringForm.setEditableNominationIndex(questionIndex); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + String editableNomination=""; + String editableFeedback=""; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + editableFeedback=voteNominationContentDTO.getFeedback(); + editableNomination=voteNominationContentDTO.getNomination(); + logger.debug("editableFeedback found :" + editableFeedback); + break; + } + + } + } + logger.debug("editableFeedback found :" + editableFeedback); + logger.debug("editableNomination found :" + editableNomination); + + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + + voteGeneralAuthoringDTO.setEditableNominationText(editableNomination); + voteGeneralAuthoringDTO.setEditableNominationFeedback (editableFeedback); + voteAuthoringForm.setFeedback(editableFeedback); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + logger.debug("fwd ing to editNominationBox: "); + return (mapping.findForward("editNominationBox")); + } + + + /** + * newNominationBox + * + * enables adding a new nomination + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward newNominationBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispathcing newNominationBox"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + logger.debug("fwd ing to newNominationBox: "); + return (mapping.findForward("newNominationBox")); + } + + /** + * addSingleNomination + * + * enables adding a new nomination to the authoring nominations list + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward addSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispathcing addSingleNomination"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + String newNomination=request.getParameter("newNomination"); + logger.debug("newNomination: " + newNomination); + + String feedback=request.getParameter("feedback"); + logger.debug("feedback: " + feedback); + + + int listSize=listNominationContentDTO.size(); + logger.debug("listSize: " + listSize); + + if ((newNomination != null) && (newNomination.length() > 0)) + { + boolean duplicates=AuthoringUtil.checkDuplicateNominations(listNominationContentDTO, newNomination); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + VoteNominationContentDTO voteNominationContentDTO=new VoteNominationContentDTO(); + voteNominationContentDTO.setDisplayOrder(new Long(listSize+1).toString()); + voteNominationContentDTO.setFeedback(feedback); + voteNominationContentDTO.setNomination(newNomination); + + listNominationContentDTO.add(voteNominationContentDTO); + logger.debug("updated listNominationContentDTO: " + listNominationContentDTO); + } + else + { + logger.debug("entry duplicate, not adding"); + + } + } + else + { + logger.debug("entry blank, not adding"); + + } + + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + + String richTextTitle=(String)sessionMap.get(ACTIVITY_TITLE_KEY); + logger.debug("richTextTitle: " + richTextTitle); + String richTextInstructions=(String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY); + logger.debug("richTextInstructions: " + richTextInstructions); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOfflineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + } + + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + request.getSession().setAttribute(httpSessionID, sessionMap); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("httpSessionID: " + httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + logger.debug("voteGeneralAuthoringDTO.getMapNominationContent(); " + voteGeneralAuthoringDTO.getMapNominationContent()); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * saveSingleNomination + * saves a new or updated nomination in the authoring nominations list + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward saveSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("dispathcing saveSingleNomination"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + + String editNominationBoxRequest=request.getParameter("editNominationBoxRequest"); + logger.debug("editNominationBoxRequest: " + editNominationBoxRequest); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + + String newNomination=request.getParameter("newNomination"); + logger.debug("newNomination: " + newNomination); + + String feedback=request.getParameter("feedback"); + logger.debug("feedback: " + feedback); + + + String editableNominationIndex=request.getParameter("editableNominationIndex"); + logger.debug("editableNominationIndex: " + editableNominationIndex); + + + if ((newNomination != null) && (newNomination.length() > 0)) + { + if ((editNominationBoxRequest != null) && (editNominationBoxRequest.equals("false"))) + { + logger.debug("request for add and save"); + boolean duplicates=AuthoringUtil.checkDuplicateNominations(listNominationContentDTO, newNomination); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getQuestion()); + + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableNominationIndex)) + { + break; + } + + } + } + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + + voteNominationContentDTO.setQuestion(newNomination); + voteNominationContentDTO.setFeedback(feedback); + voteNominationContentDTO.setDisplayOrder(editableNominationIndex); + + listNominationContentDTO=AuthoringUtil.reorderUpdateListNominationContentDTO(listNominationContentDTO, voteNominationContentDTO, editableNominationIndex); + logger.debug("post reorderUpdateListNominationContentDTO listNominationContentDTO: " + listNominationContentDTO); + } + else + { + logger.debug("duplicate question entry, not adding"); + } + } + else + { + logger.debug("request for edit and save."); + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableNominationIndex)) + { + break; + } + + } + } + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + + voteNominationContentDTO.setNomination(newNomination); + voteNominationContentDTO.setFeedback(feedback); + voteNominationContentDTO.setDisplayOrder(editableNominationIndex); + + listNominationContentDTO=AuthoringUtil.reorderUpdateListNominationContentDTO(listNominationContentDTO, voteNominationContentDTO, editableNominationIndex); + logger.debug("post reorderUpdateListNominationContentDTO listNominationContentDTO: " + listNominationContentDTO); + } + } + else + { + logger.debug("entry blank, not adding"); + } + + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + + String richTextTitle=(String)sessionMap.get(ACTIVITY_TITLE_KEY); + logger.debug("richTextTitle: " + richTextTitle); + String richTextInstructions=(String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY); + logger.debug("richTextInstructions: " + richTextInstructions); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOfflineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + + } + + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("httpSessionID: " + httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + request.getSession().setAttribute(httpSessionID, sessionMap); + logger.debug("voteGeneralAuthoringDTO.getMapNominationContent(); " + voteGeneralAuthoringDTO.getMapNominationContent()); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /** + * submitAllContent + * + * persists the nominations list and other user selections in the db. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispathcing submitAllContent :" +form); + + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + Map mapNominationContent=AuthoringUtil.extractMapNominationContent(listNominationContentDTO); + logger.debug("extracted mapNominationContent: " + mapNominationContent); + + + Map mapFeedback=AuthoringUtil.extractMapFeedback(listNominationContentDTO); + logger.debug("extracted mapFeedback: " + mapFeedback); + + ActionMessages errors = new ActionMessages(); + logger.debug("mapNominationContent size: " + mapNominationContent.size()); + + if (mapNominationContent.size() == 0) + { + ActionMessage error = new ActionMessage("nominations.none.submitted"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + + + String maxNomCount=voteAuthoringForm.getMaxNominationCount(); + logger.debug("maxNomCount:" + maxNomCount); + + if (activeModule != null) + { + if (activeModule.equals(AUTHORING)) + { + if (maxNomCount != null) + { + if (maxNomCount.equals("0")) + { + ActionMessage error = new ActionMessage("maxNomination.invalid"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + + try + { + int intMaxNomCount=new Integer(maxNomCount).intValue(); + logger.debug("intMaxNomCount : " +intMaxNomCount); + } + catch(NumberFormatException e) + { + ActionMessage error = new ActionMessage("maxNomination.invalid"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + } + } + } + + boolean nominationsDuplicate=AuthoringUtil.verifyDuplicateNominations(mapNominationContent); + logger.debug("nominationsDuplicate :" +nominationsDuplicate); + + if (nominationsDuplicate == true) + { + ActionMessage error = new ActionMessage("nominations.duplicate"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + + logger.debug("errors: " + errors); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + List attachmentListBackup= new ArrayList(); + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + attachmentListBackup=attachmentList; + + List deletedAttachmentListBackup= new ArrayList(); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + deletedAttachmentListBackup=deletedAttachmentList; + + String onlineInstructions=(String)sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + + String offlineInstructions=(String)sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + voteGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOfflineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + + } + + + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + voteGeneralAuthoringDTO.setMapNominationContent(mapNominationContent); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("there are no issues with input, continue and submit data"); + + VoteContent voteContentTest=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContentTest: " + voteContentTest); + + logger.debug("errors: " + errors); + if(!errors.isEmpty()){ + saveErrors(request, errors); + logger.debug("errors saved: " + errors); + } + + + VoteContent voteContent=voteContentTest; + if(errors.isEmpty()){ + logger.debug("errors is empty: " + errors); + /*to remove deleted entries in the questions table based on mapNominationContent */ + authoringUtil.removeRedundantNominations(mapNominationContent, voteService, voteAuthoringForm, request, strToolContentID); + logger.debug("end of removing unused entries... "); + + voteContent=authoringUtil.saveOrUpdateVoteContent(mapNominationContent, mapFeedback, voteService, voteAuthoringForm, request, voteContentTest, strToolContentID); + logger.debug("voteContent: " + voteContent); + + + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (voteContent != null) + { + voteGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + logger.debug("updated voteGeneralAuthoringDTO to: " + voteGeneralAuthoringDTO); + + authoringUtil.reOrganizeDisplayOrder(mapNominationContent, voteService, voteAuthoringForm, voteContent); + + logger.debug("activeModule: " + activeModule); + if (activeModule.equals(AUTHORING)) + { + logger.debug("since it is authoring save the attachments: "); + + List attachmentList= (List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + + List attachments=saveAttachments(voteContent,attachmentList, deletedAttachmentList, mapping, request); + logger.debug("attachments: " + attachments); + } + + logger.debug("strToolContentID: " + strToolContentID); + VoteUtils.setDefineLater(request, false, strToolContentID, voteService); + logger.debug("define later set to false"); + + if (activeModule.equals(AUTHORING)) + { + logger.debug("standard authoring close"); + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE); + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + } + else + { + logger.debug("go back to view only screen"); + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + } + + } + else + { + logger.debug("errors is not empty: " + errors); + + if (voteContent != null) + { + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (voteContent != null) + { + voteGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + + } + } + + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString()); + + voteAuthoringForm.resetUserAction(); + voteGeneralAuthoringDTO.setMapNominationContent(mapNominationContent); + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + request.getSession().setAttribute(httpSessionID, sessionMap); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("1"); + + logger.debug("forwarding to :" + LOAD_QUESTIONS); + return mapping.findForward(LOAD_QUESTIONS); + } + + + + private VoteToolContentHandler getToolContentHandler() + { + if ( toolContentHandler == null ) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); + toolContentHandler = (VoteToolContentHandler) wac.getBean("voteToolContentHandler"); + } + return toolContentHandler; + } + + /** + * saveAttachments + * + * persists uploaded files + * + * @param voteContent + * @param attachmentList + * @param deletedAttachmentList + * @param mapping + * @param request + * @return + */ + private List saveAttachments (VoteContent voteContent, + List attachmentList, List deletedAttachmentList, + ActionMapping mapping, HttpServletRequest request) { + + logger.debug("start saveAttachments, attachmentList " + attachmentList); + logger.debug("start deletedAttachmentList, deletedAttachmentList " + deletedAttachmentList); + + if(attachmentList==null || deletedAttachmentList==null) + return null; + + IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + if ( deletedAttachmentList != null ) { + logger.debug("deletedAttachmentList is iterated..."); + Iterator iter = deletedAttachmentList.iterator(); + while (iter.hasNext()) { + VoteUploadedFile attachment = (VoteUploadedFile) iter.next(); + logger.debug("attachment: " + attachment); + + if ( attachment.getSubmissionId() != null ) { + voteService.removeFile(attachment.getSubmissionId()); + } + } + deletedAttachmentList.clear(); + logger.error("cleared attachment list."); + } + + + if ( attachmentList != null ) + { + logger.debug("attachmentList is iterated..."); + Iterator iter = attachmentList.iterator(); + while (iter.hasNext()) { + VoteUploadedFile attachment = (VoteUploadedFile) iter.next(); + logger.debug("attachment: " + attachment); + logger.debug("attachment submission id: " + attachment.getSubmissionId()); + + if ( attachment.getSubmissionId() == null ) { + /* add entry to tool table - file already in content repository */ + logger.debug("calling persistFile with attachment: " + attachment); + voteService.persistFile(voteContent, attachment); + } + } + } + + return deletedAttachmentList; + } + + + /** + * deleteFile + * + * removes an uploaded file + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward deleteFile(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + logger.debug("dispatching deleteFile"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=request.getParameter(HTTP_SESSION_ID); + logger.debug("httpSessionID: " + httpSessionID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + List listQuestionContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listQuestionContentDTO: " + listQuestionContentDTO); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listQuestionContentDTO); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setSbmtSuccess( new Integer(0).toString()); + + + String onlineInstructions=(String) sessionMap.get(ONLINE_INSTRUCTIONS_KEY); + logger.debug("onlineInstructions: " + onlineInstructions); + + String offlineInstructions=(String) sessionMap.get(OFFLINE_INSTRUCTIONS_KEY); + logger.debug("offlineInstructions: " + offlineInstructions); + + + logger.debug("onlineInstructions: " + onlineInstructions); + logger.debug("offlineInstructions: " + offlineInstructions); + voteAuthoringForm.setOnlineInstructions(onlineInstructions); + voteAuthoringForm.setOfflineInstructions(offlineInstructions); + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + + String richTextTitle=(String)sessionMap.get(ACTIVITY_TITLE_KEY); + String richTextInstructions=(String)sessionMap.get(ACTIVITY_INSTRUCTIONS_KEY); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + long uuid = WebUtil.readLongParam(request, UUID); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + + if(attachmentList == null) + attachmentList = new ArrayList(); + + + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + if(deletedAttachmentList == null) + deletedAttachmentList = new ArrayList(); + + /* move the file's details from the attachment collection to the deleted attachments collection + the attachment will be delete on saving. */ + + deletedAttachmentList = VoteUtils.moveToDelete(Long.toString(uuid), attachmentList, deletedAttachmentList ); + logger.debug("post moveToDelete, attachmentList: " + attachmentList); + logger.debug("post moveToDelete, deletedAttachmentList: " + deletedAttachmentList); + + + sessionMap.put(ATTACHMENT_LIST_KEY,attachmentList); + sessionMap.put(DELETED_ATTACHMENT_LIST_KEY,deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("3"); + + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listQuestionContentDTO.size())); + + voteAuthoringForm.resetUserAction(); + logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS); + + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * addNewFile + * + * adds a new uploaded file to the uploadedfiles list + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward addNewFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispathching addNewFile"); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String onlineInstructions=request.getParameter(ONLINE_INSTRUCTIONS); + logger.debug("onlineInstructions: " + onlineInstructions); + + String offlineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); + logger.debug("offlineInstructions: " + offlineInstructions); + + sessionMap.put(ONLINE_INSTRUCTIONS_KEY, onlineInstructions); + sessionMap.put(OFFLINE_INSTRUCTIONS, offlineInstructions); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); + voteGeneralAuthoringDTO.setOfflineInstructions(offlineInstructions); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + List attachmentList=(List)sessionMap.get(ATTACHMENT_LIST_KEY); + logger.debug("attachmentList: " + attachmentList); + List deletedAttachmentList=(List)sessionMap.get(DELETED_ATTACHMENT_LIST_KEY); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + addFileToContentRepository(request, voteAuthoringForm, attachmentList, deletedAttachmentList, sessionMap, voteGeneralAuthoringDTO); + logger.debug("post addFileToContentRepository, attachmentList: " + attachmentList); + logger.debug("post addFileToContentRepository, deletedAttachmentList: " + deletedAttachmentList); + + sessionMap.put(ATTACHMENT_LIST_KEY,attachmentList); + sessionMap.put(DELETED_ATTACHMENT_LIST_KEY,deletedAttachmentList); + + voteGeneralAuthoringDTO.setAttachmentList(attachmentList); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setCurrentTab("3"); + + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + voteAuthoringForm.resetUserAction(); + + String strOnlineInstructions= request.getParameter("onlineInstructions"); + String strOfflineInstructions= request.getParameter("offlineInstructions"); + logger.debug("onlineInstructions: " + strOnlineInstructions); + logger.debug("offlineInstructions: " + strOnlineInstructions); + voteAuthoringForm.setOnlineInstructions(strOnlineInstructions); + voteAuthoringForm.setOfflineInstructions(strOfflineInstructions); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + logger.debug("fwd ing to LOAD_QUESTIONS: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * addFileToContentRepository + * + * persists files data in the content repository + * + * @param request + * @param voteAuthoringForm + * @param attachmentList + * @param deletedAttachmentList + * @param sessionMap + * @param voteGeneralAuthoringDTO + */ + public void addFileToContentRepository(HttpServletRequest request, VoteAuthoringForm voteAuthoringForm, + List attachmentList, List deletedAttachmentList, SessionMap sessionMap, + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO) + { + logger.debug("attempt addFileToContentRepository"); + logger.debug("attachmentList: " + attachmentList); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + if(attachmentList == null) + attachmentList = new ArrayList(); + + if(deletedAttachmentList == null) + deletedAttachmentList = new ArrayList(); + + FormFile uploadedFile = null; + boolean isOnlineFile = false; + String fileType = null; + if(voteAuthoringForm.getTheOfflineFile() != null && voteAuthoringForm.getTheOfflineFile().getFileSize() > 0 ){ + logger.debug("theOfflineFile is available: "); + uploadedFile = voteAuthoringForm.getTheOfflineFile(); + logger.debug("uploadedFile: " + uploadedFile); + fileType = IToolContentHandler.TYPE_OFFLINE; + } + else if(voteAuthoringForm.getTheOnlineFile() != null && voteAuthoringForm.getTheOnlineFile().getFileSize() > 0 ){ + logger.debug("theOnlineFile is available: "); + uploadedFile = voteAuthoringForm.getTheOnlineFile(); + logger.debug("uploadedFile: " + uploadedFile); + isOnlineFile = true; + fileType = IToolContentHandler.TYPE_ONLINE; + } + else + /*no file uploaded*/ + return; + + logger.debug("uploadedFile.getFileName(): " + uploadedFile.getFileName()); + + /* if a file with the same name already exists then move the old one to deleted */ + deletedAttachmentList = VoteUtils.moveToDelete(uploadedFile.getFileName(), isOnlineFile, attachmentList, deletedAttachmentList ); + logger.debug("deletedAttachmentList: " + deletedAttachmentList); + + try + { + /* This is a new file and so is saved to the content repository. Add it to the + attachments collection, but don't add it to the tool's tables yet. + */ + NodeKey node = getToolContentHandler().uploadFile(uploadedFile.getInputStream(), uploadedFile.getFileName(), + uploadedFile.getContentType(), fileType); + VoteUploadedFile file = new VoteUploadedFile(); + String fileName=uploadedFile.getFileName(); + logger.debug("fileName: " + fileName); + logger.debug("fileName length: " + fileName.length()); + + if ((fileName != null) && (fileName.length() > 30)) + { + fileName=fileName.substring(0, 31); + logger.debug("shortened fileName: " + fileName); + } + + file.setFileName(fileName); + file.setFileOnline(isOnlineFile); + file.setUuid(node.getUuid().toString()); + /* file.setVersionId(node.getVersion()); */ + + /* add the files to the attachment collection - if one existed, it should have already been removed. */ + attachmentList.add(file); + + /* reset the fields so that more files can be uploaded */ + voteAuthoringForm.setTheOfflineFile(null); + voteAuthoringForm.setTheOnlineFile(null); + } + catch (FileNotFoundException e) { + logger.error("Unable to uploadfile",e); + throw new RuntimeException("Unable to upload file, exception was "+e.getMessage()); + } catch (IOException e) { + logger.error("Unable to uploadfile",e); + throw new RuntimeException("Unable to upload file, exception was "+e.getMessage()); + } catch (RepositoryCheckedException e) { + logger.error("Unable to uploadfile",e); + throw new RuntimeException("Unable to upload file, exception was "+e.getMessage()); + } + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAuthoringForm.java (.../VoteAuthoringForm.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -86,6 +86,7 @@ protected String isRemoveContent; protected String toolContentID; + protected String editableNominationIndex; /* instructions content */ @@ -116,6 +117,13 @@ protected String httpSessionID; protected IVoteService voteService; + + private String contentFolderID; + private String addSingleQuestion; + private String editableQuestionIndex; + private String feedback; + private String editQuestionBoxRequest; + public void resetUserAction() { this.editDefaultQuestion=null; @@ -880,6 +888,11 @@ public String toString() { return new ToStringBuilder(this) .append("activeModule: ", activeModule) + .append("contentFolderID: ", contentFolderID) + .append("addSingleQuestion: ", addSingleQuestion) + .append("editableQuestionIndex: ", editableQuestionIndex) + .append("feedback: ", feedback) + .append("editQuestionBoxRequest: ", editQuestionBoxRequest) .append("defineLaterInEditMode: ", defineLaterInEditMode) .append("submissionAttempt: ", submissionAttempt) .append("sbmtSuccess: ", sbmtSuccess) @@ -927,4 +940,79 @@ public void setReflectionSubject(String reflectionSubject) { this.reflectionSubject = reflectionSubject; } + + /** + * @return Returns the addSingleQuestion. + */ + public String getAddSingleQuestion() { + return addSingleQuestion; + } + /** + * @param addSingleQuestion The addSingleQuestion to set. + */ + public void setAddSingleQuestion(String addSingleQuestion) { + this.addSingleQuestion = addSingleQuestion; + } + /** + * @return Returns the contentFolderID. + */ + public String getContentFolderID() { + return contentFolderID; + } + /** + * @param contentFolderID The contentFolderID to set. + */ + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } + /** + * @return Returns the editableQuestionIndex. + */ + public String getEditableQuestionIndex() { + return editableQuestionIndex; + } + /** + * @param editableQuestionIndex The editableQuestionIndex to set. + */ + public void setEditableQuestionIndex(String editableQuestionIndex) { + this.editableQuestionIndex = editableQuestionIndex; + } + /** + * @return Returns the editQuestionBoxRequest. + */ + public String getEditQuestionBoxRequest() { + return editQuestionBoxRequest; + } + /** + * @param editQuestionBoxRequest The editQuestionBoxRequest to set. + */ + public void setEditQuestionBoxRequest(String editQuestionBoxRequest) { + this.editQuestionBoxRequest = editQuestionBoxRequest; + } + /** + * @return Returns the feedback. + */ + public String getFeedback() { + return feedback; + } + /** + * @param feedback The feedback to set. + */ + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + + /** + * @return Returns the editableNominationIndex. + */ + public String getEditableNominationIndex() { + return editableNominationIndex; + } + /** + * @param editableNominationIndex The editableNominationIndex to set. + */ + public void setEditableNominationIndex(String editableNominationIndex) { + this.editableNominationIndex = editableNominationIndex; + } } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteDLStarterAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteDLStarterAction.java (.../VoteDLStarterAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteDLStarterAction.java (.../VoteDLStarterAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -28,6 +28,27 @@ * * @author Ozgur Demirtas * + + + + + + + + * + * */ package org.lamsfoundation.lams.tool.vote.web; import java.io.IOException; @@ -60,7 +81,6 @@ IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); logger.debug("voteService: " + voteService); - //request.getSession().setAttribute(TOOL_SERVICE, voteService); voteAuthoringForm.setVoteService(voteService); VoteStarterAction voteStarterAction= new VoteStarterAction(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteLearningAction.java (.../VoteLearningAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -81,7 +81,7 @@ * @author Ozgur Demirtas * * - * + + + + + + - + + + + + * */ Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringAction.java (.../VoteMonitoringAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,6 +23,7 @@ package org.lamsfoundation.lams.tool.vote.web; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -38,9 +39,12 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.vote.EditActivityDTO; import org.lamsfoundation.lams.tool.vote.ExportPortfolioDTO; import org.lamsfoundation.lams.tool.vote.ReflectionDTO; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; @@ -51,6 +55,7 @@ import org.lamsfoundation.lams.tool.vote.VoteGeneralMonitoringDTO; import org.lamsfoundation.lams.tool.vote.VoteMonitoredAnswersDTO; import org.lamsfoundation.lams.tool.vote.VoteMonitoredUserDTO; +import org.lamsfoundation.lams.tool.vote.VoteNominationContentDTO; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; @@ -59,7 +64,10 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; /** *

Action class that controls the logic of tool behavior.

@@ -77,6 +85,68 @@ * * @author Ozgur Demirtas * + * + + + + + + + + + + + + + + + + + + + + + + * */ public class VoteMonitoringAction extends LamsDispatchAction implements VoteAppConstants { @@ -162,6 +232,7 @@ if (currentMonitoredToolSession.equals("All")) { voteGeneralMonitoringDTO.setSelectionCase(new Long(2)); + request.setAttribute(SELECTION_CASE, new Long(2)); logger.debug("generate DTO for All sessions: "); List listVoteAllSessionsDTO=MonitoringUtil.prepareChartDTO(request, voteService, voteMonitoringForm, voteContent.getVoteContentId()); @@ -172,6 +243,7 @@ { logger.debug("preparing chart data for content id: " + voteContent.getVoteContentId()); logger.debug("preparing chart data for currentMonitoredToolSession: " + currentMonitoredToolSession); + request.setAttribute(SELECTION_CASE, new Long(1)); VoteSession voteSession=voteService.retrieveVoteSession(new Long(currentMonitoredToolSession)); logger.debug("voteSession uid:" + voteSession.getUid()); @@ -188,6 +260,10 @@ voteGeneralMonitoringDTO.setSelectionCase(new Long(1)); } logger.debug("SELECTION_CASE: " + voteGeneralMonitoringDTO.getSelectionCase()); + + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + request.setAttribute(CURRENT_MONITORED_TOOL_SESSION, currentMonitoredToolSession); + voteGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession); voteMonitoringForm.setSbmtSuccess(new Boolean(false).toString()); @@ -204,7 +280,7 @@ voteGeneralMonitoringDTO.setSummaryToolSessionsId(summaryToolSessionsId); logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); + //initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); @@ -259,10 +335,69 @@ logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - prepareReflectionData(request, voteContent, voteService, null,false); + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of commonSubmitSessionCode, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + } @@ -280,6 +415,7 @@ commonSubmitSessionCode(form, request, voteService,voteGeneralMonitoringDTO); logger.debug("post commonSubmitSessionCode: " +voteGeneralMonitoringDTO); + return (mapping.findForward(LOAD_MONITORING)); } @@ -400,10 +536,70 @@ voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); } - prepareReflectionData(request, voteContent, voteService, null,false); + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + } @@ -421,10 +617,10 @@ List listUserEntries=new LinkedList(); - Iterator itListQuestions = userEntries.iterator(); - while (itListQuestions.hasNext()) + Iterator itListNominations = userEntries.iterator(); + while (itListNominations.hasNext()) { - String userEntry =(String)itListQuestions.next(); + String userEntry =(String)itListNominations.next(); logger.debug("userEntry:..." + userEntry); if ((userEntry != null) && (userEntry.length() > 0)) @@ -447,8 +643,8 @@ logger.debug("new DTO created"); VoteUsrAttempt voteUsrAttempt =(VoteUsrAttempt)itUserRecords.next(); logger.debug("voteUsrAttempt: " + voteUsrAttempt); - - + + VoteSession localUserSession=voteUsrAttempt.getVoteQueUsr().getVoteSession(); logger.debug("localUserSession: " + localUserSession); logger.debug("localUserSession's content id: " + localUserSession.getVoteContentId()); @@ -460,8 +656,7 @@ logger.debug("show user entries by same content only"); if (voteContent.getUid().toString().equals(localUserSession.getVoteContentId().toString())) { - //voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString()); - voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); + voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone()); voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname()); voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString()); @@ -489,7 +684,6 @@ if (userId.equals(localUserId)) { logger.debug("this is requested by user id: " + userId); - //voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString()); voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone()); voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname()); @@ -521,8 +715,7 @@ if (userSessionId.equals(currentSessionId)) { logger.debug("this is requested by session id: " + currentSessionId); - //voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString()); - voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); + voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); voteMonitoredUserDTO.setTimeZone(voteUsrAttempt.getTimeZone()); voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname()); voteMonitoredUserDTO.setQueUsrId(voteUsrAttempt.getVoteQueUsr().getUid().toString()); @@ -594,91 +787,63 @@ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); } - prepareReflectionData(request, voteContent, voteService, null,false); + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); - voteGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); - logger.debug("end initSummaryContent..."); - } - - - public void initInstructionsContent(String toolContentID, - HttpServletRequest request, - IVoteService voteService, - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO) throws IOException, - ServletException - { - logger.debug("starting initInstructionsContent..."); - logger.debug("dispatching getInstructions.., voteGeneralMonitoringDTO:" + voteGeneralMonitoringDTO); - - logger.debug("voteService: " + voteService); - if (voteService == null) + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) { - logger.debug("will retrieve voteService"); - voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("retrieving voteService from session: " + voteService); + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) + voteGeneralMonitoringDTO.setCurrentMonitoringTab("summary"); + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) { - voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } } else { - voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); } + /* ... till here*/ - refreshInstructionsData(request, voteContent, voteService, voteGeneralMonitoringDTO); - logger.debug("post refreshInstructionsData, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); - prepareReflectionData(request, voteContent, voteService, null,false); - - voteGeneralMonitoringDTO.setCurrentMonitoringTab("instructions"); - logger.debug("ending initInstructionsContent..."); + logger.debug("end initSummaryContent..."); } - - public void refreshInstructionsData(HttpServletRequest request, VoteContent voteContent, - IVoteService voteService, VoteGeneralMonitoringDTO voteGeneralMonitoringDTO) - { - logger.debug("starting refreshInstructionsData, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - voteGeneralMonitoringDTO.setRichTextOfflineInstructions(voteContent.getOfflineInstructions()); - voteGeneralMonitoringDTO.setRichTextOnlineInstructions(voteContent.getOnlineInstructions()); - - /*process offline files metadata*/ - List listOfflineFilesMetaData=voteService.getOfflineFilesMetaData(voteContent.getUid()); - logger.debug("existing listOfflineFilesMetaData, to be structured as VoteAttachmentDTO: " + listOfflineFilesMetaData); - listOfflineFilesMetaData=AuthoringUtil.populateMetaDataAsAttachments(listOfflineFilesMetaData); - logger.debug("populated listOfflineFilesMetaData: " + listOfflineFilesMetaData); - voteGeneralMonitoringDTO.setListOfflineFilesMetadata(listOfflineFilesMetaData); - - List listUploadedOfflineFileNames=AuthoringUtil.populateMetaDataAsFilenames(listOfflineFilesMetaData); - logger.debug("returned from db listUploadedOfflineFileNames: " + listUploadedOfflineFileNames); - voteGeneralMonitoringDTO.setListUploadedOfflineFileNames(listUploadedOfflineFileNames); - - /*process online files metadata*/ - List listOnlineFilesMetaData=voteService.getOnlineFilesMetaData(voteContent.getUid()); - logger.debug("existing listOnlineFilesMetaData, to be structured as VoteAttachmentDTO: " + listOnlineFilesMetaData); - listOnlineFilesMetaData=AuthoringUtil.populateMetaDataAsAttachments(listOnlineFilesMetaData); - logger.debug("populated listOnlineFilesMetaData: " + listOnlineFilesMetaData); - voteGeneralMonitoringDTO.setListOnlineFilesMetadata(listOnlineFilesMetaData); - - List listUploadedOnlineFileNames=AuthoringUtil.populateMetaDataAsFilenames(listOnlineFilesMetaData); - logger.debug("returned from db listUploadedOnlineFileNames: " + listUploadedOnlineFileNames); - voteGeneralMonitoringDTO.setListUploadedOnlineFileNames(listUploadedOnlineFileNames); - - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("end of refreshInstructionsData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - } - + public void initStatsContent(String toolContentID, HttpServletRequest request, IVoteService voteService, @@ -703,12 +868,64 @@ logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); } + refreshStatsData(request, voteService,voteGeneralMonitoringDTO); logger.debug("post refreshStatsData, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO ); - prepareReflectionData(request, voteContent, voteService, null,false); - + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + voteGeneralMonitoringDTO.setCurrentMonitoringTab("stats"); + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + logger.debug("ending initStatsContent..."); } @@ -740,462 +957,13 @@ logger.debug("countSessionComplete: " + countSessionComplete); voteGeneralMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); - + logger.debug("end of refreshStatsData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); } - public ActionForward editActivityQuestions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException, - ToolException - { - logger.debug("dispatching editActivityQuestions..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - logger.debug("done repopulateRequestParameters"); - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - - VoteUtils.setDefineLater(request, true, voteService, toolContentID.toString()); - logger.debug("voteContent: " + voteContent); - - /*true means there is at least 1 response*/ - if (voteContent != null) - { - if (voteService.studentActivityOccurredStandardAndOpen(voteContent)) - { - voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); - } - else - { - voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); - logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); - } - } - - request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); - logger.debug("SOURCE_VOTE_STARTER: monitoring"); - - voteMonitoringForm.setSbmtSuccess(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setSbmtSuccess(new Boolean(false).toString()); - logger.debug("submit success is false"); - - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - - /*setting editable screen properties*/ - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - voteGeneralAuthoringDTO.setActivityTitle(voteContent.getTitle()); - voteGeneralAuthoringDTO.setActivityInstructions(voteContent.getInstructions()); - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - Iterator queIterator=voteContent.getVoteQueContents().iterator(); - Long mapIndex=new Long(1); - logger.debug("mapOptionsContent: " + mapOptionsContent); - while (queIterator.hasNext()) - { - VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); - if (voteQueContent != null) - { - logger.debug("question: " + voteQueContent.getQuestion()); - mapOptionsContent.put(mapIndex.toString(),voteQueContent.getQuestion()); - /** - * make the first entry the default(first) one for jsp - */ - if (mapIndex.longValue() == 1) - { - voteGeneralAuthoringDTO.setDefaultOptionContent(voteQueContent.getQuestion()); - } - - mapIndex=new Long(mapIndex.longValue()+1); - } - } - - logger.debug("mapOptionsContent: " + mapOptionsContent); - int maxIndex=mapOptionsContent.size(); - logger.debug("maxIndex: " + maxIndex); - voteGeneralAuthoringDTO.setMaxOptionIndex(maxIndex); - - voteGeneralAuthoringDTO.setMapOptionsContent(mapOptionsContent); - voteGeneralAuthoringDTO.setActiveModule(MONITORING); - - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - return (mapping.findForward(LOAD_MONITORING)); - } - - - public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException { - logger.debug("dispatching proxy submitAllContent..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - logger.debug("done repopulateRequestParameters"); - - request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); - logger.debug("SOURCE_VOTE_STARTER: monitoring"); - - VoteAction voteAction= new VoteAction(); - - voteMonitoringForm.setSbmtSuccess(new Boolean(false).toString()); - voteMonitoringForm.setActiveModule(DEFINE_LATER); - - - /* 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); - - - boolean isContentSubmitted=voteAction.submitContent(mapping, form, request, response); - logger.debug("isContentSubmitted :" +isContentSubmitted); - - if (isContentSubmitted == true) - voteMonitoringForm.setSbmtSuccess(new Boolean(true).toString()); - - logger.debug("final submit status :" +voteMonitoringForm.getSbmtSuccess()); - - - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - - if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - voteGeneralAuthoringDTO.setActiveModule(MONITORING); - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - return (mapping.findForward(destination)); - } - - - public ActionForward addNewNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException - { - logger.debug("dispatching proxy addNewNomination..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - - - request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); - logger.debug("SOURCE_VOTE_STARTER: monitoring"); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - voteMonitoringForm.setSbmtSuccess(new Boolean(false).toString()); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - - /* 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); - - VoteAction voteAction= new VoteAction(); - - boolean isNewNominationAdded=voteAction.isNewNominationAdded(mapping, form, request, response); - logger.debug("isNewNominationAdded:" + isNewNominationAdded); - - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - - if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - voteGeneralAuthoringDTO.setActiveModule(MONITORING); - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - return (mapping.findForward(destination)); - } - - - public ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException - { - logger.debug("dispatching proxy removeNomination..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - - 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(); - - /* 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); - - boolean isNominationRemoved=voteAction.isNominationRemoved(mapping, form, request, response); - logger.debug("isNominationRemoved :" +isNominationRemoved); - - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - - if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - - VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); - voteGeneralAuthoringDTO.setActiveModule(MONITORING); - logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); - request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); - - return (mapping.findForward(destination)); - } - - - public ActionForward moveNominationDown(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - logger.debug("dispatching proxy moveNominationDown..."); - - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); - logger.debug("SOURCE_VOTE_STARTER: monitoring"); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - VoteAction voteAction= new VoteAction(); - - /* 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); - - boolean isMoveNominationDown=voteAction.isMoveNominationDown(mapping, form, request, response); - logger.debug("isMoveNominationDown :" +isMoveNominationDown); - - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - - if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - - return (mapping.findForward(destination)); - } - - - public ActionForward moveNominationUp(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) throws IOException, - ServletException - { - logger.debug("dispatching proxy moveNominationUp..."); - IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("voteService :" +voteService); - - VoteMonitoringForm voteMonitoringForm = (VoteMonitoringForm) form; - logger.debug("voteMonitoringForm :" +voteMonitoringForm); - voteMonitoringForm.setVoteService(voteService); - VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); - - repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); - - request.setAttribute(SOURCE_VOTE_STARTER, "monitoring"); - logger.debug("SOURCE_VOTE_STARTER: monitoring"); - - /* 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); - - VoteAction voteAction= new VoteAction(); - boolean isMoveNominationUp=voteAction.isMoveNominationUp(mapping, form, request, response); - logger.debug("isMoveNominationUp:" + isMoveNominationUp); - - String toolContentID =voteMonitoringForm.getToolContentID(); - logger.debug("toolContentID: " + toolContentID); - - initSummaryContent(toolContentID , request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - logger.debug("calling initStatsContent."); - initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); - logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - - voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(false).toString()); - voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); - - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); - - if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); - - logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - - return (mapping.findForward(destination)); - - } - /** * calls learning action endLearning functionality * ActionForward endLearning(ActionMapping mapping, @@ -1232,6 +1000,7 @@ repopulateRequestParameters(request, voteMonitoringForm, voteGeneralMonitoringDTO); VoteLearningAction voteLearningAction= new VoteLearningAction(); + return null; } @@ -1284,13 +1053,25 @@ logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); initStatsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initStatsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); @@ -1307,13 +1088,91 @@ voteGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession); voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + logger.debug("ending editActivityQuestions, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("currentMonitoredToolSession: " + currentMonitoredToolSession); + + if (currentMonitoredToolSession.equals("")) + { + currentMonitoredToolSession="All"; + } + + if (currentMonitoredToolSession.equals("All")) + { + request.setAttribute(SELECTION_CASE, new Long(2)); + } + else + { + request.setAttribute(SELECTION_CASE, new Long(1)); + } + + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + + logger.debug("ending viewOpenVotes, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("fwd'ing to LOAD_MONITORING: " + LOAD_MONITORING); return (mapping.findForward(LOAD_MONITORING)); @@ -1350,7 +1209,6 @@ logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); @@ -1359,17 +1217,107 @@ voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); + logger.debug("existing voteContent:" + voteContent); + + if (voteContent != null) + { + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); - VoteContent voteContent=voteService.retrieveVote(new Long(toolContentID)); - logger.debug("existing voteContent:" + voteContent); if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); logger.debug("ending closeOpenVotes, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); - + + String currentMonitoredToolSession=voteMonitoringForm.getSelectedToolSessionId(); + if (currentMonitoredToolSession.equals("")) + { + currentMonitoredToolSession="All"; + } + + if (currentMonitoredToolSession.equals("All")) + { + request.setAttribute(SELECTION_CASE, new Long(2)); + } + else + { + request.setAttribute(SELECTION_CASE, new Long(1)); + } + + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + + return (mapping.findForward(LOAD_MONITORING)); } @@ -1414,7 +1362,6 @@ logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); @@ -1428,25 +1375,98 @@ refreshSummaryData(request, voteContent, voteService, true, false, currentMonitoredToolSession, null, true, null, voteGeneralMonitoringDTO, null); + + if (currentMonitoredToolSession.equals("")) + { + currentMonitoredToolSession="All"; + } + if (currentMonitoredToolSession.equals("All")) { voteGeneralMonitoringDTO.setSelectionCase(new Long(2)); + request.setAttribute(SELECTION_CASE, new Long(2)); } else { voteGeneralMonitoringDTO.setSelectionCase(new Long(1)); + request.setAttribute(SELECTION_CASE, new Long(1)); } + voteGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession); voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("ending editActivityQuestions, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + logger.debug("submitting session to refresh the data from the database: "); return submitSession(mapping, form, request, response, voteService, voteGeneralMonitoringDTO); } @@ -1491,7 +1511,6 @@ logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initInstructionsContent."); - initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); @@ -1505,21 +1524,93 @@ refreshSummaryData(request, voteContent, voteService, true, false, currentMonitoredToolSession, null, true, null, voteGeneralMonitoringDTO, null); + if (currentMonitoredToolSession.equals("")) + { + currentMonitoredToolSession="All"; + } + if (currentMonitoredToolSession.equals("All")) { voteGeneralMonitoringDTO.setSelectionCase(new Long(2)); + request.setAttribute(SELECTION_CASE, new Long(2)); } else { voteGeneralMonitoringDTO.setSelectionCase(new Long(1)); + request.setAttribute(SELECTION_CASE, new Long(1)); } + + logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); + voteGeneralMonitoringDTO.setCurrentMonitoredToolSession(currentMonitoredToolSession); voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + if (voteContent != null) - prepareReflectionData(request, voteContent, voteService, null,false); + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + logger.debug("submitting session to refresh the data from the database: "); return submitSession(mapping, form, request, response, voteService, voteGeneralMonitoringDTO); } @@ -1551,18 +1642,37 @@ logger.debug("userNames: " + userNames); List listVotedLearnersDTO= new LinkedList(); + VoteContent voteContent=null; Iterator userIterator=userNames.iterator(); while (userIterator.hasNext()) { VoteUsrAttempt voteUsrAttempt=(VoteUsrAttempt)userIterator.next(); + + if (voteUsrAttempt != null) + { + logger.debug("used voteContent is: "); + voteContent = voteUsrAttempt.getVoteQueContent().getVoteContent(); + } + VoteMonitoredUserDTO voteMonitoredUserDTO= new VoteMonitoredUserDTO(); voteMonitoredUserDTO.setUserName(voteUsrAttempt.getVoteQueUsr().getFullname()); - //voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime().toString()); voteMonitoredUserDTO.setAttemptTime(voteUsrAttempt.getAttemptTime()); listVotedLearnersDTO.add(voteMonitoredUserDTO); } logger.debug("listVoteAllSessionsDTO: " + listVotedLearnersDTO); + logger.debug("voteContent: " + voteContent); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + voteGeneralMonitoringDTO.setMapStudentsVoted(listVotedLearnersDTO); voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); logger.debug("ending getVoteNomination, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); @@ -1573,100 +1683,14 @@ } - public void prepareReflectionData(HttpServletRequest request, VoteContent voteContent, - IVoteService mcService, String userID, boolean exportMode) - { - logger.debug("starting prepareReflectionData: " + voteContent); - logger.debug("exportMode: " + exportMode); - List reflectionsContainerDTO= new LinkedList(); - - if (userID == null) - { - logger.debug("all users mode"); - for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) - { - VoteSession qaSession = (VoteSession) sessionIter.next(); - logger.debug("qaSession: " + qaSession); - for (Iterator userIter = qaSession.getVoteQueUsers().iterator(); userIter.hasNext();) - { - VoteQueUsr user = (VoteQueUsr) userIter.next(); - logger.debug("user: " + user); - - NotebookEntry notebookEntry = mcService.getEntry(qaSession.getVoteSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); - - logger.debug("notebookEntry: " + notebookEntry); - - if (notebookEntry != null) { - ReflectionDTO reflectionDTO = new ReflectionDTO(); - reflectionDTO.setUserId(user.getQueUsrId().toString()); - reflectionDTO.setSessionId(qaSession.getVoteSessionId().toString()); - reflectionDTO.setUserName(user.getUsername()); - reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); - String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); - reflectionDTO.setEntry(notebookEntryPresentable); - reflectionsContainerDTO.add(reflectionDTO); - } - - } - } - } - else - { - logger.debug("single user mode"); - for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) - { - VoteSession qaSession = (VoteSession) sessionIter.next(); - logger.debug("qaSession: " + qaSession); - for (Iterator userIter = qaSession.getVoteQueUsers().iterator(); userIter.hasNext();) - { - VoteQueUsr user = (VoteQueUsr) userIter.next(); - logger.debug("user: " + user); - - if (user.getQueUsrId().toString().equals(userID)) - { - NotebookEntry notebookEntry = mcService.getEntry(qaSession.getVoteSessionId(), - CoreNotebookConstants.NOTEBOOK_TOOL, - MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); - - logger.debug("notebookEntry: " + notebookEntry); - - if (notebookEntry != null) { - ReflectionDTO reflectionDTO = new ReflectionDTO(); - reflectionDTO.setUserId(user.getQueUsrId().toString()); - reflectionDTO.setSessionId(qaSession.getVoteSessionId().toString()); - reflectionDTO.setUserName(user.getUsername()); - reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); - String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); - reflectionDTO.setEntry(notebookEntryPresentable); - reflectionsContainerDTO.add(reflectionDTO); - } - - } - } - } - - } - - - logger.debug("reflectionsContainerDTO: " + reflectionsContainerDTO); - request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); - - if (exportMode) - { - request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); - } - } - public ActionForward openNotebook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException { logger.debug("dispatching openNotebook..."); - IVoteService qaService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); - logger.debug("qaService: " + qaService); + IVoteService VoteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("VoteService: " + VoteService); String uid=request.getParameter("uid"); @@ -1682,7 +1706,7 @@ logger.debug("sessionId: " + sessionId); - NotebookEntry notebookEntry = qaService.getEntry(new Long(sessionId), + NotebookEntry notebookEntry = VoteService.getEntry(new Long(sessionId), CoreNotebookConstants.NOTEBOOK_TOOL, MY_SIGNATURE, new Integer(userId)); @@ -1698,12 +1722,12 @@ logger.debug("voteGeneralLearnerFlowDTO: " + voteGeneralLearnerFlowDTO); request.setAttribute(VOTE_GENERAL_LEARNER_FLOW_DTO, voteGeneralLearnerFlowDTO); + logger.debug("fwding to : " + LEARNER_NOTEBOOK); return mapping.findForward(LEARNER_NOTEBOOK); } - protected void repopulateRequestParameters(HttpServletRequest request, VoteMonitoringForm voteMonitoringForm, VoteGeneralMonitoringDTO voteGeneralMonitoringDTO) { @@ -1724,6 +1748,7 @@ voteMonitoringForm.setDefineLaterInEditMode(defineLaterInEditMode); voteGeneralMonitoringDTO.setDefineLaterInEditMode(defineLaterInEditMode); + String isToolSessionChanged=request.getParameter(IS_TOOL_SESSION_CHANGED); logger.debug("isToolSessionChanged: " + isToolSessionChanged); voteMonitoringForm.setIsToolSessionChanged(isToolSessionChanged); @@ -1738,6 +1763,2071 @@ logger.debug("currentUid: " + currentUid); voteMonitoringForm.setCurrentUid(currentUid); voteGeneralMonitoringDTO.setCurrentUid(currentUid); - } + } + + + + protected void repopulateRequestParameters(HttpServletRequest request, VoteMonitoringForm voteMonitoringForm, + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO) + { + logger.debug("starting repopulateRequestParameters"); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteMonitoringForm.setContentFolderID(contentFolderID); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + + String toolContentID=request.getParameter(TOOL_CONTENT_ID); + logger.debug("toolContentID: " + toolContentID); + voteMonitoringForm.setToolContentID(toolContentID); + voteGeneralAuthoringDTO.setToolContentID(toolContentID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + voteMonitoringForm.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + + String defineLaterInEditMode=request.getParameter(DEFINE_LATER_IN_EDIT_MODE); + logger.debug("defineLaterInEditMode: " + defineLaterInEditMode); + voteMonitoringForm.setDefineLaterInEditMode(defineLaterInEditMode); + voteGeneralAuthoringDTO.setDefineLaterInEditMode(defineLaterInEditMode); + + } + + + /** + * used in define later mode to switch from view-only to editable screen + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * @throws ToolException + */ + public ActionForward editActivityQuestions(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException, + ToolException + { + logger.debug("dispatching editActivityQuestions..."); + + VoteMonitoringForm VoteMonitoringForm = (VoteMonitoringForm) form; + logger.debug("VoteMonitoringForm: " + VoteMonitoringForm); + + IVoteService voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + VoteGeneralMonitoringDTO generalMonitoringDTO = new VoteGeneralMonitoringDTO(); + + generalMonitoringDTO.setMonitoredContentInUse(new Boolean(false).toString()); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + generalMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + VoteMonitoringForm.setToolContentID(strToolContentID); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + VoteMonitoringForm.setContentFolderID(contentFolderID); + + String httpSessionID=request.getParameter("httpSessionID"); + logger.debug("httpSessionID: " + httpSessionID); + VoteMonitoringForm.setHttpSessionID(httpSessionID); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("existing voteContent:" + voteContent); + + VoteMonitoringForm.setTitle(voteContent.getTitle()); + + VoteUtils.setDefineLater(request, true,strToolContentID, voteService); + + prepareEditActivityScreenData(request, voteContent); + + //prepareReflectionData(request, voteContent, voteService, null, false, "All"); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + generalMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + generalMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + generalMonitoringDTO.setAttachmentList(attachmentList); + generalMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + + List listNominationContentDTO= new LinkedList(); + + Iterator queIterator=voteContent.getVoteQueContents().iterator(); + while (queIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO=new VoteNominationContentDTO(); + + VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); + if (voteQueContent != null) + { + logger.debug("question: " + voteQueContent.getQuestion()); + logger.debug("displayorder: " + new Integer(voteQueContent.getDisplayOrder()).toString()); + + voteNominationContentDTO.setQuestion(voteQueContent.getQuestion()); + voteNominationContentDTO.setDisplayOrder(new Integer(voteQueContent.getDisplayOrder()).toString()); + listNominationContentDTO.add(voteNominationContentDTO); + } + } + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + VoteGeneralAuthoringDTO VoteGeneralAuthoringDTO = (VoteGeneralAuthoringDTO)request.getAttribute(VOTE_GENERAL_AUTHORING_DTO); + VoteGeneralAuthoringDTO.setActiveModule(MONITORING); + + VoteGeneralAuthoringDTO.setToolContentID(strToolContentID); + VoteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + VoteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, VoteGeneralAuthoringDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)generalMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug(": " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + MonitoringUtil.generateGroupsSessionData(request, voteService, voteContent); + + return (mapping.findForward(LOAD_MONITORING)); + } + + + public void prepareEditActivityScreenData(HttpServletRequest request, VoteContent voteContent) + { + logger.debug("starting prepareEditActivityScreenData: " + voteContent); + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + + if (voteContent.getTitle() == null) + { + voteGeneralAuthoringDTO.setActivityTitle(DEFAULT_VOTING_TITLE); + } + else + { + voteGeneralAuthoringDTO.setActivityTitle(voteContent.getTitle()); + } + + + if (voteContent.getInstructions() == null) + { + voteGeneralAuthoringDTO.setActivityInstructions(DEFAULT_VOTING_INSTRUCTIONS); + } + else + { + voteGeneralAuthoringDTO.setActivityInstructions(voteContent.getInstructions()); + } + + + logger.debug("final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + } + + + + + + /** + * submits content into the tool database + * ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("dispathcing submitAllContent :" +form); + + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + Map mapNominationContent=AuthoringUtil.extractMapNominationContent(listNominationContentDTO); + logger.debug("extracted mapNominationContent: " + mapNominationContent); + + + Map mapFeedback=AuthoringUtil.extractMapFeedback(listNominationContentDTO); + logger.debug("extracted mapFeedback: " + mapFeedback); + + ActionMessages errors = new ActionMessages(); + logger.debug("mapNominationContent size: " + mapNominationContent.size()); + + if (mapNominationContent.size() == 0) + { + ActionMessage error = new ActionMessage("nominations.none.submitted"); + errors.add(ActionMessages.GLOBAL_MESSAGE, error); + } + logger.debug("errors: " + errors); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + + logger.debug("activeModule: " + activeModule); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + voteGeneralAuthoringDTO.setMapNominationContent(mapNominationContent); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("there are no issues with input, continue and submit data"); + + VoteContent voteContentTest=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContentTest: " + voteContentTest); + + + logger.debug("errors: " + errors); + if(!errors.isEmpty()){ + saveErrors(request, errors); + logger.debug("errors saved: " + errors); + } + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO = new VoteGeneralMonitoringDTO(); + + + VoteContent voteContent=voteContentTest; + if(errors.isEmpty()){ + logger.debug("errors is empty: " + errors); + /*to remove deleted entries in the questions table based on mapNominationContent */ + authoringUtil.removeRedundantNominations(mapNominationContent, voteService, voteAuthoringForm, request, strToolContentID); + logger.debug("end of removing unused entries... "); + + voteContent=authoringUtil.saveOrUpdateVoteContent(mapNominationContent, mapFeedback, voteService, voteAuthoringForm, request, voteContentTest, strToolContentID); + logger.debug("voteContent: " + voteContent); + + + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (voteContent != null) + { + voteGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + logger.debug("updated voteGeneralAuthoringDTO to: " + voteGeneralAuthoringDTO); + + authoringUtil.reOrganizeDisplayOrder(mapNominationContent, voteService, voteAuthoringForm, voteContent); + + logger.debug("strToolContentID: " + strToolContentID); + VoteUtils.setDefineLater(request, false, strToolContentID, voteService); + logger.debug("define later set to false"); + + //VoteUtils.setFormProperties(request, voteService, + // voteAuthoringForm, voteGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + } + else + { + logger.debug("errors is not empty: " + errors); + + if (voteContent != null) + { + long defaultContentID=0; + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + + if (voteContent != null) + { + voteGeneralAuthoringDTO.setDefaultContentIdStr(new Long(defaultContentID).toString()); + } + + //VoteUtils.setFormProperties(request, voteService, + // voteAuthoringForm, voteGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + } + + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + } + + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString()); + + voteAuthoringForm.resetUserAction(); + voteGeneralAuthoringDTO.setMapNominationContent(mapNominationContent); + + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + request.getSession().setAttribute(httpSessionID, sessionMap); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + + logger.debug("forwarding to :" + LOAD_MONITORING); + return mapping.findForward(LOAD_MONITORING); + } + + + /** + * saveSingleNomination + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward saveSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("dispathcing saveSingleNomination"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + String editNominationBoxRequest=request.getParameter("editNominationBoxRequest"); + logger.debug("editNominationBoxRequest: " + editNominationBoxRequest); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + + String newNomination=request.getParameter("newNomination"); + logger.debug("newNomination: " + newNomination); + + + String editableNominationIndex=request.getParameter("editableNominationIndex"); + logger.debug("editableNominationIndex: " + editableNominationIndex); + + + if ((newNomination != null) && (newNomination.length() > 0)) + { + if ((editNominationBoxRequest != null) && (editNominationBoxRequest.equals("false"))) + { + logger.debug("request for add and save"); + boolean duplicates=AuthoringUtil.checkDuplicateNominations(listNominationContentDTO, newNomination); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getQuestion()); + + String question=voteNominationContentDTO.getQuestion(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableNominationIndex)) + { + break; + } + + } + } + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + + voteNominationContentDTO.setQuestion(newNomination); + voteNominationContentDTO.setDisplayOrder(editableNominationIndex); + + listNominationContentDTO=AuthoringUtil.reorderUpdateListNominationContentDTO(listNominationContentDTO, voteNominationContentDTO, editableNominationIndex); + logger.debug("post reorderUpdateListNominationContentDTO listNominationContentDTO: " + listNominationContentDTO); + } + else + { + logger.debug("duplicate question entry, not adding"); + } + } + else + { + logger.debug("request for edit and save."); + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getQuestion()); + + String question=voteNominationContentDTO.getQuestion(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(editableNominationIndex)) + { + break; + } + + } + } + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + + voteNominationContentDTO.setQuestion(newNomination); + voteNominationContentDTO.setDisplayOrder(editableNominationIndex); + + listNominationContentDTO=AuthoringUtil.reorderUpdateListNominationContentDTO(listNominationContentDTO, voteNominationContentDTO, editableNominationIndex); + logger.debug("post reorderUpdateListQuestionContentDTO listQuestionContentDTO: " + listNominationContentDTO); + } + } + else + { + logger.debug("entry blank, not adding"); + } + + + + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + logger.debug("activeModule: " + activeModule); + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + //VoteUtils.setFormProperties(request, voteService, + // voteAuthoringForm, voteGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("httpSessionID: " + httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + request.getSession().setAttribute(httpSessionID, sessionMap); + logger.debug("voteGeneralAuthoringDTO.getMapNominationContent(); " + voteGeneralAuthoringDTO.getMapNominationContent()); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + + + /** + * addSingleNomination + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward addSingleNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("dispathcing addSingleNomination"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + String newNomination=request.getParameter("newNomination"); + logger.debug("newNomination: " + newNomination); + + int listSize=listNominationContentDTO.size(); + logger.debug("listSize: " + listSize); + + if ((newNomination != null) && (newNomination.length() > 0)) + { + boolean duplicates=AuthoringUtil.checkDuplicateNominations(listNominationContentDTO, newNomination); + logger.debug("duplicates: " + duplicates); + + if (!duplicates) + { + VoteNominationContentDTO voteNominationContentDTO=new VoteNominationContentDTO(); + voteNominationContentDTO.setDisplayOrder(new Long(listSize+1).toString()); + voteNominationContentDTO.setNomination(newNomination); + + listNominationContentDTO.add(voteNominationContentDTO); + logger.debug("updated listNominationContentDTO: " + listNominationContentDTO); + } + else + { + logger.debug("entry duplicate, not adding"); + + } + } + else + { + logger.debug("entry blank, not adding"); + } + + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + logger.debug("activeModule: " + activeModule); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + request.getSession().setAttribute(httpSessionID, sessionMap); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + logger.debug("httpSessionID: " + httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + logger.debug("voteGeneralAuthoringDTO.getMapNominationContent(); " + voteGeneralAuthoringDTO.getMapNominationContent()); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + } + + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + /** + * opens up an new screen within the current page for adding a new question + * + * newNominationBox + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward newNominationBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispathcing newNominationBox"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + logger.debug("activeModule: " + activeModule); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + + logger.debug("fwd ing to newNominationBox: "); + return (mapping.findForward("newNominationBox")); + } + + + /** + * opens up an new screen within the current page for editing a question + * newEditableNominationBox + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward newEditableNominationBox(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + { + logger.debug("dispathcing newEditableNominationBox"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + voteAuthoringForm.setEditableNominationIndex(questionIndex); + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + String editableNomination=""; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + VoteNominationContentDTO voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + editableNomination=voteNominationContentDTO.getNomination(); + logger.debug("editableNomination found :" + editableNomination); + break; + } + + } + } + logger.debug("editableNomination found :" + editableNomination); + + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + voteGeneralAuthoringDTO.setEditableNominationText(editableNomination); + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("voteGeneralAuthoringDTO now: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("fwd ing to editNominationBox: "); + return (mapping.findForward("editNominationBox")); + } + + + + /** + * removes a question from the questions map + * ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward removeNomination(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching removeNomination"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + VoteNominationContentDTO voteNominationContentDTO= null; + Iterator listIterator=listNominationContentDTO.iterator(); + while (listIterator.hasNext()) + { + voteNominationContentDTO= (VoteNominationContentDTO)listIterator.next(); + logger.debug("voteNominationContentDTO:" + voteNominationContentDTO); + logger.debug("voteNominationContentDTO question:" + voteNominationContentDTO.getNomination()); + + String question=voteNominationContentDTO.getNomination(); + String displayOrder=voteNominationContentDTO.getDisplayOrder(); + logger.debug("displayOrder:" + displayOrder); + + if ((displayOrder != null) && (!displayOrder.equals(""))) + { + if (displayOrder.equals(questionIndex)) + { + break; + } + + } + } + + logger.debug("voteNominationContentDTO found:" + voteNominationContentDTO); + voteNominationContentDTO.setNomination(""); + logger.debug("listNominationContentDTO after remove:" + listNominationContentDTO); + + + listNominationContentDTO=AuthoringUtil.reorderListNominationContentDTO(listNominationContentDTO, questionIndex ); + logger.debug("listNominationContentDTO reordered:" + listNominationContentDTO); + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + if (voteContent == null) + { + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + voteContent=voteService.retrieveVote(new Long(defaultContentIdStr)); + + } + logger.debug("final voteContent: " + voteContent); + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("voteNominationContentDTO now: " + voteNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + + /** + * moves a question down in the list + * moveNominationDown + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward moveNominationDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveNominationDown"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.swapNodes(listNominationContentDTO, questionIndex, "down"); + logger.debug("listNominationContentDTO after swap: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.reorderSimpleListNominationContentDTO(listNominationContentDTO); + logger.debug("listNominationContentDTO after reordersimple: " + listNominationContentDTO); + + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + + /** + * moves a question up in the list + * moveNominationUp + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward moveNominationUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + logger.debug("dispatching moveNominationUp"); + VoteMonitoringForm voteAuthoringForm = (VoteMonitoringForm) form; + + IVoteService voteService =VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService: " + voteService); + + String httpSessionID=voteAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String questionIndex=request.getParameter("questionIndex"); + logger.debug("questionIndex: " + questionIndex); + + + List listNominationContentDTO=(List)sessionMap.get(LIST_NOMINATION_CONTENT_DTO_KEY); + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.swapNodes(listNominationContentDTO, questionIndex, "up"); + logger.debug("listNominationContentDTO after swap: " + listNominationContentDTO); + + listNominationContentDTO=AuthoringUtil.reorderSimpleListNominationContentDTO(listNominationContentDTO); + logger.debug("listNominationContentDTO after reordersimple: " + listNominationContentDTO); + + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + logger.debug("contentFolderID: " + contentFolderID); + voteAuthoringForm.setContentFolderID(contentFolderID); + + + String activeModule=request.getParameter(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentID: " + strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + VoteContent voteContent=voteService.retrieveVote(new Long(strToolContentID)); + logger.debug("voteContent: " + voteContent); + + + VoteGeneralAuthoringDTO voteGeneralAuthoringDTO= new VoteGeneralAuthoringDTO(); + logger.debug("voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + voteGeneralAuthoringDTO.setContentFolderID(contentFolderID); + + voteGeneralAuthoringDTO.setActivityTitle(richTextTitle); + voteAuthoringForm.setTitle(richTextTitle); + + voteGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + voteGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + request.getSession().setAttribute(httpSessionID, sessionMap); + + voteGeneralAuthoringDTO.setToolContentID(strToolContentID); + voteGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + voteGeneralAuthoringDTO.setActiveModule(activeModule); + voteGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setToolContentID(strToolContentID); + voteAuthoringForm.setHttpSessionID(httpSessionID); + voteAuthoringForm.setActiveModule(activeModule); + voteAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + voteAuthoringForm.setCurrentTab("3"); + + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + logger.debug("listNominationContentDTO now: " + listNominationContentDTO); + + voteGeneralAuthoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + repopulateRequestParameters(request, voteAuthoringForm, voteGeneralAuthoringDTO); + logger.debug("before saving final voteGeneralAuthoringDTO: " + voteGeneralAuthoringDTO); + request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + + if (voteContent != null) + { + //prepareReflectionData(request, voteContent, voteService, null,false); + prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + boolean isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(false).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + } + + /*find out if there are any reflection entries, from here*/ + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + VoteGeneralMonitoringDTO voteGeneralMonitoringDTO= new VoteGeneralMonitoringDTO(); + voteGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (voteService.studentActivityOccurredGlobal(voteContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + voteGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + logger.debug("end of refreshSummaryData, voteGeneralMonitoringDTO" + voteGeneralMonitoringDTO); + request.setAttribute(VOTE_GENERAL_MONITORING_DTO, voteGeneralMonitoringDTO); + + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralAuthoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + /* ... till here*/ + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + + + + public void prepareReflectionData(HttpServletRequest request, VoteContent voteContent, + IVoteService voteService, String userID, boolean exportMode, String currentSessionId) + { + logger.debug("starting prepareReflectionData: " + voteContent); + logger.debug("currentSessionId: " + currentSessionId); + logger.debug("userID: " + userID); + logger.debug("exportMode: " + exportMode); + + + List reflectionsContainerDTO= new LinkedList(); + + reflectionsContainerDTO=getReflectionList(voteContent, userID, voteService); + + logger.debug("reflectionsContainerDTO: " + reflectionsContainerDTO); + request.setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); + + if (exportMode) + { + request.getSession().setAttribute(REFLECTIONS_CONTAINER_DTO, reflectionsContainerDTO); + } + } + + + + /** + * returns reflection data for all sessions + * + * getReflectionList + * @param voteContent + * @param userID + * @param voteService + * @return + */ + public List getReflectionList(VoteContent voteContent, String userID, IVoteService voteService) + { + logger.debug("getting reflections for all sessions"); + List reflectionsContainerDTO= new LinkedList(); + if (userID == null) + { + logger.debug("all users mode"); + for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) + { + VoteSession voteSession = (VoteSession) sessionIter.next(); + logger.debug("voteSession: " + voteSession); + logger.debug("voteSession sessionId: " + voteSession.getVoteSessionId()); + + for (Iterator userIter = voteSession.getVoteQueUsers().iterator(); userIter.hasNext();) + { + VoteQueUsr user = (VoteQueUsr) userIter.next(); + logger.debug("user: " + user); + + NotebookEntry notebookEntry = voteService.getEntry(voteSession.getVoteSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(voteSession.getVoteSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + else + { + logger.debug("single user mode"); + for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) + { + VoteSession voteSession = (VoteSession) sessionIter.next(); + logger.debug("voteSession: " + voteSession); + for (Iterator userIter = voteSession.getVoteQueUsers().iterator(); userIter.hasNext();) + { + VoteQueUsr user = (VoteQueUsr) userIter.next(); + logger.debug("user: " + user); + + if (user.getQueUsrId().toString().equals(userID)) + { + logger.debug("getting reflection for user with userID: " + userID); + NotebookEntry notebookEntry = voteService.getEntry(voteSession.getVoteSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(voteSession.getVoteSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + } + + return reflectionsContainerDTO; + } + + /** + * returns reflection data for a specific session + * + * getReflectionListForSession(VoteContent voteContent, String userID, IVoteService voteService, String currentSessionId) + * @param voteContent + * @param userID + * @param voteService + * @param currentSessionId + * @return + */ + public List getReflectionListForSession(VoteContent voteContent, String userID, IVoteService voteService, String currentSessionId) + { + logger.debug("getting reflections for a specific session"); + logger.debug("currentSessionId: " + currentSessionId); + + List reflectionsContainerDTO= new LinkedList(); + if (userID == null) + { + logger.debug("all users mode"); + for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) + { + VoteSession voteSession = (VoteSession) sessionIter.next(); + logger.debug("voteSession: " + voteSession); + logger.debug("voteSession sessionId: " + voteSession.getVoteSessionId()); + + if (currentSessionId.equals(voteSession.getVoteSessionId())) + { + + for (Iterator userIter = voteSession.getVoteQueUsers().iterator(); userIter.hasNext();) + { + VoteQueUsr user = (VoteQueUsr) userIter.next(); + logger.debug("user: " + user); + + NotebookEntry notebookEntry = voteService.getEntry(voteSession.getVoteSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(voteSession.getVoteSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + } + } + else + { + logger.debug("single user mode"); + for (Iterator sessionIter = voteContent.getVoteSessions().iterator(); sessionIter.hasNext();) + { + VoteSession voteSession = (VoteSession) sessionIter.next(); + logger.debug("voteSession: " + voteSession); + + if (currentSessionId.equals(voteSession.getVoteSessionId())) + { + for (Iterator userIter = voteSession.getVoteQueUsers().iterator(); userIter.hasNext();) + { + VoteQueUsr user = (VoteQueUsr) userIter.next(); + logger.debug("user: " + user); + + if (user.getQueUsrId().toString().equals(userID)) + { + logger.debug("getting reflection for user with userID: " + userID); + NotebookEntry notebookEntry = voteService.getEntry(voteSession.getVoteSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(user.getQueUsrId().toString())); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + ReflectionDTO reflectionDTO = new ReflectionDTO(); + reflectionDTO.setUserId(user.getQueUsrId().toString()); + reflectionDTO.setSessionId(voteSession.getVoteSessionId().toString()); + reflectionDTO.setUserName(user.getFullname()); + reflectionDTO.setReflectionUid (notebookEntry.getUid().toString()); + String notebookEntryPresentable=VoteUtils.replaceNewLines(notebookEntry.getEntry()); + reflectionDTO.setEntry(notebookEntryPresentable); + reflectionsContainerDTO.add(reflectionDTO); + } + } + } + + } + } + } + + return reflectionsContainerDTO; + } } \ No newline at end of file Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteMonitoringStarterAction.java (.../VoteMonitoringStarterAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -23,7 +23,10 @@ package org.lamsfoundation.lams.tool.vote.web; import java.io.IOException; +import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -39,17 +42,20 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.vote.EditActivityDTO; import org.lamsfoundation.lams.tool.vote.VoteAppConstants; import org.lamsfoundation.lams.tool.vote.VoteApplicationException; import org.lamsfoundation.lams.tool.vote.VoteComparator; import org.lamsfoundation.lams.tool.vote.VoteGeneralAuthoringDTO; import org.lamsfoundation.lams.tool.vote.VoteGeneralMonitoringDTO; +import org.lamsfoundation.lams.tool.vote.VoteNominationContentDTO; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; /** @@ -141,7 +147,6 @@ logger.debug("post initSummaryContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initInstructionsContent."); - voteMonitoringAction.initInstructionsContent(toolContentID, request, voteService, voteGeneralMonitoringDTO); logger.debug("post initInstructionsContent, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("calling initStatsContent."); @@ -197,7 +202,7 @@ request.setAttribute(VOTE_GENERAL_AUTHORING_DTO, voteGeneralAuthoringDTO); /*...till here */ - voteMonitoringAction.prepareReflectionData(request, voteContent, voteService, null, false); + //voteMonitoringAction.prepareReflectionData(request, voteContent, voteService, null, false); logger.debug("calling submitSession with selectedToolSessionId" + voteMonitoringForm.getSelectedToolSessionId()); return voteMonitoringAction.submitSession(mapping, voteMonitoringForm, request, response, voteService, voteGeneralMonitoringDTO); @@ -230,7 +235,6 @@ { VoteUtils.cleanUpSessionAbsolute(request); voteGeneralMonitoringDTO.setUserExceptionContentDoesNotExist(new Boolean(true).toString()); - persistInRequestError(request, "error.content.doesNotExist"); return false; } @@ -241,7 +245,6 @@ if (isContentInUse == true) { logger.debug("monitoring url does not allow editActivity since the content is in use."); - persistInRequestError(request,"error.content.inUse"); voteGeneralMonitoringDTO.setIsMonitoredContentInUse(new Boolean(true).toString()); } @@ -268,6 +271,17 @@ * get the nominations * section is needed for the Edit tab's View Only mode, starts here */ + + SessionMap sessionMap = new SessionMap(); + sessionMap.put(ACTIVITY_TITLE_KEY, voteContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, voteContent.getInstructions()); + + voteMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + + + List listNominationContentDTO= new LinkedList(); + Map mapOptionsContent= new TreeMap(new VoteComparator()); logger.debug("setting existing content data from the db"); mapOptionsContent.clear(); @@ -276,16 +290,17 @@ logger.debug("mapOptionsContent: " + mapOptionsContent); while (queIterator.hasNext()) { + VoteNominationContentDTO voteNominationContentDTO=new VoteNominationContentDTO(); + VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); if (voteQueContent != null) { logger.debug("question: " + voteQueContent.getQuestion()); mapOptionsContent.put(mapIndex.toString(),voteQueContent.getQuestion()); - if (mapIndex.longValue() == 1) - { - voteGeneralMonitoringDTO.setDefaultOptionContent(voteQueContent.getQuestion()); - } + voteNominationContentDTO.setQuestion(voteQueContent.getQuestion()); + voteNominationContentDTO.setDisplayOrder(new Integer(voteQueContent.getDisplayOrder()).toString()); + listNominationContentDTO.add(voteNominationContentDTO); mapIndex=new Long(mapIndex.longValue()+1); } @@ -295,6 +310,13 @@ /* ends here*/ + logger.debug("listNominationContentDTO: " + listNominationContentDTO); + request.setAttribute(LIST_NOMINATION_CONTENT_DTO,listNominationContentDTO); + sessionMap.put(LIST_NOMINATION_CONTENT_DTO_KEY, listNominationContentDTO); + + request.setAttribute(TOTAL_NOMINATION_COUNT, new Integer(listNominationContentDTO.size())); + + VoteMonitoringAction voteMonitoringAction= new VoteMonitoringAction(); logger.debug("refreshing summary data..."); voteMonitoringAction.refreshSummaryData(request, voteContent, voteService, true, false, @@ -306,12 +328,64 @@ logger.debug("post refreshStatsData, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); logger.debug("refreshing instructions data..."); - voteMonitoringAction.refreshInstructionsData(request, voteContent, voteService, voteGeneralMonitoringDTO); + //voteMonitoringAction.refreshInstructionsData(request, voteContent, voteService, voteGeneralMonitoringDTO); logger.debug("end initializing monitoring data..."); voteGeneralMonitoringDTO.setExistsOpenVotes(new Boolean(false).toString()); logger.debug("post refreshes, voteGeneralMonitoringDTO: " + voteGeneralMonitoringDTO); + + + EditActivityDTO editActivityDTO = new EditActivityDTO(); + isContentInUse=VoteUtils.isContentInUse(voteContent); + logger.debug("isContentInUse:" + isContentInUse); + if (isContentInUse == true) + { + editActivityDTO.setMonitoredContentInUse(new Boolean(true).toString()); + } + request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); + + voteMonitoringAction.prepareReflectionData(request, voteContent, voteService, null, false, "All"); + + + + boolean notebookEntriesExist=MonitoringUtil.notebookEntriesExist(voteService, voteContent); + logger.debug("notebookEntriesExist : " + notebookEntriesExist); + + if (notebookEntriesExist) + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + + String userExceptionNoToolSessions=(String)voteGeneralMonitoringDTO.getUserExceptionNoToolSessions(); + logger.debug("userExceptionNoToolSessions : " + userExceptionNoToolSessions); + + if (userExceptionNoToolSessions.equals("true")) + { + logger.debug("there are no online student activity but there are reflections : "); + request.setAttribute(NO_SESSIONS_NOTEBOOK_ENTRIES_EXIST, new Boolean(true).toString()); + } + + } + else + { + request.setAttribute(NOTEBOOK_ENTRIES_EXIST, new Boolean(false).toString()); + } + + + /**getting instructions screen content from here... */ + voteGeneralMonitoringDTO.setOnlineInstructions(voteContent.getOnlineInstructions()); + voteGeneralMonitoringDTO.setOfflineInstructions(voteContent.getOfflineInstructions()); + + List attachmentList = voteService.retrieveVoteUploadedFiles(voteContent); + logger.debug("attachmentList: " + attachmentList); + voteGeneralMonitoringDTO.setAttachmentList(attachmentList); + voteGeneralMonitoringDTO.setDeletedAttachmentList(new ArrayList()); + /** ...till here **/ + + + + MonitoringUtil.buildVoteStatsDTO(request,voteService, voteContent); + return true; } @@ -325,7 +399,6 @@ if ((strToolContentId == null) || (strToolContentId.length() == 0)) { - //persistInRequestError(request, "error.contentId.required"); VoteUtils.cleanUpSessionAbsolute(request); return (mapping.findForward(ERROR_LIST)); } @@ -339,7 +412,6 @@ } catch(NumberFormatException e) { - persistInRequestError(request, "error.numberFormatException"); logger.debug("add error.numberFormatException to ActionMessages."); VoteUtils.cleanUpSessionAbsolute(request); return (mapping.findForward(ERROR_LIST)); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -70,7 +70,7 @@ The author is given warnings when the content in use by learners OR when the content is being edited in the Monitoring interface. - + - + + + javax.servlet.jsp.jstl.fmt.localizationContext + org.lamsfoundation.lams.tool.vote.ApplicationResources + + + contextConfigLocation - - classpath:/org/lamsfoundation/lams/applicationContext.xml - classpath:/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml - classpath:/org/lamsfoundation/lams/toolApplicationContext.xml - classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml - classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml - classpath:/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml - + + classpath:/org/lamsfoundation/lams/applicationContext.xml + classpath:/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml + classpath:/org/lamsfoundation/lams/toolApplicationContext.xml + classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml + classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml + classpath:/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml + - - - org.springframework.web.context.ContextLoaderListener - - - hibernateFilter - - org.springframework.orm.hibernate3.support.OpenSessionInViewFilter - - - sessionFactoryBeanName - mcSessionFactory - + SystemSessionFilter + + org.lamsfoundation.lams.web.session.SystemSessionFilter + + + + + hibernateFilter + + org.lamsfoundation.lams.util.CustomizedOpenSessionInViewFilter + + + sessionFactoryBeanName + voteSessionFactory + - - - SystemSessionFilter + + + LocaleFilter - org.lamsfoundation.lams.web.session.SystemSessionFilter + org.lamsfoundation.lams.web.filter.LocaleFilter - + - hibernateFilter - *.do - - SystemSessionFilter + /* + + + + hibernateFilter /* - + + + LocaleFilter + /* + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + org.lamsfoundation.lams.web.SessionListener + + + - context - org.springframework.web.context.ContextLoaderServlet - 1 - - action org.apache.struts.action.ActionServlet @@ -75,50 +109,169 @@ validate true - 2 + 1 - - - Connector - com.fredck.FCKeditor.connector.ConnectorServlet - - baseDir - /UserFiles/ - - - debug - false - - 1 + + + download + org.lamsfoundation.lams.contentrepository.client.ToolDownload + + toolContentHandlerBeanName + voteToolContentHandler + + 3 + + + exportPortfolio + org.lamsfoundation.lams.tool.vote.web.ExportServlet + + + + chartGenerator + org.lamsfoundation.lams.tool.vote.web.VoteChartGenerator + - + + + + Connector + com.fredck.FCKeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + action - *.do + *.do + + download + /download/* + + - Connector - /editor/filemanager/browser/default/connectors/jsp/connector - - + exportPortfolio + /exportPortfolio/* + - - 120 - + + chartGenerator + /chartGenerator/* + + + + Connector + /fckeditor/editor/filemanager/browser/default/connectors/jsp/connector + + + + 120 + - - 403 - /403.html - + + 500 + /error.jsp + + + 403 + /403.jsp + + + 404 + /404.jsp + + + + + --> - - fck-editor - /WEB-INF/fckeditor/tlds/FCKeditor.tld - + + + + + + + + tags-bean + /WEB-INF/struts/tlds/struts-bean.tld + + + tags-html + /WEB-INF/struts/tlds/struts-html.tld + + + tags-logic + /WEB-INF/struts/tlds/struts-logic.tld + + + tags-logic-el + /WEB-INF/struts/tlds/struts-logic-el.tld + + + tags-tiles + /WEB-INF/struts/tlds/struts-tiles.tld + + + + + + tags-fmt + /WEB-INF/jstl/tlds/fmt.tld + + + tags-core + /WEB-INF/jstl/tlds/c.tld + + + tags-function + /WEB-INF/jstl/tlds/fn.tld + + + tags-xml + /WEB-INF/jstl/tlds/x.tld + + + + + + tags-permittedTaglibs + /WEB-INF/jstl/tlds/permittedTaglibs.tld + + + tags-scriptfree + /WEB-INF/jstl/tlds/scriptfree.tld + + + + + + fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + + tags-lams + /WEB-INF/lams.tld + + + + @@ -135,46 +288,44 @@ - - + - Secure Content - /* + Authoring Update + /authoring.do - LEARNER - TEACHER - MONITOR AUTHOR - ADMIN - SYSADMIN + + + Staff Content + /monitoring.do + + + MONITOR + TEACHER + + - Authoring Update - /authoringStarter.do - /authoring.do - + Adminstrator Content + /admin.do + - AUTHOR + ADMIN - - - Staff Content - /monitoringStarter.do - /monitoring.do + LAMS System Adminstrator Content + /sysadmin.do - MONITOR + SYSADMIN - - @@ -184,19 +335,11 @@ AUTHOR MONITOR + TEACHER ADMIN SYSADMIN - - - - - FORM - LAMS - - /login.jsp - - - + + Index: lams_tool_vote/web/403.jsp =================================================================== diff -u -ra8e5c42d584e4b8b9b67224179acbc53850d279f -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/403.jsp (.../403.jsp) (revision a8e5c42d584e4b8b9b67224179acbc53850d279f) +++ lams_tool_vote/web/403.jsp (.../403.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,6 +1,25 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> - + \ No newline at end of file Index: lams_tool_vote/web/404.jsp =================================================================== diff -u -ra8e5c42d584e4b8b9b67224179acbc53850d279f -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/404.jsp (.../404.jsp) (revision a8e5c42d584e4b8b9b67224179acbc53850d279f) +++ lams_tool_vote/web/404.jsp (.../404.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,7 +1,26 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> - + Index: lams_tool_vote/web/BaseContent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/BaseContent.jsp (.../BaseContent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/BaseContent.jsp (.../BaseContent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,19 +13,9 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> - -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %>

Base Content

Index: lams_tool_vote/web/Footer.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/Footer.jsp (.../Footer.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/Footer.jsp (.../Footer.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,17 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt ---%> - - -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +--%> \ No newline at end of file Index: lams_tool_vote/web/Header.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/Header.jsp (.../Header.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/Header.jsp (.../Header.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,19 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> - - -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/VoteErrorBox.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/web/WEB-INF/fckeditor/tlds/FCKeditor.tld =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/fckeditor/tlds/FCKeditor.tld (.../FCKeditor.tld) (revision 402985c35e80fbce6960c7d7598b0262292398eb) +++ lams_tool_vote/web/WEB-INF/fckeditor/tlds/FCKeditor.tld (.../FCKeditor.tld) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -14,6 +14,7 @@ id true + true basePath Index: lams_tool_vote/web/WEB-INF/lams.tld =================================================================== diff -u -r6b48d7643dda77bdad77a24c3af3f0b3d9cec1c2 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/lams.tld (.../lams.tld) (revision 6b48d7643dda77bdad77a24c3af3f0b3d9cec1c2) +++ lams_tool_vote/web/WEB-INF/lams.tld (.../lams.tld) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -24,6 +24,46 @@ + converts text from \n or \r\n to <BR> before rendering + converts text from \n or \r\n to <BR> before rendering + + + out + org.lamsfoundation.lams.web.tag.MultiLinesOutputTag + empty + + + converts text from \n or \r\n to <BR> before rendering + value + true + + true + + + + + + + Render html tag with direction and language + Render html tag with direction and language + + + html + org.lamsfoundation.lams.web.tag.HtmlTag + JSP + + + Render html tag with direction and language + xhtml + false + + true + + + + + + Output a random number for the learner and passon flash movies to communicate directly. generate unique ID @@ -287,14 +327,10 @@ /WEB-INF/tags/TabBody.tag - HTMLEditor - /WEB-INF/tags/HTMLEditor.tag + FCKEditor + /WEB-INF/tags/FCKEditor.tag - SetEditor - /WEB-INF/tags/SetEditor.tag - - AuthoringButton /WEB-INF/tags/AuthoringButton.tag @@ -310,8 +346,13 @@ ExportPortOutput /WEB-INF/tags/ExportPortOutput.tag - + Date /WEB-INF/tags/Date.tag + + DefineLater + /WEB-INF/tags/DefineLater.tag + + Index: lams_tool_vote/web/WEB-INF/struts-config.xml =================================================================== diff -u -r14256ea45ab199cb0fea34e9b987aa55608cd206 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 14256ea45ab199cb0fea34e9b987aa55608cd206) +++ lams_tool_vote/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -110,6 +110,20 @@ path="/learning/Preview.jsp" redirect="false" /> + + + + + + @@ -382,6 +396,20 @@ redirect="false" /> + + + + + + <%@ attribute name="toolSignature" required="true" rtexprvalue="true" %> <%@ attribute name="toolContentID" required="true" rtexprvalue="true" %> +<%@ attribute name="contentFolderID" required="true" rtexprvalue="true" %> <%@ attribute name="clearSessionActionUrl" required="true" rtexprvalue="true" %> <%-- Optional attribute --%> @@ -45,6 +46,7 @@ <%@ attribute name="saveButtonLabelKey" required="false" rtexprvalue="true" %> <%@ attribute name="cancelConfirmMsgKey" required="false" rtexprvalue="true" %> <%@ attribute name="defineLater" required="false" rtexprvalue="true" %> +<%@ attribute name="customiseSessionID" required="false" rtexprvalue="true" %> <%-- Default value for message key --%> @@ -63,14 +65,14 @@ -

+

Index: lams_tool_vote/web/WEB-INF/tags/Date.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/Date.tag (.../Date.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/Date.tag (.../Date.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/DefineLater.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/DefineLater.tag (.../DefineLater.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/DefineLater.tag (.../DefineLater.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/ExportPortOutput.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/ExportPortOutput.tag (.../ExportPortOutput.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/ExportPortOutput.tag (.../ExportPortOutput.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/FCKEditor.tag =================================================================== diff -u --- lams_tool_vote/web/WEB-INF/tags/FCKEditor.tag (revision 0) +++ lams_tool_vote/web/WEB-INF/tags/FCKEditor.tag (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,57 @@ +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="fck-editor" prefix="fck"%> + +<%@ attribute name="id" required="true" rtexprvalue="true"%> +<%@ attribute name="value" required="true" rtexprvalue="true"%> +<%@ attribute name="toolbarSet" required="false" rtexprvalue="true"%> +<%@ attribute name="contentFolderID" required="true" rtexprvalue="true"%> + + + + + + + + + + + + + + + ${value} + + + + + Index: lams_tool_vote/web/WEB-INF/tags/Passon.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/Passon.tag (.../Passon.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/Passon.tag (.../Passon.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt @@ -33,16 +33,20 @@ <%@ tag body-content="empty" %> <%@ attribute name="progress" required="true" rtexprvalue="true" type="java.lang.String" %> <%@ attribute name="id" required="true" rtexprvalue="true" %> +<%@ attribute name="redirect" required="false" rtexprvalue="true" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-lams" prefix="lams" %> - - - + + + + + + Index: lams_tool_vote/web/WEB-INF/tags/Tab.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/Tab.tag (.../Tab.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/Tab.tag (.../Tab.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/TabBody.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/TabBody.tag (.../TabBody.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/TabBody.tag (.../TabBody.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/Tabs.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/Tabs.tag (.../Tabs.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/Tabs.tag (.../Tabs.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/tags/headItems.tag =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/tags/headItems.tag (.../headItems.tag) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/tags/headItems.tag (.../headItems.tag) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * http://www.gnu.org/licenses/gpl.txt Index: lams_tool_vote/web/WEB-INF/web.xml =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/WEB-INF/web.xml (.../web.xml) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/WEB-INF/web.xml (.../web.xml) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -270,4 +270,76 @@ /WEB-INF/lams.tld + + + + + + Secure Content + /* + + + LEARNER + TEACHER + MONITOR + AUTHOR + ADMIN + SYSADMIN + + + + + + Authoring Update + /authoring.do + + + AUTHOR + + + + + Staff Content + /monitoring.do + + + MONITOR + TEACHER + + + + + + Adminstrator Content + /admin.do + + + ADMIN + + + + + LAMS System Adminstrator Content + /sysadmin.do + + + SYSADMIN + + + + + + Download Files + /download/ + + + AUTHOR + MONITOR + TEACHER + ADMIN + SYSADMIN + + + + Index: lams_tool_vote/web/authoring/AdvancedContent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -19,14 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp"%> Index: lams_tool_vote/web/authoring/AuthoringMaincontent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/authoring/AuthoringMaincontent.jsp (.../AuthoringMaincontent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/authoring/AuthoringMaincontent.jsp (.../AuthoringMaincontent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -45,11 +45,15 @@ <bean:message key="activity.title"/> <%@ include file="/common/header.jsp"%> - <%@ include file="/common/fckeditorheader.jsp"%> + + - - - - - + + +
- -
+ + + + + + + + + - - - + + + + + + + + + + + + + + - - - - +
+
+ +
+ +
+
+ +
+ +
- -
+
+ + <%@ include file="/authoring/itemlist.jsp"%> + + + <%@ include file="/monitoring/itemlist.jsp"%> + +
+
+ ');" + style="float:right;width:150px" class="button-add-item"> +
+ ');" + style="float:right;width:150px" class="button-add-item"> +
- + + + - - - -
+ +
- +
- images/down.gif" align=left onclick="javascript:submitModifyNomination('1','moveNominationDown');"> -
+ + + + +
 
+ +

+ + +

+ +
+ + + + + +
- - - - - - + - - - - - - - - - - - - - - - - images/up.gif" align=left onclick="javascript:submitModifyNomination('','moveNominationUp');"> - - - - images/down.gif" align=left onclick="javascript:submitModifyNomination('','moveNominationDown');"> - images/up.gif" align=left onclick="javascript:submitModifyNomination('','moveNominationUp');"> - - - - - - - - - - - - - - - - - - -
- - - -
 
 
- - - - -

- - -

-
- - - - - - - Index: lams_tool_vote/web/authoring/BasicContentViewOnly.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/authoring/BasicContentViewOnly.jsp (.../BasicContentViewOnly.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -19,69 +19,59 @@ http://www.gnu.org/licenses/gpl.txt --%> +<%@ include file="/common/taglibs.jsp"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - - - + +
- - - - + + + - - - - - - - - + + + - - - - - - - + + + - - - - - - - +
- -
+
+ +
+ +
- -
- : - - -
+
+ +
+ +
:
+
+ <%@ include file="/authoring/itemlistViewOnly.jsp"%> +
+
- -
+ - - + + + + + + + + + + \ No newline at end of file Index: lams_tool_vote/web/authoring/InstructionsContent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/authoring/InstructionsContent.jsp (.../InstructionsContent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,3 +1,4 @@ + <%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ @@ -13,143 +14,185 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA http://www.gnu.org/licenses/gpl.txt --%> +<%@ include file="/common/taglibs.jsp" %> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-logic-el" prefix="logic-el" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> + - - - -
- - + + + - - + +
- -
+
+ +
+ +
- - - - - - - - +
- - - - - - - - - - - - - - - - + + + - - -
- images/delete.gif" align=left onclick="javascript:submitDeleteFile('','deleteOnlineFile');"> -
-
+ + + +
+ + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +    + + + +
+
+
+ + + +
+ + + + - - + + - - - - - + + + + + + - - - - - + + + +
+ +
+ + - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - images/delete.gif" align=left onclick="javascript:submitDeleteFile('','deleteOfflineFile');"> -
- + + + + + +
+ + + + +
+ + + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +    + + + +
+
+
+ +
+ + + - - - - - - - - + + + + + + + + + + + - + + - - - - - - -   - - - - + + + Index: lams_tool_vote/web/authoring/editNominationBox.jsp =================================================================== diff -u --- lams_tool_vote/web/authoring/editNominationBox.jsp (revision 0) +++ lams_tool_vote/web/authoring/editNominationBox.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,94 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ +
+ + +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_vote/web/authoring/itemlist.jsp =================================================================== diff -u --- lams_tool_vote/web/authoring/itemlist.jsp (revision 0) +++ lams_tool_vote/web/authoring/itemlist.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,103 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + +<%-- This script will works when a new resoruce item submit in order to refresh "Resource List" panel. --%> + + Index: lams_tool_vote/web/authoring/itemlistViewOnly.jsp =================================================================== diff -u --- lams_tool_vote/web/authoring/itemlistViewOnly.jsp (revision 0) +++ lams_tool_vote/web/authoring/itemlistViewOnly.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,94 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + +<%@ include file="/common/taglibs.jsp" %> + + Index: lams_tool_vote/web/authoring/newNominationBox.jsp =================================================================== diff -u --- lams_tool_vote/web/authoring/newNominationBox.jsp (revision 0) +++ lams_tool_vote/web/authoring/newNominationBox.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,89 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_vote/web/common/header.jsp =================================================================== diff -u -rc277bb1c30c1283b5f66c6f651855c51a5f87bc5 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/common/header.jsp (.../header.jsp) (revision c277bb1c30c1283b5f66c6f651855c51a5f87bc5) +++ lams_tool_vote/web/common/header.jsp (.../header.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,25 +1,36 @@ <%@ include file="/common/taglibs.jsp"%> - - - + + + + + + + - - - - - - - - - - - + + + + + + - - - - - + - \ No newline at end of file + + + + + + + + + + + + + + + +<%@ include file="/common/fckeditorheader.jsp"%> + Index: lams_tool_vote/web/common/messages.jsp =================================================================== diff -u -re48a67de27af42221ddce80419f05c1be4680430 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/common/messages.jsp (.../messages.jsp) (revision e48a67de27af42221ddce80419f05c1be4680430) +++ lams_tool_vote/web/common/messages.jsp (.../messages.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -2,9 +2,9 @@
- -
+   
@@ -13,8 +13,8 @@
- -
+    +   
\ No newline at end of file Index: lams_tool_vote/web/common/taglibs.jsp =================================================================== diff -u -re48a67de27af42221ddce80419f05c1be4680430 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/common/taglibs.jsp (.../taglibs.jsp) (revision e48a67de27af42221ddce80419f05c1be4680430) +++ lams_tool_vote/web/common/taglibs.jsp (.../taglibs.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,4 +1,4 @@ -<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-tiles" prefix="tiles" %> <%@ taglib uri="tags-bean" prefix="bean" %> <%@ taglib uri="tags-html" prefix="html" %> @@ -10,4 +10,3 @@ <%@ taglib uri="tags-lams" prefix="lams" %> <%@ taglib uri="fck-editor" prefix="FCK"%> - Index: lams_tool_vote/web/error.jsp =================================================================== diff -u -r88acb04987abd12bc87754fbbe1f835dcd99a5cc -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/error.jsp (.../error.jsp) (revision 88acb04987abd12bc87754fbbe1f835dcd99a5cc) +++ lams_tool_vote/web/error.jsp (.../error.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,3 +1,24 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + Index: lams_tool_vote/web/export/ExportContent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/export/ExportContent.jsp (.../ExportContent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/export/ExportContent.jsp (.../ExportContent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -19,15 +19,8 @@ http://www.gnu.org/licenses/gpl.txt --%> +<%@ include file="/common/taglibs.jsp"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - @@ -308,6 +301,7 @@ + Index: lams_tool_vote/web/images/iconInformation.gif =================================================================== diff -u Binary files differ Index: lams_tool_vote/web/images/iconWarning.gif =================================================================== diff -u Binary files differ Index: lams_tool_vote/web/includes/blank.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/blank.jsp (revision 0) +++ lams_tool_vote/web/includes/blank.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,3 @@ +<%@ include file="/common/taglibs.jsp" %> +<%@ include file="/common/messages.jsp" %> + Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/css/rsrc.css'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/web/includes/error.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/error.jsp (revision 0) +++ lams_tool_vote/web/includes/error.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,7 @@ +<%@ page language="java" %> +<%@ include file="/includes/taglibs.jsp" %> +
+
+ + +
Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/fckcontroller.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/rsrccommon.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/rsrcresourceitem.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tabcontroller.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tree.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/includes/javascript/tree_tpl.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/web/includes/layout.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/layout.jsp (revision 0) +++ lams_tool_vote/web/includes/layout.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,32 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + +
+ + + +

+ +

+
+ + + +
+ +
+ + +
+ + Index: lams_tool_vote/web/includes/learnerLayout.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/learnerLayout.jsp (revision 0) +++ lams_tool_vote/web/includes/learnerLayout.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,33 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + + + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + + + + + +
+ +
+ + Index: lams_tool_vote/web/includes/tablayout.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/tablayout.jsp (revision 0) +++ lams_tool_vote/web/includes/tablayout.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,31 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + <bean:message key="activity.title" /> + <%@ include file="/common/header.jsp"%> + + + + + +
+ + + + +

+ +

+
+ + + + +
+ + Index: lams_tool_vote/web/includes/taglibs.jsp =================================================================== diff -u --- lams_tool_vote/web/includes/taglibs.jsp (revision 0) +++ lams_tool_vote/web/includes/taglibs.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,10 @@ +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ taglib uri="tags-bean" prefix="bean" %> +<%@ taglib uri="tags-logic" prefix="logic" %> +<%@ taglib uri="tags-tiles" prefix="tiles" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ taglib uri="fck-editor" prefix="fck"%> + Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/index.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/learningIndex.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_vote/web/login.jsp =================================================================== diff -u -r0409f98dc17dfd380badf33ae103a47d0fffc4e5 -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/login.jsp (.../login.jsp) (revision 0409f98dc17dfd380badf33ae103a47d0fffc4e5) +++ lams_tool_vote/web/login.jsp (.../login.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,3 +1,23 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-core" prefix="c" %> Index: lams_tool_vote/web/monitoring/AllSessionsSummary.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/monitoring/AllSessionsSummary.jsp (.../AllSessionsSummary.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/monitoring/AllSessionsSummary.jsp (.../AllSessionsSummary.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -20,20 +20,14 @@ --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> +<%@ include file="/common/taglibs.jsp"%> - +
@@ -42,7 +36,7 @@
-
+ - + @@ -223,7 +218,7 @@ - monitoring.do?method=getVoteNomination&questionUid=${currentQuestionUid.value}&sessionUid=${currentSessionUid.value} + monitoring.do?dispatch=getVoteNomination&questionUid=${currentQuestionUid.value}&sessionUid=${currentSessionUid.value} Index: lams_tool_vote/web/monitoring/Edit.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -18,33 +18,30 @@ http://www.gnu.org/licenses/gpl.txt --%> + + <%@ include file="/common/taglibs.jsp"%> + + -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> + <%@ include file="/common/messages.jsp"%> + + + + + + + + + - - + +
+
+ +
+ +
+ - - - - - - - - - - - - - -
- -
-
+ + Index: lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp (.../IndividualSessionSummary.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/monitoring/IndividualSessionSummary.jsp (.../IndividualSessionSummary.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -20,28 +20,21 @@ --%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - +<%@ include file="/common/taglibs.jsp"%> - - +
+
- +
+
- + + @@ -216,7 +212,7 @@ - monitoring.do?method=getVoteNomination&questionUid=${currentQuestionUid.value}&sessionUid=${currentSessionUid.value} + monitoring.do?dispatch=getVoteNomination&questionUid=${currentQuestionUid.value}&sessionUid=${currentSessionUid.value} Index: lams_tool_vote/web/monitoring/Instructions.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/monitoring/Instructions.jsp (.../Instructions.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/monitoring/Instructions.jsp (.../Instructions.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -1,9 +1,9 @@ -<%-- +<%-- Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) License Information: http://lamsfoundation.org/licensing/lams/2.0/ This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as + it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, @@ -13,120 +13,124 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA http://www.gnu.org/licenses/gpl.txt --%> +<%@ include file="/common/taglibs.jsp"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-logic" prefix="logic" %> -<%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="fck-editor" prefix="FCK" %> -<%@ taglib uri="tags-lams" prefix="lams" %> - - - - -
+
- - - + - - - - - - - - - + + + +
- - + + + + + + + + + +
+ +
+ + - - +
-
- -
+ + - - -
+ - - + +
- - - - - - + + + + + +
- - - - - - - - - + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +
+
+
- - - - - - -
-
+
- - + +
- -
- - - - - - - - -
- - - - - - - - - - - - - - - -
-
+ + + +
- - - - + + + + +
+ + + + + /download/?uuid=&preferDownload=false + /download/?uuid=&preferDownload=true + + + + + + + + +
+ + + + +
+ '/>")' class="button"> + + +    + + + +
+
+
+ +
+
- \ No newline at end of file Index: lams_tool_vote/web/monitoring/MonitoringMaincontent.jsp =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r00759d7592ccc90e8769763524afb69546f641d4 --- lams_tool_vote/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_tool_vote/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -43,10 +43,14 @@ <bean:message key="label.monitoring"/> <%@ include file="/common/header.jsp"%> - <%@ include file="/common/fckeditorheader.jsp"%> + + + Index: lams_tool_vote/web/monitoring/editNominationBox.jsp =================================================================== diff -u --- lams_tool_vote/web/monitoring/editNominationBox.jsp (revision 0) +++ lams_tool_vote/web/monitoring/editNominationBox.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,106 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
+ +
+ + +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Index: lams_tool_vote/web/monitoring/itemlist.jsp =================================================================== diff -u --- lams_tool_vote/web/monitoring/itemlist.jsp (revision 0) +++ lams_tool_vote/web/monitoring/itemlist.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,104 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ include file="/common/taglibs.jsp" %> + + +<%-- This script will works when a new resoruce item submit in order to refresh "Resource List" panel. --%> + + Index: lams_tool_vote/web/monitoring/newNominationBox.jsp =================================================================== diff -u --- lams_tool_vote/web/monitoring/newNominationBox.jsp (revision 0) +++ lams_tool_vote/web/monitoring/newNominationBox.jsp (revision 00759d7592ccc90e8769763524afb69546f641d4) @@ -0,0 +1,104 @@ + <%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + http://www.gnu.org/licenses/gpl.txt +--%> + + + +<%@ include file="/common/taglibs.jsp"%> + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ +
+ +
+ + + + + + +
                     + + + + + + + +
+
+
+ + + Fisheye: Tag 00759d7592ccc90e8769763524afb69546f641d4 refers to a dead (removed) revision in file `lams_tool_vote/web/monitoringIndex.jsp'. Fisheye: No comparison available. Pass `N' to diff?