Index: lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteContent.hbm.xml =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteContent.hbm.xml (.../VoteContent.hbm.xml) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/conf/hibernate/mappings/org/lamsfoundation/lams/tool/vote/VoteContent.hbm.xml (.../VoteContent.hbm.xml) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -41,8 +41,17 @@ column="instructions" length="65535" /> + + + + + - - - - - - - - - - - - Index: lams_tool_vote/conf/language/ApplicationResources.properties =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -152,7 +152,7 @@ error.title =Please correct this: The field "Title" is mandatory.
error.instructions =Please correct this: The field "Instructions" is mandatory.
error.reportTitle =Please correct this: The field "Report Title (Advanced)" is mandatory.
-error.defaultquestion.empty =Please correct this: The first question can not be empty.
+error.defaultoption.empty =Please correct this: The first nomination can not be empty.
error.passMark.empty =Please correct this: Pass Mark can not be empty. options.count.zero =Please correct this: There must be at least one candidate answer. error.passmark.notInteger =Please correct this: Pass Mark can only be an integer. @@ -207,6 +207,7 @@ error.mode.required =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a mode. error.mode.invalid =Tool Activity Error! Can't continue
URL is not complete. The Tool Activity requires a valid mode: learner or teacher error.learner.sessionId.inconsistent =Tool Activity Error! Can't continue
The session id passed is inconsistent for learner progress report. +error.options.duplicate =Please correct this: The nominations must be unique. #Monitoring mode resources button.startLesson =Start Lesson Index: lams_tool_vote/conf/middlegen/lams_tool_lamc11-prefs.properties =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/conf/middlegen/lams_tool_lamc11-prefs.properties (.../lams_tool_lamc11-prefs.properties) (revision 402985c35e80fbce6960c7d7598b0262292398eb) +++ lams_tool_vote/conf/middlegen/lams_tool_lamc11-prefs.properties (.../lams_tool_lamc11-prefs.properties) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -1,174 +1 @@ # Middlegen Preferences -hibernate.tables.tl_lamc11_content.base-class-name=TlLamc11Content -hibernate.tables.tl_lamc11_content.columns.content_in_use.java-name=contentInUse -hibernate.tables.tl_lamc11_content.columns.content_in_use.java-type=byte -hibernate.tables.tl_lamc11_content.columns.created_by.java-name=createdBy -hibernate.tables.tl_lamc11_content.columns.created_by.java-type=long -hibernate.tables.tl_lamc11_content.columns.creation_date.java-name=creationDate -hibernate.tables.tl_lamc11_content.columns.creation_date.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.define_later.java-name=defineLater -hibernate.tables.tl_lamc11_content.columns.define_later.java-type=byte -hibernate.tables.tl_lamc11_content.columns.end_learning_message.java-name=endLearningMessage -hibernate.tables.tl_lamc11_content.columns.end_learning_message.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.instructions.java-name=instructions -hibernate.tables.tl_lamc11_content.columns.instructions.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.mc_content_id.java-name=mcContentId -hibernate.tables.tl_lamc11_content.columns.mc_content_id.java-type=long -hibernate.tables.tl_lamc11_content.columns.monitoring_report_title.java-name=monitoringReportTitle -hibernate.tables.tl_lamc11_content.columns.monitoring_report_title.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.offline_instructions.java-name=offlineInstructions -hibernate.tables.tl_lamc11_content.columns.offline_instructions.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.online_instructions.java-name=onlineInstructions -hibernate.tables.tl_lamc11_content.columns.online_instructions.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.pass_mark.java-name=passMark -hibernate.tables.tl_lamc11_content.columns.pass_mark.java-type=java.lang.Integer -hibernate.tables.tl_lamc11_content.columns.qa_content_id.java-name=qaContentId -hibernate.tables.tl_lamc11_content.columns.qa_content_id.java-type=long -hibernate.tables.tl_lamc11_content.columns.questions_sequenced.java-name=questionsSequenced -hibernate.tables.tl_lamc11_content.columns.questions_sequenced.java-type=byte -hibernate.tables.tl_lamc11_content.columns.report_title.java-name=reportTitle -hibernate.tables.tl_lamc11_content.columns.report_title.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.retries.java-name=retries -hibernate.tables.tl_lamc11_content.columns.retries.java-type=byte -hibernate.tables.tl_lamc11_content.columns.run_offline.java-name=runOffline -hibernate.tables.tl_lamc11_content.columns.run_offline.java-type=byte -hibernate.tables.tl_lamc11_content.columns.show_feedback.java-name=showFeedback -hibernate.tables.tl_lamc11_content.columns.show_feedback.java-type=byte -hibernate.tables.tl_lamc11_content.columns.show_top_users.java-name=showTopUsers -hibernate.tables.tl_lamc11_content.columns.show_top_users.java-type=byte -hibernate.tables.tl_lamc11_content.columns.synch_in_monitor.java-name=synchInMonitor -hibernate.tables.tl_lamc11_content.columns.synch_in_monitor.java-type=byte -hibernate.tables.tl_lamc11_content.columns.title.java-name=title -hibernate.tables.tl_lamc11_content.columns.title.java-type=java.lang.String -hibernate.tables.tl_lamc11_content.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_content.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_lamc11_content.columns.update_date.java-name=updateDate -hibernate.tables.tl_lamc11_content.columns.update_date.java-type=java.sql.Timestamp -hibernate.tables.tl_lamc11_content.columns.username_visible.java-name=usernameVisible -hibernate.tables.tl_lamc11_content.columns.username_visible.java-type=byte -hibernate.tables.tl_lamc11_options_content.base-class-name=TlLamc11OptionsContent -hibernate.tables.tl_lamc11_options_content.columns.correct_option.java-name=correctOption -hibernate.tables.tl_lamc11_options_content.columns.correct_option.java-type=byte -hibernate.tables.tl_lamc11_options_content.columns.mc_que_content_id.java-name=mcQueContentId -hibernate.tables.tl_lamc11_options_content.columns.mc_que_content_id.java-type=long -hibernate.tables.tl_lamc11_options_content.columns.mc_que_option_id.java-name=mcQueOptionId -hibernate.tables.tl_lamc11_options_content.columns.mc_que_option_id.java-type=long -hibernate.tables.tl_lamc11_options_content.columns.mc_que_option_text.java-name=mcQueOptionText -hibernate.tables.tl_lamc11_options_content.columns.mc_que_option_text.java-type=java.lang.String -hibernate.tables.tl_lamc11_options_content.columns.qa_que_content_id.java-name=qaQueContentId -hibernate.tables.tl_lamc11_options_content.columns.qa_que_content_id.java-type=long -hibernate.tables.tl_lamc11_options_content.columns.qa_que_option_id.java-name=qaQueOptionId -hibernate.tables.tl_lamc11_options_content.columns.qa_que_option_id.java-type=long -hibernate.tables.tl_lamc11_options_content.columns.qa_que_option_text.java-name=qaQueOptionText -hibernate.tables.tl_lamc11_options_content.columns.qa_que_option_text.java-type=java.lang.String -hibernate.tables.tl_lamc11_options_content.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_options_content.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_lamc11_options_content.keygenerator=native -hibernate.tables.tl_lamc11_que_content.base-class-name=TlLamc11QueContent -hibernate.tables.tl_lamc11_que_content.columns.display_order.java-name=displayOrder -hibernate.tables.tl_lamc11_que_content.columns.display_order.java-type=java.lang.Integer -hibernate.tables.tl_lamc11_que_content.columns.mc_content_id.java-name=mcContentId -hibernate.tables.tl_lamc11_que_content.columns.mc_content_id.java-type=long -hibernate.tables.tl_lamc11_que_content.columns.mc_que_content_id.java-name=mcQueContentId -hibernate.tables.tl_lamc11_que_content.columns.mc_que_content_id.java-type=long -hibernate.tables.tl_lamc11_que_content.columns.qa_content_id.java-name=qaContentId -hibernate.tables.tl_lamc11_que_content.columns.qa_content_id.java-type=long -hibernate.tables.tl_lamc11_que_content.columns.qa_que_content_id.java-name=qaQueContentId -hibernate.tables.tl_lamc11_que_content.columns.qa_que_content_id.java-type=long -hibernate.tables.tl_lamc11_que_content.columns.question.java-name=question -hibernate.tables.tl_lamc11_que_content.columns.question.java-type=java.lang.String -hibernate.tables.tl_lamc11_que_content.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_que_content.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_lamc11_que_content.keygenerator=assigned -hibernate.tables.tl_lamc11_que_usr.base-class-name=TlLamc11QueUsr -hibernate.tables.tl_lamc11_que_usr.columns.fullname.java-name=fullname -hibernate.tables.tl_lamc11_que_usr.columns.fullname.java-type=java.lang.String -hibernate.tables.tl_lamc11_que_usr.columns.mc_session_id.java-name=mcSessionId -hibernate.tables.tl_lamc11_que_usr.columns.mc_session_id.java-type=long -hibernate.tables.tl_lamc11_que_usr.columns.qa_session_id.java-name=qaSessionId -hibernate.tables.tl_lamc11_que_usr.columns.qa_session_id.java-type=long -hibernate.tables.tl_lamc11_que_usr.columns.que_usr_id.java-name=queUsrId -hibernate.tables.tl_lamc11_que_usr.columns.que_usr_id.java-type=long -hibernate.tables.tl_lamc11_que_usr.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_que_usr.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_lamc11_que_usr.columns.username.java-name=username -hibernate.tables.tl_lamc11_que_usr.columns.username.java-type=java.lang.String -hibernate.tables.tl_lamc11_session.base-class-name=TlLamc11Session -hibernate.tables.tl_lamc11_session.columns.mc_content_id.java-name=mcContentId -hibernate.tables.tl_lamc11_session.columns.mc_content_id.java-type=long -hibernate.tables.tl_lamc11_session.columns.mc_session_id.java-name=mcSessionId -hibernate.tables.tl_lamc11_session.columns.mc_session_id.java-type=long -hibernate.tables.tl_lamc11_session.columns.qa_content_id.java-name=qaContentId -hibernate.tables.tl_lamc11_session.columns.qa_content_id.java-type=long -hibernate.tables.tl_lamc11_session.columns.qa_session_id.java-name=qaSessionId -hibernate.tables.tl_lamc11_session.columns.qa_session_id.java-type=long -hibernate.tables.tl_lamc11_session.columns.session_end_date.columnspecialty=property -hibernate.tables.tl_lamc11_session.columns.session_end_date.java-name=sessionEndDate -hibernate.tables.tl_lamc11_session.columns.session_end_date.java-type=java.sql.Timestamp -hibernate.tables.tl_lamc11_session.columns.session_start_date.java-name=sessionStartDate -hibernate.tables.tl_lamc11_session.columns.session_start_date.java-type=java.sql.Timestamp -hibernate.tables.tl_lamc11_session.columns.session_status.java-name=sessionStatus -hibernate.tables.tl_lamc11_session.columns.session_status.java-type=java.lang.String -hibernate.tables.tl_lamc11_session.columns.uid.columnspecialty=key -hibernate.tables.tl_lamc11_session.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_session.columns.uid.java-type=java.lang.Long -hibernate.tables.tl_lamc11_usr_attempt.base-class-name=TlLamc11UsrAttempt -hibernate.tables.tl_lamc11_usr_attempt.columns.attempt_id.columnspecialty=property -hibernate.tables.tl_lamc11_usr_attempt.columns.attempt_id.java-name=attemptId -hibernate.tables.tl_lamc11_usr_attempt.columns.attempt_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.attempt_time.java-name=attemptTime -hibernate.tables.tl_lamc11_usr_attempt.columns.attempt_time.java-type=java.sql.Timestamp -hibernate.tables.tl_lamc11_usr_attempt.columns.mc_que_content_id.java-name=mcQueContentId -hibernate.tables.tl_lamc11_usr_attempt.columns.mc_que_content_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.mc_que_option_id.java-name=mcQueOptionId -hibernate.tables.tl_lamc11_usr_attempt.columns.mc_que_option_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.qa_que_content_id.java-name=qaQueContentId -hibernate.tables.tl_lamc11_usr_attempt.columns.qa_que_content_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.qa_que_option_id.java-name=qaQueOptionId -hibernate.tables.tl_lamc11_usr_attempt.columns.qa_que_option_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.que_usr_id.java-name=queUsrId -hibernate.tables.tl_lamc11_usr_attempt.columns.que_usr_id.java-type=long -hibernate.tables.tl_lamc11_usr_attempt.columns.time_zone.java-name=timeZone -hibernate.tables.tl_lamc11_usr_attempt.columns.time_zone.java-type=java.lang.String -hibernate.tables.tl_lamc11_usr_attempt.columns.uid.java-name=uid -hibernate.tables.tl_lamc11_usr_attempt.columns.uid.java-type=java.lang.Long -relations.tl_lamc11_content-tl_lamc11_que_content.tl_lamc11_content-has-tl_lamc11_que_content.enabled=true -relations.tl_lamc11_content-tl_lamc11_que_content.tl_lamc11_content-has-tl_lamc11_que_content.target-many=true -relations.tl_lamc11_content-tl_lamc11_que_content.tl_lamc11_que_content-has-tl_lamc11_content.enabled=true -relations.tl_lamc11_content-tl_lamc11_que_content.tl_lamc11_que_content-has-tl_lamc11_content.target-many=false -relations.tl_lamc11_content-tl_lamc11_session.tl_lamc11_content-has-tl_lamc11_session.enabled=true -relations.tl_lamc11_content-tl_lamc11_session.tl_lamc11_content-has-tl_lamc11_session.target-many=true -relations.tl_lamc11_content-tl_lamc11_session.tl_lamc11_session-has-tl_lamc11_content.enabled=true -relations.tl_lamc11_content-tl_lamc11_session.tl_lamc11_session-has-tl_lamc11_content.target-many=false -relations.tl_lamc11_options_content-tl_lamc11_usr_attempt.tl_lamc11_options_content-has-tl_lamc11_usr_attempt.enabled=true -relations.tl_lamc11_options_content-tl_lamc11_usr_attempt.tl_lamc11_options_content-has-tl_lamc11_usr_attempt.target-many=true -relations.tl_lamc11_options_content-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_options_content.enabled=true -relations.tl_lamc11_options_content-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_options_content.target-many=false -relations.tl_lamc11_que_content-tl_lamc11_options_content.tl_lamc11_options_content-has-tl_lamc11_que_content.enabled=true -relations.tl_lamc11_que_content-tl_lamc11_options_content.tl_lamc11_options_content-has-tl_lamc11_que_content.target-many=false -relations.tl_lamc11_que_content-tl_lamc11_options_content.tl_lamc11_que_content-has-tl_lamc11_options_content.enabled=true -relations.tl_lamc11_que_content-tl_lamc11_options_content.tl_lamc11_que_content-has-tl_lamc11_options_content.target-many=true -relations.tl_lamc11_que_content-tl_lamc11_usr_attempt.tl_lamc11_que_content-has-tl_lamc11_usr_attempt.enabled=true -relations.tl_lamc11_que_content-tl_lamc11_usr_attempt.tl_lamc11_que_content-has-tl_lamc11_usr_attempt.target-many=true -relations.tl_lamc11_que_content-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_que_content.enabled=true -relations.tl_lamc11_que_content-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_que_content.target-many=false -relations.tl_lamc11_que_usr-tl_lamc11_usr_attempt.tl_lamc11_que_usr-has-tl_lamc11_usr_attempt.enabled=true -relations.tl_lamc11_que_usr-tl_lamc11_usr_attempt.tl_lamc11_que_usr-has-tl_lamc11_usr_attempt.target-many=true -relations.tl_lamc11_que_usr-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_que_usr.enabled=true -relations.tl_lamc11_que_usr-tl_lamc11_usr_attempt.tl_lamc11_usr_attempt-has-tl_lamc11_que_usr.target-many=false -relations.tl_lamc11_session-tl_lamc11_que_usr.tl_lamc11_que_usr-has-tl_lamc11_session.enabled=true -relations.tl_lamc11_session-tl_lamc11_que_usr.tl_lamc11_que_usr-has-tl_lamc11_session.target-many=false -relations.tl_lamc11_session-tl_lamc11_que_usr.tl_lamc11_session-has-tl_lamc11_que_usr.enabled=true -relations.tl_lamc11_session-tl_lamc11_que_usr.tl_lamc11_session-has-tl_lamc11_que_usr.target-many=true -tables.tl_lamc11_content.x=50 -tables.tl_lamc11_content.y=50 -tables.tl_lamc11_options_content.x=110 -tables.tl_lamc11_options_content.y=110 -tables.tl_lamc11_que_content.x=69 -tables.tl_lamc11_que_content.y=69 -tables.tl_lamc11_que_usr.x=90 -tables.tl_lamc11_que_usr.y=90 -tables.tl_lamc11_session.x=10 -tables.tl_lamc11_session.y=10 -tables.tl_lamc11_usr_attempt.x=30 -tables.tl_lamc11_usr_attempt.y=30 Index: lams_tool_vote/db/model/lams_tool_vote.clay =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision 402985c35e80fbce6960c7d7598b0262292398eb) +++ lams_tool_vote/db/model/lams_tool_vote.clay (.../lams_tool_vote.clay) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -9,7 +9,7 @@ - + @@ -43,6 +43,12 @@ + + + + + + @@ -224,7 +230,7 @@
- + @@ -246,6 +252,19 @@ + + + + + + + + + + + + + @@ -276,60 +295,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -610,13 +575,6 @@ - - - - - - -
Index: lams_tool_vote/db/sql/create_lams_tool_vote.sql =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/db/sql/create_lams_tool_vote.sql (.../create_lams_tool_vote.sql) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -1,30 +1,8 @@ --- 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.0 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 --- USA --- --- http://www.gnu.org/licenses/gpl.txt --- **************************************************************** --- --- $Id$ - CREATE TABLE tl_vote11_content ( uid BIGINT(20) NOT NULL AUTO_INCREMENT , content_id BIGINT(20) NOT NULL , title TEXT NOT NULL + , posting TEXT , instructions TEXT NOT NULL , creation_date DATETIME , update_date DATETIME @@ -41,7 +19,6 @@ , content_in_use TINYINT(1) NOT NULL DEFAULT 0 , lock_on_finish TINYINT NOT NULL DEFAULT 0 , retries TINYINT(1) NOT NULL DEFAULT 0 - , show_feedback TINYINT(1) NOT NULL DEFAULT 0 , show_report TINYINT(1) NOT NULL DEFAULT 0 , UNIQUE UQ_tl_lamc11_content_1 (content_id) , PRIMARY KEY (uid) @@ -50,24 +27,14 @@ CREATE TABLE tl_vote11_que_content ( uid BIGINT(20) NOT NULL AUTO_INCREMENT , question VARCHAR(255) - , disabled TINYINT(1) NOT NULL DEFAULT 1 + , display_order INT(5) , vote_content_id BIGINT(20) NOT NULL , PRIMARY KEY (uid) , INDEX (vote_content_id) , CONSTRAINT FK_tl_vote_que_content_1 FOREIGN KEY (vote_content_id) REFERENCES tl_vote11_content (uid) )TYPE=InnoDB; -CREATE TABLE tl_vote11_options_content ( - uid BIGINT(20) NOT NULL AUTO_INCREMENT - , vote_que_content_id BIGINT(20) NOT NULL - , vote_que_option_text VARCHAR(250) - , PRIMARY KEY (uid) - , INDEX (vote_que_content_id) - , CONSTRAINT FK_tl_vote_options_content_1 FOREIGN KEY (vote_que_content_id) - REFERENCES tl_vote11_que_content (uid) -)TYPE=InnoDB; - CREATE TABLE tl_vote11_session ( uid BIGINT(20) NOT NULL AUTO_INCREMENT , vote_session_id BIGINT(20) NOT NULL @@ -112,9 +79,6 @@ , INDEX (vote_que_content_id) , CONSTRAINT FK_tl_vote_usr_attempt_4 FOREIGN KEY (vote_que_content_id) REFERENCES tl_vote11_que_content (uid) - , INDEX (vote_que_option_id) - , CONSTRAINT FK_tl_vote_usr_attempt_3 FOREIGN KEY (vote_que_option_id) - REFERENCES tl_vote11_options_content (uid) )TYPE=InnoDB; CREATE TABLE tl_vote11_uploadedfile ( @@ -129,9 +93,6 @@ REFERENCES tl_vote11_content (uid) )TYPE=InnoDB; +INSERT INTO tl_vote11_content(uid, content_id , title , instructions , posting, creation_date , questions_sequenced , username_visible , created_by , monitoring_report_title , report_title , run_offline , define_later, offline_instructions, online_instructions, end_learning_message, content_in_use, retries, show_report) VALUES (1, ${default_content_id} ,'Voting Title','Voting Instructions', 'sample posting', NOW(), 0, 0,1,'Voting Report','Report', 0, 0, 'offline instructions','online instructions','Finished Activity...', 0, 0, 0); -INSERT INTO tl_vote11_content(uid, content_id , title , instructions , creation_date , questions_sequenced , username_visible , created_by , monitoring_report_title , report_title , run_offline , define_later, offline_instructions, online_instructions, end_learning_message, content_in_use, retries, show_feedback, show_report) VALUES (1, ${default_content_id} ,'Voting Title','Voting Instructions', NOW(), 0, 0,1,'Voting Report','Report', 0, 0, 'offline instructions','online instructions','Finished Activity...', 0, 0, 0, 0); - -INSERT INTO tl_vote11_que_content (uid,question, disabled, vote_content_id) VALUES (1, 'sample posting', 0, 1); - -INSERT INTO tl_vote11_options_content (uid, vote_que_content_id, vote_que_option_text) VALUES (1, 1,'sample nomination'); \ No newline at end of file +INSERT INTO tl_vote11_que_content (uid,question, display_order, vote_content_id) VALUES (1, 'sample posting', 1, 1); \ No newline at end of file Index: lams_tool_vote/db/sql/drop_lams_tool_vote.sql =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/db/sql/drop_lams_tool_vote.sql (.../drop_lams_tool_vote.sql) (revision 402985c35e80fbce6960c7d7598b0262292398eb) +++ lams_tool_vote/db/sql/drop_lams_tool_vote.sql (.../drop_lams_tool_vote.sql) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -25,7 +25,6 @@ DROP TABLE tl_vote11_usr_attempt; DROP TABLE tl_vote11_que_usr; DROP TABLE tl_vote11_session; -DROP TABLE tl_vote11_options_content; DROP TABLE tl_vote11_que_content; DROP TABLE tl_vote11_content; SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java =================================================================== diff -u -r4355528fd4c5808b9b4d0eba2cbe68238560214e -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision 4355528fd4c5808b9b4d0eba2cbe68238560214e) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteAppConstants.java (.../VoteAppConstants.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -160,12 +160,15 @@ public static final String RICHTEXT_TITLE ="richTextTitle"; public static final String RICHTEXT_INSTRUCTIONS ="richTextInstructions"; public static final String RICHTEXT_BLANK ="

 

