Index: lams_tool_lamc/JUnit/junit-3.7/lib/junit-3.7.jar =================================================================== diff -u Binary files differ Index: lams_tool_lamc/JUnit/junit.jar =================================================================== diff -u Binary files differ Index: lams_tool_lamc/build.properties =================================================================== diff -u --- lams_tool_lamc/build.properties (revision 0) +++ lams_tool_lamc/build.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,21 @@ +# properties for building the Lams mc Tool + +#name of this project +signature=lamc11 + +#mc files package definition +mc.package=org.lamsfoundation.lams.tool.mc +mc.path=org/lamsfoundation/lams/tool/mc + +#configuration files +conf.includes.dir=${basedir}/web/includes +conf.template.dir=${basedir}/web/template +conf.resources.dir=${conf.web.dir}/resources + +# Build directory +build.webinf.dir=${build.web}/WEB-INF/resources +build.web.includes=${build}/web/includes +build.web.template=${build}/web/template + +testweb=${basedir}/test/web +testwebinf=${testweb}/WEB-INF Index: lams_tool_lamc/build.xml =================================================================== diff -u --- lams_tool_lamc/build.xml (revision 0) +++ lams_tool_lamc/build.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,441 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You must download several jar files before you can build Middlegen. + Execute the "download-deps" target. Then try to build again. + + If you are behind a proxy, you should define the properties + http.proxyHost and http.proxyPort. Example: + + ant -Dhttp.proxyHost=foo.com -Dhttp.proxyPort=8080 + + It's also possible to download the jars manually. + + + + + + + + + The JDBC driver you have specified by including one of the files in ${basedir}/config/database + doesn't exist. You have to download this driver separately and put it in ${db.driver.jar} + Please make sure you're using a version that is equal or superior to the one we looked for. + If you name the driver jar file differently, please update the db.driver.jar property + in the ${basedir}/config/database/xxx.xml file accordingly. + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deploying the Question and Answer tool + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/conf/hibernate/mappings/QaContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaContent.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/hibernate/mappings/QaQueContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaQueContent.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaQueContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/hibernate/mappings/QaQueUsr.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaQueUsr.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaQueUsr.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/hibernate/mappings/QaSession.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaSession.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaSession.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/hibernate/mappings/QaUploadedFile.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaUploadedFile.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaUploadedFile.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/hibernate/mappings/QaUsrResp.hbm.xml =================================================================== diff -u --- lams_tool_lamc/conf/hibernate/mappings/QaUsrResp.hbm.xml (revision 0) +++ lams_tool_lamc/conf/hibernate/mappings/QaUsrResp.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/conf/jar/META-INF/MANIFEST.MF =================================================================== diff -u --- lams_tool_lamc/conf/jar/META-INF/MANIFEST.MF (revision 0) +++ lams_tool_lamc/conf/jar/META-INF/MANIFEST.MF (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3 @@ +Implementation-Title: LAMS QnA Tool +Implementation-Version: 0.1 +Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org) Index: lams_tool_lamc/conf/middlegen/lams_tool_qa-prefs.properties =================================================================== diff -u --- lams_tool_lamc/conf/middlegen/lams_tool_qa-prefs.properties (revision 0) +++ lams_tool_lamc/conf/middlegen/lams_tool_qa-prefs.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,110 @@ +# Middlegen Preferences +hibernate.tables.tl_lasbmt11_content.base-class-name=TlLasbmt11Content +hibernate.tables.tl_lasbmt11_content.columns.content_id.columnspecialty=key +hibernate.tables.tl_lasbmt11_content.columns.content_id.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.content_id.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.content_id.java-name=contentID +hibernate.tables.tl_lasbmt11_content.columns.content_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_content.columns.date_of_submission.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.date_of_submission.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.date_of_submission.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.date_of_submission.java-name=dateOfSubmission +hibernate.tables.tl_lasbmt11_content.columns.date_of_submission.java-type=java.sql.Timestamp +hibernate.tables.tl_lasbmt11_content.columns.fileDescription.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.fileDescription.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.fileDescription.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.fileDescription.java-name=fileDescription +hibernate.tables.tl_lasbmt11_content.columns.fileDescription.java-type=java.lang.String +hibernate.tables.tl_lasbmt11_content.columns.filePath.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.filePath.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.filePath.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.filePath.java-name=filePath +hibernate.tables.tl_lasbmt11_content.columns.filePath.java-type=java.lang.String +hibernate.tables.tl_lasbmt11_content.columns.instructions.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.instructions.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.instructions.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.instructions.java-name=instructions +hibernate.tables.tl_lasbmt11_content.columns.instructions.java-type=java.lang.String +hibernate.tables.tl_lasbmt11_content.columns.title.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.title.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.title.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.title.java-name=title +hibernate.tables.tl_lasbmt11_content.columns.title.java-type=java.lang.String +hibernate.tables.tl_lasbmt11_content.columns.uuid.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.uuid.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.uuid.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.uuid.java-name=uuid +hibernate.tables.tl_lasbmt11_content.columns.uuid.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_content.columns.version_id.columnspecialty=property +hibernate.tables.tl_lasbmt11_content.columns.version_id.incequals=true +hibernate.tables.tl_lasbmt11_content.columns.version_id.inctostring=true +hibernate.tables.tl_lasbmt11_content.columns.version_id.java-name=versionID +hibernate.tables.tl_lasbmt11_content.columns.version_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_content.equalshashcode=true +hibernate.tables.tl_lasbmt11_content.keygenerator=assigned +hibernate.tables.tl_lasbmt11_report.base-class-name=TlLasbmt11Report +hibernate.tables.tl_lasbmt11_report.columns.comments.columnspecialty=property +hibernate.tables.tl_lasbmt11_report.columns.comments.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.comments.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.comments.java-name=comments +hibernate.tables.tl_lasbmt11_report.columns.comments.java-type=java.lang.String +hibernate.tables.tl_lasbmt11_report.columns.content_id.columnspecialty=foreign key +hibernate.tables.tl_lasbmt11_report.columns.content_id.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.content_id.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.content_id.java-name=contentID +hibernate.tables.tl_lasbmt11_report.columns.content_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_report.columns.date_marks_released.columnspecialty=property +hibernate.tables.tl_lasbmt11_report.columns.date_marks_released.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.date_marks_released.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.date_marks_released.java-name=dateMarksReleased +hibernate.tables.tl_lasbmt11_report.columns.date_marks_released.java-type=java.sql.Timestamp +hibernate.tables.tl_lasbmt11_report.columns.marks.columnspecialty=property +hibernate.tables.tl_lasbmt11_report.columns.marks.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.marks.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.marks.java-name=marks +hibernate.tables.tl_lasbmt11_report.columns.marks.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_report.columns.report_id.columnspecialty=key +hibernate.tables.tl_lasbmt11_report.columns.report_id.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.report_id.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.report_id.java-name=reportID +hibernate.tables.tl_lasbmt11_report.columns.report_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_report.columns.user_id.columnspecialty=property +hibernate.tables.tl_lasbmt11_report.columns.user_id.incequals=true +hibernate.tables.tl_lasbmt11_report.columns.user_id.inctostring=true +hibernate.tables.tl_lasbmt11_report.columns.user_id.java-name=userID +hibernate.tables.tl_lasbmt11_report.columns.user_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_report.equalshashcode=true +hibernate.tables.tl_lasbmt11_report.keygenerator=assigned +hibernate.tables.tl_lasbmt11_session.base-class-name=TlLasbmt11Session +hibernate.tables.tl_lasbmt11_session.columns.content_id.columnspecialty=foreign key +hibernate.tables.tl_lasbmt11_session.columns.content_id.incequals=true +hibernate.tables.tl_lasbmt11_session.columns.content_id.inctostring=true +hibernate.tables.tl_lasbmt11_session.columns.content_id.java-name=contentID +hibernate.tables.tl_lasbmt11_session.columns.content_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_session.columns.session_id.columnspecialty=key +hibernate.tables.tl_lasbmt11_session.columns.session_id.incequals=true +hibernate.tables.tl_lasbmt11_session.columns.session_id.inctostring=true +hibernate.tables.tl_lasbmt11_session.columns.session_id.java-name=sessionID +hibernate.tables.tl_lasbmt11_session.columns.session_id.java-type=java.lang.Long +hibernate.tables.tl_lasbmt11_session.columns.session_id.updateable=true +hibernate.tables.tl_lasbmt11_session.columns.status.columnspecialty=property +hibernate.tables.tl_lasbmt11_session.columns.status.incequals=true +hibernate.tables.tl_lasbmt11_session.columns.status.inctostring=true +hibernate.tables.tl_lasbmt11_session.columns.status.java-name=status +hibernate.tables.tl_lasbmt11_session.columns.status.java-type=java.lang.Integer +hibernate.tables.tl_lasbmt11_session.equalshashcode=true +hibernate.tables.tl_lasbmt11_session.keygenerator=assigned +relations.tl_lasbmt11_content-tl_lasbmt11_report.tl_lasbmt11_content-has-tl_lasbmt11_report.enabled=true +relations.tl_lasbmt11_content-tl_lasbmt11_report.tl_lasbmt11_content-has-tl_lasbmt11_report.target-many=true +relations.tl_lasbmt11_content-tl_lasbmt11_report.tl_lasbmt11_report-has-tl_lasbmt11_content.enabled=true +relations.tl_lasbmt11_content-tl_lasbmt11_report.tl_lasbmt11_report-has-tl_lasbmt11_content.target-many=false +relations.tl_lasbmt11_content-tl_lasbmt11_session.tl_lasbmt11_content-has-tl_lasbmt11_session.enabled=true +relations.tl_lasbmt11_content-tl_lasbmt11_session.tl_lasbmt11_content-has-tl_lasbmt11_session.target-many=true +relations.tl_lasbmt11_content-tl_lasbmt11_session.tl_lasbmt11_session-has-tl_lasbmt11_content.enabled=true +relations.tl_lasbmt11_content-tl_lasbmt11_session.tl_lasbmt11_session-has-tl_lasbmt11_content.target-many=false +tables.tl_lasbmt11_content.x=339 +tables.tl_lasbmt11_content.y=166 +tables.tl_lasbmt11_report.x=596 +tables.tl_lasbmt11_report.y=8 +tables.tl_lasbmt11_session.x=49 +tables.tl_lasbmt11_session.y=49 Index: lams_tool_lamc/conf/war/META-INF/MANIFEST.MF =================================================================== diff -u --- lams_tool_lamc/conf/war/META-INF/MANIFEST.MF (revision 0) +++ lams_tool_lamc/conf/war/META-INF/MANIFEST.MF (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.5.3 +Created-By: 1.4.2_08-b03 (Sun Microsystems Inc.) +Class-Path: ./lams.jar ./lams-tool-laqa11.jar ./lams-contentrepository.jar ./lams-learning.jar + + Index: lams_tool_lamc/db/model/lams_tool_mc.clay =================================================================== diff -u --- lams_tool_lamc/db/model/lams_tool_mc.clay (revision 0) +++ lams_tool_lamc/db/model/lams_tool_mc.clay (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,561 @@ + + + +QA Tool for Lams 1.1 + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + Index: lams_tool_lamc/db/sql/activity_insert.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/activity_insert.sql (revision 0) +++ lams_tool_lamc/db/sql/activity_insert.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,80 @@ +# Connection: ROOT LOCAL +# Host: localhost +# Saved: 2005-04-07 11:08:32 +# +INSERT INTO lams_learning_activity +( +activity_ui_id +, description +, title +, help_text +, xcoord +, ycoord +, parent_activity_id +, parent_ui_id +, learning_activity_type_id +, grouping_support_type_id +, apply_grouping_flag +, grouping_id +, grouping_ui_id +, order_id +, define_later_flag +, learning_design_id +, learning_library_id +, create_date_time +, run_offline_flag +, max_number_of_options +, min_number_of_options +, options_instructions +, tool_id +, tool_content_id +, activity_category_id +, gate_activity_level_id +, gate_open_flag +, gate_start_time_offset +, gate_end_time_offset +, gate_start_date_time +, gate_end_date_time +, library_activity_ui_image +, create_grouping_id +, create_grouping_ui_id +, library_activity_id +) +VALUES +( +NULL +, 'Question and Answer Description' +, 'Question and Answer' +, 'Put some help text here.' +, NULL +, NULL +, NULL +, NULL +, 1 +, 1 +, 0 +, NULL +, NULL +, NULL +, 0 +, NULL +, ${learning_library_id} +, NOW() +, 0 +, NULL +, NULL +, NULL +, ${tool_id} +, NULL +, 4 +, NULL +, NULL +, NULL +, NULL +, NULL +, NULL +, '/tool/laqa11/images/icon_questionanswer.swf' +, NULL +, NULL +, NULL +) Index: lams_tool_lamc/db/sql/create_lams_tool_lamc.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (revision 0) +++ lams_tool_lamc/db/sql/create_lams_tool_lamc.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,99 @@ +CREATE TABLE tl_laqa11_content ( + qa_content_id BIGINT(20) NOT NULL + , title VARCHAR(250) NOT NULL DEFAULT 'Questions and Answers' + , instructions VARCHAR(250) NOT NULL DEFAULT 'Please, take a minute to answer the following questions.' + , creation_date VARCHAR(100) + , update_date DATETIME + , questions_sequenced TINYINT(1) NOT NULL + , username_visible TINYINT(1) NOT NULL DEFAULT 0 + , monitoring_report_title VARCHAR(100) DEFAULT 'Combined Learner Results' + , report_title VARCHAR(100) DEFAULT 'Report' + , created_by BIGINT(20) NOT NULL DEFAULT 0 + , run_offline TINYINT(1) DEFAULT 0 + , define_later TINYINT(1) NOT NULL DEFAULT 0 + , synch_in_monitor TINYINT(1) NOT NULL DEFAULT 0 + , offline_instructions VARCHAR(250) DEFAULT 'offline instructions' + , online_instructions VARCHAR(250) DEFAULT 'online instructions' + , end_learning_message VARCHAR(150) DEFAULT 'Thank you!' + , content_locked TINYINT(1) DEFAULT 0 + , PRIMARY KEY (qa_content_id) +)TYPE=InnoDB; + +CREATE TABLE tl_laqa11_session ( + qa_session_id BIGINT(20) NOT NULL + , session_start_date DATETIME + , session_end_date DATETIME + , session_status VARCHAR(100) + , qa_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (qa_session_id) + , INDEX (qa_content_id) + , CONSTRAINT FK_tl_laqa11_session_1 FOREIGN KEY (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) +)TYPE=InnoDB; + +CREATE TABLE tl_laqa11_que_usr ( + que_usr_id BIGINT(20) NOT NULL + , username VARCHAR(100) + , qa_session_id BIGINT(20) NOT NULL + , fullname VARCHAR(100) + , PRIMARY KEY (que_usr_id) + , INDEX (qa_session_id) + , CONSTRAINT FK_tl_laqa11_que_usr_2 FOREIGN KEY (qa_session_id) + REFERENCES lams.tl_laqa11_session (qa_session_id) +)TYPE=InnoDB; + +CREATE TABLE tl_laqa11_que_content ( + qa_que_content_id BIGINT(20) NOT NULL + , question VARCHAR(255) + , display_order INT(5) + , qa_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (qa_que_content_id) + , INDEX (qa_content_id) + , CONSTRAINT FK_tl_laqa11_que_content_1 FOREIGN KEY (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) +)TYPE=InnoDB; + +CREATE TABLE tl_laqa11_usr_resp ( + response_id BIGINT(20) NOT NULL + , hidden TINYINT(1) DEFAULT 0 + , answer VARCHAR(255) + , time_zone VARCHAR(255) + , attempt_time DATETIME + , que_usr_id BIGINT(20) NOT NULL + , qa_que_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (response_id) + , INDEX (qa_que_content_id) + , CONSTRAINT FK_tl_laqa11_usr_resp_2 FOREIGN KEY (qa_que_content_id) + REFERENCES lams.tl_laqa11_que_content (qa_que_content_id) + , INDEX (que_usr_id) + , CONSTRAINT FK_tl_laqa11_usr_resp_3 FOREIGN KEY (que_usr_id) + REFERENCES lams.tl_laqa11_que_usr (que_usr_id) +)TYPE=InnoDB; + +CREATE TABLE tl_laqa11_uploadedFile ( + submissionId BIGINT(20) NOT NULL AUTO_INCREMENT + , uuid VARCHAR(255) NOT NULL + , isOnline_File TINYINT(1) NOT NULL + , filename VARCHAR(255) NOT NULL + , qa_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (submissionId) + , INDEX (qa_content_id) + , CONSTRAINT FK_tl_laqa11_que_content_1_1 FOREIGN KEY (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) +)TYPE=InnoDB; + + + +-- data for content table +INSERT INTO tl_laqa11_content (qa_content_id, + creation_date + ) +VALUES (${default_content_id}, + NOW()); + + +-- data for content questions table +INSERT INTO tl_laqa11_que_content (question, + display_order, + qa_content_id) VALUES ('What is the capital of Russia?',1,${default_content_id}); + Index: lams_tool_lamc/db/sql/drop_lams_tool_lamc.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/drop_lams_tool_lamc.sql (revision 0) +++ lams_tool_lamc/db/sql/drop_lams_tool_lamc.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,7 @@ + +DROP TABLE IF EXISTS tl_laqa11_usr_resp; +DROP TABLE IF EXISTS tl_laqa11_que_usr; +DROP TABLE IF EXISTS tl_laqa11_que_content; +DROP TABLE IF EXISTS tl_laqa11_session; +DROP TABLE IF EXISTS tl_laqa11_uploadedFile; +DROP TABLE IF EXISTS tl_laqa11_content; Index: lams_tool_lamc/db/sql/insert_tool_lamc_data.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/insert_tool_lamc_data.sql (revision 0) +++ lams_tool_lamc/db/sql/insert_tool_lamc_data.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,20 @@ + +-- test data for content table +-- test data for content table +INSERT INTO tl_laqa11_content (qa_content_id, + creation_date + ) +VALUES (10, + NOW()); + + + +-- test data for content questions table +INSERT INTO tl_laqa11_que_content (qa_que_content_id, + question, + display_order, + qa_content_id) VALUES (20,'What is the name of this activity?',1,10); + + + + Index: lams_tool_lamc/db/sql/library_insert.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/library_insert.sql (revision 0) +++ lams_tool_lamc/db/sql/library_insert.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,18 @@ +# Connection: ROOT LOCAL +# Host: localhost +# Saved: 2005-04-07 10:50:55 +# +INSERT INTO lams_learning_library +( +description, +title, +valid_flag, +create_date_time +) +VALUES +( +'Question and Answer Learning Library Description', +'Question and Answer', +0, +NOW() +) Index: lams_tool_lamc/db/sql/tl_laqa11_uploadedFile.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/tl_laqa11_uploadedFile.sql (revision 0) +++ lams_tool_lamc/db/sql/tl_laqa11_uploadedFile.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,12 @@ +CREATE TABLE lams.tl_laqa11_uploadedFile ( + submissionId BIGINT(20) NOT NULL AUTO_INCREMENT + , uuid VARCHAR(255) NOT NULL + , isOnline_File TINYINT(1) NOT NULL + , filename VARCHAR(255) NOT NULL + , qa_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (submissionId) + , INDEX (qa_content_id) + , CONSTRAINT FK_tl_laqa11_que_content_1_1 FOREIGN KEY (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) +)TYPE=InnoDB; + Index: lams_tool_lamc/db/sql/tl_laqa11_uploadedFiles.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/tl_laqa11_uploadedFiles.sql (revision 0) +++ lams_tool_lamc/db/sql/tl_laqa11_uploadedFiles.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,12 @@ +CREATE TABLE lams.tl_laqa11_uploadedFiles ( + submissionId BIGINT(20) NOT NULL AUTO_INCREMENT + , uuid VARCHAR(255) NOT NULL + , isOnline_File TINYINT(5) NOT NULL + , filename VARCHAR(20) NOT NULL + , qa_content_id BIGINT(20) NOT NULL + , PRIMARY KEY (submissionId) + , INDEX (qa_content_id) + , CONSTRAINT FK_tl_laqa11_que_content_1_1 FOREIGN KEY (qa_content_id) + REFERENCES lams.tl_laqa11_content (qa_content_id) +)TYPE=InnoDB; + Index: lams_tool_lamc/db/sql/tool_insert.sql =================================================================== diff -u --- lams_tool_lamc/db/sql/tool_insert.sql (revision 0) +++ lams_tool_lamc/db/sql/tool_insert.sql (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,54 @@ +# Connection: ROOT LOCAL +# Host: localhost +# Saved: 2005-04-07 10:42:43 +# +INSERT INTO lams_tool +( +tool_signature, +service_name, +tool_display_name, +description, +tool_identifier, +tool_version, +learning_library_id, +default_tool_content_id, +valid_flag, +grouping_support_type_id, +supports_define_later_flag, +supports_run_offline_flag, +supports_moderation_flag, +supports_contribute_flag, +learner_url, +author_url, +define_later_url, +export_portfolio_url, +monitor_url, +contribute_url, +moderation_url, +create_date_time +) +VALUES +( +'laqa11', +'qaService', +'Question and Answer', +'Question and Answer Tool Description', +'qa', +'1.1', +NULL, +NULL, +0, +1, +1, +1, +1, +0, +'/tool/laqa11/learningStarter.do', +'/tool/laqa11/authoringStarter.do', +'/tool/laqa11/definelater.do', +'/tool/laqa11/export.do', +'/tool/laqa11/monitoringStarter.do', +'/tool/laqa11/monitoringStarter.do', +'/tool/laqa11/monitoringStarter.do', +NOW() +) Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Nullable.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,39 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + + +/** + * Null Object pattern. This interface is defined to avoid the use of NULL. + * The domain object that allows NULL as return value should implement this + * interface. + * + * @author Ozgur Demirtas + * + */ +public interface Nullable +{ + /** + * contract to indicate whether current object is null. + * @return + */ + public boolean isNull(); +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaAppConstants.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaAppConstants.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaAppConstants.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,274 @@ +/** + * Created on 20/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa; + +/** + * @author Ozgur Demirtas + * + * TODO: Check back the constants with "Attention" + * Holds constants used throughout the application + * + */ +public interface QaAppConstants { + /** + * Currently we are hardcoding the default content id. + * This will be replaced when the deploy logic automatically assigns a default content id in the deploy script. + */ + + public static final String MY_SIGNATURE ="laqa11"; + public static final long DEFAULT_CONTENT_ID =0; + public static final long DEFAULT_QUE_CONTENT_ID =1; + + /** + * temporarily refers to an existing content id for an incoming tool session id, won't need it in deployment environment + */ + public static final long THE_MOCKED_CONTENT_ID =1803739427456570536L; + public static final String TOOL_SERVICE ="tool_service"; + /** + * indicates which mode the tool runs under between Authoring, Learning, Monitoring + */ + public static final String TARGET_MODE ="targetMode"; + public static final String TARGET_MODE_AUTHORING ="Authoring"; + public static final String TARGET_MODE_LEARNING ="Learning"; + public static final String TARGET_MODE_MONITORING ="Monitoring"; + public static final String TARGET_MODE_EXPORT_PORTFOLIO ="ExportPortfolio"; + + public static final String AUTHORING_STARTER ="starter"; + public static final String LEARNING_STARTER ="learningStarter"; + public static final String MONITORING_STARTER ="monitoringStarter"; + + /** + * Mock constants below are temporary until the tool gets a User object from the container. + */ + public static final Integer MOCK_USER_ID = new Integer(111); + public static final String MOCK_USER_NAME ="Ozgur"; + public static final String MOCK_USER_LASTNAME ="Demirtas"; + public static final String MOCK_LOGIN_NAME ="ozgur"; + + /** + * refers to number of questions presented initially, we have a single record for default content + */ + public static final Long INITIAL_QUESTION_COUNT =new Long(1); + + /** + * Struts level constants + */ + public static final String LOAD ="load"; + public static final String LOAD_QUESTIONS ="load"; + public static final String LOAD_STARTER ="starter"; + public static final String AUTHORING_BASIC ="authoringBasic"; + public static final boolean MODE_OPTIONAL = false; + public static final String DISABLE_TOOL ="disabled"; + public static final String IS_DEFINE_LATER ="isDefineLater"; + + /** + * authoring mode controllers + */ + public static final String IS_ADD_QUESTION ="isAddQuestion"; + public static final String IS_REMOVE_QUESTION ="isRemoveQuestion"; + public static final String IS_REMOVE_CONTENT ="isRemoveContent"; + + /** + * tab controllers, constants for authoring page html tabs, used within jsp + */ + public static final String CHOICE ="choice"; + public static final String CHOICE_TYPE_BASIC ="choiceTypeBasic"; + public static final String CHOICE_TYPE_ADVANCED ="choiceTypeAdvanced"; + public static final String CHOICE_TYPE_INSTRUCTIONS ="choiceTypeInstructions"; + + + /** + * authoring mode constants + */ + public static final String MAP_QUESTION_CONTENT ="mapQuestionContent"; + public static final String DEFAULT_QUESTION_CONTENT ="defaultQuestionContent"; + public static final String TITLE ="title"; + public static final String INSTRUCTIONS ="instructions"; + public static final String CREATION_DATE ="creationDate"; + public static final String USERNAME_VISIBLE ="usernameVisible"; + public static final String ONLINE_INSTRUCTIONS ="onlineInstructions"; + public static final String OFFLINE_INSTRUCTIONS ="offlineInstructions"; + public static final String END_LEARNING_MESSSAGE ="endLearningMessage"; + public static final String CONTENT_LOCKED ="contentLocked"; + public static final String ON ="ON"; + public static final String OFF ="OFF"; + public static final String IS_USERNAME_VISIBLE_MONITORING ="isUsernameVisibleMonitoring"; + public static final String IS_SYNCH_INMONITOR_MONITORING ="isSynchInMonitorMonitoring"; + public static final String IS_QUESTIONS_SEQUENCED_MONITORING ="isQuestionsSequencedMonitoring"; + public static final String RICHTEXT_OFFLINEINSTRUCTIONS ="richTextOfflineInstructions"; + public static final String RICHTEXT_ONLINEINSTRUCTIONS ="richTextOnlineInstructions"; + public static final String RICHTEXT_TITLE ="richTextTitle"; + public static final String RICHTEXT_INSTRUCTIONS ="richTextInstructions"; + public static final String RICHTEXT_BLANK ="

 

"; + public static final String THE_OFFLINE_FILE ="theOfflineFile"; + public static final String THE_ONLINE_FILE ="theOnlineFile"; + public static final String THE_OFFLINE_FILENAME ="theOfflineFileName"; + public static final String THE_ONLINE_FILENAME ="theOnlineFileName"; + public static final String SUBMIT_OFFLINE_FILE ="submitOfflineFile"; + public static final String SUBMIT_ONLINE_FILE ="submitOnlineFile"; + public static final String LIST_UPLOADED_OFFLINE_FILES ="listUploadedOfflineFiles"; + public static final String LIST_UPLOADED_ONLINE_FILES ="listUploadedOnlineFiles"; + public static final String LIST_UPLOADED_OFFLINE_FILENAMES ="listUploadedOfflineFileNames"; + public static final String LIST_UPLOADED_ONLINE_FILENAMES ="listUploadedOnlineFileNames"; + public static final String LIST_UPLOADED_OFFLINE_FILES_UUID ="listUploadedOfflineFilesUuid"; + public static final String LIST_UPLOADED_OFFLINE_FILES_NAME ="listUploadedOfflineFilesName"; + public static final String LIST_UPLOADED_ONLINE_FILES_UUID ="listUploadedOnlineFilesUuid"; + public static final String LIST_UPLOADED_ONLINE_FILES_NAME ="listUploadedOnlineFilesName"; + public static final String POPULATED_UPLOADED_FILESDATA ="populateUploadedFilesData"; + + + /** + * the author's current content id + */ + public static final String TOOL_CONTENT_ID ="toolContentId"; + + /** + * the learner or monitoring environment provides toolSessionId + */ + public static final String TOOL_SESSION_ID ="toolSessionId"; + public final long ONE_DAY =60 * 60 * 1000 * 24; + public final static String NOT_ATTEMPTED ="NOT_ATTEMPTED"; + public final static String INCOMPLETE ="INCOMPLETE"; + public static final String COMPLETED ="COMPLETED"; + + public static final String MAP_TOOL_SESSIONS ="mapToolSessions"; + public static final String RESPONSE_INDEX ="responseIndex"; + public static final Integer MAX_TOOL_SESSION_COUNT =new Integer(500); + public static final String IS_TOOL_SESSION_CHANGED ="isToolSessionChanged"; + public static final String USER_EXCEPTION_WRONG_FORMAT ="userExceptionWrongFormat"; + public static final String USER_EXCEPTION_UNCOMPATIBLE_IDS ="userExceptionUncompatibleIds"; + public static final String USER_EXCEPTION_NUMBERFORMAT ="userExceptionNumberFormat"; + public static final String USER_EXCEPTION_CONTENT_DOESNOTEXIST ="userExceptionContentDoesNotExist"; + public static final String USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST ="userExceptionToolSessionDoesNotExist"; + public static final String USER_EXCEPTION_CONTENTID_REQUIRED ="userExceptionContentIdRequired"; + public static final String USER_EXCEPTION_TOOLSESSIONID_REQUIRED ="userExceptionToolSessionIdRequired"; + public static final String USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE ="userExceptionDefaultContentNotAvailable"; + public static final String USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE ="userExceptionDefaultQuestionContentNotAvailable"; + public static final String USER_EXCEPTION_USERID_NOTAVAILABLE ="userExceptionUserIdNotAvailable"; + public static final String USER_EXCEPTION_USERID_NOTNUMERIC ="userExceptionUserIdNotNumeric"; + public static final String USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS ="userExceptionOnlyContentAndNoSessions"; + public static final String USER_EXCEPTION_USERID_EXISTING ="userExceptionUserIdExisting"; + public static final String USER_EXCEPTION_USER_DOESNOTEXIST ="userExceptionUserDoesNotExist"; + public static final String USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED ="userExceptionMonitoringTabContentIdRequired"; + public static final String USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP ="userExceptionDefaultContentNotSetup"; + public static final String USER_EXCEPTION_NO_TOOL_SESSIONS ="userExceptionNoToolSessions"; + + /** + * export portfolio constants + */ + public static final String MODE ="mode"; + public static final String LEARNER ="learner"; + public static final String TEACHER ="teacher"; + public static final String USER_EXCEPTION_MODE_REQUIRED ="userExceptionModeRequired"; + public static final String PORTFOLIO_REPORT ="portfolioReport"; + public static final String PORTFOLIO_REQUEST ="portfolioRequest"; + public static final int MAX_GROUPS_COUNT =250; + + /** + * user actions + */ + public static final String ADD_NEW_QUESTION ="addNewQuestion"; + public static final String REMOVE_QUESTION ="removeQuestion"; + public static final String REMOVE_ALL_CONTENT ="removeAllContent"; + public static final String SUBMIT_ALL_CONTENT ="submitAllContent"; + public static final String SUBMIT_TAB_DONE ="submitTabDone"; + + public static final String OPTION_OFF ="false"; + + //LEARNER mode contants + public static final String MAP_QUESTION_CONTENT_LEARNER ="mapQuestionContentLearner"; + public static final String CURRENT_QUESTION_INDEX ="currentQuestionIndex"; + public static final String TOTAL_QUESTION_COUNT ="totalQuestionCount"; + public static final String MAP_ANSWERS ="mapAnswers"; + public static final String CURRENT_ANSWER ="currentAnswer"; + public static final String USER_FEEDBACK ="userFeedback"; + public static final String REPORT_TITLE ="reportTitle"; + public static final String MONITORING_REPORT_TITLE ="monitoringReportTitle"; + public static final String REPORT_TITLE_LEARNER ="reportTitleLearner"; + public static final String END_LEARNING_MESSAGE ="endLearningMessage"; + public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline"; + public static final String IS_USERNAME_VISIBLE ="isUsernameVisible"; + public static final String IS_ALL_SESSIONS_COMPLETED ="isAllSessionsCompleted"; + public static final String CHECK_ALL_SESSIONS_COMPLETED ="checkAllSessionsCompleted"; + public static final String FROM_TOOL_CONTENT_ID ="fromToolContentId"; + public static final String TO_TOOL_CONTENT_ID ="toToolContentId"; + public static final String LEARNER_REPORT ="learnerReport"; + public static final String MAP_USER_RESPONSES ="mapUserResponses"; + public static final String MAP_MAIN_REPORT ="mapMainReport"; + public static final String MAP_STATS ="mapStats"; + public static final String ACTIVITY_TITLE ="activityTitle"; + public static final String ACTIVITY_INSTRUCTIONS ="activityInstructions"; + + /** + * Monitoring Mode constants + */ + public static final String REPORT_TITLE_MONITOR ="reportTitleMonitor"; + public static final String MONITOR_USER_ID ="userId"; + public static final String MONITORING_REPORT ="monitoringReport"; + public static final String MONITORING_ERROR ="monitoringError"; + public static final String MAP_MONITORING_QUESTIONS ="mapMonitoringQuestions"; + public static final String SUMMARY_TOOL_SESSIONS ="summaryToolSessions"; + public static final String CURRENT_MONITORED_TOOL_SESSION ="currentMonitoredToolSession"; + public static final String CHOICE_MONITORING ="choiceMonitoring"; + public static final String CHOICE_TYPE_MONITORING_SUMMARY ="choiceTypeMonitoringSummary"; + public static final String CHOICE_TYPE_MONITORING_INSTRUCTIONS ="choiceTypeMonitoringInstructions"; + public static final String CHOICE_TYPE_MONITORING_EDITACTIVITY ="choiceTypeMonitoringEditActivity"; + public static final String CHOICE_TYPE_MONITORING_STATS ="choiceTypeMonitoringStats"; + public static final String MONITORING_INSTRUCTIONS_VISITED ="monitoringInstructionsVisited"; + public static final String MONITORING_EDITACTIVITY_VISITED ="monitoringEditActivityVisited"; + public static final String MONITORING_STATS_VISITED ="monitoringStatsVisited"; + public static final String DATAMAP_EDITABLE ="dataMapEditable"; + public static final String DATAMAP_EDITABLE_RESPONSE_ID ="dataMapEditableResponseId"; + public static final String DATAMAP_HIDDEN_RESPONSE_ID ="dataMapHiddenResponseId"; + public static final String MONITORED_CONTENT_ID ="monitoredContentId"; + public static final String START_MONITORING_SUMMARY_REQUEST ="startMonitoringSummaryRequest"; + public static final String STOP_RENDERING_QUESTIONS ="stopRenderingQuestions"; + public static final String EDITACTIVITY_EDITMODE ="editActivityEditMode"; + public static final String FORM_INDEX ="formIndex"; + public static final String RENDER_MONITORING_EDITACTIVITY ="renderMonitoringEditActivity"; + public static final String NO_AVAILABLE_SESSIONS ="noAvailableSessions"; + public static final String INITIAL_MONITORING_TOOL_CONTENT_ID ="initialMonitoringToolContentId"; + public static final String IS_MONITORING_DEFINE_LATER ="isMonitoringDefineLater"; + public static final String NO_TOOL_SESSIONS_AVAILABLE ="noToolSessionAvailable"; + public static final String ORIGINAL_TOOL_SESSIONS ="originalToolSessions"; + + public static final String MONITORED_OFFLINE_INSTRUCTIONS ="monitoredOfflineInstructions"; + public static final String MONITORED_ONLINE_INSTRUCTIONS ="monitoredOnlineInstructions"; + public static final String MONITORING_INSTRUCTIONS_UPDATE_MESSAGE ="monitoringInstructionsUpdateMessage"; + + /** + * Monitor and Learning common constants - used in jsp reporting + */ + public static final String FULLNAME ="fullName"; + public static final String ANSWER ="answer"; + public static final String ATIME ="aTime"; + public static final String FORMATTED_ATIME ="formattedAtime"; + public static final String RESPONSE_ID ="responseId"; + public static final String RESPONSE_HIDDEN ="responseHidden"; + public static final String CURRENTLEARNER_FULLNAME ="currentLearnerFullname"; + public static final String ATTR_USERDATA ="qa_user"; + public static final String TIMEZONE ="timeZone"; + public static final String TIMEZONE_ID ="timeZoneId"; + + /** + * following tell whether author prefers to have the questions listed all in one page or listed sequentially. The default is all in one page. + */ + public static final String QUESTION_LISTING_MODE ="questionListingMode"; + public static final String QUESTION_LISTING_MODE_SEQUENTIAL ="questionListingModeSequential"; + public static final String QUESTION_LISTING_MODE_COMBINED ="questionListingModeCombined"; + + public static final String FEEDBACK_TYPE_SEQUENTIAL ="You will be presented a total of : "; + public static final String FEEDBACK_TYPE_COMBINED ="You are being presented a total of : "; + public static final String QUESTIONS =" questions."; + + /** + * constants redundant for the moment + */ + public static final String DISPLAY_QUESTIONS ="display"; + public static final String SUBMIT_QUESTIONS ="submit"; + public static final String VIEW_INDIVIDUAL_SUMMARY ="view"; +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaApplicationException.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaApplicationException.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaApplicationException.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,71 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + + +/** + *

This exception wraps all basic exception occured in the qa tool. It is + * not suppose to be try and catched in any level. The struts should be taking + * care of handling this exception.

+ * +* @author Ozgur Demirtas + * + */ +public class QaApplicationException extends RuntimeException +{ + /** + * Default Constructor + */ + public QaApplicationException() + { + super(); + } + + /** + * Constructor for customized error message + * @param message + */ + public QaApplicationException(String message) + { + super(message); + } + + /** + * Constructor for wrapping the throwable object + * @param cause + */ + public QaApplicationException(Throwable cause) + { + super(cause); + } + + /** + * Constructor for wrapping both the customized error message and + * throwable exception object. + * @param message + * @param cause + */ + public QaApplicationException(String message, Throwable cause) + { + super(message, cause); + } + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaComparator.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaComparator.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaComparator.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,43 @@ +/* + * Created on 20/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.Comparator; + +import org.apache.log4j.Logger; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * A comparator implementation that can be used as a constructor to collections. + * The TreeMap in the web layer makes use of it. + * + */ +public class QaComparator implements Comparator, Serializable { + static Logger logger = Logger.getLogger(QaComparator.class.getName()); + + public int compare(Object o1, Object o2) { + String s1 = (String)o1; + String s2 = (String)o2; + + int key1=new Long(s1).intValue(); + int key2=new Long(s2).intValue(); + //logger.debug(logger + " " + this.getClass().getName() + "comparing key1 and key2:" + key1 + " and " + key2); + return key1 - key2; + } + + public boolean equals(Object o) { + String s = (String)o; + return compare(this, o)==0; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaContent.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,497 @@ +package org.lamsfoundation.lams.tool.qa; +import java.io.Serializable; +import java.util.Date; +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; + +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.tool.qa.QaQueContent; + + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * QaContent Value Object + * The value object that maps to our model database table: tl_laqa11_content + * The relevant hibernate mapping resides in: QaContent.hbm.xml + * + * Holds content representation for the tool. + * Default content is made available to the tool by the database. + */ +public class QaContent implements Serializable { + static Logger logger = Logger.getLogger(QaContent.class.getName()); + + /** identifier field */ + private Long qaContentId; + + /** nullable persistent field */ + private String title; + + /** nullable persistent field */ + private String instructions; + + /** nullable persistent field */ + private String reportTitle; + + /** nullable persistent field */ + private String monitoringReportTitle; + + /** nullable persistent field */ + private String offlineInstructions; + + /** nullable persistent field */ + private String onlineInstructions; + + /** nullable persistent field */ + private long createdBy; + + /** nullable persistent field */ + private boolean defineLater; + + /** nullable persistent field */ + private boolean runOffline; + + private boolean questionsSequenced; + + /** nullable persistent field */ + private boolean usernameVisible; + + /** nullable persistent field */ + private boolean synchInMonitor; + + /** nullable persistent field */ + private boolean contentLocked; + + /** nullable persistent field */ + private String endLearningMessage; + + /** nullable persistent field */ + private String creationDate; + + /** nullable persistent field */ + private Date updateDate; + + + /** persistent field */ + private Set qaQueContents; + + /** persistent field */ + private Set qaSessions; + + /** persistent field */ + private Set qaUploadedFiles; + + public QaContent(){}; + + /** full constructor */ + public QaContent(Long qaContentId, + String title, + String instructions, + String reportTitle, + String monitoringReportTitle, + String offlineInstructions, + String onlineInstructions, + String endLearningMessage, + long createdBy, + boolean defineLater, + boolean runOffline, + boolean questionsSequenced, + boolean usernameVisible, + boolean synchInMonitor, + boolean contentLocked, + String creationDate, + Date updateDate, + Set qaQueContents, + Set qaSessions, + Set qaUploadedFiles) + { + this.qaContentId = qaContentId; + this.title = title; + this.instructions = instructions; + this.reportTitle = reportTitle; + this.monitoringReportTitle=monitoringReportTitle; + this.offlineInstructions = offlineInstructions; + this.onlineInstructions = onlineInstructions; + this.endLearningMessage = endLearningMessage; + this.createdBy = createdBy; + this.defineLater = defineLater; + this.runOffline = runOffline; + this.questionsSequenced = questionsSequenced; + this.usernameVisible = usernameVisible; + this.synchInMonitor = synchInMonitor; + this.contentLocked = contentLocked; + this.creationDate = creationDate; + this.updateDate = updateDate; + this.qaQueContents = qaQueContents; + this.qaSessions = qaSessions; + this.qaUploadedFiles = qaUploadedFiles; + logger.debug(logger + " " + this.getClass().getName() + "in full constructor: QaContent()"); + } + + /** + * Copy Construtor to create a new qa content instance. Note that we + * don't copy the qa session data here because the qa session + * will be created after we copied tool content. + * @param qa the original qa content. + * @param newContentId the new qa content id. + * @return the new qa content object. + */ + public static QaContent newInstance(QaContent qa, + Long newContentId) + { + QaContent newContent = new QaContent(newContentId, + qa.getTitle(), + qa.getInstructions(), + qa.getReportTitle(), + qa.getMonitoringReportTitle(), + qa.getOfflineInstructions(), + qa.getOnlineInstructions(), + qa.getEndLearningMessage(), + qa.getCreatedBy(), + qa.isDefineLater(), + qa.isRunOffline(), + qa.isQuestionsSequenced(), + qa.isUsernameVisible(), + qa.isSynchInMonitor(), + qa.isContentLocked(), + qa.getCreationDate(), + qa.getUpdateDate(), + new TreeSet(), + new TreeSet(), + new TreeSet()); + logger.debug(logger + " " + "QaContent" + " " + "before doing deepCopyQaQueContent"); + newContent.setQaQueContents(qa.deepCopyQaQueContent(newContent)); + logger.debug(logger + " " + "QaContent" + " " + "after doing deepCopyQaQueContent"); + return newContent; + } + + + //part of the contract: make sure that this works! + public Set deepCopyQaQueContent(QaContent newQaContent) + { + logger.debug(logger + " " + "QaContent" + " " + "start of deepCopyQaQueContent"); + Set newQaQueContent = new TreeSet(); + for (Iterator i = this.getQaQueContents().iterator(); i.hasNext();) + { + QaQueContent queContent = (QaQueContent) i.next(); + newQaQueContent.add(QaQueContent.newInstance(queContent, + newQaContent, + null)); + } + logger.debug(logger + " " + "QaContent" + " " + "returning newQaQueContent: " + newQaQueContent); + return newQaQueContent; + } + + + + + public Set deepCopyQaSession(QaContent newQaSession) + { + return new TreeSet(); + } + + + public Set getQaQueContents() + { + if (this.qaQueContents == null) + setQaQueContents(new TreeSet()); + return this.qaQueContents; + } + + public void setQaQueContents(Set qaQueContents) + { + this.qaQueContents = qaQueContents; + } + + public Set getQaSessions() + { + if (this.qaSessions == null) + setQaSessions(new TreeSet()); + return this.qaSessions; + } + + public void setQaSessions(Set qaSessions) + { + this.qaSessions = qaSessions; + } + + + /** + * @return Returns the qaContentId. + */ + public Long getQaContentId() { + return qaContentId; + } + /** + * @param qaContentId The qaContentId to set. + */ + public void setQaContentId(Long qaContentId) { + this.qaContentId = qaContentId; + } + /** + * @return Returns the title. + */ + public String getTitle() { + return title; + } + /** + * @param title The title to set. + */ + public void setTitle(String title) { + this.title = title; + } + + + public String toString() + { + return new ToStringBuilder(this).append("qaContentId:", + getQaContentId()) + .append("qa title:", getTitle()) + .append("qa instructions:", + getInstructions()) + .append("date created:", + getCreationDate()) + .append("update date:", + getUpdateDate()) + .append("creator user id", + getCreatedBy()) + .append("username_visible:", isUsernameVisible()) + .append("defineLater", isDefineLater()) + .append("offline_instructions:", getOfflineInstructions()) + .append("online_instructions:", getOnlineInstructions()) + .append("report_title: ", getReportTitle()) + .append("synch_in_monitor: ", isSynchInMonitor()) + .toString(); + } + + + + /** + * Since the survey content id is assigned variable, we can use content id + * to ensure two survey objects are equal. + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object other) + { + if (!(other instanceof QaContent)) + return false; + QaContent castOther = (QaContent) other; + return new EqualsBuilder().append(this.getQaContentId(), + castOther.getQaContentId()) + .isEquals(); + } + + /** + * Since the survey content id is assigned variable, we can use content id + * to ensure two survey objects are equal. + * @see java.lang.Object#hashCode() + */ + public int hashCode() + { + return new HashCodeBuilder().append(getQaContentId()).toHashCode(); + } + + + /** + * @return Returns the createdBy. + */ + public long getCreatedBy() { + return createdBy; + } + /** + * @param createdBy The createdBy to set. + */ + public void setCreatedBy(long createdBy) { + this.createdBy = createdBy; + } + /** + * @return Returns the creationDate. + */ + public String getCreationDate() { + return creationDate; + } + /** + * @param creationDate The creationDate to set. + */ + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + } + /** + * @return Returns the defineLater. + */ + public boolean isDefineLater() { + return defineLater; + } + /** + * @param defineLater The defineLater to set. + */ + public void setDefineLater(boolean defineLater) { + this.defineLater = defineLater; + } + /** + * @return Returns the instructions. + */ + public String getInstructions() { + return instructions; + } + /** + * @param instructions The instructions to set. + */ + public void setInstructions(String instructions) { + this.instructions = instructions; + } + /** + * @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 reportTitle. + */ + public String getReportTitle() { + return reportTitle; + } + /** + * @param reportTitle The reportTitle to set. + */ + public void setReportTitle(String reportTitle) { + this.reportTitle = reportTitle; + } + /** + * @return Returns the synchInMonitor. + */ + public boolean isSynchInMonitor() { + return synchInMonitor; + } + /** + * @param synchInMonitor The synchInMonitor to set. + */ + public void setSynchInMonitor(boolean synchInMonitor) { + this.synchInMonitor = synchInMonitor; + } + /** + * @return Returns the updateDate. + */ + public Date getUpdateDate() { + return updateDate; + } + /** + * @param updateDate The updateDate to set. + */ + public void setUpdateDate(Date updateDate) { + this.updateDate = updateDate; + } + /** + * @return Returns the usernameVisible. + */ + public boolean isUsernameVisible() { + return usernameVisible; + } + /** + * @param usernameVisible The usernameVisible to set. + */ + public void setUsernameVisible(boolean usernameVisible) { + this.usernameVisible = usernameVisible; + } + + /** + * @return Returns the questionsSequenced. + */ + public boolean isQuestionsSequenced() { + return questionsSequenced; + } + /** + * @param questionsSequenced The questionsSequenced to set. + */ + public void setQuestionsSequenced(boolean questionsSequenced) { + this.questionsSequenced = questionsSequenced; + } + /** + * @return Returns the endLearningMessage. + */ + public String getEndLearningMessage() { + return endLearningMessage; + } + /** + * @param endLearningMessage The endLearningMessage to set. + */ + public void setEndLearningMessage(String endLearningMessage) { + this.endLearningMessage = endLearningMessage; + } + /** + * @return Returns the runOffline. + */ + public boolean isRunOffline() { + return runOffline; + } + /** + * @param runOffline The runOffline to set. + */ + public void setRunOffline(boolean runOffline) { + this.runOffline = runOffline; + } + /** + * @return Returns the monitoringReportTitle. + */ + public String getMonitoringReportTitle() { + return monitoringReportTitle; + } + /** + * @param monitoringReportTitle The monitoringReportTitle to set. + */ + public void setMonitoringReportTitle(String monitoringReportTitle) { + this.monitoringReportTitle = monitoringReportTitle; + } + /** + * @return Returns the contentLocked. + */ + public boolean isContentLocked() { + return contentLocked; + } + /** + * @param contentLocked The contentLocked to set. + */ + public void setContentLocked(boolean contentLocked) { + this.contentLocked = contentLocked; + } + /** + * @return Returns the qaUploadedFiles. + */ + public Set getQaUploadedFiles() { + return qaUploadedFiles; + } + /** + * @param qaUploadedFiles The qaUploadedFiles to set. + */ + public void setQaUploadedFiles(Set qaUploadedFiles) { + this.qaUploadedFiles = qaUploadedFiles; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueContent.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,359 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; + +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; + +/** + * + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * QaQueContent Value Object + * The value object that maps to our model database table: tl_laqa11_que_content + * The relevant hibernate mapping resides in: QaQueContent.hbm.xml + * + * Holds question content within a particular content + */ +public class QaQueContent implements Serializable,Comparable, Nullable +{ + static Logger logger = Logger.getLogger(QaQueContent.class.getName()); + + /** identifier field */ + private Long qaQueContentId; + + /** nullable persistent field */ + private String question; + + /** nullable persistent field */ + private int displayOrder; + + + /** nullable persistent field */ + private org.lamsfoundation.lams.tool.qa.QaContent qaContent; + + /** persistent field */ + private Set qaUsrResps; + + /** persistent field */ + private Set qaQueUsers; + + /** Struts form convenient field */ + private String[] userResponses = {}; + + /** Struts form convenient field */ + private String otherResponse; + + /** nullable persistent field */ + private boolean isOptional; + + /** nullable persistent field */ + private Long qaContentId; + + /** default constructor */ + public QaQueContent() + { + logger.debug(logger + " " + this.getClass().getName() + "in constructor: QaQueContent()"); + } + + /** full constructor */ + public QaQueContent(String question, + int displayOrder, + org.lamsfoundation.lams.tool.qa.QaContent qaContent, + Set qaQueUsers, + Set qaUsrResps) + { + this.question = question; + this.displayOrder = displayOrder; + this.qaContent = qaContent; + this.qaQueUsers=qaQueUsers; + this.qaUsrResps=qaUsrResps; + } + + public QaQueContent(String question, + int displayOrder, + Set qaQueUsers, + Set qaUsrResps) +{ + this.question = question; + this.displayOrder = displayOrder; + this.qaQueUsers=qaQueUsers; + this.qaUsrResps=qaUsrResps; + } + + + /** minimal constructor */ + public QaQueContent(Set qaQueUsers, + Set qaUsrResps) + { + this.qaQueUsers = qaQueUsers; + this.qaUsrResps = qaUsrResps; + } + + + /** + * Copy constructor + * @param queContent the original qa question content + * @return the new qa question content object + */ + //part of the contract: make sure that this works! + public static QaQueContent newInstance(QaQueContent queContent, + QaContent newQaContent, + QaQueContent parentQuestion) + { + QaQueContent newQueContent = new QaQueContent(queContent.getQuestion(), + queContent.getDisplayOrder(), + newQaContent, + new TreeSet(), + new TreeSet()); + logger.debug(logger + " " + "QaQueContent" + " " + "returning newQueContent: " + newQueContent); + return newQueContent; + } + + + public String toString() { + return new ToStringBuilder(this) + .append("qaQueContentId: ", getQaQueContentId()) + .append("question: ", getQuestion()) + .append("displayOrder: ", getDisplayOrder()) + .toString(); + } + + public boolean equals(Object other) { + if ( !(other instanceof QaQueContent) ) return false; + QaQueContent castOther = (QaQueContent) other; + return new EqualsBuilder() + .append(this.getQaQueContentId(), castOther.getQaQueContentId()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getQaQueContentId()) + .toHashCode(); + } + + + /** + * @return Returns the displayOrder. + */ + public int getDisplayOrder() { + return displayOrder; + } + /** + * @param displayOrder The displayOrder to set. + */ + public void setDisplayOrder(int displayOrder) { + this.displayOrder = displayOrder; + } + /** + * @return Returns the qaContent. + */ + public org.lamsfoundation.lams.tool.qa.QaContent getQaContent() { + return qaContent; + } + /** + * @param qaContent The qaContent to set. + */ + public void setQaContent(org.lamsfoundation.lams.tool.qa.QaContent qaContent) { + this.qaContent = qaContent; + } + /** + * @return Returns the qaQueContentId. + */ + public Long getQaQueContentId() { + return qaQueContentId; + } + /** + * @param qaQueContentId The qaQueContentId to set. + */ + public void setQaQueContentId(Long qaQueContentId) { + this.qaQueContentId = qaQueContentId; + } + /** + * @return Returns the qaQueUsers. + */ + public Set getQaQueUsers() { + if (this.qaQueUsers == null) + setQaQueUsers(new TreeSet()); + return qaQueUsers; + } + /** + * @param qaQueUsers The qaQueUsers to set. + */ + public void setQaQueUsers(Set qaQueUsers) { + this.qaQueUsers = qaQueUsers; + } + /** + * @return Returns the qaUsrResps. + */ + public Set getQaUsrResps() { + if (this.qaUsrResps == null) + setQaUsrResps(new TreeSet()); + return qaUsrResps; + } + /** + * @param qaUsrResps The qaUsrResps to set. + */ + public void setQaUsrResps(Set qaUsrResps) { + this.qaUsrResps = qaUsrResps; + } + /** + * @return Returns the question. + */ + public String getQuestion() { + return question; + } + /** + * @param question The question to set. + */ + public void setQuestion(String question) { + this.question = question; + } + + + public String[] getUserResponses() + { + return userResponses; + } + + /** + * @param userResponse The userResponse to set. + */ + public void setUserResponses(String[] userResponse) + { + this.userResponses = userResponse; + } + + /** + * @return Returns the otherResponse. + */ + public String getOtherResponse() + { + return otherResponse == null ? null : otherResponse.trim(); + } + + /** + * @param otherResponse The otherResponse to set. + */ + public void setOtherResponse(String otherResponse) + { + this.otherResponse = otherResponse; + } + + + /** + * @hibernate.property column="isOptional" length="1" + * + */ + public boolean getIsOptional() + { + return this.isOptional; + } + + public void setIsOptional(boolean isOptional) + { + this.isOptional = isOptional; + } + + + /** + * Validate whether there is a response available for current question. + * This method only validate struts convient field at the moment. + * @return whether the resonse is available or not. + */ + private boolean isResponseAvailable() + { + if (this.getUserResponses().length == 0 + && this.getOtherResponse() == null) + return false; + return this.getUserResponses().length != 0 + || !this.getOtherResponse().equals(""); + + } + + public void setUpOtherResponse(String username) + { + for (Iterator i = this.getQaQueUsers().iterator(); i.hasNext();) + { + QaQueUsr qUser = (QaQueUsr) i.next(); + + if ((qUser.getUsername().trim()).equals(username)) + this.setOtherResponse(qUser.getOtherResponse()); + } + } + + + /** + * Convenient method to check out the response for other field. + * @return true if other response field is not null and is not equals to + * empty String + */ + public boolean isOtherResponseAvailable() + { + if (this.otherResponse != null && !this.otherResponse.equals("")) + return true; + return false; + } + + public boolean isNull() + { + return false; + } + + public int compareTo(Object o) + { + QaQueContent queContent = (QaQueContent) o; + + //if the object does not exist yet, then just return any one of 0, -1, 1. Should not make a difference. + if (qaQueContentId == null) + return 1; + else + return (int) (qaQueContentId.longValue() - queContent.qaQueContentId.longValue()); + + } + + + /** + * @return Returns the qaContentId. + */ + public Long getQaContentId() { + return qaContentId; + } + /** + * @param qaContentId The qaContentId to set. + */ + public void setQaContentId(Long qaContentId) { + this.qaContentId = qaContentId; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,470 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +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; +/** + * + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * + * QaQueUsr Value Object + * The value object that maps to our model database table: tl_laqa11_que_usr + * The relevant hibernate mapping resides in: QaQueUsr.hbm.xml + * + * Represents tool users. + */ +public class QaQueUsr implements Serializable, Comparable, Nullable +{ + static Logger logger = Logger.getLogger(QaQueUsr.class.getName()); + + /** identifier field */ + private Long queUsrId; + + /** nullable persistent field */ + private String username; + + /** nullable persistent field */ + private String fullname; + + /** persistent field */ + private QaSession qaSession; + + /** persistent field */ + private Long qaSessionId; + + /** persistent field */ + private QaQueContent qaQueContent; + + /** persistent field */ + private Set qaUsrResps; //surveyUsrResps + + public QaQueUsr() + { + logger.debug(logger + " " + this.getClass().getName() + "in constructor: QaQueUsr()"); + } + + + + /** full constructor */ + public QaQueUsr(Long queUsrId, + String username, + String fullname, + QaQueContent qaQueContent, + QaSession qaSession, + Set qaUsrResps) + + { + this.queUsrId = queUsrId; + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps =qaUsrResps; + } + + /** minimal constructor */ + public QaQueUsr(QaQueContent qaQueContent, + QaSession qaSession, + Set qaUsrResps) + + { + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps =qaUsrResps; + } + + + public QaQueUsr(Long queUsrId, + String username, + String fullname, + QaQueContent qaQueContent, + QaSession qaSession) + { + this.queUsrId = queUsrId; + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + } + + + + public QaQueUsr(String username, + String fullname, + QaQueContent qaQueContent, + QaSession qaSession, + Set qaUsrResps) + + { + this.username = username; + this.fullname = fullname; + this.qaQueContent = qaQueContent; + this.qaSession = qaSession; + this.qaUsrResps =qaUsrResps; + } + + + + //implement this, double check this, what is it for? + /** + * Copy construtor; We copy all data except the hibernate id field. + * @param queUsr the original survey question user object. + * @return the survey question user object. + */ + public QaQueUsr newInstance(QaQueUsr queUsr) + { + return new QaQueUsr(queUsr.getQueUsrId(), + queUsr.getUsername(), + queUsr.getFullname(), + queUsr.getQaQueContent(), + queUsr.getQaSession(), + queUsr.getQaUsrResps()); + } + + + /** + * @return Returns the fullname. + */ + public String getFullname() { + return fullname; + } + /** + * @param fullName The fullName to set. + */ + public void setFullname(String fullname) { + this.fullname = fullname; + } + /** + * @return Returns the qaQueContent. + */ + public QaQueContent getQaQueContent() { + return qaQueContent; + } + /** + * @param qaQueContent The qaQueContent to set. + */ + public void setQaQueContent(QaQueContent qaQueContent) { + this.qaQueContent = qaQueContent; + } + /** + * @return Returns the qaSession. + */ + public QaSession getQaSession() { + return qaSession; + } + /** + * @param qaSession The qaSession to set. + */ + public void setQaSession(QaSession qaSession) { + this.qaSession = qaSession; + } + /** + * @return Returns the qaUsrResps. + */ + public Set getQaUsrResps() + { + if (this.qaUsrResps == null) + setQaUsrResps(new TreeSet()); + return this.qaUsrResps; + } + /** + * @param qaUsrResps The qaUsrResps to set. + */ + public void setQaUsrResps(Set qaUsrResps) { + this.qaUsrResps = qaUsrResps; + } + /** + * @return Returns the queUsrId. + */ + public Long getQueUsrId() { + return queUsrId; + } + /** + * @param queUsrId The queUsrId to set. + */ + public void setQueUsrId(Long queUsrId) { + this.queUsrId = queUsrId; + } + /** + * @return Returns the username. + */ + public String getUsername() { + return username; + } + /** + * @param username The username to set. + */ + public void setUsername(String username) { + this.username = username; + } + + + public String toString() + { + return new ToStringBuilder(this).append("queUsrId", getQueUsrId()) + .append("username",getUsername()) + .append("full name",getFullname()) + .toString(); + } + + + public boolean equals(Object other) + { + if (!(other instanceof QaQueUsr)) + return false; + QaQueUsr castOther = (QaQueUsr) other; + return new EqualsBuilder().append(this.getQueUsrId(),castOther.getQueUsrId()) + //.append(this.getUserId(),castOther.getUserId()) + //.append(this.getQaQueContent(),castOther.getQaQueContent()) + .isEquals(); + } + + public int hashCode() + { + return new HashCodeBuilder().append(getQueUsrId()) + //.append(getUserId()) + .toHashCode(); + } + + + + //--------------------------------------------------------------------- + // Convenient Service Methods + //--------------------------------------------------------------------- + /** + * Check up question responsed by current user against a list user responses. + * Return true if + * @param responses + * @return the validation result + */ + public boolean checkUpQueUsrHas(List responses) + { + if (responses == null) + throw new IllegalArgumentException("Invalid responses from " + + this.getFullname() + ": Can't validate null responses" + + "against current survey questions"); + + //make defensive copy to avoid list mutation outside this class. + ArrayList resps = new ArrayList(responses); + + for (Iterator i = resps.iterator(); i.hasNext();) + { + QaUsrResp resp = (QaUsrResp) i.next(); + if (doesQueUserHas(resp)) + return true; + } + return false; + } + + + + /** + * The helper function to validate the availability of a user response for + * this question user. + * The condition to return true is:
+ *
  • the requested response has a reference to a question user object + * and reference id is the same as current question user object.
  • + * + * @param response the user response + * @return the validation result + */ + public boolean doesQueUserHas(QaUsrResp response) + { + if (response.getQaQueUser() == null) + throw new IllegalArgumentException("Invalid response :" + + " Can't validate the availability" + + " of a response without the reference to a user"); + + if(response.getQaQueUser().getQueUsrId()==null||this.getQueUsrId()==null) + return false; + + if (this.getQueUsrId().equals(response.getQaQueUser().getQueUsrId())) + return true; + return false; + } + + /** + * @param responses + * @param responseSet + */ + public void removeResponseBy(ArrayList responses) + { + Set responseSet = new TreeSet(this.getQaUsrResps()); + //remove responses no longer exist. + for(Iterator i = responseSet.iterator();i.hasNext();) + { + QaUsrResp resp = (QaUsrResp) i.next(); + if(!resp.doesRespExistIn(responses)) + this.getQaUsrResps().remove(resp); + } + } + + + /** + * Update the user responses of this question user object against a list of + * new user responses. + * @param responses + */ + public void updateQueUsr(List responses) + { + if (responses == null) + throw new IllegalArgumentException("Invalid responses from " + + this.getFullname() + ": Can't update null responses" + + "against current survey questions"); + + //make defensive copy to avoid list mutation outside this class. + ArrayList resps = new ArrayList(responses); + //clean up all the existing reponses + removeResponseBy(resps); + addNewResponsesBy(resps); + updateExistingResp(resps); + } + + /** + * @param resps + * @param responseList + */ + public void addNewResponsesBy(ArrayList resps) + { + ArrayList responseList = new ArrayList(this.getQaUsrResps()); + //add all associated new responses into the current question user. + for (Iterator i = resps.iterator(); i.hasNext();) + { + QaUsrResp resp = (QaUsrResp) i.next(); + if (!resp.doesRespExistIn(responseList)&&doesQueUserHas(resp)) + addUserResponse(resp); + } + } + + /** + * @param responses + * @param responseSet + */ + public void updateExistingResp(ArrayList responses) + { + //update existing responses + for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) + { + QaUsrResp resp = (QaUsrResp) i.next(); + if(resp.doesRespExistIn(responses)) + resp.updateResponseBy(responses); + } + } + + /** + * @param resp + */ + public void addUserResponse(QaUsrResp resp) + { + if (resp != null && !resp.isResponseValid()) + throw new IllegalArgumentException("Invalid response for update "); + + this.getQaUsrResps().add(resp); + } + + + /** + * Get a list of user response Strings that are correspondent to the + * authored defined candidate answers. Currently, we include the free + * text answer to this category as well. + * + * @return the list of String user responses + */ + public List getPredefinedResponse() + { + LinkedList responses = new LinkedList(); + + for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) + { + QaUsrResp res = (QaUsrResp)i.next(); + if(res.isPredefinedResponse()) + { + responses.add(res.getAnswer()); + } + } + return responses; + } + + + public String getOtherResponse() + { + for(Iterator i = this.getQaUsrResps().iterator();i.hasNext();) + { + QaUsrResp res = (QaUsrResp)i.next(); + if(!res.isPredefinedResponse()) + return res.getAnswer(); + } + + return ""; + } + + public int compareTo(Object o) + { + + QaQueUsr qUser = (QaQueUsr) o; + /* + if (this.qaQueContent == null + && qUser.getQaQueContent() == null) + return String.CASE_INSENSITIVE_ORDER.compare(username, + qUser.username); + if (this.qaQueContent == null) + return 1; + if (qUser.getQaQueContent() == null) + return -1; + */ + return this.getQaQueContent().compareTo(qUser.getQaQueContent()); + } + + public boolean isNull() + { + return false; + } + + /** + * @return Returns the qaSessionId. + */ + public Long getQaSessionId() { + return qaSessionId; + } + /** + * @param qaSessionId The qaSessionId to set. + */ + public void setQaSessionId(Long qaSessionId) { + this.qaSessionId = qaSessionId; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaResources.properties =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaResources.properties (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaResources.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,113 @@ +# Project lams_tool_qa +#Authoring mode resources +label.authoring.qa =Questions and Answers +label.authoring.title =Title +label.authoring.instructions =Instructions + +button.basic =Basic +button.uploadFile =Upload Package +button.preview =Preview +button.advanced =Advanced +button.instructions =Instructions +button.done =Done +tool.icon.name =Q/A +button.addNewQuestion =+ +button.removeQuestion =- +button.removeAllContent =Remove Content +button.submitAllContent =Submit +button.done =Done +button.getNextQuestion =Next +button.getPreviousQuestion =Previous + +label.report.title =Report Title +label.monitoringReport.title =Monitoring Report Title +label.report.endLearningMessage =End of Activity Message +label.question1 =Question 1 +radiobox.defineLater =Define Later +radiobox.synchInMonitor =Sync in Monitor +radiobox.forceOffline =Force Offline +radiobox.usernameVisible =Username Visible +radiobox.questionsSequenced =Questions Sequenced +label.offlineInstructions =Offline Instructions +label.onlineInstructions =Online Instructions +label.offlineFiles =Offline Files: +label.onlineFiles =Online Files: +label.upload =Upload +label.uploadedOfflineFiles =Uploaded Offline Files: +label.uploadedOnlineFiles =Uploaded Online Files: +option.on =ON +option.off =OFF +feedback =Please address the following issues before submit.
    +error.title =The field "Title" is mandatory.
    +error.instructions =The field "Instructions" is mandatory.
    +error.reportTitle =The field "Report Title (Advanced)" is mandatory.
    +error.defaultquestion.empty =The first question can not be empty.
    +submit.successful =The content has been created successfully.
    + +error.content.locked =The content has been locked since it is being used by one mor more learners.
    The modification of the content is not allowed. +error.content.inUse =The modification of the content is not allowed since one or more students has attempted the activity. +error.content.beingModified =The content creation is not allowed since the same content is being modified. +error.content.unstableState =The content is in an unstable state since it has been left editable while monitored.
    Please use this screen to redefine the content. +error.defaultContent.notAvailable =Tool Activity Error! Can't continue
    The the default content for the Tool Activity has not been set up. +error.defaultQuestionContent.notAvailable =Tool Activity Error! Can't continue
    The the default question content for the Tool Activity has not been set up. + +#Learning mode resources +label.learning.qa =Answers for Q/A +label.question =Question +label.answers =Answers: +button.endLearning =Finish +label.learning.user =User +label.learning.attemptTime =Attempt Date/Time +label.learning.timezone =Time-Zone +label.learning.response =Response +label.learning.forceOfflineMessage =This is setup to be carried out offline. Plase see your instructor for details. +error.defineLater =Sorry, this activity's content is not ready yet.
    Please wait for your teacher to make the content ready. +error.toolSessionId.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a toolSession id. +error.contentId.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a content id. +error.authoringUser.notAvailable =Tool Activity Error! Can't continue. Tool Activity expects a user id. +error.userId.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a user id. +error.userId.notNumeric =Tool Activity Error! Can't continue. The user id passed to the Tool Activity must be numerical. +error.userId.existing =Tool Activity Error! Can't continue. The user id passed to the Tool Activity refers to a student that has already used the activity.
    Each learner activity should be associated with a unique userId. +error.defaultContent.notSetup =Tool Activity Error! Can't continue. The default content for the tool has not been setup properly. +error.mode.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a mode. + +#Monitoring mode resources +button.startLesson =Start Lesson +button.deleteLesson =Delete Lesson +button.contributeLesson =Contribute -> Report +button.forceComplete =Force Complete +error.synchInMonitor =The report is available only after all the students finish their activities.
    + Some of the students has not completed the activity yet. However, those students may be forced to complete. +error.monitorReportTitle =The field "Monitor Report Title (Advanced)" is mandatory.
    +error.noStudentActivity =Sorry, the report can not be generated.
    No student has attempted the activity yet. +error.contentAndToolSession.notCompatible =Tool Activity Error! Can't continue. The content id and tool session(s) passed to the tool activity are not compatible with each other.
    The Tool Activity expects that each of the passed tool sessions refer to the same passed content id. +error.toolSessions.wrongFormat =Tool Activity Error! Can't continue. No valid tool sessions has been passed to the Tool Activity.
    The expected format is: TOOLURL?toolContentId=A&toolSessionId1=B&toolSessionId2=C&toolSessionId3=D&... +error.numberFormatException =Tool Activity Error! Can't continue. The content id and tool session id(s) passed to the Tool Activity must be numerical. +error.contentId.numberFormatException =Tool Activity Error! Can't continue. The content id passed to the Tool Activity must be numerical. +error.sessionId.numberFormatException =Tool Activity Error! Can't continue. The toolSession id passed to the Tool Activity must be numerical. +error.content.doesNotExist =Tool Activity Error! Can't continue. The content id passed to the Tool Activity does not refer to an existing content. +error.toolSessions.doesNotExist =Tool Activity Error! Can't continue. One of the toolsession ids passed to the Tool Activity does not refer to an existing tool session. +error.toolSession.doesNotExist =Tool Activity Error! Can't continue. The toolsession id passed to the Tool Activity does not refer to an existing tool session. +error.content.onlyContentAndNoSessions =A report can not be generated since no tool sessions has been passed to the Tool Activity. +error.content.noToolSessions =A report can not be generated since there has not been any student activity on this content. +error.user.doesNotExist =Tool Activity Error! Can't continue. The user id passed to the Tool Activity does not refer to an existing user. +error.tab.contentId.required =Sorry, the screen is not available. The Tool Activity requires a content id. +monitoring.feedback.instructionUpdate =The content has been updated successfully. + +group.label =Group +button.summary =Summary +button.editActivity =Edit Activity +button.stats =Stats +label.edit =Edit +label.update =Update +label.hide =Hide +label.unHide =UnHide +label.hidden =Hidden +label.stats.totalLearners =Total count of learners: +label.stats.allGroups =All Groups: +label.stats.totalAllGroups =Total count of all learners: + +#=========================Error Messages===========================# +error.system.qa=A system exception has occured. Please contact Lams International technical support at 95806666. The error to report is\:
    {0}
    + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaSession.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,364 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +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; + + +/** + * + * @author Ozgur Demirtas + * + * QaSession Value Object + * The value object that maps to our model database table: tl_laqa11_session + * The relevant hibernate mapping resides in: QaSession.hbm.xml + * + * Holds tool sessions + */ +public class QaSession implements Serializable,Comparable, Nullable +{ + static Logger logger = Logger.getLogger(QaSession.class.getName()); + + public final static String INCOMPLETE = "INCOMPLETE"; + + public static final String COMPLETED = "COMPLETED"; + + /** identifier field */ + private Long qaSessionId; + + /** nullable persistent field */ + private Date session_start_date; + + /** nullable persistent field */ + private Date session_end_date; + + /** nullable persistent field */ + private String session_status; + + /** persistent field */ + private QaContent qaContent; + + /** persistent field */ + private Set qaQueUsers; + + private Long qaContentId; + + + + /** full constructor */ + public QaSession(Long qaSessionId, + Date session_start_date, + Date session_end_date, + String session_status, + QaContent qaContent, + Set qaQueUsers) + { + this.qaSessionId = qaSessionId; + this.session_start_date = session_start_date; + this.session_end_date = session_end_date; + this.session_status = session_status; + this.qaContent = qaContent; + this.qaQueUsers = qaQueUsers; + logger.debug(logger + " " + this.getClass().getName() + "in full constructor: QaSession()"); + } + + /** default constructor */ + public QaSession() + { + logger.debug(logger + " " + this.getClass().getName() + "in constructor: QaSession()"); + } + + /** + * Construtor for initializing survey session. + * @param sessionStartDate + * @param sessionStatus + * @param surveyContent + * @param surveyQueUsrs + */ + public QaSession(Long qaSessionId, + Date session_start_date, + String session_status, + QaContent qaContent, + Set qaQueUsers) + { + this(qaSessionId,session_start_date,null,session_status,qaContent,qaQueUsers); + } + + /** + * @hibernate.id + * generator-class="assigned" + * type="java.lang.Long" + * column="survey_session_id" + * + */ + public Long getQaSessionId() + { + return this.qaSessionId; + } + + public void setQaSessionId(Long qaSessionId) + { + this.qaSessionId = qaSessionId; + } + + /** + * @hibernate.property + * column="session_start_date" + * length="10" + * + */ + public Date getSession_start_date() + { + return this.session_start_date; + } + + public void setSession_start_date(Date session_start_date) + { + this.session_start_date = session_start_date; + } + + /** + * @hibernate.property + * column="session_end_date" + * length="10" + * + */ + public Date getSession_end_date() + { + return this.session_end_date; + } + + public void setSession_end_date(Date session_end_date) + { + this.session_end_date = session_end_date; + } + + + /** + * @hibernate.property column="session_status" length="128" + * @return Returns the sessionStatus. + */ + public String getSession_status() + { + return session_status; + } + /** + * @param sessionStatus The sessionStatus to set. + */ + public void setSession_status(String session_status) + { + this.session_status = session_status; + } + + /** + * @hibernate.many-to-one + * not-null="true" + * @hibernate.column name="survey_content_id" + * + */ + public QaContent getQaContent() + { + return this.qaContent; + } + + public void setQaContent(QaContent qaContent) + { + this.qaContent = qaContent; + } + + /** + * @hibernate.set lazy="false" inverse="true" cascade="all-delete-orphan" + * @hibernate.collection-key column="survey_session_id" + * @hibernate.collection-one-to-many + * class="org.lamsfoundation.lams.tool.survey.SurveyQueUsr" + * + */ + public Set getQaQueUsers() + { + if (this.qaQueUsers == null) + setQaQueUsers(new TreeSet()); + return this.qaQueUsers; + } + + + + public void setQaQueUsers(Set qaQueUsers) + { + this.qaQueUsers = qaQueUsers; + } + + + //--------------------------------------------------------------------- + // Domain Service Methods + //--------------------------------------------------------------------- + /** + * + * @param responses + */ + + + public void removeQueUsersBy(List responses) + { + //make a copy of que user to avoid concurrent modification exception + Set queUserSet = new TreeSet(this.getQaQueUsers()); + + /* + for (Iterator i = queUserSet.iterator(); i.hasNext();) + { + SurveyQueUsr curUser = (SurveyQueUsr) i.next(); + //remove question user object if no new response has reference + //to it. + if (!curUser.checkUpQueUsrHas(responses)) + this.getSurveyQueUsrs().remove(curUser); + } + */ + } + + + + /** + * + * @param responses + */ + + + public void updateQueUsersBy(List responses) + { + for (Iterator i = this.getQaQueUsers().iterator(); i.hasNext();) + { + /* + SurveyQueUsr curUser = (SurveyQueUsr) i.next(); + if (curUser.checkUpQueUsrHas(responses)) + curUser.updateQueUsr(responses); + */ + } + } + + /** + * @param responses + */ + + public void addNewQueUsersBy(List responses) + { + //make a defensive a copy to avoid mutation from outside. + ArrayList resps = new ArrayList(responses); + for(Iterator i = resps.iterator();i.hasNext();) + { + /* + SurveyUsrResp response = (SurveyUsrResp)i.next(); + SurveyQueUsr queUser = response.getSurveyQueUsr(); + if(!isQueUsrExist(queUser)) + this.getSurveyQueUsrs().add(queUser); + */ + } + } + + + /** + * @param queUser + * @return + */ + + /* + private boolean isQueUsrExist(SurveyQueUsr queUser) + { + for(Iterator i = this.getSurveyQueUsrs().iterator();i.hasNext();) + { + + SurveyQueUsr curUser = (SurveyQueUsr)i.next(); + if(curUser.getSurveyQueContent().equals(queUser.getSurveyQueContent())) + return true; + } + return false; + } + */ + + public String toString() + { + return new ToStringBuilder(this).append("qaSessionId",getQaSessionId()) + .append("session start date",getSession_start_date()) + .append("session end date",getSession_end_date()) + .append("session status",getSession_status()) + .toString(); + } + + + + public boolean equals(Object other) + { + if (!(other instanceof QaSession)) + return false; + + QaSession castOther = (QaSession) other; + return new EqualsBuilder().append(this.getQaSessionId(), + castOther.getQaSessionId()) + .isEquals(); + + } + + public int hashCode() + { + return new HashCodeBuilder(). + append(getQaSessionId()). + toHashCode(); + + } + + + public int compareTo(Object o) + { + QaSession qaSession = (QaSession) o; + return (int) (qaSessionId.longValue() - qaSession.qaSessionId.longValue()); + } + + /** + * This object should not be null. + * @see org.lamsfoundation.lams.tool.survey.Nullable#isNull() + */ + public boolean isNull() + { + return false; + } + + /** + * @return Returns the qaContentId. + */ + public Long getQaContentId() { + return qaContentId; + } + /** + * @param qaContentId The qaContentId to set. + */ + public void setQaContentId(Long qaContentId) { + this.qaContentId = qaContentId; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaStringComparator.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaStringComparator.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaStringComparator.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,40 @@ +/* + * Created on 20/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.Comparator; + +import org.apache.log4j.Logger; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * A comparator implementation that can be used as a constructor to collections. + * The TreeMap in the web layer makes use of it. + * + */ +public class QaStringComparator implements Comparator, Serializable { + static Logger logger = Logger.getLogger(QaStringComparator.class.getName()); + + public int compare(Object o1, Object o2) { + String s1 = (String)o1; + String s2 = (String)o2; + + return s1.compareTo(s2); + } + + public boolean equals(Object o) { + String s = (String)o; + return compare(this, o)==0; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,187 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +/** + * + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * QaQueContent Value Object + * The value object that maps to our model database table: tl_laqa11_que_content + * The relevant hibernate mapping resides in: QaQueContent.hbm.xml + * + * Holds question content within a particular content + */ + +public class QaUploadedFile implements Serializable +{ + /** identifier field */ + private Long submissionId; + + /** persistent field */ + private String uuid; + + /** persistent field */ + private boolean fileOnline; + + /** persistent field */ + private String fileName; + + private Long qaContentId; + + /** persistent field */ + private QaContent qaContent; + + public QaUploadedFile(){}; + + /** full constructor */ + public QaUploadedFile(Long submissionId, + String uuid, + boolean fileOnline, + String fileName, + QaContent qaContent) + { + this.submissionId=submissionId; + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.qaContent=qaContent; + } + + public QaUploadedFile(String uuid, + boolean fileOnline, + String fileName, + QaContent qaContent) + { + this.uuid = uuid; + this.fileOnline = fileOnline; + this.fileName = fileName; + this.qaContent=qaContent; + } + + + public String toString() { + return new ToStringBuilder(this) + .append("uuid: ", getUuid()) + .append("fileName: ", getFileName()) + .toString(); + } + + public boolean equals(Object other) { + if ( !(other instanceof QaUploadedFile) ) return false; + QaUploadedFile castOther = (QaUploadedFile) 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 qaContent. + */ + public QaContent getQaContent() { + return qaContent; + } + /** + * @param qaContent The qaContent to set. + */ + public void setQaContent(QaContent qaContent) { + this.qaContent = qaContent; + } + /** + * @return Returns the qaContentId. + */ + public Long getQaContentId() { + return qaContentId; + } + /** + * @param qaContentId The qaContentId to set. + */ + public void setQaContentId(Long qaContentId) { + this.qaContentId = qaContentId; + } + /** + * @return Returns the submissionId. + */ + public Long getSubmissionId() { + return submissionId; + } + /** + * @param submissionId The submissionId to set. + */ + public void setSubmissionId(Long submissionId) { + this.submissionId = submissionId; + } + /** + * @return Returns the uuid. + */ + public String getUuid() { + return uuid; + } + /** + * @param uuid The uuid to set. + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + /** + * @return Returns the fileOnline. + */ + public boolean isFileOnline() { + return fileOnline; + } + /** + * @param fileOnline The fileOnline to set. + */ + public void setFileOnline(boolean fileOnline) { + this.fileOnline = fileOnline; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,339 @@ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * + * @author Ozgur Demirtas + * + * QaUsrResp Value Object + * The value object that maps to our model database table: tl_laqa11_usr_resp + * The relevant hibernate mapping resides in: QaQueResp.hbm.xml + * + * Holds user responses to questions + */ + +public class QaUsrResp implements Serializable, Comparable { + + /** identifier field */ + private Long responseId; + + /** nullable persistent field */ + private String answer; + + /** nullable persistent field */ + private boolean hidden; + + /** nullable persistent field */ + private Date attemptTime; + + /** nullable persistent field */ + private QaQueContent qaQueContent; + + /** nullable persistent field */ + private Long qaQueContentId; //added to enable deletion by the resp dao + + /** nullable persistent field */ + private Long queUsrId; //added to enable deletion by the resp dao + + /** nullable persistent field */ + private QaQueUsr qaQueUser; + + /** nullable persistent field */ + private String timezone; + + /** full constructor */ + public QaUsrResp(Long responseId, + String answer, + boolean hidden, + Date attemptTime, + String timezone, + QaQueContent qaQueContent, + QaQueUsr qaQueUser) { + this.responseId =responseId; + this.answer = answer; + this.hidden = hidden; + this.attemptTime = attemptTime; + this.timezone = timezone; + this.qaQueContent = qaQueContent; + this.qaQueUser = qaQueUser; + } + + public QaUsrResp(String answer, + boolean hidden, + Date attemptTime, + String timezone, + QaQueContent qaQueContent, + QaQueUsr qaQueUser) { + this.answer = answer; + this.hidden = hidden; + this.attemptTime = attemptTime; + this.timezone = timezone; + this.qaQueContent = qaQueContent; + this.qaQueUser = qaQueUser; + } + + + public QaUsrResp(String answer, + Date attemptTime, + QaQueContent question) + { + this.answer = answer; + this.attemptTime = attemptTime; + this.qaQueContent = question; + } + + /** default constructor */ + public QaUsrResp(){} + + /** + * Copy construtor. Delegate to full construtor to achieve the object + * creation. + * @param response the original survey user response + * @return the new qa user response cloned from original object + */ + public static QaUsrResp newInstance(QaUsrResp response) + { + return new QaUsrResp(response.getResponseId(), + response.getAnswer(), + response.isHidden(), + response.getAttemptTime(), + response.getTimezone(), + response.getQaQueContent(), + response.qaQueUser); + } + + + + public String toString() { + return new ToStringBuilder(this) + .append("responseId: ", getResponseId()) + .append("answer:", getAnswer()) + .append("attempt time: ", getAttemptTime()) + .toString(); + } + + public boolean equals(Object other) { + if ( !(other instanceof QaUsrResp) ) return false; + QaUsrResp castOther = (QaUsrResp) other; + return new EqualsBuilder() + .append(this.getResponseId(), castOther.getResponseId()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder() + .append(getResponseId()) + .toHashCode(); + } + + /** + * @return Returns the answer. + */ + public String getAnswer() { + return answer; + } + /** + * @param answer The answer to set. + */ + public void setAnswer(String answer) { + this.answer = answer; + } + /** + * @return Returns the attemptTime. + */ + public Date getAttemptTime() { + return attemptTime; + } + /** + * @param attemptTime The attemptTime to set. + */ + public void setAttemptTime(Date attemptTime) { + this.attemptTime = attemptTime; + } + /** + * @return Returns the qaQueContent. + */ + public QaQueContent getQaQueContent() { + return qaQueContent; + } + /** + * @param qaQueContent The qaQueContent to set. + */ + public void setQaQueContent(QaQueContent qaQueContent) { + this.qaQueContent = qaQueContent; + } + /** + * @return Returns the qaQueUsr. + */ + public QaQueUsr getQaQueUser() { + return qaQueUser; + } + /** + * @param qaQueUsr The qaQueUsr to set. + */ + public void setQaQueUser(QaQueUsr qaQueUser) { + this.qaQueUser = qaQueUser; + } + /** + * @return Returns the responseId. + */ + public Long getResponseId() { + return responseId; + } + /** + * @param responseId The responseId to set. + */ + public void setResponseId(Long responseId) { + this.responseId = responseId; + } + + + /** + * @param responses + * @return + */ + public boolean doesRespExistIn(List responses) + { + for(Iterator i = responses.iterator();i.hasNext();) + { + QaUsrResp resp = (QaUsrResp)i.next(); + if((resp.getAnswer().trim()).equals(this.getAnswer().trim()) + &&resp.getQaQueUser().getQueUsrId()==this.getQaQueUser().getQueUsrId()) + return true; + } + return false; + } + + + /** + * @param responses + */ + public void updateResponseBy(List responses) + { + for(Iterator i = responses.iterator();i.hasNext();) + { + QaUsrResp resp = (QaUsrResp)i.next(); + if(resp.getQaQueUser().getQueUsrId()==this.getQaQueUser().getQueUsrId()) +// && resp.getQaAnsContent().getDisplayOrder()==this.getQaAnsContent().getDisplayOrder()) + this.updateResponse(resp); + + } + } + + /** + * The response is not valid if it doesn't have a reference to question + * object and question user object. + * @param resp the response to be validated + * @return the validation result. + */ + public boolean isResponseValid() + { + return this.getQaQueUser()!=null && this.getQaQueContent()!=null; + // &&this.getQaAnsContent()!=null; + } + + + /** + * Update current object according to the new response object. + * @param resp + */ + public void updateResponse(QaUsrResp resp) + { + if(!resp.isResponseValid()) + throw new IllegalArgumentException("Invalid response for update "); + + this.setAnswer(resp.getAnswer()); + this.setAttemptTime(resp.getAttemptTime()); + this.setQaQueContent(resp.getQaQueContent()); + + this.setQaQueUser(resp.getQaQueUser()); + + } + + + /** + * Validate whether the current response is correspondent to an author + * defined answer. + * + * @return boolean value + */ + public boolean isPredefinedResponse() + { + //may need to add more logic here + return false; + } + + + public int compareTo(Object o) + { + QaUsrResp response = (QaUsrResp) o; + + if (responseId == null) + return -1; + if (response.responseId == null) + return 1; + + return (int) (responseId.longValue() - response.responseId.longValue()); + } + + + + /** + * @return Returns the qaQueContentId. + */ + public Long getQaQueContentId() { + return qaQueContentId; + } + /** + * @param qaQueContentId The qaQueContentId to set. + */ + public void setQaQueContentId(Long qaQueContentId) { + this.qaQueContentId = qaQueContentId; + } + /** + * @return Returns the queUsrId. + */ + public Long getQueUsrId() { + return queUsrId; + } + /** + * @param queUsrId The queUsrId to set. + */ + public void setQueUsrId(Long queUsrId) { + this.queUsrId = queUsrId; + } + /** + * @return Returns the hidden. + */ + public boolean isHidden() { + return hidden; + } + /** + * @param hidden The hidden to set. + */ + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + /** + * @return Returns the timezone. + */ + public String getTimezone() { + return timezone; + } + /** + * @param timezone The timezone to set. + */ + public void setTimezone(String timezone) { + this.timezone = timezone; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUtils.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUtils.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/QaUtils.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,768 @@ +/* + * Created on 21/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.security.Principal; +import java.text.DateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.TimeZone; +import java.util.TreeMap; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.contentrepository.NodeKey; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.web.QaAuthoringForm; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** + * + * + * The session attributes ATTR_USERDATA refer to the same User object. + * + * Verify the assumption: + * We make the assumption that the obtained User object will habe a userId property ready in it. + * We use the same userId property as the user table key when we are saving learner responses and associated user data. + * * + */ + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * Common utility functions live here. + */ +public abstract class QaUtils implements QaAppConstants { + + static Logger logger = Logger.getLogger(QaUtils.class.getName()); + + public static IQaService getToolService(HttpServletRequest request) + { + IQaService qaService=(IQaService)request.getSession().getAttribute(TOOL_SERVICE); + return qaService; + } + + + /** + * generateId() + * return long + * IMPORTANT: The way we obtain either content id or tool session id must be modified + * so that we only use lams common to get these ids. This functionality is not + * available yet in the lams common as of 21/04/2005. + */ + public static long generateId() + { + Random generator = new Random(); + long longId=generator.nextLong(); + if (longId < 0) longId=longId * (-1) ; + return longId; + } + + /** + * helps create a mock user object in development time. + * static long generateIntegerId() + * @return long + */ + public static int generateIntegerId() + { + Random generator = new Random(); + int intId=generator.nextInt(); + if (intId < 0) intId=intId * (-1) ; + return intId; + } + + + + /** + * cleanupSession(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * cleans up the session of the content details + */ + + public static void cleanupSession(HttpServletRequest request) + { + //remove session attributes in Authoring mode + request.getSession().removeAttribute(DEFAULT_QUESTION_CONTENT); + request.getSession().removeAttribute(MAP_QUESTION_CONTENT); + request.getSession().removeAttribute(CHOICE); + request.getSession().removeAttribute(IS_DEFINE_LATER); + request.getSession().removeAttribute(DISABLE_TOOL); + request.getSession().removeAttribute(CHOICE_TYPE_BASIC); + request.getSession().removeAttribute(CHOICE_TYPE_ADVANCED); + request.getSession().removeAttribute(CHOICE_TYPE_INSTRUCTIONS); + request.getSession().removeAttribute(REPORT_TITLE); + request.getSession().removeAttribute(INSTRUCTIONS); + request.getSession().removeAttribute(TITLE); + request.getSession().removeAttribute(CONTENT_LOCKED); + + + //remove session attributes in Learner mode + request.getSession().removeAttribute(MAP_ANSWERS); + request.getSession().removeAttribute(MAP_QUESTION_CONTENT_LEARNER); + request.getSession().removeAttribute(CURRENT_QUESTION_INDEX); + request.getSession().removeAttribute(TOTAL_QUESTION_COUNT); + request.getSession().removeAttribute(CURRENT_ANSWER); + request.getSession().removeAttribute(USER_FEEDBACK); + request.getSession().removeAttribute(TOOL_SESSION_ID); + request.getSession().removeAttribute(QUESTION_LISTING_MODE); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_SEQUENTIAL); + request.getSession().removeAttribute(QUESTION_LISTING_MODE_COMBINED); + request.getSession().removeAttribute(MAP_USER_RESPONSES); + request.getSession().removeAttribute(MAP_MAIN_REPORT); + request.getSession().removeAttribute(REPORT_TITLE_LEARNER); + request.getSession().removeAttribute(END_LEARNING_MESSAGE); + request.getSession().removeAttribute(IS_TOOL_ACTIVITY_OFFLINE); + + //remove session attributes in Monitoring mode + request.getSession().removeAttribute(MAP_TOOL_SESSIONS); + request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS); + + //remove session attributes used commonly + request.getSession().removeAttribute(IS_USERNAME_VISIBLE); + request.getSession().removeAttribute(REPORT_TITLE_MONITOR); + request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED); + request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); + request.getSession().removeAttribute(TOOL_CONTENT_ID); + request.getSession().removeAttribute(ATTR_USERDATA); + request.getSession().removeAttribute(TOOL_SERVICE); + request.getSession().removeAttribute(TARGET_MODE); + + } + + public static void setDefaultSessionAttributes(HttpServletRequest request, QaContent defaultQaContent, QaAuthoringForm qaAuthoringForm) + { + /**should never be null anyway as default content MUST exist in the db*/ + if (defaultQaContent != null) + { + qaAuthoringForm.setTitle(defaultQaContent.getTitle()); + qaAuthoringForm.setInstructions(defaultQaContent.getInstructions()); + qaAuthoringForm.setReportTitle(defaultQaContent.getReportTitle()); + qaAuthoringForm.setEndLearningMessage(defaultQaContent.getEndLearningMessage()); + qaAuthoringForm.setOnlineInstructions(defaultQaContent.getOnlineInstructions()); + qaAuthoringForm.setOfflineInstructions(defaultQaContent.getOfflineInstructions()); + qaAuthoringForm.setMonitoringReportTitle(defaultQaContent.getMonitoringReportTitle()); + + request.getSession().setAttribute(TITLE,qaAuthoringForm.getTitle()); + request.getSession().setAttribute(INSTRUCTIONS,qaAuthoringForm.getInstructions()); + + request.getSession().setAttribute(RICHTEXT_TITLE, defaultQaContent.getTitle()); + request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS, defaultQaContent.getInstructions()); + request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,defaultQaContent.getOfflineInstructions()); + request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,defaultQaContent.getOnlineInstructions()); + } + } + + + /** + * Helper method to retrieve the user data. We always load up from http + * session first to optimize the performance. If no session cache available, + * we load it from data source. + * @param request A standard Servlet HttpServletRequest class. + * @param surveyService the service facade of qa tool + * @return the user data value object + */ + public static User getUserData(HttpServletRequest request,IQaService qaService) throws QaApplicationException + { + User userCompleteData = (User) request.getSession().getAttribute(ATTR_USERDATA); + logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData: " + userCompleteData); + /** + * if no session cache available, retrieve it from data source + */ + if (userCompleteData == null) + { + /** + * WebUtil.getUsername(request,DEVELOPMENT_FLAG) returns the current learner's username based on + * user principals defined in the container. If no username is defined in the container, we get a RunTimeException. + */ + + /** + * pass testing flag as false to obtain user principal + */ + try + { + String userName=getUsername(request,false); + userCompleteData = qaService.getCurrentUserData(userName); + } + catch(QaApplicationException e) + { + logger.debug(logger + " " + "QaUtils" + " Exception occured: Tool expects the current user is an authenticated user and he has a security principal defined. Can't continue!: " + e); + throw new QaApplicationException("Exception occured: " + + "Tool expects the current user is an authenticated user and he has a security principal defined. Can't continue!"); + } + + logger.debug(logger + " " + "QaUtils" + "retrieving userCompleteData from service: " + userCompleteData); + //this can be redundant as we keep the User data in TOOL_USER + request.getSession().setAttribute(ATTR_USERDATA, userCompleteData); + } + return userCompleteData; + } + + public static int getCurrentUserId(HttpServletRequest request) throws QaApplicationException + { + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug(logger + " " + "QaUtils" + " Current user is: " + user + " with id: " + user.getUserID()); + return user.getUserID().intValue(); + } + + + /** + * Modified to throw QaApplicationException insteadof RuntimeException + * String getUsername(HttpServletRequest req,boolean isTesting) throws RuntimeException + * is normally lives in package org.lamsfoundation.lams.util. It generates Runtime exception when the user principal + * is not found. We find this not too usefulespeciaaly in teh development time. Below is a local and modified version + * of this function. + * + * @return username from principal object + */ + public static String getUsername(HttpServletRequest req,boolean isTesting) throws QaApplicationException + { + if(isTesting) + return "test"; + + Principal principal = req.getUserPrincipal(); + if (principal == null) + { + throw new QaApplicationException("Trying to get username but principal object missing. Request is " + + req.toString()); + } + + String username = principal.getName(); + if (username == null) + { + throw new QaApplicationException("Name missing from principal object. Request is " + + req.toString() + + " Principal object is " + + principal.toString()); + } + return username; + } + + + /** + * This method exists temporarily until we have the user data is passed properly from teh container to the tool + * createMockUser() + * @return User + */ + public static User createMockUser() + { + logger.debug(logger + " " + "QaUtils" + " request for new new mock user"); + int randomUserId=generateIntegerId(); + User mockUser=new User(); + mockUser.setUserId(new Integer(randomUserId)); + mockUser.setFirstName(MOCK_USER_NAME + randomUserId); + mockUser.setLastName(MOCK_USER_LASTNAME + randomUserId); + mockUser.setLogin(MOCK_LOGIN_NAME + randomUserId); //we assume login and username refers to the same property + logger.debug(logger + " " + "QaUtils" + " created mockuser: " + mockUser); + return mockUser; + } + + + + public static User createSimpleUser(Integer userId) + { + User user=new User(); + user.setUserId(userId); + return user; + } + + public static User createUser(Integer userId) + { + User user=new User(); + user.setUserId(userId); + + int randomUserId=generateIntegerId(); + user.setFirstName(MOCK_USER_NAME + randomUserId); + user.setLastName(MOCK_USER_LASTNAME + randomUserId); + user.setLogin(MOCK_LOGIN_NAME + randomUserId); + return user; + } + + public static boolean getDefineLaterStatus() + { + return false; + } + + + /** + * existsContent(long toolContentId) + * @param long toolContentId + * @return boolean + * determine whether a specific toolContentId exists in the db + */ + public static boolean existsContent(long toolContentId, HttpServletRequest request) + { + /** + * retrive the service + */ + IQaService qaService =QaUtils.getToolService(request); + + QaContent qaContent=qaService.loadQa(toolContentId); + logger.debug(logger + " " + "QaUtils " + "retrieving qaContent: " + qaContent); + if (qaContent == null) + return false; + + return true; + } + + /** + * it is expected that the tool session id already exists in the tool sessions table + * existsSession(long toolSessionId) + * @param toolSessionId + * @return boolean + */ + public static boolean existsSession(long toolSessionId, HttpServletRequest request) + { + /** + * get the service + */ + logger.debug("existsSession"); + IQaService qaService =QaUtils.getToolService(request); + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId); + logger.debug("qaSession:" + qaSession); + + if (qaSession == null) + return false; + + return true; + } + + + public static String getFormattedDateString(Date date) + { + logger.debug(logger + " " + " QaUtils getFormattedDateString: " + + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); + return (DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(date)); + } + + public static void persistTimeZone(HttpServletRequest request) + { + TimeZone timeZone=TimeZone.getDefault(); + logger.debug("current timezone: " + timeZone.getDisplayName()); + request.getSession().setAttribute(TIMEZONE, timeZone.getDisplayName()); + logger.debug("current timezone id: " + timeZone.getID()); + request.getSession().setAttribute(TIMEZONE_ID, timeZone.getID()); + } + + public static void persistRichText(HttpServletRequest request) + { + String richTextOfflineInstructions=request.getParameter(RICHTEXT_OFFLINEINSTRUCTIONS); + logger.debug("read parameter richTextOfflineInstructions: " + richTextOfflineInstructions); + String richTextOnlineInstructions=request.getParameter(RICHTEXT_ONLINEINSTRUCTIONS); + logger.debug("read parameter richTextOnlineInstructions: " + richTextOnlineInstructions); + + if ((richTextOfflineInstructions != null) && (richTextOfflineInstructions.length() > 0)) + { + request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS,richTextOfflineInstructions); + } + + if ((richTextOnlineInstructions != null) && (richTextOnlineInstructions.length() > 0)) + { + request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS,richTextOnlineInstructions); + } + + String richTextTitle=request.getParameter(RICHTEXT_TITLE); + logger.debug("read parameter richTextTitle: " + richTextTitle); + String richTextInstructions=request.getParameter(RICHTEXT_INSTRUCTIONS); + logger.debug("read parameter richTextInstructions: " + richTextInstructions); + + if ((richTextTitle != null) && (richTextTitle.length() > 0)) + { + request.getSession().setAttribute(RICHTEXT_TITLE,richTextTitle); + } + + if ((richTextInstructions != null) && (richTextInstructions.length() > 0)) + { + request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,richTextInstructions); + } + } + + public static void configureContentRepository(HttpServletRequest request) + { + logger.debug("attempt configureContentRepository"); + IQaService qaService =QaUtils.getToolService(request); + logger.debug("retrieving qaService from session: " + qaService); + logger.debug("calling configureContentRepository()"); + qaService.configureContentRepository(); + logger.debug("configureContentRepository ran successfully"); + } + + public static void addFileToContentRepository(HttpServletRequest request, QaAuthoringForm qaAuthoringForm, boolean isOfflineFile) + { + logger.debug("attempt addFileToContentRepository"); + IQaService qaService =QaUtils.getToolService(request); + logger.debug("qaService: " + qaService); + + Boolean populateUploadedFilesData=(Boolean)request.getSession().getAttribute(POPULATED_UPLOADED_FILESDATA); + logger.debug("boolean populateUploadedFilesData: " + populateUploadedFilesData); + + if ((populateUploadedFilesData !=null) && (populateUploadedFilesData.booleanValue())) + { + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + QaContent defaultQaContent=qaService.loadQa(new Long(toolContentId).longValue()); + logger.debug("defaultQaContent: " + defaultQaContent); + + populateUploadedFilesMetaDataFromDb(request, defaultQaContent); + logger.debug("done populateUploadedFilesMetaDataFromDb"); + } + + + List listUploadedOfflineFilesUuid = (List) request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID); + logger.debug("listUploadedOfflineFilesUuid: " + listUploadedOfflineFilesUuid); + + List listUploadedOfflineFilesName = (List) request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME); + logger.debug("listUploadedOfflineFilesName: " + listUploadedOfflineFilesName); + + List listUploadedOnlineFilesUuid = (List) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILES_UUID); + logger.debug("listUploadedOnlineFilesUuid: " + listUploadedOnlineFilesUuid); + + List listUploadedOnlineFilesName = (List) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILES_NAME); + logger.debug("listUploadedOnlineFilesName: " + listUploadedOnlineFilesName); + + List listUploadedOfflineFiles= (List) request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILES); + logger.debug("listUploadedOfflineFiles: " + listUploadedOfflineFiles); + + List listUploadedOfflineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); + logger.debug("listUploadedOfflineFiles: " + listUploadedOfflineFiles); + + List listUploadedOnlineFileNames=(List)request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILENAMES); + logger.debug("listUploadedOnlineFileNames: " + listUploadedOnlineFileNames); + + + if (listUploadedOfflineFileNames == null) + listUploadedOfflineFileNames = new LinkedList(); + logger.debug("listUploadedOfflineFileNames: " + listUploadedOfflineFileNames); + + if (listUploadedOnlineFileNames == null) + listUploadedOnlineFileNames = new LinkedList(); + logger.debug("listUploadedOnlineFileNames: " + listUploadedOnlineFileNames); + + Map allOfflineUuids= new TreeMap(new QaComparator()); + if ((listUploadedOfflineFilesUuid != null) && (listUploadedOfflineFilesName != null)) + { + logger.debug("listUploadedOfflineFilesUuid and listUploadedOfflineFilesName are not null"); + Iterator listUploadedOfflineFilesUuidIterator=listUploadedOfflineFilesUuid.iterator(); + int counter=1; + logger.debug("allOfflineUuids: " + allOfflineUuids); + while (listUploadedOfflineFilesUuidIterator.hasNext()) + { + String uuid = (String)listUploadedOfflineFilesUuidIterator.next(); + allOfflineUuids.put(new Integer(counter).toString(), uuid); + counter++; + } + logger.debug("allOfflineUuids: " + allOfflineUuids); + Iterator listUploadedOfflineFilesNameIterator=listUploadedOfflineFilesName.iterator(); + + counter=1; + while (listUploadedOfflineFilesNameIterator.hasNext()) + { + String fileName = (String)listUploadedOfflineFilesNameIterator.next(); + if (!offLineFileNameExists(request,fileName)) + { + logger.debug("reading with counter: " + new Integer(counter).toString()); + String uuid=(String)allOfflineUuids.get(new Integer(counter).toString()); + logger.debug("parsed uuid: " + uuid); + listUploadedOfflineFiles.add(uuid + '~'+ fileName); + counter++; + } + else + { + logger.debug("offline fileName exists: " +fileName); + } + } + logger.debug("final listUploadedOfflineFiles: " + listUploadedOfflineFiles); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOfflineFiles); + } + /* + List listUploadedOfflineFileNames = (List) request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); + logger.debug("listUploadedOfflineFileNames: " + listUploadedOfflineFileNames); + + + List listUploadedOnlineFileNames = (List) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILENAMES); + logger.debug("listUploadedOnlineFileNames: " + listUploadedOnlineFileNames); + */ + + + /**holds final online files list */ + List listUploadedOnlineFiles= (List) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILES); + logger.debug("listUploadedOnlineFiles: " + listUploadedOnlineFiles); + + Map allOnlineUuids= new TreeMap(new QaComparator()); + if ((listUploadedOnlineFilesUuid != null) && (listUploadedOnlineFilesName != null)) + { + logger.debug("listUploadedOnlineFilesUuid and listUploadedOnlineFilesName are not null"); + Iterator listUploadedOnlineFilesUuidIterator=listUploadedOnlineFilesUuid.iterator(); + int counter=1; + logger.debug("allOnlineUuids: " + allOnlineUuids); + while (listUploadedOnlineFilesUuidIterator.hasNext()) + { + String uuid = (String)listUploadedOnlineFilesUuidIterator.next(); + allOnlineUuids.put(new Integer(counter).toString(), uuid); + counter++; + + } + logger.debug("allOnlineUuids: " + allOnlineUuids); + Iterator listUploadedOnlineFilesNameIterator=listUploadedOnlineFilesName.iterator(); + + counter=1; + while (listUploadedOnlineFilesNameIterator.hasNext()) + { + String fileName = (String)listUploadedOnlineFilesNameIterator.next(); + if (!onLineFileNameExists(request,fileName)) + { + logger.debug("reading with counter: " + new Integer(counter).toString()); + String uuid=(String)allOnlineUuids.get(new Integer(counter).toString()); + logger.debug("parsed uuid: " + uuid); + listUploadedOnlineFiles.add(uuid + '~'+ fileName); + counter++; + } + else + { + logger.debug("online fileName exists: " +fileName); + } + + + } + logger.debug("final listUploadedOnlineFiles: " + listUploadedOnlineFiles); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES,listUploadedOnlineFiles); + } + + + if (isOfflineFile) + { + /** read uploaded file informtion - offline file*/ + logger.debug("retrieve theOfflineFile."); + FormFile theOfflineFile = qaAuthoringForm.getTheOfflineFile(); + logger.debug("retrieved theOfflineFile: " + theOfflineFile); + + String offlineFileName=""; + NodeKey nodeKey=null; + String offlineFileUuid=""; + try + { + InputStream offlineFileInputStream = theOfflineFile.getInputStream(); + logger.debug("retrieved offlineFileInputStream: " + offlineFileInputStream); + offlineFileName=theOfflineFile.getFileName(); + logger.debug("retrieved offlineFileName: " + offlineFileName); + nodeKey=qaService.uploadFileToRepository(offlineFileInputStream, offlineFileName); + logger.debug("repository returned nodeKey: " + nodeKey); + logger.debug("repository returned offlineFileUuid nodeKey uuid: " + nodeKey.getUuid()); + offlineFileUuid=nodeKey.getUuid().toString(); + logger.debug("offline file added to contentRepository"); + logger.debug("using listUploadedOfflineFiles: " + listUploadedOfflineFiles); + listUploadedOfflineFiles.add(offlineFileUuid + "~" + offlineFileName); + logger.debug("listUploadedOfflineFiles updated: " + listUploadedOfflineFiles); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOfflineFiles); + + listUploadedOfflineFileNames.add(offlineFileName); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); + } + catch(FileNotFoundException e) + { + logger.debug("exception occured, offline file not found : " + e.getMessage()); + //possibly give warning to user in request scope + } + catch(IOException e) + { + logger.debug("exception occured in offline file transfer: " + e.getMessage()); + //possibly give warning to user in request scope + } + catch(QaApplicationException e) + { + logger.debug("exception occured in accessing the repository server: " + e.getMessage()); + //possibly give warning to user in request scope + } + } + else + { + /** read uploaded file information - online file*/ + logger.debug("retrieve theOnlineFile"); + FormFile theOnlineFile = qaAuthoringForm.getTheOnlineFile(); + logger.debug("retrieved theOnlineFile: " + theOnlineFile); + + String onlineFileName=""; + NodeKey nodeKey=null; + String onlineFileUuid=""; + try + { + InputStream onlineFileInputStream = theOnlineFile.getInputStream(); + logger.debug("retrieved onlineFileInputStream: " + onlineFileInputStream); + onlineFileName=theOnlineFile.getFileName(); + logger.debug("retrieved onlineFileName: " + onlineFileName); + nodeKey=qaService.uploadFileToRepository(onlineFileInputStream, onlineFileName); + logger.debug("repository returned nodeKey: " + nodeKey); + logger.debug("repository returned onlineFileUuid nodeKey uuid: " + nodeKey.getUuid()); + onlineFileUuid=nodeKey.getUuid().toString(); + logger.debug("online file added to contentRepository"); + listUploadedOnlineFiles.add(onlineFileUuid + "~" + onlineFileName); + logger.debug("listUploadedOnlineFiles updated: " + listUploadedOnlineFiles); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES,listUploadedOnlineFiles); + + listUploadedOnlineFileNames.add(onlineFileName); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); + } + catch(FileNotFoundException e) + { + logger.debug("exception occured, online file not found : " + e.getMessage()); + //possibly give warning to user in request scope + } + catch(IOException e) + { + logger.debug("exception occured in online file transfer: " + e.getMessage()); + //possibly give warning to user in request scope + } + catch(QaApplicationException e) + { + logger.debug("exception occured in accessing the repository server: " + e.getMessage()); + //possibly give warning to user in request scope + } + } + + + if ((populateUploadedFilesData != null) && (populateUploadedFilesData.booleanValue())) + { + logger.debug("removing ofline + online file list attributes"); + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID); + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_UUID); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_NAME); + } + } + + static boolean offLineFileNameExists(HttpServletRequest request,String fileName) + { + logger.debug("attempt populateUploadedFilesData"); + IQaService qaService =QaUtils.getToolService(request); + logger.debug("qaService: " + qaService); + + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + QaContent defaultQaContent=qaService.loadQa(new Long(toolContentId).longValue()); + logger.debug("defaultQaContent: " + defaultQaContent); + + /** read the uploaded offline uuid + file name pair */ + List listOfflineFilesName=new LinkedList(); + listOfflineFilesName=qaService.retrieveQaUploadedOfflineFilesName(defaultQaContent); + logger.debug("listOfflineFilesName: " + listOfflineFilesName); + + Iterator listOfflineFilesNameIterator=listOfflineFilesName.iterator(); + while (listOfflineFilesNameIterator.hasNext()) + { + String currentFileName = (String)listOfflineFilesNameIterator.next(); + logger.debug("currentFileName: " + currentFileName); + if (currentFileName.equalsIgnoreCase(fileName)) + { + logger.debug("existing fileName: " + currentFileName); + return true; + } + } + return false; + } + + static boolean onLineFileNameExists(HttpServletRequest request,String fileName) + { + logger.debug("attempt populateUploadedFilesData"); + IQaService qaService =QaUtils.getToolService(request); + logger.debug("qaService: " + qaService); + + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + QaContent defaultQaContent=qaService.loadQa(new Long(toolContentId).longValue()); + logger.debug("defaultQaContent: " + defaultQaContent); + + /** read the uploaded offline uuid + file name pair */ + List listOnlineFilesName=new LinkedList(); + listOnlineFilesName=qaService.retrieveQaUploadedOnlineFilesName(defaultQaContent); + logger.debug("listOnlineFilesName: " + listOnlineFilesName); + + Iterator listOnlineFilesNameIterator=listOnlineFilesName.iterator(); + while (listOnlineFilesNameIterator.hasNext()) + { + String currentFileName = (String)listOnlineFilesNameIterator.next(); + logger.debug("currentFileName: " + currentFileName); + if (currentFileName.equalsIgnoreCase(fileName)) + { + logger.debug("existing fileName: " + currentFileName); + return true; + } + + } + return false; + } + + public static void populateUploadedFilesData(HttpServletRequest request, QaContent defaultQaContent) + { + populateUploadedFilesMetaDataFromDb(request, defaultQaContent); + request.getSession().setAttribute(POPULATED_UPLOADED_FILESDATA, new Boolean(true)); + } + + + public static void populateUploadedFilesMetaDataFromDb(HttpServletRequest request, QaContent defaultQaContent) + { + logger.debug("attempt populateUploadedFilesData"); + IQaService qaService =QaUtils.getToolService(request); + logger.debug("qaService: " + qaService); + + /** just for jsp purposes ** + /** read the uploaded offline uuid + file name pair */ + List listOfflineFilesUuid=new LinkedList(); + listOfflineFilesUuid=qaService.retrieveQaUploadedOfflineFilesUuid(defaultQaContent); + logger.debug("initial listOfflineFilesUuid: " + listOfflineFilesUuid); + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES_UUID, listOfflineFilesUuid); + + /** read the uploaded online uuid + file name pair */ + List listOnlineFilesUuid=new LinkedList(); + listOnlineFilesUuid=qaService.retrieveQaUploadedOnlineFilesUuid(defaultQaContent); + logger.debug("initial listOnlineFilesUuid: " + listOnlineFilesUuid); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_UUID); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES_UUID, listOnlineFilesUuid); + + + /** read the uploaded offline uuid + file name pair */ + List listOfflineFilesName=new LinkedList(); + listOfflineFilesName=qaService.retrieveQaUploadedOfflineFilesName(defaultQaContent); + logger.debug("initial listOfflineFilesName: " + listOfflineFilesName); + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES_NAME, listOfflineFilesName); + + + /** read the uploaded online uuid + file name pair */ + List listOnlineFilesName=new LinkedList(); + listOnlineFilesName=qaService.retrieveQaUploadedOnlineFilesName(defaultQaContent); + logger.debug("initial listOnlineFilesName: " + listOnlineFilesName); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILES_NAME); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES_NAME, listOnlineFilesName); + + + request.getSession().removeAttribute(LIST_UPLOADED_OFFLINE_FILENAMES); + request.getSession().removeAttribute(LIST_UPLOADED_ONLINE_FILENAMES); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES, listOfflineFilesName); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES, listOnlineFilesName); + } + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/SubmissionDetails.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/SubmissionDetails.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/SubmissionDetails.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,182 @@ +package org.lamsfoundation.lams.tool.qa; + +import java.io.Serializable; +import java.util.Date; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +public class SubmissionDetails implements Serializable{ + /** identifier field */ + private Long submissionID; + + /** persistent field */ + private String filePath; + + /** persistent field */ + private String fileDescription; + + /** persistent field */ + private Date dateOfSubmission; + + /** persistent field */ + private Long userID; + + /** persistent field */ + private Long uuid; + + /** persistent field */ + private Long versionId; + + /** default constructor */ + public SubmissionDetails() { + } + + /** full constructor */ + public SubmissionDetails(String filePath, Long uuid, Long versionId) { + this.filePath = filePath; + this.uuid = uuid; + this.versionId = versionId; + } + + + /** full constructor */ + public SubmissionDetails(String filePath, String fileDescription, Date dateOfSubmission, Long userID, Long uuid, Long versionId) { + this.filePath = filePath; + this.fileDescription = fileDescription; + this.dateOfSubmission = dateOfSubmission; + this.userID = userID; + this.uuid = uuid; + this.versionId = versionId; + } + + /** + * @hibernate.id generator-class="identity" type="java.lang.Long" + * column="submission_id" + */ + public Long getSubmissionID() { + return this.submissionID; + } + + public void setSubmissionID(Long submissionID) { + this.submissionID = submissionID; + } + + /** + * @hibernate.property column="filePath" length="250" + */ + public String getFilePath() { + return this.filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + /** + * @hibernate.property column="fileDescription" length="250" + */ + public String getFileDescription() { + return this.fileDescription; + } + + public void setFileDescription(String fileDescription) { + this.fileDescription = fileDescription; + } + + /** + * @hibernate.property column="date_of_submission" length="19" + */ + public Date getDateOfSubmission() { + return this.dateOfSubmission; + } + + public void setDateOfSubmission(Date dateOfSubmission) { + this.dateOfSubmission = dateOfSubmission; + } + + /** + * @hibernate.property column="uuid" length="20" + */ + public Long getUuid() { + return this.uuid; + } + + public void setUuid(Long uuid) { + this.uuid = uuid; + } + + /** + * @hibernate.property column="version_id" length="20" + */ + public Long getVersionID() { + return this.versionId; + } + + public void setVersionID(Long versionID) { + this.versionId = versionID; + } + + public String toString() { + return new ToStringBuilder(this) + .append("submissionID",getSubmissionID()).append("filePath", getFilePath()) + .append("fileDescription", getFileDescription()) + .append("dateOfSubmission", getDateOfSubmission()) + .append("uuid",getUuid()) + .append("versionID", getVersionID()) + .append("userID",getUserID()) + .toString(); + } + + public boolean equals(Object other) { + if ((this == other)) + return true; + if (!(other instanceof SubmissionDetails)) + return false; + SubmissionDetails castOther = (SubmissionDetails) other; + return new EqualsBuilder().append(this.getSubmissionID(), + castOther.getSubmissionID()).append(this.getFilePath(), + castOther.getFilePath()).append(this.getFileDescription(), + castOther.getFileDescription()).append( + this.getDateOfSubmission(), castOther.getDateOfSubmission()) + .append(this.getUuid(), castOther.getUuid()) + .append(this.getVersionID(), castOther.getVersionID()) + .append(this.getUserID(),castOther.getUserID()) + .isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder().append(getSubmissionID()).append( + getFilePath()).append(getFileDescription()).append( + getDateOfSubmission()).append(getUuid()).append(getVersionID()) + .toHashCode(); + } + + /** + * @hibernate.property column="user_id" length="20" + * @return Returns the userID. + */ + public Long getUserID() { + return userID; + } + /** + * @param userID + * The userID to set. + */ + public void setUserID(Long userID) { + this.userID = userID; + } + /** + * @return Returns the versionId. + */ + public Long getVersionId() { + return versionId; + } + /** + * @param versionId The versionId to set. + */ + public void setVersionId(Long versionId) { + this.versionId = versionId; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaContentDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaContentDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaContentDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,65 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import org.lamsfoundation.lams.tool.qa.QaContent; + + + + +/** + * + * @author Ozgur Demirtas + * + */ +public interface IQaContentDAO +{ + public QaContent getQaById(long qaId); + + /** + * + * return null if not found + */ + public QaContent loadQaById(long qaId); + + /** + * returns qa content + * getQaBySession(Long sessionId) + * @param sessionId + * @return QaContent + */ + public QaContent getQaBySession(Long sessionId); + + public void saveQa(QaContent qa); + + public void updateQa(QaContent qa); + + public void removeQa(Long qaContentId); + + public void deleteQa(QaContent qa); + + public void removeQaById(Long qaId); + + public void removeAllQaSession(QaContent content); + + public int countUserResponsed(QaContent content); + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueContentDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueContentDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueContentDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,46 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; + + +/** + * + * @author Ozgur Demirtas + * + */ +public interface IQaQueContentDAO +{ + public QaQueContent getQaQueById(long qaQueContentId); + + public QaQueContent getToolDefaultQuestionContent(final long qaContentId); + + public List getQuestionIndsForContent(QaContent qa); + + public void createQueContent(QaQueContent queContent); + + public void removeQueContent(long qaQueContentId); + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueUsrDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueUsrDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaQueUsrDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,43 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; + + +/** + * + * @author Ozgur Demirtas + * + */ +public interface IQaQueUsrDAO +{ + public QaQueUsr getQaQueUsrById(long qaQueUsrId); + + public QaQueUsr loadQaQueUsrById(long qaQueUsrId); + + public void createUsr(QaQueUsr usr); + + public void deleteQaQueUsr(QaQueUsr qaQueUsr); + + public int countSessionUser(QaSession qaSession); +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaSessionDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaSessionDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaSessionDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,56 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; + + +/** + * + * * @author Ozgur Demirtas + * + */ +public interface IQaSessionDAO +{ + public int countIncompleteSession(QaContent qa); + + public QaSession getQaSessionById(long qaSessionId); + + public List getToolSessionsForContent(QaContent qa); + + public QaSession getQaSessionOrNullById(long qaSessionId); + + public int studentActivityOccurred(QaContent qa); + + public void CreateQaSession(QaSession session); + + public void UpdateQaSession(QaSession session); + + public void deleteQaSession(QaSession session); +} + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUploadedFileDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUploadedFileDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUploadedFileDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,62 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaUploadedFile; + +/** + * + * @author Ozgur Demirtas + * + */ +public interface IQaUploadedFileDAO +{ + public QaUploadedFile loadUploadedFileById(long submissionId); + + public void updateUploadFile(QaUploadedFile qaUploadedFile); + + public void saveUploadFile(QaUploadedFile qaUploadedFile); + + public void createUploadFile(QaUploadedFile qaUploadedFile); + + public void UpdateUploadFile(QaUploadedFile qaUploadedFile); + + public void removeUploadFile(Long submissionId); + + public void deleteUploadFile(QaUploadedFile qaUploadedFile); + + public List retrieveQaUploadedFiles(QaContent qa, boolean fileOnline); + + public List retrieveQaUploadedOfflineFilesUuid(QaContent qa); + + public List retrieveQaUploadedOnlineFilesUuid(QaContent qa); + + public List retrieveQaUploadedOfflineFilesName(QaContent qa); + + public List retrieveQaUploadedOnlineFilesName(QaContent qa); + + public void cleanUploadedFilesMetaData(); + + public void flush(); +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUsrRespDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUsrRespDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IQaUsrRespDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,46 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao; + +import org.lamsfoundation.lams.tool.qa.QaUsrResp; + + +/** + * + * @author Ozgur Demirtas + * + */ +public interface IQaUsrRespDAO +{ + public void saveUserResponse(QaUsrResp resp); + + public void updateUserResponse(QaUsrResp resp); + + public void createUserResponse(QaUsrResp resp); + + public void removeUserResponse(QaUsrResp resp); + + public void removeUserResponseByQaQueId(Long qaQueId); + + public QaUsrResp retrieveQaUsrResp(long responseId); +} + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaContentDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaContentDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaContentDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,135 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import net.sf.hibernate.Hibernate; +import net.sf.hibernate.HibernateException; +import net.sf.hibernate.Session; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.dao.IQaContentDAO; +import org.springframework.orm.hibernate.HibernateCallback; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class QaContentDAO extends HibernateDaoSupport implements IQaContentDAO { + static Logger logger = Logger.getLogger(QaContentDAO.class.getName()); + + private static final String LOAD_QA_BY_SESSION = "select qa from QaContent qa left join fetch " + + "qa.qaSessions session where session.qaSessionId=:sessionId"; + + + private static final String COUNT_USER_RESPONSED = "select distinct u.userId from QaQueUsr u left join fetch" + + " u.qaQueContent as ques where ques.qaContent = :qa group by u.userId"; + + + public QaContentDAO() {} + + public QaContent getQaById(long qaId) + { + return (QaContent) this.getHibernateTemplate() + .load(QaContent.class, new Long(qaId)); + } + + /** + * + * return null if not found + */ + public QaContent loadQaById(long qaId) + { + return (QaContent) this.getHibernateTemplate().get(QaContent.class, new Long(qaId)); + } + + + + public void updateQa(QaContent qa) + { + this.getHibernateTemplate().update(qa); + } + + + + public QaContent getQaBySession(final Long sessionId) + { + return (QaContent) getHibernateTemplate().execute(new HibernateCallback() + { + + public Object doInHibernate(Session session) throws HibernateException + { + return session.createQuery(LOAD_QA_BY_SESSION) + .setLong("sessionId", + sessionId.longValue()) + .uniqueResult(); + } + }); + } + + public void saveQa(QaContent qa) + { + this.getHibernateTemplate().save(qa); + } + + public void createQa(QaContent qa) + { + this.getHibernateTemplate().save(qa); + } + + public void UpdateQa(QaContent qa) + { + this.getHibernateTemplate().update(qa); + } + + public int countUserResponsed(QaContent qa) + { + return (getHibernateTemplate().findByNamedParam(COUNT_USER_RESPONSED, + "qa", + qa)).size(); + } + + + + /** GETS CALLED BY CONTRACT + */ + public void removeAllQaSession(QaContent qaContent){ + this.getHibernateTemplate().deleteAll(qaContent.getQaSessions()); + } + + public void removeQa(Long qaId) + { + String query = "from qa in class org.lamsfoundation.lams.tool.qa.QaContent" + + " where qa.qaContentId = ?"; + this.getHibernateTemplate().delete(query,qaId,Hibernate.LONG); + } + + public void deleteQa(QaContent qaContent) + { + this.getHibernateTemplate().delete(qaContent); + } + + public void removeQaById(Long qaId) + { + String query = "from qa in class org.lamsfoundation.lams.tool.qa.QaContent" + + " where qa.qaContentId = ?"; + this.getHibernateTemplate().delete(query,qaId,Hibernate.LONG); + } + + + public void flush() + { + this.getHibernateTemplate().flush(); + } + + +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueContentDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueContentDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueContentDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,75 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import java.util.List; + +import net.sf.hibernate.HibernateException; +import net.sf.hibernate.Session; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.dao.IQaQueContentDAO; +import org.springframework.orm.hibernate.HibernateCallback; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + + + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class QaQueContentDAO extends HibernateDaoSupport implements IQaQueContentDAO { + static Logger logger = Logger.getLogger(QaQueContentDAO.class.getName()); + private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from qaQueContent in class QaQueContent where qaQueContent.qaContentId=:qaContentId"; + private static final String GET_QUESTION_IDS_FOR_CONTENT = "select qaQueContent.qaQueContentId from QaQueContent qaQueContent where qaQueContent.qaContentId = :qa"; + + public QaQueContent getToolDefaultQuestionContent(final long qaContentId) + { + return (QaQueContent) getHibernateTemplate().execute(new HibernateCallback() + { + public Object doInHibernate(Session session) throws HibernateException + { + return session.createQuery(LOAD_QUESTION_CONTENT_BY_CONTENT_ID) + .setLong("qaContentId", qaContentId) + .uniqueResult(); + } + }); + } + + public List getQuestionIndsForContent(QaContent qa) + { + + List listDefaultQuestionIds=(getHibernateTemplate().findByNamedParam(GET_QUESTION_IDS_FOR_CONTENT, + "qa", + qa)); + + return listDefaultQuestionIds; + } + + + public QaQueContent getQaQueById(long qaQueContentId) + { + return (QaQueContent) this.getHibernateTemplate().load(QaQueContent.class, new Long(qaQueContentId)); + } + + public void createQueContent(QaQueContent queContent) + { + this.getHibernateTemplate().save(queContent); + } + + public void removeQueContent(long qaQueContentId) + { + QaQueContent qaQueContent= (QaQueContent) this.getHibernateTemplate().load(QaQueContent.class, new Long(qaQueContentId)); + this.getHibernateTemplate().delete(qaQueContent); + } +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueUsrDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueUsrDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaQueUsrDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,60 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.dao.IQaQueUsrDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + + + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class QaQueUsrDAO extends HibernateDaoSupport implements IQaQueUsrDAO { + static Logger logger = Logger.getLogger(QaQueUsrDAO.class.getName()); + + private static final String COUNT_SESSION_USER = "select qaQueUsr.queUsrId from QaQueUsr qaQueUsr where qaQueUsr.qaSessionId= :qaSession"; + + + public int countSessionUser(QaSession qaSession) + { + return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, + "qaSession", + qaSession)).size(); + } + + + public QaQueUsr getQaQueUsrById(long qaQueUsrId) + { + return (QaQueUsr) this.getHibernateTemplate().load(QaQueUsr.class, new Long(qaQueUsrId)); + } + + public QaQueUsr loadQaQueUsrById(long qaQueUsrId) + { + return (QaQueUsr) this.getHibernateTemplate().get(QaQueUsr.class, new Long(qaQueUsrId)); + } + + public void createUsr(QaQueUsr usr) + { + this.getHibernateTemplate().save(usr); + } + + public void deleteQaQueUsr(QaQueUsr qaQueUsr) + { + this.getHibernateTemplate().delete(qaQueUsr); + } + + +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaSessionDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaSessionDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaSessionDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,105 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.dao.IQaSessionDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + + +/** + * @author Ozgur Demirtas + * + */ +public class QaSessionDAO extends HibernateDaoSupport implements + IQaSessionDAO +{ + private static final String COUNT_SESSION_INCOMPLITE = "select qaSession.session_status from QaSession qaSession where qaSession.session_status='INCOMPLETE' and qaSession.qaContentId = :qa"; + private static final String COUNT_SESSION_ACTIVITY = "select qaSession.session_status from QaSession qaSession where qaSession.qaContentId = :qa"; + private static final String GET_SESSION_IDS_FOR_CONTENT = "select qaSession.qaSessionId from QaSession qaSession where qaSession.qaContentId = :qa"; + + + public int countIncompleteSession(QaContent qa) + { + return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_INCOMPLITE, + "qa", + qa)).size(); + } + + public int studentActivityOccurred(QaContent qa) + { + return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_ACTIVITY, + "qa", + qa)).size(); + } + + + public List getToolSessionsForContent(QaContent qa) + { + + List lisToolSessionIds=(getHibernateTemplate().findByNamedParam(GET_SESSION_IDS_FOR_CONTENT, + "qa", + qa)); + return lisToolSessionIds; + } + + /** + * @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#getSurveySessionById(long) + */ + public QaSession getQaSessionById(long qaSessionId) + { + return (QaSession)this.getHibernateTemplate().load(QaSession.class,new Long(qaSessionId)); + } + + public QaSession getQaSessionOrNullById(long qaSessionId) + { + return (QaSession)this.getHibernateTemplate().get(QaSession.class,new Long(qaSessionId)); + } + + /** + * @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#CreateSurveySession(com.lamsinternational.tool.survey.domain.SurveySession) + */ + public void CreateQaSession(QaSession session) + { + this.getHibernateTemplate().save(session); + } + + /** + * @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#UpdateSurveySession(com.lamsinternational.tool.survey.domain.SurveySession) + */ + public void UpdateQaSession(QaSession session) + { + this.getHibernateTemplate().update(session); + } + + /** + * @see org.lamsfoundation.lams.tool.survey.dao.interfaces.ISurveySessionDAO#deleteSurveySession(com.lamsinternational.tool.survey.domain.SurveySession) + */ + public void deleteQaSession(QaSession qaSession) + { + this.getHibernateTemplate().delete(qaSession); + } + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUploadedFileDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUploadedFileDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUploadedFileDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,168 @@ +/* + * Created on 15/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import java.util.List; + +import net.sf.hibernate.Hibernate; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaUploadedFile; +import org.lamsfoundation.lams.tool.qa.dao.IQaUploadedFileDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +public class QaUploadedFileDAO extends HibernateDaoSupport implements IQaUploadedFileDAO { + static Logger logger = Logger.getLogger(QaUploadedFileDAO.class.getName()); + + private static final String GET_ONLINE_FILENAMES_FOR_CONTENT = "select qaUploadedFile.fileName from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=1"; + private static final String GET_OFFLINE_FILENAMES_FOR_CONTENT = "select qaUploadedFile.fileName from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=0"; + + private static final String GET_ONLINE_FILES_UUID = "select qaUploadedFile.uuid from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=1"; + private static final String GET_ONLINE_FILES_NAME ="select qaUploadedFile.fileName from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=1 order by qaUploadedFile.uuid"; + + private static final String GET_OFFLINE_FILES_UUID = "select qaUploadedFile.uuid from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=0"; + private static final String GET_OFFLINE_FILES_NAME ="select qaUploadedFile.fileName from QaUploadedFile qaUploadedFile where qaUploadedFile.qaContentId = :qa and qaUploadedFile.fileOnline=0 order by qaUploadedFile.uuid"; + + public QaUploadedFile getUploadedFileById(long submissionId) + { + return (QaUploadedFile) this.getHibernateTemplate() + .load(QaUploadedFile.class, new Long(submissionId)); + } + + /** + * + * return null if not found + */ + public QaUploadedFile loadUploadedFileById(long submissionId) + { + return (QaUploadedFile) this.getHibernateTemplate().get(QaUploadedFile.class, new Long(submissionId)); + } + + + + public void updateUploadFile(QaUploadedFile qaUploadedFile) + { + this.getHibernateTemplate().update(qaUploadedFile); + } + + + public void saveUploadFile(QaUploadedFile qaUploadedFile) + { + this.getHibernateTemplate().save(qaUploadedFile); + } + + public void createUploadFile(QaUploadedFile qaUploadedFile) + { + this.getHibernateTemplate().save(qaUploadedFile); + } + + public void UpdateUploadFile(QaUploadedFile qaUploadedFile) + { + this.getHibernateTemplate().update(qaUploadedFile); + } + + + public void cleanUploadedFilesMetaData() + { + String query = "from uploadedFile in class org.lamsfoundation.lams.tool.qa.QaUploadedFile"; + this.getHibernateTemplate().delete(query); + } + + public void removeUploadFile(Long submissionId) + { + String query = "from uploadedFile in class org.lamsfoundation.lams.tool.qa.QaUploadedFile" + + " where uploadedFile.submissionId = ?"; + this.getHibernateTemplate().delete(query,submissionId,Hibernate.LONG); + } + + public List retrieveQaUploadedFiles(QaContent qa, boolean fileOnline) + { + List listFilenames=null; + + if (fileOnline) + { + listFilenames=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILENAMES_FOR_CONTENT, + "qa", + qa)); + } + else + { + listFilenames=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILENAMES_FOR_CONTENT, + "qa", + qa)); + } + return listFilenames; + } + + + public List retrieveQaUploadedOfflineFilesUuid(QaContent qa) + { + List listFilesUuid=null; + + listFilesUuid=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILES_UUID, + "qa", + qa)); + + return listFilesUuid; + } + + public List retrieveQaUploadedOnlineFilesUuid(QaContent qa) + { + List listFilesUuid=null; + + listFilesUuid=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILES_UUID, + "qa", + qa)); + + return listFilesUuid; + } + + + public List retrieveQaUploadedOfflineFilesName(QaContent qa) + { + List listFilesUuid=null; + + listFilesUuid=(getHibernateTemplate().findByNamedParam(GET_OFFLINE_FILES_NAME, + "qa", + qa)); + + return listFilesUuid; + } + + public List retrieveQaUploadedOnlineFilesName(QaContent qa) + { + List listFilesUuid=null; + + listFilesUuid=(getHibernateTemplate().findByNamedParam(GET_ONLINE_FILES_NAME, + "qa", + qa)); + + return listFilesUuid; + } + + + + public void deleteUploadFile(QaUploadedFile qaUploadedFile) + { + this.getHibernateTemplate().delete(qaUploadedFile); + } + + public void flush() + { + this.getHibernateTemplate().flush(); + } + +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUsrRespDAO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUsrRespDAO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/QaUsrRespDAO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,88 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.dao.hibernate; + +import net.sf.hibernate.Hibernate; + +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO; +import org.springframework.orm.hibernate.support.HibernateDaoSupport; + + +/** + * + * @author Ozgur Demirtas + * + */ +public class QaUsrRespDAO extends HibernateDaoSupport implements IQaUsrRespDAO +{ + + public QaQueUsr getUserById(long userId) + { + return (QaQueUsr)this.getHibernateTemplate().load(QaQueUsr.class,new Long(userId)); + + } + + public void createUserResponse(QaUsrResp qaUsrResp) + { + this.getHibernateTemplate().save(qaUsrResp); + } + + public QaUsrResp retrieveQaUsrResp(long responseId) + { + logger.debug(logger + " " + this.getClass().getName() + " " + "retrieveUserResponse called with: " + responseId); + return (QaUsrResp) this.getHibernateTemplate().get(QaUsrResp.class, new Long(responseId)); + } + + + /** + * @see org.lamsfoundation.lams.tool.qa.dao.interfaces.IQaUsrRespDAO#saveUserResponse(com.lamsinternational.tool.qa.domain.QaUsrResp) + */ + public void saveUserResponse(QaUsrResp resp) + { + this.getHibernateTemplate().save(resp); + } + + /** + * @see org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO#updateUserResponse(org.lamsfoundation.lams.tool.qa.QaUsrResp) + */ + public void updateUserResponse(QaUsrResp resp) + { + this.getHibernateTemplate().update(resp); + } + + public void removeUserResponse(QaUsrResp resp) + { + this.getHibernateTemplate().delete(resp); + } + + + public void removeUserResponseByQaQueId(Long qaQueId) + { + String query = "from resp in class org.lamsfoundation.lams.tool.qa.QaUsrResp" + + " where resp.qaQueContentId = ?"; + this.getHibernateTemplate().delete(query,qaQueId,Hibernate.LONG); + } + +} + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,20 @@ +# Properties file with Hibernate-related settings. +# Applied by PropertyPlaceholderConfigurer from "dbConnection.xml". +# Targetted at system administrators, to avoid touching the context XML files. + +#jdbc configuration +jdbc.driverClassName=org.gjt.mm.mysql.Driver +jdbc.url=jdbc:mysql://localhost/lams?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true + +jdbc.username=lams +jdbc.password=lamsdemo + +#Hibernate configuration +hibernate.show_sql=true +hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect + +#Connection Pooling configuration +hibernate.c3p0.minPoolSize=5 +hibernate.c3p0.maxPoolSize=20 +hibernate.c3p0.timeout=1800 +hibernate.c3p0.max_statement=50 \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/log4j.properties =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/log4j.properties (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/log4j.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,12 @@ +# Set the root logger to the DEBUG level and FA as a FileAppender +#log4j.rootLogger=DEBUG, FA + +# Set FA to be a FileAppender. +#log4j.appender.FA=org.apache.log4j.FileAppender + +# Set the filename and layout for FA to use +#log4j.appender.FA.file=AppLogger.log +#log4j.appender.FA.MaxFileSize=100MB +#log4j.appender.FA.append=true +#log4j.appender.FA.layout=org.apache.log4j.PatternLayout +#log4j.appender.FA.layout.ConversionPattern=Date=%d{MMM dd yyyy} at Time=%d{HH:mm:ss} %-5p : %m %n Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/qaApplicationContext.xml =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/qaApplicationContext.xml (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/qaApplicationContext.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + /WEB-INF/QaContent.hbm.xml + /WEB-INF/QaSession.hbm.xml + /WEB-INF/QaQueContent.hbm.xml + /WEB-INF/QaQueUsr.hbm.xml + /WEB-INF/QaUsrResp.hbm.xml + /WEB-INF/QaUploadedFile.hbm.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED, -QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,readOnly,-QacpApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + + + + + + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IQaService.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IQaService.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IQaService.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,229 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.service; + +import java.io.InputStream; +import java.util.List; + +import org.lamsfoundation.lams.contentrepository.ITicket; +import org.lamsfoundation.lams.contentrepository.NodeKey; +import org.lamsfoundation.lams.tool.BasicToolVO; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.usermanagement.User; + + +/** + * This interface define the contract that all Survey service provider must + * follow. + * + * @author Ozgur Demirtas + */ +public interface IQaService +{ + /** + * Return the qa object according to the requested content id. + * @param toolContentId the tool content id + * @return the qa object + */ + + public QaContent retrieveQa(long toolContentId); + + + /** + * Return the qa object according to the requested content id. + * @param toolContentId the tool content id + * @return the qa object or null + */ + + public QaContent loadQa(long toolContentId); + + + + /** + * Return the question content object according to the requested question content id. + * @param qaQueContentId qa question content id + * @return the qa question object + */ + public QaQueContent retrieveQaQue(long qaQueContentId); + + public QaQueUsr loadQaQueUsr(Long userId); + + public void createQaQue(QaQueContent qaQueContent); + + public void createQaUsrResp(QaUsrResp qaUsrResp); + + public QaUsrResp retrieveQaUsrResp(long responseId); + + public void updateQaUsrResp(QaUsrResp qaUsrResp); + + + /** + * Return the qa session object according to the requested session id. + * @param qaSessionId qa session id + * @return the qa session object + */ + public QaSession retrieveQaSession(long qaSessionId); + + public QaSession retrieveQaSessionOrNullById(long qaSessionId) throws QaApplicationException; + + public void createQaSession(QaSession qaSession); + + public void createQaQueUsr(QaQueUsr qaQueUsr); + + public void updateQaSession(QaSession qaSession); + + + /** + * Return the qa que user object according to the requested usr id. + * @param qaQaUsrId qa usr id + * @return the qa que usr object + */ + public QaQueUsr retrieveQaQueUsr(long qaQaUsrId); + + public void updateQa(QaContent qa); + + public void createQa(QaContent qa); + + public void deleteQa(QaContent qa); + + public void deleteQaSession(QaSession QaSession) throws QaApplicationException; + + public void deleteUsrRespByQueId(Long qaQueId); + + public void deleteQaById(Long qaId); + + public void deleteQaQueUsr(QaQueUsr qaQueUsr); + + public void removeUserResponse(QaUsrResp resp); + + public User getCurrentUserData(String username); + + /** + * + * copyToolContent(Long fromContentId, Long toContentId) + * should ideally should not be part this interface as it is + * already part of the interface ToolSessionManager. It is here for development purposes. + * return void + * @param fromContentId + * @param toContentId + */ + public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException; + + public void setAsDefineLater(Long toolContentId) throws DataMissingException, ToolException; + + public void unsetAsDefineLater(Long toolContentId); + + public void setAsRunOffline(Long toolContentId) throws DataMissingException, ToolException; + + /** + * TO BE DEFINED AS PART OF MAIN TOOL API + * updates user's tool session status from INCOMPLETE to COMPLETED + * @param userId + */ + public void setAsForceComplete(Long userId); + + /** + * TO BE DEFINED AS PART OF MAIN TOOL API + * @param toolSessionId + */ + public void setAsForceCompleteSession(Long toolSessionId); + + public boolean studentActivityOccurred(QaContent qa); + + public boolean studentActivityOccurredGlobal(QaContent qaContent); + + + /** + * removeToolContent(Long toolContentId) should ideally should not be part this interface as it is + * already part of the interface ToolSessionManager. It is here for development purposes. + * return void + * @param toolContentId + */ + public void removeToolContent(Long toolContentId); + + + /** + * createToolSession(Long toolSessionId, Long toolContentId) should ideally should not be part this interface as it is + * already part of the interface ToolSessionManager. It is here for development purposes. + * + * It is also defined here since in development we want to be able call it directly from our web-layer + * instead of it being called by the container. + * @param toolSessionId + * @param toolContentId + */ + public void createToolSession(Long toolSessionId, Long toolContentId) throws ToolException; + + /** + * leaveToolSession(Long toolSessionId, User learner) should ideally should not be part this interface as it is + * already part of the interface ToolSessionManager. It is here for development purposes. + * + * It is also defined here since in development we want to be able call it directly from our web-layer + * instead of it being called by the container. + * @param toolSessionId + * @param toolContentId + */ + public String leaveToolSession(Long toolSessionId,User learner) throws DataMissingException, ToolException; + + public BasicToolVO getToolBySignature(String toolSignature); + + public long getToolDefaultContentIdBySignature(String toolSignature); + + public int countSessionUser(QaSession qaSession); + + public List getToolSessionsForContent(QaContent qa); + + public QaQueContent getToolDefaultQuestionContent(long contentId); + + /** repository access related methods from here: */ + public void configureContentRepository() throws QaApplicationException; + + public ITicket getRepositoryLoginTicket() throws QaApplicationException; + + public void deleteFromRepository(Long uuid, Long versionID) throws QaApplicationException; + + public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws QaApplicationException; + + public InputStream downloadFile(Long uuid, Long versionID)throws QaApplicationException; + + /** repository access related methods till here */ + public void persistFile(String uuid, boolean isOnlineFile, String fileName, QaContent qaContent) throws QaApplicationException; + + public List retrieveQaUploadedFiles(QaContent qa, boolean fileOnline) throws QaApplicationException; + + public List retrieveQaUploadedOfflineFilesUuid(QaContent qa); + + public List retrieveQaUploadedOnlineFilesUuid(QaContent qa); + + public List retrieveQaUploadedOfflineFilesName(QaContent qa); + + public List retrieveQaUploadedOnlineFilesName(QaContent qa); + + public void cleanUploadedFilesMetaData() throws QaApplicationException; + +} + Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServicePOJO.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServicePOJO.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServicePOJO.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,1602 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.service; +import java.io.InputStream; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.contentrepository.AccessDeniedException; +import org.lamsfoundation.lams.contentrepository.FileException; +import org.lamsfoundation.lams.contentrepository.ICredentials; +import org.lamsfoundation.lams.contentrepository.ITicket; +import org.lamsfoundation.lams.contentrepository.IVersionedNode; +import org.lamsfoundation.lams.contentrepository.ItemExistsException; +import org.lamsfoundation.lams.contentrepository.ItemNotFoundException; +import org.lamsfoundation.lams.contentrepository.LoginException; +import org.lamsfoundation.lams.contentrepository.NodeKey; +import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; +import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; +import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; +import org.lamsfoundation.lams.contentrepository.service.RepositoryProxy; +import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.tool.BasicToolVO; +import org.lamsfoundation.lams.tool.ToolContentManager; +import org.lamsfoundation.lams.tool.ToolSessionExportOutputData; +import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.SessionDataExistsException; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaUploadedFile; +import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.tool.qa.dao.IQaContentDAO; +import org.lamsfoundation.lams.tool.qa.dao.IQaQueContentDAO; +import org.lamsfoundation.lams.tool.qa.dao.IQaQueUsrDAO; +import org.lamsfoundation.lams.tool.qa.dao.IQaSessionDAO; +import org.lamsfoundation.lams.tool.qa.dao.IQaUploadedFileDAO; +import org.lamsfoundation.lams.tool.qa.dao.IQaUsrRespDAO; +import org.lamsfoundation.lams.tool.service.ILamsToolService; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.springframework.dao.DataAccessException; + + + +/** + * The POJO implementation of Survey service. All business logics of survey tool + * are implemented in this class. It translate the request from presentation + * layer and perform approporiate database operation. + * + * Two construtors are provided in this class. The constuctor with Hibernate + * session object allows survey tool to handle long run application transaction. + * The developer can store Hibernate session in http session and pass across + * different http request. This implementation also make the testing out side + * JBoss container much easier. + * + * Every method is implemented as a Hibernate session transaction. It open an + * new persistent session or connect to existing persistent session in the + * begining and it close or disconnect to the persistent session in the end. + * + * @author Ozgur Demirtas + * + */ + +public class QaServicePOJO implements + IQaService, ToolContentManager, ToolSessionManager, QaAppConstants + +{ + static Logger logger = Logger.getLogger(QaServicePOJO.class.getName()); + + /*repository access related constants */ + private final String repositoryUser = "laqa11"; + private final char[] repositoryId = {'l','a','q','a','_','1', '1'}; + private final String repositoryWorkspace = "laqa11"; + private IRepositoryService repositoryService; + private ICredentials cred; + + private IQaContentDAO qaDAO; + private IQaQueContentDAO qaQueContentDAO; + private IQaSessionDAO qaSessionDAO; + private IQaQueUsrDAO qaQueUsrDAO; + private IQaUsrRespDAO qaUsrRespDAO; + private IQaUploadedFileDAO qaUploadedFileDAO; + + private IUserManagementService userManagementService; + private ILamsToolService toolService; + + + public void configureContentRepository() throws QaApplicationException { + logger.debug("retrieved repService: " + repositoryService); + cred = new SimpleCredentials(repositoryUser, repositoryId); + logger.debug("retrieved cred: "+ cred); + try + { + repositoryService.createCredentials(cred); + logger.debug("created credentails."); + repositoryService.addWorkspace(cred,repositoryWorkspace); + logger.debug("created workspace."); + } catch (ItemExistsException ie) { + logger.warn("Tried to configure repository but it " + +" appears to be already configured. Exception thrown by repository being ignored. ", ie); + } catch (RepositoryCheckedException e) { + String error = "Error occured while trying to configure repository." + +" Unable to recover from error: "+e.getMessage(); + logger.error(error, e); + throw new QaApplicationException(error,e); + } + } + + + public QaServicePOJO(){} + + public void setQaDAO(IQaContentDAO qaDAO) + { + this.qaDAO = qaDAO; + } + + public void setQaQueContentDAO(IQaQueContentDAO qaQueContentDAO) + { + this.qaQueContentDAO = qaQueContentDAO; + } + + public void setQaSessionDAO(IQaSessionDAO qaSessionDAO) + { + this.qaSessionDAO = qaSessionDAO; + } + + public void setQaQueUsrDAO(IQaQueUsrDAO qaQueUsrDAO) + { + this.qaQueUsrDAO = qaQueUsrDAO; + } + + public void setQaUsrRespDAO(IQaUsrRespDAO qaUsrRespDAO) + { + this.qaUsrRespDAO = qaUsrRespDAO; + } + + /** + * @return Returns the qaDAO. + */ + public IQaContentDAO getQaDAO() { + return qaDAO; + } + /** + * @return Returns the qaSessionDAO. + */ + public IQaSessionDAO getQaSessionDAO() { + return qaSessionDAO; + } + /** + * @return Returns the qaUsrRespDAO. + */ + public IQaUsrRespDAO getQaUsrRespDAO() { + return qaUsrRespDAO; + } + + /** + * @return Returns the repositoryService. + */ + public IRepositoryService getRepositoryService() { + return repositoryService; + } + /** + * @param repositoryService The repositoryService to set. + */ + public void setRepositoryService(IRepositoryService repositoryService) { + this.repositoryService = repositoryService; + } + + + + public void setUserManagementService(IUserManagementService userManagementService) + { + this.userManagementService = userManagementService; + } + + public void setToolService(ILamsToolService toolService) + { + this.toolService = toolService; + } + + + public void createQa(QaContent qaContent) throws QaApplicationException + { + try + { + qaDAO.saveQa(qaContent); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa content: " + + e.getMessage(), + e); + } + } + + + public QaContent retrieveQa(long toolContentId) throws QaApplicationException + { + try + { + return qaDAO.getQaById(toolContentId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa content: " + + e.getMessage(), + e); + } + } + + /** + * same as retrieveQa(long toolContentId) except that returns null if not found + */ + public QaContent loadQa(long toolContentId) throws QaApplicationException + { + try + { + return qaDAO.loadQaById(toolContentId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa content: " + + e.getMessage(), + e); + } + } + + + + public void createQaQue(QaQueContent qaQueContent) throws QaApplicationException + { + try + { + qaQueContentDAO.createQueContent(qaQueContent); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is creating qa content: " + + e.getMessage(), + e); + } + } + + public void createQaSession(QaSession qaSession) throws QaApplicationException + { + try + { + qaSessionDAO.CreateQaSession(qaSession); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is creating qa session: " + + e.getMessage(), + e); + } + } + + public void createQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException + { + try + { + qaQueUsrDAO.createUsr(qaQueUsr); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is creating qa QueUsr: " + + e.getMessage(), + e); + } + } + + + public QaQueUsr loadQaQueUsr(Long userId) throws QaApplicationException + { + try + { + QaQueUsr qaQueUsr=qaQueUsrDAO.loadQaQueUsrById(userId.longValue()); + return qaQueUsr; + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa QueUsr: " + + e.getMessage(), + e); + } + } + + + public void createQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException + { + try + { + qaUsrRespDAO.createUserResponse(qaUsrResp); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is creating qa UsrResp: " + + e.getMessage(), + e); + } + } + + + public QaUsrResp retrieveQaUsrResp(long responseId) throws QaApplicationException + { + try + { + QaUsrResp qaUsrResp=qaUsrRespDAO.retrieveQaUsrResp(responseId); + return qaUsrResp; + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa qaUsrResp: " + + e.getMessage(), + e); + } + + } + + public void updateQaUsrResp(QaUsrResp qaUsrResp) throws QaApplicationException + { + try + { + qaUsrRespDAO.updateUserResponse(qaUsrResp); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is updating qa UsrResp: " + + e.getMessage(), + e); + } + } + + + + public QaQueContent retrieveQaQue(long qaQueContentId) throws QaApplicationException + { + try + { + return qaQueContentDAO.getQaQueById(qaQueContentId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa question content: " + + e.getMessage(), + e); + } + } + + + public QaSession retrieveQaSession(long qaSessionId) throws QaApplicationException + { + try + { + return qaSessionDAO.getQaSessionById(qaSessionId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa session : " + + e.getMessage(), + e); + } + } + + public QaSession retrieveQaSessionOrNullById(long qaSessionId) throws QaApplicationException + { + try + { + return qaSessionDAO.getQaSessionOrNullById(qaSessionId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa session : " + + e.getMessage(), + e); + } + } + + + public QaContent retrieveQaBySession(long qaSessionId) throws QaApplicationException + { + try + { + return qaDAO.getQaBySession(new Long(qaSessionId)); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa: " + + e.getMessage(), + e); + } + } + + + public void updateQa(QaContent qa) throws QaApplicationException + { + try + { + qaDAO.updateQa(qa); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is updating" + + " the qa content: " + + e.getMessage(),e); + } + } + + + public void updateQaSession(QaSession qaSession) throws QaApplicationException + { + try + { + logger.debug("before updateQaSession: " + qaSession); + qaSessionDAO.UpdateQaSession(qaSession); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is updating qa session : " + + e.getMessage(), + e); + } + } + + public void deleteQa(QaContent qa) throws QaApplicationException + { + try + { + qaDAO.deleteQa(qa); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the qa content: " + + e.getMessage(),e); + } + } + + public void deleteQaById(Long qaId) throws QaApplicationException + { + try + { + qaDAO.removeQaById(qaId); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the qa content: " + + e.getMessage(),e); + } + } + + public void deleteQaSession(QaSession QaSession) throws QaApplicationException + { + try + { + qaSessionDAO.deleteQaSession(QaSession); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the qa session: " + + e.getMessage(),e); + } + } + + + public void removeUserResponse(QaUsrResp resp) throws QaApplicationException + { + try + { + qaUsrRespDAO.removeUserResponse(resp); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the resp: " + + e.getMessage(),e); + } + } + + + public void deleteUsrRespByQueId(Long qaQueId) throws QaApplicationException + { + try + { + qaUsrRespDAO.removeUserResponseByQaQueId(qaQueId); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the resp: " + + e.getMessage(),e); + } + } + + public void deleteQaQueUsr(QaQueUsr qaQueUsr) throws QaApplicationException + { + try + { + qaQueUsrDAO.deleteQaQueUsr(qaQueUsr); + } + catch(DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is deleting" + + " the user: " + + e.getMessage(),e); + } + } + + public List retrieveQaUploadedFiles(QaContent qa, boolean fileOnline) throws QaApplicationException + { + try + { + return qaUploadedFileDAO.retrieveQaUploadedFiles(qa, fileOnline); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa uploaded files: " + + e.getMessage(), + e); + } + } + + + public List retrieveQaUploadedOfflineFilesUuid(QaContent qa) + { + try + { + return qaUploadedFileDAO.retrieveQaUploadedOfflineFilesUuid(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa uploaded files: offline + uuids " + + e.getMessage(), + e); + } + } + + public List retrieveQaUploadedOnlineFilesUuid(QaContent qa) + { + try + { + return qaUploadedFileDAO.retrieveQaUploadedOnlineFilesUuid(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa uploaded files: online + uuids " + + e.getMessage(), + e); + } + } + + public List retrieveQaUploadedOfflineFilesName(QaContent qa) + { + try + { + return qaUploadedFileDAO.retrieveQaUploadedOfflineFilesName(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa uploaded files: offline + fileNames " + + e.getMessage(), + e); + } + } + + public List retrieveQaUploadedOnlineFilesName(QaContent qa) + { + try + { + return qaUploadedFileDAO.retrieveQaUploadedOnlineFilesName(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa uploaded files: online + fileNames " + + e.getMessage(), + e); + } + + } + + + + public int countTotalNumberOfUserResponsed(QaContent qa) throws QaApplicationException + { + try + { + return qaDAO.countUserResponsed(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured in [countTotalNumberOfUserResponsed]: " + + e.getMessage(), + e); + } + } + + + public User getCurrentUserData(String username) throws QaApplicationException + { + try + { + logger.debug("getCurrentUserData: " + username); + /** + * this will return null if the username not found + */ + User user=userManagementService.getUserByLogin(username); + if (user == null) + { + logger.debug("No user with the username: "+ username + " exists."); + throw new QaApplicationException("No user with that username exists."); + } + return user; + } + catch (DataAccessException e) + { + throw new QaApplicationException("Unable to find current user information" + + " Root Cause: [" + + e.getMessage() + "]", + e); + } + } + + /** + * + * Unused method + * @param lessonId + * @return + * @throws QaApplicationException + */ + public Lesson getCurrentLesson(long lessonId) throws QaApplicationException + { + try + { + /**this is a mock implementation to make the project compile and + work. When the Lesson service is ready, we need to switch to + real service implmenation. + */ + return new Lesson(); + /**return lsDAO.find(lsessionId); */ + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading" + + " learning session:" + + e.getMessage(), + e); + } + } + + public void saveQaContent(QaContent qa) throws QaApplicationException + { + try + { + qaDAO.saveQa(qa); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is saving" + + " the qa content: " + + e.getMessage(),e); + } + } + + public QaQueUsr retrieveQaQueUsr(long qaQaQueUsrId) throws QaApplicationException + { + try + { + return qaQueUsrDAO.getQaQueUsrById(qaQaQueUsrId); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is loading qa que usr: " + + e.getMessage(), + e); + } + } + + + public int countSessionUser(QaSession qaSession) throws QaApplicationException + { + try + { + return qaQueUsrDAO.countSessionUser(qaSession); + } + catch (DataAccessException e) + { + throw new QaApplicationException("Exception occured when lams is counting users in the session " + + e.getMessage(), + e); + } + } + + + /** + * checks the paramter content in the user responses table + * @param qa + * @return + * @throws QaApplicationException + */ + public boolean studentActivityOccurredGlobal(QaContent qaContent) throws QaApplicationException + { + logger.debug("using qaContent: " + qaContent); + Iterator questionIterator=qaContent.getQaQueContents().iterator(); + while (questionIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)questionIterator.next(); + logger.debug("iterated question : " + qaQueContent); + Iterator responsesIterator=qaQueContent.getQaUsrResps().iterator(); + while (responsesIterator.hasNext()) + { + logger.debug("there is at least one response"); + /** + * proved the fact that there is at least one response for this content. + */ + return true; + } + } + logger.debug("there is no response for this content"); + return false; + } + + + public int countIncompleteSession(QaContent qa) throws QaApplicationException + { + logger.debug("start of countIncompleteSession: " + qa); + logger.debug("qaContentId: " + qa.getQaContentId()); + int countIncompleteSession=qaSessionDAO.countIncompleteSession(qa); + logger.debug("countIncompleteSession: " + countIncompleteSession); + return countIncompleteSession; + } + + /** + * checks the parameter content in the tool sessions table + * + * find out if any student has ever used (logged in through the url and replied) to this content + * return true even if you have only one content passed as parameter referenced in the tool sessions table + * @param qa + * @return boolean + * @throws QaApplicationException + */ + public boolean studentActivityOccurred(QaContent qa) throws QaApplicationException + { + logger.debug("start of studentActivityOccurred: " + qa); + logger.debug("qaContentId: " + qa.getQaContentId()); + int countStudentActivity=qaSessionDAO.studentActivityOccurred(qa); + logger.debug("countIncompleteSession: " + countStudentActivity); + if (countStudentActivity > 0) + return true; + return false; + } + + + /** + * TESTED + * gets called ONLY when a lesson is being created in monitoring mode. + * Should create the new content(toContent) based on what the author has created her content with. In q/a tool's case + * that is content + question's content but not user responses. The deep copy should go only as far as + * default content (or author created content) already goes. + * ToolContentManager CONTRACT + * + * + * similar to public void removeToolContent(Long toolContentId) + * gets called by Container+Flash + * + */ + + public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException + { + logger.debug("start of copyToolContent with ids: " + fromContentId + " and " + toContentId); + + if (fromContentId == null) + { + logger.debug("fromContentId is null."); + logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE); + long defaultContentId=0; + try + { + defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); + fromContentId= new Long(defaultContentId); + } + catch(Exception e) + { + logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); + throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); + } + } + + if (toContentId == null) + { + logger.debug("throwing ToolException: toContentId is null"); + throw new ToolException("toContentId is missing"); + } + logger.debug("final - copyToolContent using ids: " + fromContentId + " and " + toContentId); + + try + { + QaContent fromContent = qaDAO.loadQaById(fromContentId.longValue()); + + if (fromContent == null) + { + logger.debug("fromContent is null."); + logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE); + long defaultContentId=0; + try + { + defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); + fromContentId= new Long(defaultContentId); + } + catch(Exception e) + { + logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); + throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); + } + + fromContent = qaDAO.loadQaById(fromContentId.longValue()); + logger.debug("using fromContent: " + fromContent); + } + + logger.debug("final - retrieved fromContent: " + fromContent); + logger.debug("final - before new instance using " + fromContent + " and " + toContentId); + QaContent toContent = QaContent.newInstance(fromContent,toContentId); + if (toContent == null) + { + logger.debug("throwing ToolException: WARNING!, retrieved toContent is null."); + throw new ToolException("WARNING! Fail to create toContent. Can't continue!"); + } + else + { + logger.debug("retrieved toContent: " + toContent); + qaDAO.saveQa(toContent); + logger.debug("toContent has been saved successfully: " + toContent); + } + logger.debug("end of copyToolContent with ids: " + fromContentId + " and " + toContentId); + } + catch (DataAccessException e) + { + logger.debug("throwing ToolException: Exception occured when lams is copying content between content ids."); + throw new ToolException("Exception occured when lams is copying content between content ids."); + } + } + + + + /** + * TO BE DEFINED-FUTURE API + * + * update the tool session status to COMPLETE for this tool session + * IMPLEMENT THIS!!!! Is this from ToolContentManager??? + * + + * @param Long toolSessionId + */ + public void setAsForceCompleteSession(Long toolSessionId) throws QaApplicationException + { + logger.debug("rrequest for setAsForceCompleteSession has come for toolSessionId: " + toolSessionId); + + QaSession qaSession=retrieveQaSessionOrNullById(toolSessionId.longValue()); + logger.debug("retrieved qaSession is : " + qaSession); + qaSession.setSession_status(QaSession.COMPLETED); + logger.debug("updated qaSession to COMPLETED : "); + updateQaSession(qaSession); + logger.debug("updated qaSession to COMPLETED in the db : "); + } + + + /** + * TO BE DEFINED + * TESTED + * update the tool session status to COMPLETE for this user + * IMPLEMENT THIS!!!! Is this from ToolContentManager??? + * + + * @param userId + */ + public void setAsForceComplete(Long userId) throws QaApplicationException + { + logger.debug("request for setAsForceComplete has come for userId: " + userId); + QaQueUsr qaQueUsr=loadQaQueUsr(userId); + + if (qaQueUsr != null) + { + logger.debug("retrieved qaQueUsr : " + qaQueUsr); + logger.debug("retrieved qaQueUsr has the tool session : " + qaQueUsr.getQaSession()); + QaSession qaSession=qaQueUsr.getQaSession(); + if (qaSession != null) + { + Long usersToolSessionId=qaSession.getQaSessionId(); + logger.debug("retrieved tool session has tool session id : " + usersToolSessionId); + + qaSession=retrieveQaSessionOrNullById(usersToolSessionId.longValue()); + logger.debug("retrieved qaSession is : " + qaSession); + qaSession.setSession_status(QaSession.COMPLETED); + logger.debug("updated qaSession to COMPLETED : "); + updateQaSession(qaSession); + logger.debug("updated qaSession to COMPLETED in the db : "); + QaContent qaContent=qaSession.getQaContent(); + logger.debug("qaSession uses qaContent : " + qaContent); + logger.debug("qaSession uses qaContentId : " + qaContent.getQaContentId()); + + /** + * if all the sessions of this content is COMPLETED, unlock the content + * + */ + int countIncompleteSession=countIncompleteSession(qaContent); + logger.debug("qaSession countIncompleteSession : " + countIncompleteSession); + + if (countIncompleteSession == 0) + { + qaContent.setContentLocked(false); + updateQa(qaContent); + logger.debug("qaContent has been updated for contentLocked" + qaContent); + } + } + else + { + logger.debug("WARNING!: retrieved qaSession is null."); + throw new QaApplicationException("Fail to setAsForceComplete" + + " based on null qaSession."); + } + } + else + { + logger.debug("WARNING!: retrieved qaQueUsr is null."); + throw new QaApplicationException("Fail to setAsForceComplete" + + " based on null qaQueUsr."); + } + } + + + public void unsetAsDefineLater(Long toolContentId) throws QaApplicationException + { + logger.debug("request for unsetAsDefineLater with toolContentId: " + toolContentId); + if (toolContentId == null) + { + logger.debug("WARNING!: retrieved toolContentId is null."); + throw new QaApplicationException("Fail to setAsDefineLater" + + " based on null toolContentId."); + } + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + if (qaContent == null) + { + logger.debug("WARNING!!!: retrieved qaContent is null."); + throw new QaApplicationException("Fail to unsetAsDefineLater" + + " based on null qaContent."); + } + qaContent.setDefineLater(false); + updateQa(qaContent); + logger.debug("qaContent has been updated for unsetAsDefineLater: " + qaContent); + } + + /** + * TESTED + * set the defineLater to true on this content + * + * @param toolContentId + * return void + */ + public void setAsDefineLater(Long toolContentId) throws DataMissingException, ToolException + { + logger.debug("request for setAsDefineLater with toolContentId: " + toolContentId); + if (toolContentId == null) + { + logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentId is null."); + throw new DataMissingException("toolContentId is missing"); + } + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + if (qaContent == null) + { + logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null."); + throw new DataMissingException("qaContent is missing"); + } + qaContent.setDefineLater(true); + updateQa(qaContent); + logger.debug("qaContent has been updated for defineLater: " + qaContent); + } + + /** + * TESTED + * set the runOffline to true on this content + * + * @param toolContentId + * return void + */ + public void setAsRunOffline(Long toolContentId) throws DataMissingException, ToolException + { + logger.debug("request for setAsRunOffline with toolContentId:" + toolContentId); + if (toolContentId == null) + { + logger.debug("throwing DataMissingException: WARNING!: retrieved toolContentId is null."); + throw new DataMissingException("toolContentId is missing"); + } + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + if (qaContent == null) + { + logger.debug("throwing DataMissingException: WARNING!: retrieved qaContent is null."); + throw new DataMissingException("qaContent is missing"); + } + qaContent.setRunOffline(true); + updateQa(qaContent); + logger.debug("qaContent has been updated for runOffline: " + qaContent); + } + + + + /** + * !!! UNUSED !!! + * TESTED + * gets automatically called only in monitoring mode when the author chooses to delete a lesson. + * + * The idea is to remove content + its relevant sessions + in q/a tools's case the question's content from the db. + * ToolContentManager CONTRACT + * this gets called automatically by Flash when a deletion is detected in the tool interface. + */ + public void removeToolContent(Long toolContentId) + { + logger.debug("start of removeToolContent with toolContentId: " + toolContentId); + + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + logger.debug("retrieving qaContent: " + qaContent); + + if (qaContent != null) + { + Iterator sessionIterator=qaContent.getQaSessions().iterator(); + while (sessionIterator.hasNext()) + { + QaSession qaSession=(QaSession)sessionIterator.next(); + logger.debug("iterated qaSession : " + qaSession); + + Iterator sessionUsersIterator=qaSession.getQaQueUsers().iterator(); + while (sessionUsersIterator.hasNext()) + { + QaQueUsr qaQueUsr=(QaQueUsr) sessionUsersIterator.next(); + logger.debug("iterated qaQueUsr : " + qaQueUsr); + + Iterator sessionUsersResponsesIterator=qaQueUsr.getQaUsrResps().iterator(); + while (sessionUsersResponsesIterator.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)sessionUsersResponsesIterator.next(); + logger.debug("iterated qaUsrResp : " + qaUsrResp); + removeUserResponse(qaUsrResp); + logger.debug("removed qaUsrResp : " + qaUsrResp); + } + } + } + + logger.debug("removed all existing responses of toolContent with toolContentId:" + + toolContentId); + qaDAO.removeQa(toolContentId); + logger.debug("removed qaContent:" + qaContent); + } + } + + + /* + * DOUBLE CHECK! + * Will need an update on the core tool signature: reason : when qaContent is null throw an exception + * (non-Javadoc) + * @see org.lamsfoundation.lams.tool.ToolContentManager#removeToolContent(java.lang.Long, boolean) + */ + public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, ToolException + { + logger.debug("start of: removeToolContent(Long toolContentId, boolean removeSessionData"); + logger.debug("start of removeToolContent with toolContentId: " + toolContentId + "removeSessionData: " + removeSessionData); + + if (toolContentId == null) + { + logger.debug("toolContentId is null"); + throw new ToolException("toolContentId is missing"); + } + + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + logger.debug("retrieving qaContent: " + qaContent); + + if (qaContent != null) + { + Iterator sessionIterator=qaContent.getQaSessions().iterator(); + while (sessionIterator.hasNext()) + { + if (removeSessionData == false) + { + logger.debug("removeSessionData is false, throwing SessionDataExistsException."); + throw new SessionDataExistsException(); + } + + QaSession qaSession=(QaSession)sessionIterator.next(); + logger.debug("iterated qaSession : " + qaSession); + + Iterator sessionUsersIterator=qaSession.getQaQueUsers().iterator(); + while (sessionUsersIterator.hasNext()) + { + QaQueUsr qaQueUsr=(QaQueUsr) sessionUsersIterator.next(); + logger.debug("iterated qaQueUsr : " + qaQueUsr); + + Iterator sessionUsersResponsesIterator=qaQueUsr.getQaUsrResps().iterator(); + while (sessionUsersResponsesIterator.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)sessionUsersResponsesIterator.next(); + logger.debug("iterated qaUsrResp : " + qaUsrResp); + removeUserResponse(qaUsrResp); + logger.debug("removed qaUsrResp : " + qaUsrResp); + } + } + } + + logger.debug("removed all existing responses of toolContent with toolContentId:" + + toolContentId); + qaDAO.removeQa(toolContentId); + logger.debug("removed qaContent:" + qaContent); + } + else + { + logger.debug("Warning!!!, We should have not come here. qaContent is null."); + throw new ToolException("toolContentId is missing"); + } + } + + + /** + * it is possible that the tool session id already exists in the tool sessions table + * as the users from the same session are involved. + * existsSession(long toolSessionId) + * @param toolSessionId + * @return boolean + */ + protected boolean existsSession(long toolSessionId) + { + QaSession qaSession=retrieveQaSessionOrNullById(toolSessionId); + + if (qaSession == null) + { + logger.debug("qaSession does not exist yet: " + toolSessionId); + return false; + } + else + { + logger.debug("retrieving an existing qaSession: " + qaSession + " " + toolSessionId); + } + return true; + } + + /** + * TESTED + * ToolSessionManager CONTRACT : creates a tool session with the incoming toolSessionId in the tool session table + * + * gets called only in the Learner mode. + * All the learners in the same group have the same toolSessionId. + * + */ + public void createToolSession(Long toolSessionId, Long toolContentId) throws ToolException + { + logger.debug("start of createToolSession with ids: " + toolSessionId + " and " + toolContentId); + if (toolSessionId == null) + { + logger.debug("toolSessionId is null"); + throw new ToolException("toolSessionId is missing"); + } + + long defaultContentId=0; + if (toolContentId == null) + { + logger.debug("toolContentId is null."); + logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE); + + try + { + defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); + toolContentId=new Long(defaultContentId); + logger.debug("updated toolContentId to: " + toolContentId); + } + catch(Exception e) + { + logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); + throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); + } + } + logger.debug("final toolSessionId and toolContentId: " + toolSessionId + " " + toolContentId); + + QaContent qaContent = qaDAO.loadQaById(toolContentId.longValue()); + logger.debug("retrieved qaContent: " + qaContent); + + if (qaContent == null) + { + logger.debug("qaContent is null."); + logger.debug("attempt retrieving tool's default content id with signatute : " + MY_SIGNATURE); + + try + { + defaultContentId=getToolDefaultContentIdBySignature(MY_SIGNATURE); + toolContentId=new Long(defaultContentId); + logger.debug("updated toolContentId to: " + toolContentId); + } + catch(Exception e) + { + logger.debug("default content id has not been setup for signature: " + MY_SIGNATURE); + throw new ToolException("WARNING! default content has not been setup for signature" + MY_SIGNATURE + " Can't continue!"); + } + + qaContent = qaDAO.loadQaById(toolContentId.longValue()); + } + logger.debug("final - retrieved qaContent: " + qaContent); + + + /** + * create a new a new tool session if it does not already exist in the tool session table + */ + if (!existsSession(toolSessionId.longValue())) + { + try + { + QaSession qaSession = new QaSession(toolSessionId, + new Date(System.currentTimeMillis()), + QaSession.INCOMPLETE, + qaContent, + new TreeSet()); + + logger.debug("created qaSession: " + qaSession); + qaSessionDAO.CreateQaSession(qaSession); + logger.debug("created qaSession in the db: " + qaSession); + + } + catch(Exception e) + { + logger.debug("Error creating new toolsession in the db"); + throw new ToolException("Error creating new toolsession in the db: " + e); + } + } + } + + + public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException + { + logger.debug("start of removeToolSession with id: " + toolSessionId); + if (toolSessionId == null) + { + logger.debug("toolSessionId is null"); + throw new DataMissingException("toolSessionId is missing"); + } + + QaSession qaSession=null; + try + { + qaSession=retrieveQaSessionOrNullById(toolSessionId.longValue()); + logger.debug("retrieved qaSession: " + qaSession); + } + catch(QaApplicationException e) + { + throw new DataMissingException("error retrieving qaSession: " + e); + } + catch(Exception e) + { + throw new ToolException("error retrieving qaSession: " + e); + } + + if (qaSession == null) + { + logger.debug("qaSession is null"); + throw new DataMissingException("qaSession is missing"); + } + + try + { + qaSessionDAO.deleteQaSession(qaSession); + logger.debug("qaSession " + qaSession + " has been deleted successfully."); + } + catch(QaApplicationException e) + { + throw new ToolException("error deleting qaSession:" + e); + } + } + + + /**FIX THIS ONE!!!! + * TO BE TESTED + * ToolSessionManager CONTRACT + * gets called only in the Learner mode. + * + * Call controller service to complete the qa session + * @see org.lamsfoundation.lams.tool.ToolSessionManager#leaveToolSession(java.lang.Long) + */ + public String leaveToolSession(Long toolSessionId,User learner) throws DataMissingException, ToolException + { + logger.debug("start of leaveToolSession with toolSessionId:" + toolSessionId); + logger.debug("start of leaveToolSession with learner:" + learner); + + if (toolSessionId == null) + { + logger.debug("toolSessionId is null"); + throw new DataMissingException("toolSessionId is missing"); + } + + if (learner == null) + { + logger.debug("learner is null"); + throw new DataMissingException("learner is missing"); + } + + try + { + /* + String nextUrl=learnerService.completeToolSession(toolSessionId,learner); + logger.debug(logger + " " + this.getClass().getName() + " " + "nextUrl: " + nextUrl); + return nextUrl; + */ + return "nextUrl"; + } + catch(DataAccessException e) + { + throw new ToolException("Exception occured when user is leaving tool session: " + e); + } + + } + + /** + * ToolSessionManager CONTRACT + * + */ + public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException + { + throw new ToolException("not yet implemented"); + } + + /** + * ToolSessionManager CONTRACT + * + */ + public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, ToolException + { + + throw new ToolException("not yet implemented"); + } + + public BasicToolVO getToolBySignature(String toolSignature) throws QaApplicationException + { + logger.debug("attempt retrieving tool with signature : " + toolSignature); + BasicToolVO tool=toolService.getToolBySignature(toolSignature); + logger.debug("retrieved tool: " + tool); + return tool; + } + + public long getToolDefaultContentIdBySignature(String toolSignature) throws QaApplicationException + { + long contentId=0; + logger.debug("before attempting retrieving tool with signature : " + toolSignature); + contentId=toolService.getToolDefaultContentIdBySignature(toolSignature); + logger.debug("tool default contentId : " + contentId); + return contentId; + } + + public QaQueContent getToolDefaultQuestionContent(long contentId) throws QaApplicationException + { + logger.debug("before attempting retrieving QaQueContent with contentId : " + contentId); + QaQueContent qaQueContent=qaQueContentDAO.getToolDefaultQuestionContent(contentId); + logger.debug("retrieved QaQueContent : " + qaQueContent); + return qaQueContent; + } + + + public List getToolSessionsForContent(QaContent qa) + { + logger.debug("attempt retrieving listToolSessionIds for : " + qa); + List listToolSessionIds=qaSessionDAO.getToolSessionsForContent(qa); + return listToolSessionIds; + } + + + + /** + * This method verifies the credentials of the SubmitFiles Tool and gives it + * the Ticket to login and access the Content Repository. + * + * A valid ticket is needed in order to access the content from the + * repository. This method would be called evertime the tool needs to + * upload/download files from the content repository. + * + * @return ITicket The ticket for repostory access + * @throws SubmitFilesException + */ + public ITicket getRepositoryLoginTicket() throws QaApplicationException { + repositoryService = RepositoryProxy.getRepositoryService(); + logger.debug("retrieved repositoryService : " + repositoryService); + + ICredentials credentials = new SimpleCredentials( + repositoryUser, + repositoryId); + try { + ITicket ticket = repositoryService.login(credentials, + repositoryWorkspace); + logger.debug("retrieved ticket: " + ticket); + return ticket; + } catch (AccessDeniedException e) { + throw new QaApplicationException("Access Denied to repository." + + e.getMessage()); + } catch (WorkspaceNotFoundException e) { + throw new QaApplicationException("Workspace not found." + + e.getMessage()); + } catch (LoginException e) { + throw new QaApplicationException("Login failed." + e.getMessage()); + } + } + + + /** + * This method deletes the content with the given uuid and + * versionID from the content repository + * + * @param uuid + * The uuid of the node to be deleted + * @param versionID + * The version_id of the node to be deleted. + * @throws SubmitFilesException + */ + public void deleteFromRepository(Long uuid, Long versionID) + throws QaApplicationException { + ITicket ticket = getRepositoryLoginTicket(); + logger.debug("retrieved ticket: " + ticket); + try { + String files[] = repositoryService.deleteVersion(ticket, uuid,versionID); + logger.debug("retrieved files: " + files); + } catch (Exception e) { + throw new QaApplicationException( + "Exception occured while deleting files from" + + " the repository " + e.getMessage()); + } + } + + + /** + * 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 + * from the Repository hence authenticating the tool(SubmitFiles) and then + * the corresponding file is added to the repository. + * + * @param stream + * The InputStream representing the data to be + * added + * @param fileName + * The name of the file being added + * @param mimeType + * The MIME type of the file (eg. TXT, DOC, GIF etc) + * @return NodeKey Represents the two part key - UUID and Version. + * @throws SubmitFilesException + */ + public NodeKey uploadFileToRepository(InputStream stream, String fileName) throws QaApplicationException { + logger.debug("attempt getting the ticket"); + ITicket ticket = getRepositoryLoginTicket(); + logger.debug("retrieved ticket: " + ticket); + + try { + NodeKey nodeKey = repositoryService.addFileItem(ticket, stream, + fileName, null, null); + logger.debug("retrieved nodeKey from repository service: " + nodeKey); + return nodeKey; + } catch (Exception e) { + throw new QaApplicationException("Exception occured while trying to" + + " upload file into the repository" + e.getMessage()); + } + } + + public InputStream downloadFile(Long uuid, Long versionID)throws QaApplicationException{ + ITicket ticket = getRepositoryLoginTicket(); + try{ + IVersionedNode node = repositoryService.getFileItem(ticket,uuid,null); + logger.debug("retrieved node: " + node); + return node.getFile(); + }catch(AccessDeniedException e){ + throw new QaApplicationException("AccessDeniedException occured while trying to download file " + e.getMessage()); + }catch(FileException e){ + throw new QaApplicationException("FileException occured while trying to download file " + e.getMessage()); + }catch(ItemNotFoundException e){ + throw new QaApplicationException("ItemNotFoundException occured while trying to download file " + e.getMessage()); + } + } + + /** + * adds a new entry to the uploaded files table + */ + public void persistFile(String uuid, boolean isOnlineFile, String fileName, QaContent qaContent) throws QaApplicationException { + logger.debug("attempt persisting file to the db: " + uuid + " " + isOnlineFile + " " + fileName + " " + qaContent); + QaUploadedFile qaUploadedFile= new QaUploadedFile(uuid, isOnlineFile, fileName, qaContent); + logger.debug("created qaUploadedFile: " + qaUploadedFile); + qaUploadedFileDAO.saveUploadFile(qaUploadedFile); + logger.debug("persisted qaUploadedFile: " + qaUploadedFile); + } + + /** + * removes all the entries in the uploaded files table + */ + public void cleanUploadedFilesMetaData() throws QaApplicationException { + logger.debug("attempt cleaning up uploaded file meta data table from the db"); + qaUploadedFileDAO.cleanUploadedFilesMetaData(); + logger.debug("files meta data has been cleaned up"); + } + + + /** + * @return Returns the logger. + */ + public static Logger getLogger() { + return logger; + } + /** + * @param logger The logger to set. + */ + public static void setLogger(Logger logger) { + QaServicePOJO.logger = logger; + } + /** + * @return Returns the cred. + */ + public ICredentials getCred() { + return cred; + } + /** + * @param cred The cred to set. + */ + public void setCred(ICredentials cred) { + this.cred = cred; + } + /** + * @return Returns the qaUploadedFileDAO. + */ + public IQaUploadedFileDAO getQaUploadedFileDAO() { + return qaUploadedFileDAO; + } + /** + * @param qaUploadedFileDAO The qaUploadedFileDAO to set. + */ + public void setQaUploadedFileDAO(IQaUploadedFileDAO qaUploadedFileDAO) { + this.qaUploadedFileDAO = qaUploadedFileDAO; + } + /** + * @return Returns the repositoryId. + */ + public char[] getRepositoryId() { + return repositoryId; + } + /** + * @return Returns the repositoryUser. + */ + public String getRepositoryUser() { + return repositoryUser; + } + /** + * @return Returns the repositoryWorkspace. + */ + public String getRepositoryWorkspace() { + return repositoryWorkspace; + } + /** + * @return Returns the qaQueContentDAO. + */ + public IQaQueContentDAO getQaQueContentDAO() { + return qaQueContentDAO; + } + /** + * @return Returns the qaQueUsrDAO. + */ + public IQaQueUsrDAO getQaQueUsrDAO() { + return qaQueUsrDAO; + } + /** + * @return Returns the toolService. + */ + public ILamsToolService getToolService() { + return toolService; + } + /** + * @return Returns the userManagementService. + */ + public IUserManagementService getUserManagementService() { + return userManagementService; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServiceProxy.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServiceProxy.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/QaServiceProxy.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,73 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.service; + +import javax.servlet.ServletContext; +import org.lamsfoundation.lams.tool.ToolContentManager; +import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + + + + +/** + *

    This class act as the proxy between web layer and service layer. It is + * designed to decouple the presentation logic and business logic completely. + * In this way, the presentation tier will no longer be aware of the changes in + * service layer. Therefore we can feel free to switch the business logic + * implementation.

    + * + * @author Ozgur Demirtas + * + */ +public class QaServiceProxy +{ + /** + * Return the survey domain service object. It will delegate to the Spring + * helper method to retrieve the proper bean from Spring bean factory. + * @param servletContext the servletContext for current application + * @return survey service object. + */ + public static final IQaService getQaService(ServletContext servletContext) + { + return (IQaService)getQaDomainService(servletContext); + } + + public static final ToolSessionManager getQaSessionManager(ServletContext servletContext) + { + return (ToolSessionManager)getQaDomainService(servletContext); + } + + public static final ToolContentManager getQaContentManager(ServletContext servletContext) + { + return (ToolContentManager)getQaDomainService(servletContext); + } + + + private static Object getQaDomainService(ServletContext servletContext) + { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); + return wac.getBean("qaService"); + } + + +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,581 @@ +/* + * Created on 16/05/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaComparator; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** + * + * Keeps all operations needed for Authoring mode. + * @author Ozgur Demirtas + * + */ +public class AuthoringUtil implements QaAppConstants { + static Logger logger = Logger.getLogger(AuthoringUtil.class.getName()); + + /** + * reconstructQuestionContentMapForAdd(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * adds a new entry to the Map + */ + protected void reconstructQuestionContentMapForAdd(Map mapQuestionContent, HttpServletRequest request) + { + logger.debug("pre-add Map content: " + mapQuestionContent); + logger.debug("pre-add Map size: " + mapQuestionContent.size()); + + repopulateMap(mapQuestionContent, request); + + mapQuestionContent.put(new Long(mapQuestionContent.size()+1).toString(), ""); + request.getSession().setAttribute("mapQuestionContent", mapQuestionContent); + + logger.debug("post-add Map is: " + mapQuestionContent); + logger.debug("post-add count " + mapQuestionContent.size()); + } + + + /** + * reconstructQuestionContentMapForRemove(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * deletes the requested entry from the Map + */ + protected void reconstructQuestionContentMapForRemove(Map mapQuestionContent, HttpServletRequest request, QaAuthoringForm qaAuthoringForm) + { + String questionIndex =qaAuthoringForm.getQuestionIndex(); + logger.debug("pre-delete map content: " + mapQuestionContent); + logger.debug("questionIndex: " + questionIndex); + + long longQuestionIndex= new Long(questionIndex).longValue(); + logger.debug("pre-delete count: " + mapQuestionContent.size()); + + repopulateMap(mapQuestionContent, request); + logger.debug("post-repopulateMap questionIndex: " + questionIndex); + + mapQuestionContent.remove(new Long(longQuestionIndex).toString()); + logger.debug("removed the question content with index: " + longQuestionIndex); + request.getSession().setAttribute("mapQuestionContent", mapQuestionContent); + + logger.debug("post-delete count " + mapQuestionContent.size()); + logger.debug("post-delete map content: " + mapQuestionContent); + } + + + /** + * reconstructQuestionContentMapForSubmit(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * re-organizes the Map by removing empty entries from the user and creates the final Map ready for service layer + */ + protected void reconstructQuestionContentMapForSubmit(Map mapQuestionContent, HttpServletRequest request) + { + logger.debug("pre-submit Map:" + mapQuestionContent); + logger.debug("pre-submit Map size :" + mapQuestionContent.size()); + + repopulateMap(mapQuestionContent, request); + Map mapFinalQuestionContent = new TreeMap(new QaComparator()); + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + if ((pairs.getValue() != null) && (!pairs.getValue().equals(""))) + { + mapFinalQuestionContent.put(pairs.getKey(), pairs.getValue()); + logger.debug("adding the pair: " + pairs.getKey() + " = " + pairs.getValue()); + } + } + + mapQuestionContent=(TreeMap)mapFinalQuestionContent; + request.getSession().setAttribute("mapQuestionContent", mapQuestionContent); + logger.debug("post-submit Map:" + mapQuestionContent); + } + + + /** + * repopulateMap(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * repopulates the user entries into the Map + */ + protected void repopulateMap(Map mapQuestionContent, HttpServletRequest request) + { + logger.debug("queIndex: " + request.getSession().getAttribute("queIndex")); + long queIndex= new Long(request.getSession().getAttribute("queIndex").toString()).longValue(); + logger.debug("queIndex: " + queIndex); + + /** if there is data in the Map remaining from previous session remove those */ + mapQuestionContent.clear(); + logger.debug("Map got initialized: " + mapQuestionContent); + + for (long i=0; i < queIndex ; i++) + { + String candidateQuestionEntry =request.getParameter("questionContent" + i); + if (i==0) + { + request.getSession().setAttribute("defaultQuestionContent", candidateQuestionEntry); + logger.debug("defaultQuestionContent set to: " + candidateQuestionEntry); + } + if ((candidateQuestionEntry != null) && (candidateQuestionEntry.length() > 0)) + { + logger.debug("using key: " + i); + mapQuestionContent.put(new Long(i+1).toString(), candidateQuestionEntry); + logger.debug("added new entry."); + } + } + } + + + /** + * findSelectedTab(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + * + * @param mapping + * @param form + * @param request + * @param response + * + * determines which tab in the UI is the active one + */ + protected void findSelectedTab(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) + { + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + String choiceBasic=qaAuthoringForm.getChoiceBasic(); + String choiceAdvanced=qaAuthoringForm.getChoiceAdvanced(); + String choiceInstructions=qaAuthoringForm.getChoiceInstructions(); + + /** make the Basic tab the default one */ + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_BASIC); + + if (choiceBasic != null) + { + logger.debug("CHOICE_TYPE_BASIC"); + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_BASIC); + } + else if (choiceAdvanced != null) + { + logger.debug("CHOICE_TYPE_ADVANCED"); + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_ADVANCED); + } + else if (choiceInstructions != null) + { + logger.debug("CHOICE_TYPE_INSTRUCTIONS"); + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_INSTRUCTIONS); + } + + logger.debug("CHOICE is:" + request.getSession().getAttribute(CHOICE)); + /** reset tab controllers */ + qaAuthoringForm.choiceBasic=null; + qaAuthoringForm.choiceAdvanced=null; + qaAuthoringForm.choiceInstructions=null; + + + /** + * if the presentation is for monitoring EditActivity screen, keep preserving request scope START_MONITORING_SUMMARY_REQUEST + */ + Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY); + if ((renderMonitoringEditActivity != null) && (renderMonitoringEditActivity.booleanValue())) + { + request.setAttribute(FORM_INDEX, "1"); + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(true)); + } + else + { + request.setAttribute(FORM_INDEX, "0"); + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(false)); + } + + logger.debug("START_MONITORING_SUMMARY_REQUEST: " + request.getAttribute(START_MONITORING_SUMMARY_REQUEST)); + logger.debug("formIndex:" + request.getAttribute(FORM_INDEX)); + + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(false)); + if (qaAuthoringForm.getEdit() != null) + { + logger.debug("request for editActivity - editmode"); + IQaService qaService =QaUtils.getToolService(request); + Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); + logger.debug("MONITORED_CONTENT_ID: " + monitoredContentId); + + try + { + qaService.setAsDefineLater(monitoredContentId); + } + catch (ToolException e) + { + logger.debug("We should never come here."); + logger.debug("Warning! ToolException occurred"); + } + + + logger.debug("MONITORED_CONTENT_ID has been marked as defineLater: "); + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); + } + else + { + request.getSession().setAttribute(TITLE,qaAuthoringForm.getTitle()); + request.getSession().setAttribute(INSTRUCTIONS,qaAuthoringForm.getInstructions()); + } + } + + + /** + * createContent(TreeMap mapQuestionContent) + * return QaContent + * At this stage, the Map is available from the presentaion layer and can be passed to services layer for persistance. + * We are making the content and question contents persistent. + * Id generation is "CURRENTLY" based on java.util.Random + */ + protected QaContent createContent(Map mapQuestionContent, HttpServletRequest request, QaAuthoringForm qaAuthoringForm) + { + IQaService qaService =QaUtils.getToolService(request); + + /** the tool content id is passed from the container to the tool and placed into session in the QaStarterAction */ + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + if ((toolContentId != null) && (!toolContentId.equals(""))) + { + logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); + /**delete the existing content in the database before applying new content*/ + qaService.deleteQaById(new Long(toolContentId)); + logger.debug("post-deletion existing content"); + } + logger.debug("using TOOL_CONTENT_ID: " + toolContentId); + request.getSession().setAttribute(TOOL_CONTENT_ID,toolContentId); + + boolean isQuestionsSequenced=false; + boolean isSynchInMonitor=false; + boolean isUsernameVisible=false; + String reportTitle=""; + String monitoringReportTitle=""; + String offlineInstructions=""; + String onlineInstructions=""; + String endLearningMessage=""; + String creationDate=""; + + Boolean isQuestionsSequencedBoolean=new Boolean(false); + Boolean isSynchInMonitorBoolean=new Boolean(false); + Boolean isUsernameVisibleBoolean=new Boolean(false); + + Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY); + if ((renderMonitoringEditActivity != null) && (renderMonitoringEditActivity.booleanValue())) + { + logger.debug("getting properties based on editActivity: All properties available from the http session."); + isQuestionsSequencedBoolean=(Boolean)request.getSession().getAttribute(IS_QUESTIONS_SEQUENCED_MONITORING); + isSynchInMonitorBoolean=(Boolean)request.getSession().getAttribute(IS_SYNCH_INMONITOR_MONITORING); + isUsernameVisibleBoolean=(Boolean)request.getSession().getAttribute(IS_USERNAME_VISIBLE_MONITORING); + reportTitle=(String)request.getSession().getAttribute(REPORT_TITLE); + monitoringReportTitle=(String)request.getSession().getAttribute(MONITORING_REPORT_TITLE); + offlineInstructions=(String)request.getSession().getAttribute(OFFLINE_INSTRUCTIONS); + onlineInstructions=(String)request.getSession().getAttribute(ONLINE_INSTRUCTIONS); + endLearningMessage=(String)request.getSession().getAttribute(END_LEARNING_MESSSAGE); + endLearningMessage=(String)request.getSession().getAttribute(END_LEARNING_MESSSAGE); + + if (isQuestionsSequencedBoolean != null) + isQuestionsSequenced=isQuestionsSequencedBoolean.booleanValue(); + + if (isSynchInMonitorBoolean != null) + isSynchInMonitor=isSynchInMonitorBoolean.booleanValue(); + + if (isUsernameVisibleBoolean != null) + isUsernameVisible=isUsernameVisibleBoolean.booleanValue(); + } + else + { + logger.debug("getting properties based on normal flow: Properties available from form and request parameters."); + logger.debug("isQuestionsSequenced: " + qaAuthoringForm.getQuestionsSequenced()); + if (qaAuthoringForm.getQuestionsSequenced().equalsIgnoreCase(ON)) + isQuestionsSequenced=true; + + logger.debug("isSynchInMonitor: " + qaAuthoringForm.getSynchInMonitor()); + if (qaAuthoringForm.getSynchInMonitor().equalsIgnoreCase(ON)) + isSynchInMonitor=true; + + logger.debug("isUsernameVisible: " + qaAuthoringForm.getUsernameVisible()); + if (qaAuthoringForm.getUsernameVisible().equalsIgnoreCase(ON)) + isUsernameVisible=true; + + reportTitle=qaAuthoringForm.getReportTitle(); + monitoringReportTitle=qaAuthoringForm.getMonitoringReportTitle(); + offlineInstructions=qaAuthoringForm.getOnlineInstructions(); + onlineInstructions=qaAuthoringForm.getOfflineInstructions(); + endLearningMessage=qaAuthoringForm.getEndLearningMessage(); + } + creationDate=(String)request.getSession().getAttribute(CREATION_DATE); + if (creationDate == null) + creationDate=new Date(System.currentTimeMillis()).toString(); + + + /** read rich text values */ + String richTextOfflineInstructions=""; + richTextOfflineInstructions = (String)request.getSession().getAttribute(RICHTEXT_OFFLINEINSTRUCTIONS); + logger.debug("createContent: richTextOfflineInstructions from session: " + richTextOfflineInstructions); + if (richTextOfflineInstructions == null) richTextOfflineInstructions=""; + + String richTextOnlineInstructions=""; + richTextOnlineInstructions = (String)request.getSession().getAttribute(RICHTEXT_ONLINEINSTRUCTIONS); + logger.debug("createContent richTextOnlineInstructions from session: " + richTextOnlineInstructions); + if (richTextOnlineInstructions == null) richTextOnlineInstructions=""; + + String richTextTitle=""; + richTextTitle = (String)request.getSession().getAttribute(RICHTEXT_TITLE); + logger.debug("createContent richTextTitle from session: " + richTextTitle); + if (richTextTitle == null) richTextTitle=""; + + String richTextInstructions=""; + richTextInstructions = (String)request.getSession().getAttribute(RICHTEXT_INSTRUCTIONS); + logger.debug("createContent richTextInstructions from session: " + richTextInstructions); + if (richTextInstructions == null) richTextInstructions=""; + + + /**obtain user object from the session*/ + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("retrieving toolUser: " + toolUser); + logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); + String fullName= toolUser.getFirstName() + " " + toolUser.getLastName(); + logger.debug("retrieving toolUser fullname: " + fullName); + long userId=toolUser.getUserID().longValue(); + + /** create a new qa content and leave the default content intact*/ + QaContent qa = new QaContent(); + qa.setQaContentId(new Long(toolContentId)); + qa.setTitle(richTextTitle); + qa.setInstructions(richTextInstructions); + qa.setCreationDate(creationDate); /**preserve this from the db*/ + qa.setUpdateDate(new Date(System.currentTimeMillis())); /**keep updating this one*/ + qa.setCreatedBy(userId); /**make sure we are setting the userId from the User object above*/ + qa.setUsernameVisible(isUsernameVisible); + qa.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/ + qa.setSynchInMonitor(isSynchInMonitor); + qa.setOnlineInstructions(richTextOnlineInstructions); + qa.setOfflineInstructions(richTextOfflineInstructions); + qa.setEndLearningMessage(endLearningMessage); + qa.setReportTitle(reportTitle); + qa.setMonitoringReportTitle(monitoringReportTitle); + qa.setQaQueContents(new TreeSet()); + qa.setQaSessions(new TreeSet()); + qa.setQaUploadedFiles(new TreeSet()); + logger.debug("qa content :" + qa); + + /**create the content in the db*/ + qaService.createQa(qa); + logger.debug("qa created with content id: " + toolContentId); + + logger.debug("attempt cleaning files meta data from the db"); + qaService.cleanUploadedFilesMetaData(); + logger.debug("cleaned up files meta data from the db"); + + LinkedList listUploadedOfflineFiles = (LinkedList) request.getSession().getAttribute(LIST_UPLOADED_OFFLINE_FILES); + logger.debug("final listUploadedOfflineFiles: " + listUploadedOfflineFiles); + LinkedList listUploadedOnlineFiles = (LinkedList) request.getSession().getAttribute(LIST_UPLOADED_ONLINE_FILES); + logger.debug("final listUploadedOnlineFiles: " + listUploadedOnlineFiles); + + try{ + logger.debug("start persisting offline file information to db..."); + Iterator offlineFilesIterator=listUploadedOfflineFiles.iterator(); + while (offlineFilesIterator.hasNext()) + { + String uuidAndFileName=(String) offlineFilesIterator.next(); + logger.debug("iterated uuidAndFileName: " + uuidAndFileName); + if ((uuidAndFileName != null) && (uuidAndFileName.indexOf('~') > 0)) + { + int separator=uuidAndFileName.indexOf('~'); + logger.debug("separator: " + separator); + String uuid=uuidAndFileName.substring(0,separator); + String fileName=uuidAndFileName.substring(separator+1); + logger.debug("using uuid: " + uuid); + logger.debug("using fileName: " + fileName); + qaService.persistFile(uuid,false, fileName,qa); + } + } + logger.debug("all offline files data has been persisted"); + } + catch(Exception e) + { + logger.debug("error persisting offline files data: " + listUploadedOfflineFiles); + } + + try{ + logger.debug("start persisting online file information to db..."); + Iterator onlineFilesIterator=listUploadedOnlineFiles.iterator(); + while (onlineFilesIterator.hasNext()) + { + String uuidAndFileName=(String) onlineFilesIterator.next(); + logger.debug("iterated uuidAndFileName: " + uuidAndFileName); + if ((uuidAndFileName != null) && (uuidAndFileName.indexOf('~') > 0)) + { + int separator=uuidAndFileName.indexOf('~'); + logger.debug("separator: " + separator); + String uuid=uuidAndFileName.substring(0,separator); + String fileName=uuidAndFileName.substring(separator+1); + logger.debug("using uuid: " + uuid); + logger.debug("using fileName: " + fileName); + qaService.persistFile(uuid,true, fileName,qa); + } + } + logger.debug("all online files data has been persisted"); + } + catch(Exception e) + { + logger.debug("error persisting offline files data: " + listUploadedOnlineFiles); + } + + return qa; + } + + + /** + * createQuestionContent(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * + * persist the questions in the Map the user has submitted + */ + protected void createQuestionContent(Map mapQuestionContent, HttpServletRequest request, QaContent qaContent) + { + IQaService qaService =QaUtils.getToolService(request); + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + int diplayOrder=0; + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + /**make sure question entered is NOT blank*/ + if (pairs.getValue().toString().length() != 0) + { + QaQueContent queContent= new QaQueContent(pairs.getValue().toString(), + ++diplayOrder, + qaContent, + null, + null); + + logger.debug("queContent: " + queContent); + qaService.createQaQue(queContent); + logger.debug("a qaQueContent created:"); + } + } + logger.debug("all questions in the Map persisted:"); + } + + + /** remove existing content data from the db + * + * qaService.removeToolContent(Long toolContentId) gets automatically called only in monitoring mode when + * the author chooses to delete a lesson. + * + * In here we act as another client of this contact method since we want to clear q/a tool's content tables based on + * author's UI interactions. We are removing content + question's content + relavant tool sessions from the db. + * + * removeAllDBContent(TreeMap mapQuestionContent, HttpServletRequest request) + * return void + * removes content for a specific content Id + */ + protected void removeAllDBContent(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + logger.debug("retrieve qaService: " + qaService); + String toolContentId=null; + + if (request.getSession().getAttribute(TOOL_CONTENT_ID) != null) + toolContentId=(String)(request.getSession().getAttribute(TOOL_CONTENT_ID)); + + if ((toolContentId != null) && (!toolContentId.equals(""))) + { + logger.debug("simulate container behaviour by calling: removeToolContent with: " + new Long(toolContentId)); + /** + * we are calling removeToolContent to clear content tables although this method normally + * gets called only in the monitoring mode automatically by the core. + * + * Having this method here also makes sure that this contract has implemented and tested properly. + */ + qaService.removeToolContent(new Long(toolContentId)); + logger.debug("simulated container behaviour by calling: removeToolContent with: " + toolContentId); + logger.debug("removed content from database for content id:" + toolContentId); + } + } + + /** + * Normally, a request to set runOffline property of the content comes directly from container through the property inspector. + * What we do below is simulate that for development purposes. + * @param request + */ + + public void simulatePropertyInspector_RunOffline(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + if ((toolContentId != null) && (!toolContentId.equals(""))) + { + logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); + try + { + qaService.setAsRunOffline(new Long(toolContentId)); + } + catch(ToolException e) + { + logger.debug("we should never come here"); + } + + logger.debug("post-RunAsOffline"); + } + logger.debug("end of simulating RunOffline on content id: " + toolContentId); + } + + /** + * Normally, a request to set defineLaterproperty of the content comes directly from container through the property inspector. + * What we do below is simulate that for development purposes. + * @param request + */ + public void simulatePropertyInspector_setAsDefineLater(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + + String toolContentId=(String)request.getSession().getAttribute(TOOL_CONTENT_ID); + if ((toolContentId != null) && (!toolContentId.equals(""))) + { + logger.debug("passed TOOL_CONTENT_ID : " + new Long(toolContentId)); + try + { + qaService.setAsDefineLater(new Long(toolContentId)); + } + catch(ToolException e) + { + logger.debug("we should never come here"); + } + + logger.debug("post-setAsDefineLater"); + } + logger.debug("end of simulating setAsDefineLater on content id: " + toolContentId); + } + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,605 @@ +/** + * + * Keeps all operations needed for Learning mode. + * @author ozgurd + * + */ +package org.lamsfoundation.lams.tool.qa.web; + +import java.util.Date; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaComparator; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaStringComparator; +import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + +/** + * + * Keeps all operations needed for Learning mode. + * @author Ozgur Demirtas + * + */ +public class LearningUtil implements QaAppConstants{ + static Logger logger = Logger.getLogger(LearningUtil.class.getName()); + + /** + * NEVER USED: redundant method. + * @param request + */ + protected void deleteSessionUsersAndResponses(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + /** + * retrive contentId from the http session + */ + logger.debug("attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID)); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + QaContent qaContent=qaService.retrieveQa(toolContentId.longValue()); + + logger.debug("retrieving qaContent: " + qaContent); + Iterator sessionIterator=qaContent.getQaSessions().iterator(); + while (sessionIterator.hasNext()) + { + QaSession qaSession=(QaSession)sessionIterator.next(); + logger.debug("iterated qaSession : " + qaSession); + + Iterator sessionUsersIterator=qaSession.getQaQueUsers().iterator(); + while (sessionUsersIterator.hasNext()) + { + QaQueUsr qaQueUsr=(QaQueUsr) sessionUsersIterator.next(); + logger.debug("iterated qaQueUsr : " + qaQueUsr); + + Iterator sessionUsersResponsesIterator=qaQueUsr.getQaUsrResps().iterator(); + while (sessionUsersResponsesIterator.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)sessionUsersResponsesIterator.next(); + logger.debug("iterated qaUsrResp : " + qaUsrResp); + qaService.removeUserResponse(qaUsrResp); + logger.debug("removed qaUsrResp : " + qaUsrResp); + } + } + } + logger.debug("end of deleteSessionUsersAndResponses()"); + } + + + /** + * NEVER USED: redundant method. + * deletes the user of a particular question content and her responses + * deleteExistingUsersAndResponses(HttpServletRequest request) + * + * return void + * @param request + */ + protected void deleteExistingUsersAndResponses(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + /** + * retrive contentId from the http session + */ + logger.debug("attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID)); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + QaContent qaContent=qaService.retrieveQa(toolContentId.longValue()); + + logger.debug("retrieving qaContent: " + qaContent); + + /** + * get iterator of questions collection + */ + Iterator contentIterator=qaContent.getQaQueContents().iterator(); + while (contentIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); + logger.debug("retrieving qaQueContent: " + qaQueContent); + if (qaQueContent != null) + { + Set qaQueUsers=qaQueContent.getQaQueUsers(); + logger.debug("qaQueUsers size: " + qaQueUsers.size()); + /** + * iterate users and delete them + */ + Iterator usersIterator=qaQueUsers.iterator(); + while (usersIterator.hasNext()) + { + QaQueUsr qaQueUsr=(QaQueUsr) usersIterator.next(); + logger.debug("retrieving qaQueUsr: " + qaQueUsr); + if (qaQueUsr != null) + { + Set qaUsrResps=qaQueUsr.getQaUsrResps(); + logger.debug("retrieving user's all responses : " + qaUsrResps); + Iterator responsesIterator=qaUsrResps.iterator(); + while (responsesIterator.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)responsesIterator.next(); + if (qaUsrResp != null) + { + logger.debug("retrieving qaUsrResp: " + qaUsrResp); + qaService.removeUserResponse(qaUsrResp); + logger.debug("removed qaUsrResp with id:" + qaUsrResp.getResponseId()); + } + } + qaService.deleteQaQueUsr(qaQueUsr); + logger.debug("deleted user: " + qaQueUsr); + } + } + } + } + logger.debug("end of deleteExistingUsersAndResponses()"); + } + + + /** + * createUsersAndResponses(Map mapAnswers, HttpServletRequest request) + * create users of the responses + * @param mapAnswers, request + * return void + * + */ + protected void createUsersAndResponses(Map mapAnswers, HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + logger.debug("createUsers-retrieving qaService: " + qaService); + + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("retrieving toolUser: " + toolUser); + logger.debug("retrieving toolUser userId: " + toolUser.getUserID()); + logger.debug("retrieving toolUser username: " + toolUser.getLogin()); + /** + * !!double check this!! + */ + String userName=toolUser.getLogin(); + String fullName= toolUser.getFirstName() + " " + toolUser.getLastName(); + logger.debug("retrieving toolUser fullname: " + fullName); + + Long userId=new Long(toolUser.getUserID().longValue()); + + /** + * retrive contentId from the http session + */ + logger.debug("createUsers-attempt retrieving toolContentId: " + request.getSession().getAttribute(TOOL_CONTENT_ID)); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + /** + * obtain QaContent to be used in creating QaQueUsr + */ + QaContent qaContent=qaService.retrieveQa(toolContentId.longValue()); + logger.debug("createUsers-retrieving qaContent: " + qaContent); + + /** + * get QaSession to be used in creating QaQueUsr + */ + Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("createUsers-retrieving toolSessionId: " + toolSessionId); + QaSession qaSession = qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + logger.debug("createUsers-retrieving qaSession: " + qaSession); + + Iterator contentIterator=qaContent.getQaQueContents().iterator(); + logger.debug("createUsers-attempt iteration questions"); + + QaQueUsr qaQueUsr= new QaQueUsr(userId, + userName, + fullName, + null, + qaSession, + new TreeSet()); + + logger.debug("createQaQueUsr - qaQueUsr: " + qaQueUsr); + if (qaQueUsr != null) + { + qaService.createQaQueUsr(qaQueUsr); + logger.debug("createUsers-qaQueUsr created in the db: " + qaQueUsr); + } + + while (contentIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); + if (qaQueContent != null) + { + /** + * get the question + */ + String question=qaQueContent.getQuestion(); + /** + * get the question's display order + */ + String displayOrder=new Long(qaQueContent.getDisplayOrder()).toString(); + + /** + * get the answer from the map of that displayOrder + */ + String answer=(String)mapAnswers.get(displayOrder); + + logger.debug("iterationg question-answers: displayOrder: " + displayOrder + + " question: " + question + " answer: " + answer); + + String timezoneId=(String)request.getSession().getAttribute(TIMEZONE_ID); + if (timezoneId == null) timezoneId=""; + + QaUsrResp qaUsrResp= new QaUsrResp(answer,false, + new Date(System.currentTimeMillis()), + timezoneId, + qaQueContent, + qaQueUsr); + + logger.debug("iterationg qaUsrResp: " + qaUsrResp); + if (qaUsrResp != null) + { + qaService.createQaUsrResp(qaUsrResp); + logger.debug("created qaUsrResp in the db"); + } + + } + } + logger.debug("both the users and their responses created in the db"); + } + + + /** + * creates a data structure to hold learner report data + * buidLearnerReport(HttpServletRequest request, Map mapQuestions, Map mapAnswers) + * + * calls processUserResponses() to do some of the work + * @param HttpServletRequest request, Map mapQuestions, Map mapAnswers + * return void + * + */ + protected void buidLearnerReport(HttpServletRequest request, int toolSessionIdCounter) + { + IQaService qaService =QaUtils.getToolService(request); + + /** + * find out the current tool session + */ + Long toolSessionId=(Long) request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("processUserResponses using toolSessionId: " + toolSessionId); + + /** + * holds all the tool sessions passed in from the url + * used in monitoring mode + */ + Map mapToolSessions=(Map)request.getSession().getAttribute(MAP_TOOL_SESSIONS); + logger.debug("retrieving MAP_TOOL_SESSIONS from the session: " + mapToolSessions); + + + /** + * keys of the Map refers to questions and values refers to user info and their entries + * used in learning mode + */ + Map mapMainReport= new TreeMap(new QaStringComparator()); + logger.debug("mapMainReport created with QaStringComparator"); + + Long toolContentId=(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("current toolContentId: " + toolContentId); + QaContent qaContent=qaService.loadQa(toolContentId.longValue()); + logger.debug("retrieve qaContent: " + qaContent); + + Iterator contentIterator=qaContent.getQaQueContents().iterator(); + logger.debug("content iteration count: " + qaContent.getQaQueContents().size()); + + int questionIndex=0; + /** + * used to iterate responses to questions within the tool sessions in the jsp level in the monitoring mode + */ + Map mapQuestions= new TreeMap(new QaStringComparator()); + logger.debug("mapQuestions created with QaStringComparator"); + + /** + * used to iterate questions within the tool sessions in the jsp level in the monitoring mode + */ + Map mapMonitoringQuestions= new TreeMap(new QaStringComparator()); + logger.debug("mapMonitoringQuestions created with QaStringComparator"); + + while (contentIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); + logger.debug("retrieve qaQueContent: " + qaQueContent); + if (qaQueContent != null) + { + /** + * obtain All responses from ALL users to this question + */ + Set qaUsrResps=qaQueContent.getQaUsrResps(); + logger.debug("the set of user responses qaUsrResps: " + qaUsrResps); + + /** + * deal with all responses + */ + questionIndex=questionIndex+1; + logger.debug("current questionIndex: " + questionIndex); + + String targetMode=(String) request.getSession().getAttribute(TARGET_MODE); + logger.debug("TARGET_MODE: " + targetMode); + + logger.debug("buidLearnerReport for TARGET_MODE: " + targetMode); + if (targetMode.equalsIgnoreCase(TARGET_MODE_MONITORING)) + { + Map mapUserResponses=processUserResponses(request, qaUsrResps, questionIndex, new TreeMap()); + /** + * Map mapQuestions for holding the question index /responses pair + */ + mapQuestions.put(new Integer(questionIndex).toString(),mapUserResponses); + logger.debug("getting mapQuestions: " + mapQuestions); + /** + * Map mapQuestions for holding the questions themselves + */ + mapMonitoringQuestions.put(new Integer(questionIndex).toString(),qaQueContent.getQuestion()); + logger.debug("getting mapMonitoringQuestions: " + mapMonitoringQuestions); + request.getSession().setAttribute(MAP_MONITORING_QUESTIONS,mapMonitoringQuestions); + + mapToolSessions.put(toolSessionId.toString(), mapQuestions); + logger.debug("mapToolSessionsupdated: " + mapToolSessions); + request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); + logger.debug("MAP_TOOL_SESSIONS in session updated: " + mapToolSessions); + } + else + { + Map mapUserResponses= new TreeMap(new QaComparator()); + mapUserResponses=processUserResponses(request, qaUsrResps, questionIndex, mapUserResponses); + mapMainReport.put(qaQueContent.getQuestion(), mapUserResponses); + } + } + } + logger.debug("mapMainReport: " + mapMainReport); + request.getSession().setAttribute(MAP_MAIN_REPORT, mapMainReport); + } + + + /** + * This method prepares the report to eb presented in both leraning and monitoring mode. + * In learning mode in places the curresnt user's data in the first row. + * In monitoring mode, it just presents data as it reads into the Map as usual. + * + * + * Reporting in Learning mode is different than reporting in monitoring mode in two main respects: + * 1- Use of username visible applies only to learning mode + * 2- Placing the current user's name first in the generated list only applies to learning mode + * + * prepares ALL responses to a particular question and + * makes it available to the UI. + * processUserResponses(Set qaUsrResps) + * return void + * @param qaUsrResps + */ + protected Map processUserResponses(HttpServletRequest request, Set qaUsrResps, int questionIndex, Map mapUserResponses) + { + logger.debug("will be processing user responses: "); + + /** + * find out the current tool session + */ + Long toolSessionId=(Long) request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("processUserResponses using toolSessionId: " + toolSessionId); + + /** + * find out the tool's mode. We produce different reports for learning and monitoring + */ + String targetMode=(String)request.getSession().getAttribute(TARGET_MODE); + logger.debug("TARGET_MODE: " + targetMode); + + if (targetMode.equalsIgnoreCase(TARGET_MODE_MONITORING)) + { + logger.debug("processUserResponses for TARGET_MODE: " + targetMode); + + if (qaUsrResps.isEmpty()) + logger.debug("the set of user responses for a particular question is empty."); + + Iterator itResps=qaUsrResps.iterator(); + /** + * obtain each response and the user that replied with that response + */ + int responseIndex=0; + while (itResps.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)itResps.next(); + logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex); + /** + * Don't include the blank answers in the report. Make sure it is the requirement. + */ + if ((qaUsrResp != null) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals(""))) + { + logger.debug("iterated qaUsrResp:" + qaUsrResp); + logger.debug("isResponseHidden: " + qaUsrResp.isHidden()); + QaQueUsr qaQueUsr=qaUsrResp.getQaQueUser(); + //find out what you need to display: fullname or login (userName)? + logger.debug("iterated qaQueUsr fullName:" + qaQueUsr.getFullname()); + logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getUsername()); + logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession()); + logger.debug("using responseIndex: " + responseIndex); + + QaSession qaSession=qaQueUsr.getQaSession(); + if (toolSessionId.equals(qaSession.getQaSessionId())) + { + responseIndex=responseIndex+1; + logger.debug("responseIndex incremented to: " + responseIndex); + mapUserResponses.put(new Integer(responseIndex).toString(), qaQueUsr.getFullname() + " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); + logger.debug("setting attemptTime: " + "aTime" + questionIndex +""+ responseIndex + "---------" + qaUsrResp.getAttemptTime()); + logger.debug("setting final monitoring report data with:" + toolSessionId + " " + questionIndex + " " + responseIndex); + + request.getSession().setAttribute(FULLNAME + toolSessionId + "" + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); + request.getSession().setAttribute(ANSWER + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getAnswer()); + request.getSession().setAttribute(ATIME + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getAttemptTime()); + request.getSession().setAttribute(TIMEZONE_ID + questionIndex + "" + responseIndex, qaUsrResp.getTimezone()); + request.getSession().setAttribute(RESPONSE_ID + toolSessionId + "" + questionIndex +""+ responseIndex, qaUsrResp.getResponseId()); + + boolean isResponseHidden=qaUsrResp.isHidden(); + logger.debug("isResponseHidden: " + isResponseHidden); + request.getSession().setAttribute(RESPONSE_HIDDEN + toolSessionId + "" + questionIndex +""+ responseIndex, new Boolean(isResponseHidden)); + } + } + } + } + else if (targetMode.equalsIgnoreCase(TARGET_MODE_LEARNING)) + { + logger.debug("processUserResponses for TARGET_MODE: " + targetMode); + /** + * find out whos is the current user. Important to know for reporting responses in learning mode + */ + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO toolUser = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("retrieving toolUser: " + toolUser + " userName: " + toolUser.getLogin()); + /** + * !!double check if String userName=toolUser.getLogin(); + */ + + /** + * see whether you have to report only the current learner's name and make invisible all the other learner's names in the report. + * A boolean true isUsernameVisible indicates that all user names to be displayed. + * Only applies to learning mode. + */ + + Boolean isUsernameVisible=(Boolean)request.getSession().getAttribute(IS_USERNAME_VISIBLE); + logger.debug("IS_USERNAME_VISIBLE: " + isUsernameVisible); + + + if (qaUsrResps.isEmpty()) + logger.debug("the set of user responses for a particular question is empty."); + + Iterator itResps=qaUsrResps.iterator(); + /** + * obtain each response and the user that replied with that response + */ + int responseIndex=0; + while (itResps.hasNext()) + { + QaUsrResp qaUsrResp=(QaUsrResp)itResps.next(); + logger.debug("using qaUsrResp: " + qaUsrResp + " with responseIndex: " + responseIndex); + /** + * Don't include the blank answers in the report. Make sure it is the requirement. + */ + if ((qaUsrResp != null) && (!qaUsrResp.isHidden()) && (qaUsrResp.getAnswer() != null) && (!qaUsrResp.getAnswer().equals(""))) + { + logger.debug("iterated qaUsrResp:" + qaUsrResp); + QaQueUsr qaQueUsr=qaUsrResp.getQaQueUser(); + //find out what you need to display: fullname or login (userName)? + logger.debug("iterated qaQueUsr fullName:" + qaQueUsr.getFullname()); + logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getUsername()); + logger.debug("iterated qaQueUsr userName:" + qaQueUsr.getQaSession()); + logger.debug("using responseIndex: " + responseIndex); + + /** + * find out if the current tool user's login(userName) is the same as the iterated user's userName. + * If there is a match we need to display that person first in the report + * !!do this when User objkect issue is resolved!!! + */ + + /** + * these are all the other users. See if we have the permission to display their names. + * if we are permitted, get ready to display all available information + */ + + /** + * get user's tool session + */ + QaSession qaSession=qaQueUsr.getQaSession(); + logger.debug("iterated qaQueUsr userName:" + qaSession.getQaSessionId()); + logger.debug("incoming toolSessionId versus user's toolSessionId:" + toolSessionId + " versus " + qaSession.getQaSessionId()); + + logger.debug("toolSessionId versus iterated session id: " + toolSessionId + "--" + qaSession.getQaSessionId()); + logger.debug("learner report includes only those responses in the same tool session: " + toolSessionId); + if (toolSessionId.equals(qaSession.getQaSessionId())) + { + + responseIndex=responseIndex+1; + logger.debug("responseIndex incremented to: " + responseIndex); + if (isUsernameVisible.booleanValue()) + { + logger.debug("IS_USERNAME_VISIBLE:" + isUsernameVisible.booleanValue()); + mapUserResponses.put(new Integer(responseIndex).toString(), qaQueUsr.getFullname() + " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); + logger.debug("Building request level response data with: " + + "fullname" + questionIndex +""+ responseIndex); + request.getSession().setAttribute(FULLNAME + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); + + } + else /** we won't display the usernames of these users*/ + { + logger.debug("IS_USERNAME_VISIBLE:" + isUsernameVisible.booleanValue()); + mapUserResponses.put(new Integer(responseIndex).toString(), " " + qaUsrResp.getAttemptTime() + " " + qaUsrResp.getAnswer()); + logger.debug("Building request level response data with: " + + "aTime" + questionIndex +""+ responseIndex); + } + /** + * place these whether username visible or not + */ + + logger.debug("setting attemptTime: " + "aTime" + questionIndex +""+ responseIndex + + "---------" + qaUsrResp.getAttemptTime() +"-----" + qaUsrResp.getTimezone() ); + + request.getSession().setAttribute(ANSWER + questionIndex +""+ responseIndex, qaUsrResp.getAnswer()); + request.getSession().setAttribute(ATIME + questionIndex +""+ responseIndex, qaUsrResp.getAttemptTime()); + request.getSession().setAttribute(FORMATTED_ATIME + questionIndex +""+ responseIndex, QaUtils.getFormattedDateString(qaUsrResp.getAttemptTime())); + logger.debug("setting formattedDatetime"); + request.getSession().setAttribute(TIMEZONE_ID + questionIndex +""+ responseIndex, qaUsrResp.getTimezone()); + + if (qaQueUsr.getUsername().equalsIgnoreCase(toolUser.getLogin())) + { + request.getSession().setAttribute(FULLNAME + questionIndex +""+ responseIndex, qaQueUsr.getFullname()); + logger.debug("include fullName for current learner: " + "fullName" + questionIndex +""+ responseIndex + "---" + qaQueUsr.getFullname()); + logger.debug("current learner:" + qaQueUsr.getUsername()); + request.getSession().setAttribute(CURRENTLEARNER_FULLNAME , qaQueUsr.getFullname()); + logger.debug("current learner fullname:" + qaQueUsr.getFullname()); + } + } + } + } + } + logger.debug("Learner report MAP_USER_RESPONSES: " + mapUserResponses); + return mapUserResponses; + } + + + /** + * feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex) + * give user feedback on the remaining questions + * @param qaLearningForm + * return void + */ + protected void feedBackAnswersProgress(HttpServletRequest request, int currentQuestionIndex) + { + String totalQuestionCount=(String)request.getSession().getAttribute(TOTAL_QUESTION_COUNT); + logger.debug("totalQuestionCount: " + totalQuestionCount); + int remainingQuestionCount=new Long(totalQuestionCount).intValue() - currentQuestionIndex +1; + logger.debug("remainingQuestionCount: " + remainingQuestionCount); + String userFeedback=""; + if (remainingQuestionCount != 0) + userFeedback= "Remaining question count: " + remainingQuestionCount; + else + userFeedback= "End of the questions."; + + request.getSession().setAttribute(USER_FEEDBACK, userFeedback); + } + + public void lockContent(HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + Long toolContentId=(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("current toolContentId: " + toolContentId); + QaContent qaContent=qaService.loadQa(toolContentId.longValue()); + logger.debug("retrieve qaContent: " + qaContent); + + qaContent.setContentLocked(true); + logger.debug("content with id : " + toolContentId + "has been marked LOCKED"); + qaService.updateQa(qaContent); + logger.debug("content with id : " + toolContentId + "has been marked LOCKED and updated in the db"); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/MonitoringUtil.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,299 @@ +/** + * + * Keeps all operations needed for Learning mode. + * @author ozgurd + * + */ +package org.lamsfoundation.lams.tool.qa.web; + +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaUsrResp; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; + +/** + * + * Keeps all operations needed for Monitoring mode. + * @author Ozgur Demirtas + * + */ +public class MonitoringUtil implements QaAppConstants{ + static Logger logger = Logger.getLogger(MonitoringUtil.class.getName()); + + /** + * determine whether all the tool sessions for a particular content has been COMPLETED + * @param toolContentId + * @return + */ + + public boolean isSessionsSync(HttpServletRequest request, long toolContentId) + { + logger.debug("start of isSessionsSync with toolContentId: " + toolContentId); + IQaService qaService =QaUtils.getToolService(request); + + QaContent qaContent =qaService.loadQa(toolContentId); + logger.debug("retrieving qaContent: " + qaContent); + + /** + * iterate all the tool sessions, if even one session is INCOMPLETE, the function returns false + */ + if (qaContent != null) + { + Iterator sessionIterator=qaContent.getQaSessions().iterator(); + while (sessionIterator.hasNext()) + { + QaSession qaSession=(QaSession)sessionIterator.next(); + logger.debug("iterated qaSession : " + qaSession); + if (qaSession.getSession_status().equalsIgnoreCase(QaSession.INCOMPLETE)) + return false; + } + } + + return true; + } + + public void cleanupMonitoringSession(HttpServletRequest request) + { + request.getSession().removeAttribute(MAP_TOOL_SESSIONS); + request.getSession().removeAttribute(MAP_MONITORING_QUESTIONS); + request.getSession().removeAttribute(CURRENT_MONITORED_TOOL_SESSION); + request.getSession().removeAttribute(MAP_USER_RESPONSES); + request.getSession().removeAttribute(DATAMAP_EDITABLE); + request.getSession().removeAttribute(CHOICE_MONITORING); + request.getSession().removeAttribute(DATAMAP_EDITABLE_RESPONSE_ID); + request.getSession().removeAttribute(DATAMAP_HIDDEN_RESPONSE_ID); + + /** remove session attributes used commonly */ + request.getSession().removeAttribute(IS_USERNAME_VISIBLE); + request.getSession().removeAttribute(REPORT_TITLE_MONITOR); + request.getSession().removeAttribute(IS_ALL_SESSIONS_COMPLETED); + request.getSession().removeAttribute(CHECK_ALL_SESSIONS_COMPLETED); + request.getSession().removeAttribute(TOOL_CONTENT_ID); + request.getSession().removeAttribute(ATTR_USERDATA); + request.getSession().removeAttribute(TOOL_SERVICE); + request.getSession().removeAttribute(TARGET_MODE); + } + + + public void startLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request) throws ToolException + { + IQaService qaService=QaUtils.getToolService(request); + + String strFromToolContentId=""; + String strToToolContentId=""; + + qaMonitoringForm.resetUserAction(); + /** + * In deployment, we won't be passing FROM_TOOL_CONTENT_ID, TO_TOOL_CONTENT_ID and TOOL_SESSION_ID from url + * the Monitoring Service bean calls: + * copyToolContent(Long fromContentId, Long toContentId) + */ + strFromToolContentId=request.getParameter(FROM_TOOL_CONTENT_ID); + logger.debug("startLesson" + "FROM_TOOL_CONTENT_ID: " + strFromToolContentId); + if (strFromToolContentId == null) + { + throw new QaApplicationException("Exception occured: " + + "Tool expects a legitimate FROM_TOOL_CONTENT_ID from the container. Can't continue!"); + } + + strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID); + logger.debug("startLesson" + "TO_TOOL_CONTENT_ID: " + strToToolContentId); + if (strToToolContentId == null) + { + throw new QaApplicationException("Exception occured: " + + "Tool expects a legitimate TO_TOOL_CONTENT_ID from the container. Can't continue!"); + } + + try + { + qaService.copyToolContent(new Long(strFromToolContentId), new Long(strToToolContentId)); + } + catch(ToolException e) + { + logger.debug("exception copying content."); + throw e; + } + + /** calls to these two methods will be made from Monitoring Service bean optionally depending on + * the the tool is setup for DefineLater and (or) RunOffline + */ + + /** + * TESTED to work + * qaService.setAsDefineLater(new Long(strToToolContentId)); + qaService.setAsRunOffline(new Long(strToToolContentId)); + * + */ + qaMonitoringForm.resetUserAction(); + } + + + public void deleteLesson(QaMonitoringForm qaMonitoringForm, HttpServletRequest request) + { + IQaService qaService=QaUtils.getToolService(request); + + String strFromToolContentId=""; + String strToToolContentId=""; + + qaMonitoringForm.resetUserAction(); + + /** + * TESTED to work + */ + strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID); + logger.debug("TO_TOOL_CONTENT_ID: " + strToToolContentId); + if (strToToolContentId == null) + { + throw new QaApplicationException("Exception occured: " + + "Tool expects a legitimate TO_TOOL_CONTENT_ID from the container. Can't continue!"); + } + qaService.removeToolContent(new Long(strToToolContentId)); + qaMonitoringForm.resetUserAction(); + } + + + public void forceComplete(QaMonitoringForm qaMonitoringForm, HttpServletRequest request) + { + IQaService qaService=QaUtils.getToolService(request); + /** + * Parameter: userId + */ + qaMonitoringForm.resetUserAction(); + logger.debug("request for forceComplete"); + String userId=request.getParameter(MONITOR_USER_ID); + logger.debug("MONITOR_USER_ID: " + userId); + qaService.setAsForceComplete(new Long(userId)); + logger.debug("end of setAsForceComplete with userId: " + userId); + } + + + public boolean isDefaultMonitoringScreen(QaMonitoringForm qaMonitoringForm) + { + if ((qaMonitoringForm.getSummary() == null) && + (qaMonitoringForm.getInstructions() == null) && + (qaMonitoringForm.getEditActivity() == null) && + (qaMonitoringForm.getStats() == null)) + { + qaMonitoringForm.setSummary("summary"); + return true; + } + return false; + } + + + /** + * findSelectedMonitoringTab(ActionForm form, + * HttpServletRequest request) + * return void + * determines which monitoring tabs is the active one. + * + */ + public void findSelectedMonitoringTab(ActionForm form, + HttpServletRequest request) + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + String choiceTypeMonitoringSummary=qaMonitoringForm.getSummary(); + String choiceTypeMonitoringInstructions=qaMonitoringForm.getInstructions(); + String choiceTypeMonitoringEditActivity=qaMonitoringForm.getEditActivity(); + String choiceTypeMonitoringStats=qaMonitoringForm.getStats(); + + /**make the Summary tab the default one */ + request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_SUMMARY); + + if (choiceTypeMonitoringSummary != null) + { + logger.debug("CHOICE_TYPE_MONITORING_SUMMARY"); + request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_SUMMARY); + } + else if ((choiceTypeMonitoringInstructions != null) || (qaMonitoringForm.getSubmitMonitoringInstructions() != null)) + { + logger.debug("CHOICE_TYPE_MONITORING_INSTRUCTIONS"); + request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_INSTRUCTIONS); + } + else if (choiceTypeMonitoringEditActivity != null) + { + logger.debug("CHOICE_TYPE_MONITORING_EDITACTIVITY"); + request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_EDITACTIVITY); + } + else if (choiceTypeMonitoringStats != null) + { + logger.debug("CHOICE_TYPE_MONITORING_STATS"); + request.getSession().setAttribute(CHOICE_MONITORING,CHOICE_TYPE_MONITORING_STATS); + } + logger.debug("CHOICE_MONITORING is:" + request.getSession().getAttribute(CHOICE_MONITORING)); + + /** reset tab controllers */ + qaMonitoringForm.setSummary(null); + qaMonitoringForm.setInstructions(null); + qaMonitoringForm.setEditActivity(null); + qaMonitoringForm.setStats(null); + } + + public boolean isNonDefaultScreensVisited(HttpServletRequest request) + { + Boolean monitoringInstructionsVisited = (Boolean) request.getSession().getAttribute(MONITORING_INSTRUCTIONS_VISITED); + Boolean monitoringEditActivityVisited = (Boolean) request.getSession().getAttribute(MONITORING_EDITACTIVITY_VISITED); + Boolean monitoringStatsVisited = (Boolean) request.getSession().getAttribute(MONITORING_STATS_VISITED); + + logger.debug("isNonDefaultScreensVisited:" + monitoringInstructionsVisited + " " + + monitoringEditActivityVisited + " " + monitoringStatsVisited); + + if ((monitoringInstructionsVisited != null) && (monitoringInstructionsVisited.booleanValue())) + return true; + + if ((monitoringEditActivityVisited != null) && (monitoringEditActivityVisited.booleanValue())) + return true; + + if ((monitoringStatsVisited != null) && (monitoringStatsVisited.booleanValue())) + return true; + + return false; + } + + public void updateResponse(HttpServletRequest request, String responseId, String updatedResponse) + { + IQaService qaService=QaUtils.getToolService(request); + + logger.debug("load response with responseId: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setAnswer(updatedResponse); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } + + public void hideResponse(HttpServletRequest request, String responseId) + { + IQaService qaService=QaUtils.getToolService(request); + + logger.debug("load response with responseId for hiding: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setHidden(true); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } + + + public void unHideResponse(HttpServletRequest request, String responseId) + { + IQaService qaService=QaUtils.getToolService(request); + + logger.debug("load response with responseId for un-hiding: " + new Long(responseId).longValue()); + QaUsrResp qaUsrResp=qaService.retrieveQaUsrResp(new Long(responseId).longValue()); + logger.debug("loaded user response: " + qaUsrResp); + qaUsrResp.setHidden(false); + qaService.updateQaUsrResp(qaUsrResp); + logger.debug("updated user response in the db: " + qaUsrResp); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,692 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ +package org.lamsfoundation.lams.tool.qa.web; + +import java.io.IOException; +import java.util.Date; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +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.apache.struts.actions.DispatchAction; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + + +/** + * + * change the logic about completion status + * + */ + +/** + * + * once lams_learning is ready and appContext file is src/ then FINISH toool session will work. + * + */ + +/** + * + * done: removed styling, except error messages and table centering + * + */ + +/** + * The tool's Spring configuration file: qaCompactApplicationContext.xml + * Main service bean of the tool is: org.lamsfoundation.lams.tool.qa.service.QaServicePOJO + * + * done: config file is read from classpath + */ + + +/** + * + * the tool's web.xml will be modified to have classpath to learning service. + * This is how the tool gets the definition of "learnerService" + */ + +/** + * + * when to reset define later and synchin monitor etc.. + * + */ + +/** make sure the tool gets called on: + * setAsForceComplete(Long userId) throws QaApplicationException + */ + + +/** + * + * User Issue: + * Right now: + * 1- the tool gets the request object from the container. + * 2- Principal principal = req.getUserPrincipal(); + * 3- String username = principal.getName(); + * 4- User userCompleteData = qaService.getCurrentUserData(userName); + * 5- write back userCompleteData.getUserId() + */ + + +/** + * + * JBoss Issue: + * Currently getUserPrincipal() returns null and ServletRequest.isUserInRole() always returns false on unsecured pages, + * even after the user has been authenticated. + * http://jira.jboss.com/jira/browse/JBWEB-19 + */ + + +/** + * eliminate calls: + * authoringUtil.simulatePropertyInspector_RunOffline(request); + * authoringUtil.simulatePropertyInspector_setAsDefineLater(request); + */ + + +/** + * + * @author ozgurd + * + * TOOL PARAMETERS: ?? (toolAccessMode) ?? + * Authoring environment: toolContentId + * Learning environment: toolSessionId + toolContentId + * Monitoring environment: toolContentId / Contribute tab:toolSessionId(s) + * + * + */ + +/** + * Note: the tool must support deletion of an existing content from within the authoring environment. + * The current support for this is by implementing the tool contract : removeToolContent(Long toolContentId) + */ + + +/** + * + * We have had to simulate container bahaviour in development stage by calling + * createToolSession and leaveToolSession from the web layer. These will go once the tool is + * in deployment environment. + * + * + * CHECK: leaveToolSession and relavent LearnerService may need to be defined in the spring config file. + * + */ + + +/** + * + * GROUPING SUPPORT: Find out what to do. + */ + + +/** + *

    Action class that controls the logic of tool behavior.

    + * + *

    Note that Struts action class only has the responsibility to navigate + * page flow. All database operation should go to service layer and data + * transformation from domain model to struts form bean should go to form + * bean class. This ensure clean and maintainable code. + *

    + * + * SystemException is thrown whenever an known error condition is + * identified. No system exception error handling code should appear in the + * Struts action class as all of them are handled in + * CustomStrutsExceptionHandler. + * + * @author Ozgur Demirtas + */ +public class QAction extends DispatchAction implements QaAppConstants +{ + static Logger logger = Logger.getLogger(QAction.class.getName()); + + /** + *

    Struts dispatch method.

    + * + *

    It is assuming that progress engine should pass in the tool access + * mode and the tool session id as http parameters.

    + * + * @param mapping An ActionMapping class that will be used by the Action class to tell + * the ActionServlet where to send the end-user. + * + * @param form The ActionForm class that will contain any data submitted + * by the end-user via a form. + * @param request A standard Servlet HttpServletRequest class. + * @param response A standard Servlet HttpServletResponse class. + * @return An ActionForward class that will be returned to the ActionServlet indicating where + * the user is to go next. + * @throws IOException + * @throws ServletException + * @throws QaApplicationException the known runtime exception + * + */ + + /** + * loadQ(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + + * return ActionForward + * main content/question content management and workflow logic + * + * if the passed toolContentId exists in the db, we need to get the relevant data into the Map + * if not, create the default Map + */ + + public ActionForward loadQ(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + /** + * find out which tab is the active one. + */ + authoringUtil.findSelectedTab(mapping, + form, + request, + response); + + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + + IQaService qaService =QaUtils.getToolService(request); + + /** + * the status of define later is determined from the property inspector and + * by now, we know whether it is on or off + * + * enable-disable tool html elements based on "define later" status + */ + /* + * double check QaUtils.getDefineLaterStatus() + */ + boolean defineLaterStatus=QaUtils.getDefineLaterStatus(); + + Boolean defineLater=new Boolean(defineLaterStatus); + logger.debug("defineLater: " + defineLater); + if (defineLater.equals(new Boolean(false))) + { + request.getSession().setAttribute(IS_DEFINE_LATER,"false"); + request.getSession().setAttribute(DISABLE_TOOL,""); + } + else + { + request.getSession().setAttribute(IS_DEFINE_LATER,"true"); + request.getSession().setAttribute(DISABLE_TOOL,"disabled"); + } + + /**retrieve the default question content map */ + Map mapQuestionContent=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT); + logger.debug("MAP_QUESTION_CONTENT:" + request.getSession().getAttribute(MAP_QUESTION_CONTENT)); + + String userAction=""; + if (qaAuthoringForm.getAddContent() != null) + { + userAction=ADD_NEW_QUESTION; + } + else if (qaAuthoringForm.getRemoveContent() != null) + { + userAction=REMOVE_QUESTION; + } + else if (qaAuthoringForm.getRemoveAllContent() != null) + { + userAction=REMOVE_ALL_CONTENT; + } + else if (qaAuthoringForm.getSubmitTabDone() != null) + { + userAction=SUBMIT_TAB_DONE; + } + else if (qaAuthoringForm.getSubmitAllContent() != null) + { + userAction=SUBMIT_ALL_CONTENT; + } + else if (qaAuthoringForm.getSubmitOfflineFile() != null) + { + userAction=SUBMIT_OFFLINE_FILE; + } + else if (qaAuthoringForm.getSubmitOnlineFile() != null) + { + userAction=SUBMIT_ONLINE_FILE; + } + logger.debug("user action is: " + userAction); + + QaUtils.persistRichText(request); + + /** add a new question to Map */ + if (userAction.equalsIgnoreCase(ADD_NEW_QUESTION)) + { + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); + authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, request); + }/** delete a question*/ + else if (userAction.equalsIgnoreCase(REMOVE_QUESTION)) + { + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(true)); + authoringUtil.reconstructQuestionContentMapForRemove(mapQuestionContent, request, qaAuthoringForm); + } /**remove selected content*/ + else if (userAction.equalsIgnoreCase(REMOVE_ALL_CONTENT)) + { + authoringUtil.removeAllDBContent(request); + QaUtils.cleanupSession(request); + qaAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_STARTER)); + } + else if (userAction.equalsIgnoreCase(SUBMIT_OFFLINE_FILE)) + { + logger.debug("will submit offline file: " + userAction); + QaUtils.addFileToContentRepository(request, qaAuthoringForm, true); + logger.debug("offline file added to repository successfully."); + qaAuthoringForm.resetUserAction(); + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_INSTRUCTIONS); + logger.debug("forward back to instructions screen"); + return (mapping.findForward(LOAD_QUESTIONS)); + } + else if (userAction.equalsIgnoreCase(SUBMIT_ONLINE_FILE)) + { + logger.debug("will submit online file: " + userAction); + QaUtils.addFileToContentRepository(request, qaAuthoringForm, false); + logger.debug("online file added to repository successfully."); + qaAuthoringForm.resetUserAction(); + request.getSession().setAttribute(CHOICE,CHOICE_TYPE_INSTRUCTIONS); + logger.debug("forward back to instructions screen"); + return (mapping.findForward(LOAD_QUESTIONS)); + } + else if (userAction.equalsIgnoreCase(SUBMIT_TAB_DONE)) + { + logger.debug("user is done with this tab."); + qaAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + }/**submit questions contained in the Map*/ + else if (userAction.equalsIgnoreCase(SUBMIT_ALL_CONTENT)) + { + ActionMessages errors= new ActionMessages(); + + /** + * full form validation should be performed only in standard authoring mode, but not in monitoring EditActivity + */ + + String richTextTitle=(String) request.getSession().getAttribute(RICHTEXT_TITLE); + logger.debug("richTextTitle: " + richTextTitle); + String richTextInstructions=(String) request.getSession().getAttribute(RICHTEXT_INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + if ((richTextTitle == null) || (richTextTitle.length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK)) + { + errors.add(Globals.ERROR_KEY,new ActionMessage("error.title")); + logger.debug("add title to ActionMessages"); + } + + if ((richTextInstructions == null) || (richTextInstructions.length() == 0) || richTextInstructions.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 defaultQuestionEntry =request.getParameter("questionContent0"); + if ((defaultQuestionEntry == null) || (defaultQuestionEntry.length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.defaultquestion.empty")); + logger.debug("add error.defaultquestion.empty to ActionMessages: "); + } + + Boolean renderMonitoringEditActivity=(Boolean)request.getSession().getAttribute(RENDER_MONITORING_EDITACTIVITY); + if ((renderMonitoringEditActivity != null) && (!renderMonitoringEditActivity.booleanValue())) + { + + if ((qaAuthoringForm.getReportTitle() == null) || (qaAuthoringForm.getReportTitle().length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.reportTitle")); + logger.debug("add reportTitle to ActionMessages: "); + } + + if ((qaAuthoringForm.getMonitoringReportTitle() == null) || (qaAuthoringForm.getMonitoringReportTitle().length() == 0)) + { + errors.add(Globals.ERROR_KEY, new ActionMessage("error.monitorReportTitle")); + logger.debug("add monitorReportTitle to ActionMessages: "); + } + } + /** + * end of error validation + */ + + saveErrors(request,errors); + 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)); + } + + /** + * look after defineLater flag + */ + Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); + logger.debug("MONITORED_CONTENT_ID: " + monitoredContentId); + if (monitoredContentId != null) + { + qaService.unsetAsDefineLater(monitoredContentId); + logger.debug("MONITORED_CONTENT_ID has been unset as defineLater: "); + } + + authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request); + /**delete existing content from the database*/ + authoringUtil.removeAllDBContent(request); + /**create-recreate the content in the db*/ + QaContent qaContent=authoringUtil.createContent(mapQuestionContent, request, qaAuthoringForm); + authoringUtil.createQuestionContent(mapQuestionContent, request, qaContent); + + /**give the user a feedback*/ + errors.clear(); + errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful")); + logger.debug("submit successful."); + saveErrors(request,errors); + } + else + { + logger.debug("Warning!: Uncatered-for user action: " + userAction); + } + + /**reset all user actions*/ + qaAuthoringForm.resetUserAction(); + + /* + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, WebUtil.PARAM_MODE,MODE_OPTIONAL); + logger.debug("retrieving mode: " + mode); + */ + + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * This method manages the presentation Map for the learner mode. + * The dispatch method to decide which view should be shown to the user. + * The deicision is based on tool access mode and tool session status. + * The tool access mode is lams concept and should comes from progress + * engine, whereas tool session status is tool's own session state + * concept and should be loaded from database and setup by + * loadQuestionnaire. + * + * @param mapping An ActionMapping class that will be used by the Action class to tell + * the ActionServlet where to send the end-user. + * + * @param form The ActionForm class that will contain any data submitted + * by the end-user via a form. + * @param request A standard Servlet HttpServletRequest class. + * @param response A standard Servlet HttpServletResponse class. + * @return An ActionForward class that will be returned to the ActionServlet indicating where + * the user is to go next. + * @throws IOException + * @throws ServletException + */ + public ActionForward displayQ(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + /** + * if the content is not ready yet, don't even proceed. + * check the define later status + */ + Boolean defineLater=(Boolean)request.getSession().getAttribute(IS_DEFINE_LATER); + logger.debug("learning-defineLater: " + defineLater); + if (defineLater.booleanValue() == true) + { + persistError(request,"error.defineLater"); + return (mapping.findForward(LOAD)); + } + + LearningUtil learningUtil= new LearningUtil(); + QaLearningForm qaLearningForm = (QaLearningForm) form; + + /**retrieve the default question content map*/ + Map mapQuestions=(Map)request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER); + logger.debug("MAP_QUESTION_CONTENT_LEARNER:" + request.getSession().getAttribute(MAP_QUESTION_CONTENT_LEARNER)); + + /**retrieve the answers Map*/ + Map mapAnswers=(Map)request.getSession().getAttribute(MAP_ANSWERS); + logger.debug("MAP_ANSWERS:" + mapAnswers); + + /**obtain author's question listing preference*/ + String questionListingMode=(String) request.getSession().getAttribute(QUESTION_LISTING_MODE); + /**maintain Map either based on sequential listing or based on combined listing*/ + if (questionListingMode.equalsIgnoreCase(QUESTION_LISTING_MODE_SEQUENTIAL)) + { + logger.debug("QUESTION_LISTING_MODE_SEQUENTIAL"); + + int currentQuestionIndex=new Long(qaLearningForm.getCurrentQuestionIndex()).intValue(); + logger.debug("currentQuestionIndex is: " + currentQuestionIndex); + logger.debug("getting answer for question: " + currentQuestionIndex + "as: " + qaLearningForm.getAnswer()); + logger.debug("mapAnswers size:" + mapAnswers.size()); + + if (mapAnswers.size() >= currentQuestionIndex) + { + logger.debug("mapAnswers size:" + mapAnswers.size() + " and currentQuestionIndex: " + currentQuestionIndex); + mapAnswers.remove(new Long(currentQuestionIndex).toString()); + } + logger.debug("before adding to mapAnswers: " + mapAnswers); + mapAnswers.put(new Long(currentQuestionIndex).toString(), qaLearningForm.getAnswer()); + logger.debug("adding new answer:" + qaLearningForm.getAnswer() + " to mapAnswers."); + + if (qaLearningForm.getGetNextQuestion() != null) + currentQuestionIndex++; + else if (qaLearningForm.getGetPreviousQuestion() != null) + currentQuestionIndex--; + + request.getSession().setAttribute(CURRENT_ANSWER, mapAnswers.get(new Long(currentQuestionIndex).toString())); + logger.debug("currentQuestionIndex will be: " + currentQuestionIndex); + request.getSession().setAttribute(CURRENT_QUESTION_INDEX, new Long(currentQuestionIndex)); + learningUtil.feedBackAnswersProgress(request,currentQuestionIndex); + qaLearningForm.resetUserActions(); /**resets all except submitAnswersContent */ + } + else + { + logger.debug(logger + " " + this.getClass().getName() + "QUESTION_LISTING_MODE_COMBINED"); + for (int questionIndex=INITIAL_QUESTION_COUNT.intValue(); questionIndex<= mapQuestions.size(); questionIndex++ ) + { + String answer=request.getParameter("answer" + questionIndex); + logger.debug("answer for question " + questionIndex + " is:" + answer); + mapAnswers.put(new Long(questionIndex).toString(), answer); + } + } + + /** + * At this point the Map holding learner responses is ready. So place that into the session. + */ + request.getSession().setAttribute(MAP_ANSWERS, mapAnswers); + + /** + * Learner submits the responses to the questions. + */ + if (qaLearningForm.getSubmitAnswersContent() != null) + { + logger.debug(logger + " " + this.getClass().getName() + "submit the responses: " + mapAnswers); + /**recreate the users and responses*/ + learningUtil.createUsersAndResponses(mapAnswers, request); + qaLearningForm.resetUserActions(); + qaLearningForm.setSubmitAnswersContent(null); + /**start generating a report for the Learner*/ + learningUtil.buidLearnerReport(request,1); + + learningUtil.lockContent(request); + logger.debug("content has been locked"); + return (mapping.findForward(LEARNER_REPORT)); + } + /** + * Simulate learner leaving the current tool session. This will normally gets called by the container by + * leaveToolSession(toolSessionId, user) + */ + else if (qaLearningForm.getEndLearning() != null) + { + /** + * The learner is done with the tool session. The tool needs to clean-up. + */ + + Long toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + logger.debug("simulating container behaviour by calling " + + "leaveToolSession() with toolSessionId: " + toolSessionId + " and user: " + user); + + IQaService qaService =QaUtils.getToolService(request); + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + qaSession.setSession_end_date(new Date(System.currentTimeMillis())); + /** + * ?? mark the tool session as COMPLETE ?? + */ + /* + * change the logic about completion status + */ + + /* qaSession.setSession_status(COMPLETED); + qaService.updateQaSession(qaSession); + logger.debug("tool session has been marked COMPLETE: " + qaSession); + */ + + /* + ILearnerService learnerService =LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + logger.debug(logger + " " + this.getClass().getName() + "learnerService: " + learnerService); + learnerService.completeToolSession(toolSessionId, user); + logger.debug(logger + " " + this.getClass().getName() + "completeToolSession on learnerService has finished: "); + */ + } + + /** + * Also cleanup session attributes + */ + QaUtils.cleanupSession(request); + + /** reset all user actions */ + qaLearningForm.resetUserActions(); + return (mapping.findForward(LOAD)); + } + + + /** + * used to load Monitoring tabs back once the controller moves to Edit Activity. + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + */ + public ActionForward loadMonitoring(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + + if (qaAuthoringForm.getSummaryMonitoring() != null) + { + logger.debug("request for getSummaryMonitoring, start proxying..."); + logger.debug("NO_AVAILABLE_SESSIONS: " + request.getSession().getAttribute(NO_AVAILABLE_SESSIONS)); + + Boolean noAvailableSessions=(Boolean)request.getSession().getAttribute(NO_AVAILABLE_SESSIONS); + logger.debug("NO_AVAILABLE_SESSIONS: " +noAvailableSessions); + qaAuthoringForm.resetUserAction(); + if ((noAvailableSessions != null) && (noAvailableSessions.booleanValue())) + { + persistError(request,"error.noStudentActivity"); + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(true)); + request.setAttribute(STOP_RENDERING_QUESTIONS, new Boolean(true)); + return (mapping.findForward(LOAD)); + } + else + { + logger.debug("NO_AVAILABLE_SESSIONS: " +false); + QaMonitoringAction qaMonitoringAction=new QaMonitoringAction(); + QaMonitoringForm qaMonitoringForm=new QaMonitoringForm(); + return qaMonitoringAction.generateToolSessionDataMap(mapping,qaMonitoringForm,request,response); + } + } + else if (qaAuthoringForm.getInstructionsMonitoring() != null) + { + logger.debug("QAction- request for getInstructionsMonitoring()"); + qaAuthoringForm.resetUserAction(); + QaMonitoringAction qaMonitoringAction=new QaMonitoringAction(); + QaMonitoringForm qaMonitoringForm=new QaMonitoringForm(); + qaMonitoringForm.setInstructions("instructions"); + return qaMonitoringAction.generateToolSessionDataMap(mapping,qaMonitoringForm,request,response); + } + else if (qaAuthoringForm.getEditActivityMonitoring() != null) + { + logger.debug("QAction-request for getEditActivityMonitoring()"); + QaStarterAction qaStarterAction = new QaStarterAction(); + logger.debug("forwarding to Authoring Basic tab."); + ActionForward actionForward=qaStarterAction.startMonitoringSummary(mapping, qaAuthoringForm, request, response); + logger.debug("actionForward: " + actionForward); + qaAuthoringForm.resetUserAction(); + return (actionForward); + } + else if (qaAuthoringForm.getStatsMonitoring() != null) + { + qaAuthoringForm.resetUserAction(); + QaMonitoringAction qaMonitoringAction=new QaMonitoringAction(); + QaMonitoringForm qaMonitoringForm=new QaMonitoringForm(); + qaMonitoringForm.setStats("stats"); + return qaMonitoringAction.generateToolSessionDataMap(mapping,qaMonitoringForm,request,response); + } + return null; + } + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaAuthoringForm.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaAuthoringForm.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaAuthoringForm.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,506 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Authoring environment + */ +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.apache.struts.upload.FormFile; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaAuthoringForm extends ActionForm implements QaAppConstants { + /** form controllers */ + protected String addContent; + protected String removeContent; + protected String removeAllContent; + protected String submitAllContent; + protected String submitTabDone; + protected String submitOfflineFile; + protected String submitOnlineFile; + + /** tab controller, these may go away once the Flash wraps the jsp */ + protected String choice; + protected String choiceBasic; + protected String choiceAdvanced; + protected String choiceInstructions; + + /** basic content */ + protected String title; + protected String instructions; + protected String questionIndex; + protected String isRemoveContent; + protected String toolContentId; + /** instructions content */ + protected String onlineInstructions; + protected String offlineInstructions; + protected FormFile theOfflineFile; + protected FormFile theOnlineFile; + + /** advanced content */ + protected String synchInMonitor; + protected String reportTitle; + protected String monitoringReportTitle; + protected String endLearningMessage; + protected String usernameVisible; + protected String questionsSequenced; + + /** proxy controllers for Monitoring tabs */ + protected String summaryMonitoring; + protected String instructionsMonitoring; + protected String editActivityMonitoring; + protected String statsMonitoring; + + protected String edit; + + public void resetUserAction() + { + this.addContent=null; + this.removeContent=null; + this.removeAllContent=null; + this.submitAllContent=null; + this.submitTabDone=null; + this.submitOfflineFile=null; + this.submitOnlineFile=null; + + this.summaryMonitoring=null; + this.instructionsMonitoring=null; + this.editActivityMonitoring=null; + this.statsMonitoring=null; + this.edit=null; + } + + public void reset() + { + this.addContent=null; + this.removeContent=null; + this.removeAllContent=null; + this.submitAllContent=null; + this.submitTabDone=null; + this.submitOfflineFile=null; + this.submitOnlineFile=null; + + this.choice=null; + this.choiceBasic=null; + this.choiceAdvanced=null; + this.choiceInstructions=null; + + this.title=null; + this.instructions=null; + this.questionIndex=null; + this.isRemoveContent=null; + this.toolContentId=null; + + this.onlineInstructions=null; + this.offlineInstructions=null; + + this.endLearningMessage=null; + this.synchInMonitor=null; + this.reportTitle=null; + this.monitoringReportTitle=null; + this.questionsSequenced=null; + + this.summaryMonitoring=null; + this.instructionsMonitoring=null; + this.editActivityMonitoring=null; + this.statsMonitoring=null; + this.edit=null; + } + + public void resetRadioBoxes() + { + this.synchInMonitor =OPTION_OFF; + this.usernameVisible =OPTION_OFF; + this.questionsSequenced =OPTION_OFF; + } + + + /** + * @return Returns the isRemoveContent. + */ + public String getIsRemoveContent() { + return isRemoveContent; + } + /** + * @param isRemoveContent The isRemoveContent to set. + */ + public void setIsRemoveContent(String isRemoveContent) { + this.isRemoveContent = isRemoveContent; + } + /** + * @return Returns the questionIndex. + */ + public String getQuestionIndex() { + return questionIndex; + } + /** + * @param questionIndex The questionIndex to set. + */ + public void setQuestionIndex(String questionIndex) { + this.questionIndex = questionIndex; + } + + /** + * @return Returns the addContent. + */ + public String getAddContent() { + return addContent; + } + /** + * @param addContent The addContent to set. + */ + public void setAddContent(String addContent) { + this.addContent = addContent; + } + /** + * @return Returns the removeContent. + */ + public String getRemoveContent() { + return removeContent; + } + /** + * @param removeContent The removeContent to set. + */ + public void setRemoveContent(String removeContent) { + this.removeContent = removeContent; + } + /** + * @return Returns the removeAllContent. + */ + public String getRemoveAllContent() { + return removeAllContent; + } + /** + * @param removeAllContent The removeAllContent to set. + */ + public void setRemoveAllContent(String removeAllContent) { + this.removeAllContent = removeAllContent; + } + /** + * @return Returns the submitAllContent. + */ + public String getSubmitAllContent() { + return submitAllContent; + } + /** + * @param submitAllContent The submitAllContent to set. + */ + public void setSubmitAllContent(String submitAllContent) { + this.submitAllContent = submitAllContent; + } + /** + * @return Returns the instructions. + */ + public String getInstructions() { + return instructions; + } + /** + * @param instructions The instructions to set. + */ + public void setInstructions(String instructions) { + this.instructions = instructions; + } + /** + * @return Returns the title. + */ + public String getTitle() { + return title; + } + /** + * @param title The title to set. + */ + public void setTitle(String title) { + this.title = title; + } + /** + * @return Returns the toolContentId. + */ + public String getToolContentId() { + return toolContentId; + } + /** + * @param toolContentId The toolContentId to set. + */ + public void setToolContentId(String toolContentId) { + this.toolContentId = toolContentId; + } + /** + * @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 syncInMonitor. + */ + public String getSynchInMonitor() { + return synchInMonitor; + } + /** + * @param syncInMonitor The syncInMonitor to set. + */ + public void setSynchInMonitor(String synchInMonitor) { + this.synchInMonitor = synchInMonitor; + } + + /** + * @return Returns the choiceAdvanced. + */ + public String getChoiceAdvanced() { + return choiceAdvanced; + } + /** + * @param choiceAdvanced The choiceAdvanced to set. + */ + public void setChoiceAdvanced(String choiceAdvanced) { + this.choiceAdvanced = choiceAdvanced; + } + /** + * @return Returns the choiceBasic. + */ + public String getChoiceBasic() { + return choiceBasic; + } + /** + * @param choiceBasic The choiceBasic to set. + */ + public void setChoiceBasic(String choiceBasic) { + this.choiceBasic = choiceBasic; + } + /** + * @return Returns the choiceInstructions. + */ + public String getChoiceInstructions() { + return choiceInstructions; + } + /** + * @param choiceInstructions The choiceInstructions to set. + */ + public void setChoiceInstructions(String choiceInstructions) { + this.choiceInstructions = choiceInstructions; + } + /** + * @return Returns the choice. + */ + public String getChoice() { + return choice; + } + /** + * @param choice The choice to set. + */ + public void setChoice(String choice) { + this.choice = choice; + } + /** + * @return Returns the reportTitle. + */ + public String getReportTitle() { + return reportTitle; + } + /** + * @param reportTitle The reportTitle to set. + */ + public void setReportTitle(String reportTitle) { + this.reportTitle = reportTitle; + } + /** + * @return Returns the usernameVisible. + */ + public String getUsernameVisible() { + return usernameVisible; + } + /** + * @param usernameVisible The usernameVisible to set. + */ + public void setUsernameVisible(String usernameVisible) { + this.usernameVisible = usernameVisible; + } + /** + * @return Returns the submitTabDone. + */ + public String getSubmitTabDone() { + return submitTabDone; + } + /** + * @param submitTabDone The submitTabDone to set. + */ + public void setSubmitTabDone(String submitTabDone) { + this.submitTabDone = submitTabDone; + } + + /** + * @return Returns the questionsSequenced. + */ + public String getQuestionsSequenced() { + return questionsSequenced; + } + /** + * @param questionsSequenced The questionsSequenced to set. + */ + public void setQuestionsSequenced(String questionsSequenced) { + this.questionsSequenced = questionsSequenced; + } + /** + * @return Returns the endLearningMessage. + */ + public String getEndLearningMessage() { + return endLearningMessage; + } + /** + * @param endLearningMessage The endLearningMessage to set. + */ + public void setEndLearningMessage(String endLearningMessage) { + this.endLearningMessage = endLearningMessage; + } + /** + * @return Returns the monitoringReportTitle. + */ + public String getMonitoringReportTitle() { + return monitoringReportTitle; + } + /** + * @param monitoringReportTitle The monitoringReportTitle to set. + */ + public void setMonitoringReportTitle(String monitoringReportTitle) { + this.monitoringReportTitle = monitoringReportTitle; + } + /** + * @return Returns the editActivityMonitoring. + */ + public String getEditActivityMonitoring() { + return editActivityMonitoring; + } + /** + * @param editActivityMonitoring The editActivityMonitoring to set. + */ + public void setEditActivityMonitoring(String editActivityMonitoring) { + this.editActivityMonitoring = editActivityMonitoring; + } + /** + * @return Returns the instructionsMonitoring. + */ + public String getInstructionsMonitoring() { + return instructionsMonitoring; + } + /** + * @param instructionsMonitoring The instructionsMonitoring to set. + */ + public void setInstructionsMonitoring(String instructionsMonitoring) { + this.instructionsMonitoring = instructionsMonitoring; + } + /** + * @return Returns the statsMonitoring. + */ + public String getStatsMonitoring() { + return statsMonitoring; + } + /** + * @param statsMonitoring The statsMonitoring to set. + */ + public void setStatsMonitoring(String statsMonitoring) { + this.statsMonitoring = statsMonitoring; + } + /** + * @return Returns the summaryMonitoring. + */ + public String getSummaryMonitoring() { + return summaryMonitoring; + } + /** + * @param summaryMonitoring The summaryMonitoring to set. + */ + public void setSummaryMonitoring(String summaryMonitoring) { + this.summaryMonitoring = summaryMonitoring; + } + /** + * @return Returns the edit. + */ + public String getEdit() { + return edit; + } + /** + * @param edit The edit to set. + */ + public void setEdit(String edit) { + this.edit = edit; + } + + /** + * @return Returns the submitOfflineFile. + */ + public String getSubmitOfflineFile() { + return submitOfflineFile; + } + /** + * @param submitOfflineFile The submitOfflineFile to set. + */ + public void setSubmitOfflineFile(String submitOfflineFile) { + this.submitOfflineFile = submitOfflineFile; + } + /** + * @param theOfflineFile The theOfflineFile to set. + */ + public void setTheOfflineFile(FormFile theOfflineFile) { + this.theOfflineFile = theOfflineFile; + } + /** + * @param theOnlineFile The theOnlineFile to set. + */ + public void setTheOnlineFile(FormFile theOnlineFile) { + this.theOnlineFile = theOnlineFile; + } + /** + * @return Returns the theOfflineFile. + */ + public FormFile getTheOfflineFile() { + return theOfflineFile; + } + /** + * @return Returns the theOnlineFile. + */ + public FormFile getTheOnlineFile() { + return theOnlineFile; + } + /** + * @return Returns the submitOnlineFile. + */ + public String getSubmitOnlineFile() { + return submitOnlineFile; + } + /** + * @param submitOnlineFile The submitOnlineFile to set. + */ + public void setSubmitOnlineFile(String submitOnlineFile) { + this.submitOnlineFile = submitOnlineFile; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaEmptyForm.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaEmptyForm.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaEmptyForm.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,22 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Learning environment + */ +import org.apache.struts.action.ActionForm; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaEmptyForm extends ActionForm { +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioForm.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioForm.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioForm.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,25 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Monitoring environment + */ +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaExportPortfolioForm extends ActionForm implements QaAppConstants +{ + +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioStarterAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioStarterAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportPortfolioStarterAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,314 @@ +/* + * Created on 8/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * @author Ozgur Demirtas + * + * /&mode=learner&toolSessionId=231&userId= +*/ + +/** + Most of the code base for the export portfolio are re-used functionality from monitoring action and jsps. + We make use of TARGET_MODE_LEARNING and TARGET_MODE_MONITORING since these are the flags in the monitoring codebase + to differentiate between learner and teacher modes. +*/ + +/** + * Revisit when user management service is ready to include current user's name in the jsp. + */ + +package org.lamsfoundation.lams.tool.qa.web; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.Action; +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.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaStringComparator; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + +public class QaExportPortfolioStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaExportPortfolioStarterAction.class.getName()); + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException, ToolException + { + /** + * retrive the service + */ + IQaService qaService=null; + qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieved qaService : " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + + + /** + * persist time zone information to session scope. + */ + QaUtils.persistTimeZone(request); + + /** + * mark the http session as an authoring activity + */ + //request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_EXPORT_PORTFOLIO); + + /** + * obtain and setup the current user's data + */ + + //get session from shared session. + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user == null) || (user.getUserID() == null)) + { + logger.debug("error: The tool expects userId"); + persistError(request,"error.authoringUser.notAvailable"); + request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + String mode=""; + mode=request.getParameter(MODE); + logger.debug("mode: " + mode); + boolean useToolSessionId=false; + if ((mode != null) && mode.equalsIgnoreCase(LEARNER)) + { + logger.debug("mode is:" + mode + " use toolSessionId"); + useToolSessionId=true; + } + else if ((mode != null) && mode.equalsIgnoreCase(TEACHER)) + { + logger.debug("mode is:" + mode + " use toolContentId"); + useToolSessionId=false; + } + else + { + logger.debug("Warning mode is: unknown"); + persistError(request,"error.mode.required"); + request.setAttribute(USER_EXCEPTION_MODE_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + request.getSession().setAttribute(MODE,mode); + + String strToolSessionId=""; + Long toolSessionId=null; + if (useToolSessionId == true) + { + logger.debug("reading TOOL_SESSION_ID"); + strToolSessionId=request.getParameter(TOOL_SESSION_ID); + logger.debug("toolSessionId :" + strToolSessionId); + + try + { + if ((strToolSessionId != null) && (strToolSessionId.length() > 0)) + { + toolSessionId=new Long(strToolSessionId); + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + } + else + { + persistError(request,"error.toolSessionId.required"); + request.setAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + catch(NumberFormatException e) + { + persistError(request,"error.sessionId.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + logger.debug("final toolSessionId before exists test :" + toolSessionId); + + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + if (qaSession == null) + { + persistError(request,"error.toolSession.doesNotExist"); + request.setAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + logger.debug("final toolSessionId :" + toolSessionId); + + String strToolContentId=""; + Long toolContentId=null; + + if (useToolSessionId == false) + { + logger.debug("reading TOOL_CONTENT_ID"); + strToolContentId=request.getParameter(TOOL_CONTENT_ID); + logger.debug("TOOL_CONTENT_ID: " + strToolContentId); + + try + { + if ((strToolContentId != null) && (strToolContentId.length() > 0)) + { + if (!QaUtils.existsContent(new Long(strToolContentId).longValue(), request)) + { + persistError(request,"error.content.doesNotExist"); + request.setAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + request.getSession().setAttribute(TOOL_CONTENT_ID, new Long(strToolContentId)); + } + else + { + persistError(request,"error.contentId.required"); + request.setAttribute(USER_EXCEPTION_CONTENTID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + catch(NumberFormatException e) + { + persistError(request,"error.contentId.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + } + + /** + at this point we have session attributes TOOL_CONTENT_ID, TOOL_SESSION_ID AND MODE ready to use + */ + + mode=(String)request.getSession().getAttribute(MODE); + logger.debug("mode is: " + mode); + + Map mapToolSessions= new TreeMap(new QaStringComparator()); + request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); + LearningUtil learningUtil= new LearningUtil(); + + if (mode.equalsIgnoreCase(LEARNER)) + { + toolSessionId=(Long)request.getSession().getAttribute(TOOL_SESSION_ID); + logger.debug("toolSessionId: " + toolSessionId); + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId.longValue()); + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + logger.debug("using qaContent id : " + qaContent.getQaContentId()); + request.getSession().setAttribute(TOOL_CONTENT_ID, qaContent.getQaContentId()); + + /** is other learner's full name visible to this learner */ + logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible()); + request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(qaContent.isUsernameVisible())); + + logger.debug("TOOL USER is:" + user); + logger.debug("TOOL USER id:" + user.getUserID()); + + QaQueUsr qaQueUsr=qaService.loadQaQueUsr(new Long(user.getUserID().longValue())); + logger.debug("qaQueUsr:" + qaQueUsr); + + if (qaQueUsr != null) + { + request.getSession().setAttribute(CURRENTLEARNER_FULLNAME , qaQueUsr.getFullname()); + logger.debug("current learner fullname:" + qaQueUsr.getFullname()); + } + else + { + persistError(request,"error.user.doesNotExist"); + request.setAttribute(USER_EXCEPTION_USER_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + logger.debug("generate portfolio for mode: " + mode); + request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_LEARNING); + /** a single toolSessionId */ + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + logger.debug("build a learner report:"); + learningUtil.buidLearnerReport(request, 1); + } + else + { + toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + + List listToolSessions=null; + logger.debug("generate portfolio for mode: " + mode); + request.getSession().setAttribute(TARGET_MODE, TARGET_MODE_MONITORING); + + /** we already know that this content exists in the db */ + QaContent qa=qaService.loadQa(toolContentId.longValue()); + logger.debug("qa: " + qa); + listToolSessions= qaService.getToolSessionsForContent(qa); + logger.debug("listToolSessions: " + listToolSessions); + + if (listToolSessions.size() == 0) + { + persistError(request,"error.content.noToolSessions"); + request.setAttribute(USER_EXCEPTION_NO_TOOL_SESSIONS, new Boolean(true)); + logger.debug("forwarding to: " + PORTFOLIO_REPORT); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + Iterator sessionListIterator=listToolSessions.iterator(); + int toolSessionCounter=1; + while (sessionListIterator.hasNext()) + { + toolSessionId=(Long)sessionListIterator.next(); + logger.debug("toolSessionId: " + toolSessionId); + request.getSession().setAttribute(TOOL_SESSION_ID, toolSessionId); + learningUtil.buidLearnerReport(request, toolSessionCounter); + toolSessionCounter++; + } + } + + /** the flag to differentiate between request for monitoring versus request for portfolio */ + request.setAttribute(PORTFOLIO_REQUEST, new Boolean(true)); + logger.debug("generate portfolio jsp for mode: " + mode); + logger.debug("mapToolSessions: " + request.getSession().getAttribute(MAP_TOOL_SESSIONS)); + return (mapping.findForward(PORTFOLIO_REPORT)); + } + + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportServlet.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportServlet.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaExportServlet.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,58 @@ +/* + * Created on Sep 22, 2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +//import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; +//import org.lamsfoundation.lams.web.servlet.ExportPortfolioServletException; + + +/** + * @author mtruong + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaExportServlet {//extends AbstractExportPortfolioServlet{ +/* + private final String FILENAME="qa_main.html"; + + public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName) + { + String mode = WebUtil.readStrParam(request, WebUtil.PARAM_MODE); + Long toolContentId, toolSessionId, userId; + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath(); + + String url = basePath + "/exportPortfolioStarter.do"; + String urlWithParameters = null; + + if (mode.equals(ToolAccessMode.LEARNER.toString())) + { + //read in userId and toolSessionId + urlWithParameters = appendParametersToLearnerExportURL(request, url); + + } + else if (mode.equals(ToolAccessMode.TEACHER.toString())) + { + //read in toolContentId + urlWithParameters = appendParametersToTeacherExportURL(request, url); + urlWithParameters = WebUtil.appendParameterToURL(urlWithParameters, USER_ID, WebUtil.readStrParam(request, USER_ID)); + } + + try + { + + writeResponseToFile(urlWithParameters, directoryName, FILENAME); + + } + catch(ExportPortfolioServletException e) + { + throw new QaApplicationException("An error has occurred while trying to generate files ",e); + } + return FILENAME; + } +*/ +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningForm.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningForm.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningForm.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,118 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Learning environment + */ +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaLearningForm extends ActionForm implements QaAppConstants { + protected String answer; + protected String currentQuestionIndex; + /** form controllers */ + protected String submitAnswersContent; + protected String getNextQuestion; + protected String getPreviousQuestion; + protected String endLearning; + + + /** + * reset user actions in learning mode + * @param qaAuthoringForm + * return void + */ + + protected void resetUserActions() + { + this.getNextQuestion=null; + this.getPreviousQuestion=null; + this.endLearning=null; + } + + + /** + * @return Returns the currentQuestionIndex. + */ + public String getCurrentQuestionIndex() { + return currentQuestionIndex; + } + /** + * @param currentQuestionIndex The currentQuestionIndex to set. + */ + public void setCurrentQuestionIndex(String currentQuestionIndex) { + this.currentQuestionIndex = currentQuestionIndex; + } + /** + * @return Returns the answer. + */ + public String getAnswer() { + return answer; + } + /** + * @param answer The answer to set. + */ + public void setAnswer(String answer) { + this.answer = answer; + } + /** + * @return Returns the getNextQuestion. + */ + public String getGetNextQuestion() { + return getNextQuestion; + } + /** + * @param getNextQuestion The getNextQuestion to set. + */ + public void setGetNextQuestion(String getNextQuestion) { + this.getNextQuestion = getNextQuestion; + } + /** + * @return Returns the getPreviousQuestion. + */ + public String getGetPreviousQuestion() { + return getPreviousQuestion; + } + /** + * @param getPreviousQuestion The getPreviousQuestion to set. + */ + public void setGetPreviousQuestion(String getPreviousQuestion) { + this.getPreviousQuestion = getPreviousQuestion; + } + /** + * @return Returns the submitAnswersContent. + */ + public String getSubmitAnswersContent() { + return submitAnswersContent; + } + /** + * @param submitAnswersContent The submitAnswersContent to set. + */ + public void setSubmitAnswersContent(String submitAnswersContent) { + this.submitAnswersContent = submitAnswersContent; + } + /** + * @return Returns the endLearning. + */ + public String getEndLearning() { + return endLearning; + } + /** + * @param endLearning The endLearning to set. + */ + public void setEndLearning(String endLearning) { + this.endLearning = endLearning; + } + } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningStarterAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningStarterAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaLearningStarterAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,368 @@ +/** + * Created on 8/03/2005 + * initializes the tool's learning mode + */ + +package org.lamsfoundation.lams.tool.qa.web; +import java.io.IOException; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.Action; +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.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaComparator; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaQueUsr; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +/** + * TO DO: + * remove line: + * Long currentToolContentId= new Long(4321); + */ + +/** + * + * @author Ozgur Demirtas + * + * /&userId=&toolSessionId=123&mode=teacher + * + * Since the toolSessionId is passed, we will derive toolContentId from the toolSessionId + * + * This class is used to load the default content and initialize the presentation Map for Learner mode + * + * createToolSession will not be called once the tool is deployed. + * + * It is important that ALL the session attributes created in this action gets removed by: QaUtils.cleanupSession(request) + * + */ + +/** + * Tool Session: + * + * A tool session is the concept by which which the tool and the LAMS core manage a set of learners interacting with the tool. + * The tool session id (toolSessionId) is generated by the LAMS core and given to the tool. + * A tool session represents the use of a tool for a particulate activity for a group of learners. + * So if an activity is ungrouped, then one tool session exist for for a tool activity in a learning design. + * + * More details on the tool session id are covered under monitoring. + * When thinking about the tool content id and the tool session id, it might be helpful to think about the tool content id + * relating to the definition of an activity, whereas the tool session id relates to the runtime participation in the activity. + * + */ + +/** + * + * Learner URL: + * The learner url display the screen(s) that the learner uses to participate in the activity. + * When the learner accessed this user, it will have a tool access mode ToolAccessMode.LEARNER. + * + * It is the responsibility of the tool to record the progress of the user. + * If the tool is a multistage tool, for example asking a series of questions, the tool must keep track of what the learner has already done. + * If the user logs out and comes back to the tool later, then the tool should resume from where the learner stopped. + * When the user is completed with tool, then the tool notifies the progress engine by calling + * org.lamsfoundation.lams.learning.service.completeToolSession(Long toolSessionId, User learner). + * + * If the tool's content DefineLater flag is set to true, then the learner should see a "Please wait for the teacher to define this part...." + * style message. + * If the tool's content RunOffline flag is set to true, then the learner should see a "This activity is not being done on the computer. + * Please see your instructor for details." + * + * ?? Would it be better to define a run offline message in the tool? We have instructions for the teacher but not the learner. ?? + * If the tool has a LockOnFinish flag, then the tool should lock learner's entries once they have completed the activity. + * If they return to the activity (e.g. via the progress bar) then the entries should be read only. + * + */ + +/** + * + * verifies that the content id passed to the tool is numeric and does refer to an existing content. + */ + +public class QaLearningStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaLearningStarterAction.class.getName()); + + /** + * holds the question contents for a given tool session and relevant content + */ + protected Map mapQuestions= new TreeMap(new QaComparator()); + /** + * holds the answers + */ + protected Map mapAnswers= new TreeMap(new QaComparator()); + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException { + + QaLearningForm qaQaLearningForm = (QaLearningForm) form; + + /** + * reset the question index to 1. + */ + request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1"); + logger.debug("CURRENT_QUESTION_INDEX: " + request.getSession().getAttribute(CURRENT_QUESTION_INDEX)); + + /** + * reset the current answer + */ + request.getSession().setAttribute(CURRENT_ANSWER, ""); + + /** + * initialize available question display modes in the session + */ + request.getSession().setAttribute(QUESTION_LISTING_MODE_SEQUENTIAL,QUESTION_LISTING_MODE_SEQUENTIAL); + request.getSession().setAttribute(QUESTION_LISTING_MODE_COMBINED, QUESTION_LISTING_MODE_COMBINED); + + /** + * retrive the service + */ + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieving qaService: " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + + /** + * mark the http session as a learning activity + */ + request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_LEARNING); + + /** + * persist time zone information to session scope. + */ + QaUtils.persistTimeZone(request); + + /** + * obtain and setup the current user's data + */ + String userId = ""; + //get session from shared session. + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user == null) || (user.getUserID() == null)) + { + logger.debug("error: The tool expects userId"); + persistError(request,"error.authoringUser.notAvailable"); + request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + }else + userId = user.getUserID().toString(); + + + /** + * process incoming tool session id and later derive toolContentId from it. + */ + String strToolSessionId=request.getParameter(TOOL_SESSION_ID); + long toolSessionId=0; + if ((strToolSessionId == null) || (strToolSessionId.length() == 0)) + { + persistError(request, "error.toolSessionId.required"); + request.setAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + LOAD); + return (mapping.findForward(LOAD)); + } + else + { + try + { + toolSessionId=new Long(strToolSessionId).longValue(); + logger.debug("passed TOOL_SESSION_ID : " + new Long(toolSessionId)); + request.getSession().setAttribute(TOOL_SESSION_ID,new Long(toolSessionId)); + } + catch(NumberFormatException e) + { + persistError(request, "error.sessionId.numberFormatException"); + logger.debug("add error.sessionId.numberFormatException to ActionMessages."); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + LOAD); + return (mapping.findForward(LOAD)); + } + } + + /** + * By now, the passed tool session id MUST exist in the db through the calling of: + * public void createToolSession(Long toolSessionId, Long toolContentId) by the container. + * + * make sure this session exists in tool's session table by now. + */ + + if (!QaUtils.existsSession(toolSessionId, request)) + { + logger.debug("tool session does not exist" + toolSessionId); + /* + *for testing only, remove this line in development + */ + Long currentToolContentId= new Long(1234); + logger.debug("simulating container behaviour: calling createToolSession with toolSessionId : " + + new Long(toolSessionId) + " and toolContentId: " + currentToolContentId); + try + { + qaService.createToolSession(new Long(toolSessionId), currentToolContentId); + logger.debug("simulated container behaviour."); + } + catch(ToolException e) + { + logger.debug("we should never come here."); + } + + } + + /** + * by now, we made sure that the passed tool session id exists in the db as a new record + * Make sure we can retrieve it and relavent content + */ + + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(toolSessionId); + logger.debug("retrieving qaSession: " + qaSession); + /** + * find out what content this tool session is referring to + * get the content for this tool session (many to one mapping) + */ + + /** + * Each passed tool session id points to a particular content. Many to one mapping. + */ + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + request.getSession().setAttribute(TOOL_CONTENT_ID, qaContent.getQaContentId()); + logger.debug("using TOOL_CONTENT_ID: " + qaContent.getQaContentId()); + + + /** + * The content we retrieved above must have been created before in Authoring time. + * And the passed tool session id already refers to it. + */ + + + logger.debug("ACTIVITY_TITLE: " + qaContent.getTitle()); + request.getSession().setAttribute(ACTIVITY_TITLE,qaContent.getTitle()); + + logger.debug("ACTIVITY_INSTRUCTIONS: " + qaContent.getInstructions()); + request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS,qaContent.getInstructions()); + + logger.debug("REPORT_TITLE_LEARNER: " + qaContent.getReportTitle()); + request.getSession().setAttribute(REPORT_TITLE_LEARNER,qaContent.getReportTitle()); + + request.getSession().setAttribute(END_LEARNING_MESSAGE,qaContent.getEndLearningMessage()); + logger.debug("END_LEARNING_MESSAGE: " + qaContent.getEndLearningMessage()); + /** + * Is the tool activity been checked as Run Offline in the property inspector? + */ + logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + qaContent.isRunOffline()); + request.getSession().setAttribute(IS_TOOL_ACTIVITY_OFFLINE, new Boolean(qaContent.isRunOffline()).toString()); + + logger.debug("IS_USERNAME_VISIBLE: " + qaContent.isUsernameVisible()); + request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(qaContent.isUsernameVisible())); + /** + * Is the tool activity been checked as Define Later in the property inspector? + */ + logger.debug("IS_DEFINE_LATER: " + qaContent.isDefineLater()); + request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(qaContent.isDefineLater())); + + /** + * convince jsp: Learning mode requires this setting for jsp to generate the user's report + */ + request.getSession().setAttribute(CHECK_ALL_SESSIONS_COMPLETED, new Boolean(false)); + + logger.debug("IS_QUESTIONS_SEQUENCED: " + qaContent.isQuestionsSequenced()); + String feedBackType=""; + if (qaContent.isQuestionsSequenced()) + { + request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_SEQUENTIAL); + feedBackType=FEEDBACK_TYPE_SEQUENTIAL; + } + else + { + request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_COMBINED); + feedBackType=FEEDBACK_TYPE_COMBINED; + } + logger.debug("QUESTION_LISTING_MODE: " + request.getSession().getAttribute(QUESTION_LISTING_MODE)); + + /** + * fetch question content from content + */ + Iterator contentIterator=qaContent.getQaQueContents().iterator(); + while (contentIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); + if (qaQueContent != null) + { + int displayOrder=qaQueContent.getDisplayOrder(); + if (displayOrder != 0) + { + /** + * add the question to the questions Map in the displayOrder + */ + mapQuestions.put(new Integer(displayOrder).toString(),qaQueContent.getQuestion()); + } + } + } + + request.getSession().setAttribute(MAP_ANSWERS, mapAnswers); + request.getSession().setAttribute(MAP_QUESTION_CONTENT_LEARNER, mapQuestions); + logger.debug("qaContent has : " + mapQuestions.size() + " entries."); + + request.getSession().setAttribute(TOTAL_QUESTION_COUNT, new Long(mapQuestions.size()).toString()); + String userFeedback= feedBackType + request.getSession().getAttribute(TOTAL_QUESTION_COUNT) + QUESTIONS; + request.getSession().setAttribute(USER_FEEDBACK, userFeedback); + + + /** + * Verify that userId does not already exist in the db. + * If it does exist, that means, that user already responded to the content and + * his answers must be displayed read-only + * + */ + QaQueUsr qaQueUsr=qaService.loadQaQueUsr(new Long(userId)); + logger.debug("QaQueUsr:" + qaQueUsr); + if (qaQueUsr != null) + { + logger.debug("the learner has already responsed to this content, just generate a read-only report."); + LearningUtil learningUtil= new LearningUtil(); + learningUtil.buidLearnerReport(request,1); + logger.debug("buidLearnerReport called successfully, forwarding to: " + LEARNER_REPORT); + return (mapping.findForward(LEARNER_REPORT)); + } + /** + * present user with the questions. + */ + logger.debug("forwarding to: " + LOAD); + return (mapping.findForward(LOAD)); + + } + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,734 @@ +/* + *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * + *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; either version 2 of the License, or + *(at your option) any later version. + * + *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 + */ + +/** + * + * @author Ozgur Demirtas +*/ + +package org.lamsfoundation.lams.tool.qa.web; + +import java.io.IOException; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +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.apache.struts.actions.DispatchAction; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaStringComparator; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; + +public class QaMonitoringAction extends DispatchAction implements QaAppConstants +{ + static Logger logger = Logger.getLogger(QaMonitoringAction.class.getName()); + + public static String SELECTBOX_SELECTED_TOOL_SESSION ="selectBoxSelectedToolSession"; + public static Integer READABLE_TOOL_SESSION_COUNT = new Integer(1); + + public ActionForward generateToolSessionDataMap(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + MonitoringUtil monitoringUtil = new MonitoringUtil(); + monitoringUtil.findSelectedMonitoringTab(form, request); + logger.debug("done with findSelectedMonitoringTab"); + + /** + * load the values for online and offline instructions + */ + handleInstructionsScreen(mapping, form, request); + IQaService qaService =QaUtils.getToolService(request); + Long initialMonitoringContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + if (initialMonitoringContentId != null) + { + QaContent qaContent=qaService.retrieveQa(initialMonitoringContentId.longValue()); + logger.debug("qaContent: " + qaContent); + request.getSession().setAttribute(MONITORED_OFFLINE_INSTRUCTIONS, qaContent.getOfflineInstructions()); + request.getSession().setAttribute(MONITORED_ONLINE_INSTRUCTIONS, qaContent.getOnlineInstructions()); + logger.debug("session updated with online/offline instructions"); + } + + /** + * determine what screen(tab) to generate + */ + String choiceMonitoring=(String)request.getSession().getAttribute(CHOICE_MONITORING); + logger.debug("CHOICE_MONITORING: " + choiceMonitoring); + + if (choiceMonitoring.equalsIgnoreCase(CHOICE_TYPE_MONITORING_SUMMARY)) + { + logger.debug("will generate summary screen"); + return generateSummaryScreen(mapping, form, request, response); + } + else if (choiceMonitoring.equalsIgnoreCase(CHOICE_TYPE_MONITORING_INSTRUCTIONS)) + { + logger.debug("will generate instructions screen"); + request.getSession().setAttribute(MONITORING_INSTRUCTIONS_VISITED, new Boolean(true)); + return generateInstructionsScreen(mapping, form, request, response); + } + else if (choiceMonitoring.equalsIgnoreCase(CHOICE_TYPE_MONITORING_EDITACTIVITY)) + { + logger.debug("will generate editActivity screen"); + request.getSession().setAttribute(MONITORING_EDITACTIVITY_VISITED, new Boolean(true)); + return generateEditActivityScreen(mapping, form, request, response); + } + else if (choiceMonitoring.equalsIgnoreCase(CHOICE_TYPE_MONITORING_STATS)) + { + logger.debug("will generate stats screen"); + request.getSession().setAttribute(MONITORING_STATS_VISITED, new Boolean(true)); + return generateStatsScreen(mapping, form, request, response); + } + return null; + } + + + public ActionForward generateSummaryScreen(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + + Boolean noToolSessionsAvailable=(Boolean)request.getSession().getAttribute(NO_TOOL_SESSIONS_AVAILABLE); + logger.debug("generateSummaryScreen has noToolSessionsAvailable: " + noToolSessionsAvailable); + if ((noToolSessionsAvailable !=null) && (noToolSessionsAvailable.booleanValue())) + { + qaMonitoringForm.resetUserAction(); + logger.debug("detected noToolSessionsAvailable:" + noToolSessionsAvailable); + persistError(request,"error.content.noToolSessions"); + request.setAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_REPORT); + return (mapping.findForward(MONITORING_REPORT)); + } + + MonitoringUtil monitoringUtil = new MonitoringUtil(); + String responseId=qaMonitoringForm.getResponseId(); + String hiddenResponseId=qaMonitoringForm.getHiddenResponseId(); + String unHiddenResponseId=qaMonitoringForm.getUnHiddenResponseId(); + + if (qaMonitoringForm.getEditReport() != null) + { + logger.debug("responseId for editReport" + responseId); + request.getSession().setAttribute(DATAMAP_EDITABLE_RESPONSE_ID, responseId); + } + else if (qaMonitoringForm.getUpdateReport() != null) + { + logger.debug("request for responseUpdate with id: " + request.getSession().getAttribute(DATAMAP_EDITABLE_RESPONSE_ID)); + responseId=(String)request.getSession().getAttribute(DATAMAP_EDITABLE_RESPONSE_ID); + String updatedResponse=qaMonitoringForm.getUpdatedResponse(); + monitoringUtil.updateResponse(request, responseId, updatedResponse); + request.getSession().setAttribute(DATAMAP_EDITABLE_RESPONSE_ID, ""); + logger.debug("end of updateResponse with: " + responseId + "-" + updatedResponse); + } + + if (qaMonitoringForm.getHideReport() != null) + { + logger.debug("hiddenResponseId for hideReport" + hiddenResponseId); + request.getSession().setAttribute(DATAMAP_HIDDEN_RESPONSE_ID, hiddenResponseId); + monitoringUtil.hideResponse(request, hiddenResponseId); + } + + if (qaMonitoringForm.getUnhideReport() != null) + { + logger.debug("hiddenResponseId for unHideReport" + unHiddenResponseId); + request.getSession().setAttribute(DATAMAP_HIDDEN_RESPONSE_ID, ""); + monitoringUtil.unHideResponse(request, unHiddenResponseId); + } + + logger.debug("DATAMAP_EDITABLE_RESPONSE_ID: " + request.getSession().getAttribute(DATAMAP_EDITABLE_RESPONSE_ID)); + logger.debug("DATAMAP_HIDDEN_RESPONSE_ID: " + request.getSession().getAttribute(DATAMAP_HIDDEN_RESPONSE_ID)); + + qaMonitoringForm.setUpdatedResponse(""); + logger.debug("request for summary"); + + String isToolSessionChanged=request.getParameter(IS_TOOL_SESSION_CHANGED); + logger.debug("IS_TOOL_SESSION_CHANGED - initial: " + isToolSessionChanged); + + /** + * sessionList holds all the toolSessionIds passed to summary page to be presented in a drop-down box. + */ + Map sessionList = new TreeMap(); + int SELECTION_CASE=0; + + logger.debug("isNonDefaultScreensVisited: " + monitoringUtil.isNonDefaultScreensVisited(request)); + + /** + * Following conditions test which entry has been selected in the monitoring mode-summary screen drop box. + * is Default page + */ + String selectionCase=(String)request.getSession().getAttribute("selectionCase"); + logger.debug("current selectionCase: " + selectionCase); + + boolean sessionListReadable=false; + if ((isToolSessionChanged == null) && !monitoringUtil.isNonDefaultScreensVisited(request)) + { + logger.debug("First case based on null. Gets rendered only once in http session life time"); + logger.debug("summary to use MAX_TOOL_SESSION_COUNT"); + /** + * initialize sessionList with "All", which is the default option. + */ + sessionList.put("All", "All"); + READABLE_TOOL_SESSION_COUNT=MAX_TOOL_SESSION_COUNT; + SELECTION_CASE=1; + } + else if ((isToolSessionChanged == null) && monitoringUtil.isNonDefaultScreensVisited(request)) + { + logger.debug("Other tabs visited. Gets rendered for all tool sessions"); + sessionList.put("All", "All"); + READABLE_TOOL_SESSION_COUNT=MAX_TOOL_SESSION_COUNT; + SELECTION_CASE=2; + sessionListReadable=true; + } + else if ((isToolSessionChanged != null) && isToolSessionChanged.equalsIgnoreCase("1")) + { + String selectedToolSessionId=(String)request.getParameter("toolSessionId1"); + logger.debug("selectedToolSessionId" + selectedToolSessionId); + /** + * is "All" selected + */ + if (selectedToolSessionId.equalsIgnoreCase("All")) + { + logger.debug("Second case"); + logger.debug("summary to use MAX_TOOL_SESSION_COUNT"); + /** + * initialize sessionList with "All", which is the default option. + */ + sessionList.put("All", "All"); + READABLE_TOOL_SESSION_COUNT=MAX_TOOL_SESSION_COUNT; + SELECTION_CASE=2; + sessionListReadable=true; + } + else + { + /** + * is a single session id selected + */ + logger.debug("Third case"); + logger.debug("selectedToolSessionId" + selectedToolSessionId); + READABLE_TOOL_SESSION_COUNT=new Integer(2); + SELECTION_CASE=3; + request.getSession().setAttribute(CURRENT_MONITORED_TOOL_SESSION,selectedToolSessionId); + logger.debug("CURRENT_MONITORED_TOOL_SESSION " + selectedToolSessionId); + } + } + else if (isToolSessionChanged.equals("") && (selectionCase.equals("3"))) + { + /** + * is a single session id selected + */ + logger.debug("case with single session and edit or update selected"); + READABLE_TOOL_SESSION_COUNT=new Integer(2); + SELECTION_CASE=3; + } + else if (isToolSessionChanged.equals("")) + { + logger.debug("All is selected"); + sessionList.put("All", "All"); + READABLE_TOOL_SESSION_COUNT=MAX_TOOL_SESSION_COUNT; + SELECTION_CASE=2; + sessionListReadable=true; + } + logger.debug("final SELECTION_CASE: " + SELECTION_CASE); + + boolean useSelectedToolSessionId=false; + String selectedToolSessionId = (String) request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION); + if ((selectedToolSessionId != null) && (SELECTION_CASE == 3) && (READABLE_TOOL_SESSION_COUNT.intValue() == 2)) + { + useSelectedToolSessionId=true; + } + + if ((qaMonitoringForm.getEditReport() == null) && (qaMonitoringForm.getUpdateReport() == null)) + { + logger.debug("no editReport or updateReport selected"); + request.getSession().setAttribute(DATAMAP_EDITABLE_RESPONSE_ID, ""); + request.getSession().setAttribute("selectionCase",new Long(SELECTION_CASE).toString()); + } + qaMonitoringForm.resetUserAction(); + + /** + * holds all the toolSessionIds passed in the form toolSessionId1, toolSessionId2 etc. + */ + Map mapToolSessions= new TreeMap(new QaStringComparator()); + request.getSession().setAttribute(MAP_TOOL_SESSIONS,mapToolSessions); + logger.debug("MAP_TOOL_SESSIONS placed into session"); + + Map mapUserResponses= new TreeMap(new QaStringComparator()); + request.getSession().setAttribute(MAP_USER_RESPONSES,mapUserResponses); + logger.debug("MAP_USER_RESPONSES placed into session"); + logger.debug("request for contributeLesson"); + /** + * monitoring reads all the toolSessionsIds appended one after other until it finds a null one. The cap was limited to 500. + * This is the case all the tool sessions are using the same content. + * + * The final Map mapToolSessions holds the Map mapQuestions which in turn holds the Map mapUserResponses. + * The key of mapToolSessions: incremental numbers + * The key of mapQuestions: questions themselves + * The key of mapUserResponses: incremental numbers + * + */ + + IQaService qaService = QaUtils.getToolService(request); + logger.debug("retrieving qaService: " + qaService); + + if (qaService == null) + { + qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieving qaService from proxy: " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + } + + request.getSession().setAttribute(NO_AVAILABLE_SESSIONS,new Boolean(false)); + logger.debug("NO_AVAILABLE_SESSIONS: " + false); + + logger.debug("retrieving ORIGINAL_TOOL_SESSIONS"); + Map originalSessionList=(Map)request.getSession().getAttribute(ORIGINAL_TOOL_SESSIONS); + logger.debug("retrieved ORIGINAL_TOOL_SESSIONS : " + originalSessionList); + /** + * monitoredToolSessionsCounter holds the total number of valid toolSessionIds passed to the monitoring url + */ + logger.debug("READABLE_TOOL_SESSION_COUNT: " + READABLE_TOOL_SESSION_COUNT); + int monitoredToolSessionsCounter=0; + for (int toolSessionIdCounter=1; toolSessionIdCounter < READABLE_TOOL_SESSION_COUNT.intValue(); toolSessionIdCounter++) + { + logger.debug("toolSessionIdCounter: " + toolSessionIdCounter); + String strToolSessionId=""; + if (useSelectedToolSessionId) + { + strToolSessionId=(String) request.getSession().getAttribute(CURRENT_MONITORED_TOOL_SESSION); + logger.debug("using strToolSessionId: " +strToolSessionId); + } + else + { + strToolSessionId=(String) originalSessionList.get(""+toolSessionIdCounter); + logger.debug("using strToolSessionId from the session: "); + } + logger.debug("original strToolSessionId: " + strToolSessionId); + + String strRetrievableToolSessionId=""; + /** + * catering for un-formatted monitoring url + * Watch for case where the "All" is selected in the drop-down. + */ + logger.debug("SELECTION_CASE: " + SELECTION_CASE); + if ((strToolSessionId == null) && (SELECTION_CASE == 1)) + { + logger.debug("un-formatted monitoring url, exiting..."); + break; + } + else if ((!sessionListReadable) && ((strToolSessionId == null) || (strToolSessionId.length() == 0))) + { + logger.debug("un-formatted monitoring url, exiting..."); + break; + } + else + { + if (sessionListReadable) + { + logger.debug("sessionListReadable is true."); + logger.debug("strToolSessionId is All: " + strToolSessionId); + sessionList=(Map)request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS); + logger.debug("toolSessionIdCounter: " + toolSessionIdCounter); + logger.debug(logger + " " + this.getClass().getName() + "sessionList size: " + sessionList.size()); + + if (toolSessionIdCounter==sessionList.size()) + { + logger.debug("sessionList size equals toolSessionIdCounter, exiting..."); + break; + } + + logger.debug("sessionList: " + sessionList); + strToolSessionId=(String)sessionList.get("Group" + toolSessionIdCounter); + logger.debug("strToolSessionId from sessionList: " + strToolSessionId); + } + + strRetrievableToolSessionId=strToolSessionId; + logger.debug("retrievableStrToolSessionId: " + strRetrievableToolSessionId); + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(strRetrievableToolSessionId).longValue()); + logger.debug("retrieving qaSession: " + qaSession); + + if (qaSession !=null) + { + monitoredToolSessionsCounter++; + request.getSession().setAttribute(TOOL_SESSION_ID, new Long(strToolSessionId)); + logger.debug("TOOL_SESSION_ID in session"); + + if (READABLE_TOOL_SESSION_COUNT.equals(MAX_TOOL_SESSION_COUNT)) + { + logger.debug("default screen - READABLE_TOOL_SESSION_COUNT equals MAX_TOOL_SESSION_COUNT"); + /** + * add the current toolSessionId to the arraylist for the drop-down box + */ + sessionList.put("Group" + monitoredToolSessionsCounter, strToolSessionId); + logger.debug("sessionList Map new entry, strToolSessionId added to the list: " + toolSessionIdCounter + "->" + strToolSessionId ); + } + + /** + * get to content from the tool session + */ + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + logger.debug("Monitor - contribute will be using TOOL_CONTENT_ID: " + qaContent.getQaContentId()); + + /** + * editActivity-defineLater screen depends on MONITORED_CONTENT_ID + */ + request.getSession().setAttribute(MONITORED_CONTENT_ID,qaContent.getQaContentId()); + + /** + * place it into TOOL_CONTENT_ID session attribute since learningUtil.buidLearnerReport(request) depends on it + * to generate a report + */ + request.getSession().setAttribute(TOOL_CONTENT_ID,qaContent.getQaContentId()); + + /** + * this is to convince jsp although usernameVisible applies only to learning mode + */ + request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(true)); + + logger.debug("REPORT_TITLE_MONITOR: " + qaContent.getMonitoringReportTitle()); + request.getSession().setAttribute(REPORT_TITLE_MONITOR,qaContent.getMonitoringReportTitle()); + + + /** + * check if the author requires that the all tool sessions must be COMPLETED before the report in Monitoring + */ + boolean isAllSessionsCompleted=monitoringUtil.isSessionsSync(request,qaContent.getQaContentId().longValue()); + logger.debug("Monitor - contribute will be using isAllSessionsCompleted: " + isAllSessionsCompleted); + logger.debug("Monitor - contribute will be using isSynchInMonitor: " + qaContent.isSynchInMonitor()); + /** + * if the author requires syncronization but not all the sessions are COMPLETED give an error + */ + if (qaContent.isSynchInMonitor() && (!isAllSessionsCompleted)) + { + request.getSession().setAttribute(CHECK_ALL_SESSIONS_COMPLETED, new Boolean(true)); + request.getSession().setAttribute(IS_ALL_SESSIONS_COMPLETED, new Boolean(isAllSessionsCompleted)); + + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage("error.synchInMonitor")); + logger.debug("add synchInMonitor to ActionMessages"); + saveErrors(request,errors); + } + else + { + request.getSession().setAttribute(CHECK_ALL_SESSIONS_COMPLETED, new Boolean(false)); + } + logger.debug("IS_ALL_SESSIONS_COMPLETED:" + request.getSession().getAttribute(IS_ALL_SESSIONS_COMPLETED)); + logger.debug("CHECK_ALL_SESSIONS_COMPLETED" + request.getSession().getAttribute(CHECK_ALL_SESSIONS_COMPLETED)); + + LearningUtil learningUtil= new LearningUtil(); + /** + * generate a report for the Author/Teacher + */ + logger.debug("calling buidMonitoringReport with toolSessionIdCounter:" + toolSessionIdCounter); + learningUtil.buidLearnerReport(request, toolSessionIdCounter); + } + } + } + + /** + * store the arrayList in the session + */ + if (READABLE_TOOL_SESSION_COUNT.equals(MAX_TOOL_SESSION_COUNT)) + { + logger.debug("sessionList storable"); + request.getSession().setAttribute(SUMMARY_TOOL_SESSIONS,sessionList); + logger.debug("SUMMARY_TOOL_SESSIONS stored into the session:" + request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS)); + } + + mapToolSessions=(Map)request.getSession().getAttribute(MAP_TOOL_SESSIONS); + logger.debug("before forwarding MAP_TOOL_SESSIONS:" + mapToolSessions); + + if (mapToolSessions.size() == 0) + { + request.getSession().setAttribute(NO_AVAILABLE_SESSIONS,new Boolean(true)); + logger.debug("NO_AVAILABLE_SESSIONS: " +true); + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage("error.noStudentActivity")); + logger.debug("add error.noStudentActivity to ActionMessages"); + saveErrors(request,errors); + } + + Boolean noAvailableSessions=(Boolean) request.getSession().getAttribute(NO_AVAILABLE_SESSIONS); + logger.debug("before forwarding NO_AVAILABLE_SESSIONS:" + noAvailableSessions); + + Map mapMonitoringQuestions=(Map)request.getSession().getAttribute(MAP_MONITORING_QUESTIONS); + logger.debug("before forwarding MAP_MONITORING_QUESTIONS:" + mapMonitoringQuestions); + + String targetMode=(String )request.getSession().getAttribute(TARGET_MODE); + logger.debug("TARGET_MODE: " + targetMode); + return (mapping.findForward(MONITORING_REPORT)); + } + + public ActionForward generateInstructionsScreen(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + logger.debug(logger + " " + this.getClass().getName() + "will generateInstructionsScreen."); + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + + Long initialMonitoringContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + if (initialMonitoringContentId == null) + { + logger.debug("missing content id:"); + persistError(request,"error.tab.contentId.required"); + request.setAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_REPORT); + return (mapping.findForward(MONITORING_REPORT)); + } + + qaMonitoringForm.resetUserAction(); + return (mapping.findForward(MONITORING_REPORT)); + } + + + public ActionForward generateEditActivityScreen(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + + request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(false)); + IQaService qaService=(IQaService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("retrieving qaService: " + qaService); + + Long toolContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); + + if (toolContentId == null) + { + /** + * toolContentId is not available from the toolSessions passed to the monitoring url. + * in this case, toolContentId must have been passed separetely + */ + Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); + logger.debug("will generateEditActivityScreen: " + monitoredContentId); + + if (monitoredContentId == null) + { + throw new QaApplicationException("Exception occured: " + + "Tool expects a legitimate TOOL_CONTENT_ID from the container since it is also not available from the toolSession(s) passed. Can't continue!"); + } + toolContentId=monitoredContentId; + } + request.getSession().setAttribute(MONITORED_CONTENT_ID, toolContentId); + + logger.debug("will use monitoredContentId: " + toolContentId); + QaContent qaContent=qaService.loadQa(toolContentId.longValue()); + logger.debug("will use qaContent: " + qaContent); + + request.getSession().setAttribute(IS_MONITORING_DEFINE_LATER, new Boolean(qaContent.isDefineLater())); + logger.debug("IS_MONITORING_DEFINE_LATER: " + request.getSession().getAttribute(IS_MONITORING_DEFINE_LATER)); + + logger.debug("calling studentActivityOccurredGlobal with: " + qaContent); + boolean studentActivity=qaService.studentActivityOccurredGlobal(qaContent); + logger.debug("studentActivity on content: " + studentActivity); + + qaMonitoringForm.resetUserAction(); + if (studentActivity == false) + { + /** + * forward to Authoring Basic tab + */ + QaStarterAction qaStarterAction = new QaStarterAction(); + QaAuthoringForm qaAuthoringForm = new QaAuthoringForm(); + logger.debug("forward to Authoring Basic tab "); + ActionForward actionForward=qaStarterAction.startMonitoringSummary(mapping, qaAuthoringForm, request, response); + logger.debug("actionForward: " + actionForward); + return (actionForward); + } + else + { + logger.debug("forward to warning screen as the content is not allowed to be modified."); + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse")); + saveErrors(request,errors); + request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(true)); + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(true)); + logger.debug("forwarding to:" + LOAD); + return (mapping.findForward(LOAD)); + } + } + + + public ActionForward generateStatsScreen(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + Boolean noToolSessionsAvailable=(Boolean)request.getSession().getAttribute(NO_TOOL_SESSIONS_AVAILABLE); + if ((noToolSessionsAvailable !=null) && (noToolSessionsAvailable.booleanValue())) + { + qaMonitoringForm.resetUserAction(); + logger.debug("detected noToolSessionsAvailable:" + noToolSessionsAvailable); + persistError(request,"error.content.noToolSessions"); + request.setAttribute(USER_EXCEPTION_ONLYCONTENT_ANDNOSESSIONS, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_REPORT); + return (mapping.findForward(MONITORING_REPORT)); + } + + IQaService qaService=(IQaService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("retrieving qaService: " + qaService); + + Map mapStats= new TreeMap(new QaStringComparator()); + request.getSession().setAttribute(MAP_STATS,mapStats); + + Map sessionList=(Map)request.getSession().getAttribute(SUMMARY_TOOL_SESSIONS); + for (int toolSessionIdCounter=1; toolSessionIdCounter < READABLE_TOOL_SESSION_COUNT.intValue(); toolSessionIdCounter++) + { + String strToolSessionId=(String)sessionList.get("Group" + toolSessionIdCounter); + logger.debug("strToolSessionId from http session: " + strToolSessionId); + if ((strToolSessionId != null) && (strToolSessionId.length() > 0)) + { + QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(strToolSessionId).longValue()); + logger.debug("retrieving qaSession: " + qaSession); + if (qaSession != null) + { + logger.debug("retrieving qaSession: " + qaSession); + int countSessionUser=qaService.countSessionUser(qaSession); + logger.debug("countSessionUser: " + countSessionUser); + mapStats.put(strToolSessionId, new Integer(countSessionUser).toString()); + request.getSession().setAttribute(MAP_STATS,mapStats); + } + + } + } + mapStats=(Map)request.getSession().getAttribute(MAP_STATS); + logger.debug("final MAP_STATS: " + mapStats); + qaMonitoringForm.resetUserAction(); + return (mapping.findForward(MONITORING_REPORT)); + } + + + /** + * markDataMapAsEditable(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + * @throws ServletException + * + * + * marks the dataMap so that jsp renders the summary screen as editable + */ + public ActionForward markDataMapAsEditable(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException + { + request.getSession().setAttribute(DATAMAP_EDITABLE, new Boolean(true)); + logger.debug("will generate editable summary screen"); + return generateSummaryScreen(mapping, form, request, response); + } + + + public ActionForward handleInstructionsScreen(ActionMapping mapping,ActionForm form, HttpServletRequest request) + { + /** + * update online and offline instuctions content if there is a request. + */ + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + IQaService qaService =QaUtils.getToolService(request); + if (qaMonitoringForm.getSubmitMonitoringInstructions() != null) + { + logger.debug("request for prosssing Monitoring instructions :"); + qaMonitoringForm.setSubmitMonitoringInstructions(null); + + logger.debug("online instructions :" + qaMonitoringForm.getOnlineInstructions()); + logger.debug("offline instructions :" + qaMonitoringForm.getOfflineInstructions()); + Long initialMonitoringContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + if (initialMonitoringContentId == null) + { + logger.debug("missing content id:"); + persistError(request,"error.tab.contentId.required"); + request.setAttribute(USER_EXCEPTION_MONITORINGTAB_CONTENTID_REQUIRED, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_ERROR); + return (mapping.findForward(MONITORING_REPORT)); + } + else + { + /** + * update the content + */ + logger.debug("content id: " + initialMonitoringContentId); + QaContent qaContent=qaService.retrieveQa(initialMonitoringContentId.longValue()); + logger.debug("qaContent: " + qaContent); + qaContent.setOnlineInstructions(qaMonitoringForm.getOnlineInstructions()); + qaContent.setOfflineInstructions(qaMonitoringForm.getOfflineInstructions()); + qaService.updateQa(qaContent); + logger.debug("qaContent updated in the db"); + request.getSession().setAttribute(MONITORED_OFFLINE_INSTRUCTIONS, qaContent.getOfflineInstructions()); + request.getSession().setAttribute(MONITORED_ONLINE_INSTRUCTIONS, qaContent.getOnlineInstructions()); + logger.debug("session updated with online/offline instructions"); + request.setAttribute(MONITORING_INSTRUCTIONS_UPDATE_MESSAGE, new Boolean(true)); + return (mapping.findForward(MONITORING_REPORT)); + } + } + logger.debug("end of online-offline instructions content handling"); + return null; + } + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } + +} \ No newline at end of file Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringForm.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringForm.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringForm.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,291 @@ +/* + * ozgurd + * Created on 26/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa.web; + +/** + * ActionForm for the Monitoring environment + */ +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; + +/** + * @author Ozgur Demirtas + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class QaMonitoringForm extends ActionForm implements QaAppConstants { + static Logger logger = Logger.getLogger(QaMonitoringForm.class.getName()); + + /** + * these buttons are not used in the deployment + */ + protected String startLesson; + protected String deleteLesson; + protected String forceComplete; + + /** + * buttons + */ + protected String editReport; + protected String updateReport; + protected String hideReport; + protected String unhideReport; + protected String submitMonitoringInstructions; + + protected String summary; + protected String instructions; + protected String editActivity; + protected String stats; + + protected String responseId; + protected String hiddenResponseId; + protected String unHiddenResponseId; + protected String updatedResponse; + + protected String offlineInstructions; + protected String onlineInstructions; + + public void resetUserAction() + { + this.startLesson=null; + this.deleteLesson=null; + this.forceComplete=null; + + this.summary=null; + this.instructions=null; + this.editActivity=null; + this.stats=null; + + this.editReport=null; + this.updateReport=null; + this.hideReport=null; + this.unhideReport=null; + + this.offlineInstructions=null; + this.onlineInstructions=null; + } + /** + * @return Returns the deleteLesson. + */ + public String getDeleteLesson() { + return deleteLesson; + } + /** + * @param deleteLesson The deleteLesson to set. + */ + public void setDeleteLesson(String deleteLesson) { + this.deleteLesson = deleteLesson; + } + /** + * @return Returns the startLesson. + */ + public String getStartLesson() { + return startLesson; + } + /** + * @param startLesson The startLesson to set. + */ + public void setStartLesson(String startLesson) { + this.startLesson = startLesson; + } + /** + * @return Returns the forceComplete. + */ + public String getForceComplete() { + return forceComplete; + } + /** + * @param forceComplete The forceComplete to set. + */ + public void setForceComplete(String forceComplete) { + this.forceComplete = forceComplete; + } + /** + * @return Returns the summary. + */ + public String getSummary() { + return summary; + } + /** + * @param summary The summary to set. + */ + public void setSummary(String summary) { + this.summary = summary; + } + /** + * @return Returns the instructions. + */ + public String getInstructions() { + return instructions; + } + /** + * @param instructions The instructions to set. + */ + public void setInstructions(String instructions) { + this.instructions = instructions; + } + /** + * @return Returns the editActivity. + */ + public String getEditActivity() { + return editActivity; + } + /** + * @param editActivity The editActivity to set. + */ + public void setEditActivity(String editActivity) { + this.editActivity = editActivity; + } + /** + * @return Returns the stats. + */ + public String getStats() { + return stats; + } + /** + * @param stats The stats to set. + */ + public void setStats(String stats) { + this.stats = stats; + } + /** + * @return Returns the editReport. + */ + public String getEditReport() { + return editReport; + } + /** + * @param editReport The editReport to set. + */ + public void setEditReport(String editReport) { + this.editReport = editReport; + } + /** + * @return Returns the responseId. + */ + public String getResponseId() { + return responseId; + } + /** + * @param responseId The responseId to set. + */ + public void setResponseId(String responseId) { + this.responseId = responseId; + } + /** + * @return Returns the updateReport. + */ + public String getUpdateReport() { + return updateReport; + } + /** + * @param updateReport The updateReport to set. + */ + public void setUpdateReport(String updateReport) { + this.updateReport = updateReport; + } + /** + * @return Returns the updatedResponse. + */ + public String getUpdatedResponse() { + return updatedResponse; + } + /** + * @param updatedResponse The updatedResponse to set. + */ + public void setUpdatedResponse(String updatedResponse) { + this.updatedResponse = updatedResponse; + } + /** + * @return Returns the hideReport. + */ + public String getHideReport() { + return hideReport; + } + /** + * @param hideReport The hideReport to set. + */ + public void setHideReport(String hideReport) { + this.hideReport = hideReport; + } + /** + * @return Returns the hiddenResponseId. + */ + public String getHiddenResponseId() { + return hiddenResponseId; + } + /** + * @param hiddenResponseId The hiddenResponseId to set. + */ + public void setHiddenResponseId(String hiddenResponseId) { + this.hiddenResponseId = hiddenResponseId; + } + /** + * @return Returns the unhideReport. + */ + public String getUnhideReport() { + return unhideReport; + } + /** + * @param unhideReport The unhideReport to set. + */ + public void setUnhideReport(String unhideReport) { + this.unhideReport = unhideReport; + } + /** + * @return Returns the unHiddenResponseId. + */ + public String getUnHiddenResponseId() { + return unHiddenResponseId; + } + /** + * @param unHiddenResponseId The unHiddenResponseId to set. + */ + public void setUnHiddenResponseId(String unHiddenResponseId) { + this.unHiddenResponseId = unHiddenResponseId; + } + /** + * @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 submitMonitoringInstructions. + */ + public String getSubmitMonitoringInstructions() { + return submitMonitoringInstructions; + } + /** + * @param submitMonitoringInstructions The submitMonitoringInstructions to set. + */ + public void setSubmitMonitoringInstructions( + String submitMonitoringInstructions) { + this.submitMonitoringInstructions = submitMonitoringInstructions; + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringStarterAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringStarterAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaMonitoringStarterAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,406 @@ +/* + * Created on 8/03/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * @author Ozgur Demirtas + + * * + * Monitoring screen does have 4 tabs: + * Summary : default tab, either all sessions by default or single sessions selected, enable edit responses and hide responses + * Instructions: Online+offline instructions+multipe file uploads + new table + * Edit Activity : points to the definelater url= authoring url basic tab + * Stats + * + * + * SUMMARY_TOOL_SESSIONS keeps all the passed toolSessionIds in an arrayList. + */ + + +package org.lamsfoundation.lams.tool.qa.web; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.Action; +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.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaSession; +import org.lamsfoundation.lams.tool.qa.QaStringComparator; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + +public class QaMonitoringStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaMonitoringStarterAction.class.getName()); + + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException, ToolException + { + QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; + + /** + * retrive the service + */ + IQaService qaService=null; + qaService =(IQaService)request.getSession().getAttribute(TOOL_SERVICE); + if (qaService == null) + { + qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieving qaService from the session: " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + } + logger.debug("retrieved qaService: " + qaService); + + /** + * persist time zone information to session scope. + */ + QaUtils.persistTimeZone(request); + + /** + * mark the http session as an authoring activity + */ + request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_MONITORING); + + /** + * obtain and setup the current user's data + */ + String userId = ""; + //get session from shared session. + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user == null) || (user.getUserID() == null)) + { + logger.debug("error: The tool expects userId"); + persistError(request,"error.authoringUser.notAvailable"); + request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + }else + userId = user.getUserID().toString(); + + logger.debug("TOOL_USER is:" + user); + + String toolContentId=request.getParameter(TOOL_CONTENT_ID); + logger.debug("TOOL_CONTENT_ID: " + toolContentId); + + Long initialMonitoringContentId=(Long) request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + logger.debug("INITIAL_MONITORING_TOOL_CONTENT_ID: " + initialMonitoringContentId); + + if ((toolContentId == null) || (toolContentId.length() == 0)) + { + logger.debug(logger + "Warning!: toolContentId is not available!"); + } + else if (initialMonitoringContentId != null) + { + logger.debug("using INITIAL_MONITORING_TOOL_CONTENT_ID: " + initialMonitoringContentId); + toolContentId=initialMonitoringContentId.toString(); + } + + try + { + if ((toolContentId != null) && (toolContentId.length() > 0)) + { + if (!QaUtils.existsContent(new Long(toolContentId).longValue(), request)) + { + persistError(request,"error.content.doesNotExist"); + request.setAttribute(USER_EXCEPTION_CONTENT_DOESNOTEXIST, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_ERROR); + return (mapping.findForward(MONITORING_REPORT)); + } + request.getSession().setAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID, new Long(toolContentId)); + } + } + catch(NumberFormatException e) + { + persistError(request,"error.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + MONITORING_ERROR); + return (mapping.findForward(MONITORING_REPORT)); + } + logger.debug("final INITIAL_MONITORING_TOOL_CONTENT_ID: " + request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID)); + + /** + * load the values for online and offline instructions + */ + initialMonitoringContentId=(Long)request.getSession().getAttribute(INITIAL_MONITORING_TOOL_CONTENT_ID); + if (initialMonitoringContentId != null) + { + QaContent qaContent=qaService.retrieveQa(initialMonitoringContentId.longValue()); + logger.debug("qaContent: " + qaContent); + request.getSession().setAttribute(MONITORED_OFFLINE_INSTRUCTIONS, qaContent.getOfflineInstructions()); + request.getSession().setAttribute(MONITORED_ONLINE_INSTRUCTIONS, qaContent.getOnlineInstructions()); + logger.debug("session updated with online/offline instructions"); + } + + /** + * find out if only content id but no tool sessions has been passed + * since with the updated tool contract only userId+toolContentId is passed + * this will always return true + */ + + boolean isOnlyContentIdAvailable = isOnlyContentIdAvailable(request); + logger.debug("final isOnlyContentIdAvailable: " + isOnlyContentIdAvailable); + + request.getSession().setAttribute(NO_TOOL_SESSIONS_AVAILABLE, new Boolean(false)); + if (isOnlyContentIdAvailable == false) + { + /** + * this block of code will normally never run! + */ + logger.debug("Warning! We are not supposed to reach here!"); + } + else + { + logger.debug("isOnlyContentIdAvailable: " + isOnlyContentIdAvailable); + logger.debug("no tool sessions passed and they will be populated from toolContentId."); + qaMonitoringForm.resetUserAction(); + logger.debug("getting qaContent for toolContentId: " + toolContentId); + QaContent qaContent=qaService.loadQa(new Long(toolContentId).longValue()); + logger.debug("retrieved qaContent: " + qaContent); + List listToolSessionIds=qaService.getToolSessionsForContent(qaContent); + logger.debug("retrieved listToolSessionIds: " + listToolSessionIds); + + Map originalSessionList= new TreeMap(new QaStringComparator()); + Iterator sessionIdsIterator=listToolSessionIds.iterator(); + int sessionIdCounter=1; + while (sessionIdsIterator.hasNext()) + { + Long derivedToolSessionId=(Long) sessionIdsIterator.next(); + logger.debug("derivedToolSessionId: " + derivedToolSessionId); + originalSessionList.put(new Integer(sessionIdCounter).toString(), derivedToolSessionId.toString()); + sessionIdCounter++; + } + logger.debug("constructed originalSessionList: " + originalSessionList); + + if (originalSessionList.size() == 0) + request.getSession().setAttribute(NO_TOOL_SESSIONS_AVAILABLE, new Boolean(true)); + else + request.getSession().setAttribute(ORIGINAL_TOOL_SESSIONS,originalSessionList); + + qaMonitoringForm.setSummary("summary"); + } + + String strFromToolContentId=""; + String strToToolContentId=""; + + /** + * simulate Monitoring Service bean by calling the interface methods here + */ + if (qaMonitoringForm.getStartLesson() != null) + { + qaMonitoringForm.resetUserAction(); + /** + * In deployment, we won't be passing FROM_TOOL_CONTENT_ID, TO_TOOL_CONTENT_ID and TOOL_SESSION_ID from url + * the Monitoring Service bean calls: + * copyToolContent(Long fromContentId, Long toContentId) + */ + strFromToolContentId=request.getParameter(FROM_TOOL_CONTENT_ID); + logger.debug("FROM_TOOL_CONTENT_ID: " + strFromToolContentId); + + strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID); + logger.debug("TO_TOOL_CONTENT_ID: " + strToToolContentId); + try + { + qaService.copyToolContent(new Long(strFromToolContentId), new Long(strToToolContentId)); + } + catch(ToolException e) + { + logger.debug("exception copying content."); + throw e; + } + logger.debug("test successfull: copyToolContent."); + + /** calls to these two methods will be made from Monitoring Service bean optionally depending on + * the the tool is setup for DefineLater and (or) RunOffline + */ + + /** + * TESTED to work + * qaService.setAsDefineLater(new Long(strToToolContentId)); + qaService.setAsRunOffline(new Long(strToToolContentId)); + * + */ + } + else if (qaMonitoringForm.getDeleteLesson() != null) + { + qaMonitoringForm.resetUserAction(); + /** + * TESTED to work + */ + strToToolContentId=request.getParameter(TO_TOOL_CONTENT_ID); + logger.debug("TO_TOOL_CONTENT_ID: " + strToToolContentId); + if (strToToolContentId == null) + { + throw new QaApplicationException("Exception occured: " + + "Tool expects a legitimate TO_TOOL_CONTENT_ID from the container. Can't continue!"); + } + qaService.removeToolContent(new Long(strToToolContentId)); + } + /** + *forceComplete is an API call to service bean from monitoring environment with userId as the parameter + */ + else if (qaMonitoringForm.getForceComplete() != null) + { + /** + * Parameter: userId + */ + qaMonitoringForm.resetUserAction(); + logger.debug("request for forceComplete"); + userId=request.getParameter(MONITOR_USER_ID); + logger.debug("MONITOR_USER_ID: " + userId); + qaService.setAsForceComplete(new Long(userId)); + logger.debug("end of setAsForceComplete with userId: " + userId); + } + /** + * summary tab is one of the main tabs in monitoring screen, summary is the default tab + */ + else if (qaMonitoringForm.getSummary() != null) + { + qaMonitoringForm.resetUserAction(); + logger.debug("do generateToolSessionDataMap"); + QaMonitoringAction qaMonitoringAction= new QaMonitoringAction(); + return qaMonitoringAction.generateToolSessionDataMap(mapping,form,request,response); + } + else if (qaMonitoringForm.getInstructions() != null) + { + qaMonitoringForm.resetUserAction(); + logger.debug("request for instructions"); + } + else if (qaMonitoringForm.getEditActivity() != null) + { + qaMonitoringForm.resetUserAction(); + logger.debug("request for editActivity"); + } + else if (qaMonitoringForm.getStats() != null) + { + qaMonitoringForm.resetUserAction(); + logger.debug("request for stats"); + } + return null; + } + + + public boolean isOnlyContentIdAvailable(HttpServletRequest request) + { + boolean existsContentId=false; + String strToolContentId=request.getParameter(TOOL_CONTENT_ID); + if ((strToolContentId != null) && (strToolContentId.length() > 0)) + existsContentId=true; + + boolean existsToolSession=false; + for (int toolSessionIdCounter=1; toolSessionIdCounter < MAX_TOOL_SESSION_COUNT.intValue(); toolSessionIdCounter++) + { + String strToolSessionId=request.getParameter(TOOL_SESSION_ID + toolSessionIdCounter); + if ((strToolSessionId != null) && (strToolSessionId.length() > 0)) + { + existsToolSession=true; + } + } + + if (existsContentId && (!existsToolSession)) + { + logger.debug("OnlyContentIdAvailable"); + return true; + } + else + { + logger.debug("Not OnlyContentIdAvailable"); + return false; + } + } + + /** + * verify that toolSession and content is compatible + */ + public boolean isToolSessionCompatibleToContent(Long toolContentId, HttpServletRequest request) + { + IQaService qaService =QaUtils.getToolService(request); + for (int toolSessionIdCounter=1; toolSessionIdCounter < MAX_TOOL_SESSION_COUNT.intValue(); toolSessionIdCounter++) + { + String strToolSessionId=request.getParameter(TOOL_SESSION_ID + toolSessionIdCounter); + logger.debug("TOOL_SESSION_ID: " + strToolSessionId); + if ((strToolSessionId != null) && (strToolSessionId.length() > 0)) + { + QaSession qaSession=null; + try + { + qaSession=qaService.retrieveQaSessionOrNullById(new Long(strToolSessionId).longValue()); + } + catch(NumberFormatException e) + { + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + } + + if (qaSession != null) + { + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + logger.debug("qaContent id versus toolSession's content id: " + toolContentId + " versus " + qaContent.getQaContentId()); + if (!qaContent.getQaContentId().equals(toolContentId)) + { + logger.debug("qaContent and toolSesion not compatible:"); + return false; + } + } + else + { + logger.debug("error: TOOL_SESSION_ID passed does not refer to an existing tool session."); + request.setAttribute(USER_EXCEPTION_TOOLSESSION_DOESNOTEXIST, new Boolean(true)); + break; + } + } + + if ((strToolSessionId == null) && (toolSessionIdCounter == 1)) + { + logger.debug("error: TOOL_SESSION_IDs not passed in the right format"); + request.setAttribute(USER_EXCEPTION_WRONG_FORMAT, new Boolean(true)); + break; + } + if ((strToolSessionId != null) && (strToolSessionId.length() == 0) && (toolSessionIdCounter == 1)) + { + logger.debug("error: TOOL_SESSION_IDs not passed in the right format"); + request.setAttribute(USER_EXCEPTION_WRONG_FORMAT, new Boolean(true)); + break; + } + } + logger.debug("qaContent and toolSesion compatible:"); + return true; + } + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } +} Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaStarterAction.java =================================================================== diff -u --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaStarterAction.java (revision 0) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/QaStarterAction.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,513 @@ +/** + * @author Ozgur Demirtas + * + * Created on 8/03/2005 + * + * initializes the tool's authoring mode + */ + +/** + * Tool path The URL path for the tool should be /tool/$TOOL_SIG. + * + * CONTENT_LOCKED refers to content being in use or not: Any students answered that content? + * For future CONTENT_LOCKED ->CONTENT_IN_USE + * + * QaStarterAction loads the default content and initializes the presentation Map + * Requests can come either from authoring envuironment or from the monitoring environment for Edit Activity screen + * + * Check QaUtils.createAuthoringUser again User Management Service is ready + * + * */ + +/** + * + * Tool Content: + * + * While tool's manage their own content, the LAMS core and the tools work together to create and use the content. + * The tool content id (toolContentId) is the key by which the tool and the LAMS core discuss data - + * it is generated by the LAMS core and supplied to the tool whenever content needs to be stored. + * The LAMS core will refer to the tool content id whenever the content needs to be used. + * Tool content will be covered in more detail in following sections. + * + * Each tool will have one piece of content that is the default content. + * The tool content id for this content is created as part of the installation process. + * Whenever a tool is asked for some tool content that does not exist, it should supply the default tool content. + * This will allow the system to render the normal screen, albeit with useless information, rather than crashing. +*/ + +/** +* +* Authoring URL: +* +* The tool must supply an authoring module, which will be called to create new content or edit existing content. It will be called by an authoring URL using the following format: ????? +* The initial data displayed on the authoring screen for a new tool content id may be the default tool content. +* +* Authoring UI data consists of general Activity data fields and the Tool specific data fields. +* The authoring interface will have three tabs. The mandatory (and suggested) fields are given. Each tool will have its own fields which it will add on any of the three tabs, as appropriate to the tabs' function. +* +* Basic: Displays the basic set of fields that are needed for the tool, and it could be expected that a new LAMS user would use. Mandatory fields: Title, Instructions. +* Advanced: Displays the extra fields that would be used by experienced LAMS users. Optional fields: Lock On Finish, Make Responses Anonymous +* Instructions: Displays the "instructions" fields for teachers. Mandatory fields: Online instructions, Offline instructions, Document upload. +* The "Define Later" and "Run Offline" options are set on the Flash authoring part, and not on the tool's authoring screens. +* +* Preview The tool must be able to show the specified content as if it was running in a lesson. It will be the learner url with tool access mode set to ToolAccessMode.AUTHOR. +* Export The tool must be able to export its tool content for part of the overall learning design export. +* +* The format of the serialization for export is XML. Tool will define extra namespace inside the element to add a new data element (type). Inside the data element, it can further define more structures and types as it seems fit. +* The data elements must be "version" aware. The data elements must be "type" aware if they are to be shared between Tools. +* +* LAMS Xpress (Ernie, could you put something in here. You explain it better than I do!) +* Data Exchange At present, there is no data exchange format between tools. Therefore if a tool needs to work with another tool, they will need to be combined in a new tool. We plan to have a data exchange method in a future version of LAMS. +* +*/ + +/* + * check back QaUtils.configureContentRepository(request); + */ + +package org.lamsfoundation.lams.tool.qa.web; +import java.io.IOException; +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; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.apache.struts.Globals; +import org.apache.struts.action.Action; +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.tool.qa.QaAppConstants; +import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.QaComparator; +import org.lamsfoundation.lams.tool.qa.QaContent; +import org.lamsfoundation.lams.tool.qa.QaQueContent; +import org.lamsfoundation.lams.tool.qa.QaUtils; +import org.lamsfoundation.lams.tool.qa.service.IQaService; +import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; + + +public class QaStarterAction extends Action implements QaAppConstants { + static Logger logger = Logger.getLogger(QaStarterAction.class.getName()); + + /** + * A Map data structure is used to present the UI. + * It is fetched by subsequent Action classes to manipulate its content and gets parsed in the presentation layer for display. + */ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException { + + Map mapQuestionContent= new TreeMap(new QaComparator()); + /** these two are for repository access */ + /**holds the final offline files list */ + LinkedList listUploadedOfflineFiles= new LinkedList(); + LinkedList listUploadedOnlineFiles= new LinkedList(); + + /** these two are for jsp */ + LinkedList listUploadedOfflineFileNames= new LinkedList(); + LinkedList listUploadedOnlineFileNames= new LinkedList(); + + QaAuthoringForm qaAuthoringForm = (QaAuthoringForm) form; + qaAuthoringForm.resetRadioBoxes(); + + request.getSession().setAttribute(IS_DEFINE_LATER,"false"); + request.getSession().setAttribute(DISABLE_TOOL,""); + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILES,listUploadedOfflineFiles); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILES,listUploadedOnlineFiles); + + request.getSession().setAttribute(LIST_UPLOADED_OFFLINE_FILENAMES,listUploadedOfflineFileNames); + request.getSession().setAttribute(LIST_UPLOADED_ONLINE_FILENAMES,listUploadedOnlineFileNames); + + + /** + * retrive the service + */ + IQaService qaService = QaUtils.getToolService(request); + logger.debug("retrieving qaService from session: " + qaService); + if (qaService == null) + { + qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("retrieving qaService from proxy: " + qaService); + request.getSession().setAttribute(TOOL_SERVICE, qaService); + } + /** souble check if this is a good place to call */ + QaUtils.configureContentRepository(request); + + /** + * obtain and setup the current user's data + */ + //get session from shared session. + HttpSession ss = SessionManager.getSession(); + //get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if ((user == null) || (user.getUserID() == null)) + { + logger.debug("error: The tool expects userId"); + persistError(request,"error.authoringUser.notAvailable"); + request.setAttribute(USER_EXCEPTION_USERID_NOTAVAILABLE, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /** + * retrieve the default content id based on tool signature + */ + long contentId=0; + try + { + logger.debug("attempt retrieving tool with signatute : " + MY_SIGNATURE); + contentId=qaService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("retrieved tool default contentId: " + contentId); + if (contentId == 0) + { + logger.debug("default content id has not been setup"); + persistError(request,"error.defaultContent.notSetup"); + request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + } + } + catch(Exception e) + { + logger.debug("error getting the default content id: " + e.getMessage()); + persistError(request,"error.defaultContent.notSetup"); + request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOTSETUP, new Boolean(true)); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /** + * retrieve the default question content id based on default content id determined above + */ + try + { + logger.debug("retrieve the default question content based on default contentId: " + contentId); + QaQueContent qaQueContent=qaService.getToolDefaultQuestionContent(contentId); + logger.debug("using QaQueContent: " + qaQueContent); + if (qaQueContent == null) + { + logger.debug("Exception occured: No default question content"); + request.setAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE, new Boolean(true)); + persistError(request,"error.defaultQuestionContent.notAvailable"); + return (mapping.findForward(LOAD_QUESTIONS)); + } + /** + * display a single sample question + */ + request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.getQuestion()); + } + catch(Exception e) + { + logger.debug("Exception occured: No default question content"); + request.setAttribute(USER_EXCEPTION_DEFAULTQUESTIONCONTENT_NOT_AVAILABLE, new Boolean(true)); + persistError(request,"error.defaultQuestionContent.notAvailable"); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + /** + * mark the http session as an authoring activity + */ + request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_AUTHORING); + + /** + * define tab controllers for jsp + */ + request.getSession().setAttribute(CHOICE_TYPE_BASIC,CHOICE_TYPE_BASIC); + request.getSession().setAttribute(CHOICE_TYPE_ADVANCED,CHOICE_TYPE_ADVANCED); + request.getSession().setAttribute(CHOICE_TYPE_INSTRUCTIONS,CHOICE_TYPE_INSTRUCTIONS); + + request.getSession().setAttribute(EDITACTIVITY_EDITMODE, new Boolean(false)); + request.getSession().setAttribute(FORM_INDEX, "0"); + logger.debug("FORM_INDEX set to: " + request.getSession().getAttribute(FORM_INDEX)); + + + /** + * find out whether the request is coming from monitoring module for EditActivity tab or from authoring environment url + */ + String strToolContentId=""; + Boolean isMonitoringEditActivityVisited=(Boolean)request.getSession().getAttribute(MONITORING_EDITACTIVITY_VISITED); + logger.debug("isMonitoringEditActivityVisited: " + isMonitoringEditActivityVisited); + + Long monitoredContentId=(Long)request.getSession().getAttribute(MONITORED_CONTENT_ID); + logger.debug("MONITORED_CONTENT_ID: " + monitoredContentId); + + request.getSession().setAttribute(RENDER_MONITORING_EDITACTIVITY,new Boolean(false)); + + Boolean startMonitoringSummaryRequest=(Boolean)request.getAttribute(START_MONITORING_SUMMARY_REQUEST); + if ((startMonitoringSummaryRequest != null) && (startMonitoringSummaryRequest.booleanValue())) + { + logger.debug("will render Monitoring Edit Activity screen"); + if ((isMonitoringEditActivityVisited != null) && (isMonitoringEditActivityVisited.booleanValue())) + { + if (monitoredContentId != null) + { + /** + * request is from Edit Activity tab in monitoring + */ + strToolContentId=monitoredContentId.toString(); + logger.debug("request is from Edit Activity tab in monitoring: " + monitoredContentId); + logger.debug("using MONITORED_CONTENT_ID: " + monitoredContentId); + request.getSession().setAttribute(RENDER_MONITORING_EDITACTIVITY,new Boolean(true)); + } + } + } + else + { + logger.debug("will render authoring screen"); + /** + * request is from authoring environment + */ + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(false)); + logger.debug("request is from authoring environment: "); + strToolContentId=request.getParameter(TOOL_CONTENT_ID); + } + logger.debug("usable strToolContentId: " + strToolContentId); + + /** + * Process incoming tool content id + * Either exists or not exists in the db yet, a toolContentId must be passed to the tool from the container + */ + long toolContentId=0; + try + { + toolContentId=new Long(strToolContentId).longValue(); + logger.debug("passed TOOL_CONTENT_ID : " + toolContentId); + request.getSession().setAttribute(TOOL_CONTENT_ID,strToolContentId); + } + catch(NumberFormatException e) + { + persistError(request,"error.numberFormatException"); + request.setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true)); + logger.debug("forwarding to: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * find out if the passed tool content id exists in the db + * present user either a first timer screen with default content data or fetch the existing content. + * + * if the toolcontentid does not exist in the db, create the default Map, + * there is no need to check if the content is locked in this case. + * It is always unlocked since it is the default content. + */ + if (!existsContent(toolContentId, request)) + { + /** + * get default content from db, user never created any content before + */ + contentId=qaService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("getting default content with id:" + contentId); + + QaContent defaultQaContent = qaService.retrieveQa(contentId); + logger.debug("defaultQaContent: " + defaultQaContent); + + /** + * this is a new content creation, the content must always be unlocked + * CONTENT_LOCKED means CONTENT_IN_USE + */ + request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(false)); + logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED)); + + if (defaultQaContent == null) + { + logger.debug("Exception occured: No default content"); + request.setAttribute(USER_EXCEPTION_DEFAULTCONTENT_NOT_AVAILABLE, new Boolean(true)); + persistError(request,"error.defaultContent.notAvailable"); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm); + qaAuthoringForm.setUsernameVisible(OFF); + logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible()); + qaAuthoringForm.setQuestionsSequenced(OFF); + qaAuthoringForm.setSynchInMonitor(OFF); + + mapQuestionContent.clear(); + /** + * place the default question as the first entry in the Map + */ + mapQuestionContent.put(INITIAL_QUESTION_COUNT,request.getSession().getAttribute(DEFAULT_QUESTION_CONTENT)); + logger.debug("Map initialized with default contentid to: " + mapQuestionContent); + + /** set uploaded offline file names to empty list*/ + List listOfflineFileNames=new LinkedList(); + + /** set uploaded online file names to empty list*/ + List listOnlineFileNames=new LinkedList(); + + } + else + { + /** + * fetch the existing content from db, user will be presented with her previously created content data + * Note that the content might have been LOCKED(content in use) if one or more learner has started activities with this content + */ + logger.debug("getting existing content with id:" + toolContentId); + QaContent defaultQaContent = qaService.retrieveQa(toolContentId); + logger.debug("defaultQaContent: " + defaultQaContent); + + boolean studentActivity=qaService.studentActivityOccurredGlobal(defaultQaContent); + logger.debug("studentActivity on content: " + studentActivity); + if (studentActivity) + { + logger.debug("forward to warning screen as the content is not allowed to be modified."); + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage("error.content.inUse")); + saveErrors(request,errors); + request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(true)); + logger.debug("forwarding to:" + LOAD); + return (mapping.findForward(LOAD)); + } + + request.getSession().setAttribute(CONTENT_LOCKED, new Boolean(isContentLocked(defaultQaContent))); + logger.debug("CONTENT_LOCKED: " + request.getSession().getAttribute(CONTENT_LOCKED)); + + QaUtils.setDefaultSessionAttributes(request, defaultQaContent, qaAuthoringForm); + + /** + * determine the status of radio boxes + */ + logger.debug("IS_USERNAME_VISIBLE: " + defaultQaContent.isUsernameVisible()); + logger.debug("set UsernameVisible to : " + defaultQaContent.isUsernameVisible()); + if (defaultQaContent.isUsernameVisible()) + qaAuthoringForm.setUsernameVisible(ON); + else + qaAuthoringForm.setUsernameVisible(OFF); + logger.debug("UsernameVisible: " + qaAuthoringForm.getUsernameVisible()); + if (defaultQaContent.isSynchInMonitor()) + qaAuthoringForm.setSynchInMonitor(ON); + else + qaAuthoringForm.setSynchInMonitor(OFF); + + if (defaultQaContent.isQuestionsSequenced()) + qaAuthoringForm.setQuestionsSequenced(ON); + else + qaAuthoringForm.setQuestionsSequenced(OFF); + + request.getSession().setAttribute(IS_USERNAME_VISIBLE_MONITORING, new Boolean(defaultQaContent.isUsernameVisible())); + request.getSession().setAttribute(IS_SYNCH_INMONITOR_MONITORING, new Boolean(defaultQaContent.isSynchInMonitor())); + request.getSession().setAttribute(IS_QUESTIONS_SEQUENCED_MONITORING,new Boolean(defaultQaContent.isQuestionsSequenced())); + request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(defaultQaContent.isDefineLater())); + request.getSession().setAttribute(REPORT_TITLE, defaultQaContent.getReportTitle()); + request.getSession().setAttribute(MONITORING_REPORT_TITLE, defaultQaContent.getMonitoringReportTitle()); + request.getSession().setAttribute(OFFLINE_INSTRUCTIONS, defaultQaContent.getOfflineInstructions()); + request.getSession().setAttribute(ONLINE_INSTRUCTIONS, defaultQaContent.getOnlineInstructions()); + request.getSession().setAttribute(RICHTEXT_OFFLINEINSTRUCTIONS, defaultQaContent.getOfflineInstructions()); + request.getSession().setAttribute(RICHTEXT_ONLINEINSTRUCTIONS, defaultQaContent.getOnlineInstructions()); + request.getSession().setAttribute(RICHTEXT_TITLE, defaultQaContent.getTitle()); + request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS, defaultQaContent.getInstructions()); + logger.debug("QaStarter set all 4 rich text properties"); + + request.getSession().setAttribute(END_LEARNING_MESSSAGE, defaultQaContent.getEndLearningMessage()); + request.getSession().setAttribute(CREATION_DATE, defaultQaContent.getCreationDate()); + + logger.debug("IS_QUESTIONS_SEQUENCED_MONITORING: " + request.getSession().getAttribute(IS_QUESTIONS_SEQUENCED_MONITORING)); + logger.debug("IS_DEFINE_LATER: " + request.getSession().getAttribute(IS_DEFINE_LATER)); + + QaUtils.populateUploadedFilesData(request, defaultQaContent); + logger.debug("populated UploadedFilesData"); + + /** + * get the existing question content + */ + logger.debug("setting existing content data from the db"); + mapQuestionContent.clear(); + Iterator queIterator=defaultQaContent.getQaQueContents().iterator(); + Long mapIndex=new Long(1); + logger.debug("mapQuestionContent: " + mapQuestionContent); + while (queIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent) queIterator.next(); + if (qaQueContent != null) + { + logger.debug("question: " + qaQueContent.getQuestion()); + mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion()); + /** + * make the first entry the default(first) one for jsp + */ + if (mapIndex.longValue() == 1) + request.getSession().setAttribute(DEFAULT_QUESTION_CONTENT, qaQueContent.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") ); + /** + * load questions page + */ + + logger.debug("START_MONITORING_SUMMARY_REQUEST: " + request.getAttribute(START_MONITORING_SUMMARY_REQUEST)); + logger.debug("RENDER_MONITORING_EDITACTIVITY: " + request.getAttribute(RENDER_MONITORING_EDITACTIVITY)); + qaAuthoringForm.resetUserAction(); + return (mapping.findForward(LOAD_QUESTIONS)); + } + + + /** + * existsContent(long toolContentId) + * @param long toolContentId + * @return boolean + * determine whether a specific toolContentId exists in the db + */ + protected boolean existsContent(long toolContentId, HttpServletRequest request) + { + /** + * retrive the service + */ + IQaService qaService =QaUtils.getToolService(request); + QaContent qaContent=qaService.loadQa(toolContentId); + if (qaContent == null) + return false; + + return true; + } + + /** + * find out if the content is locked or not. If it is a locked content, the author can not modify it. + * The idea of content being locked is, once any one learner starts using a particular content + * that content should become unmodifiable. + * @param qaContent + * @return + */ + protected boolean isContentLocked(QaContent qaContent) + { + logger.debug("is content locked: " + qaContent.isContentLocked()); + return qaContent.isContentLocked(); + } + + + public ActionForward startMonitoringSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, QaApplicationException + { + request.setAttribute(START_MONITORING_SUMMARY_REQUEST, new Boolean(true)); + return execute(mapping, form, request, response); + } + + + /** + * persists error messages to request scope + * @param request + * @param message + */ + public void persistError(HttpServletRequest request, String message) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY, new ActionMessage(message)); + logger.debug("add " + message +" to ActionMessages:"); + saveErrors(request,errors); + } +} Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AbstractQaTestCase.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AbstractQaTestCase.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AbstractQaTestCase.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,46 @@ + +package org.lamsfoundation.lams.tool.qa; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import junit.framework.TestCase; + + +/** + * @author Jacky Fang + * + */ +public abstract class AbstractQaTestCase extends TestCase +{ + protected ApplicationContext context; + protected final long TEST_LESSON_ID=1; + /** + * @param name + */ + public AbstractQaTestCase(String name) + { + super(name); + } + + /** + * @see TestCase#setUp() + */ + protected void setUp() throws Exception + { + super.setUp(); + System.out.println("AbstractQaTestCase: done with abstract super setup"); + context = new ClassPathXmlApplicationContext(getContextConfigLocation()); + System.out.println("AbstractQaTestCase: context" + context); + } + + protected abstract String[] getContextConfigLocation(); + /** + * @see TestCase#tearDown() + */ + protected void tearDown() throws Exception + { + super.tearDown(); + } + +} Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AllTests.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AllTests.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/AllTests.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,32 @@ +/* + * Created on 1/04/2005 + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package org.lamsfoundation.lams.tool.qa; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class AllTests { + + public static void main(String[] args) { + junit.textui.TestRunner.run(AllTests.suite()); + } + + public static Test suite() { + TestSuite suite = new TestSuite("QaTestSuite"); + //$JUnit-BEGIN$ + suite.addTestSuite(org.lamsfoundation.lams.tool.qa.TestQaContent.class); + + //$JUnit-END$ + return suite; + } +} \ No newline at end of file Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaDataAccessTestCase.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaDataAccessTestCase.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaDataAccessTestCase.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,145 @@ +package org.lamsfoundation.lams.tool.qa; + +import java.util.Date; +import java.util.TreeSet; + +import org.lamsfoundation.lams.test.AbstractLamsTestCase; +import org.lamsfoundation.lams.tool.qa.dao.hibernate.QaContentDAO; +import org.lamsfoundation.lams.tool.qa.dao.hibernate.QaQueContentDAO; +import org.lamsfoundation.lams.tool.qa.dao.hibernate.QaQueUsrDAO; +import org.lamsfoundation.lams.tool.qa.dao.hibernate.QaSessionDAO; +import org.lamsfoundation.lams.tool.qa.dao.hibernate.QaUsrRespDAO; + + + +/** + * @author ozgurd + */ +public class QaDataAccessTestCase extends AbstractLamsTestCase +{ + //These both refer to the same entry in the db. + protected final long TEST_EXISTING_CONTENT_ID = 10; + protected final long DEFAULT_CONTENT_ID = 10; + + protected final long TEST_NEW_CONTENT_ID = 11; + + protected final long TEST_EXISTING_SESSION_ID = 101; + protected final long TEST_NEW_SESSION_ID = 102; + + protected final long TEST_NEW_USER_ID = 700; + protected final long TEST_EXISTING_QUE_CONTENT_ID = 20; + protected final long TEST_NEW_QUE_CONTENT_ID = 23; + + protected final long TEST_NONEXISTING_CONTENT_ID=2475733396382404l; + + protected final long ONE_DAY = 60 * 60 * 1000 * 24; + + public final String NOT_ATTEMPTED = "NOT_ATTEMPTED"; + public final String INCOMPLETE = "INCOMPLETE"; + public static String COMPLETED = "COMPLETED"; + + protected QaContentDAO qaContentDAO; + protected QaSessionDAO qaSessionDAO; + protected QaQueUsrDAO qaQueUsrDAO; + protected QaQueContentDAO qaQueContentDAO; + protected QaUsrRespDAO qaUsrRespDAO; + + + protected QaSession qaSession; + protected QaQueContent qaQueContent; + + + public QaDataAccessTestCase(String name) + { + super(name); + } + + protected void setUp() throws Exception + { + super.setUp(); + qaContentDAO = (QaContentDAO) this.context.getBean("qaContentDAO"); + qaSessionDAO = (QaSessionDAO) this.context.getBean("qaSessionDAO"); + qaQueUsrDAO = (QaQueUsrDAO) this.context.getBean("qaQueUsrDAO"); + qaQueContentDAO = (QaQueContentDAO) this.context.getBean("qaQueContentDAO"); + qaUsrRespDAO = (QaUsrRespDAO) this.context.getBean("qaUsrRespDAO"); + + } + + protected String[] getContextConfigLocation() + { + System.out.println("QaDataAccessTestCase will be configured"); + return new String[] {"/org/lamsfoundation/lams/tool/qa/testqaApplicationContext.xml" }; + } + + protected String getHibernateSessionFactoryName() + { + return "qaSessionFactory"; + } + + protected void tearDown() throws Exception + { + super.tearDown(); + } + + + protected QaQueUsr getExistingUser2(String username, String fullname) + { + QaQueContent qaQueContent = qaQueContentDAO.getQaQueById(TEST_NEW_QUE_CONTENT_ID); + QaSession qaSession = qaSessionDAO.getQaSessionById(TEST_NEW_SESSION_ID); + + QaQueUsr qaQueUsr= new QaQueUsr(new Long(TEST_NEW_USER_ID), + username, + fullname, + qaQueContent, + qaSession, + new TreeSet()); + qaQueUsrDAO.createUsr(qaQueUsr); + return qaQueUsr; + } + + + protected QaQueUsr getExistingUser(String username, String fullname) + { + QaQueContent qaQueContent = qaQueContentDAO.getQaQueById(TEST_EXISTING_QUE_CONTENT_ID); + QaSession qaSession = qaSessionDAO.getQaSessionById(TEST_EXISTING_SESSION_ID); + + QaQueUsr qaQueUsr= new QaQueUsr(new Long(TEST_NEW_USER_ID), + username, + fullname, + qaQueContent, + qaSession, + new TreeSet()); + qaQueUsrDAO.createUsr(qaQueUsr); + return qaQueUsr; + } + + + protected QaUsrResp getNewResponse(String response, QaQueContent qaQueContent) + { + QaUsrResp qaUsrResp= new QaUsrResp(response, false, + new Date(System.currentTimeMillis()), + "", + qaQueContent, + getExistingUser("randomstriker","Michael Random")); + qaUsrRespDAO.createUserResponse(qaUsrResp); + return qaUsrResp; + } + + protected QaUsrResp getExistingResponse(String response) + { + QaQueContent qaQueContent = qaQueContentDAO.getQaQueById(TEST_EXISTING_QUE_CONTENT_ID); + + QaUsrResp qaUsrResp= new QaUsrResp(response, false, + new Date(System.currentTimeMillis()), + "", + qaQueContent, + getExistingUser("randomstriker","Michael Random")); + qaUsrRespDAO.createUserResponse(qaUsrResp); + return qaUsrResp; + } + + + + + +} Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaQueUsr.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaResources.properties =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaResources.properties (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaResources.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,102 @@ +# Project lams_tool_qa +#Authoring mode resources +label.authoring.qa =Questions and Answers +label.authoring.title =Title +label.authoring.instructions =Instructions + +button.basic =Basic +button.uploadFile =Upload Package +button.preview =Preview +button.advanced =Advanced +button.instructions =Instructions +button.done =Done +tool.icon.name =Q/A +button.addNewQuestion =+ +button.removeQuestion =- +button.removeAllContent =Remove Content +button.submitAllContent =Submit +button.done =Done +button.getNextQuestion =Next +button.getPreviousQuestion =Previous + +label.report.title =Report Title +label.monitoringReport.title =Monitoring Report Title +label.report.endLearningMessage =End of Activity Message +label.question1 =Question 1 +radiobox.defineLater =Define Later +radiobox.synchInMonitor =Sync in Monitor +radiobox.forceOffline =Force Offline +radiobox.usernameVisible =Username Visible +radiobox.questionsSequenced =Questions Sequenced +label.offlineInstructions =Offline Instructions +label.onlineInstructions =Online Instructions +option.on =ON +option.off =OFF +feedback =Please address the following issues before submit.
    +error.title =The field "Title" is mandatory.
    +error.instructions =The field "Instructions" is mandatory.
    +error.reportTitle =The field "Report Title (Advanced)" is mandatory.
    +error.defaultquestion.empty =The first question can not be empty.
    +submit.successful =The content has been created successfully.
    + +error.content.locked =The content has been locked since it is being used by one mor more learners.
    The modification of the content is not allowed. +error.content.inUse =The modification of the content is not allowed since one or more students has attempted the activity. +error.content.beingModified =The content creation is not allowed since the same content is being modified. +error.content.unstableState =The content is in an unstable state since it has been left editable while monitored.
    Please use this screen to redefine the content. +error.defaultContent.notAvailable =Tool Activity Error! Can't continue
    The the default content for the Tool Activity has not been set up. +error.defaultQuestionContent.notAvailable =Tool Activity Error! Can't continue
    The the default question content for the Tool Activity has not been set up. + +#Learning mode resources +label.learning.qa =Answers for Q/A +label.question =Question +label.answers =Answers: +button.endLearning =Finish +label.learning.user =User +label.learning.attemptTime =Attempt Date/Time +label.learning.timezone =Time-Zone +label.learning.response =Response +label.learning.forceOfflineMessage =The activity Q/A is setup to be carried out offline. Plase see your instructor. +error.defineLater =Sorry, this activity's content is not ready yet.
    Please wait for your teacher to make the content ready. +error.toolSessionId.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a toolSession id. +error.contentId.required =Tool Activity Error! Can't continue
    URL is not complete. The Tool Activity requires a content id. +error.authoringUser.notAvailable =Tool Activity Error! Can't continue. Tool Activity expects a user id.

    The expected format is either : TOOLURL?userId=A&toolContentId=B or TOOLURL?userId=A +error.userId.notNumeric =Tool Activity Error! Can't continue. The user id passed to the Tool Activity must be numerical. +error.userId.existing =Tool Activity Error! Can't continue. The user id passed to the Tool Activity refers to a student that has already used the activity.
    Each learner activity should be associated with a unique userId. +error.defaultContent.notSetup =Tool Activity Error! Can't continue. The default content for the tool has not been setup properly. + +#Monitoring mode resources +button.startLesson =Start Lesson +button.deleteLesson =Delete Lesson +button.contributeLesson =Contribute -> Report +button.forceComplete =Force Complete +error.synchInMonitor =The report is available only after all the students finish their activities
    Some of the students has not completed the activity yet. Those students may be forced to complete. +error.monitorReportTitle =The field "Monitor Report Title (Advanced)" is mandatory.
    +error.noStudentActivity =Sorry, the report can not be generated.
    No student has attempted the activity yet. +error.contentAndToolSession.notCompatible =Tool Activity Error! Can't continue. The content id and tool session(s) passed to the tool activity are not compatible with each other.
    The Tool Activity expects that each of the passed tool sessions refer to the same passed content id. +error.toolSessions.wrongFormat =Tool Activity Error! Can't continue. No valid tool sessions has been passed to the Tool Activity.
    The expected format is: TOOLURL?toolContentId=A&toolSessionId1=B&toolSessionId2=C&toolSessionId3=D&... +error.numberFormatException =Tool Activity Error! Can't continue. The content id and tool session id(s) passed to the Tool Activity must be numerical. +error.contentId.numberFormatException =Tool Activity Error! Can't continue. The content id passed to the Tool Activity must be numerical. +error.sessionId.numberFormatException =Tool Activity Error! Can't continue. The toolSession id passed to the Tool Activity must be numerical. +error.content.doesNotExist =Tool Activity Error! Can't continue. The content id passed to the Tool Activity does not refer to an existing content. +error.toolSessions.doesNotExist =Tool Activity Error! Can't continue. One of the toolsession ids passed to the Tool Activity does not refer to an existing tool session. +error.content.onlyContentAndNoSessions =A report can not be generated since no tool sessions has been passed to the Tool Activity. +error.tab.contentId.required =Sorry, the screen is not available. The Tool Activity requires a content id. +monitoring.feedback.instructionUpdate =The content has been updated successfully. + +group.label =Group +button.summary =Summary +button.editActivity =Edit Activity +button.stats =Stats +label.edit =Edit +label.update =Update +label.hide =Hide +label.unHide =UnHide +label.hidden =Hidden +label.stats.totalLearners =Total count of learners: +label.stats.allGroups =All Groups: +label.stats.totalAllGroups =Total count of all learners: + +#=========================Error Messages===========================# +error.system.qa=A system exception has occured. Please contact Lams International technical support at 95806666. The error to report is\:
    {0}
    + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaSession.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUploadedFile.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/QaUsrResp.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaContent.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaContent.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaContent.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,185 @@ +/* ******************************************************************************** + * Copyright Notice + * ================= + * This file contains propriety information of LAMS Foundation. + * Copying or reproduction with prior written permission is prohibited. + * Copyright (c) 2004 + * Created on 2004-12-23 + ******************************************************************************** */ + +package org.lamsfoundation.lams.tool.qa; + +import java.text.DateFormat; +import java.util.Date; +import java.util.TimeZone; + +import org.lamsfoundation.lams.tool.service.ILamsToolService; + + + +/* + * + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * Test case for QaContent + */ + +public class TestQaContent extends QaDataAccessTestCase +{ + public org.lamsfoundation.lams.tool.dao.IToolDAO toolDAO; + public ILamsToolService lamsToolService; + + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + } + + public TestQaContent(String name) + { + super(name); + } + + /* + public void testCreateNewQaContent() + { + //create new qa content + QaContent qa = new QaContent(); + qa.setQaContentId(new Long(TEST_NEW_CONTENT_ID)); + qa.setTitle("New - Put Title Here"); + qa.setInstructions("New - Put instructions here."); + qa.setCreationDate(new Date(System.currentTimeMillis())); + qa.setCreatedBy(0); + qa.setUsernameVisible(false); + qa.setDefineLater(false); + qa.setSynchInMonitor(false); + qa.setOnlineInstructions("New- online instructions"); + qa.setOfflineInstructions("New- offline instructions"); + qa.setReportTitle("New-Report title"); + qa.setQaQueContents(new TreeSet()); + qa.setQaSessions(new TreeSet()); + + //create new qa que content + QaQueContent qaQueContent = new QaQueContent("What planet are you from", + 4, + qa, + new TreeSet(), + new TreeSet()); + + qa.getQaQueContents().add(qaQueContent); + + //create the new content + qaContentDAO.createQa(qa); + + + qaSession = new QaSession(new Long(TEST_NEW_SESSION_ID), + new Date(System.currentTimeMillis()), + new Date(System.currentTimeMillis()+ ONE_DAY), + this.NOT_ATTEMPTED, + qa, + new TreeSet()); + + qaSession.setQaContent(qa); + + //create new qa que response + qaQueContent.getQaUsrResps().add(getNewResponse("I am from Venus", qaQueContent)); + + //create a new session with the new content + qaSessionDAO.CreateQaSession(qaSession); + System.out.println(this.getClass().getName() + " New session created: " + qa); + } + */ + + +/* + + public void testCreateDefaultQaContent() + { + QaContent defaultQaContent = qaContentDAO.getQaById(DEFAULT_CONTENT_ID); + System.out.println(this.getClass().getName() + " Default qa content: " + defaultQaContent.getQaQueContents()); + Iterator queIterator=defaultQaContent.getQaQueContents().iterator(); + System.out.println(this.getClass().getName() + " \nqueIterator: " + queIterator); + while (queIterator.hasNext()) + { + System.out.println(this.getClass().getName() + " \nin loop"); + QaQueContent qaQueContent=(QaQueContent) queIterator.next(); + System.out.println(this.getClass().getName() + " \nquestion: " + qaQueContent.getQuestion()); + } + } + +*/ + + + /* + public void testCreateExistingQaContent() + { + QaContent defaultQaContent = qaContentDAO.getQaById(242453535L); + if (defaultQaContent == null) + { + System.out.println(this.getClass().getName() + " Default qa content: " + defaultQaContent); + } + else + { + System.out.println(this.getClass().getName() + " other content: "); + } + } + */ + + + /* + public void testIdGeneration() + { + System.out.println(this.getClass().getName() + " generated id: " + QaUtils.generateId()); + } + */ + + /* + public void testRemoveNewQaContent() + { + qaContentDAO.removeQa(new Long(TEST_NEW_CONTENT_ID)); + System.out.println("New content removed: "); + } + */ + + /* + public void testRemoveQaContent() + { + // qaQueContentDAO.removeQueContent(TEST_EXISTING_QUE_CONTENT_ID); + // System.out.println(this.getClass().getName() + " TEST_EXISTING_QUE_CONTENT_ID removed"); + + qaContentDAO.removeQa(new Long(DEFAULT_CONTENT_ID)); + System.out.println(this.getClass().getName() + " DEFAULT_CONTENT_ID removed"); + } + */ + + /* + public void testRemoveQaContent() + { + QaContent qaContent = qaContentDAO.loadQaById(TEST_NONEXISTING_CONTENT_ID); + System.out.println(this.getClass().getName() + "qaContent loaded : " + qaContent); + } + */ + + public void testTimeZone() + { + TimeZone timeZone=TimeZone.getDefault(); + System.out.println("timeZone: " + timeZone.getDisplayName()); + } + + public void testDateTime() + { + Date now = new Date(); + System.out.println("10. " + DateFormat.getDateTimeInstance( + DateFormat.LONG, DateFormat.LONG).format(now)); + } + +} \ No newline at end of file Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueContent.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueContent.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueContent.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,100 @@ +/* ******************************************************************************** + * Copyright Notice + * ================= + * This file contains propriety information of LAMS Foundation. + * Copying or reproduction with prior written permission is prohibited. + * Copyright (c) 2004 + * Created on 2004-12-23 + ******************************************************************************** */ + +package org.lamsfoundation.lams.tool.qa; +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; +/* + * + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * Test case for QaQueContent + */ + +public class TestQaQueContent extends QaDataAccessTestCase +{ + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + } + + public TestQaQueContent(String name) + { + super(name); + } + +/* + public void testCreateQaQueContent() + { + QaContent qaContent = qaContentDAO.getQaById(DEFAULT_CONTENT_ID); + System.out.println(this.getClass().getName() + "qa content: " + qaContent); + + QaQueContent qaQueContent= new QaQueContent("ozgur's new question test", + 1, + qaContent, + null, + null); + + System.out.println(this.getClass().getName() + " qaQueContent: " + qaQueContent); + qaQueContentDAO.createQueContent(qaQueContent); + System.out.println(this.getClass().getName() + " qaQueContent created: "); + } + */ + + /* + public void testCreateQaQueContentMap() + { + Map mapQuestionContent= new TreeMap(); + mapQuestionContent.put(new Long(1).toString(), "questionEntry -1"); + mapQuestionContent.put(new Long(2).toString(), "questionEntry -2"); + + QaContent qaContent = qaContentDAO.getQaById(DEFAULT_CONTENT_ID); + System.out.println(this.getClass().getName() + "qa content: " + qaContent); + + + Iterator itMap = mapQuestionContent.entrySet().iterator(); + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + + QaQueContent queContent= new QaQueContent(pairs.getValue().toString(), + new Long(pairs.getKey().toString()).intValue(), + qaContent, + null, + null); + + queContent.setQaContent(qaContent); + qaContent.getQaQueContents().add(queContent); + qaContentDAO.createQa(qaContent); + System.out.println(this.getClass().getName() + " queContent: " + queContent); + } + } + */ + public void testCreateDefaultQaQueContent() + { + QaQueContent defaultQaQueContent = qaQueContentDAO.getQaQueById(TEST_EXISTING_QUE_CONTENT_ID); + System.out.println(this.getClass().getName() + " Default qa que content: " + defaultQaQueContent); + } + + + + + +} \ No newline at end of file Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueUsr.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueUsr.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaQueUsr.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,61 @@ +/* ******************************************************************************** + * Copyright Notice + * ================= + * This file contains propriety information of LAMS Foundation. + * Copying or reproduction with prior written permission is prohibited. + * Copyright (c) 2004 + * Created on 2004-12-20 + ******************************************************************************** */ + +package org.lamsfoundation.lams.tool.qa; + +import java.util.TreeSet; + + +/** + * This test is designed to test all service provided by SurveyQueUsr domain + * class + * @author ozgurd + * + */ + +/** + * Test case for TestQaQueUsr + */ + +public class TestQaQueUsr extends QaDataAccessTestCase +{ + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + + } + + + public TestQaQueUsr(String name) + { + super(name); + } + + + public void testCreateNewUser() + { + QaQueContent qaQueContent = qaQueContentDAO.getQaQueById(TEST_EXISTING_QUE_CONTENT_ID); + QaSession qaSession = qaSessionDAO.getQaSessionById(TEST_EXISTING_SESSION_ID); + + QaQueUsr qaQueUsr= new QaQueUsr(new Long(TEST_NEW_USER_ID), + "john", + "John Baker", + qaQueContent, + qaSession, + new TreeSet()); + qaQueUsrDAO.createUsr(qaQueUsr); + } + + +} Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaSession.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaSession.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaSession.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,122 @@ +/* ******************************************************************************** + * Copyright Notice + * ================= + * This file contains propriety information of LAMS Foundation. + * Copying or reproduction with prior written permission is prohibited. + * Copyright (c) 2004 + * Created on 2004-12-23 + ******************************************************************************** */ + +package org.lamsfoundation.lams.tool.qa; + +import java.util.Iterator; +import java.util.Map; +import java.util.TreeMap; + + +/* + * + * @author ozgurd + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ + +/** + * Test case for TestQaSession + */ + +public class TestQaSession extends QaDataAccessTestCase +{ + + protected final long DEVELOPMENT_TOOL_SESSION_ID= 1160776126064221551L; + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + } + + public TestQaSession(String name) + { + super(name); + } + + protected long getTestQaContentID() + { + return this.TEST_EXISTING_CONTENT_ID; + } + + /* + public void testGetExistingSession() + { + QaContent qa = qaContentDAO.getQaById(getTestQaContentID()); + System.out.println(this.getClass().getName() + " gets: " + qa); + } + */ + + /* + public void testCreateNewSession() + { + QaContent qa = qaContentDAO.getQaById(getTestQaContentID()); + + qaSession = new QaSession(new Long(TEST_NEW_SESSION_ID), + new Date(System.currentTimeMillis()), + new Date(System.currentTimeMillis()+ ONE_DAY), + this.NOT_ATTEMPTED, + qa, + new TreeSet()); + + + qaSessionDAO.CreateQaSession(qaSession); + System.out.println(this.getClass().getName() + " New session created: " + qaSession); + + qaSessionDAO.deleteQaSession(qaSession); + System.out.println(this.getClass().getName() + " New session deleted: "); + } + */ + + public void testDevToolSession() + { + QaSession qaSession=qaSessionDAO.getQaSessionById(this.DEVELOPMENT_TOOL_SESSION_ID); + //System.out.println(this.getClass().getName() + " Retrieved session : " + qaSession); + + QaContent qaContent=qaSession.getQaContent(); + //System.out.println(this.getClass().getName() + " \nSession has content id : " + qaContent); + + Map mapQuestions= new TreeMap(new QaComparator()); + + //get iterator of questions collection + Iterator contentIterator=qaContent.getQaQueContents().iterator(); + while (contentIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent)contentIterator.next(); + System.out.println(this.getClass().getName() + "\n question : " + qaQueContent.getDisplayOrder() + " " + qaQueContent.getQuestion()); + String displayOrder= new Integer(qaQueContent.getDisplayOrder()).toString(); + mapQuestions.put(displayOrder,qaQueContent.getQuestion()); + } + System.out.println(this.getClass().getName() + "\n mapQuestions is ready" + mapQuestions); + + + Iterator itMap = mapQuestions.entrySet().iterator(); + int diplayOrder=0; + while (itMap.hasNext()) + { + Map.Entry pairs = (Map.Entry)itMap.next(); + System.out.println(this.getClass().getName() + "\n pairs.key: " + pairs.getKey()); + } + + + + + + + + + } + + +} \ No newline at end of file Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaUsrResp.java =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaUsrResp.java (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/TestQaUsrResp.java (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,58 @@ +/* ******************************************************************************** + * Copyright Notice + * ================= + * This file contains propriety information of LAMS Foundation. + * Copying or reproduction with prior written permission is prohibited. + * Copyright (c) 2004 + * Created on 2004-12-20 + ******************************************************************************** */ + +package org.lamsfoundation.lams.tool.qa; + +import java.util.Date; + + +/** + * This test is designed to test all service provided by SurveyQueUsr domain + * class + * @author ozgurd + * + */ + +/** + * Test case for TestQaUsrResp + */ + +public class TestQaUsrResp extends QaDataAccessTestCase +{ + protected void setUp() throws Exception + { + super.setUp(); + } + + protected void tearDown() throws Exception + { + super.tearDown(); + + } + + + public TestQaUsrResp(String name) + { + super(name); + } + + + public void testCreateNewResponse() + { + QaQueContent qaQueContent = qaQueContentDAO.getQaQueById(TEST_EXISTING_QUE_CONTENT_ID); + + QaUsrResp qaUsrResp= new QaUsrResp("I am from Mars",false, + new Date(System.currentTimeMillis()), + "", + qaQueContent, + getExistingUser("randomstriker","Michael Random")); + qaUsrRespDAO.createUserResponse(qaUsrResp); + } + +} Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/dbConnection.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,20 @@ +# Properties file with Hibernate-related settings. +# Applied by PropertyPlaceholderConfigurer from "dbConnection.xml". +# Targetted at system administrators, to avoid touching the context XML files. + +#jdbc configuration +jdbc.driverClassName=org.gjt.mm.mysql.Driver +jdbc.url=jdbc:mysql://localhost/lams?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true + +jdbc.username=root +jdbc.password=root + +#Hibernate configuration +hibernate.show_sql=true +hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect + +#Connection Pooling configuration +hibernate.c3p0.minPoolSize=5 +hibernate.c3p0.maxPoolSize=20 +hibernate.c3p0.timeout=1800 +hibernate.c3p0.max_statement=50 \ No newline at end of file Index: lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/testqaApplicationContext.xml =================================================================== diff -u --- lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/testqaApplicationContext.xml (revision 0) +++ lams_tool_lamc/test/java/org/lamsfoundation/lams/tool/mc/testqaApplicationContext.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,124 @@ + + + + + + + + + + + + + /org/lamsfoundation/lams/tool/qa/dbConnection.properties + + + + + + + + + ${jdbc.driverClassName} + ${jdbc.url} + ${jdbc.username} + ${jdbc.password} + + + + + + + + + /org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml + /org/lamsfoundation/lams/tool/qa/QaSession.hbm.xml + /org/lamsfoundation/lams/tool/qa/QaQueContent.hbm.xml + /org/lamsfoundation/lams/tool/qa/QaQueUsr.hbm.xml + /org/lamsfoundation/lams/tool/qa/QaUsrResp.hbm.xml + /org/lamsfoundation/lams/tool/qa/QaUploadedFile.hbm.xml + + + + + ${hibernate.dialect} + ${hibernate.show_sql} + ${hibernate.c3p0.minPoolSize} + ${hibernate.c3p0.maxPoolSize} + ${hibernate.c3p0.timeout} + ${hibernate.c3p0.max_statement} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED, -QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,readOnly,-QacpApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + + + + + + Index: lams_tool_lamc/test/web/WEB-INF/struts-config.xml =================================================================== diff -u --- lams_tool_lamc/test/web/WEB-INF/struts-config.xml (revision 0) +++ lams_tool_lamc/test/web/WEB-INF/struts-config.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/test/web/WEB-INF/tiles/tiles-defs.xml =================================================================== diff -u --- lams_tool_lamc/test/web/WEB-INF/tiles/tiles-defs.xml (revision 0) +++ lams_tool_lamc/test/web/WEB-INF/tiles/tiles-defs.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/test/web/WEB-INF/web.xml =================================================================== diff -u --- lams_tool_lamc/test/web/WEB-INF/web.xml (revision 0) +++ lams_tool_lamc/test/web/WEB-INF/web.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,161 @@ + + + + + + + javax.servlet.jsp.jstl.fmt.localizationContext + org.lamsfoundation.lams.tool.qa.QaResources + + + contextConfigLocation + + classpath:/org/lamsfoundation/lams/applicationContext.xml + classpath:/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml + classpath:/org/lamsfoundation/lams/tool/toolApplicationContext.xml + classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml + classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml + classpath:/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml + + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + + + + + + + context + org.springframework.web.context.ContextLoaderServlet + 1 + + + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts-config.xml + + + debug + 999 + + + detail + 2 + + + validate + true + + 2 + + + + Connector + com.fredck.FCKeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + + action + *.do + + + + Connector + /editor/filemanager/browser/default/connectors/jsp/connector + + + + + 120 + + + + fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + + + + + + + + + + Index: lams_tool_lamc/web/AdvancedContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/AdvancedContent.jsp (revision 0) +++ lams_tool_lamc/web/AdvancedContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,96 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + : + + + + + + + + +
    + : + + + + + + + + +
    + : + + + + + + + + +
    : + +
    : + +
    : + +
    + +
    + + + + +
    + + + +
    + + +
    + + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/BasicContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/BasicContent.jsp (revision 0) +++ lams_tool_lamc/web/BasicContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,169 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="fck-editor" prefix="FCK" %> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    : + + + +
    : + + + +
    + : + + "> +   + + + +
    : " value="" + size="50" maxlength="255"> +   + + + +
    + +
    + + + + +
    + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    : + +
    : + +
    + : + +
    : +   +
    + +
    + + + + +
    + + + +
    + +
    +
    +
    +
    + + + + \ No newline at end of file Index: lams_tool_lamc/web/CombinedAnswersContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/CombinedAnswersContent.jsp (revision 0) +++ lams_tool_lamc/web/CombinedAnswersContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,33 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + +
    Question : +
    + " size="60" maxlength="255" value=""/> +
     
    + +
    + + + + +
    + + + +
    + Index: lams_tool_lamc/web/InstructionsContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/InstructionsContent.jsp (revision 0) +++ lams_tool_lamc/web/InstructionsContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,101 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="fck-editor" prefix="FCK" %> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + : + + + + +
    + + + + + + +
    + + + +
  • +
    +
    + + + + + +
    + + + + + + +
    + + + +
  • +
    +
    +
    + + + + +
    + + + +
    + + +
    + + + + Index: lams_tool_lamc/web/META-INF/MANIFEST.MF =================================================================== diff -u --- lams_tool_lamc/web/META-INF/MANIFEST.MF (revision 0) +++ lams_tool_lamc/web/META-INF/MANIFEST.MF (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.5.3 +Created-By: 1.4.2_08-b03 (Sun Microsystems Inc.) +Class-Path: ./lams.jar ./lams-tool-laqa11.jar ./lams-contentrepository.jar ./lams-learning.jar + Index: lams_tool_lamc/web/MonitoringErrorScreen.jsp =================================================================== diff -u --- lams_tool_lamc/web/MonitoringErrorScreen.jsp (revision 0) +++ lams_tool_lamc/web/MonitoringErrorScreen.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,12 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + +
    + +
    + Index: lams_tool_lamc/web/MonitoringInstructionsScreen.jsp =================================================================== diff -u --- lams_tool_lamc/web/MonitoringInstructionsScreen.jsp (revision 0) +++ lams_tool_lamc/web/MonitoringInstructionsScreen.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,46 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + +
    + +
    +
    + + + + + +
    + +
    +
    + + + + + + + + + + + +
    + : + + +
    + : + + +
    +
    \ No newline at end of file Index: lams_tool_lamc/web/MonitoringStatsScreen.jsp =================================================================== diff -u --- lams_tool_lamc/web/MonitoringStatsScreen.jsp (revision 0) +++ lams_tool_lamc/web/MonitoringStatsScreen.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,47 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +
    + +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + +
    + : + + + +
      
    + + + +
    +
    \ No newline at end of file Index: lams_tool_lamc/web/MonitoringSummaryScreen.jsp =================================================================== diff -u --- lams_tool_lamc/web/MonitoringSummaryScreen.jsp (revision 0) +++ lams_tool_lamc/web/MonitoringSummaryScreen.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,66 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
      +
    + +
    + +
    + +
    + + Index: lams_tool_lamc/web/SequentialAnswersContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/SequentialAnswersContent.jsp (revision 0) +++ lams_tool_lamc/web/SequentialAnswersContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,66 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + +
    : +
    + + +
    + + + +
    + + + + + + + + + + + + + + +
    + + + +          + + + + + + + +          + + + + + + + +
    + + + Index: lams_tool_lamc/web/WEB-INF/QaContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaContent.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/QaQueContent.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaQueContent.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaQueContent.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/QaQueUsr.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaQueUsr.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaQueUsr.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/QaSession.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaSession.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaSession.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/QaUploadedFile.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaUploadedFile.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaUploadedFile.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/QaUsrResp.hbm.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/QaUsrResp.hbm.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/QaUsrResp.hbm.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/c-rt.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/c-rt.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/c-rt.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,393 @@ + + + + 1.0 + 1.2 + c_rt + http://java.sun.com/jstl/core_rt + JSTL core RT + JSTL 1.0 core library + + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + Provides core validation features for JSTL tags. + + + + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + Catches any Throwable that occurs in its body and optionally + exposes it. + + + var + false + false + + + + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + + + + if + org.apache.taglibs.standard.tag.rt.core.IfTag + JSP + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + + test + true + true + boolean + + + var + false + false + + + scope + false + false + + + + + import + org.apache.taglibs.standard.tag.rt.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + + url + true + true + + + var + false + false + + + scope + false + false + + + varReader + false + false + + + context + false + true + + + charEncoding + false + true + + + + + forEach + org.apache.taglibs.standard.tag.rt.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + + items + false + true + java.lang.Object + + + begin + false + true + int + + + end + false + true + int + + + step + false + true + int + + + var + false + false + + + varStatus + false + false + + + + + forTokens + org.apache.taglibs.standard.tag.rt.core.ForTokensTag + JSP + + Iterates over tokens, separated by the supplied delimeters + + + items + true + true + java.lang.String + + + delims + true + true + java.lang.String + + + begin + false + true + int + + + end + false + true + int + + + step + false + true + int + + + var + false + false + + + varStatus + false + false + + + + + out + org.apache.taglibs.standard.tag.rt.core.OutTag + JSP + + Like <%= ... >, but for expressions. + + + value + true + true + + + default + false + true + + + escapeXml + false + true + + + + + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + + + + param + org.apache.taglibs.standard.tag.rt.core.ParamTag + JSP + + Adds a parameter to a containing 'import' tag's URL. + + + name + true + true + + + value + false + true + + + + + redirect + org.apache.taglibs.standard.tag.rt.core.RedirectTag + JSP + + Redirects to a new URL. + + + var + false + false + + + scope + false + false + + + url + false + true + + + context + false + true + + + + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + Removes a scoped variable (from a particular scope, if specified). + + + var + true + false + + + scope + false + false + + + + + set + org.apache.taglibs.standard.tag.rt.core.SetTag + JSP + + Sets the result of an expression evaluation in a 'scope' + + + var + false + false + + + value + false + true + + + target + false + true + + + property + false + true + + + scope + false + false + + + + + url + org.apache.taglibs.standard.tag.rt.core.UrlTag + JSP + + Creates a URL with optional query parameters. + + + var + false + false + + + scope + false + false + + + value + false + true + + + context + false + true + + + + + when + org.apache.taglibs.standard.tag.rt.core.WhenTag + JSP + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + + test + true + true + boolean + + + + Index: lams_tool_lamc/web/WEB-INF/c.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/c.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/c.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,416 @@ + + + + 1.0 + 1.2 + c + http://java.sun.com/jstl/core + JSTL core + JSTL 1.0 core library + + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + expressionAttributes + + out:value + out:default + out:escapeXml + if:test + import:url + import:context + import:charEncoding + forEach:items + forEach:begin + forEach:end + forEach:step + forTokens:items + forTokens:begin + forTokens:end + forTokens:step + param:encode + param:name + param:value + redirect:context + redirect:url + set:property + set:target + set:value + url:context + url:value + when:test + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + Catches any Throwable that occurs in its body and optionally + exposes it. + + + var + false + false + + + + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + + + + out + org.apache.taglibs.standard.tag.el.core.OutTag + JSP + + Like <%= ... >, but for expressions. + + + value + true + false + + + default + false + false + + + escapeXml + false + false + + + + + if + org.apache.taglibs.standard.tag.el.core.IfTag + JSP + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + + test + true + false + + + var + false + false + + + scope + false + false + + + + + import + org.apache.taglibs.standard.tag.el.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + + url + true + false + + + var + false + false + + + scope + false + false + + + varReader + false + false + + + context + false + false + + + charEncoding + false + false + + + + + forEach + org.apache.taglibs.standard.tag.el.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + + items + false + false + + + begin + false + false + + + end + false + false + + + step + false + false + + + var + false + false + + + varStatus + false + false + + + + + forTokens + org.apache.taglibs.standard.tag.el.core.ForTokensTag + JSP + + Iterates over tokens, separated by the supplied delimeters + + + items + true + false + + + delims + true + false + + + begin + false + false + + + end + false + false + + + step + false + false + + + var + false + false + + + varStatus + false + false + + + + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + + + + param + org.apache.taglibs.standard.tag.el.core.ParamTag + JSP + + Adds a parameter to a containing 'import' tag's URL. + + + name + true + false + + + value + false + false + + + + + redirect + org.apache.taglibs.standard.tag.el.core.RedirectTag + JSP + + Redirects to a new URL. + + + var + false + false + + + scope + false + false + + + url + true + false + + + context + false + false + + + + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + Removes a scoped variable (from a particular scope, if specified). + + + var + true + false + + + scope + false + false + + + + + set + org.apache.taglibs.standard.tag.el.core.SetTag + JSP + + Sets the result of an expression evaluation in a 'scope' + + + var + false + false + + + value + false + false + + + target + false + false + + + property + false + false + + + scope + false + false + + + + + url + org.apache.taglibs.standard.tag.el.core.UrlTag + JSP + + Prints or exposes a URL with optional query parameters + (via the c:param tag). + + + var + false + false + + + scope + false + false + + + value + true + false + + + context + false + false + + + + + when + org.apache.taglibs.standard.tag.el.core.WhenTag + JSP + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + + test + true + false + + + + Index: lams_tool_lamc/web/WEB-INF/dbConnection.properties =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/dbConnection.properties (revision 0) +++ lams_tool_lamc/web/WEB-INF/dbConnection.properties (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,19 @@ +# Properties file with Hibernate-related settings. +# Applied by PropertyPlaceholderConfigurer from "dbConnection.xml". +# Targetted at system administrators, to avoid touching the context XML files. + +#jdbc configuration +jdbc.driverClassName=org.gjt.mm.mysql.Driver +jdbc.url=jdbc:mysql://localhost/lams +jdbc.username=lams +jdbc.password=lamsdemo + +#Hibernate configuration +hibernate.show_sql=true +hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect + +#Connection Pooling configuration +hibernate.c3p0.minPoolSize=5 +hibernate.c3p0.maxPoolSize=20 +hibernate.c3p0.timeout=1800 +hibernate.c3p0.max_statement=50 \ No newline at end of file Index: lams_tool_lamc/web/WEB-INF/fckeditor/tlds/FCKeditor.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/fckeditor/tlds/FCKeditor.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/fckeditor/tlds/FCKeditor.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,214 @@ + + + + + 2.3 + 1.1 + FCKeditor + http://fckeditor.net/tags-fckeditor + FCKeditor taglib + + editor + com.fredck.FCKeditor.tags.FCKeditorTag + JSP + + id + true + + + basePath + false + true + + + toolbarSet + false + true + + + width + false + true + + + height + false + true + + + customConfigurationsPath + false + true + + + editorAreaCSS + false + true + + + baseHref + false + true + + + skinPath + false + true + + + pluginsPath + false + true + + + fullPage + false + true + + + debug + false + true + + + autoDetectLanguage + false + true + + + defaultLanguage + false + true + + + contentLangDirection + false + true + + + enableXHTML + false + true + + + enableSourceXHTML + false + true + + + fillEmptyBlocks + false + true + + + formatSource + false + true + + + formatOutput + false + true + + + formatIndentator + false + true + + + geckoUseSPAN + false + true + + + startupFocus + false + true + + + forcePasteAsPlainText + false + true + + + forceSimpleAmpersand + false + true + + + tabSpaces + false + true + + + useBROnCarriageReturn + false + true + + + toolbarStartExpanded + false + true + + + toolbarCanCollapse + false + true + + + fontColors + false + true + + + fontNames + false + true + + + fontSizes + false + true + + + fontFormats + false + true + + + stylesXmlPath + false + true + + + linkBrowserURL + false + true + + + imageBrowserURL + false + true + + + flashBrowserURL + false + true + + + linkUploadURL + false + true + + + imageUploadURL + false + true + + + flashUploadURL + false + true + + + \ No newline at end of file Index: lams_tool_lamc/web/WEB-INF/fmt-rt.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/fmt-rt.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/fmt-rt.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,403 @@ + + + + 1.0 + 1.2 + fmt_rt + http://java.sun.com/jstl/fmt_rt + JSTL fmt RT + JSTL 1.0 i18n-capable formatting library + + + + org.apache.taglibs.standard.tlv.JstlFmtTLV + + + Provides core validation features for JSTL tags. + + + + + requestEncoding + org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag + empty + + Sets the request character encoding + + + value + false + true + + + + + setLocale + org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag + empty + + Stores the given locale in the locale configuration variable + + + value + true + true + + + variant + false + true + + + scope + false + false + + + + + timeZone + org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag + JSP + + Specifies the time zone for any time formatting or parsing actions + nested in its body + + + value + true + true + + + + + setTimeZone + org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag + empty + + Stores the given time zone in the time zone configuration variable + + + value + true + true + + + var + false + false + + + scope + false + false + + + + + bundle + org.apache.taglibs.standard.tag.rt.fmt.BundleTag + JSP + + Loads a resource bundle to be used by its tag body + + + basename + true + true + + + prefix + false + true + + + + + setBundle + org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag + empty + + Loads a resource bundle and stores it in the named scoped variable or + the bundle configuration variable + + + basename + true + true + + + var + false + false + + + scope + false + false + + + + + message + org.apache.taglibs.standard.tag.rt.fmt.MessageTag + JSP + + Maps key to localized message and performs parametric replacement + + + key + false + true + + + bundle + false + true + + + var + false + false + + + scope + false + false + + + + + param + org.apache.taglibs.standard.tag.rt.fmt.ParamTag + JSP + + Supplies an argument for parametric replacement to a containing + <message> tag + + + value + false + true + + + + + formatNumber + org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag + JSP + + Formats a numeric value as a number, currency, or percentage + + + value + false + true + + + type + false + true + + + pattern + false + true + + + currencyCode + false + true + + + currencySymbol + false + true + + + groupingUsed + false + true + + + maxIntegerDigits + false + true + + + minIntegerDigits + false + true + + + maxFractionDigits + false + true + + + minFractionDigits + false + true + + + var + false + false + + + scope + false + false + + + + + parseNumber + org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag + JSP + + Parses the string representation of a number, currency, or percentage + + + value + false + true + + + type + false + true + + + pattern + false + true + + + parseLocale + false + true + + + integerOnly + false + true + + + var + false + false + + + scope + false + false + + + + + formatDate + org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag + empty + + Formats a date and/or time using the supplied styles and pattern + + + value + true + true + + + type + false + true + + + dateStyle + false + true + + + timeStyle + false + true + + + pattern + false + true + + + timeZone + false + true + + + var + false + false + + + scope + false + false + + + + + parseDate + org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag + JSP + + Parses the string representation of a date and/or time + + + value + false + true + + + type + false + true + + + dateStyle + false + true + + + timeStyle + false + true + + + pattern + false + true + + + timeZone + false + true + + + parseLocale + false + true + + + var + false + false + + + scope + false + false + + + + Index: lams_tool_lamc/web/WEB-INF/fmt.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/fmt.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/fmt.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,442 @@ + + + + 1.0 + 1.2 + fmt + http://java.sun.com/jstl/fmt + JSTL fmt + JSTL 1.0 i18n-capable formatting library + + + + org.apache.taglibs.standard.tlv.JstlFmtTLV + + + expressionAttributes + + requestEncoding:value + setLocale:value + setLocale:variant + timeZone:value + setTimeZone:value + bundle:basename + bundle:prefix + setBundle:basename + message:key + message:bundle + param:value + formatNumber:value + formatNumber:pattern + formatNumber:currencyCode + formatNumber:currencySymbol + formatNumber:groupingUsed + formatNumber:maxIntegerDigits + formatNumber:minIntegerDigits + formatNumber:maxFractionDigits + formatNumber:minFractionDigits + parseNumber:value + parseNumber:pattern + parseNumber:parseLocale + parseNumber:integerOnly + formatDate:value + formatDate:pattern + formatDate:timeZone + parseDate:value + parseDate:pattern + parseDate:timeZone + parseDate:parseLocale + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + requestEncoding + org.apache.taglibs.standard.tag.el.fmt.RequestEncodingTag + empty + + Sets the request character encoding + + + value + false + false + + + + + setLocale + org.apache.taglibs.standard.tag.el.fmt.SetLocaleTag + empty + + Stores the given locale in the locale configuration variable + + + value + true + false + + + variant + false + false + + + scope + false + false + + + + + timeZone + org.apache.taglibs.standard.tag.el.fmt.TimeZoneTag + JSP + + Specifies the time zone for any time formatting or parsing actions + nested in its body + + + value + true + false + + + + + setTimeZone + org.apache.taglibs.standard.tag.el.fmt.SetTimeZoneTag + empty + + Stores the given time zone in the time zone configuration variable + + + value + true + false + + + var + false + false + + + scope + false + false + + + + + bundle + org.apache.taglibs.standard.tag.el.fmt.BundleTag + JSP + + Loads a resource bundle to be used by its tag body + + + basename + true + false + + + prefix + false + false + + + + + setBundle + org.apache.taglibs.standard.tag.el.fmt.SetBundleTag + empty + + Loads a resource bundle and stores it in the named scoped variable or + the bundle configuration variable + + + basename + true + false + + + var + false + false + + + scope + false + false + + + + + message + org.apache.taglibs.standard.tag.el.fmt.MessageTag + JSP + + Maps key to localized message and performs parametric replacement + + + key + false + false + + + bundle + false + false + + + var + false + false + + + scope + false + false + + + + + param + org.apache.taglibs.standard.tag.el.fmt.ParamTag + JSP + + Supplies an argument for parametric replacement to a containing + <message> tag + + + value + false + false + + + + + formatNumber + org.apache.taglibs.standard.tag.el.fmt.FormatNumberTag + JSP + + Formats a numeric value as a number, currency, or percentage + + + value + false + false + + + type + false + false + + + pattern + false + false + + + currencyCode + false + false + + + currencySymbol + false + false + + + groupingUsed + false + false + + + maxIntegerDigits + false + false + + + minIntegerDigits + false + false + + + maxFractionDigits + false + false + + + minFractionDigits + false + false + + + var + false + false + + + scope + false + false + + + + + parseNumber + org.apache.taglibs.standard.tag.el.fmt.ParseNumberTag + JSP + + Parses the string representation of a number, currency, or percentage + + + value + false + false + + + type + false + false + + + pattern + false + false + + + parseLocale + false + false + + + integerOnly + false + false + + + var + false + false + + + scope + false + false + + + + + formatDate + org.apache.taglibs.standard.tag.el.fmt.FormatDateTag + empty + + Formats a date and/or time using the supplied styles and pattern + + + value + true + false + + + type + false + false + + + dateStyle + false + false + + + timeStyle + false + false + + + pattern + false + false + + + timeZone + false + false + + + var + false + false + + + scope + false + false + + + + + parseDate + org.apache.taglibs.standard.tag.el.fmt.ParseDateTag + JSP + + Parses the string representation of a date and/or time + + + value + false + false + + + type + false + false + + + dateStyle + false + false + + + timeStyle + false + false + + + pattern + false + false + + + timeZone + false + false + + + parseLocale + false + false + + + var + false + false + + + scope + false + false + + + + Index: lams_tool_lamc/web/WEB-INF/qaApplicationContext.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/qaApplicationContext.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/qaApplicationContext.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,123 @@ + + + + + + + + + + + + + /WEB-INF/dbConnection.properties + + + + + + + + ${jdbc.driverClassName} + ${jdbc.url} + ${jdbc.username} + ${jdbc.password} + + + + + + + + + /WEB-INF/QaContent.hbm.xml + /WEB-INF/QaSession.hbm.xml + /WEB-INF/QaQueContent.hbm.xml + /WEB-INF/QaQueUsr.hbm.xml + /WEB-INF/QaUsrResp.hbm.xml + /WEB-INF/QaUploadedFile.hbm.xml + + + + + ${hibernate.dialect} + ${hibernate.show_sql} + ${hibernate.c3p0.minPoolSize} + ${hibernate.c3p0.maxPoolSize} + ${hibernate.c3p0.timeout} + ${hibernate.c3p0.max_statement} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED, -QaApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + PROPAGATION_REQUIRED,readOnly,-QacpApplicationException + PROPAGATION_REQUIRED,-QaApplicationException + + + + + + Index: lams_tool_lamc/web/WEB-INF/sql-rt.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/sql-rt.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/sql-rt.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,188 @@ + + + + 1.0 + 1.2 + sql_rt + http://java.sun.com/jstl/sql_rt + JSTL sql RT + JSTL 1.0 sql library + + + + org.apache.taglibs.standard.tlv.JstlSqlTLV + + + Provides core validation features for JSTL tags. + + + + + transaction + org.apache.taglibs.standard.tag.rt.sql.TransactionTag + JSP + + Provides nested database action elements with a shared Connection, + set up to execute all statements as one transaction. + + + dataSource + false + true + + + isolation + false + true + + + + + query + org.apache.taglibs.standard.tag.rt.sql.QueryTag + JSP + + Executes the SQL query defined in its body or through the + sql attribute. + + + var + true + false + + + scope + false + false + + + sql + false + true + + + dataSource + false + true + + + startRow + false + true + + + maxRows + false + true + + + + + update + org.apache.taglibs.standard.tag.rt.sql.UpdateTag + JSP + + Executes the SQL update defined in its body or through the + sql attribute. + + + var + false + false + + + scope + false + false + + + sql + false + true + + + dataSource + false + true + + + + + param + org.apache.taglibs.standard.tag.rt.sql.ParamTag + JSP + + Sets a parameter in an SQL statement to the specified value. + + + value + false + true + + + + + dateParam + org.apache.taglibs.standard.tag.rt.sql.DateParamTag + empty + + Sets a parameter in an SQL statement to the specified java.util.Date value. + + + value + true + true + + + type + false + true + + + + + setDataSource + org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag + empty + + Creates a simple DataSource suitable only for prototyping. + + + var + false + false + + + scope + false + false + + + dataSource + false + true + + + driver + false + true + + + url + false + true + + + user + false + true + + + password + false + true + + + Index: lams_tool_lamc/web/WEB-INF/sql.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/sql.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/sql.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,213 @@ + + + + 1.0 + 1.2 + sql + http://java.sun.com/jstl/sql + JSTL sql + JSTL 1.0 sql library + + + + org.apache.taglibs.standard.tlv.JstlSqlTLV + + + expressionAttributes + + transaction:dataSource + transaction:isolation + query:sql + query:dataSource + query:startRow + query:maxRows + update:sql + update:dataSource + param:value + dateParam:value + dateParam:type + setDataSource:dataSource + setDataSource:driver + setDataSource:url + setDataSource:user + setDataSource:password + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + transaction + org.apache.taglibs.standard.tag.el.sql.TransactionTag + JSP + + Provides nested database action elements with a shared Connection, + set up to execute all statements as one transaction. + + + dataSource + false + false + + + isolation + false + false + + + + + query + org.apache.taglibs.standard.tag.el.sql.QueryTag + JSP + + Executes the SQL query defined in its body or through the + sql attribute. + + + var + true + false + + + scope + false + false + + + sql + false + false + + + dataSource + false + false + + + startRow + false + false + + + maxRows + false + false + + + + + update + org.apache.taglibs.standard.tag.el.sql.UpdateTag + JSP + + Executes the SQL update defined in its body or through the + sql attribute. + + + var + false + false + + + scope + false + false + + + sql + false + false + + + dataSource + false + false + + + + + param + org.apache.taglibs.standard.tag.el.sql.ParamTag + JSP + + Sets a parameter in an SQL statement to the specified value. + + + value + false + false + + + + + dateParam + org.apache.taglibs.standard.tag.el.sql.DateParamTag + empty + + Sets a parameter in an SQL statement to the specified java.util.Date val +ue. + + + value + true + true + + + type + false + true + + + + + setDataSource + org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag + empty + + Creates a simple DataSource suitable only for prototyping. + + + var + false + false + + + scope + false + false + + + dataSource + false + false + + + driver + false + false + + + url + false + false + + + user + false + false + + + password + false + false + + + Index: lams_tool_lamc/web/WEB-INF/struts-bean-el.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-bean-el.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-bean-el.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,212 @@ + + + + + + + + + + +1.2 +1.1 +bean +http://struts.apache.org/tags-bean-el + +include +org.apache.strutsel.taglib.bean.ELIncludeTag +org.apache.struts.taglib.bean.IncludeTei +empty + +anchor +false +true + + +forward +false +true + + +href +false +true + + +id +true +false + + +name +false +true + + +page +false +true + + +transaction +false +true + + + +message +org.apache.strutsel.taglib.bean.ELMessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +page +org.apache.strutsel.taglib.bean.ELPageTag +empty + +id +true +false + + +property +true +true + + + +resource +org.apache.strutsel.taglib.bean.ELResourceTag +org.apache.struts.taglib.bean.ResourceTei +empty + +id +true +false + + +input +false +true + + +name +true +true + + + +size +org.apache.strutsel.taglib.bean.ELSizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + + +struts +org.apache.strutsel.taglib.bean.ELStrutsTag +org.apache.struts.taglib.bean.StrutsTei +empty + +id +true +false + + +formBean +false +true + + +forward +false +true + + +mapping +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-bean.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-bean.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-bean.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,382 @@ + + + + + + + + + + +1.2 +1.1 +bean +http://struts.apache.org/tags-bean + +cookie +org.apache.struts.taglib.bean.CookieTag +org.apache.struts.taglib.bean.CookieTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +define +org.apache.struts.taglib.bean.DefineTag +org.apache.struts.taglib.bean.DefineTei +JSP + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +header +org.apache.struts.taglib.bean.HeaderTag +org.apache.struts.taglib.bean.HeaderTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +include +org.apache.struts.taglib.bean.IncludeTag +org.apache.struts.taglib.bean.IncludeTei +empty + +anchor +false +true + + +forward +false +true + + +href +false +true + + +id +true +false + + +name +false +true + + +page +false +true + + +transaction +false +true + + + +message +org.apache.struts.taglib.bean.MessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +page +org.apache.struts.taglib.bean.PageTag +org.apache.struts.taglib.bean.PageTei +empty + +id +true +false + + +property +true +true + + + +parameter +org.apache.struts.taglib.bean.ParameterTag +org.apache.struts.taglib.bean.ParameterTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +resource +org.apache.struts.taglib.bean.ResourceTag +org.apache.struts.taglib.bean.ResourceTei +empty + +id +true +false + + +input +false +true + + +name +true +true + + + +size +org.apache.struts.taglib.bean.SizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + + +struts +org.apache.struts.taglib.bean.StrutsTag +org.apache.struts.taglib.bean.StrutsTei +empty + +id +true +false + + +formBean +false +true + + +forward +false +true + + +mapping +false +true + + + +write +org.apache.struts.taglib.bean.WriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +true +true + + +property +false +true + + +scope +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-config.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-config.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-html-el.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-html-el.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-html-el.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3302 @@ + + + + + + + + + + +1.2 +1.1 +html +http://struts.apache.org/tags-html-el + +base +org.apache.strutsel.taglib.html.ELBaseTag +empty + +target +false +true + + +server +false +true + + + +button +org.apache.strutsel.taglib.html.ELButtonTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +cancel +org.apache.strutsel.taglib.html.ELCancelTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +checkbox +org.apache.strutsel.taglib.html.ELCheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.strutsel.taglib.html.ELErrorsTag +empty + +bundle +false +true + + +footer +false +true + + +header +false +true + + +locale +false +true + + +name +false +true + + +prefix +false +true + + +property +false +true + + +suffix +false +true + + + +file +org.apache.strutsel.taglib.html.ELFileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.strutsel.taglib.html.ELFormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +disabled +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +readonly +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +frame +org.apache.strutsel.taglib.html.ELFrameTag + +bundle +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +frameborder +false +true + + +frameName +false +true + + +href +false +true + + +longdesc +false +true + + +marginheight +false +true + + +marginwidth +false +true + + +name +false +true + + +noresize +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +scrolling +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + + +hidden +org.apache.strutsel.taglib.html.ELHiddenTag +empty + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + +write +false +true + + + +html +org.apache.strutsel.taglib.html.ELHtmlTag +JSP + +lang +false +true + + +locale +false +true + + +xhtml +false +true + + + +image +org.apache.strutsel.taglib.html.ELImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.strutsel.taglib.html.ELImgTag +empty + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +contextRelative +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +javascript +org.apache.strutsel.taglib.html.ELJavascriptValidatorTag +empty + +cdata +false +true + + +dynamicJavascript +false +false + + +formName +false +true + + +method +false +true + + +page +false +true + + +scriptLanguage +false +true + + +src +false +true + + +staticJavascript +false +false + + +htmlComment +false +true + + +bundle +false +true + + + +link +org.apache.strutsel.taglib.html.ELLinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +bundle +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.strutsel.taglib.html.ELMessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +false + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.strutsel.taglib.html.ELMultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +option +org.apache.strutsel.taglib.html.ELOptionTag + +bundle +false +true + + +disabled +false +true + + +key +false +true + + +locale +false +true + + +style +false +true + + +styleId +false +true + + +styleClass +false +true + + +value +true +true + + + +options +org.apache.strutsel.taglib.html.ELOptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.strutsel.taglib.html.ELOptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.strutsel.taglib.html.ELPasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.strutsel.taglib.html.ELRadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +reset +org.apache.strutsel.taglib.html.ELResetTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +rewrite +org.apache.strutsel.taglib.html.ELRewriteTag +empty + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +select +org.apache.strutsel.taglib.html.ELSelectTag +JSP + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.strutsel.taglib.html.ELSubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.strutsel.taglib.html.ELTextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.strutsel.taglib.html.ELTextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +cols +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +xhtml +org.apache.struts.taglib.html.XhtmlTag +empty + + + Index: lams_tool_lamc/web/WEB-INF/struts-html.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-html.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-html.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3302 @@ + + + + + + + + + + +1.2 +1.1 +html +http://struts.apache.org/tags-html + +base +org.apache.struts.taglib.html.BaseTag +empty + +target +false +true + + +server +false +true + + + +button +org.apache.struts.taglib.html.ButtonTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +cancel +org.apache.struts.taglib.html.CancelTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +checkbox +org.apache.struts.taglib.html.CheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.html.ErrorsTag +empty + +bundle +false +true + + +footer +false +true + + +header +false +true + + +locale +false +true + + +name +false +true + + +prefix +false +true + + +property +false +true + + +suffix +false +true + + + +file +org.apache.struts.taglib.html.FileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.html.FormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +disabled +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +readonly +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +frame +org.apache.struts.taglib.html.FrameTag + +bundle +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +frameborder +false +true + + +frameName +false +true + + +href +false +true + + +longdesc +false +true + + +marginheight +false +true + + +marginwidth +false +true + + +name +false +true + + +noresize +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +scrolling +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + + +hidden +org.apache.struts.taglib.html.HiddenTag +empty + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + +write +false +true + + + +html +org.apache.struts.taglib.html.HtmlTag +JSP + +lang +false +true + + +locale +false +true + + +xhtml +false +true + + + +image +org.apache.struts.taglib.html.ImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.html.ImgTag +empty + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +contextRelative +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +javascript +org.apache.struts.taglib.html.JavascriptValidatorTag +empty + +cdata +false +true + + +dynamicJavascript +false +false + + +formName +false +true + + +method +false +true + + +page +false +true + + +scriptLanguage +false +true + + +src +false +true + + +staticJavascript +false +false + + +htmlComment +false +true + + +bundle +false +true + + + +link +org.apache.struts.taglib.html.LinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +bundle +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.struts.taglib.html.MessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +false + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.html.MultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +option +org.apache.struts.taglib.html.OptionTag + +bundle +false +true + + +disabled +false +true + + +key +false +true + + +locale +false +true + + +style +false +true + + +styleId +false +true + + +styleClass +false +true + + +value +true +true + + + +options +org.apache.struts.taglib.html.OptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.html.OptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.html.PasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.html.RadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +reset +org.apache.struts.taglib.html.ResetTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +rewrite +org.apache.struts.taglib.html.RewriteTag +empty + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +select +org.apache.struts.taglib.html.SelectTag +JSP + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.html.SubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.html.TextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.html.TextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +cols +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +xhtml +org.apache.struts.taglib.html.XhtmlTag +empty + + + Index: lams_tool_lamc/web/WEB-INF/struts-logic-el.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-logic-el.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-logic-el.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,382 @@ + + + + + + + + + +1.2 +1.1 +logic +http://struts.apache.org/tags-logic-el + +forward +org.apache.strutsel.taglib.logic.ELForwardTag +empty + +name +true +true + + + +iterate +org.apache.strutsel.taglib.logic.ELIterateTag +org.apache.struts.taglib.logic.IterateTei +JSP + +collection +false +true + + +id +true +false + + +indexId +false +false + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +match +org.apache.strutsel.taglib.logic.ELMatchTag +JSP + +cookie +false +true + + +expr +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.strutsel.taglib.logic.ELMessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.strutsel.taglib.logic.ELMessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notMatch +org.apache.strutsel.taglib.logic.ELNotMatchTag +JSP + +cookie +false +true + + +expr +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.strutsel.taglib.logic.ELNotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.strutsel.taglib.logic.ELPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +redirect +org.apache.strutsel.taglib.logic.ELRedirectTag + +action +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-logic.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-logic.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-logic.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,652 @@ + + + + + + + + + +1.2 +1.1 +logic +http://struts.apache.org/tags-logic + +empty +org.apache.struts.taglib.logic.EmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.logic.EqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +forward +org.apache.struts.taglib.logic.ForwardTag +empty + +name +true +true + + + +greaterEqual +org.apache.struts.taglib.logic.GreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.logic.GreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.logic.IterateTag +org.apache.struts.taglib.logic.IterateTei +JSP + +collection +false +true + + +id +true +false + + +indexId +false +false + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.logic.LessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.logic.LessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.logic.MatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.logic.MessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.logic.MessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.logic.NotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.logic.NotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.logic.NotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.logic.NotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.logic.PresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +redirect +org.apache.struts.taglib.logic.RedirectTag + +action +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-nested.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-nested.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-nested.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3171 @@ + + + + + + + + + +1.2 +1.1 +nested +http://struts.apache.org/tags-nested + +nest +org.apache.struts.taglib.nested.NestedPropertyTag +JSP + +property +false +true + + + +writeNesting +org.apache.struts.taglib.nested.NestedWriteNestingTag +org.apache.struts.taglib.nested.NestedWriteNestingTei +JSP + +property +false +true + + +id +false +true + + +filter +false +true + + + +root +org.apache.struts.taglib.nested.NestedRootTag +JSP + +name +false +true + + + +define +org.apache.struts.taglib.nested.bean.NestedDefineTag +org.apache.struts.taglib.nested.bean.NestedDefineTei +empty + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +message +org.apache.struts.taglib.nested.bean.NestedMessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +size +org.apache.struts.taglib.nested.bean.NestedSizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +write +org.apache.struts.taglib.nested.bean.NestedWriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +checkbox +org.apache.struts.taglib.nested.html.NestedCheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.nested.html.NestedErrorsTag +empty + +bundle +false +true + + +footer +false +true + + +header +false +true + + +locale +false +true + + +name +false +true + + +prefix +false +true + + +property +false +true + + +suffix +false +true + + + +file +org.apache.struts.taglib.nested.html.NestedFileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.nested.html.NestedFormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +disabled +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +readonly +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +hidden +org.apache.struts.taglib.nested.html.NestedHiddenTag + +alt +false +true + + +altKey +false +true + + +indexed +false +true + + +name +false +true + + +property +true +true + + +title +false +true + + +titleKey +false +true + + +styleClass +false +true + + +styleId +false +true + + +value +false +true + + +write +false +true + + + +image +org.apache.struts.taglib.nested.html.NestedImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.nested.html.NestedImgTag +empty + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +link +org.apache.struts.taglib.nested.html.NestedLinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +bundle +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.struts.taglib.nested.html.NestedMessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +true + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.nested.html.NestedMultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +options +org.apache.struts.taglib.nested.html.NestedOptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.nested.html.NestedOptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.nested.html.NestedPasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.nested.html.NestedRadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +select +org.apache.struts.taglib.nested.html.NestedSelectTag +JSP + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.nested.html.NestedSubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.nested.html.NestedTextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.nested.html.NestedTextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +cols +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +empty +org.apache.struts.taglib.nested.logic.NestedEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.nested.logic.NestedEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterEqual +org.apache.struts.taglib.nested.logic.NestedGreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.nested.logic.NestedGreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.nested.logic.NestedIterateTag +org.apache.struts.taglib.nested.logic.NestedIterateTei +JSP + +collection +false +true + + +id +false +true + + +indexId +false +true + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.nested.logic.NestedLessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.nested.logic.NestedLessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.nested.logic.NestedMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.nested.logic.NestedMessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.nested.logic.NestedMessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.nested.logic.NestedNotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.nested.logic.NestedNotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.nested.logic.NestedNotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.nested.logic.NestedNotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.nested.logic.NestedPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-template.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-template.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-template.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,73 @@ + + + + + + + + + + +1.0 +1.1 +template +http://jakarta.apache.org/struts/tags-template + +insert +org.apache.struts.taglib.template.InsertTag +JSP + +template +true +true + + + +put +org.apache.struts.taglib.template.PutTag +JSP + +name +true +true + + +role +false +true + + +content +false +true + + +direct +false +true + + + +get +org.apache.struts.taglib.template.GetTag +empty + +flush +false +true + + +name +true +true + + +role +false +true + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-tiles-el.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-tiles-el.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-tiles-el.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,343 @@ + + + + + + + + + + +1.2 +1.1 +tiles +http://struts.apache.org/tags-tiles-el + +insert +org.apache.strutsel.taglib.tiles.ELInsertTag +JSP + +template +false +true + + +component +false +true + + +page +false +true + + +definition +false +true + + +attribute +false +false + + +name +false +true + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +flush +false +false + + +ignore +false +true + + +role +false +true + + +controllerUrl +false +true + + +controllerClass +false +true + + + +definition +org.apache.strutsel.taglib.tiles.ELDefinitionTag +JSP + +id +true +false + + +scope +false +false + + +template +false +true + + +page +false +true + + +role +false +true + + +extends +false +true + + + +put +org.apache.strutsel.taglib.tiles.ELPutTag +JSP + +name +false +false + + +value +false +true + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +putList +org.apache.strutsel.taglib.tiles.ELPutListTag +JSP + +name +true +false + + + +add +org.apache.strutsel.taglib.tiles.ELAddTag +JSP + +value +false +false + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +get +org.apache.strutsel.taglib.tiles.ELGetTag +empty + +name +true +true + + +ignore +false +true + + +flush +false +false + + +role +false +true + + + +getAsString +org.apache.strutsel.taglib.tiles.ELGetAttributeTag +empty + +name +true +true + + +ignore +false +true + + +role +false +true + + + +useAttribute +org.apache.strutsel.taglib.tiles.ELUseAttributeTag +empty + +id +false +false + + +classname +false +false + + +scope +false +false + + +name +true +true + + +ignore +false +true + + + +importAttribute +org.apache.strutsel.taglib.tiles.ELImportAttributeTag +empty + +name +false +true + + +scope +false +false + + +ignore +false +true + + + +initComponentDefinitions +org.apache.strutsel.taglib.tiles.ELInitDefinitionsTag +empty + +file +true +false + + +classname +false +false + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts-tiles.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts-tiles.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts-tiles.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,344 @@ + + + + + + + + + + +1.2 +1.1 +tiles +http://struts.apache.org/tags-tiles + +insert +org.apache.struts.taglib.tiles.InsertTag +JSP + +template +false +true + + +component +false +true + + +page +false +true + + +definition +false +true + + +attribute +false +false + + +name +false +true + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +flush +false +false + + +ignore +false +true + + +role +false +true + + +controllerUrl +false +true + + +controllerClass +false +true + + + +definition +org.apache.struts.taglib.tiles.DefinitionTag +JSP + +id +true +false + + +scope +false +false + + +template +false +true + + +page +false +true + + +role +false +true + + +extends +false +true + + + +put +org.apache.struts.taglib.tiles.PutTag +JSP + +name +false +false + + +value +false +true + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +putList +org.apache.struts.taglib.tiles.PutListTag +JSP + +name +true +false + + + +add +org.apache.struts.taglib.tiles.AddTag +JSP + +value +false +false + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +get +org.apache.struts.taglib.tiles.GetTag +empty + +name +true +true + + +ignore +false +true + + +flush +false +false + + +role +false +true + + + +getAsString +org.apache.struts.taglib.tiles.GetAttributeTag +empty + +name +true +true + + +ignore +false +true + + +role +false +true + + + +useAttribute +org.apache.struts.taglib.tiles.UseAttributeTag +org.apache.struts.taglib.tiles.UseAttributeTei +empty + +id +false +false + + +classname +false +false + + +scope +false +false + + +name +true +true + + +ignore +false +true + + + +importAttribute +org.apache.struts.taglib.tiles.ImportAttributeTag +empty + +name +false +true + + +scope +false +false + + +ignore +false +true + + + +initComponentDefinitions +org.apache.struts.taglib.tiles.InitDefinitionsTag +empty + +file +true +false + + +classname +false +false + + + + + + Index: lams_tool_lamc/web/WEB-INF/struts/struts-config.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/struts/struts-config.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/struts/struts-config.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/tiles/tiles-defs.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/tiles/tiles-defs.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/tiles/tiles-defs.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/WEB-INF/web.xml =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/web.xml (revision 0) +++ lams_tool_lamc/web/WEB-INF/web.xml (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,196 @@ + + + + + + + javax.servlet.jsp.jstl.fmt.localizationContext + org.lamsfoundation.lams.tool.qa.QaResources + + + contextConfigLocation + + classpath:/org/lamsfoundation/lams/applicationContext.xml + classpath:/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml + classpath:/org/lamsfoundation/lams/tool/toolApplicationContext.xml + classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml + classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml + classpath:/org/lamsfoundation/lams/tool/qa/qaApplicationContext.xml + + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + SystemSessionFilter + + org.lamsfoundation.lams.web.session.SystemSessionFilter + + + + + SystemSessionFilter + /* + + + + + exportPortfolio + Export Portfolio + Export Portfolio + org.lamsfoundation.lams.tool.qa.web.QaExportServlet + + + + exportPortfolio + /portfolioExport + + + + + + + + + + + context + org.springframework.web.context.ContextLoaderServlet + 1 + + + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts-config.xml + + + debug + 999 + + + detail + 2 + + + validate + true + + 2 + + + + Connector + com.fredck.FCKeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + + action + *.do + + + + Connector + /editor/filemanager/browser/default/connectors/jsp/connector + + + + + 120 + + + + fck-editor + /WEB-INF/fckeditor/tlds/FCKeditor.tld + + + + + + + + + + + Index: lams_tool_lamc/web/WEB-INF/x-rt.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/x-rt.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/x-rt.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,256 @@ + + + + 1.0 + 1.2 + x_rt + http://java.sun.com/jstl/xml_rt + JSTL XML RT + JSTL 1.0 XML library + + + + org.apache.taglibs.standard.tlv.JstlXmlTLV + + + Provides validation features for JSTL XML tags. + + + + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + + + + out + org.apache.taglibs.standard.tag.rt.xml.ExprTag + empty + + Like <%= ... >, but for XPath expressions. + + + select + true + false + + + escapeXml + false + true + + + + + if + org.apache.taglibs.standard.tag.common.xml.IfTag + JSP + + XML conditional tag, which evalutes its body if the + supplied XPath expression evalutes to 'true' as a boolean + + + select + true + false + + + var + false + false + + + scope + false + false + + + + + forEach + org.apache.taglibs.standard.tag.common.xml.ForEachTag + JSP + + XML iteration tag. + + + var + false + false + + + select + true + false + + + + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + + + + param + org.apache.taglibs.standard.tag.rt.xml.ParamTag + JSP + + Adds a parameter to a containing 'transform' tag's Transformer + + + name + true + true + + + value + false + true + + + + + parse + org.apache.taglibs.standard.tag.rt.xml.ParseTag + org.apache.taglibs.standard.tei.XmlParseTEI + JSP + + Parses XML content from 'source' attribute or 'body' + + + var + false + false + + + varDom + false + false + + + scope + false + false + + + scopeDom + false + false + + + xml + false + true + + + systemId + false + true + + + filter + false + true + + + + + set + org.apache.taglibs.standard.tag.common.xml.SetTag + empty + + Saves the result of an XPath expression evaluation in a 'scope' + + + var + true + false + + + select + false + false + + + scope + false + false + + + + + transform + org.apache.taglibs.standard.tag.rt.xml.TransformTag + org.apache.taglibs.standard.tei.XmlTransformTEI + JSP + + Conducts a transformation given a source XML document + and an XSLT stylesheet + + + var + false + false + + + scope + false + false + + + result + false + true + + + xml + false + true + + + xmlSystemId + false + true + + + xslt + false + true + + + xsltSystemId + false + true + + + + + when + org.apache.taglibs.standard.tag.common.xml.WhenTag + JSP + + Subtag of <choose> that includes its body if its + expression evalutes to 'true' + + + select + true + false + + + + Index: lams_tool_lamc/web/WEB-INF/x.tld =================================================================== diff -u --- lams_tool_lamc/web/WEB-INF/x.tld (revision 0) +++ lams_tool_lamc/web/WEB-INF/x.tld (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,273 @@ + + + + 1.0 + 1.2 + x + http://java.sun.com/jstl/xml + JSTL XML + JSTL 1.0 XML library + + + + org.apache.taglibs.standard.tlv.JstlXmlTLV + + + expressionAttributes + + out:escapeXml + parse:xml + parse:systemId + parse:filter + transform:xml + transform:xmlSystemId + transform:xslt + transform:xsltSystemId + transform:result + + + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + + + + + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + + + + out + org.apache.taglibs.standard.tag.el.xml.ExprTag + empty + + Like <%= ... >, but for XPath expressions. + + + select + true + false + + + escapeXml + false + false + + + + + if + org.apache.taglibs.standard.tag.common.xml.IfTag + JSP + + XML conditional tag, which evalutes its body if the + supplied XPath expression evalutes to 'true' as a boolean + + + select + true + false + + + var + false + false + + + scope + false + false + + + + + forEach + org.apache.taglibs.standard.tag.common.xml.ForEachTag + JSP + + XML iteration tag. + + + var + false + false + + + select + true + false + + + + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + + + + param + org.apache.taglibs.standard.tag.el.xml.ParamTag + JSP + + Adds a parameter to a containing 'transform' tag's Transformer + + + name + true + false + + + value + false + false + + + + + parse + org.apache.taglibs.standard.tag.el.xml.ParseTag + org.apache.taglibs.standard.tei.XmlParseTEI + JSP + + Parses XML content from 'source' attribute or 'body' + + + var + false + false + + + varDom + false + false + + + scope + false + false + + + scopeDom + false + false + + + xml + false + false + + + systemId + false + false + + + filter + false + false + + + + + set + org.apache.taglibs.standard.tag.common.xml.SetTag + empty + + Saves the result of an XPath expression evaluation in a 'scope' + + + var + true + false + + + select + false + false + + + scope + false + false + + + + + transform + org.apache.taglibs.standard.tag.el.xml.TransformTag + org.apache.taglibs.standard.tei.XmlTransformTEI + JSP + + Conducts a transformation given a source XML document + and an XSLT stylesheet + + + var + false + false + + + scope + false + false + + + result + false + false + + + xml + false + false + + + xmlSystemId + false + false + + + xslt + false + false + + + xsltSystemId + false + false + + + + + when + org.apache.taglibs.standard.tag.common.xml.WhenTag + JSP + + Subtag of <choose> that includes its body if its + expression evalutes to 'true' + + + select + true + false + + + + Index: lams_tool_lamc/web/answersContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/answersContent.jsp (revision 0) +++ lams_tool_lamc/web/answersContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,81 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + +
    + +
    +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    +
    +
    + + + + + \ No newline at end of file Index: lams_tool_lamc/web/author_page.jsp =================================================================== diff -u --- lams_tool_lamc/web/author_page.jsp (revision 0) +++ lams_tool_lamc/web/author_page.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,135 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> +<%@ taglib uri="fck-editor" prefix="FCK" %> + +<% +String protocol = request.getProtocol(); +if(protocol.startsWith("HTTPS")){ + protocol = "https://"; +}else{ + protocol = "http://"; +} +String root = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +String pathToLams = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/../.."; + +%> + + + + + +Tool + + + + + + + + + + +

    Multiple Choice

    + + + + + + + + + +
    + + + + + + + +
    + +
    + + + + + + + +
    + +
    + + + + + + + +
    + +
    + + + + + + + +
    +

    Basic tab content

    +
    +The basic contents should go here +
    +
    +Cancel + + +
    + + + + +
    +

    Advanced tab content

    +
    +The advanced contents should go here +
    + + +
    + + +
    +

    Instructions tab content

    +
    +Instructions are here +
    +
    +Cancel + + + + +
    + + + + +

    + + +
    Index: lams_tool_lamc/web/author_page/css/aqua.css =================================================================== diff -u --- lams_tool_lamc/web/author_page/css/aqua.css (revision 0) +++ lams_tool_lamc/web/author_page/css/aqua.css (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,203 @@ +/*This is a theme CSS file. Which one will be loaded into the JSP depends on a variable passed in from FLASH.*/ + +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-color: #A2BCF9; + font-size: small; +} + +h1 { + font-size: large; + background-color: #B4C8FE; + border-top-width: 1px; + border-top-style: solid; + border-top-color: #999999; + border-left-width: 1px; + border-left-style: solid; + border-left-color: #999999; +} +h2 { + font-size: small; + border-bottom-style: solid; + border-bottom-width: 1px; + border-bottom-color: #666666; + margin-bottom: 1px; + + +} + +th { + font-size: small; + color: #FFFFFF; + background-color: #075A8B; + text-align: left; +} + +.formtablecontainer{ + text-align:center; +} + +.datatablecontainer{ + width:100%; +} + +.buttoncontainer { + +} + + +input, select, textarea { + font-family: 'Verdana', 'Arial', 'Helvetica', sans-serif; + font-size: small; +} + +.forms { + border: 1px solid #999999; + font-size: small; + font-style: normal; + width: 100%; +} + +.formlabel { + font-size: small; + font-style: normal; + text-align: right; + width: 20%; +} + +.formcontrol { + font-size: small; + font-style: normal; + text-align: left; +} + +/*tab styles*/ +.tab{ + text-align:center; +} + +.tab a{ + font-size: 11px; + color: #000000; + text-decoration:none; +} +.tab a:hover{ + font-size: 11px; + color: #000000; + text-decoration:underline +} +.tabcentre{ + background-image:url(../images/aqua_tab_centre.gif); + background-repeat:repeat-x; +} + + +.tabcentre_selected{ + background-image:url(../images/aqua_tab_s_centre.gif); + background-repeat:repeat-x; +} + + + +/*Tab content containers*/ +.tabbody{ + + + background-color : #D9E8FF; + float:left; + + margin : 0; + border-right-width: 1px; + border-left-width: 1px; + border-right-style: solid; + border-left-style: solid; + border-right-color: #0D3F59; + border-left-color: #0D3F59; + + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #0D3F59; + padding:5px; + +} + + +/*specific styles for the content divs of the tabs*/ +.content_b{ + z-index: 0; + position:relative; + visibility:visible; +} +.content_a{ + z-index: 0; + position:absolute; + visibility: hidden; +} +.content_i{ + z-index: 0; + position:absolute; + visibility: hidden; +} +/*end tabs*/ + +a.button{ + float:right; + font-size: 12px; + color: #000000; + text-decoration:none; + text-align: center; + background-color:#B4C8FE; + margin: 2px 5px 2px 5px; + padding:3px; + width: 80px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #FFFFFF; + border-right-color: #0D3F59; + border-bottom-color: #0D3F59; + border-left-color: #FFFFFF; +} + + + +a.button:link{ + color: #000000; + text-decoration:none; + background-color:#B4C8FE; +} + +a.button:visited{ + color: #000000; + text-decoration:none; + background-color:#B4C8FE; +} + + + +a.button:hover{ + text-decoration:none; + background-color:#FFFFFF; +} + +a.button:active{ + text-decoration:none; + background-color:#CCCCCC; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-bottom-color: #FFFFFF; + border-left-color: #0D3F59; + border-top-color: #0D3F59; + border-right-color: #FFFFFF; +} Index: lams_tool_lamc/web/author_page/css/base.css =================================================================== diff -u --- lams_tool_lamc/web/author_page/css/base.css (revision 0) +++ lams_tool_lamc/web/author_page/css/base.css (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3 @@ +/* +This is the Base CSS, it will define the location of images etc and other core, non user configurable items. (Admin configurable) +*/ \ No newline at end of file Index: lams_tool_lamc/web/author_page/css/tool_custom.css =================================================================== diff -u --- lams_tool_lamc/web/author_page/css/tool_custom.css (revision 0) +++ lams_tool_lamc/web/author_page/css/tool_custom.css (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,59 @@ +.button{ + float:right; + font-size: 12px; + color: #000000; + text-decoration:none; + text-align: center; + background-color:#B4C8FE; + margin: 2px 5px 2px 5px; + padding:3px; + width: 80px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #FFFFFF; + border-right-color: #0D3F59; + border-bottom-color: #0D3F59; + border-left-color: #FFFFFF; +} + +.button:link{ + color: #000000; + text-decoration:none; + background-color:#B4C8FE; +} + +.button:visited{ + color: #000000; + text-decoration:none; + background-color:#B4C8FE; +} + + + +.button:hover{ + text-decoration:none; + background-color:#FFFFFF; +} + +.button:active{ + text-decoration:none; + background-color:#CCCCCC; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-bottom-color: #FFFFFF; + border-left-color: #0D3F59; + border-top-color: #0D3F59; + border-right-color: #FFFFFF; +} \ No newline at end of file Index: lams_tool_lamc/web/author_page/css/xp.css =================================================================== diff -u --- lams_tool_lamc/web/author_page/css/xp.css (revision 0) +++ lams_tool_lamc/web/author_page/css/xp.css (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,3 @@ +/* +Another theme CSS, would have diufferent colours and layout techniques +*/ \ No newline at end of file Index: lams_tool_lamc/web/author_page/images/aqua_tab_centre.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/images/aqua_tab_left.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/images/aqua_tab_right.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/images/aqua_tab_s_centre.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/images/aqua_tab_s_left.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/images/aqua_tab_s_right.gif =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/author_page/js/tabcontroller.js =================================================================== diff -u --- lams_tool_lamc/web/author_page/js/tabcontroller.js (revision 0) +++ lams_tool_lamc/web/author_page/js/tabcontroller.js (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,137 @@ + +var tabsContents = new Array(); +var tab_lefts = new Array(); +//TODO:we need to set this variable, maybe from the praent or direct from JSP/Java +var themeName = "aqua"; +var currentTab = ""; + +function initTabs(){ + //put all the tab contents in an array + tabsContents.push(document.getElementById('content_b')); + tabsContents.push(document.getElementById('content_a')); + tabsContents.push(document.getElementById('content_i')); + + //position the advanced (a) and instructions (i) layers over the basic (b) layer + var bTabC_x = findPosX(tabsContents[0]); + var bTabC_y = findPosY(tabsContents[0]); + + tabsContents[1].style.left = bTabC_x+'px'; + tabsContents[1].style.top = bTabC_y+'px'; + tabsContents[2].style.left = bTabC_x+'px'; + tabsContents[2].style.top = bTabC_y+'px'; + tabsContents[1].style.visibility="hidden"; + tabsContents[2].style.visibility="hidden"; +} + +function deSelectTab(tabId){ + //swap images of side parts + var tl = document.getElementById("tab_left_"+tabId); + tl.src="author_page/images/"+themeName+"_tab_left.gif"; + tl.height = 22; + var tr = document.getElementById("tab_right_"+tabId); + tr.src="author_page/images/"+themeName+"_tab_right.gif"; + tr.height = 22; + //swap css of centre class + var tc = document.getElementById("tab_tbl_centre_"+tabId); + tc.className="tab tabcentre"; +} + +function selectTab(tabId){ + //alert('selecttab'); + //swap images of side parts + var tl = document.getElementById("tab_left_"+tabId); + tl.src="author_page/images/"+themeName+"_tab_s_left.gif"; + tl.height = 25; + var tr = document.getElementById("tab_right_"+tabId); + tr.src="author_page/images/"+themeName+"_tab_s_right.gif"; + tr.height = 25; + //swap css of centre class + var tc = document.getElementById("tab_tbl_centre_"+tabId); + tc.className="tab tabcentre_selected"; + + //if(tabId=="a"){ + //enableFCKEditor(); + //} + +} + +function enableFCKEditor(){ + //alert('enableFCKEditor'); + // This is a hack for Gecko... it stops editing when the editor is hidden. + if ( !document.all ){ + var oEditor = FCKeditorAPI.GetInstance( 'FCKeditor1' ) ; + + if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) + { + oEditor.SwitchEditMode() ; + oEditor.SwitchEditMode() ; + } + } +} + + +function showTab(tabId){ + if (currentTab == tabId){ + return; + }else{ + currentTab = tabId; + } + + selectTab(tabId); + + if(tabId == "i"){ + deSelectTab("a"); + deSelectTab("b"); + }else if(tabId=="a"){ + deSelectTab("i"); + deSelectTab("b"); + }else{ + deSelectTab("i"); + deSelectTab("a"); + } + + //sort out the content + var contentId = "content_"+tabId; + for(var i=0; i < tabsContents.length; i++){ + if(tabsContents[i].id==contentId){ + //document.getElementById(tabsContents[i].id).style.display = '' ; + tabsContents[i].style.visibility="visible"; + }else{ + //document.getElementById(tabsContents[i].id).style.display = 'none' ; + tabsContents[i].style.visibility="hidden"; + } + } + + + +} + +function findPosX(obj) { + var curleft = 0; + if(obj.offsetParent) + while(1) + { + curleft += obj.offsetLeft; + if(!obj.offsetParent) + break; + obj = obj.offsetParent; + } + else if(obj.x) + curleft += obj.x; + return curleft; + } + +function findPosY(obj) { + var curtop = 0; + if(obj.offsetParent) + while(1) + { + curtop += obj.offsetTop; + if(!obj.offsetParent) + break; + obj = obj.offsetParent; + } + else if(obj.y) + curtop += obj.y; + return curtop; + } Index: lams_tool_lamc/web/baseContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/baseContent.jsp (revision 0) +++ lams_tool_lamc/web/baseContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,21 @@ + +

    Base Content

    Index: lams_tool_lamc/web/errorbox.jsp =================================================================== diff -u --- lams_tool_lamc/web/errorbox.jsp (revision 0) +++ lams_tool_lamc/web/errorbox.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,43 @@ + +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> +<%@ page import="org.apache.struts.action.Action" %> +<%@ page import="org.apache.struts.action.ActionErrors" %> +<% +String cprotocol = request.getProtocol(); +if(cprotocol.startsWith("HTTPS")){ + cprotocol = "https://"; +}else{ + cprotocol = "http://"; +} +String rootPath = cprotocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +%> + + + + Error occured + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/exportPortfolioIndex.jsp =================================================================== diff -u --- lams_tool_lamc/web/exportPortfolioIndex.jsp (revision 0) +++ lams_tool_lamc/web/exportPortfolioIndex.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,7 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + +

    can be handy at some stage for testing

    \ No newline at end of file Index: lams_tool_lamc/web/footer.jsp =================================================================== diff -u --- lams_tool_lamc/web/footer.jsp (revision 0) +++ lams_tool_lamc/web/footer.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,20 @@ + Index: lams_tool_lamc/web/groupsReport.jsp =================================================================== diff -u --- lams_tool_lamc/web/groupsReport.jsp (revision 0) +++ lams_tool_lamc/web/groupsReport.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,185 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String sectionSessionId =(String)request.getAttribute("sectionSessionId"); + String fullName ="fullName" + sectionSessionId + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String aTime ="aTime" + sectionSessionId + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String timeZoneId ="timeZoneId" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String answer ="answer" + sectionSessionId + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String responseId ="responseId" + sectionSessionId + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String responseHidden ="responseHidden" + sectionSessionId + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + + fullName = (String) request.getSession().getAttribute(fullName); + request.setAttribute("fullName", fullName); + + java.util.Date attemptTime= (java.util.Date) request.getSession().getAttribute(aTime); + request.setAttribute("attemptTime", attemptTime); + + timeZoneId= (String) request.getSession().getAttribute(timeZoneId); + request.setAttribute("timeZoneId", timeZoneId); + + answer= (String) request.getSession().getAttribute(answer); + request.setAttribute("answer", answer); + Long longResponseId= (Long) request.getSession().getAttribute(responseId); + request.setAttribute("responseId", longResponseId); + Boolean booleanResponseHidden= (Boolean) request.getSession().getAttribute(responseHidden); + request.setAttribute("responseHidden", booleanResponseHidden); + + %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    : +
                   
    +     + +     + +     + +     + +     + + + + +     : + + + +     + + + + + +     + + + + +     + + + +     + + + + + + +     + + + + + +     : + + +     + + + + + + +     + + + + +
     
    + +
    Index: lams_tool_lamc/web/header.jsp =================================================================== diff -u --- lams_tool_lamc/web/header.jsp (revision 0) +++ lams_tool_lamc/web/header.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,31 @@ + +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ page contentType="text/html; charset=iso-8859-1" language="java" %> +<% +String protocol = request.getProtocol(); +if(protocol.startsWith("HTTPS")){ + protocol = "https://"; +}else{ + protocol = "http://"; +} +String pathToRoot = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +%> Index: lams_tool_lamc/web/images/icon_questionanswer.swf =================================================================== diff -u Binary files differ Index: lams_tool_lamc/web/index.jsp =================================================================== diff -u --- lams_tool_lamc/web/index.jsp (revision 0) +++ lams_tool_lamc/web/index.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,24 @@ +<%@ page import="org.lamsfoundation.lams.tool.qa.QaUtils" %> +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + +<% + String userContentId="1234"; + String userId="1111"; + String toolUrl="/authoringStarter?userId=" + userId + "&toolContentId=" + userContentId; +%> + + + + +

    + +
    + + + + Index: lams_tool_lamc/web/learnerReport.jsp =================================================================== diff -u --- lams_tool_lamc/web/learnerReport.jsp (revision 0) +++ lams_tool_lamc/web/learnerReport.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,44 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + +
    +
    + + + + + + + + + + + + + + + +
    + +
     
    + +
    +      +
    + + + +
    + + + + + + + + \ No newline at end of file Index: lams_tool_lamc/web/learningIndex.jsp =================================================================== diff -u --- lams_tool_lamc/web/learningIndex.jsp (revision 0) +++ lams_tool_lamc/web/learningIndex.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,26 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + +<% + String userId="222"; + String toolContentId="6666"; + String toolSessionId="88888888"; + String toolUrl="/learningStarter?userId=" + userId + "&toolSessionId=" + toolSessionId + "&toolContentId=" + toolContentId; +%> + + + + +


    + +
    + + + + Index: lams_tool_lamc/web/messagebox.jsp =================================================================== diff -u --- lams_tool_lamc/web/messagebox.jsp (revision 0) +++ lams_tool_lamc/web/messagebox.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,49 @@ + +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ page import="org.apache.struts.action.Action" %> +<%@ page import="org.apache.struts.action.ActionErrors" %> +<% +String curProtocol = request.getProtocol(); +if(curProtocol.startsWith("HTTPS")){ + curProtocol = "https://"; +}else{ + curProtocol = "http://"; +} +String root = curProtocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +%> + + + + + Message + + +
      + +
    • +
      +
    + + +
    + Index: lams_tool_lamc/web/monitoringIndex.jsp =================================================================== diff -u --- lams_tool_lamc/web/monitoringIndex.jsp (revision 0) +++ lams_tool_lamc/web/monitoringIndex.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,50 @@ + +<%@ page import="org.lamsfoundation.lams.tool.qa.QaUtils" %> +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + +<% + String fromToolContentId="1234"; + String toToolContentId="4321"; + String toolSessionId="999888"; + String userId="123123"; + String toolUrl="/monitoringStarter?toolSessionId=" + toolSessionId + + "&fromToolContentId=" + fromToolContentId + + "&toToolContentId=" + toToolContentId + + "&userId=" + userId; + + + +%> + + + + + +
    + + + + + + + + + + + +
    +
    + +
    + + + + + + Index: lams_tool_lamc/web/monitoringReport.jsp =================================================================== diff -u --- lams_tool_lamc/web/monitoringReport.jsp (revision 0) +++ lams_tool_lamc/web/monitoringReport.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,103 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +
    + +
    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + \ No newline at end of file Index: lams_tool_lamc/web/portfolioReport.jsp =================================================================== diff -u --- lams_tool_lamc/web/portfolioReport.jsp (revision 0) +++ lams_tool_lamc/web/portfolioReport.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,50 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + +
    + +
    +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + \ No newline at end of file Index: lams_tool_lamc/web/questionsContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/questionsContent.jsp (revision 0) +++ lams_tool_lamc/web/questionsContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,124 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="fck-editor" prefix="FCK" %> + + + + + + +
    + +
    +
    + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + +
    + +
    + +
    + + + + + + + + + +
    +
    +
    + + + \ No newline at end of file Index: lams_tool_lamc/web/rootPath.jsp =================================================================== diff -u --- lams_tool_lamc/web/rootPath.jsp (revision 0) +++ lams_tool_lamc/web/rootPath.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,35 @@ + +<%@ page language="java" import="java.lang.*,java.util.*" %> +<% +String protocol = request.getProtocol(); +if(protocol.startsWith("HTTPS")){ + protocol = "https://"; +}else{ + protocol = "http://"; +} +String pathToRoot = protocol+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"; +pageContext.setAttribute("rootpath",pathToRoot); + +//variable for calculating row color +int status = 0; +int substatus=0; +%> \ No newline at end of file Index: lams_tool_lamc/web/singleLearnerReport.jsp =================================================================== diff -u --- lams_tool_lamc/web/singleLearnerReport.jsp (revision 0) +++ lams_tool_lamc/web/singleLearnerReport.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,122 @@ +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> +<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> + + + + + + + + + + + + + + + + + + + + + <%String fullName ="fullName" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String aTime ="aTime" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String formattedAtime="formattedAtime" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String timeZoneId ="timeZoneId" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String answer ="answer" + request.getAttribute("queIndex") + request.getAttribute("ansIndex"); + String currentLearnerFullname=(String) request.getSession().getAttribute("currentLearnerFullname"); + + fullName = (String) request.getSession().getAttribute(fullName); + java.util.Date attemptTime= (java.util.Date) request.getSession().getAttribute(aTime); + formattedAtime =(String) request.getSession().getAttribute(formattedAtime); + timeZoneId = (String) request.getSession().getAttribute(timeZoneId); + answer = (String) request.getSession().getAttribute(answer); + + request.setAttribute("fullName", fullName); + request.setAttribute("attemptTime", attemptTime); + request.setAttribute("formattedAtime", formattedAtime); + request.setAttribute("timeZoneId", timeZoneId); + request.setAttribute("answer", answer); + request.setAttribute("currentLearnerFullname", currentLearnerFullname); + %> + + + + <% + if ((fullName != null) && (!fullName.equalsIgnoreCase(currentLearnerFullname))) + { + %> + + <%} + else if ((fullName != null) && (fullName.equalsIgnoreCase(currentLearnerFullname))) + {%> + + <%} + else if ((fullName == null)) + {%> + + <%}%> + + + + <% if (fullName != null) + { + %> + + + + <%}%> + + + + <% if (formattedAtime != null) + { + %> + + <%}%> + + <% if (timeZoneId != null) + { + %> + + <%}%> + + + <% if (answer != null) + { + %> + + <%}%> + + + + +
    : +
                   
    + +     ( ) + + +     + + + +     + +     ( ) + +     + +     + + + +     + +     +
     
    + Index: lams_tool_lamc/web/systemErrorContent.jsp =================================================================== diff -u --- lams_tool_lamc/web/systemErrorContent.jsp (revision 0) +++ lams_tool_lamc/web/systemErrorContent.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,40 @@ + + +<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %> +<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> + + + + + + + + +
    + +
    +
    + <%@ include file="errorbox.jsp" %> +
    +
    + + Index: lams_tool_lamc/web/template.jsp =================================================================== diff -u --- lams_tool_lamc/web/template.jsp (revision 0) +++ lams_tool_lamc/web/template.jsp (revision 653f0f0eff40af5e6891c22ef2b8efe9bf2f75af) @@ -0,0 +1,59 @@ + +<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> +<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> +<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> +<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> + + + + + + + <tiles:getAsString name="title"/> + + + + + + + + + + + + + + + + + + + +
    + +