Index: lams_tool_preview/.classpath
===================================================================
diff -u
--- lams_tool_preview/.classpath (revision 0)
+++ lams_tool_preview/.classpath (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/.cvsignore
===================================================================
diff -u
--- lams_tool_preview/.cvsignore (revision 0)
+++ lams_tool_preview/.cvsignore (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,2 @@
+build
+bin
Index: lams_tool_preview/conf/hibernate/mappings/hibernate.cfg.xml
===================================================================
diff -u
--- lams_tool_preview/conf/hibernate/mappings/hibernate.cfg.xml (revision 0)
+++ lams_tool_preview/conf/hibernate/mappings/hibernate.cfg.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,12 @@
+
+
+
+
+ @db.username@
+ @db.password@
+ @db.url.run@
+ @db.driver@
+ org.hibernate.dialect.MySQLDialect
+
+
Index: lams_tool_preview/conf/hibernate/mappings/org/lamsfoundation/lams/tool/peerreview/model/Peerreview.hbm.xml
===================================================================
diff -u
--- lams_tool_preview/conf/hibernate/mappings/org/lamsfoundation/lams/tool/peerreview/model/Peerreview.hbm.xml (revision 0)
+++ lams_tool_preview/conf/hibernate/mappings/org/lamsfoundation/lams/tool/peerreview/model/Peerreview.hbm.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u
--- lams_tool_preview/conf/language/lams/ApplicationResources.properties (revision 0)
+++ lams_tool_preview/conf/language/lams/ApplicationResources.properties (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,179 @@
+appName = shareresources
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Jun 02 10:51:09 CST 2015
+
+#=================== labels for ShareResources =================#
+
+activity.title =Peerreview
+activity.description =Sharing resources with others.
+activity.helptext =Uploading your resources to share with others.
+tool.display.name =Share Resources Tool
+tool.description =Tool for sharing resources.
+appName =Share Resources
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =Share Resources Authoring
+label.author.title =Share Resources
+label.authoring.heading.basic =Basic
+label.authoring.heading.advance =Advanced
+label.authoring.heading.basic.desc =Basic input information for shared resources
+label.authoring.heading.advance.desc =Please input advance options for shared resources
+label.authoring.basic.title =Title
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.add.website =Add Zipped Website
+label.authoring.basic.add.learning.object =Add IMS Content Package
+label.authoring.basic.resource.list.title =Resource list
+label.authoring.basic.resource.url =URL
+label.authoring.basic.resource.file =File
+label.authoring.basic.resource.website =Website
+label.authoring.basic.resource.learning.object =IMS CP
+label.authoring.basic.resource.verify.url =Verify URL
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.url.input =URL
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.basic.resource.zip.file.input =Zip file:
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.run.content.auto =Run content automatically (only available if there is exactly one resource)
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow learners to add URLs
+label.authoring.advance.allow.learner.add.files =Allow learners to add files
+label.next.instruction =Next Instruction
+label.authoring.save.button =Save
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in shared resources authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.package =Invalid IMS CP format.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.website.no.initial.file =Website zip can not find out initial file (index.htm/html or default.htm/html).
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.repository =A repository error occurred while trying to upload the file.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+msg.no.instruction =No instruction available.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =Share Resource Learning
+label.learning.heading =Share Resources
+label.resoruce.to.review =Resources to view
+label.learning.minimum.review =You must view at least {0} of the resources.
+lable.learning.minimum.view.number.less =You must view at least another {0} of the resources.
+label.check.for.new =Check for new
+label.suggest.new =Suggest a new
+label.learning.new.file =New file details:
+label.learning.new.url =New URL details:
+label.learning.comment.or.instruction =Comment/Instruction
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of learners is the number of learners who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Learners
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.loginname =Login name
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.resource =Resource
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of Share Resource
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.open =Open
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.finished =Next Activity
+label.completed =Completed
+label.finish =Finished
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+monitoring.label.access.time =Started on
+define.later.message =Please wait for the instructor to complete the contents of this activity.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+label.up =Move Up
+label.down =Move down
+label.monitoring.heading.access =Learners list
+label.authoring.advanced.reflectOnActivity =Add a notebook at end of Shared Resources with the following instructions:
+error.reflection.emtpy =Please input Notebook Entry
+title.reflection =Notebook Entry
+label.continue =Continue
+monitoring.user.fullname =Name
+monitoring.user.reflection =Notebook Entry
+page.title.monitoring.view.reflection =View Notebook Entries
+button.close =Close
+message.step.of =Step {0} of {1}
+message.no.reflection.available =No notebook available
+button.edit =Edit
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
+message.warnLockOnFinish =Note: After you click on "Next Activity\u201d, if you come back to this Share Resource, you won\u2019t be able to share new resources.
+message.activityLocked =The instructor has set this activity not to allow you to view or share any more resources after you have finished it.
+label.export.reflection =Notebook Entries
+monitoring.label.instructions =Instructions
+label.on =On
+label.off =Off
+monitor.summary.th.advancedSettings =Advanced settings
+monitor.summary.td.addNotebook =Add a notebook at end of Shared Resources
+monitor.summary.td.notebookInstructions =Notebook instructions
+label.authoring.advanced.notify.onassigmentsubmit =Notify instructors when a learner submits a resource
+event.assigment.submit.subject =LAMS: A learner submitted an assignment in a Shared Resources tool
+event.assigment.submit.body =The learner {0} submitted an assignment in a Shared Resources tool.\n\nThis message was sent automatically, following the tool''s advanced settings.
+error.planner.no.resource.save =There has to be at least one resource to save.
+error.planner.url.blank =In resource {0} URL can not be blank.
+error.planner.file.blank =In resource {0} file can not be blank.
+label.authoring.up =Move up
+label.authoring.down =Move down
+monitoring.label.complete.time =Finished on
+monitoring.label.time.taken =Time taken
+output.desc.shared.items.output.definition.rsrc =Share Resources: Uploaded URLs and paths to files
+label.submit =Finish
+monitoring.label.actions =Actions
+monitoring.label.views =Views
+label.monitoring.heading =Share Resources Monitoring
+open.file.in.new.window =Open file in a new window
+
+
+#======= End labels: Exported 168 labels for en AU =====
Index: lams_tool_preview/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
diff -u
--- lams_tool_preview/conf/language/lams/ApplicationResources_en_AU.properties (revision 0)
+++ lams_tool_preview/conf/language/lams/ApplicationResources_en_AU.properties (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,208 @@
+appName = shareresources
+#language code: en
+#locale code: AU
+
+ # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Jun 02 10:51:09 CST 2015
+
+#=================== labels for PeerReview =================#
+
+activity.title =Peer Review
+activity.description =Individual peer review.
+activity.helptext =Individual peer review.
+tool.display.name =Peer Review Tool
+tool.description =Tool for individual peer review.
+appName =Peer Review
+errorPage.title =Error page
+errorPage.heading =Some error occurs when handling your request
+label.authoring.heading =Peer Review Authoring
+label.author.title =Peer Review
+label.authoring.heading.basic =Basic
+label.authoring.heading.advance =Advanced
+label.authoring.heading.basic.desc =Basic input information for peer review
+label.authoring.heading.advance.desc =Please input advance options for peer review
+label.authoring.basic.title =Title
+label.authoring.basic.instruction =Instruction
+label.authoring.basic.add.url =Add URL
+label.authoring.basic.add.file =Add Single File
+label.authoring.basic.add.website =Add Zipped Website
+label.authoring.basic.add.learning.object =Add IMS Content Package
+label.authoring.basic.resource.list.title =Resource list
+label.authoring.basic.resource.url =URL
+label.authoring.basic.resource.file =File
+label.authoring.basic.resource.website =Website
+label.authoring.basic.resource.learning.object =IMS CP
+label.authoring.basic.resource.verify.url =Verify URL
+label.authoring.basic.resource.preview =Preview
+label.authoring.basic.resource.edit =Edit
+label.authoring.basic.resource.delete =Delete
+label.authoring.basic.resource.add.instruction =Add Instruction
+label.authoring.basic.resource.instructions =Instructions
+label.authoring.basic.resource.title.input =Title
+label.authoring.basic.resource.url.input =URL
+label.authoring.basic.resource.file.input =File
+label.authoring.basic.resource.description.input =Description
+label.authoring.basic.resource.zip.file.input =Zip file:
+label.authoring.online.filelist =Online file list
+label.authoring.offline.filelist =Offline file list
+label.authoring.advance.lock.on.finished =Lock when finished
+label.authoring.advance.run.content.auto =Run content automatically (only available if there is exactly one resource)
+label.authoring.advance.mini.number.resources.view =Minimum number of resources to view
+label.authoring.advance.allow.learner.add.urls =Allow learners to add URLs
+label.authoring.advance.allow.learner.add.files =Allow learners to add files
+label.next.instruction =Next Instruction
+label.authoring.save.button =Save
+label.authoring.cancel.button =Cancel
+label.description =Description:
+authoring.exception =There is a problem in peer review authoring page, the reason is {0}
+error.resource.item.title.blank =Title can not be blank.
+error.resource.item.url.blank =URL can not be blank.
+error.resource.item.file.blank =File can not be blank.
+error.resource.item.desc.blank =Comment/Instruction can not be blank
+error.resource.item.invalid.url =Invalid URL format.
+error.upload.failed =Upload file failed: {0}
+error.msg.upload.file.not.found =Could not find upload file {0}.
+error.msg.zip.file.exception =Could not handle zip file when uploading file.
+error.msg.file.not.found =File not found exception occurs when uploading file.
+error.msg.ims.package =Invalid IMS CP format.
+error.msg.ims.application =ImscpApplicationException occurs when uploading resource item file.
+error.msg.website.no.initial.file =Website zip can not find out initial file (index.htm/html or default.htm/html).
+error.msg.io.exception =IOException occurs when uploading file.
+error.msg.invaid.param.upload =InvalidParameterException occured while trying to upload File.
+error.msg.repository =A repository error occurred while trying to upload the file.
+error.msg.default.content.not.find =Could not retrieve default content record for this tool.
+msg.no.instruction =No instruction available.
+authoring.msg.cancel.save =Do you want to close this window without saving?
+label.learning.title =Share Resource Learning
+label.learning.heading =Peer Review
+label.resoruce.to.review =Resources to view
+label.learning.minimum.review =You must view at least {0} of the resources.
+lable.learning.minimum.view.number.less =You must view at least another {0} of the resources.
+label.check.for.new =Check for new
+label.suggest.new =Suggest a new
+label.learning.new.file =New file details:
+label.learning.new.url =New URL details:
+label.learning.comment.or.instruction =Comment/Instruction
+monitoring.tab.summary =Summary
+monitoring.tab.statistics =Statistic
+monitoring.tab.edit.activity =Edit Activity
+monitoring.label.group =Group
+monitoring.summary.note =Note: number of learners is the number of learners who have viewed the resource.
+monitoring.label.type =Type
+monitoring.label.title =Title
+monitoring.label.suggest =Suggested By
+monitoring.label.number.learners =Number of Learners
+monitoring.label.hide =Hide
+monitoring.label.show =Show
+monitoring.label.user.loginname =Login name
+monitoring.label.user.name =Name
+monitoring.label.hidden =Hidden
+label.monitoring.edit.activity.cancel =Cancel
+label.monitoring.edit.activity.update =Update
+label.monitoring.edit.activity.edit =Edit
+message.monitoring.edit.activity.not.editable =This Activity is no longer editable
+export.label.resource =Resource
+export.label.no.learning.object =No offline package available
+export.title =Export portfolio of Share Resource
+export.init.resource =Initial Resources
+errors.header =
+errors.footer =
+error.valueReqd =Value Required
+error.inputFileTooLarge =Input File size is too large!
+error.uploading =error uploading
+error.title.empty =Title can not be blank
+message.msg.maxFileSize =Max 250K
+label.open =Open
+label.delete =Delete
+label.download =Download
+label.view =View
+label.edit =Edit
+label.finished =Next Activity
+label.completed =Completed
+label.finish =Finished
+button.upload =Upload
+button.add =Add
+button.cancel =Cancel
+message.monitoring.summary.no.session =No Session Available
+label.show =Show
+label.hide =Hide
+label.save =Save
+label.cancel =Cancel
+monitoring.label.access.time =Started on
+define.later.message =Please wait for the instructor to complete the contents of this activity.
+message.monitoring.summary.no.resource.for.group =No resource available for this group.
+button.try.again =Try again
+open.in.new.window =Open URL in pop-up
+label.up =Move Up
+label.down =Move down
+label.monitoring.heading.access =Learners list
+label.authoring.advanced.reflectOnActivity =Add a notebook at end of Peer Review with the following instructions:
+error.reflection.emtpy =Please input Notebook Entry
+title.reflection =Notebook Entry
+label.continue =Continue
+monitoring.user.fullname =Name
+monitoring.user.reflection =Notebook Entry
+page.title.monitoring.view.reflection =View Notebook Entries
+button.close =Close
+message.step.of =Step {0} of {1}
+message.no.reflection.available =No notebook available
+button.edit =Edit
+errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes
+error.attachment.executable =The uploaded file is executable, please zip it before uploading.
+message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
+message.warnLockOnFinish =Note: After you click on "Next Activity\u201d, if you come back to this Share Resource, you won\u2019t be able to share new resources.
+message.activityLocked =The instructor has set this activity not to allow you to view or share any more resources after you have finished it.
+label.export.reflection =Notebook Entries
+monitoring.label.instructions =Instructions
+label.on =On
+label.off =Off
+monitor.summary.th.advancedSettings =Advanced settings
+monitor.summary.td.addNotebook =Add a notebook at end of Peer Review
+monitor.summary.td.notebookInstructions =Notebook instructions
+label.authoring.advanced.notify.onassigmentsubmit =Notify instructors when a learner submits a resource
+event.assigment.submit.subject =LAMS: A learner submitted an assignment in a Peer Review tool
+event.assigment.submit.body =The learner {0} submitted an assignment in a Peer Review tool.\n\nThis message was sent automatically, following the tool''s advanced settings.
+error.planner.no.resource.save =There has to be at least one resource to save.
+error.planner.url.blank =In resource {0} URL can not be blank.
+error.planner.file.blank =In resource {0} file can not be blank.
+label.authoring.up =Move up
+label.authoring.down =Move down
+monitoring.label.complete.time =Finished on
+monitoring.label.time.taken =Time taken
+output.desc.shared.items.output.definition.rsrc =peer review: Uploaded URLs and paths to files
+label.submit =Finish
+monitoring.label.actions =Actions
+monitoring.label.views =Views
+label.monitoring.heading =Peer Review Monitoring
+open.file.in.new.window =Open file in a new window
+
+label.average.rating =Average rating {0}/{1} votes
+label.redo =Redo ratings
+label.rating.criterias =Rating criterias
+label.add.criteria =Add Criteria
+label.your.rating =Your rating is {0} Avg rating {1} out of {2} votes
+label.rate.limits.reminder =Rating limitation: Minimum {0} and Maximum {1}.
+label.rate.limits.topic.reminder =You have rated {0} users already.
+label.rate.limits.reminder.min = You must rate at least {0} users.
+label.rate.limits.reminder.max = You can only rate up to {0} users.
+js.warning.max.min.limit = There is an error with the minimum and/or maximum set for ratings. Please check and try again.
+label.minimum =Minimum:
+label.maximum =Maximum:
+label.no.minimum =No minimum
+label.no.maximum =No maximum
+label.minimum.number.words =Minimum number of words in a comment {0}
+warning.minimum.number.words =There is a minimum required number of words in a comment: {0}. So far you've entered {1} word(s).
+label.comment.textarea.tip =Please, provide some comment here...
+label.max.number.marks.each.user =Max number of marks for a each user.
+label.move.up =Move Up
+label.move.down =Move Down
+label.allow.comments =Allow learners to comment on other learners
+label.sort.by.user.name =Sort by user name
+label.user.name =User name
+label.rating =Rating
+label.comment =Comment
+label.show.ratings.left.for.user =After completion, show feedback left for student
+label.ratings.by.others =Ratings by other users
+label.comment.minimum.number.words =Minimum number of words in a comment{0}
+label.no.users =There is no users available for rating.
+
+#======= End labels: Exported 168 labels for en AU =====
Index: lams_tool_preview/conf/xdoclet/global-exceptions.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/global-exceptions.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/global-exceptions.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,8 @@
+
+
+
Index: lams_tool_preview/conf/xdoclet/global-forwards.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/global-forwards.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/global-forwards.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,6 @@
+
+
+
+
+
+
Index: lams_tool_preview/conf/xdoclet/struts-actions.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/struts-actions.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/struts-actions.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/conf/xdoclet/struts-forms.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/struts-forms.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/struts-forms.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1 @@
+
Index: lams_tool_preview/conf/xdoclet/struts-message-resources.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/struts-message-resources.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/struts-message-resources.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1 @@
+
Index: lams_tool_preview/conf/xdoclet/struts-plugins.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/struts-plugins.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/struts-plugins.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1 @@
+
Index: lams_tool_preview/conf/xdoclet/validation-forms.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/validation-forms.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/validation-forms.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,29 @@
+
Index: lams_tool_preview/conf/xdoclet/validation-global.xml
===================================================================
diff -u
--- lams_tool_preview/conf/xdoclet/validation-global.xml (revision 0)
+++ lams_tool_preview/conf/xdoclet/validation-global.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,6 @@
+
+
+ datePattern
+ yyyy-MM-dd
+
+
Index: lams_tool_preview/db/model/peerreview.clay
===================================================================
diff -u
--- lams_tool_preview/db/model/peerreview.clay (revision 0)
+++ lams_tool_preview/db/model/peerreview.clay (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,873 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/db/sql/activity_insert.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/activity_insert.sql (revision 0)
+++ lams_tool_preview/db/sql/activity_insert.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,78 @@
+# 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
+, library_activity_ui_image
+, create_grouping_id
+, create_grouping_ui_id
+, library_activity_id
+, language_file
+)
+VALUES
+(
+NULL
+, 'Peerreview'
+, 'Peerreview'
+, 'Put some help text here.'
+, NULL
+, NULL
+, NULL
+, NULL
+, 1
+, 2
+, 0
+, NULL
+, NULL
+, NULL
+, 0
+, NULL
+, ${learning_library_id}
+, NOW()
+, 0
+, NULL
+, NULL
+, NULL
+, ${tool_id}
+, NULL
+, 4
+, NULL
+, NULL
+, NULL
+, NULL
+, 'tool/laprev11/images/icon_peerreview.swf'
+, NULL
+, NULL
+, NULL
+, 'org.lamsfoundation.lams.tool.peerreview.ApplicationResources'
+)
Index: lams_tool_preview/db/sql/create_lams_tool_peerreview.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/create_lams_tool_peerreview.sql (revision 0)
+++ lams_tool_preview/db/sql/create_lams_tool_peerreview.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,54 @@
+SET FOREIGN_KEY_CHECKS=0;
+drop table if exists tl_laprev11_peerreview;
+drop table if exists tl_laprev11_session;
+drop table if exists tl_laprev11_user;
+create table tl_laprev11_peerreview (
+ uid bigint not null auto_increment,
+ create_date datetime,
+ update_date datetime,
+ create_by bigint,
+ title varchar(255),
+ lock_on_finished tinyint,
+ show_ratings_left_for_user tinyint DEFAULT 1,
+ instructions text,
+ content_in_use tinyint,
+ define_later tinyint,
+ content_id bigint unique,
+ reflect_instructions text,
+ reflect_on_activity smallint,
+ minimum_rates integer DEFAULT 0,
+ maximum_rates integer DEFAULT 0,
+ maximum_rates_per_user integer DEFAULT 0,
+ primary key (uid)
+)ENGINE=InnoDB;
+create table tl_laprev11_session (
+ uid bigint not null auto_increment,
+ session_end_date datetime,
+ session_start_date datetime,
+ status integer,
+ peerreview_uid bigint,
+ session_id bigint,
+ session_name varchar(250),
+ primary key (uid)
+)ENGINE=InnoDB;
+create table tl_laprev11_user (
+ uid bigint not null auto_increment,
+ user_id bigint,
+ last_name varchar(255),
+ first_name varchar(255),
+ login_name varchar(255),
+ session_finished smallint,
+ session_uid bigint,
+ peerreview_uid bigint,
+ primary key (uid)
+)ENGINE=InnoDB;
+alter table tl_laprev11_peerreview add index FK_NEW_1661738138_89093BF758092FB (create_by), add constraint FK_NEW_1661738138_89093BF758092FB foreign key (create_by) references tl_laprev11_user (uid);
+alter table tl_laprev11_session add index FK_NEW_1661738138_24AA78C530E79035 (peerreview_uid), add constraint FK_NEW_1661738138_24AA78C530E79035 foreign key (peerreview_uid) references tl_laprev11_peerreview (uid);
+alter table tl_laprev11_user add index FK_NEW_1661738138_30113BFCEC0D3147 (session_uid), add constraint FK_NEW_1661738138_30113BFCEC0D3147 foreign key (session_uid) references tl_laprev11_session (uid);
+alter table tl_laprev11_user add index FK_NEW_1661738138_30113BFC309ED320 (peerreview_uid), add constraint FK_NEW_1661738138_30113BFC309ED320 foreign key (peerreview_uid) references tl_laprev11_peerreview (uid);
+
+INSERT INTO `tl_laprev11_peerreview` (`uid`, `create_date`, `update_date`, `create_by`, `title`, `lock_on_finished`,
+ `instructions`, `content_in_use`, `define_later`, `content_id`, `reflect_on_activity`, `show_ratings_left_for_user`) VALUES
+ (1,NULL,NULL,NULL,'Peer review','0','Instructions ',0,0,${default_content_id},0, 1);
+
+SET FOREIGN_KEY_CHECKS=1;
Index: lams_tool_preview/db/sql/db_version_insert.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/db_version_insert.sql (revision 0)
+++ lams_tool_preview/db/sql/db_version_insert.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,2 @@
+-- $Id$
+INSERT INTO patches VALUES ('@signature@', '@tool_version@', NOW(), 'F');
Index: lams_tool_preview/db/sql/drop_lams_tool_peerreview.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/drop_lams_tool_peerreview.sql (revision 0)
+++ lams_tool_preview/db/sql/drop_lams_tool_peerreview.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,10 @@
+SET FOREIGN_KEY_CHECKS=0;
+drop table if exists tl_laprev11_peerreview;
+drop table if exists tl_laprev11_session;
+drop table if exists tl_laprev11_user;
+SET FOREIGN_KEY_CHECKS=1;
+
+
+
+
+
Index: lams_tool_preview/db/sql/library_insert.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/library_insert.sql (revision 0)
+++ lams_tool_preview/db/sql/library_insert.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -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
+(
+'Peerreview',
+'Peerreview',
+0,
+NOW()
+)
Index: lams_tool_preview/db/sql/table-schema.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/table-schema.sql (revision 0)
+++ lams_tool_preview/db/sql/table-schema.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1 @@
\ No newline at end of file
Index: lams_tool_preview/db/sql/tool_insert.sql
===================================================================
diff -u
--- lams_tool_preview/db/sql/tool_insert.sql (revision 0)
+++ lams_tool_preview/db/sql/tool_insert.sql (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,56 @@
+# 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_run_offline_flag,
+learner_url,
+learner_preview_url,
+learner_progress_url,
+author_url,
+monitor_url,
+define_later_url,
+export_pfolio_learner_url,
+export_pfolio_class_url,
+help_url,
+language_file,
+create_date_time,
+modified_date_time
+)
+VALUES
+(
+'laprev11',
+'peerreviewService',
+'Peerreview',
+'Peerreview',
+'peerreview',
+'@tool_version@',
+NULL,
+NULL,
+0,
+2,
+1,
+'tool/laprev11/learning/start.do?mode=learner',
+'tool/laprev11/learning/start.do?mode=author',
+'tool/laprev11/learning/start.do?mode=teacher',
+'tool/laprev11/authoring/start.do',
+'tool/laprev11/monitoring/summary.do',
+'tool/laprev11/definelater.do',
+'tool/laprev11/exportPortfolio?mode=learner',
+'tool/laprev11/exportPortfolio?mode=teacher',
+'http://wiki.lamsfoundation.org/display/lamsdocs/laprev11',
+'org.lamsfoundation.lams.tool.peerreview.ApplicationResources',
+NOW(),
+NOW()
+)
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/PeerreviewConstants.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/PeerreviewConstants.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/PeerreviewConstants.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,133 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview;
+
+public class PeerreviewConstants {
+ public static final String TOOL_SIGNATURE = "laprev11";
+
+ public static final String PEERREVIEW_SERVICE = "peerreviewService";
+
+ public static final String TOOL_CONTENT_HANDLER_NAME = "peerreviewToolContentHandler";
+
+ public static final int COMPLETED = 1;
+
+ public static final int SORT_BY_NO = 0;
+ public static final int SORT_BY_USERNAME_ASC = 1;
+ public static final int SORT_BY_USERNAME_DESC = 2;
+
+ // for action forward name
+ public static final String SUCCESS = "success";
+
+ public static final String ERROR = "error";
+
+ public static final String DEFINE_LATER = "definelater";
+
+ public static final String PARAM_PAGE = "page";
+ public static final String PARAM_ROWS = "rows";
+ public static final String PARAM_SIDX = "sidx";
+ public static final String PARAM_SORD = "sord";
+ public static final String PARAM_METHOD = "method";
+ public static final String PARAM_DISPATCH = "dispatch";
+ public static final String PARAM_LOGIN = "login";
+ public static final String PARAM_ID = "id";
+ public static final String PARAM_MARK = "mark";
+ public static final String PARAM_FEEDBACK = "feedback";
+ public static final String PARAM_USERID = "userID";
+ public static final String PARAM_SEARCH = "_search";
+ public static final String PARAM_SEARCH_FIELD = "searchField";
+ public static final String PARAM_SEARCH_OPERATION = "searchOper";
+ public static final String PARAM_SEARCH_STRING = "searchString";
+ public static final String PARAM_ROW_NAME = "rowName";
+ public static final String PARAM_TIME_TAKEN = "timeTaken";
+ public static final String PARAM_AVG_TIME_TAKEN = "avgTimeTaken";
+ public static final String PARAM_AVG_MARK = "avgMark";
+ public static final String PARAM_VIEW = "view";
+ public static final String PARAM_START_DATE = "startDate";
+ public static final String PARAM_GROUP_ID = "groupId";
+ // Sort
+ public static final String SORT_DESC = "desc";
+ public static final String SORT_ASC = "asc";
+
+ // for parameters' name
+ public static final String PARAM_TOOL_CONTENT_ID = "toolContentID";
+
+ public static final String PARAM_TOOL_SESSION_ID = "toolSessionId";
+
+ public static final String PARAM_TITLE = "title";
+
+ // for request attribute name
+ public static final String ATTR_TOOL_CONTENT_ID = "toolContentID";
+
+ public static final String ATTR_TOOL_SESSION_ID = "toolSessionID";
+
+ public static final String ATTR_PEERREVIEW = "peerreview";
+
+ public static final String ATTR_NEXT_ACTIVITY_URL = "nextActivityUrl";
+
+ public static final String ATTR_SUMMARY_LIST = "summaryList";
+
+ public static final String ATTR_USER_LIST = "userList";
+
+ public static final String ATTR_RESOURCE_INSTRUCTION = "instructions";
+
+ public static final String ATTR_FINISH_LOCK = "finishedLock";
+
+ public static final String ATTR_LOCK_ON_FINISH = "lockOnFinish";
+
+ public static final String ATTR_SESSION_MAP_ID = "sessionMapID";
+
+ public static final String ATTR_PEERREVIEW_FORM = "peerreviewForm";
+
+ public static final String ATTR_TITLE = "title";
+
+ public static final String ATTR_INSTRUCTIONS = "instructions";
+
+ public static final String ATTR_USER_FINISHED = "userFinished";
+
+ public static final String ATTR_USER = "user";
+
+ public static final String ATTR_IS_GROUPED_ACTIVITY = "isGroupedActivity";
+
+ public static final String ATTR_IS_URL_ITEM_TYPE = "isUrlItemType";
+
+ // error message keys
+
+ public static final String ERROR_MSG_UPLOAD_FAILED = "error.upload.failed";
+
+ public static final String PAGE_EDITABLE = "isPageEditable";
+
+ public static final String MODE_AUTHOR_SESSION = "author_session";
+
+ public static final String ATTR_REFLECTION_ON = "reflectOn";
+
+ public static final String ATTR_REFLECTION_INSTRUCTION = "reflectInstructions";
+
+ public static final String ATTR_REFLECTION_ENTRY = "reflectEntry";
+
+ public static final String ATTR_REFLECT_LIST = "reflectList";
+
+ public static final String ATTR_USER_UID = "userUid";
+
+ public static final String SHARED_ITEMS_DEFINITION_NAME = "shared.items.output.definition.peerreview";
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/DAO.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/DAO.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/DAO.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,70 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * Data Access Object (DAO) interface. This is an interface
+ * used to tag our DAO classes and to provide common methods to all DAOs.
+ *
+ * @author Dapeng.Ni
+ */
+public interface DAO {
+
+ /**
+ * Generic method used to get all objects of a particular type. This
+ * is the same as lookup up all rows in a table.
+ * @param clazz the type of objects (a.k.a. while table) to get data from
+ * @return List of populated objects
+ */
+ public List getObjects(Class clazz);
+
+ /**
+ * Generic method to get an object based on class and identifier. An
+ * ObjectRetrievalFailureException Runtime Exception is thrown if
+ * nothing is found.
+ *
+ * @param clazz model class to lookup
+ * @param id the identifier (primary key) of the class
+ * @return a populated object
+ * @see org.springframework.orm.ObjectRetrievalFailureException
+ */
+ public Object getObject(Class clazz, Serializable id);
+
+ /**
+ * Generic method to save an object - handles both update and insert.
+ * @param o the object to save
+ */
+ public void saveObject(Object o);
+
+ /**
+ * Generic method to delete an object based on class and id
+ * @param clazz model class to lookup
+ * @param id the identifier (primary key) of the class
+ */
+ public void removeObject(Class clazz, Serializable id);
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewDAO.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewDAO.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewDAO.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao;
+
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+
+public interface PeerreviewDAO extends DAO {
+
+ Peerreview getByContentId(Long contentId);
+
+ Peerreview getByUid(Long peerreviewUid);
+
+ void delete(Peerreview peerreview);
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewSessionDAO.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewSessionDAO.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewSessionDAO.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+
+public interface PeerreviewSessionDAO extends DAO {
+
+ PeerreviewSession getSessionBySessionId(Long sessionId);
+
+ List getByContentId(Long toolContentId);
+
+ void delete(PeerreviewSession session);
+
+ void deleteBySessionId(Long toolSessionId);
+
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewUserDAO.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewUserDAO.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/PeerreviewUserDAO.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,44 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+
+public interface PeerreviewUserDAO extends DAO {
+
+ PeerreviewUser getUserByUserIDAndSessionID(Long userID, Long sessionId);
+
+ PeerreviewUser getUserByUserIDAndContentID(Long userId, Long contentId);
+
+ List getBySessionID(Long sessionId);
+
+ List getByContentId(Long toolContentId);
+
+ int getCountUsersBySession(final Long toolSessionId, final Long excludeUserId);
+
+ List getUsersForTablesorter(final Long toolSessionId, final Long excludeUserId, int page, int size,
+ int sorting);
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/BaseDAOHibernate.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/BaseDAOHibernate.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/BaseDAOHibernate.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,72 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao.hibernate;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.lamsfoundation.lams.tool.peerreview.dao.DAO;
+import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
+/**
+ * This class serves as the Base class for all other DAOs - namely to hold
+ * common methods that they might all use. Can be used for standard CRUD
+ * operations.
+ *
+ * @author Dapeng.Ni
+ */
+public class BaseDAOHibernate extends HibernateDaoSupport implements DAO {
+ protected final Log log = LogFactory.getLog(getClass());
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#saveObject(java.lang.Object)
+ */
+ public void saveObject(Object o) {
+ getHibernateTemplate().saveOrUpdate(o);
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#getObject(java.lang.Class, java.io.Serializable)
+ */
+ public Object getObject(Class clazz, Serializable id) {
+ Object o = getHibernateTemplate().get(clazz, id);
+ return o;
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#getObjects(java.lang.Class)
+ */
+ public List getObjects(Class clazz) {
+ return getHibernateTemplate().loadAll(clazz);
+ }
+
+ /**
+ * @see com.edgenius.paradise.dao.DAO#removeObject(java.lang.Class, java.io.Serializable)
+ */
+ public void removeObject(Class clazz, Serializable id) {
+ getHibernateTemplate().delete(getObject(clazz, id));
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewDAOHibernate.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewDAOHibernate.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewDAOHibernate.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,56 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao.hibernate;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewDAO;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+
+/**
+ *
+ * @author Steve.Ni
+ *
+ * @version $Revision$
+ */
+public class PeerreviewDAOHibernate extends BaseDAOHibernate implements PeerreviewDAO{
+ private static final String GET_RESOURCE_BY_CONTENTID = "from "+Peerreview.class.getName()+" as r where r.contentId=?";
+
+ public Peerreview getByContentId(Long contentId) {
+ List list = getHibernateTemplate().find(GET_RESOURCE_BY_CONTENTID,contentId);
+ if(list.size() > 0)
+ return (Peerreview) list.get(0);
+ else
+ return null;
+ }
+
+ public Peerreview getByUid(Long peerreviewUid) {
+ return (Peerreview) getObject(Peerreview.class,peerreviewUid);
+ }
+
+ public void delete(Peerreview peerreview) {
+ this.getHibernateTemplate().delete(peerreview);
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewSessionDAOHibernate.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewSessionDAOHibernate.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewSessionDAOHibernate.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,54 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao.hibernate;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewSessionDAO;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+
+
+public class PeerreviewSessionDAOHibernate extends BaseDAOHibernate implements PeerreviewSessionDAO{
+
+ private static final String FIND_BY_SESSION_ID = "from " + PeerreviewSession.class.getName() + " as p where p.sessionId=?";
+ private static final String FIND_BY_CONTENT_ID = "from " + PeerreviewSession.class.getName() + " as p where p.peerreview.contentId=?";
+
+ public PeerreviewSession getSessionBySessionId(Long sessionId) {
+ List list = getHibernateTemplate().find(FIND_BY_SESSION_ID,sessionId);
+ if(list == null || list.size() == 0)
+ return null;
+ return (PeerreviewSession) list.get(0);
+ }
+ public List getByContentId(Long toolContentId) {
+ return getHibernateTemplate().find(FIND_BY_CONTENT_ID,toolContentId);
+ }
+
+ public void delete(PeerreviewSession session) {
+ this.getHibernateTemplate().delete(session);
+ }
+ public void deleteBySessionId(Long toolSessionId) {
+ this.removeObject(PeerreviewSession.class,toolSessionId);
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewUserDAOHibernate.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewUserDAOHibernate.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dao/hibernate/PeerreviewUserDAOHibernate.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,109 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.dao.hibernate;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewUserDAO;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+
+public class PeerreviewUserDAOHibernate extends BaseDAOHibernate implements PeerreviewUserDAO {
+
+ private static final String FIND_BY_USER_ID_CONTENT_ID = "FROM " + PeerreviewUser.class.getName()
+ + " AS u WHERE u.userId =? AND u.peerreview.contentId=?";
+ private static final String FIND_BY_USER_ID_SESSION_ID = "FROM " + PeerreviewUser.class.getName()
+ + " AS u WHERE u.userId =? AND u.session.sessionId=?";
+ private static final String FIND_BY_SESSION_ID = "FROM " + PeerreviewUser.class.getName()
+ + " AS u WHERE u.session.sessionId=?";
+
+ private static final String FIND_BY_CONTENT_ID = "FROM " + PeerreviewUser.class.getName()
+ + " AS u WHERE u.session.peerreview.contentId=?";
+
+ private static final String GET_COUNT_USERS_FOR_SESSION = "SELECT COUNT(*) FROM " + PeerreviewUser.class.getName()
+ + " AS r WHERE r.session.sessionId=? AND r.userId!=?";
+
+ private static final String LOAD_USERS_FOR_SESSION_LIMIT = "FROM user in class PeerreviewUser "
+ + "WHERE user.session.sessionId=:toolSessionId AND user.userId!=:excludeUserId order by ";
+
+ @Override
+ public PeerreviewUser getUserByUserIDAndSessionID(Long userID, Long sessionId) {
+ List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_SESSION_ID, new Object[] { userID, sessionId });
+ if (list == null || list.size() == 0)
+ return null;
+ return (PeerreviewUser) list.get(0);
+ }
+
+ @Override
+ public PeerreviewUser getUserByUserIDAndContentID(Long userId, Long contentId) {
+ List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_CONTENT_ID, new Object[] { userId, contentId });
+ if (list == null || list.size() == 0)
+ return null;
+ return (PeerreviewUser) list.get(0);
+ }
+
+ @Override
+ public List getBySessionID(Long sessionId) {
+ return this.getHibernateTemplate().find(FIND_BY_SESSION_ID, sessionId);
+ }
+
+ @Override
+ public List getByContentId(Long toolContentId) {
+ return this.getHibernateTemplate().find(FIND_BY_CONTENT_ID, toolContentId);
+ }
+
+ @Override
+ public int getCountUsersBySession(final Long toolSessionId, final Long excludeUserId) {
+
+ List list = getHibernateTemplate().find(GET_COUNT_USERS_FOR_SESSION,
+ new Object[] { toolSessionId, excludeUserId });
+ if (list == null || list.size() == 0) {
+ return 0;
+ }
+ return ((Number) list.get(0)).intValue();
+ }
+
+ @Override
+ public List getUsersForTablesorter(final Long toolSessionId, final Long excludeUserId,
+ int page, int size, int sorting) {
+ String sortingOrder = "";
+ switch (sorting) {
+ case PeerreviewConstants.SORT_BY_NO:
+ sortingOrder = "user.userId";
+ break;
+ case PeerreviewConstants.SORT_BY_USERNAME_ASC:
+ sortingOrder = "user.firstName ASC";
+ break;
+ case PeerreviewConstants.SORT_BY_USERNAME_DESC:
+ sortingOrder = "user.firstName DESC";
+ break;
+ }
+
+ return getSession().createQuery(LOAD_USERS_FOR_SESSION_LIMIT + sortingOrder)
+ .setLong("toolSessionId", toolSessionId.longValue())
+ .setLong("excludeUserId", excludeUserId.longValue()).setFirstResult(page * size).setMaxResults(size)
+ .list();
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dbupdates/autopatchContext.xml
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dbupdates/autopatchContext.xml (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dbupdates/autopatchContext.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/GroupSummary.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/GroupSummary.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/GroupSummary.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview.dto;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class GroupSummary {
+
+ private Long sessionId;
+ private String sessionName;
+
+ public Long getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+}
+
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/ReflectDTO.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/ReflectDTO.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/dto/ReflectDTO.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,80 @@
+package org.lamsfoundation.lams.tool.peerreview.dto;
+
+import java.util.Date;
+
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+
+/**
+ * @author Dapeng Ni
+ */
+public class ReflectDTO {
+ private Long userUid;
+ private String fullName;
+ private String loginName;
+ private String reflectInstrctions;
+ private boolean finishReflection;
+ private String reflect;
+ private Date date;
+
+ public ReflectDTO(PeerreviewUser user) {
+ this.setLoginName(user.getLoginName());
+ this.setFullName(user.getFirstName() + " " + user.getLastName());
+ this.setUserUid(user.getUid());
+ }
+
+ public boolean isFinishReflection() {
+ return finishReflection;
+ }
+
+ public void setFinishReflection(boolean finishReflection) {
+ this.finishReflection = finishReflection;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getLoginName() {
+ return loginName;
+ }
+
+ public void setLoginName(String loginName) {
+ this.loginName = loginName;
+ }
+
+ public String getReflect() {
+ return reflect;
+ }
+
+ public void setReflect(String reflect) {
+ this.reflect = reflect;
+ }
+
+ public String getReflectInstrctions() {
+ return reflectInstrctions;
+ }
+
+ public void setReflectInstrctions(String reflectInstrctions) {
+ this.reflectInstrctions = reflectInstrctions;
+ }
+
+ public Long getUserUid() {
+ return userUid;
+ }
+
+ public void setUserUid(Long userUid) {
+ this.userUid = userUid;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IContentPackageConverter.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IContentPackageConverter.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IContentPackageConverter.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,64 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.ims;
+
+/**
+ * A ContentPackageConverter converts an IMS Content Package into the
+ * data needed for our tool. The only implementation initially done was
+ * SimpleContentPackageCoverter.
+ *
+ * The creation method of the converter (which is unique to each converter)
+ * will need to parse the package and have the data ready for the "get"
+ * calls.
+ *
+ * Note: Classes that implement this interface should be normal POJOS,
+ * not singletons. This allows them to have instance data.
+ */
+public interface IContentPackageConverter {
+
+ /**
+ * @return Returns the defaultItem.
+ */
+ public abstract String getDefaultItem();
+
+ /**
+ * @return Returns the description.
+ */
+ public abstract String getDescription();
+
+ /**
+ * @return Returns the organzationXML.
+ */
+ public abstract String getOrganzationXML();
+
+ /**
+ * @return Returns the schema.
+ */
+ public abstract String getSchema();
+
+ /**
+ * @return Returns the title.
+ */
+ public abstract String getTitle();
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IMSManifestException.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IMSManifestException.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/IMSManifestException.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,64 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.ims;
+
+/**
+ * This exception is thrown when an error occurs that may be related to
+ * the formatting of the IMS content package. e.g. the manifest file
+ * is missing.
+ *
+ * @author Fiona Malikoff
+ */
+public class IMSManifestException extends ImscpApplicationException {
+
+ /**
+ *
+ */
+ public IMSManifestException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public IMSManifestException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public IMSManifestException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public IMSManifestException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/ImscpApplicationException.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/ImscpApplicationException.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/ImscpApplicationException.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,61 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.ims;
+
+/**
+ * Generic exception for the imscr tool.
+ * @author Fiona Malikoff
+ */
+public class ImscpApplicationException extends Exception {
+
+ /**
+ *
+ */
+ public ImscpApplicationException() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ */
+ public ImscpApplicationException(String arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ */
+ public ImscpApplicationException(Throwable arg0) {
+ super(arg0);
+ }
+
+ /**
+ * @param arg0
+ * @param arg1
+ */
+ public ImscpApplicationException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/OrganizationXMLDef.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/OrganizationXMLDef.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/OrganizationXMLDef.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,42 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.ims;
+
+/**
+ * This contains the "tag" of items in the organization xml. May be used
+ * by JSP pages to get the tag names right!
+ *
+ * @author Fiona Malikoff
+ */
+public final class OrganizationXMLDef {
+
+ public static final String DEFAULT = "default";
+ public static final String ITEM = "item";
+ public static final String PARAMETERS = "parameters";
+ public static final String HREF = "href";
+ public static final String IDENTIFIER = "identifier";
+ public static final String RESOURCE = "peerreview";
+ public static final String TITLE = "title";
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/SimpleContentPackageConverter.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/SimpleContentPackageConverter.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/ims/SimpleContentPackageConverter.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,492 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.ims;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.Namespace;
+
+import uk.ac.reload.jdom.XMLDocument;
+import uk.ac.reload.jdom.XMLPath;
+import uk.ac.reload.jdom.XMLUtils;
+import uk.ac.reload.moonunit.contentpackaging.CP_Core;
+
+/**
+ * SimpleContentPackageConverter contains the code required for
+ * parsing the IMS Content Package and converting the info into our
+ * own structures.
+ *
+ * Note: this class has instance data, so do not use it as a singleton.
+ *
+ * @author Fiona Malikoff
+ */
+public class SimpleContentPackageConverter implements IContentPackageConverter {
+
+ private Logger log = Logger.getLogger(SimpleContentPackageConverter.class);
+
+ // manifestDoc and cpCore are set up in the constructor. They are then used
+ // to generate the rest of the values
+ private XMLDocument manifestDoc = null;
+ private CP_Core cpCore = null;
+
+ private String schema=null;
+ private String title=null;
+ private String description=null;
+ private String defaultItem=null;
+ private String organzationXML=null;
+
+ // cachedPeerreviewList is used to avoid building up the list
+ // every time an item is parsed - otherwise there is a lot
+ // of processing done by the reload code time and time again.
+ private Element[] cachedPeerreviewList = null;
+
+ /** Set up a package converter, using the supplied directory as the package.
+ * The package should be parsed automatically and the values readied for calls
+ * to getSchema(), getTitle(), etc.
+ *
+ * @param directoryName: directory containing an expanded IMS content package.
+ * @throws IMSManifestException if there is an error in parsing the manifest file
+ * due to an error in the file or an unexpected value.
+ * @throws ImscpApplicationException if there is any other error
+ */
+ public SimpleContentPackageConverter(String directoryName)
+ throws IMSManifestException, ImscpApplicationException {
+
+ this.manifestDoc = getDocument(directoryName);
+ this.cpCore = new CP_Core(manifestDoc);
+
+ // initialise the property file required for the reload code. Needed to make
+ // the metadata call work. If we remove the metadata call, then this constructor
+ // may be removed.
+ System.setProperty("editor.properties.file", "uk.ac.reload.editor.properties.rb");
+
+ parsePackage();
+ }
+
+ /** Parse IMS content package expanded out
+ * into the supplied directory. Note: the manifest file is expected to be in the
+ * root of the supplied directory.
+ *
+ * @throws ImscpApplicationException
+ * @throws IMSManifestException
+ */
+ private void parsePackage( ) throws IMSManifestException, ImscpApplicationException {
+
+ String schemaText = getText(manifestDoc, "//metadata/schema");
+ String schemaVersion = getText(manifestDoc, "//metadata/schemaversion");
+ this.schema = ( schemaText != null ? schemaText : "unknown" )
+ + " " + ( schemaVersion != null ? schemaVersion : "unknown") ;
+
+ Document orgs = buildOrganisationList();
+ if ( orgs == null ) {
+ String error = "Unable to convert organizations from manifest file to our own structure. Reason unknown - buildOrganisationList returned null";
+ log.error(error);
+ throw new ImscpApplicationException(error);
+ }
+
+ try {
+ this.organzationXML = XMLUtils.write2XMLString(orgs);
+ } catch ( IOException ioe ) {
+ String error = "Exception thrown converting organization structure (as document) to an XML string."+ioe.getMessage();
+ log.error(error,ioe);
+ throw new ImscpApplicationException(error,ioe);
+ }
+
+ XMLPath xmlPath = new XMLPath("//metadata/*:lom/*:general/*:title/*:langstring");
+ this.title = getMetaValue(xmlPath);
+ if ( this.title == null ) {
+ // try the old root name - untested
+ xmlPath = new XMLPath("//metadata/*:record/*:general/*:title/*:langstring");
+ this.title = getMetaValue(xmlPath);
+ }
+
+ xmlPath = new XMLPath("//metadata/*:lom/*:general/*:description/*:langstring");
+ this.description = getMetaValue(xmlPath);
+ if ( this.description == null ) {
+ // try the old root name - untested
+ xmlPath = new XMLPath("//metadata/*:record/*:general/*:description/*:langstring");
+ this.description = getMetaValue(xmlPath);
+ }
+
+ }
+
+
+ /**
+ * Finds a value at the given xmlPath. If only one element, uses that value.
+ * If more than one element, tries to find an English value.
+ * @param xmlPath
+ * @return Value of the element found at xmlPath.
+ */
+ private String getMetaValue(XMLPath xmlPath) {
+ Element[] elList = manifestDoc.getElements(xmlPath);
+ String value = null;
+ if ( elList != null ) {
+ if ( elList.length == 0 ) {
+ value="Unknown";
+ } else if ( elList.length == 1 ) {
+ value=elList[0].getTextTrim();
+ } else {
+ value = null;
+ // TODO check if it is really testing for english
+ for ( int i=0; value == null && i < elList.length; i++ ) {
+ // grab the first English one
+ Element el = elList[i];
+ String attrValue = el.getAttributeValue("lang", Namespace.XML_NAMESPACE );
+ if ( attrValue != null && attrValue.startsWith("en") ) {
+ value = el.getTextTrim();
+ }
+ }
+ if ( value == null ) {
+ // can't seem to find an English one, just pick the first
+ value=elList[0].getTextTrim();
+ }
+ }
+ }
+ return value;
+ }
+
+ /* Get the text for this element - expect only 1 */
+ private String getText(XMLDocument document, String xmlPathString ) {
+ XMLPath xmlPath = new XMLPath(xmlPathString);
+ Element el = document.getElement(xmlPath);
+ return el != null ? el.getTextTrim() : null;
+ }
+
+ private String debug(XMLDocument document, String param, String xmlPathString ) {
+ XMLPath xmlPath = new XMLPath(xmlPathString);
+ Element[]elList = document.getElements(xmlPath);
+ if ( elList != null ) {
+ log.error(param+" xp: length "+elList.length+" el "+elList);
+ if ( elList.length >= 1 ) {
+ log.error("text is "+elList[0].getTextTrim());
+ return elList[0].getTextTrim();
+ }
+ } else {
+ log.error(param+" xp: el is null");
+ }
+ return null;
+ }
+
+ /**
+ * @param directoryName
+ * @return
+ * @throws JDOMException
+ * @throws IOException
+ */
+ private XMLDocument getDocument(String directoryName) throws IMSManifestException {
+ try {
+ XMLDocument doc = new XMLDocument();
+ doc.loadDocument(new File(directoryName, "imsmanifest.xml"));
+ return doc;
+ } catch (JDOMException je) {
+ String error = "Parsing error occured while loading imsmanifest.xml file. Contents of file may be invalid. "+je.getMessage();
+ log.error(error, je);
+ throw new IMSManifestException(error, je);
+ } catch (FileNotFoundException e) {
+ String error = "Unable to find imsmanifest file in the package."+e.getMessage();
+ log.error(error, e);
+ throw new IMSManifestException(error, e);
+ } catch (IOException ioe) {
+ String error = "IOException occured while loading imsmanifest file. "+ioe.getMessage();
+ log.error(error, ioe);
+ throw new IMSManifestException(error, ioe);
+ }
+ }
+
+ /** Built an XML document which is a list of organisations/peerreview.
+ */
+ private Document buildOrganisationList( ) throws IMSManifestException {
+
+ Namespace nm = cpCore.getRootManifestElement().getNamespace();
+
+ Element rootElement = cpCore.getRootManifestElement();
+ Element orgsElement = rootElement.getChild(CP_Core.ORGANIZATIONS, nm);
+
+ // set up a list of all the peerreview
+
+ // now get all the organizations and set up the new XML document, combining
+ // the organization and the peerreview.
+ Element defaultOrg = cpCore.getDefaultOrganization(orgsElement);
+ String defaultOrgIdentifier = null;
+ if ( defaultOrg != null )
+ defaultOrgIdentifier = defaultOrg.getAttributeValue("identifier");
+
+ log.debug("cpCore default org id: "+defaultOrgIdentifier);
+
+ Element newRootElement = new Element("organizations");
+ setAttribute(newRootElement, "version", "imscp1");
+ Document doc = new Document(newRootElement);
+
+ Element[] orgs = cpCore.getOrganizationsAllowed(orgsElement);
+ Element initOrganizationElement =null;
+ for ( int i=0; i ratingCriterias;
+
+ // advance
+
+ private boolean lockWhenFinished;
+
+ private boolean defineLater;
+
+ private boolean contentInUse;
+
+ // general infomation
+ private Date created;
+
+ private Date updated;
+
+ private PeerreviewUser createdBy;
+
+ private int maximumRatesPerUser;
+
+ private boolean showRatingsLeftForUser;
+
+ private boolean reflectOnActivity;
+
+ private String reflectInstructions;
+
+ // **********************************************************
+ // Function method for Peerreview
+ // **********************************************************
+ public static Peerreview newInstance(Peerreview defaultContent, Long contentId) {
+ Peerreview toContent = new Peerreview();
+ toContent = (Peerreview) defaultContent.clone();
+ toContent.setContentId(contentId);
+
+ // reset contentId
+ if (toContent.getRatingCriterias() != null) {
+ Set criterias = toContent.getRatingCriterias();
+ for (LearnerItemRatingCriteria criteria : criterias) {
+ criteria.setToolContentId(contentId);
+ }
+ }
+
+ return toContent;
+ }
+
+ @Override
+ public Object clone() {
+
+ Peerreview peerreview = null;
+ try {
+ peerreview = (Peerreview) super.clone();
+ peerreview.setUid(null);
+
+ // clone ReourceUser as well
+ if (createdBy != null) {
+ peerreview.setCreatedBy((PeerreviewUser) createdBy.clone());
+ }
+
+ // clone ratingCriterias as well
+ if (ratingCriterias != null) {
+ Set newCriterias = new HashSet();
+ for (LearnerItemRatingCriteria criteria : (Set) ratingCriterias) {
+ LearnerItemRatingCriteria newCriteria = (LearnerItemRatingCriteria) criteria.clone();
+ // just clone old file without duplicate it in repository
+ newCriterias.add(newCriteria);
+ }
+ peerreview.ratingCriterias = newCriterias;
+ }
+
+ } catch (CloneNotSupportedException e) {
+ Peerreview.log.error("When clone " + Peerreview.class + " failed");
+ }
+
+ return peerreview;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof Peerreview)) {
+ return false;
+ }
+
+ final Peerreview genericEntity = (Peerreview) o;
+
+ return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title)
+ .append(instructions, genericEntity.instructions).append(created, genericEntity.created)
+ .append(updated, genericEntity.updated).append(createdBy, genericEntity.createdBy).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(title).append(instructions).append(created).append(updated)
+ .append(createdBy).toHashCode();
+ }
+
+ /**
+ * Updates the modification data for this entity.
+ */
+ public void updateModificationData() {
+
+ long now = System.currentTimeMillis();
+ if (created == null) {
+ this.setCreated(new Date(now));
+ }
+ this.setUpdated(new Date(now));
+ }
+
+ // **********************************************************
+ // get/set methods
+ // **********************************************************
+ /**
+ * Returns the object's creation date
+ *
+ * @return date
+ */
+ public Date getCreated() {
+ return created;
+ }
+
+ /**
+ * Sets the object's creation date
+ *
+ * @param created
+ */
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ /**
+ * Returns the object's date of last update
+ *
+ * @return date updated
+ */
+ public Date getUpdated() {
+ return updated;
+ }
+
+ /**
+ * Sets the object's date of last update
+ *
+ * @param updated
+ */
+ public void setUpdated(Date updated) {
+ this.updated = updated;
+ }
+
+ /**
+ * @return Returns the userid of the user who created the Share peerreview.
+ *
+ */
+ public PeerreviewUser getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * @param createdBy
+ * The userid of the user who created this Share peerreview.
+ */
+ public void setCreatedBy(PeerreviewUser createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @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 lockWhenFinish.
+ *
+ */
+ public boolean getLockWhenFinished() {
+ return lockWhenFinished;
+ }
+
+ /**
+ * @param lockWhenFinished
+ * Set to true to lock the peerreview for finished users.
+ */
+ public void setLockWhenFinished(boolean lockWhenFinished) {
+ this.lockWhenFinished = lockWhenFinished;
+ }
+
+ /**
+ * @return Returns the instructions set by the teacher.
+ */
+ public String getInstructions() {
+ return instructions;
+ }
+
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
+
+ /**
+ * @return
+ */
+ public int getMaximumRates() {
+ return maximumRates;
+ }
+
+ public void setMaximumRates(int maximumRate) {
+ this.maximumRates = maximumRate;
+ }
+
+ /**
+ * @return
+ */
+ public int getMinimumRates() {
+ return minimumRates;
+ }
+
+ public void setMinimumRates(int minimumRates) {
+ this.minimumRates = minimumRates;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Set getRatingCriterias() {
+ return ratingCriterias;
+ }
+
+ public void setRatingCriterias(Set ratingCriterias) {
+ this.ratingCriterias = ratingCriterias;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isContentInUse() {
+ return contentInUse;
+ }
+
+ public void setContentInUse(boolean contentInUse) {
+ this.contentInUse = contentInUse;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isDefineLater() {
+ return defineLater;
+ }
+
+ public void setDefineLater(boolean defineLater) {
+ this.defineLater = defineLater;
+ }
+
+ /**
+ * @return
+ */
+ public Long getContentId() {
+ return contentId;
+ }
+
+ public void setContentId(Long contentId) {
+ this.contentId = contentId;
+ }
+
+ /**
+ * @return
+ */
+ public int getMaximumRatesPerUser() {
+ return maximumRatesPerUser;
+ }
+
+ public void setMaximumRatesPerUser(int maximumRatesPerUser) {
+ this.maximumRatesPerUser = maximumRatesPerUser;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isShowRatingsLeftForUser() {
+ return showRatingsLeftForUser;
+ }
+
+ public void setShowRatingsLeftForUser(boolean showRatingsLeftForUser) {
+ this.showRatingsLeftForUser = showRatingsLeftForUser;
+ }
+
+ /**
+ * @return
+ */
+ public String getReflectInstructions() {
+ return reflectInstructions;
+ }
+
+ public void setReflectInstructions(String reflectInstructions) {
+ this.reflectInstructions = reflectInstructions;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isReflectOnActivity() {
+ return reflectOnActivity;
+ }
+
+ public void setReflectOnActivity(boolean reflectOnActivity) {
+ this.reflectOnActivity = reflectOnActivity;
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewSession.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewSession.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewSession.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,145 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.model;
+
+import java.util.Date;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Peerreview Session
+ *
+ * @author Dapeng Ni
+ *
+ * @hibernate.class table="tl_laprev11_session"
+ *
+ */
+public class PeerreviewSession {
+
+ private static Logger log = Logger.getLogger(PeerreviewSession.class);
+
+ private Long uid;
+ private Long sessionId;
+ private String sessionName;
+ private Peerreview peerreview;
+ private Date sessionStartDate;
+ private Date sessionEndDate;
+ // finish or not
+ private int status;
+
+ // **********************************************************
+ // Get/Set methods
+ // **********************************************************
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the learnerID.
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ public void setUid(Long uuid) {
+ this.uid = uuid;
+ }
+
+ /**
+ * @hibernate.property column="session_end_date"
+ * @return
+ */
+ public Date getSessionEndDate() {
+ return sessionEndDate;
+ }
+
+ public void setSessionEndDate(Date sessionEndDate) {
+ this.sessionEndDate = sessionEndDate;
+ }
+
+ /**
+ * @hibernate.property column="session_start_date"
+ *
+ * @return
+ */
+ public Date getSessionStartDate() {
+ return sessionStartDate;
+ }
+
+ public void setSessionStartDate(Date sessionStartDate) {
+ this.sessionStartDate = sessionStartDate;
+ }
+
+ /**
+ * @hibernate.property
+ * @return
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ /**
+ * @hibernate.many-to-one column="peerreview_uid" cascade="none"
+ * @return
+ */
+ public Peerreview getPeerreview() {
+ return peerreview;
+ }
+
+ public void setPeerreview(Peerreview peerreview) {
+ this.peerreview = peerreview;
+ }
+
+ /**
+ * @hibernate.property column="session_id"
+ * @return
+ */
+ public Long getSessionId() {
+ return sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * @hibernate.property column="session_name" length="250"
+ * @return Returns the session name
+ */
+ public String getSessionName() {
+ return sessionName;
+ }
+
+ /**
+ *
+ * @param sessionName
+ * The session name to set.
+ */
+ public void setSessionName(String sessionName) {
+ this.sessionName = sessionName;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewUser.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewUser.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/model/PeerreviewUser.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,252 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+
+/**
+ * Peerreview User
+ *
+ * @author Dapeng Ni
+ *
+ * @hibernate.class table="tl_laprev11_user"
+ *
+ */
+public class PeerreviewUser implements Cloneable {
+ private static final long serialVersionUID = -7043502180037866257L;
+ private static Logger log = Logger.getLogger(PeerreviewUser.class);
+
+ private Long uid;
+ private Long userId;
+ private String firstName;
+ private String lastName;
+ private String loginName;
+ private boolean sessionFinished;
+
+ private PeerreviewSession session;
+ private Peerreview peerreview;
+
+ // =============== NON Persisit value: for display use ===========
+ // the user access some reousrce item date time. Use in monitoring summary page
+ private Date accessDate;
+ // peerreview item complete date. Use in monitoring summary page
+ private Date completeDate;
+ // difference between completeDate and accessDate
+ private Date timeTaken;
+
+ public PeerreviewUser() {
+ }
+
+ public PeerreviewUser(UserDTO user, PeerreviewSession session) {
+ this.userId = new Long(user.getUserID().intValue());
+ this.firstName = user.getFirstName();
+ this.lastName = user.getLastName();
+ this.loginName = user.getLogin();
+ this.session = session;
+ this.peerreview = null;
+ this.sessionFinished = false;
+ }
+
+ public PeerreviewUser(UserDTO user, Peerreview content) {
+ this.userId = new Long(user.getUserID().intValue());
+ this.firstName = user.getFirstName();
+ this.lastName = user.getLastName();
+ this.loginName = user.getLogin();
+ this.session = null;
+ this.peerreview = content;
+ this.sessionFinished = false;
+ }
+
+ /**
+ * Clone method from java.lang.Object
+ */
+ public Object clone() {
+
+ PeerreviewUser user = null;
+ try {
+ user = (PeerreviewUser) super.clone();
+ user.setUid(null);
+ // never clone session
+ user.setSession(null);
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + PeerreviewUser.class + " failed");
+ }
+
+ return user;
+ }
+
+ // **********************************************************
+ // Get/Set methods
+ // **********************************************************
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ /**
+ * @param uid
+ * The uid to set.
+ */
+ public void setUid(Long userID) {
+ this.uid = userID;
+ }
+
+ /**
+ * @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;
+ }
+
+ /**
+ * @hibernate.property length="255" column="last_name"
+ * @return
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ /**
+ * @hibernate.property length="255" column="first_name"
+ * @return
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ /**
+ * @hibernate.property column="login_name"
+ * @return
+ */
+ public String getLoginName() {
+ return loginName;
+ }
+
+ public void setLoginName(String loginName) {
+ this.loginName = loginName;
+ }
+
+ /**
+ * @hibernate.many-to-one column="session_uid" cascade="none"
+ * @return
+ */
+ public PeerreviewSession getSession() {
+ return session;
+ }
+
+ public void setSession(PeerreviewSession session) {
+ this.session = session;
+ }
+
+ /**
+ * @hibernate.many-to-one column="peerreview_uid" cascade="none"
+ * @return
+ */
+ public Peerreview getPeerreview() {
+ return peerreview;
+ }
+
+ public void setPeerreview(Peerreview content) {
+ this.peerreview = content;
+ }
+
+ /**
+ * @hibernate.property column="session_finished"
+ * @return
+ */
+ public boolean isSessionFinished() {
+ return sessionFinished;
+ }
+
+ public void setSessionFinished(boolean sessionFinished) {
+ this.sessionFinished = sessionFinished;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!(obj instanceof PeerreviewUser))
+ return false;
+
+ final PeerreviewUser user = (PeerreviewUser) obj;
+
+ return new EqualsBuilder().append(this.uid, user.uid).append(this.firstName, user.firstName)
+ .append(this.lastName, user.lastName).append(this.loginName, user.loginName).isEquals();
+
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(firstName).append(lastName).append(loginName).toHashCode();
+ }
+
+ public Date getAccessDate() {
+ return accessDate;
+ }
+
+ public void setAccessDate(Date accessDate) {
+ this.accessDate = accessDate;
+ }
+
+ public Date getCompleteDate() {
+ return completeDate;
+ }
+
+ public void setCompleteDate(Date completeDate) {
+ this.completeDate = completeDate;
+ }
+
+ public Date getTimeTaken() {
+ return timeTaken;
+ }
+
+ public void setTimeTaken(Date timeTaken) {
+ this.timeTaken = timeTaken;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/peerreviewApplicationContext.xml
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/peerreviewApplicationContext.xml (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/peerreviewApplicationContext.xml (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+ org.lamsfoundation.lams.tool.peerreview.ApplicationResources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,-java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+ PROPAGATION_REQUIRED,+java.lang.Exception
+
+
+
+
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/IPeerreviewService.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/IPeerreviewService.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/IPeerreviewService.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,217 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.rating.ToolRatingManager;
+import org.lamsfoundation.lams.rating.dto.ItemRatingDTO;
+import org.lamsfoundation.lams.tool.peerreview.dto.GroupSummary;
+import org.lamsfoundation.lams.tool.peerreview.dto.ReflectDTO;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+
+/**
+ * Interface that defines the contract that all Peerreview service provider must follow.
+ *
+ * @author Andrey Balan
+ */
+public interface IPeerreviewService extends ToolRatingManager {
+
+ /**
+ * Get Peerreview by toolContentID.
+ *
+ * @param contentId
+ * @return
+ */
+ Peerreview getPeerreviewByContentId(Long contentId);
+
+ /**
+ * Get a cloned copy of tool default tool content (Peerreview) and assign the toolContentId of that copy as the
+ * given contentId
+ *
+ * @param contentId
+ * @return
+ * @throws PeerreviewApplicationException
+ */
+ Peerreview getDefaultContent(Long contentId) throws PeerreviewApplicationException;
+
+ // ********** for user methods *************
+ /**
+ * Create a new user in database.
+ */
+ void createUser(PeerreviewUser peerreviewUser);
+
+ List getUsersBySession(Long toolSessionId);
+
+ List getUsersByContent(Long toolContentId);
+
+ /**
+ * Get user by given userID and toolContentID.
+ *
+ * @param long1
+ * @return
+ */
+ PeerreviewUser getUserByIDAndContent(Long userID, Long contentId);
+
+ /**
+ * Get user by sessionID and UserID
+ *
+ * @param long1
+ * @param sessionId
+ * @return
+ */
+ PeerreviewUser getUserByIDAndSession(Long long1, Long sessionId);
+
+ /**
+ * Save or update peerreview into database.
+ *
+ * @param Peerreview
+ */
+ void saveOrUpdatePeerreview(Peerreview Peerreview);
+
+ /**
+ * Get peerreview which is relative with the special toolSession.
+ *
+ * @param sessionId
+ * @return
+ */
+ Peerreview getPeerreviewBySessionId(Long sessionId);
+
+ /**
+ * Get peerreview toolSession by toolSessionId
+ *
+ * @param sessionId
+ * @return
+ */
+ PeerreviewSession getPeerreviewSessionBySessionId(Long sessionId);
+
+ /**
+ * Save or update peerreview session.
+ *
+ * @param resSession
+ */
+ void saveOrUpdatePeerreviewSession(PeerreviewSession resSession);
+
+ /**
+ * Sets user.setSessionFinished(true)
+ *
+ * @param toolSessionId
+ * @param userId
+ */
+ void markUserFinished(Long toolSessionId, Long userId);
+
+ /**
+ * If success return next activity's url, otherwise return null.
+ *
+ * @param toolSessionId
+ * @param userId
+ * @return
+ */
+ String finishToolSession(Long toolSessionId, Long userId) throws PeerreviewApplicationException;
+
+ /**
+ * Return monitoring summary list. The return value is list of peerreview summaries for each groups.
+ *
+ * @param contentId
+ * @return
+ */
+ List getGroupSummaries(Long contentId);
+
+ List getUsersForTablesorter(final Long qaSessionId, final Long excludeUserId,
+ int page, int size, int sorting);
+
+ int getCountUsersBySession(final Long qaSessionId, final Long excludeUserId);
+
+ /**
+ * Create refection entry into notebook tool.
+ *
+ * @param sessionId
+ * @param notebook_tool
+ * @param tool_signature
+ * @param userId
+ * @param entryText
+ */
+ Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId,
+ String entryText);
+
+ /**
+ * Get reflection entry from notebook tool.
+ *
+ * @param sessionId
+ * @param idType
+ * @param signature
+ * @param userID
+ * @return
+ */
+ NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID);
+
+ /**
+ * @param notebookEntry
+ */
+ void updateEntry(NotebookEntry notebookEntry);
+
+ /**
+ * Get Reflect DTO list.
+ *
+ * @param contentId
+ * @return
+ */
+ List getReflectList(Long contentId);
+
+ /**
+ * Get user by UID
+ *
+ * @param uid
+ * @return
+ */
+ PeerreviewUser getUser(Long uid);
+
+ /**
+ * @param toolSessionId
+ * @return
+ */
+ List fetchUsersFromLesson(Long toolSessionId);
+
+ /**
+ * Returns whether activity is grouped and therefore it is expected more than one tool session.
+ *
+ * @param toolContentID
+ * @return
+ */
+ boolean isGroupedActivity(long toolContentID);
+
+ int getCommentsMinWordsLimit(Long toolContentId);
+
+ /**
+ * Returns item DTO with all corresponding ratings and comments. Doesn't contain average and total amount of rates.
+ *
+ * @param contentId
+ * @param itemId
+ * @return
+ */
+ ItemRatingDTO getRatingCriteriaDtoWithActualRatings(Long contentId, Long itemId);
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewApplicationException.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewApplicationException.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewApplicationException.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+public class PeerreviewApplicationException extends Exception{
+
+ public PeerreviewApplicationException() {
+ super();
+
+ }
+
+ public PeerreviewApplicationException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+ public PeerreviewApplicationException(String message) {
+ super(message);
+
+ }
+
+ public PeerreviewApplicationException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewImportContentVersionFilter.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewImportContentVersionFilter.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewImportContentVersionFilter.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,43 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+import org.lamsfoundation.lams.learningdesign.service.ToolContentVersionFilter;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+
+/**
+ * Import filter class for different version of Peerreview content.
+ */
+public class PeerreviewImportContentVersionFilter extends ToolContentVersionFilter {
+
+ /**
+ * Import 20131128 version content to 20140102 version tool server.
+ */
+ public void up20131128To20140102() {
+ this.removeField(Peerreview.class, "runOffline");
+ this.removeField(Peerreview.class, "onlineInstructions");
+ this.removeField(Peerreview.class, "offlineInstructions");
+ this.removeField(Peerreview.class, "attachments");
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceImpl.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceImpl.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceImpl.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,732 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.log4j.Logger;
+import org.apache.tomcat.util.json.JSONException;
+import org.apache.tomcat.util.json.JSONObject;
+import org.lamsfoundation.lams.learning.service.ILearnerService;
+import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException;
+import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService;
+import org.lamsfoundation.lams.learningdesign.service.ImportToolContentException;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.notebook.service.ICoreNotebookService;
+import org.lamsfoundation.lams.rating.dto.ItemRatingDTO;
+import org.lamsfoundation.lams.rating.model.RatingCriteria;
+import org.lamsfoundation.lams.rating.service.IRatingService;
+import org.lamsfoundation.lams.rest.RestTags;
+import org.lamsfoundation.lams.rest.ToolRestManager;
+import org.lamsfoundation.lams.tool.ToolContentImport102Manager;
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.ToolOutput;
+import org.lamsfoundation.lams.tool.ToolOutputDefinition;
+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.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewDAO;
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewSessionDAO;
+import org.lamsfoundation.lams.tool.peerreview.dao.PeerreviewUserDAO;
+import org.lamsfoundation.lams.tool.peerreview.dto.GroupSummary;
+import org.lamsfoundation.lams.tool.peerreview.dto.ReflectDTO;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+import org.lamsfoundation.lams.tool.peerreview.util.PeerreviewToolContentHandler;
+import org.lamsfoundation.lams.tool.service.ILamsToolService;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.usermanagement.service.IUserManagementService;
+import org.lamsfoundation.lams.util.JsonUtil;
+import org.lamsfoundation.lams.util.MessageService;
+
+/**
+ * @author Andrey Balan
+ */
+public class PeerreviewServiceImpl implements IPeerreviewService, ToolContentManager, ToolSessionManager,
+ ToolContentImport102Manager, ToolRestManager {
+ private static Logger log = Logger.getLogger(PeerreviewServiceImpl.class.getName());
+
+ private PeerreviewDAO peerreviewDao;
+
+ private PeerreviewUserDAO peerreviewUserDao;
+
+ private PeerreviewSessionDAO peerreviewSessionDao;
+
+ // tool service
+ private PeerreviewToolContentHandler peerreviewToolContentHandler;
+
+ private MessageService messageService;
+
+ // system services
+
+ private ILamsToolService toolService;
+
+ private ILearnerService learnerService;
+
+ private IUserManagementService userManagementService;
+
+ private IExportToolContentService exportContentService;
+
+ private ICoreNotebookService coreNotebookService;
+
+ private IRatingService ratingService;
+
+ // *******************************************************************************
+ // Service method
+ // *******************************************************************************
+
+ @Override
+ public Peerreview getPeerreviewByContentId(Long contentId) {
+ Peerreview rs = peerreviewDao.getByContentId(contentId);
+ if (rs == null) {
+ PeerreviewServiceImpl.log.debug("Could not find the content by given ID:" + contentId);
+ }
+ return rs;
+ }
+
+ @Override
+ public Peerreview getDefaultContent(Long contentId) throws PeerreviewApplicationException {
+ if (contentId == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ PeerreviewServiceImpl.log.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+ Peerreview defaultContent = getDefaultPeerreview();
+ // save default content by given ID.
+ Peerreview content = new Peerreview();
+ content = Peerreview.newInstance(defaultContent, contentId);
+ return content;
+ }
+
+ @Override
+ public void createUser(PeerreviewUser peerreviewUser) {
+ peerreviewUserDao.saveObject(peerreviewUser);
+ }
+
+ @Override
+ public PeerreviewUser getUserByIDAndContent(Long userId, Long contentId) {
+ return peerreviewUserDao.getUserByUserIDAndContentID(userId, contentId);
+ }
+
+ @Override
+ public PeerreviewUser getUserByIDAndSession(Long userId, Long sessionId) {
+ return peerreviewUserDao.getUserByUserIDAndSessionID(userId, sessionId);
+ }
+
+ @Override
+ public void saveOrUpdatePeerreview(Peerreview peerreview) {
+ peerreviewDao.saveObject(peerreview);
+ }
+
+ @Override
+ public Peerreview getPeerreviewBySessionId(Long sessionId) {
+ PeerreviewSession session = peerreviewSessionDao.getSessionBySessionId(sessionId);
+ // to skip CGLib problem
+ Long contentId = session.getPeerreview().getContentId();
+ Peerreview res = peerreviewDao.getByContentId(contentId);
+ return res;
+ }
+
+ @Override
+ public PeerreviewSession getPeerreviewSessionBySessionId(Long sessionId) {
+ return peerreviewSessionDao.getSessionBySessionId(sessionId);
+ }
+
+ @Override
+ public void saveOrUpdatePeerreviewSession(PeerreviewSession resSession) {
+ peerreviewSessionDao.saveObject(resSession);
+ }
+
+ @Override
+ public void markUserFinished(Long toolSessionId, Long userId) {
+ PeerreviewUser user = peerreviewUserDao.getUserByUserIDAndSessionID(userId, toolSessionId);
+ user.setSessionFinished(true);
+ peerreviewUserDao.saveObject(user);
+ }
+
+ @Override
+ public String finishToolSession(Long toolSessionId, Long userId) throws PeerreviewApplicationException {
+ markUserFinished(toolSessionId, userId);
+
+ // PeerreviewSession session = peerreviewSessionDao.getSessionBySessionId(toolSessionId);
+ // session.setStatus(PeerreviewConstants.COMPLETED);
+ // peerreviewSessionDao.saveObject(session);
+
+ String nextUrl = null;
+ try {
+ nextUrl = this.leaveToolSession(toolSessionId, userId);
+ } catch (DataMissingException e) {
+ throw new PeerreviewApplicationException(e);
+ } catch (ToolException e) {
+ throw new PeerreviewApplicationException(e);
+ }
+ return nextUrl;
+ }
+
+ @Override
+ public List getGroupSummaries(Long contentId) {
+ List groupList = new ArrayList();
+
+ // get all sessions in a peerreview and retrieve all peerreview items under this session
+ // plus initial peerreview items by author creating (resItemList)
+ List sessionList = peerreviewSessionDao.getByContentId(contentId);
+
+ for (PeerreviewSession session : sessionList) {
+ // one new group for one session.
+ GroupSummary group = new GroupSummary();
+ group.setSessionId(session.getSessionId());
+ group.setSessionName(session.getSessionName());
+
+ groupList.add(group);
+ }
+
+ return groupList;
+ }
+
+ @Override
+ public List getReflectList(Long contentId) {
+ List reflections = new LinkedList();
+
+ List sessionList = peerreviewSessionDao.getByContentId(contentId);
+ for (PeerreviewSession session : sessionList) {
+ Long sessionId = session.getSessionId();
+ // get all users in this session
+ List users = peerreviewUserDao.getBySessionID(sessionId);
+ for (PeerreviewUser user : users) {
+
+ NotebookEntry entry = getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+ if (entry != null) {
+ ReflectDTO ref = new ReflectDTO(user);
+ ref.setReflect(entry.getEntry());
+ Date postedDate = (entry.getLastModified() != null) ? entry.getLastModified() : entry
+ .getCreateDate();
+ ref.setDate(postedDate);
+ reflections.add(ref);
+ }
+
+ }
+
+ }
+
+ return reflections;
+ }
+
+ @Override
+ public List getUsersForTablesorter(final Long toolSessionId, final Long excludeUserId,
+ int page, int size, int sorting) {
+ return peerreviewUserDao.getUsersForTablesorter(toolSessionId, excludeUserId, page, size, sorting);
+ }
+
+ @Override
+ public int getCountUsersBySession(final Long toolSessionId, final Long excludeUserId) {
+ return peerreviewUserDao.getCountUsersBySession(toolSessionId, excludeUserId);
+ }
+
+ @Override
+ public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId,
+ String entryText) {
+ return coreNotebookService.createNotebookEntry(sessionId, notebookToolType, toolSignature, userId, "",
+ entryText);
+ }
+
+ @Override
+ public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID) {
+ List list = coreNotebookService.getEntry(sessionId, idType, signature, userID);
+ if (list == null || list.isEmpty()) {
+ return null;
+ } else {
+ return list.get(0);
+ }
+ }
+
+ @Override
+ public void updateEntry(NotebookEntry notebookEntry) {
+ coreNotebookService.updateEntry(notebookEntry);
+ }
+
+ @Override
+ public PeerreviewUser getUser(Long uid) {
+ return (PeerreviewUser) peerreviewUserDao.getObject(PeerreviewUser.class, uid);
+ }
+
+ @Override
+ public List getUsersBySession(Long toolSessionId) {
+ return peerreviewUserDao.getBySessionID(toolSessionId);
+ }
+
+ @Override
+ public List getUsersByContent(Long toolContentId) {
+ return peerreviewUserDao.getByContentId(toolContentId);
+ }
+
+ @Override
+ public List fetchUsersFromLesson(Long toolSessionId) {
+ //can we change lesson's class?
+ //boolean isGroupedActivity = isGroupedActivity(toolContentId);
+
+ PeerreviewSession session = getPeerreviewSessionBySessionId(toolSessionId);
+ Set lessonUsers = toolService.getUsersFromGroupingActivity(toolSessionId);
+ List sessionUsers = peerreviewUserDao.getBySessionID(toolSessionId);
+
+ //create all new users
+ for (User lessonUser: lessonUsers) {
+
+ boolean isCorrespondingUserExist = false;
+ for (PeerreviewUser sessionUser: sessionUsers) {
+ if (lessonUser.getUserId().longValue() == sessionUser.getUserId().longValue()) {
+ isCorrespondingUserExist = true;
+ break;
+ }
+ }
+
+ if (!isCorrespondingUserExist) {
+ PeerreviewUser newUser = new PeerreviewUser(lessonUser.getUserDTO(), session);
+ createUser(newUser);
+ }
+
+ }
+
+ return sessionUsers;
+ }
+
+ // *****************************************************************************
+ // private methods
+ // *****************************************************************************
+ private Peerreview getDefaultPeerreview() throws PeerreviewApplicationException {
+ Long defaultPeerreviewId = getToolDefaultContentIdBySignature(PeerreviewConstants.TOOL_SIGNATURE);
+ Peerreview defaultPeerreview = getPeerreviewByContentId(defaultPeerreviewId);
+ if (defaultPeerreview == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ PeerreviewServiceImpl.log.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+ return defaultPeerreview;
+ }
+
+ private Long getToolDefaultContentIdBySignature(String toolSignature) throws PeerreviewApplicationException {
+ Long contentId = null;
+ contentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature));
+ if (contentId == null) {
+ String error = messageService.getMessage("error.msg.default.content.not.find");
+ PeerreviewServiceImpl.log.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+ return contentId;
+ }
+
+ @Override
+ public boolean isGroupedActivity(long toolContentID) {
+ return toolService.isGroupedActivity(toolContentID);
+ }
+
+ // *******************************************************************************
+ // ToolContentManager, ToolSessionManager methods
+ // *******************************************************************************
+
+ @Override
+ public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException {
+ Peerreview toolContentObj = peerreviewDao.getByContentId(toolContentId);
+ if (toolContentObj == null) {
+ try {
+ toolContentObj = getDefaultPeerreview();
+ } catch (PeerreviewApplicationException e) {
+ throw new DataMissingException(e.getMessage());
+ }
+ }
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to find default content for the peerreview tool");
+ }
+
+ // set PeerreviewToolContentHandler as null to avoid copy file node in repository again.
+ toolContentObj = Peerreview.newInstance(toolContentObj, toolContentId);
+ try {
+ exportContentService.exportToolContent(toolContentId, toolContentObj, peerreviewToolContentHandler,
+ rootPath);
+ } catch (ExportToolContentException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ @Override
+ public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion,
+ String toVersion) throws ToolException {
+
+ try {
+ // register version filter class
+ exportContentService.registerImportVersionFilterClass(PeerreviewImportContentVersionFilter.class);
+
+ Object toolPOJO = exportContentService.importToolContent(toolContentPath, peerreviewToolContentHandler,
+ fromVersion, toVersion);
+ if (!(toolPOJO instanceof Peerreview)) {
+ throw new ImportToolContentException(
+ "Import Share peerreview tool content failed. Deserialized object is " + toolPOJO);
+ }
+ Peerreview toolContentObj = (Peerreview) toolPOJO;
+
+ // reset it to new toolContentId
+ toolContentObj.setContentId(toolContentId);
+ PeerreviewUser user = peerreviewUserDao.getUserByUserIDAndContentID(new Long(newUserUid.longValue()),
+ toolContentId);
+ if (user == null) {
+ user = new PeerreviewUser();
+ UserDTO sysUser = ((User) userManagementService.findById(User.class, newUserUid)).getUserDTO();
+ user.setFirstName(sysUser.getFirstName());
+ user.setLastName(sysUser.getLastName());
+ user.setLoginName(sysUser.getLogin());
+ user.setUserId(new Long(newUserUid.longValue()));
+ user.setPeerreview(toolContentObj);
+ }
+ toolContentObj.setCreatedBy(user);
+
+ peerreviewDao.saveObject(toolContentObj);
+ } catch (ImportToolContentException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ @Override
+ public SortedMap getToolOutputDefinitions(Long toolContentId, int definitionType)
+ throws ToolException {
+ return new TreeMap();
+ }
+
+ @Override
+ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException {
+ if (toContentId == null) {
+ throw new ToolException("Failed to create the PeerreviewFiles tool seession");
+ }
+
+ Peerreview peerreview = null;
+ if (fromContentId != null) {
+ peerreview = peerreviewDao.getByContentId(fromContentId);
+ }
+ if (peerreview == null) {
+ try {
+ peerreview = getDefaultPeerreview();
+ } catch (PeerreviewApplicationException e) {
+ throw new ToolException(e);
+ }
+ }
+
+ Peerreview toContent = Peerreview.newInstance(peerreview, toContentId);
+ peerreviewDao.saveObject(toContent);
+ }
+
+ @Override
+ public String getToolContentTitle(Long toolContentId) {
+ return getPeerreviewByContentId(toolContentId).getTitle();
+ }
+
+ @Override
+ public void resetDefineLater(Long toolContentId) throws DataMissingException, ToolException {
+ Peerreview peerreview = peerreviewDao.getByContentId(toolContentId);
+ if (peerreview == null) {
+ throw new ToolException("No found tool content by given content ID:" + toolContentId);
+ }
+ peerreview.setDefineLater(false);
+ }
+
+ @Override
+ public boolean isContentEdited(Long toolContentId) {
+ return getPeerreviewByContentId(toolContentId).isDefineLater();
+ }
+
+ @Override
+ public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException,
+ ToolException {
+ Peerreview peerreview = peerreviewDao.getByContentId(toolContentId);
+ if (removeSessionData) {
+ List list = peerreviewSessionDao.getByContentId(toolContentId);
+ Iterator iter = list.iterator();
+ while (iter.hasNext()) {
+ PeerreviewSession session = (PeerreviewSession) iter.next();
+ peerreviewSessionDao.delete(session);
+ }
+ }
+ peerreviewDao.delete(peerreview);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void removeLearnerContent(Long toolContentId, Integer userId) throws ToolException {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing Peerreview content for user ID " + userId + " and toolContentId " + toolContentId);
+ }
+
+ Peerreview peerreview = peerreviewDao.getByContentId(toolContentId);
+ if (peerreview == null) {
+ log.warn("Did not find activity with toolContentId: " + toolContentId + " to remove learner content");
+ return;
+ }
+
+ List sessions = peerreviewSessionDao.getByContentId(toolContentId);
+ for (PeerreviewSession session : sessions) {
+ PeerreviewUser user = peerreviewUserDao.getUserByUserIDAndSessionID(userId.longValue(),
+ session.getSessionId());
+ if (user != null) {
+ NotebookEntry entry = getEntry(session.getSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, userId);
+ if (entry != null) {
+ peerreviewDao.removeObject(NotebookEntry.class, entry.getUid());
+ }
+
+ peerreviewUserDao.removeObject(PeerreviewUser.class, user.getUid());
+ }
+ }
+ }
+
+ @Override
+ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException {
+ PeerreviewSession session = new PeerreviewSession();
+ session.setSessionId(toolSessionId);
+ session.setSessionName(toolSessionName);
+ Peerreview peerreview = peerreviewDao.getByContentId(toolContentId);
+ session.setPeerreview(peerreview);
+ peerreviewSessionDao.saveObject(session);
+ }
+
+ @Override
+ public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException {
+ if (toolSessionId == null) {
+ PeerreviewServiceImpl.log.error("Fail to leave tool Session based on null tool session id.");
+ throw new ToolException("Fail to remove tool Session based on null tool session id.");
+ }
+ if (learnerId == null) {
+ PeerreviewServiceImpl.log.error("Fail to leave tool Session based on null learner.");
+ throw new ToolException("Fail to remove tool Session based on null learner.");
+ }
+
+ PeerreviewSession session = peerreviewSessionDao.getSessionBySessionId(toolSessionId);
+ if (session != null) {
+ session.setStatus(PeerreviewConstants.COMPLETED);
+ peerreviewSessionDao.saveObject(session);
+ } else {
+ PeerreviewServiceImpl.log.error("Fail to leave tool Session.Could not find peerreview "
+ + "session by given session id: " + toolSessionId);
+ throw new DataMissingException("Fail to leave tool Session."
+ + "Could not find peerreview session by given session id: " + toolSessionId);
+ }
+ return learnerService.completeToolSession(toolSessionId, learnerId);
+ }
+
+ @Override
+ public List getRatingCriterias(Long toolContentId) {
+ return ratingService.getCriteriasByToolContentId(toolContentId);
+ }
+
+ @Override
+ public void saveRatingCriterias(HttpServletRequest request, Collection oldCriterias, Long toolContentId) {
+ ratingService.saveRatingCriterias(request, oldCriterias, toolContentId);
+ }
+
+ @Override
+ public boolean isCommentsEnabled(Long toolContentId) {
+ return ratingService.isCommentsEnabled(toolContentId);
+ }
+
+ @Override
+ public int getCommentsMinWordsLimit(Long toolContentId) {
+ return ratingService.getCommentsMinWordsLimit(toolContentId);
+ }
+
+ @Override
+ public List getRatingCriteriaDtos(Long contentId, Collection itemIds, boolean isCommentsByOtherUsersRequired, Long userId) {
+ return ratingService.getRatingCriteriaDtos(contentId, itemIds, isCommentsByOtherUsersRequired, userId);
+ }
+
+ @Override
+ public ItemRatingDTO getRatingCriteriaDtoWithActualRatings(Long contentId, Long itemId) {
+ return ratingService.getRatingCriteriaDtoWithActualRatings(contentId, itemId);
+ }
+
+ @Override
+ public int getCountItemsRatedByUser(Long toolContentId, Integer userId) {
+ return ratingService.getCountItemsRatedByUser(toolContentId, userId);
+ }
+
+ @Override
+ public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException {
+ return null;
+ }
+
+ @Override
+ public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException,
+ ToolException {
+ return null;
+ }
+
+ @Override
+ public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException {
+ peerreviewSessionDao.deleteBySessionId(toolSessionId);
+ }
+
+ @Override
+ public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) {
+ return new TreeMap();
+ }
+
+ @Override
+ public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) {
+ return null;
+ }
+
+ @Override
+ public void forceCompleteUser(Long toolSessionId, User user) {
+ // no actions required
+ }
+
+ /* ===============Methods implemented from ToolContentImport102Manager =============== */
+
+ @Override
+ public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) {
+ }
+
+ /** Set the description, throws away the title value as this is not supported in 2.0 */
+ public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException,
+ DataMissingException {
+
+ Peerreview toolContentObj = getPeerreviewByContentId(toolContentId);
+ if (toolContentObj == null) {
+ throw new DataMissingException("Unable to set reflective data titled " + title
+ + " on activity toolContentId " + toolContentId + " as the tool content does not exist.");
+ }
+
+ toolContentObj.setReflectOnActivity(Boolean.TRUE);
+ toolContentObj.setReflectInstructions(description);
+ }
+
+ public Class[] getSupportedToolOutputDefinitionClasses(int definitionType) {
+ return null;
+ }
+
+ // *****************************************************************************
+ // set methods for Spring Bean
+ // *****************************************************************************
+
+ public void setLearnerService(ILearnerService learnerService) {
+ this.learnerService = learnerService;
+ }
+
+ public void setMessageService(MessageService messageService) {
+ this.messageService = messageService;
+ }
+
+ public void setPeerreviewDao(PeerreviewDAO peerreviewDao) {
+ this.peerreviewDao = peerreviewDao;
+ }
+
+ public void setPeerreviewSessionDao(PeerreviewSessionDAO peerreviewSessionDao) {
+ this.peerreviewSessionDao = peerreviewSessionDao;
+ }
+
+ public void setPeerreviewToolContentHandler(PeerreviewToolContentHandler peerreviewToolContentHandler) {
+ this.peerreviewToolContentHandler = peerreviewToolContentHandler;
+ }
+
+ public void setPeerreviewUserDao(PeerreviewUserDAO peerreviewUserDao) {
+ this.peerreviewUserDao = peerreviewUserDao;
+ }
+
+ public void setToolService(ILamsToolService toolService) {
+ this.toolService = toolService;
+ }
+
+ public void setExportContentService(IExportToolContentService exportContentService) {
+ this.exportContentService = exportContentService;
+ }
+
+ public void setUserManagementService(IUserManagementService userManagementService) {
+ this.userManagementService = userManagementService;
+ }
+
+ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) {
+ this.coreNotebookService = coreNotebookService;
+ }
+
+ public void setRatingService(IRatingService ratingService) {
+ this.ratingService = ratingService;
+ }
+
+ // ****************** REST methods *************************
+
+ /**
+ * Used by the Rest calls to create content. Mandatory fields in toolContentJSON: title, instructions, peerreview,
+ * user fields firstName, lastName and loginName Peerreview must contain a JSONArray of JSONObject objects, which
+ * have the following mandatory fields: title, description, type. If there are instructions for a peerreview, the
+ * instructions are a JSONArray of Strings. There should be at least one peerreview object in the peerreview array.
+ */
+ @Override
+ public void createRestToolContent(Integer userID, Long toolContentID, JSONObject toolContentJSON)
+ throws JSONException {
+
+ Date updateDate = new Date();
+
+ Peerreview peerreview = new Peerreview();
+ peerreview.setContentId(toolContentID);
+ peerreview.setTitle(toolContentJSON.getString(RestTags.TITLE));
+ peerreview.setInstructions(toolContentJSON.getString(RestTags.INSTRUCTIONS));
+ peerreview.setCreated(updateDate);
+
+ peerreview.setLockWhenFinished(JsonUtil.opt(toolContentJSON, RestTags.LOCK_WHEN_FINISHED, Boolean.FALSE));
+ peerreview.setReflectOnActivity(JsonUtil.opt(toolContentJSON, RestTags.REFLECT_ON_ACTIVITY, Boolean.FALSE));
+ peerreview.setReflectInstructions(JsonUtil.opt(toolContentJSON, RestTags.REFLECT_INSTRUCTIONS, (String) null));
+
+ peerreview.setContentInUse(false);
+ peerreview.setDefineLater(false);
+
+ PeerreviewUser peerreviewUser = getUserByIDAndContent(userID.longValue(), toolContentID);
+ if (peerreviewUser == null) {
+ peerreviewUser = new PeerreviewUser();
+ peerreviewUser.setFirstName(toolContentJSON.getString("firstName"));
+ peerreviewUser.setLastName(toolContentJSON.getString("lastName"));
+ peerreviewUser.setLoginName(toolContentJSON.getString("loginName"));
+ // peerreviewUser.setPeerreview(content);
+ }
+
+ peerreview.setCreatedBy(peerreviewUser);
+
+ saveOrUpdatePeerreview(peerreview);
+
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceProxy.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceProxy.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/PeerreviewServiceProxy.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,69 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+import javax.servlet.ServletContext;
+
+import org.lamsfoundation.lams.tool.ToolContentManager;
+import org.lamsfoundation.lams.tool.ToolSessionManager;
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+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 Andrey Balan
+ */
+public class PeerreviewServiceProxy {
+ /**
+ * Return the 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 Peerreview service object.
+ */
+ public static final IPeerreviewService getPeerreviewService(ServletContext servletContext) {
+ return (IPeerreviewService) getPeerreviewDomainService(servletContext);
+ }
+
+ public static final ToolSessionManager getSessionManager(ServletContext servletContext) {
+ return (ToolSessionManager) getPeerreviewDomainService(servletContext);
+ }
+
+ public static final ToolContentManager getContentManager(ServletContext servletContext) {
+ return (ToolContentManager) getPeerreviewDomainService(servletContext);
+ }
+
+ private static Object getPeerreviewDomainService(ServletContext servletContext) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
+ return wac.getBean(PeerreviewConstants.PEERREVIEW_SERVICE);
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/UploadPeerreviewFileException.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/UploadPeerreviewFileException.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/UploadPeerreviewFileException.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,48 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.service;
+
+public class UploadPeerreviewFileException extends Exception{
+
+ public UploadPeerreviewFileException() {
+ super();
+
+ }
+
+ public UploadPeerreviewFileException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+ public UploadPeerreviewFileException(String message) {
+ super(message);
+
+ }
+
+ public UploadPeerreviewFileException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/PeerreviewToolContentHandler.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/PeerreviewToolContentHandler.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/PeerreviewToolContentHandler.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,68 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.util;
+
+import org.lamsfoundation.lams.contentrepository.client.ToolContentHandler;
+
+/**
+ * Simple client for accessing the content repository.
+ *
+ * @author Fiona Malikoff
+ */
+public class PeerreviewToolContentHandler extends ToolContentHandler {
+
+ private static String repositoryWorkspaceName = "peerreviewworkspace";
+ private static String repositoryUser = "peerreview";
+ //peerreview
+ private static char[] repositoryId = {'l','a','m','s','-','p','e','e','r','r','e','v','i','e','w'};
+
+ /**
+ *
+ */
+ public PeerreviewToolContentHandler() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryWorkspaceName()
+ */
+ public String getRepositoryWorkspaceName() {
+ return repositoryWorkspaceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryUser()
+ */
+ public String getRepositoryUser() {
+ return repositoryUser;
+ }
+
+ /* (non-Javadoc)
+ * @see org.lamsfoundation.lams.contentrepository.client.ToolContentHandler#getRepositoryId()
+ */
+ public char[] getRepositoryId() {
+ return repositoryId;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/ReflectDTOComparator.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/ReflectDTOComparator.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/util/ReflectDTOComparator.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+package org.lamsfoundation.lams.tool.peerreview.util;
+
+import java.util.Comparator;
+
+import org.lamsfoundation.lams.tool.peerreview.dto.ReflectDTO;
+
+public class ReflectDTOComparator implements Comparator {
+ public int compare(ReflectDTO o1, ReflectDTO o2) {
+ if (o1 != null && o2 != null) {
+ return o1.getFullName().compareTo(o2.getFullName());
+ } else if (o1 != null)
+ return 1;
+ else
+ return -1;
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/AuthoringAction.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/AuthoringAction.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/AuthoringAction.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,321 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.web.action;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+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.ActionMessages;
+import org.lamsfoundation.lams.authoring.web.AuthoringConstants;
+import org.lamsfoundation.lams.rating.model.RatingCriteria;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+import org.lamsfoundation.lams.tool.peerreview.service.IPeerreviewService;
+import org.lamsfoundation.lams.tool.peerreview.web.form.PeerreviewForm;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * @author Steve.Ni
+ */
+public class AuthoringAction extends Action {
+
+ private static Logger log = Logger.getLogger(AuthoringAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+
+ String param = mapping.getParameter();
+ // -----------------------Peerreview Author function
+ // ---------------------------
+ if (param.equals("start")) {
+ ToolAccessMode mode = getAccessMode(request);
+ // teacher mode "check for new" button enter.
+ if (mode != null) {
+ request.setAttribute(AttributeNames.ATTR_MODE, mode.toString());
+ } else {
+ request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.AUTHOR.toString());
+ }
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("definelater")) {
+ // update define later flag to true
+ Long contentId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ IPeerreviewService service = getPeerreviewService();
+ Peerreview peerreview = service.getPeerreviewByContentId(contentId);
+
+ peerreview.setDefineLater(true);
+ service.saveOrUpdatePeerreview(peerreview);
+
+ request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER.toString());
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("initPage")) {
+ return initPage(mapping, form, request, response);
+ }
+ if (param.equals("updateContent")) {
+ return updateContent(mapping, form, request, response);
+ }
+
+ return mapping.findForward(PeerreviewConstants.ERROR);
+ }
+
+ /**
+ * Read peerreview data from database and put them into HttpSession. It will
+ * redirect to init.do directly after this method run successfully.
+ *
+ * This method will avoid read database again and lost un-saved resouce item
+ * lost when user "refresh page",
+ *
+ * @throws ServletException
+ *
+ */
+ private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException {
+
+ // save toolContentID into HTTPSession
+ Long contentId = new Long(WebUtil.readLongParam(request, PeerreviewConstants.PARAM_TOOL_CONTENT_ID));
+
+ // get back the peerreview and item list and display them on page
+ IPeerreviewService service = getPeerreviewService();
+
+ Peerreview peerreview = null;
+ PeerreviewForm peerreviewForm = (PeerreviewForm) form;
+
+ // Get contentFolderID and save to form.
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ peerreviewForm.setContentFolderID(contentFolderID);
+
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ peerreviewForm.setSessionMapID(sessionMap.getSessionID());
+
+ try {
+ peerreview = service.getPeerreviewByContentId(contentId);
+ // if peerreview does not exist, try to use default content instead.
+ if (peerreview == null) {
+ peerreview = service.getDefaultContent(contentId);
+ }
+
+ peerreviewForm.setPeerreview(peerreview);
+ } catch (Exception e) {
+ AuthoringAction.log.error(e);
+ throw new ServletException(e);
+ }
+
+ // get rating criterias from DB
+ List ratingCriterias = service.getRatingCriterias(contentId);
+ sessionMap.put(AttributeNames.ATTR_RATING_CRITERIAS, ratingCriterias);
+
+ sessionMap.put(PeerreviewConstants.ATTR_PEERREVIEW_FORM, peerreviewForm);
+ request.getSession().setAttribute(AttributeNames.PARAM_NOTIFY_CLOSE_URL,
+ request.getParameter(AttributeNames.PARAM_NOTIFY_CLOSE_URL));
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ /**
+ * Display same entire authoring page content from HttpSession variable.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException {
+ String sessionMapID = WebUtil.readStrParam(request, PeerreviewConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ PeerreviewForm existForm = (PeerreviewForm) sessionMap.get(PeerreviewConstants.ATTR_PEERREVIEW_FORM);
+
+ PeerreviewForm peerreviewForm = (PeerreviewForm) form;
+ try {
+ PropertyUtils.copyProperties(peerreviewForm, existForm);
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+
+ ToolAccessMode mode = getAccessMode(request);
+ if (mode.isAuthor()) {
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ } else {
+ return mapping.findForward(PeerreviewConstants.DEFINE_LATER);
+ }
+ }
+
+ /**
+ * This method will persist all inforamtion in this authoring page, include
+ * all peerreview item, information etc.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws ServletException
+ */
+ private ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ PeerreviewForm peerreviewForm = (PeerreviewForm) form;
+
+ // get back sessionMAP
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(peerreviewForm.getSessionMapID());
+
+ ToolAccessMode mode = getAccessMode(request);
+
+ ActionMessages errors = validate(peerreviewForm, mapping, request);
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ if (mode.isAuthor()) {
+ return mapping.findForward("author");
+ } else {
+ return mapping.findForward("monitor");
+ }
+ }
+
+ Peerreview peerreview = peerreviewForm.getPeerreview();
+ IPeerreviewService service = getPeerreviewService();
+
+ // **********************************Get Peerreview
+ // PO*********************
+ Peerreview peerreviewPO = service.getPeerreviewByContentId(peerreviewForm.getPeerreview().getContentId());
+ if (peerreviewPO == null) {
+ // new Peerreview, create it.
+ peerreviewPO = peerreview;
+ peerreviewPO.setCreated(new Timestamp(new Date().getTime()));
+ peerreviewPO.setUpdated(new Timestamp(new Date().getTime()));
+ } else {
+ if (mode.isAuthor()) {
+ Long uid = peerreviewPO.getUid();
+ PropertyUtils.copyProperties(peerreviewPO, peerreview);
+ // get back UID
+ peerreviewPO.setUid(uid);
+ } else { // if it is Teacher, then just update basic tab content
+ // (definelater)
+ peerreviewPO.setInstructions(peerreview.getInstructions());
+ peerreviewPO.setTitle(peerreview.getTitle());
+ // change define later status
+ peerreviewPO.setDefineLater(false);
+ }
+ peerreviewPO.setUpdated(new Timestamp(new Date().getTime()));
+ }
+
+ // *******************************Handle user*******************
+ // try to get form system session
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ PeerreviewUser peerreviewUser = service.getUserByIDAndContent(new Long(user.getUserID().intValue()), peerreviewForm.getPeerreview().getContentId());
+ if (peerreviewUser == null) {
+ peerreviewUser = new PeerreviewUser(user, peerreviewPO);
+ }
+
+ peerreviewPO.setCreatedBy(peerreviewUser);
+
+ // finally persist peerreviewPO
+ service.saveOrUpdatePeerreview(peerreviewPO);
+
+ // ************************* Handle rating criterias *******************
+ Long contentId = peerreview.getContentId();
+ List oldCriterias = (List) sessionMap.get(AttributeNames.ATTR_RATING_CRITERIAS);
+ service.saveRatingCriterias(request, oldCriterias, contentId);
+
+ peerreviewForm.setPeerreview(peerreviewPO);
+
+ request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE);
+ if (mode.isAuthor()) {
+ return mapping.findForward("author");
+ } else {
+ return mapping.findForward("monitor");
+ }
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+ /**
+ * Return PeerreviewService bean.
+ */
+ private IPeerreviewService getPeerreviewService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext());
+ return (IPeerreviewService) wac.getBean(PeerreviewConstants.PEERREVIEW_SERVICE);
+ }
+
+ /**
+ * Get ToolAccessMode from HttpRequest parameters. Default value is AUTHOR
+ * mode.
+ *
+ * @param request
+ * @return
+ */
+ private ToolAccessMode getAccessMode(HttpServletRequest request) {
+ ToolAccessMode mode;
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equalsIgnoreCase(modeStr, ToolAccessMode.TEACHER.toString())) {
+ mode = ToolAccessMode.TEACHER;
+ } else {
+ mode = ToolAccessMode.AUTHOR;
+ }
+ return mode;
+ }
+
+ private ActionMessages validate(PeerreviewForm peerreviewForm, ActionMapping mapping, HttpServletRequest request) {
+ ActionMessages errors = new ActionMessages();
+ // if (StringUtils.isBlank(peerreviewForm.getPeerreview().getTitle())) {
+ // ActionMessage error = new
+ // ActionMessage("error.resource.item.title.blank");
+ // errors.add(ActionMessages.GLOBAL_MESSAGE, error);
+ // }
+
+ // define it later mode(TEACHER) skip below validation.
+ String modeStr = request.getParameter(AttributeNames.ATTR_MODE);
+ if (StringUtils.equals(modeStr, ToolAccessMode.TEACHER.toString())) {
+ return errors;
+ }
+
+ // Some other validation outside basic Tab.
+
+ return errors;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/ClearSessionAction.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/ClearSessionAction.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/ClearSessionAction.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,46 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview.web.action;
+
+import javax.servlet.http.HttpSession;
+
+import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishAction;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+
+/**
+ * This class give a chance to clear HttpSession when user save/close authoring page.
+ *
+ * @author Steve.Ni
+ */
+public class ClearSessionAction extends LamsAuthoringFinishAction {
+
+ @Override
+ public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) {
+ if (mode.isAuthor()) {
+ session.removeAttribute(customiseSessionID);
+ }
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/LearningAction.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/LearningAction.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/LearningAction.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,552 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview.web.action;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+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.ActionRedirect;
+import org.apache.tomcat.util.json.JSONArray;
+import org.apache.tomcat.util.json.JSONException;
+import org.apache.tomcat.util.json.JSONObject;
+import org.lamsfoundation.lams.learning.web.bean.ActivityPositionDTO;
+import org.lamsfoundation.lams.learning.web.util.LearningWebUtil;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.rating.dto.ItemRatingCriteriaDTO;
+import org.lamsfoundation.lams.rating.dto.ItemRatingDTO;
+import org.lamsfoundation.lams.rating.dto.RatingCommentDTO;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+import org.lamsfoundation.lams.tool.peerreview.service.IPeerreviewService;
+import org.lamsfoundation.lams.tool.peerreview.service.PeerreviewApplicationException;
+import org.lamsfoundation.lams.tool.peerreview.web.form.ReflectionForm;
+import org.lamsfoundation.lams.usermanagement.dto.UserDTO;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.session.SessionManager;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * @author Steve.Ni
+ */
+public class LearningAction extends Action {
+
+ private static Logger log = Logger.getLogger(LearningAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, JSONException {
+
+ String param = mapping.getParameter();
+ // -----------------------Peerreview Learner function ---------------------------
+ if (param.equals("start")) {
+ return start(mapping, form, request, response);
+ }
+ if (param.equals("getUsers")) {
+ return getUsers(mapping, form, request, response);
+ }
+ if (param.equals("showResults")) {
+ return showResults(mapping, form, request, response);
+ }
+ if (param.equals("finish")) {
+ return finish(mapping, form, request, response);
+ }
+
+ // ================ Reflection =======================
+ if (param.equals("newReflection")) {
+ return newReflection(mapping, form, request, response);
+ }
+ if (param.equals("submitReflection")) {
+ return submitReflection(mapping, form, request, response);
+ }
+
+ return mapping.findForward(PeerreviewConstants.ERROR);
+ }
+
+ /**
+ * Read peerreview data from database and put them into HttpSession. It will redirect to init.do directly after this
+ * method run successfully.
+ *
+ * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page",
+ *
+ */
+ private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ IPeerreviewService service = getPeerreviewService();
+
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+
+ // save toolContentID into HTTPSession
+ ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true);
+
+ Long sessionId = new Long(request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID));
+
+ request.setAttribute(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ request.setAttribute(AttributeNames.ATTR_MODE, mode);
+ request.setAttribute(PeerreviewConstants.PARAM_TOOL_SESSION_ID, sessionId);
+
+ // create user if needed
+ PeerreviewUser user = null;
+ if (mode != null && mode.isTeacher()) {
+ // monitoring mode - user is specified in URL
+ // peerreviewUser may be null if the user was force completed.
+ user = getSpecifiedUser(service, sessionId,
+ WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, false));
+ } else {
+ user = getCurrentUser(service, sessionId);
+ }
+ Long userId = user.getUserId();
+
+ Peerreview peerreview = service.getPeerreviewBySessionId(sessionId);
+
+ // get notebook entry
+ String entryText = new String();
+ NotebookEntry notebookEntry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+ if (notebookEntry != null) {
+ entryText = notebookEntry.getEntry();
+ }
+
+ // basic information
+ sessionMap.put(PeerreviewConstants.ATTR_PEERREVIEW, peerreview);
+ sessionMap.put(PeerreviewConstants.ATTR_TITLE, peerreview.getTitle());
+ sessionMap.put(PeerreviewConstants.ATTR_RESOURCE_INSTRUCTION, peerreview.getInstructions());
+ sessionMap.put(PeerreviewConstants.ATTR_LOCK_ON_FINISH, peerreview.getLockWhenFinished());
+ sessionMap.put(PeerreviewConstants.ATTR_USER, user);
+
+ sessionMap.put(PeerreviewConstants.PARAM_TOOL_SESSION_ID, sessionId);
+ sessionMap.put(AttributeNames.ATTR_MODE, mode);
+ // reflection information
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECTION_ON, peerreview.isReflectOnActivity());
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECTION_INSTRUCTION, peerreview.getReflectInstructions());
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECTION_ENTRY, entryText);
+
+ // add define later support
+ if (peerreview.isDefineLater()) {
+ return mapping.findForward("defineLater");
+ }
+
+ // handle rating criterias
+ service.fetchUsersFromLesson(sessionId);
+
+ boolean isCommentsEnabled = service.isCommentsEnabled(peerreview.getContentId());
+ sessionMap.put("isCommentsEnabled", isCommentsEnabled);
+
+ int commentsMinWordsLimit = service.getCommentsMinWordsLimit(peerreview.getContentId());
+ sessionMap.put("commentsMinWordsLimit", commentsMinWordsLimit);
+
+ // store how many items are rated
+ int countRatedUsers = service.getCountItemsRatedByUser(peerreview.getContentId(), userId.intValue());
+ sessionMap.put(AttributeNames.ATTR_COUNT_RATED_ITEMS, countRatedUsers);
+
+ // set contentInUse flag to true!
+ peerreview.setContentInUse(true);
+ peerreview.setDefineLater(false);
+ service.saveOrUpdatePeerreview(peerreview);
+
+ ActivityPositionDTO activityPosition = LearningWebUtil.putActivityPositionInRequestByToolSessionId(sessionId,
+ request, getServlet().getServletContext());
+ sessionMap.put(AttributeNames.ATTR_ACTIVITY_POSITION, activityPosition);
+
+ //markUser as not Finished if it's redo
+ boolean isRedo = WebUtil.readBooleanParam(request, "isRedo", false);
+ if (!mode.isTeacher() && !peerreview.getLockWhenFinished() && isRedo && user.isSessionFinished()) {
+ user.setSessionFinished(false);
+ service.createUser(user);
+ }
+ sessionMap.put("isDisabled", peerreview.getLockWhenFinished() && user.isSessionFinished() || (mode != null)
+ && mode.isTeacher());
+ sessionMap.put(PeerreviewConstants.ATTR_USER_FINISHED, user.isSessionFinished());
+
+ // show results page
+ if (user.isSessionFinished() && peerreview.isShowRatingsLeftForUser()) {
+
+ ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("showResults"));
+ redirect.addParameter(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ return redirect;
+
+ } else {
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ }
+
+ /**
+ * Displays page with user's ratings left for others and ratings others left for him.
+ */
+ private ActionForward showResults(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ IPeerreviewService service = getPeerreviewService();
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(PeerreviewConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
+ sessionMapID);
+ request.setAttribute(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+
+ ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
+ Long sessionId = (Long) sessionMap.get(PeerreviewConstants.PARAM_TOOL_SESSION_ID);
+ Peerreview peerreview = (Peerreview) sessionMap.get(PeerreviewConstants.ATTR_PEERREVIEW);
+ PeerreviewUser user = (PeerreviewUser) sessionMap.get(PeerreviewConstants.ATTR_USER);
+
+ //markUserFinished if it hasn't been done previously
+ if (!mode.isTeacher() && !user.isSessionFinished()) {
+ service.markUserFinished(sessionId, user.getUserId());
+ }
+
+ // ratings left by the user
+ List itemIds = new LinkedList();
+ List sessionUsers = service.getUsersBySession(sessionId);
+ for (PeerreviewUser userIter : sessionUsers) {
+ //excempt user himself
+ if (!user.getUserId().equals(userIter.getUserId())) {
+ itemIds.add(userIter.getUserId());
+ }
+ }
+
+ //filter out not rated by user
+ List itemRatingDtos = service.getRatingCriteriaDtos(peerreview.getContentId(), itemIds, false,
+ user.getUserId());
+ List ratedByUser = new ArrayList();
+ for (ItemRatingDTO itemRatingDto: itemRatingDtos) {
+ boolean isRatedByUser = itemRatingDto.getCommentPostedByUser() != null;
+
+ for (ItemRatingCriteriaDTO criteriaDto: itemRatingDto.getCriteriaDtos()) {
+ if (StringUtils.isNotBlank(criteriaDto.getUserRating())) {
+ isRatedByUser = true;
+ }
+ }
+
+ if (isRatedByUser) {
+ ratedByUser.add(itemRatingDto);
+ }
+ }
+ request.setAttribute("itemRatingDtos", ratedByUser);
+
+ // ratings left by others for this user
+ List userIdList = Collections.singletonList(user.getUserId());
+ List userRatingDtos = service.getRatingCriteriaDtos(peerreview.getContentId(), userIdList, true,
+ user.getUserId());
+ ItemRatingDTO userRatingDto = null;
+ if (userRatingDtos.size() == 1) {
+ userRatingDto = userRatingDtos.get(0);
+ }
+ request.setAttribute("itemRatingDto", userRatingDto);
+
+ //user name map
+ HashMap userNameMap = new HashMap();
+ for (PeerreviewUser userIter : sessionUsers) {
+ userNameMap.put(userIter.getUserId(), userIter.getFirstName() + " " + userIter.getLastName());
+ }
+ request.setAttribute("userNameMap", userNameMap);
+
+ // check whether finish lock is enabled
+ sessionMap.put(PeerreviewConstants.ATTR_FINISH_LOCK, peerreview.getLockWhenFinished());
+
+ // store how many items are rated
+ int countRatedUsers = service.getCountItemsRatedByUser(peerreview.getContentId(), user.getUserId().intValue());
+ sessionMap.put(AttributeNames.ATTR_COUNT_RATED_ITEMS, countRatedUsers);
+
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ /**
+ * Refreshes user list.
+ */
+ public ActionForward getUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse res) throws IOException, ServletException, JSONException {
+ IPeerreviewService service = getPeerreviewService();
+
+ Long toolContentId = WebUtil.readLongParam(request, "toolContentId");
+ Long toolSessionId = WebUtil.readLongParam(request, "toolSessionId");
+
+ // in case of monitoring we show all results. in case of learning - don't show results from the current user
+ boolean isMonitoring = WebUtil.readBooleanParam(request, "isMonitoring", false);
+ Long userId = isMonitoring ? -1 : WebUtil.readLongParam(request, "userId");
+
+ // paging parameters of tablesorter
+ int size = WebUtil.readIntParam(request, "size");
+ int page = WebUtil.readIntParam(request, "page");
+ Integer isSort1 = WebUtil.readIntParam(request, "column[0]", true);
+
+ int sorting = PeerreviewConstants.SORT_BY_NO;
+ if (isSort1 != null && isSort1.equals(0)) {
+ sorting = PeerreviewConstants.SORT_BY_USERNAME_ASC;
+ } else if (isSort1 != null && isSort1.equals(1)) {
+ sorting = PeerreviewConstants.SORT_BY_USERNAME_DESC;
+ }
+
+ List users = service.getUsersForTablesorter(toolSessionId, userId, page, size, sorting);
+
+ JSONObject responcedata = new JSONObject();
+ JSONArray rows = new JSONArray();
+
+ responcedata.put("total_rows", service.getCountUsersBySession(toolSessionId, userId));
+
+ // handle rating criterias
+ List itemRatingDtos = null;
+ if (!users.isEmpty()) {
+ // create itemIds list
+ List itemIds = new LinkedList();
+ for (PeerreviewUser user : users) {
+ itemIds.add(user.getUserId());
+ }
+
+ // all comments required only for monitoring
+ boolean isCommentsByOtherUsersRequired = isMonitoring;
+ itemRatingDtos = service.getRatingCriteriaDtos(toolContentId, itemIds, isCommentsByOtherUsersRequired,
+ userId);
+
+ // store how many items are rated
+ int countRatedQuestions = service.getCountItemsRatedByUser(toolContentId, userId.intValue());
+ responcedata.put(AttributeNames.ATTR_COUNT_RATED_ITEMS, countRatedQuestions);
+ }
+
+ for (PeerreviewUser user : users) {
+
+ JSONObject userRow = new JSONObject();
+ userRow.put("userId", user.getUserId().toString());
+ userRow.put("userName", StringEscapeUtils.escapeCsv(user.getFirstName() + " " + user.getLastName()));
+
+ // find corresponding itemRatingDto
+ ItemRatingDTO itemRatingDto = null;
+ for (ItemRatingDTO itemRatingDtoIter : itemRatingDtos) {
+ if (user.getUserId().equals(itemRatingDtoIter.getItemId())) {
+ itemRatingDto = itemRatingDtoIter;
+ break;
+ }
+ }
+
+ JSONArray criteriasRows = new JSONArray();
+ for (ItemRatingCriteriaDTO criteriaDto : itemRatingDto.getCriteriaDtos()) {
+ JSONObject criteriasRow = new JSONObject();
+ criteriasRow.put("ratingCriteriaId", criteriaDto.getRatingCriteria().getRatingCriteriaId());
+ criteriasRow.put("title", criteriaDto.getRatingCriteria().getTitle());
+ criteriasRow.put("averageRating", criteriaDto.getAverageRating());
+ criteriasRow.put("numberOfVotes", criteriaDto.getNumberOfVotes());
+ criteriasRow.put("userRating", criteriaDto.getUserRating());
+
+ criteriasRows.put(criteriasRow);
+ }
+ userRow.put("criteriaDtos", criteriasRows);
+
+ // handle comments
+ userRow.put("commentsCriteriaId", itemRatingDto.getCommentsCriteriaId());
+ String commentPostedByUser = itemRatingDto.getCommentPostedByUser() == null ? "" : itemRatingDto
+ .getCommentPostedByUser().getComment();
+ userRow.put("commentPostedByUser", commentPostedByUser);
+ if (itemRatingDto.getCommentDtos() != null) {
+ JSONArray comments = new JSONArray();
+ for (RatingCommentDTO commentDto : itemRatingDto.getCommentDtos()) {
+ comments.put(StringEscapeUtils.escapeCsv(commentDto.getComment()));
+ }
+ userRow.put("comments", comments);
+ }
+
+ rows.put(userRow);
+ }
+ responcedata.put("rows", rows);
+
+ res.setContentType("application/json;charset=utf-8");
+ res.getWriter().print(new String(responcedata.toString()));
+ return null;
+ }
+
+ /**
+ * Finish learning session.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get back SessionMap
+ String sessionMapID = request.getParameter(PeerreviewConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
+ sessionMapID);
+
+ // get mode and ToolSessionID from sessionMAP
+ ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
+ Long sessionId = (Long) sessionMap.get(PeerreviewConstants.PARAM_TOOL_SESSION_ID);
+
+ IPeerreviewService service = getPeerreviewService();
+ // get sessionId from HttpServletRequest
+ String nextActivityUrl = null;
+ try {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userID = new Long(user.getUserID().longValue());
+
+ nextActivityUrl = service.finishToolSession(sessionId, userID);
+ request.setAttribute(PeerreviewConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl);
+ } catch (PeerreviewApplicationException e) {
+ LearningAction.log.error("Failed get next activity url:" + e.getMessage());
+ }
+
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ /**
+ * Display empty reflection form.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ // get session value
+ String sessionMapID = WebUtil.readStrParam(request, PeerreviewConstants.ATTR_SESSION_MAP_ID);
+
+ ReflectionForm refForm = (ReflectionForm) form;
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+
+ refForm.setUserID(user.getUserID());
+ refForm.setSessionMapID(sessionMapID);
+
+ // get the existing reflection entry
+ IPeerreviewService submitFilesService = getPeerreviewService();
+
+ SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long toolSessionID = (Long) map.get(PeerreviewConstants.PARAM_TOOL_SESSION_ID);
+ NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, user.getUserID());
+
+ if (entry != null) {
+ refForm.setEntryText(entry.getEntry());
+ }
+
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ /**
+ * Submit reflection form input database.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ ReflectionForm refForm = (ReflectionForm) form;
+ Integer userId = refForm.getUserID();
+
+ String sessionMapID = WebUtil.readStrParam(request, PeerreviewConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
+ sessionMapID);
+ Long sessionId = (Long) sessionMap.get(PeerreviewConstants.PARAM_TOOL_SESSION_ID);
+
+ IPeerreviewService service = getPeerreviewService();
+
+ // check for existing notebook entry
+ NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, userId);
+
+ if (entry == null) {
+ // create new entry
+ service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, userId, refForm.getEntryText());
+ } else {
+ // update existing entry
+ entry.setEntry(refForm.getEntryText());
+ entry.setLastModified(new Date());
+ service.updateEntry(entry);
+ }
+
+ return finish(mapping, form, request, response);
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+
+ private IPeerreviewService getPeerreviewService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (IPeerreviewService) wac.getBean(PeerreviewConstants.PEERREVIEW_SERVICE);
+ }
+
+ private PeerreviewUser getCurrentUser(IPeerreviewService service, Long sessionId) {
+ // try to get form system session
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ PeerreviewUser peerreviewUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId);
+
+ if (peerreviewUser == null) {
+ PeerreviewSession session = service.getPeerreviewSessionBySessionId(sessionId);
+ peerreviewUser = new PeerreviewUser(user, session);
+ service.createUser(peerreviewUser);
+ }
+ return peerreviewUser;
+ }
+
+ private PeerreviewUser getSpecifiedUser(IPeerreviewService service, Long sessionId, Integer userId) {
+ PeerreviewUser peerreviewUser = service.getUserByIDAndSession(new Long(userId.intValue()), sessionId);
+ if (peerreviewUser == null) {
+ LearningAction.log
+ .error("Unable to find specified user for peerreview activity. Screens are likely to fail. SessionId="
+ + sessionId + " UserId=" + userId);
+ }
+ return peerreviewUser;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/MonitoringAction.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/MonitoringAction.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/action/MonitoringAction.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,327 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $Id$ */
+package org.lamsfoundation.lams.tool.peerreview.web.action;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.log4j.Logger;
+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.tomcat.util.json.JSONArray;
+import org.apache.tomcat.util.json.JSONException;
+import org.apache.tomcat.util.json.JSONObject;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.rating.dto.ItemRatingCriteriaDTO;
+import org.lamsfoundation.lams.rating.dto.ItemRatingDTO;
+import org.lamsfoundation.lams.rating.dto.RatingCommentDTO;
+import org.lamsfoundation.lams.rating.dto.RatingDTO;
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.dto.GroupSummary;
+import org.lamsfoundation.lams.tool.peerreview.dto.ReflectDTO;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewSession;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+import org.lamsfoundation.lams.tool.peerreview.service.IPeerreviewService;
+import org.lamsfoundation.lams.usermanagement.Organisation;
+import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+public class MonitoringAction extends Action {
+ public static Logger log = Logger.getLogger(MonitoringAction.class);
+
+ @Override
+ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, JSONException {
+ String param = mapping.getParameter();
+
+ request.setAttribute("initialTabId", WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true));
+
+ if (param.equals("summary")) {
+ return summary(mapping, form, request, response);
+ }
+ if (param.equals("getUsers")) {
+ return getUsers(mapping, form, request, response);
+ }
+ if (param.equals("getSubgridData")) {
+ return getSubgridData(mapping, form, request, response);
+ }
+ if (param.equals("viewReflection")) {
+ return viewReflection(mapping, form, request, response);
+ }
+
+ return mapping.findForward(PeerreviewConstants.ERROR);
+ }
+
+ private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ // initial Session Map
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ request.setAttribute(PeerreviewConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ // save contentFolderID into session
+ sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID,
+ WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID));
+
+ Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID);
+ IPeerreviewService service = getPeerreviewService();
+ List groupList = service.getGroupSummaries(contentId);
+
+ Peerreview peerreview = service.getPeerreviewByContentId(contentId);
+
+ // Create reflectList if reflection is enabled.
+ if (peerreview.isReflectOnActivity()) {
+ List relectList = service.getReflectList(contentId);
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECT_LIST, relectList);
+ }
+
+ // user name map
+ List sessionUsers = service.getUsersByContent(contentId);
+ HashMap userNameMap = new HashMap();
+ for (PeerreviewUser userIter : sessionUsers) {
+ userNameMap.put(userIter.getUserId(), userIter.getFirstName() + " " + userIter.getLastName());
+ }
+ sessionMap.put("userNameMap", userNameMap);
+
+ // cache into sessionMap
+ sessionMap.put(PeerreviewConstants.ATTR_SUMMARY_LIST, groupList);
+ sessionMap.put(PeerreviewConstants.PAGE_EDITABLE, peerreview.isContentInUse());
+ sessionMap.put(PeerreviewConstants.ATTR_PEERREVIEW, peerreview);
+ sessionMap.put(PeerreviewConstants.ATTR_TOOL_CONTENT_ID, contentId);
+ sessionMap.put(PeerreviewConstants.ATTR_IS_GROUPED_ACTIVITY, service.isGroupedActivity(contentId));
+ return mapping.findForward(PeerreviewConstants.SUCCESS);
+ }
+
+ /**
+ * Refreshes user list.
+ */
+ public ActionForward getUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse res) throws IOException, ServletException, JSONException {
+ IPeerreviewService service = getPeerreviewService();
+
+ Long toolContentId = WebUtil.readLongParam(request, "toolContentId");
+ Long toolSessionId = WebUtil.readLongParam(request, "toolSessionId");
+
+ // Getting the params passed in from the jqGrid
+ int page = WebUtil.readIntParam(request, PeerreviewConstants.PARAM_PAGE) - 1;
+ int size = WebUtil.readIntParam(request, PeerreviewConstants.PARAM_ROWS);
+ String sortOrder = WebUtil.readStrParam(request, PeerreviewConstants.PARAM_SORD);
+ String sortBy = WebUtil.readStrParam(request, PeerreviewConstants.PARAM_SIDX, true);
+
+ int sorting = PeerreviewConstants.SORT_BY_NO;
+ if (sortBy != null && sortBy.equals(PeerreviewConstants.PARAM_ROW_NAME)) {
+ if (sortOrder != null && sortOrder.equals(PeerreviewConstants.SORT_DESC)) {
+ sorting = PeerreviewConstants.SORT_BY_USERNAME_ASC;
+ } else {
+ sorting = PeerreviewConstants.SORT_BY_USERNAME_DESC;
+ }
+ }
+
+ // in case of monitoring we show all results. in case of learning - don't show results from the current user
+ Long userId = -1L;
+ List users = service.getUsersForTablesorter(toolSessionId, userId, page, size, sorting);
+
+ JSONObject responcedata = new JSONObject();
+ JSONArray rows = new JSONArray();
+
+ responcedata.put("total", "" + service.getCountUsersBySession(toolSessionId, userId));
+ responcedata.put("page", "" + page);
+ responcedata.put("records", "" + size);
+
+ // handle rating criterias
+ List itemRatingDtos = null;
+ if (!users.isEmpty()) {
+ // create itemIds list
+ List itemIds = new LinkedList();
+ for (PeerreviewUser user : users) {
+ itemIds.add(user.getUserId());
+ }
+
+ boolean isCommentsByOtherUsersRequired = false;
+ itemRatingDtos = service.getRatingCriteriaDtos(toolContentId, itemIds, isCommentsByOtherUsersRequired,
+ userId);
+ }
+
+ for (PeerreviewUser user : users) {
+ JSONArray rowData = new JSONArray();
+ rowData.put(toolSessionId);
+ rowData.put(user.getUserId());
+ rowData.put(StringEscapeUtils.escapeHtml(user.getFirstName()) + " "
+ + StringEscapeUtils.escapeHtml(user.getLastName()));
+
+ // find corresponding itemRatingDto
+ ItemRatingDTO itemRatingDto = null;
+ for (ItemRatingDTO itemRatingDtoIter : itemRatingDtos) {
+ if (user.getUserId().equals(itemRatingDtoIter.getItemId())) {
+ itemRatingDto = itemRatingDtoIter;
+ break;
+ }
+ }
+
+ String criteriasString = "";
+ for (ItemRatingCriteriaDTO criteriaDto : itemRatingDto.getCriteriaDtos()) {
+ JSONObject criteriasRow = new JSONObject();
+ criteriasRow.put("ratingCriteriaId", criteriaDto.getRatingCriteria().getRatingCriteriaId());
+ criteriasRow.put("title", criteriaDto.getRatingCriteria().getTitle());
+ criteriasRow.put("averageRating", criteriaDto.getAverageRating());
+ criteriasRow.put("numberOfVotes", criteriaDto.getNumberOfVotes());
+ criteriasRow.put("userRating", criteriaDto.getUserRating());
+
+ criteriasString += criteriaDto.getRatingCriteria().getTitle() + ": Avg rating " + criteriaDto.getAverageRating()
+ + " out of " + criteriaDto.getNumberOfVotes() + " votes ";
+ }
+ rowData.put(criteriasString);
+
+ JSONObject row = new JSONObject();
+ row.put("id", "" + user.getUserId());
+ row.put("cell", rowData);
+ rows.put(row);
+ }
+
+ responcedata.put("rows", rows);
+
+ res.setContentType("application/json;charset=utf-8");
+ res.getWriter().print(new String(responcedata.toString()));
+ return null;
+ }
+
+ private ActionForward getSubgridData(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws JSONException, IOException {
+ IPeerreviewService service = getPeerreviewService();
+ String sessionMapID = request.getParameter(PeerreviewConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
+ sessionMapID);
+ HashMap userNameMap = (HashMap) sessionMap.get("userNameMap");
+
+ Long userId = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID);
+ Long contentId = (Long) sessionMap.get(PeerreviewConstants.ATTR_TOOL_CONTENT_ID);
+
+ // ratings left by others for this user
+ ItemRatingDTO userRatingDto = service.getRatingCriteriaDtoWithActualRatings(contentId, userId);
+// request.setAttribute("itemRatingDto", userRatingDto);
+
+ JSONArray rows = new JSONArray();
+ DateFormat timeTakenFormatter = new SimpleDateFormat("H:mm:ss");
+ DateFormat dateFormatter = new SimpleDateFormat("d-MMM-yyyy h:mm a");
+ int i = 0;
+ for (ItemRatingCriteriaDTO criteriaDto : userRatingDto.getCriteriaDtos()) {
+
+ for (RatingDTO ratingDto : criteriaDto.getRatingDtos()) {
+ JSONArray userData = new JSONArray();
+ userData.put(i);
+ userData.put(ratingDto.getLearner().getFirstName() + " " + ratingDto.getLearner().getLastName());
+ userData.put(ratingDto.getRating());
+ String title = criteriaDto.getRatingCriteria().getTitle();
+ userData.put(title);
+
+ JSONObject userRow = new JSONObject();
+ userRow.put("id", i++);
+ userRow.put("cell", userData);
+
+ rows.put(userRow);
+ }
+ }
+
+ // if comments are enabled display them too
+ if (userRatingDto.isCommentsEnabled()) {
+ for (RatingCommentDTO commentDto : userRatingDto.getCommentDtos()) {
+ JSONArray userData = new JSONArray();
+ userData.put(i);
+ userData.put(userNameMap.get(commentDto.getUserId()));
+ userData.put(commentDto.getComment());
+ userData.put("Comments");
+
+ JSONObject userRow = new JSONObject();
+ userRow.put("id", i++);
+ userRow.put("cell", userData);
+
+ rows.put(userRow);
+ }
+ }
+
+ JSONObject responseJSON = new JSONObject();
+ responseJSON.put("total", 1);
+ responseJSON.put("page", 1);
+ responseJSON.put("records", rows.length());
+ responseJSON.put("rows", rows);
+
+ response.setContentType("application/json;charset=utf-8");
+ response.getWriter().write(responseJSON.toString());
+ return null;
+ }
+
+ private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+
+ Long uid = WebUtil.readLongParam(request, PeerreviewConstants.ATTR_USER_UID);
+ Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ IPeerreviewService service = getPeerreviewService();
+ PeerreviewUser user = service.getUser(uid);
+ NotebookEntry notebookEntry = service.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
+ PeerreviewConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+
+ PeerreviewSession session = service.getPeerreviewSessionBySessionId(sessionID);
+
+ ReflectDTO refDTO = new ReflectDTO(user);
+ if (notebookEntry == null) {
+ refDTO.setFinishReflection(false);
+ refDTO.setReflect(null);
+ } else {
+ refDTO.setFinishReflection(true);
+ refDTO.setReflect(notebookEntry.getEntry());
+ }
+ refDTO.setReflectInstrctions(session.getPeerreview().getReflectInstructions());
+
+ request.setAttribute("userDTO", refDTO);
+ return mapping.findForward("success");
+ }
+
+ // *************************************************************************************
+ // Private method
+ // *************************************************************************************
+ private IPeerreviewService getPeerreviewService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (IPeerreviewService) wac.getBean(PeerreviewConstants.PEERREVIEW_SERVICE);
+ }
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/PeerreviewForm.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/PeerreviewForm.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/PeerreviewForm.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,108 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.web.form;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.upload.FormFile;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+
+/**
+ *
+ * Peerreview Form.
+ *
+ * @struts.form name="peerreviewForm"
+ *
+ * User: Andrey Balan
+ */
+public class PeerreviewForm extends ActionForm {
+ private static final long serialVersionUID = 3599879328307492312L;
+
+ private static Logger logger = Logger.getLogger(PeerreviewForm.class.getName());
+
+ // Forum fields
+ private String sessionMapID;
+ private String contentFolderID;
+ private int currentTab;
+
+ private Peerreview peerreview;
+
+ public PeerreviewForm() {
+ peerreview = new Peerreview();
+ peerreview.setTitle("Peer Review");
+ currentTab = 1;
+ }
+
+ public void setPeerreview(Peerreview peerreview) {
+ this.peerreview = peerreview;
+ // set Form special varaible from given forum
+ if (peerreview == null) {
+ logger.error("Initial PeerreviewForum failed by null value of Peerreview.");
+ }
+ }
+
+ public void reset(ActionMapping mapping, HttpServletRequest request) {
+ String param = mapping.getParameter();
+ // if it is start page, all data read out from database or current session
+ // so need not reset checkbox to refresh value!
+ if (!StringUtils.equals(param, "start") && !StringUtils.equals(param, "initPage")) {
+ peerreview.setLockWhenFinished(false);
+ peerreview.setDefineLater(false);
+ peerreview.setReflectOnActivity(false);
+ }
+ }
+
+ public int getCurrentTab() {
+ return currentTab;
+ }
+
+ public void setCurrentTab(int currentTab) {
+ this.currentTab = currentTab;
+ }
+
+ public Peerreview getPeerreview() {
+ return peerreview;
+ }
+
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+ public String getContentFolderID() {
+ return contentFolderID;
+ }
+
+ public void setContentFolderID(String contentFolderID) {
+ this.contentFolderID = contentFolderID;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/ReflectionForm.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/ReflectionForm.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/form/ReflectionForm.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,69 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.tool.peerreview.web.form;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.validator.ValidatorForm;
+
+/**
+ *
+ * Reflection Form.
+ *
+ * @struts.form name="reflectionForm"
+ *
+ */
+public class ReflectionForm extends ValidatorForm {
+ private static final long serialVersionUID = -9054365604649146735L;
+ private static Logger logger = Logger.getLogger(ReflectionForm.class.getName());
+
+ private Integer userID;
+ private String sessionMapID;
+ private String entryText;
+
+ public String getEntryText() {
+ return entryText;
+ }
+
+ public void setEntryText(String entryText) {
+ this.entryText = entryText;
+ }
+
+ public Integer getUserID() {
+ return userID;
+ }
+
+ public void setUserID(Integer userUid) {
+ this.userID = userUid;
+ }
+
+ public String getSessionMapID() {
+ return sessionMapID;
+ }
+
+ public void setSessionMapID(String sessionMapID) {
+ this.sessionMapID = sessionMapID;
+ }
+
+}
Index: lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/servlet/ExportServlet.java
===================================================================
diff -u
--- lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/servlet/ExportServlet.java (revision 0)
+++ lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/web/servlet/ExportServlet.java (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,213 @@
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+
+package org.lamsfoundation.lams.tool.peerreview.web.servlet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.notebook.model.NotebookEntry;
+import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
+import org.lamsfoundation.lams.tool.ToolAccessMode;
+import org.lamsfoundation.lams.tool.peerreview.PeerreviewConstants;
+import org.lamsfoundation.lams.tool.peerreview.dto.ReflectDTO;
+import org.lamsfoundation.lams.tool.peerreview.model.Peerreview;
+import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
+import org.lamsfoundation.lams.tool.peerreview.service.IPeerreviewService;
+import org.lamsfoundation.lams.tool.peerreview.service.PeerreviewApplicationException;
+import org.lamsfoundation.lams.tool.peerreview.service.PeerreviewServiceProxy;
+import org.lamsfoundation.lams.tool.peerreview.util.PeerreviewToolContentHandler;
+import org.lamsfoundation.lams.util.FileUtil;
+import org.lamsfoundation.lams.util.WebUtil;
+import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet;
+import org.lamsfoundation.lams.web.util.AttributeNames;
+import org.lamsfoundation.lams.web.util.SessionMap;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+/**
+ * Export portfolio servlet to export all peerreview into offline HTML package.
+ *
+ * @author Steve.Ni
+ *
+ * @version $Revision$
+ */
+public class ExportServlet extends AbstractExportPortfolioServlet {
+ private static final long serialVersionUID = -4529093489007108143L;
+
+ private static Logger logger = Logger.getLogger(ExportServlet.class);
+
+ private final String FILENAME = "peer_review_main.html";
+
+ private IPeerreviewService service;
+
+ @Override
+ public void init() throws ServletException {
+ service = PeerreviewServiceProxy.getPeerreviewService(getServletContext());
+ super.init();
+ }
+
+ public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName,
+ Cookie[] cookies) {
+
+ // initial sessionMap
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+
+ try {
+ if (StringUtils.equals(mode, ToolAccessMode.LEARNER.toString())) {
+ sessionMap.put(AttributeNames.ATTR_MODE, ToolAccessMode.LEARNER);
+ learner(request, response, directoryName, cookies, sessionMap);
+ } else if (StringUtils.equals(mode, ToolAccessMode.TEACHER.toString())) {
+ sessionMap.put(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER);
+ teacher(request, response, directoryName, cookies, sessionMap);
+ }
+ } catch (PeerreviewApplicationException e) {
+ logger.error("Cannot perform export for peerreview tool.");
+ }
+
+ String basePath = WebUtil.getBaseServerURL() + request.getContextPath();
+ writeResponseToFile(basePath + "/pages/export/exportportfolio.jsp?sessionMapID=" + sessionMap.getSessionID(),
+ directoryName, FILENAME, cookies);
+
+ return FILENAME;
+ }
+
+ public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName,
+ Cookie[] cookies, HashMap sessionMap) throws PeerreviewApplicationException {
+
+ if (userID == null || toolSessionID == null) {
+ String error = "Tool session Id or user Id is null. Unable to continue";
+ logger.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+ PeerreviewUser learner = service.getUserByIDAndSession(userID, toolSessionID);
+
+ if (learner == null) {
+ String error = "The user with user id " + userID + " does not exist.";
+ logger.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+ Peerreview content = service.getPeerreviewBySessionId(toolSessionID);
+
+ if (content == null) {
+ String error = "The content for this activity has not been defined yet.";
+ logger.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+// List group = service.exportBySessionId(toolSessionID, true);
+// saveFileToLocal(group, directoryName);
+//
+// List> groupList = new ArrayList>();
+// if (group.size() > 0)
+// groupList.add(group);
+
+ // Add flag to indicate whether to render user notebook entries
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECTION_ON, content.isReflectOnActivity());
+
+ // Create reflectList if reflection is enabled.
+ if (content.isReflectOnActivity()) {
+ List reflectList = new LinkedList();
+
+ // Create reflectList, need to follow same structure used in teacher
+ // see service.getReflectList();
+ reflectList.add(getReflectionEntry(learner));
+
+ // Add reflectList to sessionMap
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECT_LIST, reflectList);
+ }
+
+ sessionMap.put(PeerreviewConstants.ATTR_TITLE, content.getTitle());
+ sessionMap.put(PeerreviewConstants.ATTR_INSTRUCTIONS, content.getInstructions());
+// sessionMap.put(PeerreviewConstants.ATTR_SUMMARY_LIST, groupList);
+ }
+
+ public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName,
+ Cookie[] cookies, HashMap sessionMap) throws PeerreviewApplicationException {
+
+ // check if toolContentId exists in db or not
+ if (toolContentID == null) {
+ String error = "Tool Content Id is missing. Unable to continue";
+ logger.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+
+ Peerreview content = service.getPeerreviewByContentId(toolContentID);
+
+ if (content == null) {
+ String error = "Data is missing from the database. Unable to Continue";
+ logger.error(error);
+ throw new PeerreviewApplicationException(error);
+ }
+// List> groupList = service.exportByContentId(toolContentID);
+// if (groupList != null) {
+// for (List list : groupList) {
+// saveFileToLocal(list, directoryName);
+// }
+// }
+
+ // Add flag to indicate whether to render user notebook entries
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECTION_ON, content.isReflectOnActivity());
+
+ // Create reflectList if reflection is enabled.
+ if (content.isReflectOnActivity()) {
+ List reflectList = service.getReflectList(content.getContentId());
+ // Add reflectList to sessionMap
+ sessionMap.put(PeerreviewConstants.ATTR_REFLECT_LIST, reflectList);
+ }
+
+ // put it into HTTPSession
+ sessionMap.put(PeerreviewConstants.ATTR_TITLE, content.getTitle());
+ sessionMap.put(PeerreviewConstants.ATTR_INSTRUCTIONS, content.getInstructions());
+// sessionMap.put(PeerreviewConstants.ATTR_SUMMARY_LIST, groupList);
+ }
+
+ private ReflectDTO getReflectionEntry(PeerreviewUser peerreviewUser) {
+ ReflectDTO reflectDTO = new ReflectDTO(peerreviewUser);
+ NotebookEntry notebookEntry = service.getEntry(peerreviewUser.getSession().getSessionId(),
+ CoreNotebookConstants.NOTEBOOK_TOOL, PeerreviewConstants.TOOL_SIGNATURE, peerreviewUser.getUserId()
+ .intValue());
+
+ // check notebookEntry is not null
+ if (notebookEntry != null) {
+ reflectDTO.setReflect(notebookEntry.getEntry());
+ logger.debug("Could not find notebookEntry for PeerreviewUser: " + peerreviewUser.getUid());
+ }
+ return reflectDTO;
+ }
+}
Index: lams_tool_preview/web/403.jsp
===================================================================
diff -u
--- lams_tool_preview/web/403.jsp (revision 0)
+++ lams_tool_preview/web/403.jsp (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,6 @@
+<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+<%@ taglib uri="tags-core" prefix="c" %>
+
+
+
Index: lams_tool_preview/web/404.jsp
===================================================================
diff -u
--- lams_tool_preview/web/404.jsp (revision 0)
+++ lams_tool_preview/web/404.jsp (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,8 @@
+<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+<%@ taglib uri="tags-core" prefix="c" %>
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/AuthoringButton.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/AuthoringButton.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,133 @@
+<%
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * AuthoringButton.tag
+ * Author: Dapeng Ni
+ * Description: Creates the save/cancel button for authoring page
+ */
+
+ %>
+<%@ tag body-content="scriptless" %>
+<%@ taglib uri="tags-core" prefix="c" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+
+<%@ attribute name="formID" required="true" rtexprvalue="true" %>
+<%@ attribute name="toolSignature" required="true" rtexprvalue="true" %>
+<%@ attribute name="toolContentID" required="true" rtexprvalue="true" %>
+<%@ attribute name="contentFolderID" required="true" rtexprvalue="true" %>
+<%@ attribute name="clearSessionActionUrl" required="true" rtexprvalue="true" %>
+
+<%-- Optional attribute --%>
+<%@ attribute name="accessMode" required="false" rtexprvalue="true" %>
+<%@ attribute name="cancelButtonLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="saveButtonLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="cancelConfirmMsgKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="defineLater" required="false" rtexprvalue="true" %>
+<%@ attribute name="customiseSessionID" required="false" rtexprvalue="true" %>
+
+<%-- Default value for message key --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_tool_preview/web/WEB-INF/tags/CKEditor.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/CKEditor.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/CKEditor.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,95 @@
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+<%@ taglib uri="tags-function" prefix="fn" %>
+
+<%@ attribute name="id" required="true" rtexprvalue="true"%>
+<%@ attribute name="value" required="true" rtexprvalue="true"%>
+<%@ attribute name="toolbarSet" required="false" rtexprvalue="true"%>
+<%@ attribute name="height" required="false" rtexprvalue="true"%>
+<%@ attribute name="width" required="false" rtexprvalue="true"%>
+<%@ attribute name="contentFolderID" required="false" rtexprvalue="true"%>
+<%@ attribute name="displayExpanded" required="false" rtexprvalue="true"%>
+<%@ attribute name="resizeParentFrameName" required="false" rtexprvalue="true"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ckeditor/
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/Date.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/Date.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/Date.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,55 @@
+<%
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * Author: Fiona Malikoff
+ * Description: Format a date, using the locale, based on standard parameters.
+ * Need to use long for the date otherwise the AU locale comes out as 1/2/06 and
+ * full is needed to include the timezone.
+ */
+
+ %>
+<%@ tag body-content="empty" %>
+<%@ attribute name="value" required="true" rtexprvalue="true" type="java.util.Date" %>
+<%@ attribute name="style" required="false" rtexprvalue="true"%>
+<%@ attribute name="type" required="false" rtexprvalue="true"%>
+
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="tags-core" prefix="c" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/DefineLater.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/DefineLater.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/DefineLater.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,58 @@
+
+<%
+ /****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * DefineLater.tag
+ * Author: Fiona Malikoff
+ * Description: Layout for "Define Later" screens - to be used in learning.
+ * A suggested layout - unless the tool has special requirements, this layout should be used.
+ * Expects to be used inside
+ */
+%>
+
+<%@ tag body-content="scriptless"%>
+<%@ taglib uri="tags-fmt" prefix="fmt"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+
+<%@ attribute name="defineLaterMessageKey" required="false"
+ rtexprvalue="true"%>
+<%@ attribute name="buttonTryAgainKey" required="false"
+ rtexprvalue="true"%>
+
+<%-- Default value for I18N keys --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/Head.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/Head.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/Head.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,42 @@
+<%/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/**
+ * Head.tag
+ * Author: Fiona Malikoff
+ * Description: Sets up the non-cache pragma statements and the UTF-8
+ * encoding. Use in place of the normal head tag.
+ */
+%>
+
+<%@ tag body-content="scriptless"%>
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/ImgButtonWrapper.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/ImgButtonWrapper.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/ImgButtonWrapper.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,37 @@
+<%
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * ImgButtonWrapper.tag
+ * Author: Mitchell Seaton
+ * Description: Simple wrapper that will display buttons correctly when RTL page rendering is used.
+ */
+
+ %>
+<%@ tag body-content="scriptless" %>
+
+
\ No newline at end of file
Index: lams_tool_preview/web/WEB-INF/tags/Tab.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/Tab.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/Tab.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,85 @@
+<%
+ /****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * Tab.tag
+ * Author: Mitchell Seaton
+ * Description: Creates a tab element.
+ * Wiki:
+ */
+%>
+<%@ tag body-content="empty"%>
+<%@ attribute name="id" required="true" rtexprvalue="true"%>
+<%@ attribute name="value" required="false" rtexprvalue="true"%>
+<%@ attribute name="key" required="false" rtexprvalue="true"%>
+<%@ attribute name="inactive" required="false" rtexprvalue="true"%>
+<%@ attribute name="methodCall" required="false" rtexprvalue="true"%>
+
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-fmt" prefix="fmt"%>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+
+<%-- Check if bundle is set --%>
+
+
+
+
+
+
+
+
+
+
+<%--
+ Usually methodCall is selectTab, but the calling code can override methodCall if desired.
+ this is handy if the page needs different logic on initialisation and user switching tabs
+--%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/TabBody.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/TabBody.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/TabBody.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,52 @@
+<%/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/**
+ * TabBody.tag
+ * Author: Mitchell Seaton
+ * Description: Creates the body container for a tab element
+ * Wiki:
+ */
+
+ %>
+<%@ tag body-content="scriptless"%>
+<%@ attribute name="id" required="true" rtexprvalue="true"%>
+<%@ attribute name="tabTitle" required="false" rtexprvalue="true"%>
+<%@ attribute name="titleKey" required="false" rtexprvalue="true"%>
+<%@ attribute name="page" required="false" rtexprvalue="true"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-bean" prefix="bean"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/TabName.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/TabName.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/TabName.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,59 @@
+<%/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/**
+ * TabName Tag
+ * Author: Mitchell Seaton
+ * Description: Shortens name that are too long to fit inside a tab
+ */
+
+ %>
+<%@ tag body-content="scriptless" %>
+
+<%@ attribute name="url" required="true" rtexprvalue="true"%>
+<%@ attribute name="highlight" required="false" rtexprvalue="true" %>
+
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-function" prefix="fn"%>
+
+12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/Tabs.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/Tabs.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/Tabs.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,69 @@
+<%/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/**
+ * Tabs.tag
+ * Author: Mitchell Seaton
+ * Description: Create a tab list from a input collection or nested Tab tags.
+ * Wiki:
+ */
+
+ %>
+<%@ tag body-content="scriptless"%>
+<%@ attribute name="collection" type="java.util.Collection" required="false" rtexprvalue="true"%>
+<%@ attribute name="control" required="false" rtexprvalue="true"%>
+<%@ attribute name="useKey" required="false" rtexprvalue="true"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-lams" prefix="lams"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_preview/web/WEB-INF/tags/TextSearch.tag
===================================================================
diff -u
--- lams_tool_preview/web/WEB-INF/tags/TextSearch.tag (revision 0)
+++ lams_tool_preview/web/WEB-INF/tags/TextSearch.tag (revision 9f2c1f957570c3885c34d8d162a1f14d82e3aba2)
@@ -0,0 +1,136 @@
+<%
+/****************************************************************
+ * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+ * =============================================================
+ * License Information: http://lamsfoundation.org/licensing/lams/2.0/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2.0
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+ /**
+ * TextSearch.tag
+ * Author: Marcin Cieslak
+ * Description: Displays form for creating text search conditions.
+ */
+
+ %>
+<%@ tag body-content="scriptless" %>
+<%@ taglib uri="tags-core" prefix="c" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-lams" prefix="lams" %>
+
+<%-- Required attributes --%>
+<%@ attribute name="sessionMapID" required="true" rtexprvalue="true" %>
+<%@ attribute name="wrapInFormTag" required="true" rtexprvalue="true" %>
+
+<%-- Optional attributes --%>
+<%@ attribute name="action" required="false" rtexprvalue="true" %>
+<%@ attribute name="formID" required="false" rtexprvalue="true" %>
+<%@ attribute name="headingLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="allWordsLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="phraseLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="anyWordsLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="excludedWordsLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="saveButtonLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="cancelButtonLabelKey" required="false" rtexprvalue="true" %>
+<%@ attribute name="cancelAction" required="false" rtexprvalue="true" %>
+
+<%-- Default value for message key --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+