"; + public static final String RENDER_MONITORING_EDITACTIVITY ="renderMonitoringEditActivity"; public static final String SUBMIT_OFFLINE_FILE ="submitOfflineFile"; public static final String SUBMIT_ONLINE_FILE ="submitOnlineFile"; public static final String LIST_UPLOADED_OFFLINE_FILENAMES ="listUploadedOfflineFileNames"; public static final String LIST_UPLOADED_ONLINE_FILENAMES ="listUploadedOnlineFileNames"; public static final String LIST_OFFLINEFILES_METADATA ="listOfflineFilesMetadata"; public static final String LIST_ONLINEFILES_METADATA ="listOnlineFilesMetadata"; + public static final String ATTACHMENT_LIST ="attachmentList"; + public static final String DELETED_ATTACHMENT_LIST ="deletedAttachmentList"; public static final String COUNT_SESSION_COMPLETE ="countSessionComplete"; public static final String COUNT_ALL_USERS ="countAllUsers"; @@ -310,4 +313,5 @@ public static final String USER_EXCEPTION_FILENAME_EMPTY ="userExceptionFilenameEmpty"; public static final String USER_EXCEPTION_WEIGHT_MUST_EQUAL100 ="userExceptionWeightMustEqual100"; public static final String USER_EXCEPTION_SINGLE_OPTION ="userExceptionSingleOption"; + public static final String USER_EXCEPTION_OPTIONS_DUPLICATE ="userExceptionOptionsDuplicate"; } Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/VoteUtils.java (.../VoteUtils.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -512,30 +512,6 @@ } - /** - * sets/resets the define later flag of the content - * setDefineLater(HttpServletRequest request, boolean value) - * - * @param request - * @param value - */ - public static void setDefineLater(HttpServletRequest request, boolean value) - { - IVoteService mcService =VoteUtils.getToolService(request); - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); - logger.debug("toolContentId:" + toolContentId); - logger.debug("value:" + value); - - VoteContent mcContent=mcService.retrieveVote(toolContentId); - logger.debug("mcContent:" + mcContent); - if (mcContent != null) - { - mcContent.setDefineLater(value); - logger.debug("defineLater has been set to true"); - mcService.saveVoteContent(mcContent); - } - } - public static String getDestination(String sourceVoteStarter) { @@ -557,8 +533,25 @@ return LOAD_MONITORING_CONTENT_EDITACTIVITY; } } - + public static void setDefineLater(HttpServletRequest request, boolean value) + { + IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("voteService:" + voteService); + + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId:" + toolContentId); + + VoteContent voteContent=voteService.retrieveVote(toolContentId); + logger.debug("voteContent:" + voteContent); + if (voteContent != null) + { + voteContent.setDefineLater(value); + logger.debug("defineLater has been set to true"); + voteService.updateVote(voteContent); + } + } + /** * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID and CURRENT_MONITORED_TOOL_SESSION Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/IVoteQueContentDAO.java (.../IVoteQueContentDAO.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -43,6 +43,8 @@ public VoteQueContent getQuestionContentByQuestionText(final String question, final Long voteContentUid); + public List getVoteQueContentsByContentId(long qaContentId); + public void removeQuestionContentByVoteUid(final Long voteContentUid); public void resetAllQuestions(final Long voteContentUid); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/dao/hibernate/VoteQueContentDAO.java (.../VoteQueContentDAO.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -46,7 +46,7 @@ private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from voteQueContent in class VoteQueContent where voteQueContent.question=:question and voteQueContent.voteContentId=:voteContentUid"; - + public VoteQueContent getVoteQueContentByUID(Long uid) { return (VoteQueContent) this.getHibernateTemplate() @@ -69,6 +69,10 @@ } + public List getVoteQueContentsByContentId(long voteContentId){ + return getHibernateTemplate().findByNamedParam(LOAD_QUESTION_CONTENT_BY_CONTENT_ID, "voteContentId", new Long(voteContentId)); + } + public List getAllQuestionEntries(final long voteContentId) { HibernateTemplate templ = this.getHibernateTemplate(); Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/IVoteService.java (.../IVoteService.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -42,6 +42,7 @@ import org.lamsfoundation.lams.tool.vote.pojos.VoteSession; import org.lamsfoundation.lams.tool.vote.pojos.VoteUsrAttempt; import org.lamsfoundation.lams.usermanagement.User; +import org.springframework.dao.DataAccessException; /** @@ -71,8 +72,12 @@ public void updateVoteUsrAttempt(VoteUsrAttempt mcUsrAttempt) throws VoteApplicationException; - public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long mcQueContentId) throws VoteApplicationException; + public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException; + public List getAttemptsForUserAndQuestionContent(final Long queUsrId, final Long mcQueContentId) throws VoteApplicationException; + + public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException; + public VoteQueContent retrieveVoteQueContentByUID(Long uid) throws VoteApplicationException; public void removeVoteQueContent(VoteQueContent mcQueContent) throws VoteApplicationException; Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java =================================================================== diff -u -r1c7c157a72edb59e9bbd8b7300d0b31eb52df88d -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision 1c7c157a72edb59e9bbd8b7300d0b31eb52df88d) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/service/VoteServicePOJO.java (.../VoteServicePOJO.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -176,6 +176,20 @@ } } + public List retrieveVoteQueContentsByToolContentId(long qaContentId) throws VoteApplicationException + { + try + { + return voteQueContentDAO.getVoteQueContentsByContentId(qaContentId); + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is loading vote que usr: " + + e.getMessage(), + e); + } + } + public void createVoteQue(VoteQueContent voteQueContent) throws VoteApplicationException { try @@ -444,8 +458,23 @@ e); } } - + public void updateVoteQueContent(VoteQueContent voteQueContent) throws VoteApplicationException + { + try + { + voteQueContentDAO.updateVoteQueContent(voteQueContent); + + } + catch (DataAccessException e) + { + throw new VoteApplicationException("Exception occured when lams is updating vote content by question: " + + e.getMessage(), + e); + } + + } + public void cleanAllQuestionsSimple(final Long voteContentId) throws VoteApplicationException { try Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision 402985c35e80fbce6960c7d7598b0262292398eb) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/voteApplicationContext.xml (.../voteApplicationContext.xml) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -19,7 +19,6 @@ /org/lamsfoundation/lams/tool/vote/VoteContent.hbm.xml /org/lamsfoundation/lams/tool/vote/VoteQueContent.hbm.xml - /org/lamsfoundation/lams/tool/vote/VoteOptsContent.hbm.xml /org/lamsfoundation/lams/tool/vote/VoteSession.hbm.xml /org/lamsfoundation/lams/tool/vote/VoteQueUsr.hbm.xml /org/lamsfoundation/lams/tool/vote/VoteUsrAttempt.hbm.xml @@ -50,16 +49,10 @@ - - - - - - @@ -79,7 +72,6 @@ - Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java =================================================================== diff -u -r4355528fd4c5808b9b4d0eba2cbe68238560214e -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 4355528fd4c5808b9b4d0eba2cbe68238560214e) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -49,6 +49,7 @@ import org.lamsfoundation.lams.tool.vote.VoteComparator; 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.usermanagement.dto.UserDTO; @@ -1065,7 +1066,314 @@ } } + protected void reconstructOptionsContentMapForSubmit(Map mapOptionsContent, HttpServletRequest request) + { + logger.debug("pre-submit Map:" + mapOptionsContent); + logger.debug("pre-submit Map size :" + mapOptionsContent.size()); + + repopulateMap(mapOptionsContent, request); + Map mapFinalOptionsContent = new TreeMap(new VoteComparator()); + + Iterator itMap = mapOptionsContent.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) + { + mapFinalOptionsContent.put(pairs.getKey(), pairs.getValue()); + logger.debug("adding the pair: " + pairs.getKey() + " = " + pairs.getValue()); + } + } + + mapOptionsContent=(TreeMap)mapFinalOptionsContent; + request.getSession().setAttribute("mapOptionsContent", mapOptionsContent); + logger.debug("final mapOptionsContent:" + mapOptionsContent); + } + + public void removeRedundantOptions (Map mapOptionsContent, IVoteService voteService, VoteAuthoringForm voteAuthoringForm, HttpServletRequest request) + { + logger.debug("removing unused entries... "); + logger.debug("mapOptionsContent: " + mapOptionsContent); + + String toolContentId=voteAuthoringForm.getToolContentId(); + logger.debug("toolContentId: " + toolContentId); + if ((toolContentId == null) || toolContentId.equals("")) + { + logger.debug("getting toolContentId from session."); + Long longToolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); + toolContentId=longToolContentId.toString(); + logger.debug("toolContentId: " + toolContentId); + } + logger.debug("final toolContentId: " + toolContentId); + + + VoteContent voteContent=voteService.retrieveVote(new Long(toolContentId)); + logger.debug("voteContent: " + voteContent); + + if (voteContent != null) + { + logger.debug("voteContent uid: " + voteContent.getUid()); + List allQuestions=voteService.getAllQuestionEntries(voteContent.getUid()); + logger.debug("allQuestions: " + allQuestions); + + Iterator listIterator=allQuestions.iterator(); + Long mapIndex=new Long(1); + boolean entryUsed=false; + while (listIterator.hasNext()) + { + VoteQueContent queContent=(VoteQueContent)listIterator.next(); + logger.debug("queContent data: " + queContent); + + entryUsed=false; + Iterator itMap = mapOptionsContent.entrySet().iterator(); + while (itMap.hasNext()) + { + 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()); + if (pairs.getValue().toString().equals(queContent.getQuestion())) + { + logger.debug("used entry in db:" + queContent.getQuestion()); + 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 mapOptionsContent, IVoteService voteService, VoteAuthoringForm voteAuthoringForm, HttpServletRequest request) + { + UserDTO toolUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + + boolean isQuestionsSequenced=false; + boolean isUsernameVisible=false; + String reportTitle = voteAuthoringForm.getReportTitle(); + //String richTextTitle = voteAuthoringForm.getTitle(); + + String richTextTitle = request.getParameter("title"); + String richTextInstructions = request.getParameter("instructions"); + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + String richTextPosting = request.getParameter("posting"); + logger.debug("richTextPosting: " + richTextPosting); + + String monitoringReportTitle = voteAuthoringForm.getMonitoringReportTitle(); + logger.debug("monitoringReportTitle: " + monitoringReportTitle); + + String richTextOnlineInstructions = voteAuthoringForm.getOnlineInstructions(); + logger.debug("richTextOnlineInstructions: " + richTextOnlineInstructions); + + //String richTextInstructions = voteAuthoringForm.getInstructions(); + String richTextOfflineInstructions = voteAuthoringForm.getOfflineInstructions(); + logger.debug("richTextOfflineInstructions: " + richTextOfflineInstructions); + + String endLearningMessage = voteAuthoringForm.getEndLearningMessage(); + logger.debug("endLearningMessage: " + endLearningMessage); + + String questionsSequenced = voteAuthoringForm.getQuestionsSequenced(); + logger.debug("questionsSequenced: " + questionsSequenced); + + String usernameVisible = voteAuthoringForm.getUsernameVisible(); + logger.debug("usernameVisible: " + usernameVisible); + + boolean setCommonContent=true; + if ((questionsSequenced == null) || (usernameVisible == null)) + { + setCommonContent=false; + } + logger.debug("setCommonContent: " + setCommonContent); + + String activeModule=(String)request.getSession().getAttribute(ACTIVE_MODULE); + logger.debug("activeModule: " + activeModule); + + boolean questionsSequencedBoolean=false; + boolean synchInMonitorBoolean=false; + boolean usernameVisibleBoolean=false; + if (setCommonContent) + { + if (questionsSequenced.equalsIgnoreCase(ON)) + questionsSequencedBoolean=true; + + if (usernameVisible.equalsIgnoreCase(ON)) + usernameVisibleBoolean=true; + } + + + 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); + + + Long toolContentIdLong =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentIdLong: " + toolContentIdLong); + + //String toolContentId=voteAuthoringForm.getToolContentId(); + String toolContentId=toolContentIdLong.toString(); + logger.debug("toolContentId: " + toolContentId); + + VoteContent voteContent=voteService.retrieveVote(new Long(toolContentId)); + 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(toolContentId)); + voteContent.setTitle(richTextTitle); + voteContent.setInstructions(richTextInstructions); + voteContent.setPosting(richTextPosting); + 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..."); + + + if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent)) + { + logger.debug("setting other content values..."); + voteContent.setUsernameVisible(isUsernameVisible); + voteContent.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/ + voteContent.setOnlineInstructions(richTextOnlineInstructions); + voteContent.setOfflineInstructions(richTextOfflineInstructions); + voteContent.setEndLearningMessage(endLearningMessage); + voteContent.setReportTitle(reportTitle); + voteContent.setMonitoringReportTitle(monitoringReportTitle); + voteContent.setUsernameVisible(usernameVisibleBoolean); + voteContent.setQuestionsSequenced(questionsSequencedBoolean); + + } + + + + if (newContent) + { + logger.debug("will create: " + voteContent); + voteService.createVote(voteContent); + } + else + { + logger.debug("will update: " + voteContent); + voteService.updateVote(voteContent); + } + + voteContent=voteService.retrieveVote(new Long(toolContentId)); + logger.debug("voteContent: " + voteContent); + + voteContent=createOptiosContent(mapOptionsContent, voteService, voteContent); + + return voteContent; + } + + protected VoteContent createOptiosContent(Map mapOptionsContent, IVoteService voteService, VoteContent voteContent) + { + logger.debug("content uid is: " + voteContent.getUid()); + List questions=voteService.retrieveVoteQueContentsByToolContentId(voteContent.getUid().longValue()); + logger.debug("questions: " + questions); + + + Iterator itMap = mapOptionsContent.entrySet().iterator(); + int diplayOrder=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); + logger.debug("starting createQuestionContent: diplayOrder: " + diplayOrder); + diplayOrder=new Integer(pairs.getKey().toString()).intValue(); + logger.debug("int diplayOrder: " + diplayOrder); + + + VoteQueContent queContent= new VoteQueContent(pairs.getValue().toString(), + diplayOrder, + voteContent, + null, + null); + + + /* 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: " + diplayOrder); + + VoteQueContent existingVoteQueContent=voteService.getQuestionContentByQuestionText(pairs.getValue().toString(), 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); + if (duplicateVoteQueContent == null) + { + logger.debug("adding a new question to content: " + queContent); + voteContent.getVoteQueContents().add(queContent); + queContent.setVoteContent(voteContent); + + voteService.createVoteQue(queContent); + } + } + else + { + existingVoteQueContent.setQuestion(pairs.getValue().toString()); + existingVoteQueContent.setDisplayOrder(diplayOrder); + logger.debug("updating the existing question content: " + existingVoteQueContent); + voteService.updateVoteQueContent(existingVoteQueContent); + } + } + } + return voteContent; + } + /** * cleans up authoring http session * cleanupAuthoringSession(HttpServletRequest request) Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java =================================================================== diff -u -raa602e148cfb13b61541a8c3ebc7676eda85bc77 -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision aa602e148cfb13b61541a8c3ebc7676eda85bc77) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteAction.java (.../VoteAction.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -22,7 +22,9 @@ package org.lamsfoundation.lams.tool.vote.web; import java.io.IOException; +import java.util.List; import java.util.Map; +import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -37,9 +39,13 @@ import org.apache.struts.action.ActionMessages; 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.VoteUtils; +import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; import org.lamsfoundation.lams.tool.vote.service.IVoteService; +import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.lamsfoundation.lams.web.util.AttributeNames; /** * * @author Ozgur Demirtas @@ -121,7 +127,7 @@ public ActionForward addNewOption(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - logger.debug("dispathcing addNewQuestion"); + logger.debug("dispathcing addNewOption"); request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); AuthoringUtil authoringUtil= new AuthoringUtil(); @@ -164,7 +170,7 @@ public ActionForward removeOption(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - logger.debug("doing removeQuestion "); + logger.debug("doing removeOption "); request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); String richTextTitle = request.getParameter("title"); @@ -206,8 +212,170 @@ return (mapping.findForward(LOAD_QUESTIONS)); } + + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + logger.debug("starting submitAllContent :" +form); + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); + VoteAuthoringForm voteAuthoringForm = (VoteAuthoringForm) form; + logger.debug("voteAuthoringForm :" +voteAuthoringForm); + + IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); + if (voteService == null) + voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("voteService :" +voteService); + + + AuthoringUtil authoringUtil= new AuthoringUtil(); + Map mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT); + logger.debug("mapOptionsContent :" +mapOptionsContent); + + if (mapOptionsContent == null) + mapOptionsContent= new TreeMap(new VoteComparator()); + logger.debug("mapOptionsContent :" +mapOptionsContent); + + ActionMessages errors= new ActionMessages(); + /* full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity */ + errors=validateSubmit(request, errors, voteAuthoringForm); + + if (errors.size() > 0) + { + logger.debug("returning back to from to fix errors:"); + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + List attachmentList = (List) request.getSession().getAttribute(ATTACHMENT_LIST); + List deletedAttachmentList = (List) request.getSession().getAttribute(DELETED_ATTACHMENT_LIST); + + authoringUtil.reconstructOptionsContentMapForSubmit(mapOptionsContent, request); + logger.debug("before saveOrUpdateVoteContent."); + + boolean verifyDuplicatesOptionsMap=AuthoringUtil.verifyDuplicatesOptionsMap(mapOptionsContent); + logger.debug("verifyDuplicatesOptionsMap: " + verifyDuplicatesOptionsMap); + request.getSession().removeAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE); + if (verifyDuplicatesOptionsMap == false) + { + errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY,new ActionMessage("error.options.duplicate")); + request.getSession().setAttribute(USER_EXCEPTION_OPTIONS_DUPLICATE, new Boolean(true).toString()); + logger.debug("add error.options.duplicate to ActionMessages"); + saveErrors(request,errors); + voteAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + logger.debug("submitting mapOptionsContent:" + mapOptionsContent); + + /*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 voteContent=authoringUtil.saveOrUpdateVoteContent(mapOptionsContent, voteService, voteAuthoringForm, request); + logger.debug("voteContent: " + voteContent); + + String richTextTitle = request.getParameter("title"); + String richTextInstructions = request.getParameter("instructions"); + String richTextPosting = request.getParameter("posting"); + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + logger.debug("richTextPosting: " + richTextPosting); + + if (richTextTitle != null) + { + request.getSession().setAttribute(ACTIVITY_TITLE, richTextTitle); + } + + if (richTextInstructions != null) + { + request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, richTextInstructions); + } + + if (richTextPosting != null) + { + request.getSession().setAttribute(POSTING, richTextPosting); + } + + //List attacments=saveAttachments(voteContent, attachmentList, deletedAttachmentList, mapping, request); + //logger.debug("attacments: " + attacments); + + + errors.clear(); + errors.add(Globals.ERROR_KEY, new ActionMessage("sbmt.successful")); + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(1)); + logger.debug("setting SUBMIT_SUCCESS to 1."); + + Long strToolContentId=(Long)request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); + logger.debug("strToolContentId: " + strToolContentId); + VoteUtils.setDefineLater(request, false); + + saveErrors(request,errors); + + VoteUtils.setDefineLater(request, false); + logger.debug("define later set to false"); + + voteAuthoringForm.resetUserAction(); + return mapping.findForward(LOAD_QUESTIONS); + } + + + + protected ActionMessages validateSubmit(HttpServletRequest request, ActionMessages errors, VoteAuthoringForm voteAuthoringForm) + { + request.getSession().setAttribute(SUBMIT_SUCCESS, new Integer(0)); + String title = voteAuthoringForm.getTitle(); + logger.debug("title: " + title); + + String instructions = voteAuthoringForm.getInstructions(); + logger.debug("instructions: " + instructions); + + if ((title == null) || (title.trim().length() == 0) || title.equalsIgnoreCase(RICHTEXT_BLANK)) + { + errors.add(Globals.ERROR_KEY,new ActionMessage("error.title")); + logger.debug("add title to ActionMessages"); + } + + if ((instructions == null) || (instructions.trim().length() == 0) || instructions.equalsIgnoreCase(RICHTEXT_BLANK)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.instructions")); + logger.debug("add instructions to ActionMessages: "); + } + + /* + * enforce that the first (default) question entry is not empty + */ + String defaultOptionEntry =request.getParameter("optionContent0"); + if ((defaultOptionEntry == null) || (defaultOptionEntry.length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.defaultoption.empt")); + logger.debug("add error.defaultoption.empt to ActionMessages: "); + } + + Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY); + if ((renderMonitoringEditActivity != null) && (!renderMonitoringEditActivity.booleanValue())) + { + + if ((voteAuthoringForm.getReportTitle() == null) || (voteAuthoringForm.getReportTitle().length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.reportTitle")); + logger.debug("add reportTitle to ActionMessages: "); + } + if ((voteAuthoringForm.getMonitoringReportTitle() == null) || (voteAuthoringForm.getMonitoringReportTitle().length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.monitorReportTitle")); + logger.debug("add monitorReportTitle to ActionMessages: "); + } + } + + saveErrors(request,errors); + return errors; + } + + + /** * persists error messages to request scope * @param request Index: lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java =================================================================== diff -u -raa602e148cfb13b61541a8c3ebc7676eda85bc77 -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision aa602e148cfb13b61541a8c3ebc7676eda85bc77) +++ lams_tool_vote/src/java/org/lamsfoundation/lams/tool/vote/web/VoteStarterAction.java (.../VoteStarterAction.java) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -75,7 +75,6 @@ import java.io.IOException; import java.util.Iterator; import java.util.LinkedList; -import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -97,7 +96,6 @@ import org.lamsfoundation.lams.tool.vote.VoteComparator; import org.lamsfoundation.lams.tool.vote.VoteUtils; import org.lamsfoundation.lams.tool.vote.pojos.VoteContent; -import org.lamsfoundation.lams.tool.vote.pojos.VoteOptsContent; import org.lamsfoundation.lams.tool.vote.pojos.VoteQueContent; import org.lamsfoundation.lams.tool.vote.service.IVoteService; import org.lamsfoundation.lams.tool.vote.service.VoteServiceProxy; @@ -322,8 +320,8 @@ * there is no need to check if the content is in use in this case. * It is always unlocked -> not in use since it is the default content. */ - Map mapQuestionContent= new TreeMap(new VoteComparator()); - logger.debug("mapQuestionContent: " + mapQuestionContent); + Map mapOptionsContent= new TreeMap(new VoteComparator()); + logger.debug("mapOptionsContent: " + mapOptionsContent); if (!existsContent(toolContentId, request)) { @@ -332,7 +330,7 @@ String defaultContentIdStr=(String) request.getSession().getAttribute(DEFAULT_CONTENT_ID_STR); logger.debug("defaultContentIdStr:" + defaultContentIdStr); logger.debug("will get content for defaultContentIdStr:" + defaultContentIdStr); - retrieveContent(request, mapping, voteAuthoringForm, mapQuestionContent, new Long(defaultContentIdStr).longValue()); + retrieveContent(request, mapping, voteAuthoringForm, mapOptionsContent, new Long(defaultContentIdStr).longValue()); } else { @@ -350,7 +348,7 @@ return (mapping.findForward(ERROR_LIST)); } logger.debug("will get content for strToolContentId:" + strToolContentId); - retrieveContent(request, mapping, voteAuthoringForm, mapQuestionContent, new Long(strToolContentId).longValue()); + retrieveContent(request, mapping, voteAuthoringForm, mapOptionsContent, new Long(strToolContentId).longValue()); } } @@ -398,126 +396,85 @@ */ public ActionForward readSignature(HttpServletRequest request, ActionMapping mapping) { - IVoteService voteService =VoteUtils.getToolService(request); - /* retrieve the default content id based on tool signature */ - long contentId=0; + IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("voteService: " + voteService); + if (voteService == null) + { + logger.debug("will retrieve voteService"); + voteService = VoteServiceProxy.getVoteService(getServlet().getServletContext()); + logger.debug("retrieving voteService from session: " + voteService); + } + request.getSession().setAttribute(TOOL_SERVICE, voteService); + /* + * retrieve the default content id based on tool signature + */ + long defaultContentID=0; try { - logger.debug("attempt retrieving tool with signature : " + MY_SIGNATURE); - contentId=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); - logger.debug("retrieved tool default contentId: " + contentId); - if (contentId == 0) + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + defaultContentID=voteService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + defaultContentID); + if (defaultContentID == 0) { VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); + logger.debug("default content id has not been setup"); + persistError(request,"error.defaultContent.notSetup"); + request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); + return (mapping.findForward(ERROR_LIST)); } } catch(Exception e) { VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); + logger.debug("error getting the default content id: " + e.getMessage()); + persistError(request,"error.defaultContent.notSetup"); + request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); + logger.debug("forwarding to: " + ERROR_LIST); return (mapping.findForward(ERROR_LIST)); } + /* retrieve uid of the content based on default content id determined above */ long contentUID=0; try { - logger.debug("retrieve uid of the content based on default content id determined above: " + contentId); - VoteContent voteContent=voteService.retrieveVote(new Long(contentId)); + logger.debug("retrieve uid of the content based on default content id determined above: " + defaultContentID); + VoteContent voteContent=voteService.retrieveVote(new Long(defaultContentID)); if (voteContent == null) { VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); + logger.debug("Exception occured: No default content"); persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); + request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); + return (mapping.findForward(ERROR_LIST)); } logger.debug("using voteContent: " + voteContent); - logger.debug("using voteContent uid: " + voteContent.getUid()); + logger.debug("using mcContent uid: " + voteContent.getUid()); contentUID=voteContent.getUid().longValue(); + logger.debug("contentUID: " + contentUID); } catch(Exception e) { VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); + logger.debug("Exception occured: No default question content"); + persistError(request,"error.defaultContent.notSetup"); request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); + logger.debug("forwarding to: " + ERROR_LIST); return (mapping.findForward(ERROR_LIST)); } - - - /* retrieve uid of the default question content */ - long queContentUID=0; - try - { - logger.debug("retrieve the default question content based on default content UID: " + queContentUID); - VoteQueContent voteQueContent=voteService.getToolDefaultQuestionContent(contentUID); - logger.debug("using voteQueContent: " + voteQueContent); - if (voteQueContent == null) - { - VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); - } - logger.debug("using voteQueContent uid: " + voteQueContent.getUid()); - queContentUID=voteQueContent.getUid().longValue(); - request.getSession().setAttribute(DEFAULT_QUESTION_UID, new Long(queContentUID)); - logger.debug("DEFAULT_QUESTION_UID: " + queContentUID); - } - catch(Exception e) - { - VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); - } - - - /* retrieve default options content */ - try - { - logger.debug("retrieve the default options content based on default question content UID: " + queContentUID); - List list=voteService.findVoteOptionsContentByQueId(new Long(queContentUID)); - logger.debug("using options list: " + list); - if (list == null) - { - VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); - } - - } - catch(Exception e) - { - VoteUtils.cleanUpSessionAbsolute(request); - logger.debug("Exception occured: No default options content"); - request.getSession().setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true).toString()); - persistError(request,"error.defaultContent.notSetup"); - return (mapping.findForward(ERROR_LIST)); - } - - logger.debug("Voting tool has the default content id: " + contentId); - request.getSession().setAttribute(DEFAULT_CONTENT_ID, new Long(contentId).toString()); - request.getSession().setAttribute(DEFAULT_CONTENT_ID_STR, new Long(contentId).toString()); + + logger.debug("Voting tool has the default content id: " + defaultContentID); + request.getSession().setAttribute(DEFAULT_CONTENT_ID_STR, new Long(defaultContentID).toString()); + request.getSession().setAttribute(DEFAULT_CONTENT_ID, new Long(defaultContentID).toString()); return null; + } - protected void retrieveContent(HttpServletRequest request, ActionMapping mapping, VoteAuthoringForm voteAuthoringForm, Map mapQuestionContent, long toolContentId) + protected void retrieveContent(HttpServletRequest request, ActionMapping mapping, VoteAuthoringForm voteAuthoringForm, Map mapOptionsContent, long toolContentId) { - logger.debug("starting retrieveExistingContent for toolContentId: " + toolContentId); + logger.debug("starting retrieve content for toolContentId: " + toolContentId); IVoteService voteService = (IVoteService)request.getSession().getAttribute(TOOL_SERVICE); logger.debug("voteService: " + voteService); @@ -545,11 +502,13 @@ { request.getSession().setAttribute(ACTIVITY_TITLE, "Questions and Answers"); request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, "Please answer the questions."); + request.getSession().setAttribute(POSTING, "sample posting"); } else { request.getSession().setAttribute(ACTIVITY_TITLE, voteContent.getTitle()); - request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, voteContent.getInstructions()); + request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS, voteContent.getInstructions()); + request.getSession().setAttribute(POSTING, voteContent.getPosting()); } @@ -573,74 +532,40 @@ /* - * get the posting content + * get the nominations */ logger.debug("setting existing content data from the db"); - mapQuestionContent.clear(); + mapOptionsContent.clear(); Iterator queIterator=voteContent.getVoteQueContents().iterator(); Long mapIndex=new Long(1); - logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapOptionsContent: " + mapOptionsContent); while (queIterator.hasNext()) { VoteQueContent voteQueContent=(VoteQueContent) queIterator.next(); if (voteQueContent != null) { logger.debug("question: " + voteQueContent.getQuestion()); - mapQuestionContent.put(mapIndex.toString(),voteQueContent.getQuestion()); + mapOptionsContent.put(mapIndex.toString(),voteQueContent.getQuestion()); /** * make the first entry the default(first) one for jsp */ if (mapIndex.longValue() == 1) { request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, voteQueContent.getQuestion()); - request.getSession().setAttribute(POSTING, voteQueContent.getQuestion()); } mapIndex=new Long(mapIndex.longValue()+1); } } - logger.debug("Map initialized with existing contentid to: " + mapQuestionContent); - request.getSession().setAttribute(MAP_QUESTION_CONTENT, mapQuestionContent); - logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute("mapQuestionContent") ); - - - /* collect options for the default question content into a Map*/ - VoteQueContent voteQueContent=voteService.getToolDefaultQuestionContent(voteContent.getUid().longValue()); - logger.debug("voteQueContent:" + voteQueContent); - - /* hold all he options for this question*/ - List list=voteService.findVoteOptionsContentByQueId(voteQueContent.getUid()); - logger.debug("options list:" + list); - - Map mapOptionsContent= new TreeMap(new VoteComparator()); - Iterator listIterator=list.iterator(); - Long mapOptsIndex=new Long(1); - while (listIterator.hasNext()) - { - VoteOptsContent voteOptsContent=(VoteOptsContent)listIterator.next(); - logger.debug("option text:" + voteOptsContent.getVoteQueOptionText()); - mapOptionsContent.put(mapOptsIndex.toString(),voteOptsContent.getVoteQueOptionText()); - - if (mapOptsIndex.longValue() == 1) - request.getSession().setAttribute(DEFAULT_OPTION_CONTENT, voteOptsContent.getVoteQueOptionText()); - - mapIndex=new Long(mapOptsIndex.longValue()+1); - } - - logger.debug("DEFAULT_QUESTION_CONTENT: " + request.getSession().getAttribute(DEFAULT_QUESTION_CONTENT)); - logger.debug("DEFAULT_OPTION_CONTENT: " + request.getSession().getAttribute(DEFAULT_OPTION_CONTENT)); + logger.debug("Map initialized with existing contentid to: " + mapOptionsContent); request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); - Map mapDefaultOptionsContent=mapOptionsContent; - request.getSession().setAttribute(MAP_DEFAULTOPTIONS_CONTENT, mapDefaultOptionsContent); - logger.debug("starter initialized the Options Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT)); - logger.debug("starter initialized the Default Options Map: " + request.getSession().getAttribute(MAP_DEFAULTOPTIONS_CONTENT)); - - + logger.debug("starter initialized the Comparable Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT) ); + logger.debug("final title: " + voteAuthoringForm.getTitle()); logger.debug("final ins: " + voteAuthoringForm.getInstructions()); /* - * load questions page + * load nominations page */ voteAuthoringForm.resetUserAction(); } Index: lams_tool_vote/web/authoring/BasicContent.jsp =================================================================== diff -u -raa602e148cfb13b61541a8c3ebc7676eda85bc77 -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 --- lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision aa602e148cfb13b61541a8c3ebc7676eda85bc77) +++ lams_tool_vote/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision b9472d342c6b0edd1c3e0df5ff2b7179051bb389) @@ -36,7 +36,7 @@ - + images/success.gif" align="left" width=20 height=20> Index: lams_tool_vote/web/images/Thumbs.db =================================================================== diff -u -r402985c35e80fbce6960c7d7598b0262292398eb -rb9472d342c6b0edd1c3e0df5ff2b7179051bb389 Binary files differ