Index: lams_tool_scratchie/.classpath =================================================================== diff -u --- lams_tool_scratchie/.classpath (revision 0) +++ lams_tool_scratchie/.classpath (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/.cvsignore =================================================================== diff -u --- lams_tool_scratchie/.cvsignore (revision 0) +++ lams_tool_scratchie/.cvsignore (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,3 @@ +.myeclipse +.mymetadata +build Index: lams_tool_scratchie/.project =================================================================== diff -u --- lams_tool_scratchie/.project (revision 0) +++ lams_tool_scratchie/.project (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,49 @@ + + + lams_tool_scratchie + + + + + + com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator + + + + + com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator + + + + + com.ibm.etools.validation.validationbuilder + + + + + com.ibm.sse.model.structuredbuilder + + + + + com.genuitec.eclipse.hibernate.HibernateBuilder + + + + + + com.genuitec.eclipse.hibernate.hibernatenature + com.genuitec.eclipse.j2eedt.core.webnature + org.eclipse.jdt.core.javanature + + Index: lams_tool_scratchie/build.properties =================================================================== diff -u --- lams_tool_scratchie/build.properties (revision 0) +++ lams_tool_scratchie/build.properties (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,27 @@ +######################################################################################################################## +### BUILD PROPERTIES ### +### 1) Do *NOT* use backslashes in paths unless you are sure the ANT task treats them properly. ### +### 2) Use only ant variables (${foo}) that You declared above or make *SURE* You derive them from the right place. ### +### 3) Comment out boolean style build settings instead of setting false. Set to false may fail. ### +### 4) Uncommenting the forceClean attribute *WILL* delete your sourcecode to make place for vcs controlled builds. ### +### +######################################################################################################################## + +### project properties ### +signature=lascrt11 +project.displayname = lams scratchie tool + +#project version +tool.version=20110509 + +# hide tool option +hideTool=false + +# Minimum compatible version +min.server.version.number=2.0 + +# packages +tool.package=org.lamsfoundation.lams.tool.scratchie +language.files.package=${tool.package} +# Precompiled JSP classes package +jsp.java.src.package=${tool.package}.jsp Index: lams_tool_scratchie/build.xml =================================================================== diff -u --- lams_tool_scratchie/build.xml (revision 0) +++ lams_tool_scratchie/build.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,576 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +------------------------------------------+ + | creating directory structure | + +------------------------------------------+ + + + + + + + + + + + + + + +------------------------------------------+ + | clean | + +------------------------------------------+ + + + + + + + + + + + + + + + + + + + + +------------------------------------------+ + | generating hibernate metadata | + +------------------------------------------+ + + + + Building hbm.xml files using XDoclet to ${conf.hibernate.mapping.dir} from ${src.java.dir} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +------------------------------------------+ + | create jar file | + +------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +------------------------------------------+ + | build jar file | + +------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +------------------------------------------+ + | Generate the deployment package. | + +------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deploying the Scratchie tool + + + + + + + + + + + + + + +------------------------------------------+ + | built war file | + +------------------------------------------+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copying web files + + + + + + + + + + + + + + + + + + + + + + + + + + + Generating Java source from JSP pages + + + + + + Compiling JSP classes + + + + + + + + + + + Copying web scratchie + + + + + + + + + + + + + + + + + + + Copying web scratchie + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/conf/hibernate/mappings/.cvsignore =================================================================== diff -u --- lams_tool_scratchie/conf/hibernate/mappings/.cvsignore (revision 0) +++ lams_tool_scratchie/conf/hibernate/mappings/.cvsignore (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ +org Index: lams_tool_scratchie/conf/jar/META-INF/MANIFEST.MF =================================================================== diff -u --- lams_tool_scratchie/conf/jar/META-INF/MANIFEST.MF (revision 0) +++ lams_tool_scratchie/conf/jar/META-INF/MANIFEST.MF (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,3 @@ +Implementation-Title: LAMS - Scratchie Tool +Implementation-Version: 2.1 +Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org) Index: lams_tool_scratchie/conf/language/lams/ApplicationResources.properties =================================================================== diff -u --- lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (revision 0) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,11 @@ +appName = scratchie +#language code: en +#locale code: AU + + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Mar 13 11:07:34 CST 2012 + +#=================== labels for ShareResources =================# + + + +#======= End labels: Exported 176 labels for en AU ===== Index: lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u --- lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (revision 0) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,95 @@ +appName = scratchie +#language code: en +#locale code: AU + + # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Mar 13 11:07:34 CST 2012 + +#=================== labels for ShareResources =================# + +activity.title =Scratchie +label.authoring.heading =Scratchie Tool Authoring +label.author.title =Scratchie Tool +label.authoring.heading.basic =Basic +label.authoring.heading.advance =Advanced +label.authoring.heading.instructions =Instructions +label.authoring.heading.basic.desc =Basic input information for scratchie tool +label.authoring.heading.instructions.desc =Please input online and offline instructions +label.authoring.heading.advance.desc =Please input advance options for shared resources +label.authoring.basic.title =Title +label.authoring.maximum.answers.warning =Sorry, you can only have 10 answers at maximum. +label.authoring.specify.correct.answer.warning =Please, specify which answer is correct one. +label.authoring.basic.instruction =Question +label.authoring.basic.resource.instructions =Instructions +label.authoring.basic.item.title =Scratchie title +label.authoring.basic.item.correct =Correct? +label.authoring.basic.add.another.scratchie =Add another scratchie +label.authoring.online.instruction =Online Instructions +label.authoring.offline.instruction =Offline Instructions +label.authoring.online.file =Upload online file +label.authoring.offline.file =Upload offline file +label.authoring.choosefile.button =Choose file +label.authoring.upload.online.button =Upload Online +label.authoring.upload.offline.button =Upload Offline +label.authoring.online.delete =Delete +label.authoring.offline.delete =Delete +label.authoring.save.button =Save +label.authoring.cancel.button =Cancel +error.msg.upload.file.not.found =Could not find upload file {0}. +error.msg.file.not.found =File not found exception occurs when uploading file. +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. +authoring.msg.cancel.save =Do you want to close this window without saving? +label.learning.title =Scratchie Learning +monitoring.tab.summary =Summary +monitoring.tab.statistics =Statistic +monitoring.tab.instructions =Instruction +monitoring.tab.edit.activity =Edit Activity +monitoring.label.group =Group +label.monitoring.edit.activity.edit =Edit +message.monitoring.edit.activity.not.editable =This Activity is no longer editable +export.title =Export portfolio of Scratchie tool +label.download =Download +label.view =View +label.edit =Edit +label.finished =Next Activity +label.finish =Finished +message.monitoring.summary.no.session =No Session Available +define.later.message =Please wait for the instructor to complete the contents of this activity. +run.offline.message =This activity is not being done on the computer. Please see your instructor for details. +button.try.again =Try again +label.up =Move Up +label.down =Move down +label.authoring.advanced.reflectOnActivity =Add Notebook at end of Shared Resources with the following instructions: +label.continue =Continue +page.title.monitoring.view.reflection =View Notebook Entries +button.close =Close +message.no.reflection.available =No notebook available +message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information. +monitoring.label.attachments =Attachments +label.on =On +label.off =Off +monitor.summary.th.advancedSettings =Advanced Settings +monitor.summary.td.addNotebook =Add Notebook at end of Shared Resources +monitor.summary.td.notebookInstructions =Notebook instructions +label.authoring.up =Move up +label.monitoring.summary.select.student =Select a student from the list to see his/her attempts/results +label.monitoring.summary.user.name =Name +label.monitoring.summary.summary =Summary +label.monitoring.summary.attempts =Attempts +label.monitoring.summary.mark =Mark +label.monitoring.summary.learners.summary =Learner's summary +label.monitoring.summary.report.by.scratchie =Report by scratchie +label.monitoring.summary.attempt =Attempt +label.monitoring.summary.attempt.number =Attempt # +label.monitoring.summary.scratchie =Scratchie +label.monitoring.summary.correct =Correct? +label.monitoring.item.summary.correct =Correct +label.monitoring.summary.date =Date +label.monitoring.summary.report.for =Report for {0} +label.monitoring.summary.choose =Choose... +label.monitoring.item.summary.group =Group: +output.desc.learner.number.of.attempts =Number of attempts made by user + +#======= End labels: Exported 176 labels for en AU ===== Index: lams_tool_scratchie/conf/language/rams/ApplicationResources.properties =================================================================== diff -u --- lams_tool_scratchie/conf/language/rams/ApplicationResources.properties (revision 0) +++ lams_tool_scratchie/conf/language/rams/ApplicationResources.properties (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,171 @@ +appName = shareresources +#language code: en +#locale code: AU + + # CVS ID: $Id$ Exported from the RAMS Community by Ernie Ghiglione on Tue Aug 12 12:00:29 EST 2008 + +#=================== labels for ShareResources =================# + +appName =Share Resources +activity.title =Scratchie +activity.description =Sharing resource with others. +activity.helptext =Uploading your resources to share with others. +tool.display.name =Share Resources Tool +tool.description =Tool for sharing resources. +errorPage.title =Error page +errorPage.heading =Some error occurs when handling your request +label.authoring.heading =Share Resources +label.author.title =Share Resources Authoring +label.authoring.heading.basic =Basic +label.authoring.heading.advance =Advanced +label.authoring.heading.instructions =Instructions +label.authoring.heading.basic.desc =Basic input information for shared resources +label.authoring.heading.instructions.desc =Please input online and offline instructions +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.instruction =Online Instructions +label.authoring.offline.instruction =Offline Instructions +label.authoring.online.file =Upload online file +label.authoring.offline.file =Upload offline file +label.authoring.choosefile.button =Choose file +label.authoring.upload.online.button =Upload Online +label.authoring.upload.offline.button =Upload Offline +label.authoring.online.filelist =Online file list +label.authoring.offline.filelist =Offline file list +label.authoring.online.delete =Delete +label.authoring.offline.delete =Delete +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 participants to add URLs +label.authoring.advance.allow.learner.add.files =Allow participants 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 =Repository occurs exception while trying to upload 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 +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 at least view 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.instructions =Instruction +monitoring.tab.edit.activity =Edit Activity +monitoring.label.group =Group +monitoring.summary.note =Note: number of participants is the number of participants who have viewed the resource. +monitoring.label.type =Type +monitoring.label.title =Title +monitoring.label.suggest =Suggested By +monitoring.label.number.learners =Number of Participants +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 =Finished +label.completed =Completed +label.finish =Finish +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 =Access time +define.later.message =Please wait for the researcher to complete the contents of this activity. +run.offline.message =This activity is not being done on the computer. Please see your instructor for details. +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.authoring.advanced.reflectOnActivity =Add Notebook at end of Shared Resources with the following instructions: +error.reflection.emtpy =Please input reflection +title.reflection =Reflection +label.continue =Continue +monitoring.user.fullname =Name +monitoring.user.reflection =Reflection +page.title.monitoring.view.reflection =View Reflection +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. +label.monitoring.heading.access =Participants list +message.alertContentEdit =Warning: One of more participants have accessed this activity. Changing this content will result in students getting different information. +label.export.reflection =Notebook Entries +monitoring.label.attachments =Attachments +message.activityLocked =Note: After you click on "Next Activity" and you come back to this Share Resources, you won't be able to continue. +message.warnLockOnFinish =This activitiy has been setup not to allow sharing and viewing of resources after it has been finished. + + +#======= End labels: Exported 160 labels for en AU ===== Index: lams_tool_scratchie/conf/language/rams/ApplicationResources_en_AU.properties =================================================================== diff -u --- lams_tool_scratchie/conf/language/rams/ApplicationResources_en_AU.properties (revision 0) +++ lams_tool_scratchie/conf/language/rams/ApplicationResources_en_AU.properties (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,171 @@ +appName = shareresources +#language code: en +#locale code: AU + + # CVS ID: $Id$ Exported from the RAMS Community by Ernie Ghiglione on Tue Aug 12 12:00:29 EST 2008 + +#=================== labels for ShareResources =================# + +appName =Share Resources +activity.title =Scratchie +activity.description =Sharing resource with others. +activity.helptext =Uploading your resources to share with others. +tool.display.name =Share Resources Tool +tool.description =Tool for sharing resources. +errorPage.title =Error page +errorPage.heading =Some error occurs when handling your request +label.authoring.heading =Share Resources +label.author.title =Share Resources Authoring +label.authoring.heading.basic =Basic +label.authoring.heading.advance =Advanced +label.authoring.heading.instructions =Instructions +label.authoring.heading.basic.desc =Basic input information for shared resources +label.authoring.heading.instructions.desc =Please input online and offline instructions +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.instruction =Online Instructions +label.authoring.offline.instruction =Offline Instructions +label.authoring.online.file =Upload online file +label.authoring.offline.file =Upload offline file +label.authoring.choosefile.button =Choose file +label.authoring.upload.online.button =Upload Online +label.authoring.upload.offline.button =Upload Offline +label.authoring.online.filelist =Online file list +label.authoring.offline.filelist =Offline file list +label.authoring.online.delete =Delete +label.authoring.offline.delete =Delete +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 participants to add URLs +label.authoring.advance.allow.learner.add.files =Allow participants 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 =Repository occurs exception while trying to upload 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 +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 at least view 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.instructions =Instruction +monitoring.tab.edit.activity =Edit Activity +monitoring.label.group =Group +monitoring.summary.note =Note: number of participants is the number of participants who have viewed the resource. +monitoring.label.type =Type +monitoring.label.title =Title +monitoring.label.suggest =Suggested By +monitoring.label.number.learners =Number of Participants +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 =Finished +label.completed =Completed +label.finish =Finish +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 =Access time +define.later.message =Please wait for the researcher to complete the contents of this activity. +run.offline.message =This activity is not being done on the computer. Please see your instructor for details. +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.authoring.advanced.reflectOnActivity =Add Notebook at end of Shared Resources with the following instructions: +error.reflection.emtpy =Please input reflection +title.reflection =Reflection +label.continue =Continue +monitoring.user.fullname =Name +monitoring.user.reflection =Reflection +page.title.monitoring.view.reflection =View Reflection +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. +label.monitoring.heading.access =Participants list +message.alertContentEdit =Warning: One of more participants have accessed this activity. Changing this content will result in students getting different information. +label.export.reflection =Notebook Entries +monitoring.label.attachments =Attachments +message.activityLocked =Note: After you click on "Next Activity" and you come back to this Share Resources, you won't be able to continue. +message.warnLockOnFinish =This activitiy has been setup not to allow sharing and viewing of resources after it has been finished. + + +#======= End labels: Exported 160 labels for en AU ===== Index: lams_tool_scratchie/conf/war/META-INF/MANIFEST.MF =================================================================== diff -u --- lams_tool_scratchie/conf/war/META-INF/MANIFEST.MF (revision 0) +++ lams_tool_scratchie/conf/war/META-INF/MANIFEST.MF (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,4 @@ +Implementation-Title: LAMS - Scratchie Tool +Implementation-Version: 2.1 +Implementation-Vendor: LAMS Foundation (http://lamsfoundation.org) +Class-Path: ./lams.jar ./lams-tool-lascrt11.jar ./lams-contentrepository.jar Index: lams_tool_scratchie/conf/xdoclet/global-exceptions.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/global-exceptions.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/global-exceptions.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,8 @@ + + + Index: lams_tool_scratchie/conf/xdoclet/global-forwards.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/global-forwards.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/global-forwards.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,6 @@ + + + + + + Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/struts-actions.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/conf/xdoclet/struts-forms.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/struts-forms.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/struts-forms.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ + Index: lams_tool_scratchie/conf/xdoclet/struts-message-resources.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/struts-message-resources.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/struts-message-resources.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ + Index: lams_tool_scratchie/conf/xdoclet/struts-plugins.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/struts-plugins.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/struts-plugins.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,15 @@ + + + + + + Index: lams_tool_scratchie/conf/xdoclet/validation-forms.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/validation-forms.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/validation-forms.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,29 @@ + Index: lams_tool_scratchie/conf/xdoclet/validation-global.xml =================================================================== diff -u --- lams_tool_scratchie/conf/xdoclet/validation-global.xml (revision 0) +++ lams_tool_scratchie/conf/xdoclet/validation-global.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,6 @@ + + + datePattern + yyyy-MM-dd + + Index: lams_tool_scratchie/db/model/scratchie.clay =================================================================== diff -u --- lams_tool_scratchie/db/model/scratchie.clay (revision 0) +++ lams_tool_scratchie/db/model/scratchie.clay (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,873 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
Index: lams_tool_scratchie/db/sql/activity_insert.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/activity_insert.sql (revision 0) +++ lams_tool_scratchie/db/sql/activity_insert.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,82 @@ +# Connection: ROOT LOCAL +# Host: localhost +# Saved: 2005-04-07 11:08:32 +# +INSERT INTO lams_learning_activity +( +activity_ui_id +, description +, title +, help_text +, xcoord +, ycoord +, parent_activity_id +, parent_ui_id +, learning_activity_type_id +, grouping_support_type_id +, apply_grouping_flag +, grouping_id +, grouping_ui_id +, order_id +, define_later_flag +, learning_design_id +, learning_library_id +, create_date_time +, run_offline_flag +, max_number_of_options +, min_number_of_options +, options_instructions +, tool_id +, tool_content_id +, activity_category_id +, gate_activity_level_id +, gate_open_flag +, gate_start_time_offset +, gate_end_time_offset +, gate_start_date_time +, gate_end_date_time +, library_activity_ui_image +, create_grouping_id +, create_grouping_ui_id +, library_activity_id +, language_file +) +VALUES +( +NULL +, 'Scratchie' +, 'Scratchie' +, '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 +, NULL +, NULL +, 'tool/lascrt11/images/icon_scratchie.swf' +, NULL +, NULL +, NULL +, 'org.lamsfoundation.lams.tool.scratchie.ApplicationResources' +) Index: lams_tool_scratchie/db/sql/create_lams_tool_scratchie.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/create_lams_tool_scratchie.sql (revision 0) +++ lams_tool_scratchie/db/sql/create_lams_tool_scratchie.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,96 @@ +SET FOREIGN_KEY_CHECKS=0; +drop table if exists tl_lascrt11_attachment; +drop table if exists tl_lascrt11_scratchie; +drop table if exists tl_lascrt11_scratchie_item; +drop table if exists tl_lascrt11_scratchie_item_visit_log; +drop table if exists tl_lascrt11_session; +drop table if exists tl_lascrt11_user; +create table tl_lascrt11_attachment ( + uid bigint not null auto_increment, + file_version_id bigint, + file_type varchar(255), + file_name varchar(255), + file_uuid bigint, + create_date datetime, + scratchie_uid bigint, + primary key (uid) +)ENGINE=InnoDB; +create table tl_lascrt11_scratchie ( + uid bigint not null auto_increment, + create_date datetime, + update_date datetime, + create_by bigint, + title varchar(255), + run_offline tinyint, + instructions text, + online_instructions text, + offline_instructions text, + content_in_use tinyint, + define_later tinyint, + content_id bigint unique, + reflect_instructions varchar(255), + reflect_on_activity smallint, + primary key (uid) +)ENGINE=InnoDB; +create table tl_lascrt11_scratchie_item ( + uid bigint not null auto_increment, + description varchar(255), + create_by bigint, + create_date datetime, + create_by_author tinyint, + correct tinyint, + scratchie_uid bigint, + session_uid bigint, + order_id integer, + primary key (uid) +)ENGINE=InnoDB; +create table tl_lascrt11_item_log ( + uid bigint not null auto_increment, + access_date datetime, + scratchie_item_uid bigint, + user_uid bigint, + session_id bigint, + primary key (uid) +)ENGINE=InnoDB; +create table tl_lascrt11_session ( + uid bigint not null auto_increment, + session_end_date datetime, + session_start_date datetime, + status integer, + scratchie_uid bigint, + session_id bigint, + session_name varchar(250), + primary key (uid) +)ENGINE=InnoDB; +create table tl_lascrt11_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, + scratchie_uid bigint, + primary key (uid) +)ENGINE=InnoDB; +alter table tl_lascrt11_attachment add index FK_NEW_610529188_1E7009430E79035 (scratchie_uid), add constraint FK_NEW_610529188_1E7009430E79035 foreign key (scratchie_uid) references tl_lascrt11_scratchie (uid); +alter table tl_lascrt11_scratchie add index FK_NEW_610529188_89093BF758092FB (create_by), add constraint FK_NEW_610529188_89093BF758092FB foreign key (create_by) references tl_lascrt11_user (uid); +alter table tl_lascrt11_scratchie_item add index FK_NEW_610529188_F52D1F93758092FB (create_by), add constraint FK_NEW_610529188_F52D1F93758092FB foreign key (create_by) references tl_lascrt11_user (uid); +alter table tl_lascrt11_scratchie_item add index FK_NEW_610529188_F52D1F9330E79035 (scratchie_uid), add constraint FK_NEW_610529188_F52D1F9330E79035 foreign key (scratchie_uid) references tl_lascrt11_scratchie (uid); +alter table tl_lascrt11_scratchie_item add index FK_NEW_610529188_F52D1F93EC0D3147 (session_uid), add constraint FK_NEW_610529188_F52D1F93EC0D3147 foreign key (session_uid) references tl_lascrt11_session (uid); +alter table tl_lascrt11_item_log add index FK_NEW_610529188_693580A438BF8DFE (scratchie_item_uid), add constraint FK_NEW_610529188_693580A438BF8DFE foreign key (scratchie_item_uid) references tl_lascrt11_scratchie_item (uid); +alter table tl_lascrt11_item_log add index FK_NEW_610529188_693580A441F9365D (user_uid), add constraint FK_NEW_610529188_693580A441F9365D foreign key (user_uid) references tl_lascrt11_user (uid); +alter table tl_lascrt11_session add index FK_NEW_610529188_24AA78C530E79035 (scratchie_uid), add constraint FK_NEW_610529188_24AA78C530E79035 foreign key (scratchie_uid) references tl_lascrt11_scratchie (uid); +alter table tl_lascrt11_user add index FK_NEW_610529188_30113BFCEC0D3147 (session_uid), add constraint FK_NEW_610529188_30113BFCEC0D3147 foreign key (session_uid) references tl_lascrt11_session (uid); +alter table tl_lascrt11_user add index FK_NEW_610529188_30113BFC309ED320 (scratchie_uid), add constraint FK_NEW_610529188_30113BFC309ED320 foreign key (scratchie_uid) references tl_lascrt11_scratchie (uid); + + + +INSERT INTO `tl_lascrt11_scratchie` (`uid`, `create_date`, `update_date`, `create_by`, `title`, `run_offline`, + `instructions`, `online_instructions`, `offline_instructions`, `content_in_use`, `define_later`, `content_id`, `reflect_on_activity`) VALUES + (1,NULL,NULL,NULL,'Scratchie','0','Scenario explanation / or question ', null,null,0,0,${default_content_id},0); + +INSERT INTO `tl_lascrt11_scratchie_item` (`uid`, `description`, `create_by`, `create_date`, `create_by_author`, correct, `scratchie_uid`, `session_uid`, `order_id`) VALUES + (1, 'Answer A',null,NOW(),1,1,1,NULL, 1); + +SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_scratchie/db/sql/db_version_insert.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/db_version_insert.sql (revision 0) +++ lams_tool_scratchie/db/sql/db_version_insert.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,2 @@ +-- $Id$ +INSERT INTO patches VALUES ('@signature@', '@tool_version@', NOW(), 'F'); Index: lams_tool_scratchie/db/sql/drop_lams_tool_scratchie.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/drop_lams_tool_scratchie.sql (revision 0) +++ lams_tool_scratchie/db/sql/drop_lams_tool_scratchie.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,14 @@ +SET FOREIGN_KEY_CHECKS=0; +drop table if exists tl_lascrt11_attachment; +drop table if exists tl_lascrt11_item_instruction; +drop table if exists tl_lascrt11_scratchie; +drop table if exists tl_lascrt11_scratchie_item; +drop table if exists tl_lascrt11_item_log; +drop table if exists tl_lascrt11_session; +drop table if exists tl_lascrt11_user; +SET FOREIGN_KEY_CHECKS=1; + + + + + Index: lams_tool_scratchie/db/sql/library_insert.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/library_insert.sql (revision 0) +++ lams_tool_scratchie/db/sql/library_insert.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 +( +'Scratchie', +'Scratchie', +0, +NOW() +) Index: lams_tool_scratchie/db/sql/table-schema.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/table-schema.sql (revision 0) +++ lams_tool_scratchie/db/sql/table-schema.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ \ No newline at end of file Index: lams_tool_scratchie/db/sql/tool_insert.sql =================================================================== diff -u --- lams_tool_scratchie/db/sql/tool_insert.sql (revision 0) +++ lams_tool_scratchie/db/sql/tool_insert.sql (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,62 @@ +# 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, +contribute_url, +moderation_url, +pedagogical_planner_url, +help_url, +language_file, +create_date_time, +modified_date_time +) +VALUES +( +'lascrt11', +'scratchieService', +'Scratchie', +'Scratchie', +'scratchie', +'@tool_version@', +NULL, +NULL, +0, +2, +1, +'tool/lascrt11/learning/start.do?mode=learner', +'tool/lascrt11/learning/start.do?mode=author', +'tool/lascrt11/learning/start.do?mode=teacher', +'tool/lascrt11/authoring/start.do', +'tool/lascrt11/monitoring/summary.do', +'tool/lascrt11/definelater.do', +'tool/lascrt11/exportPortfolio?mode=learner', +'tool/lascrt11/exportPortfolio?mode=teacher', +'tool/lascrt11/contribute.do', +'tool/lascrt11/moderate.do', +'tool/lascrt11/authoring/initPedagogicalPlannerForm.do', +'http://wiki.lamsfoundation.org/display/lamsdocs/lascrt11', +'org.lamsfoundation.lams.tool.scratchie.ApplicationResources', +NOW(), +NOW() +) Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/ScratchieConstants.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,125 @@ +/**************************************************************** + * 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.scratchie; + +public class ScratchieConstants { + public static final String TOOL_SIGNATURE = "lascrt11"; + + public static final String RESOURCE_SERVICE = "scratchieService"; + + public static final String TOOL_CONTENT_HANDLER_NAME = "scratchieToolContentHandler"; + + public static final int COMPLETED = 1; + + // for action forward name + public static final String SUCCESS = "success"; + + public static final String ERROR = "error"; + + public static final String DEFINE_LATER = "definelater"; + + // 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_SESSION_ID = "sessionId"; + + public static final String PARAM_FILE_VERSION_ID = "fileVersionId"; + + public static final String PARAM_FILE_UUID = "fileUuid"; + + public static final String PARAM_ITEM_INDEX = "itemIndex"; + + public static final String PARAM_ITEM_UID = "itemUid"; + + public static final String PARAM_RUN_OFFLINE = "runOffline"; + + // 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_ITEM_LIST = "itemList"; + + public static final String ATTR_ITEM_ORDER_ID_PREFIX = "itemOrderId"; + + public static final String ATTR_ITEM_DESCRIPTION_PREFIX = "itemDescription"; + + public static final String ATTR_ITEM_CORRECT = "itemCorrect"; + + public static final String ATTR_ITEM_COUNT = "itemCount"; + + public static final String ATT_ATTACHMENT_LIST = "instructionAttachmentList"; + + public static final String ATTR_DELETED_ITEM_LIST = "deleteItemList"; + + public static final String ATTR_DELETED_ATTACHMENT_LIST = "deletedAttachmmentList"; + + public static final String ATTR_SCRATCHIE = "scratchie"; + + public static final String ATTR_VISIT_LOGS = "visitLogs"; + + public static final String ATTR_ITEM_UID = "itemUid"; + + public static final String ATTR_NEXT_ACTIVITY_URL = "nextActivityUrl"; + + public static final String ATTR_SUMMARY_LIST = "summaryList"; + + public static final String ATTR_ITEM_SUMMARY = "itemSummary"; + + public static final String ATTR_RESOURCE_INSTRUCTION = "instructions"; + + public static final String ATTR_SCRATCHING_LOCK = "scratchingLock"; + + public static final String ATTR_SESSION_MAP_ID = "sessionMapID"; + + public static final String ATTR_USER_SESSION_ID = "userSessionId"; + + public static final String ATTR_RESOURCE_FORM = "scratchieForm"; + + public static final String ATTR_FILE_TYPE_FLAG = "fileTypeFlag"; + + public static final String ATTR_TITLE = "title"; + + public static final String ATTR_ITEM = "item"; + + public static final String ATTR_USER_FINISHED = "userFinished"; + + public static final String ATTR_IS_GROUPED_ACTIVITY = "isGroupedActivity"; + + public static final String PAGE_EDITABLE = "isPageEditable"; + + 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 LEARNER_NUMBER_ATTEMPTS = "learner.number.of.attempts"; +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/DAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/DAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/DAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,73 @@ +/**************************************************************** + * 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.scratchie.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 Andrey Balan + */ +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_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieAttachmentDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieAttachmentDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieAttachmentDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,28 @@ +/**************************************************************** + * 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.scratchie.dao; + +public interface ScratchieAttachmentDAO extends DAO { + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.dao; + +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; + +public interface ScratchieDAO extends DAO { + + Scratchie getByContentId(Long contentId); + + Scratchie getByUid(Long scratchieUid); + + void delete(Scratchie scratchie); + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; + +public interface ScratchieItemDAO extends DAO { + + /** + * Return all scratchie items which is uploaded by author in given scratchieUid. + * + * @param scratchieUid + * @return + */ + List getAuthoringItems(Long scratchieUid); + + ScratchieItem getByUid(Long scratchieItemUid); + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemVisitDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemVisitDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieItemVisitDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,47 @@ +/**************************************************************** + * 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.scratchie.dao; + +import java.util.List; +import java.util.Map; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItemVisitLog; + +public interface ScratchieItemVisitDAO extends DAO { + + public ScratchieItemVisitLog getScratchieItemLog(Long itemUid, Long userId); + + public int getUserViewLogCount(Long sessionId, Long userId); + + /** + * Return list which contains key pair which key is scratchie item uid, value is number view. + * + * @param contentId + * @return + */ + public Map getSummary(Long contentId); + + public List getLogsBySessionAndUser(Long sessionId, Long userId); + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieSessionDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieSessionDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieSessionDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,40 @@ +/**************************************************************** + * 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.scratchie.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; + +public interface ScratchieSessionDAO extends DAO { + + ScratchieSession getSessionBySessionId(Long sessionId); + + List getByContentId(Long toolContentId); + + void delete(ScratchieSession session); + + void deleteBySessionId(Long toolSessionId); + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieUserDAO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieUserDAO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/ScratchieUserDAO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 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.scratchie.dao; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; + +public interface ScratchieUserDAO extends DAO { + + ScratchieUser getUserByUserIDAndSessionID(Long userID, Long sessionId); + + ScratchieUser getUserByUserIDAndContentID(Long userId, Long contentId); + + List getBySessionID(Long sessionId); +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/BaseDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/BaseDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/BaseDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.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.scratchie.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 Andrey Balan + */ +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_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieAttachmentDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieAttachmentDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieAttachmentDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,30 @@ +/**************************************************************** + * 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.scratchie.dao.hibernate; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieAttachmentDAO; + +public class ScratchieAttachmentDAOHibernate extends BaseDAOHibernate implements ScratchieAttachmentDAO { + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,51 @@ +/**************************************************************** + * 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.scratchie.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieDAO; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; + +public class ScratchieDAOHibernate extends BaseDAOHibernate implements ScratchieDAO { + private static final String GET_RESOURCE_BY_CONTENTID = "from " + Scratchie.class.getName() + + " as r where r.contentId=?"; + + public Scratchie getByContentId(Long contentId) { + List list = getHibernateTemplate().find(GET_RESOURCE_BY_CONTENTID, contentId); + if (list.size() > 0) + return (Scratchie) list.get(0); + else + return null; + } + + public Scratchie getByUid(Long scratchieUid) { + return (Scratchie) getObject(Scratchie.class, scratchieUid); + } + + public void delete(Scratchie scratchie) { + this.getHibernateTemplate().delete(scratchie); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,45 @@ +/**************************************************************** + * 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.scratchie.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemDAO; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; + +public class ScratchieItemDAOHibernate extends BaseDAOHibernate implements ScratchieItemDAO { + + private static final String FIND_AUTHORING_ITEMS = "from " + ScratchieItem.class.getName() + + " where scratchie_uid = ? order by create_date asc"; + + public List getAuthoringItems(Long scratchieUid) { + + return this.getHibernateTemplate().find(FIND_AUTHORING_ITEMS, scratchieUid); + } + + public ScratchieItem getByUid(Long scratchieItemUid) { + return (ScratchieItem) this.getObject(ScratchieItem.class, scratchieItemUid); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemVisitDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemVisitDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieItemVisitDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,83 @@ +/**************************************************************** + * 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.scratchie.dao.hibernate; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemVisitDAO; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItemVisitLog; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; + +public class ScratchieItemVisitDAOHibernate extends BaseDAOHibernate implements ScratchieItemVisitDAO { + + private static final String FIND_BY_ITEM_AND_USER = "from " + ScratchieItemVisitLog.class.getName() + + " as r where r.user.userId = ? and r.scratchieItem.uid=?"; + + private static final String FIND_BY_SESSION_AND_USER = "from " + ScratchieItemVisitLog.class.getName() + + " as r where r.sessionId = ? and r.user.userId=? order by r.accessDate asc"; + + private static final String FIND_VIEW_COUNT_BY_USER = "select count(*) from " + + ScratchieItemVisitLog.class.getName() + " as r where r.sessionId=? and r.user.userId =?"; + + private static final String FIND_SUMMARY = "select v.scratchieItem.uid, count(v.scratchieItem) from " + + ScratchieItemVisitLog.class.getName() + " as v , " + ScratchieSession.class.getName() + " as s, " + + Scratchie.class.getName() + " as r " + " where v.sessionId = s.sessionId " + + " and s.scratchie.uid = r.uid " + " and r.contentId =? " + " group by v.sessionId, v.scratchieItem.uid "; + + public ScratchieItemVisitLog getScratchieItemLog(Long itemUid, Long userId) { + List list = getHibernateTemplate().find(FIND_BY_ITEM_AND_USER, new Object[] { userId, itemUid }); + if (list == null || list.size() == 0) + return null; + return (ScratchieItemVisitLog) list.get(0); + } + + public int getUserViewLogCount(Long toolSessionId, Long userId) { + List list = getHibernateTemplate().find(FIND_VIEW_COUNT_BY_USER, new Object[] { toolSessionId, userId }); + if (list == null || list.size() == 0) + return 0; + return ((Number) list.get(0)).intValue(); + } + + public Map getSummary(Long contentId) { + + // Note: Hibernate 3.1 query.uniqueResult() returns Integer, Hibernate 3.2 query.uniqueResult() returns Long + List result = getHibernateTemplate().find(FIND_SUMMARY, contentId); + Map summaryList = new HashMap(result.size()); + for (Object[] list : result) { + if (list[1] != null) { + summaryList.put((Long) list[0], new Integer(((Number) list[1]).intValue())); + } + } + return summaryList; + + } + + public List getLogsBySessionAndUser(Long sessionId, Long userId) { + return getHibernateTemplate().find(FIND_BY_SESSION_AND_USER, new Object[] { sessionId, userId }); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieSessionDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieSessionDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieSessionDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,57 @@ +/**************************************************************** + * 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.scratchie.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieSessionDAO; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; + +public class ScratchieSessionDAOHibernate extends BaseDAOHibernate implements ScratchieSessionDAO { + + private static final String FIND_BY_SESSION_ID = "from " + ScratchieSession.class.getName() + + " as p where p.sessionId=?"; + private static final String FIND_BY_CONTENT_ID = "from " + ScratchieSession.class.getName() + + " as p where p.scratchie.contentId=?"; + + public ScratchieSession getSessionBySessionId(Long sessionId) { + List list = getHibernateTemplate().find(FIND_BY_SESSION_ID, sessionId); + if (list == null || list.size() == 0) + return null; + return (ScratchieSession) list.get(0); + } + + public List getByContentId(Long toolContentId) { + return getHibernateTemplate().find(FIND_BY_CONTENT_ID, toolContentId); + } + + public void delete(ScratchieSession session) { + this.getHibernateTemplate().delete(session); + } + + public void deleteBySessionId(Long toolSessionId) { + this.removeObject(ScratchieSession.class, toolSessionId); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieUserDAOHibernate.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieUserDAOHibernate.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dao/hibernate/ScratchieUserDAOHibernate.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 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.scratchie.dao.hibernate; + +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieUserDAO; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; + +public class ScratchieUserDAOHibernate extends BaseDAOHibernate implements ScratchieUserDAO { + + private static final String FIND_BY_USER_ID_CONTENT_ID = "from " + ScratchieUser.class.getName() + + " as u where u.userId =? and u.scratchie.contentId=?"; + private static final String FIND_BY_USER_ID_SESSION_ID = "from " + ScratchieUser.class.getName() + + " as u where u.userId =? and u.session.sessionId=?"; + private static final String FIND_BY_SESSION_ID = "from " + ScratchieUser.class.getName() + + " as u where u.session.sessionId=?"; + + public ScratchieUser 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 (ScratchieUser) list.get(0); + } + + public ScratchieUser 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 (ScratchieUser) list.get(0); + } + + public List getBySessionID(Long sessionId) { + return this.getHibernateTemplate().find(FIND_BY_SESSION_ID, sessionId); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/autopatchContext.xml =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/autopatchContext.xml (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dbupdates/autopatchContext.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,11 @@ + + + + + + + + + + + Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/ReflectDTO.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/ReflectDTO.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/ReflectDTO.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,79 @@ +package org.lamsfoundation.lams.tool.scratchie.dto; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; + +/** + * + * @author Andrey Balan + */ +public class ReflectDTO { + private Long userUid; + private String fullName; + private String loginName; + private boolean hasRefection; + private String reflectInstrctions; + private boolean finishReflection; + private String reflect; + + public ReflectDTO(ScratchieUser 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 boolean isHasRefection() { + return hasRefection; + } + + public void setHasRefection(boolean hasRefection) { + this.hasRefection = hasRefection; + } + + 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; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/Summary.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/Summary.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/dto/Summary.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,230 @@ +/**************************************************************** + * 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.scratchie.dto; + +import java.util.ArrayList; +import java.util.List; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; + +/** + * List contains following element:
+ * + *
  • session_id
  • session_name
  • ScratchieItem.uid
  • + * ScratchieItem.item_type
  • ScratchieItem.create_by_author
  • + * ScratchieItem.is_hide
  • ScratchieItem.title
  • User.login_name
  • count(scratchie_item_uid)
  • + * + * @author Andrey Balan + */ +public class Summary { + + private Long sessionId; + private String sessionName; + private Long itemUid; + private short itemType; + private boolean itemCreateByAuthor; + private String itemTitle; + private List itemInstructions = new ArrayList(); + private String username; + private int viewNumber; + + // following is used for export portfolio programs: + private String url; + private Long fileUuid; + private Long fileVersionId; + private String fileName; + private String attachmentLocalUrl; + + // true: initial group item, false, belong to some group. + private boolean isInitGroup; + + public Summary() { + } + + /** + * Contruction method for monitoring summary function. + * + * Don't not set isInitGroup and viewNumber fields + * + * @param sessionName + * @param item + * @param isInitGroup + */ + public Summary(Long sessionId, String sessionName, ScratchieItem item) { + this.sessionId = sessionId; + this.sessionName = sessionName; + if (item != null) { + this.itemUid = item.getUid(); + this.itemCreateByAuthor = item.isCreateByAuthor(); + this.itemTitle = item.getDescription(); + this.username = item.getCreateBy() == null ? "" : item.getCreateBy().getLoginName(); + } else + this.itemUid = new Long(-1); + } + + /** + * Contruction method for export profolio function. + * + * Don't not set sessionId and viewNumber fields + * + * @param sessionName + * @param item + * @param isInitGroup + */ + public Summary(Long sessionId, String sessionName, ScratchieItem item, boolean isInitGroup) { + this.sessionId = sessionId; + this.sessionName = sessionName; + if (item != null) { + this.itemUid = item.getUid(); + this.itemCreateByAuthor = item.isCreateByAuthor(); + // TODO maybe a,b,c,d ? + this.itemTitle = item.getDescription(); + this.username = item.getCreateBy() == null ? "" : item.getCreateBy().getLoginName(); + } else + this.itemUid = new Long(-1); + this.isInitGroup = isInitGroup; + } + + public boolean isItemCreateByAuthor() { + return itemCreateByAuthor; + } + + public void setItemCreateByAuthor(boolean itemCreateByAuthor) { + this.itemCreateByAuthor = itemCreateByAuthor; + } + + public String getItemTitle() { + return itemTitle; + } + + public void setItemTitle(String itemTitle) { + this.itemTitle = itemTitle; + } + + public short getItemType() { + return itemType; + } + + public void setItemType(short itemType) { + this.itemType = itemType; + } + + public Long getItemUid() { + return itemUid; + } + + public void setItemUid(Long itemUid) { + this.itemUid = itemUid; + } + + 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; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public int getViewNumber() { + return viewNumber; + } + + public void setViewNumber(int viewNumber) { + this.viewNumber = viewNumber; + } + + public Long getFileUuid() { + return fileUuid; + } + + public void setFileUuid(Long fileUuid) { + this.fileUuid = fileUuid; + } + + public Long getFileVersionId() { + return fileVersionId; + } + + public void setFileVersionId(Long fileVersionId) { + this.fileVersionId = fileVersionId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public boolean isInitGroup() { + return isInitGroup; + } + + public void setInitGroup(boolean isInitGroup) { + this.isInitGroup = isInitGroup; + } + + public String getAttachmentLocalUrl() { + return attachmentLocalUrl; + } + + public void setAttachmentLocalUrl(String attachmentLocalUrl) { + this.attachmentLocalUrl = attachmentLocalUrl; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public List getItemInstructions() { + return itemInstructions; + } + + public void setItemInstructions(List itemInstructions) { + this.itemInstructions = itemInstructions; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/GroupSummary.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/GroupSummary.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/GroupSummary.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,73 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.Collection; + +public class GroupSummary { + + private Long sessionId; + private String sessionName; + + private Collection users; + + /** + * Contruction method for monitoring summary function. + * + * Don't not set isInitGroup and viewNumber fields + * + * @param sessionName + * @param item + * @param isInitGroup + */ + public GroupSummary(Long sessionId, String sessionName) { + this.sessionId = sessionId; + this.sessionName = 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; + } + + public Collection getUsers() { + return users; + } + + public void setUsers(Collection users) { + this.users = users; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/Scratchie.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,482 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieToolContentHandler; + +/** + * Scratchie + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_scratchie" + * + */ +public class Scratchie implements Cloneable { + + private static final Logger log = Logger.getLogger(Scratchie.class); + + // key + private Long uid; + + // tool contentID + private Long contentId; + + private String title; + + private String instructions; + + // advance + private boolean runOffline; + + private boolean defineLater; + + private boolean contentInUse; + + // instructions + private String onlineInstructions; + + private String offlineInstructions; + + private Set attachments; + + // general infomation + private Date created; + + private Date updated; + + private ScratchieUser createdBy; + + // scratchie Items + private Set scratchieItems; + + private boolean reflectOnActivity; + + private String reflectInstructions; + + // *************** NON Persist Fields ******************** + private IToolContentHandler toolContentHandler; + + private List onlineFileList; + + private List offlineFileList; + + /** + * Default contruction method. + * + */ + public Scratchie() { + attachments = new HashSet(); + scratchieItems = new HashSet(); + } + + // ********************************************************** + // Function method for Scratchie + // ********************************************************** + public static Scratchie newInstance(Scratchie defaultContent, Long contentId, + ScratchieToolContentHandler scratchieToolContentHandler) { + Scratchie toContent = new Scratchie(); + defaultContent.toolContentHandler = scratchieToolContentHandler; + toContent = (Scratchie) defaultContent.clone(); + toContent.setContentId(contentId); + + // reset user info as well + if (toContent.getCreatedBy() != null) { + toContent.getCreatedBy().setScratchie(toContent); + Set items = toContent.getScratchieItems(); + for (ScratchieItem item : items) { + item.setCreateBy(toContent.getCreatedBy()); + } + } + return toContent; + } + + @Override + public Object clone() { + + Scratchie scratchie = null; + try { + scratchie = (Scratchie) super.clone(); + scratchie.setUid(null); + if (scratchieItems != null) { + Iterator iter = scratchieItems.iterator(); + Set set = new HashSet(); + while (iter.hasNext()) { + ScratchieItem item = (ScratchieItem) iter.next(); + ScratchieItem newItem = (ScratchieItem) item.clone(); + // just clone old file without duplicate it in repository + set.add(newItem); + } + scratchie.scratchieItems = set; + } + // clone attachment + if (attachments != null) { + Iterator iter = attachments.iterator(); + Set set = new HashSet(); + while (iter.hasNext()) { + ScratchieAttachment file = (ScratchieAttachment) iter.next(); + ScratchieAttachment newFile = (ScratchieAttachment) file.clone(); + // just clone old file without duplicate it in repository + + set.add(newFile); + } + scratchie.attachments = set; + } + // clone ReourceUser as well + if (createdBy != null) { + scratchie.setCreatedBy((ScratchieUser) createdBy.clone()); + } + } catch (CloneNotSupportedException e) { + Scratchie.log.error("When clone " + Scratchie.class + " failed"); + } + + return scratchie; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Scratchie)) { + return false; + } + + final Scratchie genericEntity = (Scratchie) o; + + return new EqualsBuilder().append(uid, genericEntity.uid).append(title, genericEntity.title) + .append(instructions, genericEntity.instructions) + .append(onlineInstructions, genericEntity.onlineInstructions) + .append(offlineInstructions, genericEntity.offlineInstructions).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(onlineInstructions) + .append(offlineInstructions).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)); + } + + public void toDTO() { + onlineFileList = new ArrayList(); + offlineFileList = new ArrayList(); + Set fileSet = this.getAttachments(); + if (fileSet != null) { + for (ScratchieAttachment file : fileSet) { + if (StringUtils.equalsIgnoreCase(file.getFileType(), IToolContentHandler.TYPE_OFFLINE)) { + offlineFileList.add(file); + } else { + onlineFileList.add(file); + } + } + } + } + + // ********************************************************** + // get/set methods + // ********************************************************** + /** + * Returns the object's creation date + * + * @return date + * @hibernate.property column="create_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 + * @hibernate.property column="update_date" + */ + 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 scratchie. + * + * @hibernate.many-to-one cascade="save-update" column="create_by" + * + */ + public ScratchieUser getCreatedBy() { + return createdBy; + } + + /** + * @param createdBy + * The userid of the user who created this Share scratchie. + */ + public void setCreatedBy(ScratchieUser createdBy) { + this.createdBy = createdBy; + } + + /** + * @hibernate.id column="uid" generator-class="native" + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @return Returns the title. + * + * @hibernate.property column="title" + * + */ + public String getTitle() { + return title; + } + + /** + * @param title + * The title to set. + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * @return Returns the runOffline. + * + * @hibernate.property column="run_offline" + * + */ + public boolean getRunOffline() { + return runOffline; + } + + /** + * @param runOffline + * The forceOffLine to set. + * + * + */ + public void setRunOffline(boolean forceOffline) { + runOffline = forceOffline; + } + + /** + * @return Returns the instructions set by the teacher. + * + * @hibernate.property column="instructions" type="text" + */ + public String getInstructions() { + return instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + /** + * @return Returns the onlineInstructions set by the teacher. + * + * @hibernate.property column="online_instructions" type="text" + */ + public String getOnlineInstructions() { + return onlineInstructions; + } + + public void setOnlineInstructions(String onlineInstructions) { + this.onlineInstructions = onlineInstructions; + } + + /** + * @return Returns the onlineInstructions set by the teacher. + * + * @hibernate.property column="offline_instructions" type="text" + */ + public String getOfflineInstructions() { + return offlineInstructions; + } + + public void setOfflineInstructions(String offlineInstructions) { + this.offlineInstructions = offlineInstructions; + } + + /** + * + * @hibernate.set lazy="true" cascade="all" inverse="false" order-by="create_date desc" + * @hibernate.collection-key column="scratchie_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.scratchie.model.ScratchieAttachment" + * + * @return a set of Attachments to this Message. + */ + public Set getAttachments() { + return attachments; + } + + /* + * @param attachments The attachments to set. + */ + public void setAttachments(Set attachments) { + this.attachments = attachments; + } + + /** + * + * + * @hibernate.set lazy="true" inverse="false" cascade="all" order-by="create_date desc" + * @hibernate.collection-key column="scratchie_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem" + * + * @return + */ + public Set getScratchieItems() { + return scratchieItems; + } + + public void setScratchieItems(Set scratchieItems) { + this.scratchieItems = scratchieItems; + } + + /** + * @hibernate.property column="content_in_use" + * @return + */ + public boolean isContentInUse() { + return contentInUse; + } + + public void setContentInUse(boolean contentInUse) { + this.contentInUse = contentInUse; + } + + /** + * @hibernate.property column="define_later" + * @return + */ + public boolean isDefineLater() { + return defineLater; + } + + public void setDefineLater(boolean defineLater) { + this.defineLater = defineLater; + } + + /** + * @hibernate.property column="content_id" unique="true" + * @return + */ + public Long getContentId() { + return contentId; + } + + public void setContentId(Long contentId) { + this.contentId = contentId; + } + + public List getOfflineFileList() { + return offlineFileList; + } + + public void setOfflineFileList(List offlineFileList) { + this.offlineFileList = offlineFileList; + } + + public List getOnlineFileList() { + return onlineFileList; + } + + public void setOnlineFileList(List onlineFileList) { + this.onlineFileList = onlineFileList; + } + + public void setToolContentHandler(IToolContentHandler toolContentHandler) { + this.toolContentHandler = toolContentHandler; + } + + /** + * @hibernate.property column="reflect_instructions" + * @return + */ + public String getReflectInstructions() { + return reflectInstructions; + } + + public void setReflectInstructions(String reflectInstructions) { + this.reflectInstructions = reflectInstructions; + } + + /** + * @hibernate.property column="reflect_on_activity" + * @return + */ + public boolean isReflectOnActivity() { + return reflectOnActivity; + } + + public void setReflectOnActivity(boolean reflectOnActivity) { + this.reflectOnActivity = reflectOnActivity; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieAttachment.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieAttachment.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieAttachment.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,159 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.Date; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.log4j.Logger; + +/** + * A Wrapper class for uploaded files. An Attachment cannot exist independently and must belong to a Scratchie. + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_attachment" + * + */ +public class ScratchieAttachment implements Cloneable { + private static final Logger log = Logger.getLogger(ScratchieAttachment.class); + + private Long uid; + private Long fileUuid; + private Long fileVersionId; + private String fileType; + private String fileName; + private Date created; + + // Default contruction method + public ScratchieAttachment() { + + } + + // ********************************************************** + // Function method for Attachment + // ********************************************************** + public Object clone() { + Object obj = null; + try { + obj = super.clone(); + ((ScratchieAttachment) obj).setUid(null); + } catch (CloneNotSupportedException e) { + log.error("When clone " + ScratchieAttachment.class + " failed"); + } + + return obj; + } + + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof ScratchieAttachment)) + return false; + + final ScratchieAttachment genericEntity = (ScratchieAttachment) o; + + return new EqualsBuilder().append(this.uid, genericEntity.uid) + .append(this.fileVersionId, genericEntity.fileVersionId).append(this.fileName, genericEntity.fileName) + .append(this.fileType, genericEntity.fileType).append(this.created, genericEntity.created).isEquals(); + } + + public int hashCode() { + return new HashCodeBuilder().append(uid).append(fileVersionId).append(fileName).append(fileType) + .append(created).toHashCode(); + } + + // ********************************************************** + // get/set methods + // ********************************************************** + /** + * @hibernate.id column="uid" generator-class="native" + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="file_version_id" + * + */ + public Long getFileVersionId() { + return fileVersionId; + } + + public void setFileVersionId(Long version) { + this.fileVersionId = version; + } + + /** + * @hibernate.property column="file_type" + */ + public String getFileType() { + return fileType; + } + + public void setFileType(String type) { + this.fileType = type; + } + + /** + * @hibernate.property column="file_name" + */ + public String getFileName() { + return fileName; + } + + public void setFileName(String name) { + this.fileName = name; + } + + /** + * @hibernate.property column="file_uuid" + * @return + */ + public Long getFileUuid() { + return fileUuid; + } + + public void setFileUuid(Long uuid) { + this.fileUuid = uuid; + } + + /** + * @hibernate.property column="create_date" + * @return + */ + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItem.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,183 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.Date; + +import org.apache.log4j.Logger; + +/** + * Scratchie + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_scratchie_item" + * + */ +public class ScratchieItem implements Cloneable { + private static final Logger log = Logger.getLogger(ScratchieItem.class); + + private Long uid; + + private String description; + + private boolean correct; + + private Integer orderId; + + private boolean isCreateByAuthor; + + private Date createDate; + private ScratchieUser createBy; + + // *********************************************** + // DTO fields: + private boolean scratched; + private Date scratchedDate; + + public Object clone() { + ScratchieItem obj = null; + try { + obj = (ScratchieItem) super.clone(); + + ((ScratchieItem) obj).setUid(null); + // clone ReourceUser as well + if (this.createBy != null) + ((ScratchieItem) obj).setCreateBy((ScratchieUser) this.createBy.clone()); + + } catch (CloneNotSupportedException e) { + log.error("When clone " + ScratchieItem.class + " failed"); + } + + return obj; + } + + // ********************************************************** + // 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="description" + * @return + */ + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * @hibernate.many-to-one cascade="none" column="create_by" + * + * @return + */ + public ScratchieUser getCreateBy() { + return createBy; + } + + public void setCreateBy(ScratchieUser createBy) { + this.createBy = createBy; + } + + /** + * @hibernate.property column="create_date" + * @return + */ + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + /** + * @hibernate.property column="create_by_author" + * @return + */ + public boolean isCreateByAuthor() { + return isCreateByAuthor; + } + + public void setCreateByAuthor(boolean isCreateByAuthor) { + this.isCreateByAuthor = isCreateByAuthor; + } + + /** + * @hibernate.property column="correct" + * @return + */ + public boolean isCorrect() { + return correct; + } + + public void setCorrect(boolean correctScratchie) { + this.correct = correctScratchie; + } + + /** + * @hibernate.property column="order_id" + * @return + */ + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public void setScratched(boolean complete) { + this.scratched = complete; + } + + public boolean isScratched() { + return scratched; + } + + public Date getScratchedDate() { + return scratchedDate; + } + + public void setScratchedDate(Date scratchedDate) { + this.scratchedDate = scratchedDate; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItemVisitLog.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItemVisitLog.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieItemVisitLog.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,105 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.Date; + +/** + * Scratchie + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_item_log" + * + */ +public class ScratchieItemVisitLog { + + private Long uid; + private ScratchieUser user; + private ScratchieItem scratchieItem; + private Date accessDate; + private Long sessionId; + + /** + * @hibernate.property column="access_date" + * @return + */ + public Date getAccessDate() { + return accessDate; + } + + public void setAccessDate(Date accessDate) { + this.accessDate = accessDate; + } + + /** + * @hibernate.many-to-one column="scratchie_item_uid" cascade="none" + * @return + */ + public ScratchieItem getScratchieItem() { + return scratchieItem; + } + + public void setScratchieItem(ScratchieItem item) { + this.scratchieItem = item; + } + + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the log Uid. + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.many-to-one column="user_uid" cascade="none" + * @return + */ + public ScratchieUser getUser() { + return user; + } + + public void setUser(ScratchieUser user) { + this.user = user; + } + + /** + * @hibernate.property column="session_id" + * @return + */ + public Long getSessionId() { + return sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieSession.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieSession.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieSession.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,164 @@ +/**************************************************************** + * 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.scratchie.model; + +import java.util.Date; +import java.util.Set; + +import org.apache.log4j.Logger; + +/** + * Scratchie + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_session" + * + */ +public class ScratchieSession { + + private static Logger log = Logger.getLogger(ScratchieSession.class); + + private Long uid; + private Long sessionId; + private String sessionName; + private Scratchie scratchie; + private Date sessionStartDate; + private Date sessionEndDate; + // finish or not + private int status; + // scratchie Items + private Set scratchieItems; + + // ********************************************************** + // 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="scratchie_uid" cascade="none" + * @return + */ + public Scratchie getScratchie() { + return scratchie; + } + + public void setScratchie(Scratchie scratchie) { + this.scratchie = scratchie; + } + + /** + * @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; + } + + /** + * + * + * @hibernate.set lazy="true" inverse="false" cascade="all" order-by="create_date desc" + * @hibernate.collection-key column="session_uid" + * @hibernate.collection-one-to-many class="org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem" + * + * @return + */ + public Set getScratchieItems() { + return scratchieItems; + } + + public void setScratchieItems(Set scratchieItems) { + this.scratchieItems = scratchieItems; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieUser.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieUser.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/model/ScratchieUser.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,248 @@ +/**************************************************************** + * 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.scratchie.model; + +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; + +/** + * Scratchie + * + * @author Andrey Balan + * + * @hibernate.class table="tl_lascrt11_user" + * + */ +public class ScratchieUser implements Cloneable { + private static final long serialVersionUID = -7043502180037866257L; + private static Logger log = Logger.getLogger(ScratchieUser.class); + + private Long uid; + private Long userId; + private String firstName; + private String lastName; + private String loginName; + private boolean sessionFinished; + + private ScratchieSession session; + private Scratchie scratchie; + + // =============== NON Persisit value: for display use =========== + // the user access some reousrce item date time. Use in monitoring summary page + private int mark; + private int totalAttempts; + private int attemptNumber; + + public ScratchieUser() { + } + + public ScratchieUser(UserDTO user, ScratchieSession session) { + this.userId = new Long(user.getUserID().intValue()); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.loginName = user.getLogin(); + this.session = session; + this.scratchie = null; + this.sessionFinished = false; + } + + public ScratchieUser(UserDTO user, Scratchie content) { + this.userId = new Long(user.getUserID().intValue()); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.loginName = user.getLogin(); + this.session = null; + this.scratchie = content; + this.sessionFinished = false; + } + + /** + * Clone method from java.lang.Object + */ + public Object clone() { + + ScratchieUser user = null; + try { + user = (ScratchieUser) super.clone(); + user.setUid(null); + // never clone session + user.setSession(null); + } catch (CloneNotSupportedException e) { + log.error("When clone " + ScratchieUser.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 ScratchieSession getSession() { + return session; + } + + public void setSession(ScratchieSession session) { + this.session = session; + } + + /** + * @hibernate.many-to-one column="scratchie_uid" cascade="none" + * @return + */ + public Scratchie getScratchie() { + return scratchie; + } + + public void setScratchie(Scratchie content) { + this.scratchie = 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 ScratchieUser)) + return false; + + final ScratchieUser user = (ScratchieUser) 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 int getMark() { + return mark; + } + + public void setMark(int mark) { + this.mark = mark; + } + + public int getTotalAttempts() { + return totalAttempts; + } + + public void setTotalAttempts(int totalAttempts) { + this.totalAttempts = totalAttempts; + } + + public int getAttemptNumber() { + return attemptNumber; + } + + public void setAttemptNumber(int attemptNumber) { + this.attemptNumber = attemptNumber; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/scratchieApplicationContext.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,140 @@ + + + + + + + + + org.lamsfoundation.lams.tool.scratchie.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 + PROPAGATION_REQUIRED,+java.lang.Exception + PROPAGATION_REQUIRED,+java.lang.Exception + + + + + Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,271 @@ +/**************************************************************** + * 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.scratchie.service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.events.IEventNotificationService; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; +import org.lamsfoundation.lams.tool.scratchie.dto.Summary; +import org.lamsfoundation.lams.tool.scratchie.model.GroupSummary; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAttachment; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItemVisitLog; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.usermanagement.User; + +/** + * Interface that defines the contract that all ShareScratchie service provider must follow. + * + * @author Andrey Balan + */ +public interface IScratchieService { + + /** + * Get Scratchie by toolContentID. + * + * @param contentId + * @return + */ + Scratchie getScratchieByContentId(Long contentId); + + /** + * Get a cloned copy of tool default tool content (Scratchie) and assign the toolContentId of that copy as the given + * contentId + * + * @param contentId + * @return + * @throws ScratchieApplicationException + */ + Scratchie getDefaultContent(Long contentId) throws ScratchieApplicationException; + + /** + * Get list of scratchie items by given scratchieUid. These scratchie items must be created by author. + * + * @param scratchieUid + * @return + */ + List getAuthoredItems(Long scratchieUid); + + /** + * Upload instruciton file into repository. + * + * @param file + * @param type + * @return + * @throws UploadScratchieFileException + */ + ScratchieAttachment uploadInstructionFile(FormFile file, String type) throws UploadScratchieFileException; + + // ********** for user methods ************* + /** + * Create a new user in database. + */ + void createUser(ScratchieUser scratchieUser); + + /** + * Get user by given userID and toolContentID. + * + * @param long1 + * @return + */ + ScratchieUser getUserByIDAndContent(Long userID, Long contentId); + + /** + * Get user by sessionID and UserID + * + * @param long1 + * @param sessionId + * @return + */ + ScratchieUser getUserByIDAndSession(Long long1, Long sessionId); + + // ********** Repository methods *********************** + /** + * Delete file from repository. + */ + void deleteFromRepository(Long fileUuid, Long fileVersionId) throws ScratchieApplicationException; + + /** + * Save or update scratchie into database. + * + * @param Scratchie + */ + void saveOrUpdateScratchie(Scratchie Scratchie); + + /** + * Delete reource attachment(i.e., offline/online instruction file) from database. This method does not delete the + * file from repository. + * + * @param attachmentUid + */ + void deleteScratchieAttachment(Long attachmentUid); + + /** + * Delete resoruce item from database. + * + * @param uid + */ + void deleteScratchieItem(Long uid); + + /** + * Get scratchie which is relative with the special toolSession. + * + * @param sessionId + * @return + */ + Scratchie getScratchieBySessionId(Long sessionId); + + /** + * Get scratchie toolSession by toolSessionId + * + * @param sessionId + * @return + */ + ScratchieSession getScratchieSessionBySessionId(Long sessionId); + + /** + * Save or update scratchie session. + * + * @param resSession + */ + void saveOrUpdateScratchieSession(ScratchieSession resSession); + + void retrieveScratched(Collection scratchieItemList, ScratchieUser user); + + void setItemAccess(Long scratchieItemUid, Long userId, Long sessionId); + + int getNumberAttempts(Long userId, Long sessionId); + + /** + * If success return next activity's url, otherwise return null. + * + * @param toolSessionId + * @param userId + * @return + */ + String finishToolSession(Long toolSessionId, Long userId) throws ScratchieApplicationException; + + ScratchieItem getScratchieItemByUid(Long itemUid); + + List getMonitoringSummary(Long contentId); + + List getUserMasterDetail(Long sessionId, Long userId); + + List getQuestionSummary(Long contentId, Long itemUid); + + /** + * Get scratchie item Summary list according to sessionId and skipHide flag. + * + * @param sessionId + * @param skipHide + * true, don't get scratchie item if its isHide flag is true. Otherwise, get all + * scratchie item + * @return + */ + public List exportBySessionId(Long sessionId); + + public List> exportByContentId(Long contentId); + + /** + * Create refection entry into notebook tool. + * + * @param sessionId + * @param notebook_tool + * @param tool_signature + * @param userId + * @param entryText + */ + public 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 + */ + public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID); + + /** + * @param notebookEntry + */ + public void updateEntry(NotebookEntry notebookEntry); + + /** + * Get Reflect DTO list grouped by sessionID. + * + * @param contentId + * @return + */ + Map> getReflectList(Long contentId, boolean setEntry); + + /** + * Get user by UID + * + * @param uid + * @return + */ + ScratchieUser getUser(Long uid); + + public IEventNotificationService getEventNotificationService(); + + /** + * Gets a message from scratchie bundle. Same as in JSP pages. + * + * @param key + * key of the message + * @param args + * arguments for the message + * @return message content + */ + String getLocalisedMessage(String key, Object[] args); + + /** + * Finds out which lesson the given tool content belongs to and returns its monitoring users. + * + * @param sessionId + * tool session ID + * @return list of teachers that monitor the lesson which contains the tool with given session ID + */ + public List getMonitorsByToolSessionId(Long sessionId); + + /** + * Returns whether activity is grouped and therefore it is expected more than one tool session. + * + * @param toolContentID + * @return + */ + boolean isGroupedActivity(long toolContentID); +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieApplicationException.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieApplicationException.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieApplicationException.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.service; + +public class ScratchieApplicationException extends Exception { + + public ScratchieApplicationException() { + super(); + + } + + public ScratchieApplicationException(String message, Throwable cause) { + super(message, cause); + + } + + public ScratchieApplicationException(String message) { + super(message); + + } + + public ScratchieApplicationException(Throwable cause) { + super(cause); + + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieOutputFactory.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieOutputFactory.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieOutputFactory.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,97 @@ +/**************************************************************** + * 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.scratchie.service; + +import java.util.List; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.lamsfoundation.lams.tool.OutputFactory; +import org.lamsfoundation.lams.tool.ToolOutput; +import org.lamsfoundation.lams.tool.ToolOutputDefinition; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; + +public class ScratchieOutputFactory extends OutputFactory { + + /** + * {@inheritDoc} + */ + @Override + public SortedMap getToolOutputDefinitions(Object toolContentObject, int definitionType) + throws ToolException { + TreeMap definitionMap = new TreeMap(); + switch (definitionType) { + case ToolOutputDefinition.DATA_OUTPUT_DEFINITION_TYPE_CONDITION: + break; + case ToolOutputDefinition.DATA_OUTPUT_DEFINITION_TYPE_DATA_FLOW: + ToolOutputDefinition definition = buildRangeDefinition(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, + new Long(0), null); + definitionMap.put(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, definition); + break; + } + return definitionMap; + } + + /** + * Follows {@link PixlrService#getToolOutput(List, Long, Long)}. + * + */ + public SortedMap getToolOutput(List names, IScratchieService scratchieService, + Long toolSessionId, Long learnerId) { + + TreeMap outputs = new TreeMap(); + // tool output cache + TreeMap baseOutputs = new TreeMap(); + if (names == null || names.contains(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS)) { + outputs.put( + ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, + getToolOutput(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, scratchieService, toolSessionId, + learnerId)); + } + + return outputs; + + } + + public ToolOutput getToolOutput(String name, IScratchieService scratchieService, Long toolSessionId, Long learnerId) { + if (name.equals(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS)) { + return getNumberAttempts(scratchieService, toolSessionId, learnerId); + } + + return null; + } + + /** + * Get the number of attempts done by user. Will always return a ToolOutput object. + */ + private ToolOutput getNumberAttempts(IScratchieService scratchieService, Long toolSessionId, Long learnerId) { + + int numberAttempts = scratchieService.getNumberAttempts(learnerId, toolSessionId); + + return new ToolOutput(ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, getI18NText( + ScratchieConstants.LEARNER_NUMBER_ATTEMPTS, true), numberAttempts); + + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,1093 @@ +/**************************************************************** + * 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.scratchie.service; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.TreeSet; +import java.util.Vector; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.contentrepository.AccessDeniedException; +import org.lamsfoundation.lams.contentrepository.ICredentials; +import org.lamsfoundation.lams.contentrepository.ITicket; +import org.lamsfoundation.lams.contentrepository.IVersionedNode; +import org.lamsfoundation.lams.contentrepository.InvalidParameterException; +import org.lamsfoundation.lams.contentrepository.LoginException; +import org.lamsfoundation.lams.contentrepository.NodeKey; +import org.lamsfoundation.lams.contentrepository.RepositoryCheckedException; +import org.lamsfoundation.lams.contentrepository.WorkspaceNotFoundException; +import org.lamsfoundation.lams.contentrepository.service.IRepositoryService; +import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials; +import org.lamsfoundation.lams.events.IEventNotificationService; +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.lesson.service.ILessonService; +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.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.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieAttachmentDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieItemVisitDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieSessionDAO; +import org.lamsfoundation.lams.tool.scratchie.dao.ScratchieUserDAO; +import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; +import org.lamsfoundation.lams.tool.scratchie.dto.Summary; +import org.lamsfoundation.lams.tool.scratchie.model.GroupSummary; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAttachment; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItemVisitLog; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.tool.scratchie.util.ReflectDTOComparator; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieToolContentHandler; +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.MessageService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.util.audit.IAuditService; +import org.lamsfoundation.lams.util.wddx.WDDXProcessor; +import org.lamsfoundation.lams.util.wddx.WDDXProcessorConversionException; + +/** + * + * @author Dapeng.Ni + */ +public class ScratchieServiceImpl implements IScratchieService, ToolContentManager, ToolSessionManager, + ToolContentImport102Manager { + static Logger log = Logger.getLogger(ScratchieServiceImpl.class.getName()); + + private ScratchieDAO scratchieDao; + + private ScratchieItemDAO scratchieItemDao; + + private ScratchieAttachmentDAO scratchieAttachmentDao; + + private ScratchieUserDAO scratchieUserDao; + + private ScratchieSessionDAO scratchieSessionDao; + + private ScratchieItemVisitDAO scratchieItemVisitDao; + + // tool service + private ScratchieToolContentHandler scratchieToolContentHandler; + + private MessageService messageService; + + // system services + private IRepositoryService repositoryService; + + private ILamsToolService toolService; + + private ILearnerService learnerService; + + private IAuditService auditService; + + private IUserManagementService userManagementService; + + private IExportToolContentService exportContentService; + + private ICoreNotebookService coreNotebookService; + + private IEventNotificationService eventNotificationService; + + private ILessonService lessonService; + + private ScratchieOutputFactory scratchieOutputFactory; + + // ******************************************************************************* + // Service method + // ******************************************************************************* + /** + * Try to get the file. If forceLogin = false and an access denied exception occurs, call this method again to get a + * new ticket and retry file lookup. If forceLogin = true and it then fails then throw exception. + * + * @param uuid + * @param versionId + * @param relativePath + * @param attemptCount + * @return file node + * @throws ImscpApplicationException + */ + private IVersionedNode getFile(Long uuid, Long versionId, String relativePath) throws ScratchieApplicationException { + + ITicket tic = getRepositoryLoginTicket(); + + try { + + return repositoryService.getFileItem(tic, uuid, versionId, relativePath); + + } catch (AccessDeniedException e) { + + String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId + + " path " + relativePath + "."; + + error = error + "AccessDeniedException: " + e.getMessage() + " Unable to retry further."; + ScratchieServiceImpl.log.error(error); + throw new ScratchieApplicationException(error, e); + + } catch (Exception e) { + + String error = "Unable to access repository to get file uuid " + uuid + " version id " + versionId + + " path " + relativePath + "." + " Exception: " + e.getMessage(); + ScratchieServiceImpl.log.error(error); + throw new ScratchieApplicationException(error, e); + + } + } + + /** + * This method verifies the credentials of the Scratchie Tool and gives it the Ticket to login and + * access the Content Repository. + * + * A valid ticket is needed in order to access the content from the repository. This method would be called evertime + * the tool needs to upload/download files from the content repository. + * + * @return ITicket The ticket for repostory access + * @throws ScratchieApplicationException + */ + private ITicket getRepositoryLoginTicket() throws ScratchieApplicationException { + ICredentials credentials = new SimpleCredentials(scratchieToolContentHandler.getRepositoryUser(), + scratchieToolContentHandler.getRepositoryId()); + try { + ITicket ticket = repositoryService.login(credentials, + scratchieToolContentHandler.getRepositoryWorkspaceName()); + return ticket; + } catch (AccessDeniedException ae) { + throw new ScratchieApplicationException("Access Denied to repository." + ae.getMessage()); + } catch (WorkspaceNotFoundException we) { + throw new ScratchieApplicationException("Workspace not found." + we.getMessage()); + } catch (LoginException e) { + throw new ScratchieApplicationException("Login failed." + e.getMessage()); + } + } + + public Scratchie getScratchieByContentId(Long contentId) { + Scratchie rs = scratchieDao.getByContentId(contentId); + if (rs == null) { + ScratchieServiceImpl.log.debug("Could not find the content by given ID:" + contentId); + } + return rs; + } + + public Scratchie getDefaultContent(Long contentId) throws ScratchieApplicationException { + if (contentId == null) { + String error = messageService.getMessage("error.msg.default.content.not.find"); + ScratchieServiceImpl.log.error(error); + throw new ScratchieApplicationException(error); + } + + Scratchie defaultContent = getDefaultScratchie(); + // save default content by given ID. + Scratchie content = new Scratchie(); + content = Scratchie.newInstance(defaultContent, contentId, scratchieToolContentHandler); + return content; + } + + public List getAuthoredItems(Long scratchieUid) { + return scratchieItemDao.getAuthoringItems(scratchieUid); + } + + public ScratchieAttachment uploadInstructionFile(FormFile uploadFile, String fileType) + throws UploadScratchieFileException { + if (uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.upload.file.not.found", + new Object[] { uploadFile })); + } + + // upload file to repository + NodeKey nodeKey = processFile(uploadFile, fileType); + + // create new attachement + ScratchieAttachment file = new ScratchieAttachment(); + file.setFileType(fileType); + file.setFileUuid(nodeKey.getUuid()); + file.setFileVersionId(nodeKey.getVersion()); + file.setFileName(uploadFile.getFileName()); + file.setCreated(new Date()); + + return file; + } + + public void createUser(ScratchieUser scratchieUser) { + scratchieUserDao.saveObject(scratchieUser); + } + + public ScratchieUser getUserByIDAndContent(Long userId, Long contentId) { + + return scratchieUserDao.getUserByUserIDAndContentID(userId, contentId); + + } + + public ScratchieUser getUserByIDAndSession(Long userId, Long sessionId) { + + return scratchieUserDao.getUserByUserIDAndSessionID(userId, sessionId); + + } + + public void deleteFromRepository(Long fileUuid, Long fileVersionId) throws ScratchieApplicationException { + ITicket ticket = getRepositoryLoginTicket(); + try { + repositoryService.deleteVersion(ticket, fileUuid, fileVersionId); + } catch (Exception e) { + throw new ScratchieApplicationException("Exception occured while deleting files from" + " the repository " + + e.getMessage()); + } + } + + public void saveOrUpdateScratchie(Scratchie scratchie) { + scratchieDao.saveObject(scratchie); + } + + public void deleteScratchieAttachment(Long attachmentUid) { + scratchieAttachmentDao.removeObject(ScratchieAttachment.class, attachmentUid); + + } + + public void saveOrUpdateScratchieItem(ScratchieItem item) { + scratchieItemDao.saveObject(item); + } + + public void deleteScratchieItem(Long uid) { + scratchieItemDao.removeObject(ScratchieItem.class, uid); + } + + public List exportBySessionId(Long sessionId) { + ScratchieSession session = scratchieSessionDao.getSessionBySessionId(sessionId); + if (session == null) { + ScratchieServiceImpl.log.error("Failed get ScratchieSession by ID [" + sessionId + "]"); + return null; + } + // initial scratchie items list + List itemList = new ArrayList(); + Set resList = session.getScratchie().getScratchieItems(); + for (ScratchieItem item : resList) { + // if item is create by author + if (item.isCreateByAuthor()) { + Summary sum = new Summary(session.getSessionId(), session.getSessionName(), item, false); + itemList.add(sum); + } + } + + // get this session's all scratchie items + Set sessList = session.getScratchieItems(); + for (ScratchieItem item : sessList) { + + // to skip all item create by author + if (!item.isCreateByAuthor()) { + Summary sum = new Summary(session.getSessionId(), session.getSessionName(), item, false); + itemList.add(sum); + } + } + + return itemList; + } + + public List> exportByContentId(Long contentId) { + Scratchie scratchie = scratchieDao.getByContentId(contentId); + List> groupList = new ArrayList(); + + // create init scratchie items list + List initList = new ArrayList(); + groupList.add(initList); + Set resList = scratchie.getScratchieItems(); + for (ScratchieItem item : resList) { + if (item.isCreateByAuthor()) { + Summary sum = new Summary(null, null, item, true); + initList.add(sum); + } + } + + // session by session + List sessionList = scratchieSessionDao.getByContentId(contentId); + for (ScratchieSession session : sessionList) { + List group = new ArrayList(); + // get this session's all scratchie items + Set sessList = session.getScratchieItems(); + for (ScratchieItem item : sessList) { + // to skip all item create by author + if (!item.isCreateByAuthor()) { + Summary sum = new Summary(session.getSessionId(), session.getSessionName(), item, false); + group.add(sum); + } + } + if (group.size() == 0) { + group.add(new Summary(session.getSessionId(), session.getSessionName(), null, false)); + } + groupList.add(group); + } + + return groupList; + } + + public Scratchie getScratchieBySessionId(Long sessionId) { + ScratchieSession session = scratchieSessionDao.getSessionBySessionId(sessionId); + // to skip CGLib problem + Long contentId = session.getScratchie().getContentId(); + Scratchie res = scratchieDao.getByContentId(contentId); + return res; + } + + public ScratchieSession getScratchieSessionBySessionId(Long sessionId) { + return scratchieSessionDao.getSessionBySessionId(sessionId); + } + + public void saveOrUpdateScratchieSession(ScratchieSession resSession) { + scratchieSessionDao.saveObject(resSession); + } + + public void retrieveScratched(Collection items, ScratchieUser user) { + for (ScratchieItem item : items) { + ScratchieItemVisitLog log = scratchieItemVisitDao.getScratchieItemLog(item.getUid(), user.getUserId()); + if (log == null) { + item.setScratched(false); + } else { + item.setScratched(true); + item.setScratchedDate(log.getAccessDate()); + } + } + } + + public void setItemAccess(Long scratchieItemUid, Long userId, Long sessionId) { + ScratchieItemVisitLog log = scratchieItemVisitDao.getScratchieItemLog(scratchieItemUid, userId); + if (log == null) { + log = new ScratchieItemVisitLog(); + ScratchieItem item = scratchieItemDao.getByUid(scratchieItemUid); + log.setScratchieItem(item); + ScratchieUser user = scratchieUserDao.getUserByUserIDAndSessionID(userId, sessionId); + log.setUser(user); + log.setSessionId(sessionId); + log.setAccessDate(new Timestamp(new Date().getTime())); + scratchieItemVisitDao.saveObject(log); + } + } + + public int getNumberAttempts(Long userId, Long sessionId) { + return scratchieItemVisitDao.getUserViewLogCount(sessionId, userId); + } + + public String finishToolSession(Long toolSessionId, Long userId) throws ScratchieApplicationException { + ScratchieUser user = scratchieUserDao.getUserByUserIDAndSessionID(userId, toolSessionId); + user.setSessionFinished(true); + scratchieUserDao.saveObject(user); + + // ScratchieSession session = scratchieSessionDao.getSessionBySessionId(toolSessionId); + // session.setStatus(ScratchieConstants.COMPLETED); + // scratchieSessionDao.saveObject(session); + + String nextUrl = null; + try { + nextUrl = this.leaveToolSession(toolSessionId, userId); + } catch (DataMissingException e) { + throw new ScratchieApplicationException(e); + } catch (ToolException e) { + throw new ScratchieApplicationException(e); + } + return nextUrl; + } + + public ScratchieItem getScratchieItemByUid(Long itemUid) { + return scratchieItemDao.getByUid(itemUid); + } + + public List getMonitoringSummary(Long contentId) { + List groupSummaryList = new ArrayList(); + + Scratchie scratchie = scratchieDao.getByContentId(contentId); + + List sessionList = scratchieSessionDao.getByContentId(contentId); + for (ScratchieSession session : sessionList) { + Long sessionId = session.getSessionId(); + // one new summary for one session. + GroupSummary groupSummary = new GroupSummary(sessionId, session.getSessionName()); + + List users = scratchieUserDao.getBySessionID(sessionId); + for (ScratchieUser user : users) { + int attempts = scratchieItemVisitDao.getUserViewLogCount(sessionId, user.getUserId()); + int mark = (attempts == 0) ? -1 : scratchie.getScratchieItems().size() - attempts + 1; + + user.setTotalAttempts(attempts); + user.setMark(mark); + } + + groupSummary.setUsers(users); + groupSummaryList.add(groupSummary); + } + + return groupSummaryList; + } + + public List getUserMasterDetail(Long sessionId, Long userId) { + List logs = scratchieItemVisitDao.getLogsBySessionAndUser(sessionId, userId); + + return logs; + } + + public List getQuestionSummary(Long contentId, Long itemUid) { + + List groupSummaryList = new ArrayList(); + + Scratchie scratchie = scratchieDao.getByContentId(contentId); + + List sessionList = scratchieSessionDao.getByContentId(contentId); + for (ScratchieSession session : sessionList) { + Long sessionId = session.getSessionId(); + // one new summary for one session. + GroupSummary groupSummary = new GroupSummary(sessionId, session.getSessionName()); + + List users = scratchieUserDao.getBySessionID(sessionId); + for (ScratchieUser user : users) { + + int attemptNumber; + ScratchieItemVisitLog log = scratchieItemVisitDao.getScratchieItemLog(itemUid, user.getUserId()); + if (log == null) { + //-1 if there is no log + attemptNumber = -1; + } else { + List allAttempts = scratchieItemVisitDao.getLogsBySessionAndUser(sessionId, user.getUserId()); + attemptNumber = allAttempts.indexOf(log); + } + + user.setAttemptNumber(attemptNumber); + } + + groupSummary.setUsers(users); + groupSummaryList.add(groupSummary); + } + + return groupSummaryList; + } + + public Map> getReflectList(Long contentId, boolean setEntry) { + Map> map = new HashMap>(); + + List sessionList = scratchieSessionDao.getByContentId(contentId); + for (ScratchieSession session : sessionList) { + Long sessionId = session.getSessionId(); + boolean hasRefection = session.getScratchie().isReflectOnActivity(); + Set list = new TreeSet(new ReflectDTOComparator()); + // get all users in this session + List users = scratchieUserDao.getBySessionID(sessionId); + for (ScratchieUser user : users) { + ReflectDTO ref = new ReflectDTO(user); + + if (setEntry) { + NotebookEntry entry = getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.TOOL_SIGNATURE, user.getUserId().intValue()); + if (entry != null) { + ref.setReflect(entry.getEntry()); + } + } + + ref.setHasRefection(hasRefection); + list.add(ref); + } + map.put(sessionId, list); + } + + return map; + } + + public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, + String entryText) { + return coreNotebookService.createNotebookEntry(sessionId, notebookToolType, toolSignature, userId, "", + entryText); + } + + 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); + } + } + + /** + * @param notebookEntry + */ + public void updateEntry(NotebookEntry notebookEntry) { + coreNotebookService.updateEntry(notebookEntry); + } + + public ScratchieUser getUser(Long uid) { + return (ScratchieUser) scratchieUserDao.getObject(ScratchieUser.class, uid); + } + + // ***************************************************************************** + // private methods + // ***************************************************************************** + private Scratchie getDefaultScratchie() throws ScratchieApplicationException { + Long defaultScratchieId = getToolDefaultContentIdBySignature(ScratchieConstants.TOOL_SIGNATURE); + Scratchie defaultScratchie = getScratchieByContentId(defaultScratchieId); + if (defaultScratchie == null) { + String error = messageService.getMessage("error.msg.default.content.not.find"); + ScratchieServiceImpl.log.error(error); + throw new ScratchieApplicationException(error); + } + + return defaultScratchie; + } + + private Long getToolDefaultContentIdBySignature(String toolSignature) throws ScratchieApplicationException { + Long contentId = null; + contentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); + if (contentId == null) { + String error = messageService.getMessage("error.msg.default.content.not.find"); + ScratchieServiceImpl.log.error(error); + throw new ScratchieApplicationException(error); + } + return contentId; + } + + /** + * Process an uploaded file. + * + * @throws ScratchieApplicationException + * @throws FileNotFoundException + * @throws IOException + * @throws RepositoryCheckedException + * @throws InvalidParameterException + */ + private NodeKey processFile(FormFile file, String fileType) throws UploadScratchieFileException { + NodeKey node = null; + if (file != null && !StringUtils.isEmpty(file.getFileName())) { + String fileName = file.getFileName(); + try { + node = scratchieToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType(), + fileType); + } catch (InvalidParameterException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.invaid.param.upload")); + } catch (FileNotFoundException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.file.not.found")); + } catch (RepositoryCheckedException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.repository")); + } catch (IOException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.io.exception")); + } + } + return node; + } + + private NodeKey processPackage(String packageDirectory, String initFile) throws UploadScratchieFileException { + NodeKey node = null; + try { + node = scratchieToolContentHandler.uploadPackage(packageDirectory, initFile); + } catch (InvalidParameterException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.invaid.param.upload")); + } catch (RepositoryCheckedException e) { + throw new UploadScratchieFileException(messageService.getMessage("error.msg.repository")); + } + return node; + } + + public boolean isGroupedActivity(long toolContentID) { + return toolService.isGroupedActivity(toolContentID); + } + + // ***************************************************************************** + // set methods for Spring Bean + // ***************************************************************************** + public void setAuditService(IAuditService auditService) { + this.auditService = auditService; + } + + public void setLearnerService(ILearnerService learnerService) { + this.learnerService = learnerService; + } + + public void setMessageService(MessageService messageService) { + this.messageService = messageService; + } + + public void setRepositoryService(IRepositoryService repositoryService) { + this.repositoryService = repositoryService; + } + + public void setScratchieAttachmentDao(ScratchieAttachmentDAO scratchieAttachmentDao) { + this.scratchieAttachmentDao = scratchieAttachmentDao; + } + + public void setScratchieDao(ScratchieDAO scratchieDao) { + this.scratchieDao = scratchieDao; + } + + public void setScratchieItemDao(ScratchieItemDAO scratchieItemDao) { + this.scratchieItemDao = scratchieItemDao; + } + + public void setScratchieSessionDao(ScratchieSessionDAO scratchieSessionDao) { + this.scratchieSessionDao = scratchieSessionDao; + } + + public void setScratchieToolContentHandler(ScratchieToolContentHandler scratchieToolContentHandler) { + this.scratchieToolContentHandler = scratchieToolContentHandler; + } + + public void setScratchieUserDao(ScratchieUserDAO scratchieUserDao) { + this.scratchieUserDao = scratchieUserDao; + } + + public void setToolService(ILamsToolService toolService) { + this.toolService = toolService; + } + + public ScratchieItemVisitDAO getScratchieItemVisitDao() { + return scratchieItemVisitDao; + } + + public void setScratchieItemVisitDao(ScratchieItemVisitDAO scratchieItemVisitDao) { + this.scratchieItemVisitDao = scratchieItemVisitDao; + } + + // ******************************************************************************* + // ToolContentManager, ToolSessionManager methods + // ******************************************************************************* + + public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { + Scratchie toolContentObj = scratchieDao.getByContentId(toolContentId); + if (toolContentObj == null) { + try { + toolContentObj = getDefaultScratchie(); + } catch (ScratchieApplicationException e) { + throw new DataMissingException(e.getMessage()); + } + } + if (toolContentObj == null) { + throw new DataMissingException("Unable to find default content for the scratchie tool"); + } + + // set ScratchieToolContentHandler as null to avoid copy file node in repository again. + toolContentObj = Scratchie.newInstance(toolContentObj, toolContentId, null); + toolContentObj.setToolContentHandler(null); + toolContentObj.setOfflineFileList(null); + toolContentObj.setOnlineFileList(null); + try { + exportContentService.registerFileClassForExport(ScratchieAttachment.class.getName(), "fileUuid", + "fileVersionId"); + exportContentService.registerFileClassForExport(ScratchieItem.class.getName(), "fileUuid", "fileVersionId"); + exportContentService + .exportToolContent(toolContentId, toolContentObj, scratchieToolContentHandler, rootPath); + } catch (ExportToolContentException e) { + throw new ToolException(e); + } + } + + public void importToolContent(Long toolContentId, Integer newUserUid, String toolContentPath, String fromVersion, + String toVersion) throws ToolException { + + try { + exportContentService.registerFileClassForImport(ScratchieAttachment.class.getName(), "fileUuid", + "fileVersionId", "fileName", "fileType", null, null); + exportContentService.registerFileClassForImport(ScratchieItem.class.getName(), "fileUuid", "fileVersionId", + "fileName", "fileType", null, "initialItem"); + + Object toolPOJO = exportContentService.importToolContent(toolContentPath, scratchieToolContentHandler, + fromVersion, toVersion); + if (!(toolPOJO instanceof Scratchie)) { + throw new ImportToolContentException( + "Import Share scratchie tool content failed. Deserialized object is " + toolPOJO); + } + Scratchie toolContentObj = (Scratchie) toolPOJO; + + // reset it to new toolContentId + toolContentObj.setContentId(toolContentId); + ScratchieUser user = scratchieUserDao.getUserByUserIDAndContentID(new Long(newUserUid.longValue()), + toolContentId); + if (user == null) { + user = new ScratchieUser(); + 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.setScratchie(toolContentObj); + } + toolContentObj.setCreatedBy(user); + + // reset all scratchieItem createBy user + Set items = toolContentObj.getScratchieItems(); + for (ScratchieItem item : items) { + item.setCreateBy(user); + } + scratchieDao.saveObject(toolContentObj); + } catch (ImportToolContentException e) { + throw new ToolException(e); + } + } + + /** + * Get the definitions for possible output for an activity, based on the toolContentId. These may be definitions + * that are always available for the tool (e.g. number of marks for Multiple Choice) or a custom definition created + * for a particular activity such as the answer to the third question contains the word Koala and hence the need for + * the toolContentId + * + * @return SortedMap of ToolOutputDefinitions with the key being the name of each definition + * @throws ScratchieApplicationException + */ + public SortedMap getToolOutputDefinitions(Long toolContentId, int definitionType) + throws ToolException { + Scratchie content = getScratchieByContentId(toolContentId); + if (content == null) { + try { + content = getDefaultContent(toolContentId); + } catch (ScratchieApplicationException e) { + throw new ToolException(e); + } + } + return getScratchieOutputFactory().getToolOutputDefinitions(content, definitionType); + } + + public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { + if (toContentId == null) { + throw new ToolException("Failed to create the SharedScratchieFiles tool seession"); + } + + Scratchie scratchie = null; + if (fromContentId != null) { + scratchie = scratchieDao.getByContentId(fromContentId); + } + if (scratchie == null) { + try { + scratchie = getDefaultScratchie(); + } catch (ScratchieApplicationException e) { + throw new ToolException(e); + } + } + + Scratchie toContent = Scratchie.newInstance(scratchie, toContentId, scratchieToolContentHandler); + scratchieDao.saveObject(toContent); + + // save scratchie items as well + Set items = toContent.getScratchieItems(); + if (items != null) { + Iterator iter = items.iterator(); + while (iter.hasNext()) { + ScratchieItem item = (ScratchieItem) iter.next(); + // createRootTopic(toContent.getUid(),null,msg); + } + } + } + + public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Scratchie scratchie = scratchieDao.getByContentId(toolContentId); + if (scratchie == null) { + throw new ToolException("No found tool content by given content ID:" + toolContentId); + } + scratchie.setDefineLater(value); + } + + public void setAsRunOffline(Long toolContentId, boolean value) throws DataMissingException, ToolException { + Scratchie scratchie = scratchieDao.getByContentId(toolContentId); + if (scratchie == null) { + throw new ToolException("No found tool content by given content ID:" + toolContentId); + } + scratchie.setRunOffline(value); + } + + public void removeToolContent(Long toolContentId, boolean removeSessionData) throws SessionDataExistsException, + ToolException { + Scratchie scratchie = scratchieDao.getByContentId(toolContentId); + if (removeSessionData) { + List list = scratchieSessionDao.getByContentId(toolContentId); + Iterator iter = list.iterator(); + while (iter.hasNext()) { + ScratchieSession session = (ScratchieSession) iter.next(); + scratchieSessionDao.delete(session); + } + } + scratchieDao.delete(scratchie); + } + + public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { + ScratchieSession session = new ScratchieSession(); + session.setSessionId(toolSessionId); + session.setSessionName(toolSessionName); + Scratchie scratchie = scratchieDao.getByContentId(toolContentId); + session.setScratchie(scratchie); + scratchieSessionDao.saveObject(session); + } + + public String leaveToolSession(Long toolSessionId, Long learnerId) throws DataMissingException, ToolException { + if (toolSessionId == null) { + ScratchieServiceImpl.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) { + ScratchieServiceImpl.log.error("Fail to leave tool Session based on null learner."); + throw new ToolException("Fail to remove tool Session based on null learner."); + } + + ScratchieSession session = scratchieSessionDao.getSessionBySessionId(toolSessionId); + if (session != null) { + session.setStatus(ScratchieConstants.COMPLETED); + scratchieSessionDao.saveObject(session); + } else { + ScratchieServiceImpl.log.error("Fail to leave tool Session.Could not find shared scratchie " + + "session by given session id: " + toolSessionId); + throw new DataMissingException("Fail to leave tool Session." + + "Could not find shared scratchie session by given session id: " + toolSessionId); + } + return learnerService.completeToolSession(toolSessionId, learnerId); + } + + public ToolSessionExportOutputData exportToolSession(Long toolSessionId) throws DataMissingException, ToolException { + return null; + } + + public ToolSessionExportOutputData exportToolSession(List toolSessionIds) throws DataMissingException, + ToolException { + return null; + } + + public void removeToolSession(Long toolSessionId) throws DataMissingException, ToolException { + scratchieSessionDao.deleteBySessionId(toolSessionId); + } + + /** + * Get the tool output for the given tool output names. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, java.lang.Long, + * java.lang.Long) + */ + public SortedMap getToolOutput(List names, Long toolSessionId, Long learnerId) { + return getScratchieOutputFactory().getToolOutput(names, this, toolSessionId, learnerId); + } + + /** + * Get the tool output for the given tool output name. + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, java.lang.Long, + * java.lang.Long) + */ + public ToolOutput getToolOutput(String name, Long toolSessionId, Long learnerId) { + return getScratchieOutputFactory().getToolOutput(name, this, toolSessionId, learnerId); + } + + /* ===============Methods implemented from ToolContentImport102Manager =============== */ + + /** + * Import the data for a 1.0.2 Noticeboard or HTMLNoticeboard + */ + public void import102ToolContent(Long toolContentId, UserDTO user, Hashtable importValues) { + Date now = new Date(); + Scratchie toolContentObj = new Scratchie(); + + try { + toolContentObj.setTitle((String) importValues.get(ToolContentImport102Manager.CONTENT_TITLE)); + toolContentObj.setContentId(toolContentId); + toolContentObj.setContentInUse(Boolean.FALSE); + toolContentObj.setCreated(now); + toolContentObj.setDefineLater(Boolean.FALSE); + toolContentObj.setInstructions(WebUtil.convertNewlines((String) importValues + .get(ToolContentImport102Manager.CONTENT_BODY))); + toolContentObj.setOfflineInstructions(null); + toolContentObj.setOnlineInstructions(null); + toolContentObj.setRunOffline(Boolean.FALSE); + toolContentObj.setUpdated(now); + toolContentObj.setReflectOnActivity(Boolean.FALSE); + toolContentObj.setReflectInstructions(null); + + // leave as empty, no need to set them to anything. + // toolContentObj.setAttachments(attachments); + + /* + * unused entries from 1.0.2 [directoryName=] no equivalent in 2.0 [runtimeSubmissionStaffFile=true] no + * equivalent in 2.0 [contentShowUser=false] no equivalent in 2.0 [isHTML=false] no equivalent in 2.0 + * [showbuttons=false] no equivalent in 2.0 [isReusable=false] not used in 1.0.2 (would be lock when + * finished) + */ + ScratchieUser ruser = new ScratchieUser(); + ruser.setUserId(new Long(user.getUserID().longValue())); + ruser.setFirstName(user.getFirstName()); + ruser.setLastName(user.getLastName()); + ruser.setLoginName(user.getLogin()); + createUser(ruser); + toolContentObj.setCreatedBy(ruser); + + // Scratchie Items. They are ordered on the screen by create date so they need to be saved in the right + // order. + // So read them all in first, then go through and assign the dates in the correct order and then save. + Vector urls = (Vector) importValues.get(ToolContentImport102Manager.CONTENT_URL_URLS); + SortedMap items = new TreeMap(); + if (urls != null) { + Iterator iter = urls.iterator(); + while (iter.hasNext()) { + Hashtable urlMap = (Hashtable) iter.next(); + Integer itemOrder = WDDXProcessor.convertToInteger(urlMap, + ToolContentImport102Manager.CONTENT_URL_URL_VIEW_ORDER); + ScratchieItem item = new ScratchieItem(); + //TODO check if this right? + item.setDescription((String) urlMap.get(ToolContentImport102Manager.CONTENT_TITLE)); + item.setCreateBy(ruser); + item.setCreateByAuthor(true); + + item.setCorrect(false); + + items.put(itemOrder, item); + } + } + + Iterator iter = items.values().iterator(); + Date itemDate = null; + while (iter.hasNext()) { + if (itemDate != null) { + try { + Thread.sleep(1000); + } catch (Exception e) { + } + } + itemDate = new Date(); + + ScratchieItem item = (ScratchieItem) iter.next(); + item.setCreateDate(itemDate); + toolContentObj.getScratchieItems().add(item); + } + + } catch (WDDXProcessorConversionException e) { + ScratchieServiceImpl.log.error("Unable to content for activity " + toolContentObj.getTitle() + + "properly due to a WDDXProcessorConversionException.", e); + throw new ToolException( + "Invalid import data format for activity " + + toolContentObj.getTitle() + + "- WDDX caused an exception. Some data from the design will have been lost. See log for more details."); + } + + scratchieDao.saveObject(toolContentObj); + + } + + /** Set the description, throws away the title value as this is not supported in 2.0 */ + public void setReflectiveData(Long toolContentId, String title, String description) throws ToolException, + DataMissingException { + + Scratchie toolContentObj = getScratchieByContentId(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 IExportToolContentService getExportContentService() { + return exportContentService; + } + + public void setExportContentService(IExportToolContentService exportContentService) { + this.exportContentService = exportContentService; + } + + public IUserManagementService getUserManagementService() { + return userManagementService; + } + + public void setUserManagementService(IUserManagementService userManagementService) { + this.userManagementService = userManagementService; + } + + public ICoreNotebookService getCoreNotebookService() { + return coreNotebookService; + } + + public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { + this.coreNotebookService = coreNotebookService; + } + + public IEventNotificationService getEventNotificationService() { + return eventNotificationService; + } + + public void setEventNotificationService(IEventNotificationService eventNotificationService) { + this.eventNotificationService = eventNotificationService; + } + + public String getLocalisedMessage(String key, Object[] args) { + return messageService.getMessage(key, args); + } + + public ILessonService getLessonService() { + return lessonService; + } + + public void setLessonService(ILessonService lessonService) { + this.lessonService = lessonService; + } + + /** + * Finds out which lesson the given tool content belongs to and returns its monitoring users. + * + * @param sessionId + * tool session ID + * @return list of teachers that monitor the lesson which contains the tool with given session ID + */ + public List getMonitorsByToolSessionId(Long sessionId) { + return getLessonService().getMonitorsByToolSessionId(sessionId); + } + + public Class[] getSupportedToolOutputDefinitionClasses(int definitionType) { + return getScratchieOutputFactory().getSupportedDefinitionClasses(definitionType); + } + + public ScratchieOutputFactory getScratchieOutputFactory() { + return scratchieOutputFactory; + } + + public void setScratchieOutputFactory(ScratchieOutputFactory scratchieOutputFactory) { + this.scratchieOutputFactory = scratchieOutputFactory; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceProxy.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceProxy.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceProxy.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.service; + +import javax.servlet.ServletContext; + +import org.lamsfoundation.lams.tool.ToolContentManager; +import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; +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 ScratchieServiceProxy { + /** + * 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 Shared scratchie service object. + */ + public static final IScratchieService getScratchieService(ServletContext servletContext) { + return (IScratchieService) getScratchieDomainService(servletContext); + } + + public static final ToolSessionManager getSessionManager(ServletContext servletContext) { + return (ToolSessionManager) getScratchieDomainService(servletContext); + } + + public static final ToolContentManager getContentManager(ServletContext servletContext) { + return (ToolContentManager) getScratchieDomainService(servletContext); + } + + private static Object getScratchieDomainService(ServletContext servletContext) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); + return wac.getBean(ScratchieConstants.RESOURCE_SERVICE); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/UploadScratchieFileException.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/UploadScratchieFileException.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/UploadScratchieFileException.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.service; + +public class UploadScratchieFileException extends Exception { + + public UploadScratchieFileException() { + super(); + } + + public UploadScratchieFileException(String message, Throwable cause) { + super(message, cause); + } + + public UploadScratchieFileException(String message) { + super(message); + } + + public UploadScratchieFileException(Throwable cause) { + super(cause); + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ReflectDTOComparator.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ReflectDTOComparator.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ReflectDTOComparator.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.util; + +import java.util.Comparator; + +import org.lamsfoundation.lams.tool.scratchie.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_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieBundler.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieBundler.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieBundler.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,139 @@ +/**************************************************************** + * 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.scratchie.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; + +import org.lamsfoundation.lams.learning.export.web.action.Bundler; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.HttpUrlConnectionUtil; + +public class ScratchieBundler extends Bundler { + + private static final char URL_SEPARATOR = '/'; + + public ScratchieBundler() { + } + + /** + * This method bundles the files to the given output dir + * + * @param request + * the request for the export + * @param cookies + * cookies for the request + * @param outputDirectory + * the location where the files should be written + * @throws Exception + */ + public void bundle(HttpServletRequest request, Cookie[] cookies, String outputDirectory) throws Exception { + bundleViaHTTP(request, cookies, outputDirectory); + } + + /** + * See bundle + * + * @param request + * @param cookies + * @param outputDirectory + * @throws MalformedURLException + * @throws FileNotFoundException + * @throws IOException + */ + private void bundleViaHTTP(HttpServletRequest request, Cookie[] cookies, String outputDirectory) + throws MalformedURLException, FileNotFoundException, IOException { + List directories = new ArrayList(); + directories.add(outputDirectory + File.separator + "includes"); + this.createDirectories(directories); + + // String[] imageNames = new String[] { "scratchie-correct.gif", "scratchie-wrong.gif", "scratchie.gif" }; + // + // for (String imageName : imageNames) { + // String urlToConnectTo = getIncludesFolder() + "images" + URL_SEPARATOR + "jquery-ui-redmond-theme" + + // URL_SEPARATOR + imageName; + // String directoryToStoreFile = outputDirectory + File. separator + "javascript" + File.separator + "images" + + // File.separator + "jquery-ui-redmond-theme"; + // HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, directoryToStoreFile, imageName, cookies);// + // cookies aren't really needed here. + // } + final String FOLDER_TO_STORE_FILE = outputDirectory + File.separator + "includes"; + + final String JAVASCRIPT_FOLDER = getServerUrl() + "includes" + URL_SEPARATOR + "javascript" + URL_SEPARATOR; + final String CSS_FOLDER = getServerUrl() + "css" + URL_SEPARATOR; + final String IMAGE_FOLDER = getServerUrl() + "tool" + URL_SEPARATOR + ScratchieConstants.TOOL_SIGNATURE + + URL_SEPARATOR + "includes" + URL_SEPARATOR + "images" + URL_SEPARATOR; + + String urlToConnectTo = JAVASCRIPT_FOLDER + "jquery.jqGrid.min.js"; + HttpUrlConnectionUtil + .writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "jquery.jqGrid.min.js", cookies); + urlToConnectTo = JAVASCRIPT_FOLDER + "jquery.jqGrid.locale-en.js"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "jquery.jqGrid.locale-en.js", + cookies); + urlToConnectTo = JAVASCRIPT_FOLDER + "jquery-1.7.1.min.js"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "jquery-1.7.1.min.js", cookies); + urlToConnectTo = JAVASCRIPT_FOLDER + "jquery-ui-1.8.11.custom.min.js"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, + "jquery-ui-1.8.11.custom.min.js", cookies); + + urlToConnectTo = CSS_FOLDER + "jquery-ui-1.8.11.redmont-theme.css"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, + "jquery-ui-1.8.11.redmont-theme.css", cookies); + urlToConnectTo = CSS_FOLDER + "jquery.jqGrid-4.1.2.css"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "jquery.jqGrid-4.1.2.css", + cookies); + + urlToConnectTo = IMAGE_FOLDER + "scratchie-correct.gif"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "scratchie-correct.gif", + cookies); + urlToConnectTo = IMAGE_FOLDER + "scratchie-wrong.gif"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "scratchie-wrong.gif", cookies); + urlToConnectTo = IMAGE_FOLDER + "scratchie.gif"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, FOLDER_TO_STORE_FILE, "scratchie.gif", cookies); + } + + private String getServerUrl() { + String serverUrl = Configuration.get(ConfigurationKeys.SERVER_URL); + if (serverUrl == null) { + log.error("Unable to get path to the LAMS Spreadsheet URL from the configuration table. Spreadsheet javascript files export failed"); + return ""; + } else { + + if (!serverUrl.endsWith("/")) { + serverUrl += "/"; + } + return serverUrl; + } + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieItemComparator.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieItemComparator.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieItemComparator.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,24 @@ +package org.lamsfoundation.lams.tool.scratchie.util; + +import java.util.Comparator; + +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; + +public class ScratchieItemComparator implements Comparator { + + public int compare(ScratchieItem o1, ScratchieItem o2) { + + if (o1 != null && o2 != null & o1.getOrderId() != null && o2.getOrderId() != null) { + if (o1.getOrderId() > o2.getOrderId()) { + return 1; + } else { + return -1; + } + } else if (o1 != null && o2 != null & o1.getCreateDate() != null && o2.getCreateDate() != null) { + return (o1.getCreateDate().getTime() - o2.getCreateDate().getTime()) > 0 ? 1 : -1; + } else if (o1 != null) + return 1; + else + return -1; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieToolContentHandler.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieToolContentHandler.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/util/ScratchieToolContentHandler.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.util; + +import org.lamsfoundation.lams.contentrepository.client.ToolContentHandler; + +/** + * Simple client for accessing the content repository. + * + * @author Fiona Malikoff + */ +public class ScratchieToolContentHandler extends ToolContentHandler { + + private static String repositoryWorkspaceName = "sharedscratchieworkspace"; + private static String repositoryUser = "sharedscratchie"; + //sharedscratchie + private static char[] repositoryId = {'l','a','m','s','-','s','h','a','r','e','d','r','e','s','o','u','r','c','e','s'}; + + /** + * + */ + public ScratchieToolContentHandler() { + 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_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/AuthoringAction.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/AuthoringAction.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/AuthoringAction.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,892 @@ +/**************************************************************** + * 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.scratchie.web.action; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +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.commons.lang.math.NumberUtils; +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.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieAttachment; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; +import org.lamsfoundation.lams.tool.scratchie.service.UploadScratchieFileException; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieItemComparator; +import org.lamsfoundation.lams.tool.scratchie.web.form.ScratchieForm; +import org.lamsfoundation.lams.tool.scratchie.web.form.ScratchiePedagogicalPlannerForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.FileValidatorUtil; +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 Andrey Balan + */ +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 { + + // -----------------------Scratchie Author functions + String param = mapping.getParameter(); + 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)); + IScratchieService service = getScratchieService(); + Scratchie scratchie = service.getScratchieByContentId(contentId); + + scratchie.setDefineLater(true); + service.saveOrUpdateScratchie(scratchie); + + 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); + } + if (param.equals("uploadOnlineFile")) { + return uploadOnline(mapping, form, request, response); + } + if (param.equals("uploadOfflineFile")) { + return uploadOffline(mapping, form, request, response); + } + if (param.equals("deleteOnlineFile")) { + return deleteOnlineFile(mapping, form, request, response); + } + if (param.equals("deleteOfflineFile")) { + return deleteOfflineFile(mapping, form, request, response); + } + // ----------------------- Add scratchie item functions + if (param.equals("addItem")) { + return addItem(mapping, form, request, response); + } + if (param.equals("removeItem")) { + return removeItem(mapping, form, request, response); + } + if (param.equals("upItem")) { + return upItem(mapping, form, request, response); + } + if (param.equals("downItem")) { + return downItem(mapping, form, request, response); + } + // -----------------------PedagogicalPlanner functions + if (param.equals("initPedagogicalPlannerForm")) { + return initPedagogicalPlannerForm(mapping, form, request, response); + } + if (param.equals("saveOrUpdatePedagogicalPlannerForm")) { + return saveOrUpdatePedagogicalPlannerForm(mapping, form, request, response); + } + + return mapping.findForward(ScratchieConstants.ERROR); + } + + + /** + * Read scratchie 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, ScratchieConstants.PARAM_TOOL_CONTENT_ID)); + + // get back the scratchie and item list and display them on page + IScratchieService service = getScratchieService(); + + List items = null; + Scratchie scratchie = null; + ScratchieForm scratchieForm = (ScratchieForm) form; + + // initial Session Map + SessionMap sessionMap = new SessionMap(); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + scratchieForm.setSessionMapID(sessionMap.getSessionID()); + + // Get contentFolderID and save to form. + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID); + scratchieForm.setContentFolderID(contentFolderID); + + try { + scratchie = service.getScratchieByContentId(contentId); + // if scratchie does not exist, try to use default content instead. + if (scratchie == null) { + scratchie = service.getDefaultContent(contentId); + if (scratchie.getScratchieItems() != null) { + items = new ArrayList(scratchie.getScratchieItems()); + } else { + items = null; + } + } else { + items = service.getAuthoredItems(scratchie.getUid()); + } + + scratchieForm.setScratchie(scratchie); + + // initialize instruction attachment list + List attachmentList = getAttachmentList(sessionMap); + attachmentList.clear(); + attachmentList.addAll(scratchie.getAttachments()); + } catch (Exception e) { + AuthoringAction.log.error(e); + throw new ServletException(e); + } + + // init it to avoid null exception in following handling + if (items == null) { + items = new ArrayList(); + } else { + ScratchieUser scratchieUser = null; + // handle system default question: createBy is null, now set it to + // current user + for (ScratchieItem item : items) { + if (item.getCreateBy() == null) { + if (scratchieUser == null) { + // get back login user DTO + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + scratchieUser = new ScratchieUser(user, scratchie); + } + item.setCreateBy(scratchieUser); + } + } + } + // init scratchie item list + SortedSet itemList = getItemList(sessionMap); + itemList.clear(); + itemList.addAll(items); + + // If there is no order id, set it up + int i = 1; + for (ScratchieItem scratchieItem : itemList) { + if (scratchieItem.getOrderId() == null || scratchieItem.getOrderId() != i) { + scratchieItem.setOrderId(i); + } + i++; + } + + sessionMap.put(ScratchieConstants.ATTR_RESOURCE_FORM, scratchieForm); + return mapping.findForward(ScratchieConstants.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, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + ScratchieForm existForm = (ScratchieForm) sessionMap.get(ScratchieConstants.ATTR_RESOURCE_FORM); + + ScratchieForm scratchieForm = (ScratchieForm) form; + try { + PropertyUtils.copyProperties(scratchieForm, existForm); + } catch (Exception e) { + throw new ServletException(e); + } + + ToolAccessMode mode = getAccessMode(request); + if (mode.isAuthor()) { + return mapping.findForward(ScratchieConstants.SUCCESS); + } else { + return mapping.findForward(ScratchieConstants.DEFINE_LATER); + } + } + + /** + * This method will persist all inforamtion in this authoring page, include all scratchie 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 { + ScratchieForm scratchieForm = (ScratchieForm) form; + + // get back sessionMAP + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(scratchieForm.getSessionMapID()); + + ToolAccessMode mode = getAccessMode(request); + + Scratchie scratchie = scratchieForm.getScratchie(); + IScratchieService service = getScratchieService(); + + // **********************************Get Scratchie + // PO********************* + Scratchie scratchiePO = service.getScratchieByContentId(scratchieForm.getScratchie().getContentId()); + if (scratchiePO == null) { + // new Scratchie, create it. + scratchiePO = scratchie; + scratchiePO.setCreated(new Timestamp(new Date().getTime())); + scratchiePO.setUpdated(new Timestamp(new Date().getTime())); + } else { + if (mode.isAuthor()) { + Long uid = scratchiePO.getUid(); + PropertyUtils.copyProperties(scratchiePO, scratchie); + // get back UID + scratchiePO.setUid(uid); + } else { // if it is Teacher, then just update basic tab content + // (definelater) + scratchiePO.setInstructions(scratchie.getInstructions()); + scratchiePO.setTitle(scratchie.getTitle()); + // change define later status + scratchiePO.setDefineLater(false); + } + scratchiePO.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); + ScratchieUser scratchieUser = service.getUserByIDAndContent(new Long(user.getUserID().intValue()), + scratchieForm.getScratchie().getContentId()); + if (scratchieUser == null) { + scratchieUser = new ScratchieUser(user, scratchiePO); + } + + scratchiePO.setCreatedBy(scratchieUser); + + // **********************************Handle Authoring Instruction + // Attachement ********************* + // merge attachment info + // so far, attPOSet will be empty if content is existed. because + // PropertyUtils.copyProperties() is executed + Set attPOSet = scratchiePO.getAttachments(); + if (attPOSet == null) { + attPOSet = new HashSet(); + } + List attachmentList = getAttachmentList(sessionMap); + List deleteAttachmentList = getDeletedAttachmentList(sessionMap); + + // current attachemnt in authoring instruction tab. + Iterator iter = attachmentList.iterator(); + while (iter.hasNext()) { + ScratchieAttachment newAtt = (ScratchieAttachment) iter.next(); + attPOSet.add(newAtt); + } + attachmentList.clear(); + + // deleted attachment. 2 possible types: one is persist another is + // non-persist before. + iter = deleteAttachmentList.iterator(); + while (iter.hasNext()) { + ScratchieAttachment delAtt = (ScratchieAttachment) iter.next(); + iter.remove(); + // it is an existed att, then delete it from current attachmentPO + if (delAtt.getUid() != null) { + Iterator attIter = attPOSet.iterator(); + while (attIter.hasNext()) { + ScratchieAttachment att = (ScratchieAttachment) attIter.next(); + if (delAtt.getUid().equals(att.getUid())) { + attIter.remove(); + break; + } + } + service.deleteScratchieAttachment(delAtt.getUid()); + }// end remove from persist value + } + + // copy back + scratchiePO.setAttachments(attPOSet); + // ************************* Handle scratchie items ******************* + // Handle scratchie items + Set itemList = new LinkedHashSet(); + SortedSet topics = getItemsFromRequest(request, true); + iter = topics.iterator(); + while (iter.hasNext()) { + ScratchieItem item = (ScratchieItem) iter.next(); + if (item != null) { + // This flushs user UID info to message if this user is a new + // user. + item.setCreateBy(scratchieUser); + itemList.add(item); + } + } + scratchiePO.setScratchieItems(itemList); + // delete instructino file from database. + List delScratchieItemList = getDeletedItemList(sessionMap); + iter = delScratchieItemList.iterator(); + while (iter.hasNext()) { + ScratchieItem item = (ScratchieItem) iter.next(); + iter.remove(); + if (item.getUid() != null) { + service.deleteScratchieItem(item.getUid()); + } + } + + // ********************************************** + // finally persist scratchiePO again + service.saveOrUpdateScratchie(scratchiePO); + + // initialize attachmentList again + attachmentList = getAttachmentList(sessionMap); + attachmentList.addAll(scratchie.getAttachments()); + scratchieForm.setScratchie(scratchiePO); + + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); + if (mode.isAuthor()) { + return mapping.findForward("author"); + } else { + return mapping.findForward("monitor"); + } + } + + /** + * Handle upload online instruction files request. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws UploadScratchieFileException + */ + public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws UploadScratchieFileException { + return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE, request); + } + + /** + * Handle upload offline instruction files request. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws UploadScratchieFileException + */ + public ActionForward uploadOffline(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws UploadScratchieFileException { + return uploadFile(mapping, form, IToolContentHandler.TYPE_OFFLINE, request); + } + + /** + * Common method to upload online or offline instruction files request. + * + * @param mapping + * @param form + * @param type + * @param request + * @return + * @throws UploadScratchieFileException + */ + private ActionForward uploadFile(ActionMapping mapping, ActionForm form, String type, HttpServletRequest request) + throws UploadScratchieFileException { + + SortedSet itemList = getItemsFromRequest(request, false); + request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList); + + ScratchieForm scratchieForm = (ScratchieForm) form; + // get back sessionMAP + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(scratchieForm.getSessionMapID()); + + FormFile file; + if (StringUtils.equals(IToolContentHandler.TYPE_OFFLINE, type)) { + file = scratchieForm.getOfflineFile(); + } else { + file = scratchieForm.getOnlineFile(); + } + + if (file == null || StringUtils.isBlank(file.getFileName())) { + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + // validate file size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors); + if (!errors.isEmpty()) { + this.saveErrors(request, errors); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + IScratchieService service = getScratchieService(); + // upload to repository + ScratchieAttachment att = service.uploadInstructionFile(file, type); + // handle session value + List attachmentList = getAttachmentList(sessionMap); + List deleteAttachmentList = getDeletedAttachmentList(sessionMap); + // first check exist attachment and delete old one (if exist) to + // deletedAttachmentList + Iterator iter = attachmentList.iterator(); + ScratchieAttachment existAtt; + while (iter.hasNext()) { + existAtt = (ScratchieAttachment) iter.next(); + if (StringUtils.equals(existAtt.getFileName(), att.getFileName()) + && StringUtils.equals(existAtt.getFileType(), att.getFileType())) { + // if there is same name attachment, delete old one + deleteAttachmentList.add(existAtt); + iter.remove(); + break; + } + } + // add to attachmentList + attachmentList.add(att); + + return mapping.findForward(ScratchieConstants.SUCCESS); + + } + + /** + * Delete offline instruction file from current Scratchie authoring page. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public ActionForward deleteOfflineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_OFFLINE); + } + + /** + * Delete online instruction file from current Scratchie authoring page. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return deleteFile(mapping, request, response, form, IToolContentHandler.TYPE_ONLINE); + } + + /** + * General method to delete file (online or offline) + * + * @param mapping + * @param request + * @param response + * @param form + * @param type + * @return + */ + private ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, + ActionForm form, String type) { + SortedSet itemList = getItemsFromRequest(request, false); + request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList); + + Long versionID = new Long(WebUtil.readLongParam(request, ScratchieConstants.PARAM_FILE_VERSION_ID)); + Long uuID = new Long(WebUtil.readLongParam(request, ScratchieConstants.PARAM_FILE_UUID)); + + // get back sessionMAP + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + // handle session value + List attachmentList = getAttachmentList(sessionMap); + List deleteAttachmentList = getDeletedAttachmentList(sessionMap); + // first check exist attachment and delete old one (if exist) to + // deletedAttachmentList + Iterator iter = attachmentList.iterator(); + ScratchieAttachment existAtt; + while (iter.hasNext()) { + existAtt = (ScratchieAttachment) iter.next(); + if (existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)) { + // if there is same name attachment, delete old one + deleteAttachmentList.add(existAtt); + iter.remove(); + } + } + + request.setAttribute(ScratchieConstants.ATTR_FILE_TYPE_FLAG, type); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); + return mapping.findForward(ScratchieConstants.SUCCESS); + + } + + /** + * Ajax call, will add one more input line for new resource item instruction. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward addItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); + SortedSet itemList = getItemsFromRequest(request, false); + + ScratchieItem item = new ScratchieItem(); + int maxSeq = 1; + if (itemList != null && itemList.size() > 0) { + ScratchieItem last = itemList.last(); + maxSeq = last.getOrderId() + 1; + } + item.setOrderId(maxSeq); + itemList.add(item); + + request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + /** + * Ajax call, remove the given line of instruction of resource item. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + SortedSet itemList = getItemsFromRequest(request, false); + + int itemIndex = NumberUtils.stringToInt(request.getParameter(ScratchieConstants.PARAM_ITEM_INDEX), -1); + if (itemIndex != -1) { + List rList = new ArrayList(itemList); + ScratchieItem item = rList.remove(itemIndex); + itemList.clear(); + itemList.addAll(rList); + + // add to delList + List delList = getDeletedItemList(sessionMap); + delList.add(item); + } + + request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + /** + * Move up current option. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward upItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return switchOption(mapping, request, true); + } + + /** + * Move down current option. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + private ActionForward downItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + return switchOption(mapping, request, false); + } + + private ActionForward switchOption(ActionMapping mapping, HttpServletRequest request, boolean up) { + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); + SortedSet itemList = getItemsFromRequest(request, false); + + int itemIndex = NumberUtils.stringToInt(request.getParameter(ScratchieConstants.PARAM_ITEM_INDEX), -1); + if (itemIndex != -1) { + List rList = new ArrayList(itemList); + + // get current and the target item, and switch their sequnece + ScratchieItem item = rList.get(itemIndex); + ScratchieItem repOption; + if (up) { + repOption = rList.get(--itemIndex); + } else { + repOption = rList.get(++itemIndex); + } + + int upSeqId = repOption.getOrderId(); + repOption.setOrderId(item.getOrderId()); + item.setOrderId(upSeqId); + + // put back list, it will be sorted again + itemList.clear(); + itemList.addAll(rList); + } + + + request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + public ActionForward initPedagogicalPlannerForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + ScratchiePedagogicalPlannerForm plannerForm = (ScratchiePedagogicalPlannerForm) form; + Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Scratchie scratchie = getScratchieService().getScratchieByContentId(toolContentID); + plannerForm.fillForm(scratchie); + String contentFolderId = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + plannerForm.setContentFolderID(contentFolderId); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + public ActionForward saveOrUpdatePedagogicalPlannerForm(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response) throws IOException { + ScratchiePedagogicalPlannerForm plannerForm = (ScratchiePedagogicalPlannerForm) form; + ActionMessages errors = plannerForm.validate(); + if (errors.isEmpty()) { + Scratchie scratchie = getScratchieService().getScratchieByContentId(plannerForm.getToolContentID()); + scratchie.setInstructions(plannerForm.getInstructions()); + getScratchieService().saveOrUpdateScratchie(scratchie); + } else { + saveErrors(request, errors); + } + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + // ************************************************************************************* + // Private method + // ************************************************************************************* + /** + * Return ScratchieService bean. + */ + private IScratchieService getScratchieService() { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + return (IScratchieService) wac.getBean(ScratchieConstants.RESOURCE_SERVICE); + } + + /** + * @param request + * @return + */ + private List getAttachmentList(SessionMap sessionMap) { + return getListFromSession(sessionMap, ScratchieConstants.ATT_ATTACHMENT_LIST); + } + + /** + * @param request + * @return + */ + private List getDeletedAttachmentList(SessionMap sessionMap) { + return getListFromSession(sessionMap, ScratchieConstants.ATTR_DELETED_ATTACHMENT_LIST); + } + + /** + * List save current scratchie items. + * + * @param request + * @return + */ + private SortedSet getItemList(SessionMap sessionMap) { + SortedSet list = (SortedSet) sessionMap + .get(ScratchieConstants.ATTR_ITEM_LIST); + if (list == null) { + list = new TreeSet(new ScratchieItemComparator()); + sessionMap.put(ScratchieConstants.ATTR_ITEM_LIST, list); + } + return list; + } + + /** + * List save deleted scratchie items, which could be persisted or non-persisted items. + * + * @param request + * @return + */ + private List getDeletedItemList(SessionMap sessionMap) { + return getListFromSession(sessionMap, ScratchieConstants.ATTR_DELETED_ITEM_LIST); + } + + /** + * Get java.util.List from HttpSession by given name. + * + * @param request + * @param name + * @return + */ + private List getListFromSession(SessionMap sessionMap, String name) { + List list = (List) sessionMap.get(name); + if (list == null) { + list = new ArrayList(); + sessionMap.put(name, list); + } + return list; + } + + /** + * Get answer options from HttpRequest + * + * @param request + * @param isForSaving whether the blank options will be preserved or not + * + */ + private TreeSet getItemsFromRequest(HttpServletRequest request, boolean isForSaving) { + Map paramMap = splitRequestParameter(request, ScratchieConstants.ATTR_ITEM_LIST); + Integer correctItemIndex = (paramMap.get(ScratchieConstants.ATTR_ITEM_CORRECT) == null) ? null + : NumberUtils.stringToInt(paramMap.get(ScratchieConstants.ATTR_ITEM_CORRECT)); + + int count = NumberUtils.stringToInt(paramMap.get(ScratchieConstants.ATTR_ITEM_COUNT)); + TreeSet itemList = new TreeSet(new ScratchieItemComparator()); + for (int i = 0; i < count; i++) { + + String itemDescription = paramMap.get(ScratchieConstants.ATTR_ITEM_DESCRIPTION_PREFIX + i); + if ((itemDescription == null) && isForSaving) { + continue; + } + + ScratchieItem item = new ScratchieItem(); + String orderIdStr = paramMap.get(ScratchieConstants.ATTR_ITEM_ORDER_ID_PREFIX + i); + Integer orderId = NumberUtils.stringToInt(orderIdStr); + item.setOrderId(orderId); + item.setDescription(itemDescription); + if ((correctItemIndex!=null) && correctItemIndex.equals(orderId)) { + item.setCorrect(true); + } + itemList.add(item); + } + + return itemList; + } + + /** + * Split Request Parameter from HttpRequest + * + * @param request + * @param parameterName parameterName + */ + private Map splitRequestParameter(HttpServletRequest request, String parameterName) { + String list = request.getParameter(parameterName); + if (list == null) { + return null; + } + + String[] params = list.split("&"); + Map paramMap = new HashMap(); + String[] pair; + for (String item : params) { + pair = item.split("="); + if (pair == null || pair.length != 2) + continue; + try { + paramMap.put(pair[0], URLDecoder.decode(pair[1], "UTF-8")); + } catch (UnsupportedEncodingException e) { + log.error("Error occurs when decode instruction string:" + e.toString()); + } + } + return paramMap; + } + + /** + * 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; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/ClearSessionAction.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/ClearSessionAction.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/ClearSessionAction.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,47 @@ +/**************************************************************** + * 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.scratchie.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 @author Andrey Balan + */ +public class ClearSessionAction extends LamsAuthoringFinishAction { + + @Override + public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { + if(mode.isAuthor()){ + session.removeAttribute(customiseSessionID); + } + } + + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,449 @@ +/**************************************************************** + * 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.scratchie.web.action; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.math.NumberUtils; +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.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.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; +import org.lamsfoundation.lams.tool.scratchie.service.ScratchieApplicationException; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieItemComparator; +import org.lamsfoundation.lams.tool.scratchie.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(); + // -----------------------Scratchie Learner function --------------------------- + if (param.equals("start")) { + return start(mapping, form, request, response); + } + if (param.equals("scratchItem")) { + return scratchItem(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(ScratchieConstants.ERROR); + } + + /** + * Read scratchie 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) { + + // 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 toolSessionId = new Long(request.getParameter(ScratchieConstants.PARAM_TOOL_SESSION_ID)); + + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + request.setAttribute(AttributeNames.ATTR_MODE, mode); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionId); + + // get back the scratchie and item list and display them on page + IScratchieService service = getScratchieService(); + ScratchieUser scratchieUser = null; + if (mode != null && mode.isTeacher()) { + // monitoring mode - user is specified in URL + // scratchieUser may be null if the user was force completed. + scratchieUser = getSpecifiedUser(service, toolSessionId, + WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, false)); + } else { + scratchieUser = getCurrentUser(service, toolSessionId); + } + + Scratchie scratchie = service.getScratchieBySessionId(toolSessionId); + Set initialItems = scratchie.getScratchieItems(); + + // get notebook entry + String entryText = new String(); + if (scratchieUser != null) { + NotebookEntry notebookEntry = service.getEntry(toolSessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.TOOL_SIGNATURE, scratchieUser.getUserId().intValue()); + if (notebookEntry != null) { + entryText = notebookEntry.getEntry(); + } + } + + // basic information + sessionMap.put(ScratchieConstants.ATTR_TITLE, scratchie.getTitle()); + sessionMap.put(ScratchieConstants.ATTR_RESOURCE_INSTRUCTION, scratchie.getInstructions()); + boolean isUserFinished = scratchieUser != null && scratchieUser.isSessionFinished(); + sessionMap.put(ScratchieConstants.ATTR_USER_FINISHED, isUserFinished); + + + sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionId); + sessionMap.put(AttributeNames.ATTR_MODE, mode); + // reflection information + sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ON, scratchie.isReflectOnActivity()); + sessionMap.put(ScratchieConstants.ATTR_REFLECTION_INSTRUCTION, scratchie.getReflectInstructions()); + sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ENTRY, entryText); + + // add define later support + if (scratchie.isDefineLater()) { + return mapping.findForward("defineLater"); + } + + // set contentInUse flag to true! + scratchie.setContentInUse(true); + scratchie.setDefineLater(false); + service.saveOrUpdateScratchie(scratchie); + + // add run offline support + if (scratchie.getRunOffline()) { + sessionMap.put(ScratchieConstants.PARAM_RUN_OFFLINE, true); + return mapping.findForward("runOffline"); + } else { + sessionMap.put(ScratchieConstants.PARAM_RUN_OFFLINE, false); + } + + // becuase in webpage will use this login name. Here is just initialize it to avoid session close error in proxy object. + for (ScratchieItem item : initialItems) { + if (item.getCreateBy() != null) { + item.getCreateBy().getLoginName(); + } + } + + // set complete flag for display purpose + if (scratchieUser != null) { + service.retrieveScratched(initialItems, scratchieUser); + } + + //randomize order if needed + Collection items = new TreeSet(new ScratchieItemComparator()); + items.addAll(initialItems); + sessionMap.put(ScratchieConstants.ATTR_ITEM_LIST, items); + + boolean scratchingLock = isUserFinished; + for (ScratchieItem item : items) { + if (item.isScratched() && item.isCorrect()) { + scratchingLock = true; + } + } + sessionMap.put(ScratchieConstants.ATTR_SCRATCHING_LOCK, scratchingLock); + + + sessionMap.put(ScratchieConstants.ATTR_SCRATCHIE, scratchie); + + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + /** + * Display main frame to display instrcution and item content. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws JSONException + * @throws IOException + */ + private ActionForward scratchItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws JSONException, IOException { + String mode = request.getParameter(AttributeNames.ATTR_MODE); + + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + + Long itemUid = NumberUtils.createLong(request.getParameter(ScratchieConstants.PARAM_ITEM_UID)); + // get back the resource and item list and display them on page + ScratchieItem item = getScratchieService().getScratchieItemByUid(itemUid); + + String toolSessionIdStr = request.getParameter(ScratchieConstants.ATTR_TOOL_SESSION_ID); + Long toolSessionId = NumberUtils.createLong(toolSessionIdStr); + // mark this item access flag if it is learner + if (ToolAccessMode.LEARNER.toString().equals(mode)) { + HttpSession ss = SessionManager.getSession(); + // get back login user DTO + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + getScratchieService().setItemAccess(item.getUid(), new Long(user.getUserID().intValue()), toolSessionId); + } + + if (item == null) { + return mapping.findForward(ScratchieConstants.ERROR); + } + + JSONObject JSONObject = new JSONObject(); + JSONObject.put(ScratchieConstants.ATTR_ITEM_CORRECT, item.isCorrect()); + response.setContentType("application/x-json"); + response.getWriter().print(JSONObject); + return null; + + } + + + +// /** +// * Set complete flag for given scratchie item. +// * +// * @param request +// * @param sessionId +// */ +// private void doComplete(HttpServletRequest request) { +// // get back sessionMap +// String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); +// +// Long scratchieItemUid = new Long(request.getParameter(ScratchieConstants.PARAM_ITEM_UID)); +// IScratchieService service = getScratchieService(); +// HttpSession ss = SessionManager.getSession(); +// // get back login user DTO +// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); +// +// Long sessionId = (Long) sessionMap.get(ScratchieConstants.ATTR_TOOL_SESSION_ID); +// service.setItemComplete(scratchieItemUid, new Long(user.getUserID().intValue()), sessionId); +// +// // set scratchie item complete tag +// SortedSet scratchieItemList = getScratchieItemList(sessionMap); +// for (ScratchieItem item : scratchieItemList) { +// if (item.getUid().equals(scratchieItemUid)) { +// item.setScratched(true); +// break; +// } +// } +// } + + /** + * 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(ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + IScratchieService service = getScratchieService(); + // 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(ScratchieConstants.ATTR_NEXT_ACTIVITY_URL, nextActivityUrl); + } catch (ScratchieApplicationException e) { + LearningAction.log.error("Failed get next activity url:" + e.getMessage()); + } + + return mapping.findForward(ScratchieConstants.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, ScratchieConstants.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 + IScratchieService submitFilesService = getScratchieService(); + + SessionMap map = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long toolSessionID = (Long) map.get(AttributeNames.PARAM_TOOL_SESSION_ID); + NotebookEntry entry = submitFilesService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.TOOL_SIGNATURE, user.getUserID()); + + if (entry != null) { + refForm.setEntryText(entry.getEntry()); + } + + return mapping.findForward(ScratchieConstants.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, ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + IScratchieService service = getScratchieService(); + + // check for existing notebook entry + NotebookEntry entry = service.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.TOOL_SIGNATURE, userId); + + if (entry == null) { + // create new entry + service.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.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 IScratchieService getScratchieService() { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + return (IScratchieService) wac.getBean(ScratchieConstants.RESOURCE_SERVICE); + } + + /** + * Get java.util.List from HttpSession by given name. + * + * @param request + * @param name + * @return + */ + private List getListFromSession(SessionMap sessionMap, String name) { + List list = (List) sessionMap.get(name); + if (list == null) { + list = new ArrayList(); + sessionMap.put(name, list); + } + return list; + } + + private ScratchieUser getCurrentUser(IScratchieService 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); + ScratchieUser scratchieUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()), sessionId); + + if (scratchieUser == null) { + ScratchieSession session = service.getScratchieSessionBySessionId(sessionId); + scratchieUser = new ScratchieUser(user, session); + service.createUser(scratchieUser); + } + return scratchieUser; + } + + private ScratchieUser getSpecifiedUser(IScratchieService service, Long sessionId, Integer userId) { + ScratchieUser scratchieUser = service.getUserByIDAndSession(new Long(userId.intValue()), sessionId); + if (scratchieUser == null) { + LearningAction.log + .error("Unable to find specified user for scratchie activity. Screens are likely to fail. SessionId=" + + sessionId + " UserId=" + userId); + } + return scratchieUser; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/MonitoringAction.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,175 @@ +/**************************************************************** + * 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.scratchie.web.action; + +import java.io.IOException; +import java.util.List; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +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.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.tool.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; +import org.lamsfoundation.lams.tool.scratchie.model.GroupSummary; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItemVisitLog; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; +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 { + 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("userMasterDetail")) { + return userMasterDetail(mapping, form, request, response); + } + if (param.equals("itemSummary")) { + return itemSummary(mapping, form, request, response); + } + if (param.equals("viewReflection")) { + return viewReflection(mapping, form, request, response); + } + + return mapping.findForward(ScratchieConstants.ERROR); + } + + private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + // initialize Session Map + SessionMap sessionMap = new SessionMap(); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + + Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + IScratchieService service = getScratchieService(); + List summaryList = service.getMonitoringSummary(contentId); + + Scratchie scratchie = service.getScratchieByContentId(contentId); + scratchie.toDTO(); + + // cache into sessionMap + boolean isGroupedActivity = service.isGroupedActivity(contentId); + sessionMap.put(ScratchieConstants.ATTR_IS_GROUPED_ACTIVITY, isGroupedActivity); + sessionMap.put(ScratchieConstants.ATTR_SUMMARY_LIST, summaryList); + sessionMap.put(ScratchieConstants.PAGE_EDITABLE, scratchie.isContentInUse()); + sessionMap.put(ScratchieConstants.ATTR_SCRATCHIE, scratchie); + sessionMap.put(ScratchieConstants.ATTR_TOOL_CONTENT_ID, contentId); + sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, WebUtil.readStrParam(request, + AttributeNames.PARAM_CONTENT_FOLDER_ID)); + + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + private ActionForward userMasterDetail(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + Long userId = WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID); + Long sessionId = WebUtil.readLongParam(request, ScratchieConstants.PARAM_SESSION_ID); + List logs = getScratchieService().getUserMasterDetail(sessionId, userId); + + request.setAttribute(ScratchieConstants.ATTR_USER_SESSION_ID, sessionId); + request.setAttribute(ScratchieConstants.ATTR_VISIT_LOGS, logs); + return (logs.isEmpty()) ? null : mapping.findForward(ScratchieConstants.SUCCESS); + } + + private ActionForward itemSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + + Long itemUid = WebUtil.readLongParam(request, ScratchieConstants.ATTR_ITEM_UID); + if (itemUid.equals(-1)) { + return null; + } + ScratchieItem item = getScratchieService().getScratchieItemByUid(itemUid); + request.setAttribute(ScratchieConstants.ATTR_ITEM, item); + + Long contentId = (Long) sessionMap.get(ScratchieConstants.ATTR_TOOL_CONTENT_ID); + List summaryList = getScratchieService().getQuestionSummary(contentId, itemUid); + + request.setAttribute(ScratchieConstants.ATTR_SUMMARY_LIST, summaryList); + return mapping.findForward(ScratchieConstants.SUCCESS); + } + + private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + + Long uid = WebUtil.readLongParam(request, ScratchieConstants.ATTR_USER_UID); + Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + + IScratchieService service = getScratchieService(); + ScratchieUser user = service.getUser(uid); + NotebookEntry notebookEntry = service.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + ScratchieConstants.TOOL_SIGNATURE, user.getUserId().intValue()); + + ScratchieSession session = service.getScratchieSessionBySessionId(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.getScratchie().getReflectInstructions()); + + request.setAttribute("userDTO", refDTO); + return mapping.findForward("success"); + } + + // ************************************************************************************* + // Private method + // ************************************************************************************* + private IScratchieService getScratchieService() { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + return (IScratchieService) wac.getBean(ScratchieConstants.RESOURCE_SERVICE); + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ReflectionForm.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ReflectionForm.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ReflectionForm.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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.scratchie.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_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchieForm.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,125 @@ +/**************************************************************** + * 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.scratchie.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.scratchie.model.Scratchie; + +/** + * + * Scratchie Form. + * + * @struts.form name="scratchieForm" + */ +public class ScratchieForm extends ActionForm { + private static final long serialVersionUID = 3599879328307492312L; + + private static Logger logger = Logger.getLogger(ScratchieForm.class.getName()); + + private String sessionMapID; + private String contentFolderID; + + // Forum fields + private int currentTab; + private FormFile offlineFile; + private FormFile onlineFile; + + private Scratchie scratchie; + + public ScratchieForm() { + scratchie = new Scratchie(); + scratchie.setTitle("Shared Scratchie"); + currentTab = 1; + } + + public void setScratchie(Scratchie scratchie) { + this.scratchie = scratchie; + // set Form special varaible from given forum + if (scratchie == null) { + logger.error("Initial ScratchieForum failed by null value of Scratchie."); + } + } + + 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")) { + scratchie.setDefineLater(false); + scratchie.setRunOffline(false); + scratchie.setReflectOnActivity(false); + } + } + + 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; + } + + public int getCurrentTab() { + return currentTab; + } + + public void setCurrentTab(int currentTab) { + this.currentTab = currentTab; + } + + public FormFile getOfflineFile() { + return offlineFile; + } + + public void setOfflineFile(FormFile offlineFile) { + this.offlineFile = offlineFile; + } + + public FormFile getOnlineFile() { + return onlineFile; + } + + public void setOnlineFile(FormFile onlineFile) { + this.onlineFile = onlineFile; + } + + public Scratchie getScratchie() { + return scratchie; + } + +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchiePedagogicalPlannerForm.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchiePedagogicalPlannerForm.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/form/ScratchiePedagogicalPlannerForm.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.scratchie.web.form; + +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivityForm; + +/** + * @struts.form name="pedagogicalPlannerForm" + */ +public class ScratchiePedagogicalPlannerForm extends PedagogicalPlannerActivityForm { + private String instructions; + private String contentFolderID; + + public void fillForm(Scratchie scratchie) { + if (scratchie != null) { + setToolContentID(scratchie.getContentId()); + setInstructions(scratchie.getInstructions()); + } + } + + public String getInstructions() { + return instructions; + } + + public void setInstructions(String instructions) { + this.instructions = instructions; + } + + public String getContentFolderID() { + return contentFolderID; + } + + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } +} Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/servlet/ExportServlet.java =================================================================== diff -u --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/servlet/ExportServlet.java (revision 0) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/servlet/ExportServlet.java (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,260 @@ +/**************************************************************** + * 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.scratchie.web.servlet; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +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.scratchie.ScratchieConstants; +import org.lamsfoundation.lams.tool.scratchie.dto.ReflectDTO; +import org.lamsfoundation.lams.tool.scratchie.model.GroupSummary; +import org.lamsfoundation.lams.tool.scratchie.model.Scratchie; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieItem; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieSession; +import org.lamsfoundation.lams.tool.scratchie.model.ScratchieUser; +import org.lamsfoundation.lams.tool.scratchie.service.IScratchieService; +import org.lamsfoundation.lams.tool.scratchie.service.ScratchieApplicationException; +import org.lamsfoundation.lams.tool.scratchie.service.ScratchieServiceProxy; +import org.lamsfoundation.lams.tool.scratchie.util.ReflectDTOComparator; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieBundler; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieItemComparator; +import org.lamsfoundation.lams.tool.scratchie.util.ScratchieToolContentHandler; +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 scratchie into offline HTML package. + * + * @author Andrey Balan + */ +public class ExportServlet extends AbstractExportPortfolioServlet { + private static final long serialVersionUID = -4529093489007108143L; + + private static Logger logger = Logger.getLogger(ExportServlet.class); + + private final String FILENAME = "scratchie_main.html"; + + private ScratchieToolContentHandler handler; + + private IScratchieService service; + + @Override + public void init() throws ServletException { + service = ScratchieServiceProxy.getScratchieService(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 (ScratchieApplicationException e) { + logger.error("Cannot perform export for scratchie tool."); + } + + // Attempting to export required js and image files + try { + ScratchieBundler imageBundler = new ScratchieBundler(); + imageBundler.bundle(request, cookies, directoryName); + } catch (Exception e) { + logger.error( + "Could not export spreadsheet javascript files, some files may be missing in export portfolio", e); + } + + String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + + request.getContextPath(); + writeResponseToFile(basePath + "/pages/export/exportportfolio.jsp?sessionMapID=" + sessionMap.getSessionID(), + directoryName, FILENAME, cookies); + + return FILENAME; + } + + protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies) { + if (toolContentID == null && toolSessionID == null) { + logger.error("Tool content Id or and session Id are null. Unable to activity title"); + } else { + + Scratchie content = null; + if (toolContentID != null) { + content = service.getScratchieByContentId(toolContentID); + } else { + ScratchieSession session = service.getScratchieSessionBySessionId(toolSessionID); + if (session != null) + content = session.getScratchie(); + } + if (content != null) { + activityTitle = content.getTitle(); + } + } + return super.doOfflineExport(request, response, directoryName, cookies); + } + + public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies, HashMap sessionMap) throws ScratchieApplicationException { + + if (userID == null || toolSessionID == null) { + String error = "Tool session Id or user Id is null. Unable to continue"; + logger.error(error); + throw new ScratchieApplicationException(error); + } + + ScratchieUser learner = service.getUserByIDAndSession(userID, toolSessionID); + + if (learner == null) { + String error = "The user with user id " + userID + " does not exist."; + logger.error(error); + throw new ScratchieApplicationException(error); + } + + Scratchie content = service.getScratchieBySessionId(toolSessionID); + + if (content == null) { + String error = "The content for this activity has not been defined yet."; + logger.error(error); + throw new ScratchieApplicationException(error); + } + + Set initialItems = content.getScratchieItems(); + + // set complete flag for display purpose + service.retrieveScratched(initialItems, learner); + + // randomize order if needed + Collection items = new TreeSet(new ScratchieItemComparator()); + items.addAll(initialItems); + sessionMap.put(ScratchieConstants.ATTR_ITEM_LIST, items); + + // Add flag to indicate whether to render user notebook entries + sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ON, content.isReflectOnActivity()); + sessionMap.put(ScratchieConstants.ATTR_SCRATCHIE, content); + + // Create reflectList if reflection is enabled. + if (content.isReflectOnActivity()) { + // Create reflectList, need to follow same structure used in teacher + // see service.getReflectList(); + Map> map = new HashMap>(); + Set reflectDTOSet = new TreeSet(new ReflectDTOComparator()); + reflectDTOSet.add(getReflectionEntry(learner)); + map.put(toolSessionID, reflectDTOSet); + + // Add reflectList to sessionMap + sessionMap.put(ScratchieConstants.ATTR_REFLECT_LIST, map); + } + } + + public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, + Cookie[] cookies, HashMap sessionMap) throws ScratchieApplicationException { + + // 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 ScratchieApplicationException(error); + } + + Scratchie content = service.getScratchieByContentId(toolContentID); + + if (content == null) { + String error = "Data is missing from the database. Unable to Continue"; + logger.error(error); + throw new ScratchieApplicationException(error); + } + + List summaryList = service.getMonitoringSummary(content.getContentId()); + + content.toDTO(); + + // cache into sessionMap + boolean isGroupedActivity = service.isGroupedActivity(toolContentID); + sessionMap.put(ScratchieConstants.ATTR_IS_GROUPED_ACTIVITY, isGroupedActivity); + sessionMap.put(ScratchieConstants.ATTR_SUMMARY_LIST, summaryList); + sessionMap.put(ScratchieConstants.PAGE_EDITABLE, content.isContentInUse()); + sessionMap.put(ScratchieConstants.ATTR_SCRATCHIE, content); + sessionMap.put(ScratchieConstants.ATTR_TOOL_CONTENT_ID, toolContentID); + + // Add flag to indicate whether to render user notebook entries + sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ON, content.isReflectOnActivity()); + + // Create reflectList if reflection is enabled. + if (content.isReflectOnActivity()) { + Map> reflectList = service.getReflectList(content.getContentId(), true); + // Add reflectList to sessionMap + sessionMap.put(ScratchieConstants.ATTR_REFLECT_LIST, reflectList); + } + } + + private ScratchieToolContentHandler getToolContentHandler() { + if (handler == null) { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(this + .getServletContext()); + handler = (ScratchieToolContentHandler) wac.getBean(ScratchieConstants.TOOL_CONTENT_HANDLER_NAME); + } + return handler; + } + + private ReflectDTO getReflectionEntry(ScratchieUser scratchieUser) { + ReflectDTO reflectDTO = new ReflectDTO(scratchieUser); + NotebookEntry notebookEntry = service.getEntry(scratchieUser.getSession().getSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, ScratchieConstants.TOOL_SIGNATURE, scratchieUser.getUserId() + .intValue()); + + // check notebookEntry is not null + if (notebookEntry != null) { + reflectDTO.setReflect(notebookEntry.getEntry()); + logger.debug("Could not find notebookEntry for ScratchieUser: " + scratchieUser.getUid()); + } + return reflectDTO; + } +} Index: lams_tool_scratchie/web/403.jsp =================================================================== diff -u --- lams_tool_scratchie/web/403.jsp (revision 0) +++ lams_tool_scratchie/web/403.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/404.jsp =================================================================== diff -u --- lams_tool_scratchie/web/404.jsp (revision 0) +++ lams_tool_scratchie/web/404.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/.cvsignore =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/.cvsignore (revision 0) +++ lams_tool_scratchie/web/WEB-INF/.cvsignore (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,4 @@ +lib +struts-config.xml +validation.xml +classes Index: lams_tool_scratchie/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/AuthoringButton.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/AuthoringButton.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,134 @@ +<% +/**************************************************************** + * 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 --%> + + + + + + + + + + + + + + + + + + + + +

    + + + + + + +

    + Index: lams_tool_scratchie/web/WEB-INF/tags/CKEditor.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/CKEditor.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/CKEditor.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,91 @@ +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> + +<%@ 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_scratchie/web/WEB-INF/tags/Date.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/Date.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/Date.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 + * **************************************************************** + */ + + /** + * 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_scratchie/web/WEB-INF/tags/DefineLater.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/DefineLater.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/DefineLater.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/tags/Head.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/Head.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/Head.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 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_scratchie/web/WEB-INF/tags/ImgButtonWrapper.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/ImgButtonWrapper.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/ImgButtonWrapper.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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" %> +
    +
    + +
    +
    Index: lams_tool_scratchie/web/WEB-INF/tags/Passon.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/Passon.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/Passon.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,86 @@ +<% +/**************************************************************** + * 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 + * **************************************************************** + */ + + /** + * Passon + * Author: Mitchell Seaton + * Description: Passes on progress data to the Flash Learner to update the progress bar. + * + */ + + %> +<%@ tag body-content="empty" %> +<%@ attribute name="progress" required="true" rtexprvalue="true" type="java.lang.String" %> +<%@ attribute name="version" required="false" rtexprvalue="true" %> +<%@ attribute name="id" required="true" rtexprvalue="true" %> +<%@ attribute name="redirect" required="false" rtexprvalue="true" %> +<%@ taglib uri="tags-core" prefix="c" %> +<%@ taglib uri="tags-lams" prefix="lams" %> + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tags/Tab.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/Tab.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/Tab.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/tags/TabBody.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/TabBody.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/TabBody.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/tags/TabName.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/TabName.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/TabName.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/tags/Tabs.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/Tabs.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/Tabs.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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_scratchie/web/WEB-INF/tags/headItems.tag =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tags/headItems.tag (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tags/headItems.tag (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,47 @@ +<%/**************************************************************** + * 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 + * **************************************************************** + */ + +/** + * Standard Head Items + * Author: Fiona Malikoff + * Description: Includes all the standard head items e.g. the + * lams css files, sets the content type, standard javascript files. + */ +%> +<%@ tag body-content="empty"%> + +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> + + + + + + + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tiles-defs.xml =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tiles-defs.xml (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tiles-defs.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/jstl/c.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/jstl/c.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/jstl/c.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,563 @@ + + + + + JSTL 1.1 core library + JSTL core + 1.1 + c + http://java.sun.com/jsp/jstl/core + + + + Provides core validation features for JSTL tags. + + + org.apache.taglibs.standard.tlv.JstlCoreTLV + + + + + + Catches any Throwable that occurs in its body and optionally + exposes it. + + catch + org.apache.taglibs.standard.tag.common.core.CatchTag + JSP + + +Name of the exported scoped variable for the +exception thrown from a nested action. The type of the +scoped variable is the type of the exception thrown. + + var + false + false + + + + + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + + + + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + + if + org.apache.taglibs.standard.tag.rt.core.IfTag + JSP + + +The test condition that determines whether or +not the body content should be processed. + + test + true + true + boolean + + + +Name of the exported scoped variable for the +resulting value of the test condition. The type +of the scoped variable is Boolean. + + var + false + false + + + +Scope for var. + + scope + false + false + + + + + + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + + import + org.apache.taglibs.standard.tag.rt.core.ImportTag + org.apache.taglibs.standard.tei.ImportTEI + JSP + + +The URL of the scratchie to import. + + url + true + true + + + +Name of the exported scoped variable for the +scratchie's content. The type of the scoped +variable is String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +Name of the exported scoped variable for the +scratchie's content. The type of the scoped +variable is Reader. + + varReader + false + false + + + +Name of the context when accessing a relative +URL scratchie that belongs to a foreign +context. + + context + false + true + + + +Character encoding of the content at the input +scratchie. + + charEncoding + false + true + + + + + + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + + forEach + org.apache.taglibs.standard.tag.rt.core.ForEachTag + org.apache.taglibs.standard.tei.ForEachTEI + JSP + + +Collection of items to iterate over. + + items + false + true + java.lang.Object + + + +If items specified: +Iteration begins at the item located at the +specified index. First item of the collection has +index 0. +If items not specified: +Iteration begins with index set at the value +specified. + + begin + false + true + int + + + +If items specified: +Iteration ends at the item located at the +specified index (inclusive). +If items not specified: +Iteration ends when index reaches the value +specified. + + end + false + true + int + + + +Iteration will only process every step items of +the collection, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. Its type depends +on the object of the underlying collection. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of type +javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Iterates over tokens, separated by the supplied delimeters + + forTokens + org.apache.taglibs.standard.tag.rt.core.ForTokensTag + JSP + + +String of tokens to iterate over. + + items + true + true + java.lang.String + + + +The set of delimiters (the characters that +separate the tokens in the string). + + delims + true + true + java.lang.String + + + +Iteration begins at the token located at the +specified index. First token has index 0. + + begin + false + true + int + + + +Iteration ends at the token located at the +specified index (inclusive). + + end + false + true + int + + + +Iteration will only process every step tokens +of the string, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +current item of the iteration. This scoped +variable has nested visibility. + + var + false + false + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of +type +javax.servlet.jsp.jstl.core.LoopTag +Status. This scoped variable has nested +visibility. + + varStatus + false + false + + + + + + Like <%= ... >, but for expressions. + + out + org.apache.taglibs.standard.tag.rt.core.OutTag + JSP + + +Expression to be evaluated. + + value + true + true + + + +Default value if the resulting value is null. + + default + false + true + + + +Determines whether characters <,>,&,'," in the +resulting string should be converted to their +corresponding character entity codes. Default value is +true. + + escapeXml + false + true + + + + + + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + + + + Adds a parameter to a containing 'import' tag's URL. + + param + org.apache.taglibs.standard.tag.rt.core.ParamTag + JSP + + +Name of the query string parameter. + + name + true + true + + + +Value of the parameter. + + value + false + true + + + + + + Redirects to a new URL. + + redirect + org.apache.taglibs.standard.tag.rt.core.RedirectTag + JSP + + +The URL of the scratchie to redirect to. + + url + false + true + + + +Name of the context when redirecting to a relative URL +scratchie that belongs to a foreign context. + + context + false + true + + + + + + Removes a scoped variable (from a particular scope, if specified). + + remove + org.apache.taglibs.standard.tag.common.core.RemoveTag + empty + + +Name of the scoped variable to be removed. + + var + true + false + + + +Scope for var. + + scope + false + false + + + + + + Sets the result of an expression evaluation in a 'scope' + + set + org.apache.taglibs.standard.tag.rt.core.SetTag + JSP + + +Name of the exported scoped variable to hold the value +specified in the action. The type of the scoped variable is +whatever type the value expression evaluates to. + + var + false + false + + + +Expression to be evaluated. + + value + false + true + + + +Target object whose property will be set. Must evaluate to +a JavaBeans object with setter property property, or to a +java.util.Map object. + + target + false + true + + + +Name of the property to be set in the target object. + + property + false + true + + + +Scope for var. + + scope + false + false + + + + + + Creates a URL with optional query parameters. + + url + org.apache.taglibs.standard.tag.rt.core.UrlTag + JSP + + +Name of the exported scoped variable for the +processed url. The type of the scoped variable is +String. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +URL to be processed. + + value + false + true + + + +Name of the context when specifying a relative URL +scratchie that belongs to a foreign context. + + context + false + true + + + + + + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + + when + org.apache.taglibs.standard.tag.rt.core.WhenTag + JSP + + +The test condition that determines whether or not the +body content should be processed. + + test + true + true + boolean + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/jstl/fmt.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/jstl/fmt.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/jstl/fmt.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,671 @@ + + + + + JSTL 1.1 i18n-capable formatting library + JSTL fmt + 1.1 + fmt + http://java.sun.com/jsp/jstl/fmt + + + + Provides core validation features for JSTL tags. + + + org.apache.taglibs.standard.tlv.JstlFmtTLV + + + + + + Sets the request character encoding + + requestEncoding + org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag + empty + + +Name of character encoding to be applied when +decoding request parameters. + + value + false + true + + + + + + Stores the given locale in the locale configuration variable + + setLocale + org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag + empty + + +A String value is interpreted as the +printable representation of a locale, which +must contain a two-letter (lower-case) +language code (as defined by ISO-639), +and may contain a two-letter (upper-case) +country code (as defined by ISO-3166). +Language and country codes must be +separated by hyphen (-) or underscore +(_). + + value + true + true + + + +Vendor- or browser-specific variant. +See the java.util.Locale javadocs for +more information on variants. + + variant + false + true + + + +Scope of the locale configuration variable. + + scope + false + false + + + + + + Specifies the time zone for any time formatting or parsing actions + nested in its body + + timeZone + org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag + JSP + + +The time zone. A String value is interpreted as +a time zone ID. This may be one of the time zone +IDs supported by the Java platform (such as +"America/Los_Angeles") or a custom time zone +ID (such as "GMT-8"). See +java.util.TimeZone for more information on +supported time zone formats. + + value + true + true + + + + + + Stores the given time zone in the time zone configuration variable + + setTimeZone + org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag + empty + + +The time zone. A String value is interpreted as +a time zone ID. This may be one of the time zone +IDs supported by the Java platform (such as +"America/Los_Angeles") or a custom time zone +ID (such as "GMT-8"). See java.util.TimeZone for +more information on supported time zone +formats. + + value + true + true + + + +Name of the exported scoped variable which +stores the time zone of type +java.util.TimeZone. + + var + false + false + + + +Scope of var or the time zone configuration +variable. + + scope + false + false + + + + + + Loads a scratchie bundle to be used by its tag body + + bundle + org.apache.taglibs.standard.tag.rt.fmt.BundleTag + JSP + + +Scratchie bundle base name. This is the bundle's +fully-qualified scratchie name, which has the same +form as a fully-qualified class name, that is, it uses +"." as the package component separator and does not +have any file type (such as ".class" or ".properties") +suffix. + + basename + true + true + + + +Prefix to be prepended to the value of the message +key of any nested <fmt:message> action. + + prefix + false + true + + + + + + Loads a scratchie bundle and stores it in the named scoped variable or + the bundle configuration variable + + setBundle + org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag + empty + + +Scratchie bundle base name. This is the bundle's +fully-qualified scratchie name, which has the same +form as a fully-qualified class name, that is, it uses +"." as the package component separator and does not +have any file type (such as ".class" or ".properties") +suffix. + + basename + true + true + + + +Name of the exported scoped variable which stores +the i18n localization context of type +javax.servlet.jsp.jstl.fmt.LocalizationC +ontext. + + var + false + false + + + +Scope of var or the localization context +configuration variable. + + scope + false + false + + + + + + Maps key to localized message and performs parametric replacement + + message + org.apache.taglibs.standard.tag.rt.fmt.MessageTag + JSP + + +Message key to be looked up. + + key + false + true + + + +Localization context in whose scratchie +bundle the message key is looked up. + + bundle + false + true + + + +Name of the exported scoped variable +which stores the localized message. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Supplies an argument for parametric replacement to a containing + <message> tag + + param + org.apache.taglibs.standard.tag.rt.fmt.ParamTag + JSP + + +Argument used for parametric replacement. + + value + false + true + + + + + + Formats a numeric value as a number, currency, or percentage + + formatNumber + org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag + JSP + + +Numeric value to be formatted. + + value + false + true + + + +Specifies whether the value is to be +formatted as number, currency, or +percentage. + + type + false + true + + + +Custom formatting pattern. + + pattern + false + true + + + +ISO 4217 currency code. Applied only +when formatting currencies (i.e. if type is +equal to "currency"); ignored otherwise. + + currencyCode + false + true + + + +Currency symbol. Applied only when +formatting currencies (i.e. if type is equal +to "currency"); ignored otherwise. + + currencySymbol + false + true + + + +Specifies whether the formatted output +will contain any grouping separators. + + groupingUsed + false + true + + + +Maximum number of digits in the integer +portion of the formatted output. + + maxIntegerDigits + false + true + + + +Minimum number of digits in the integer +portion of the formatted output. + + minIntegerDigits + false + true + + + +Maximum number of digits in the +fractional portion of the formatted output. + + maxFractionDigits + false + true + + + +Minimum number of digits in the +fractional portion of the formatted output. + + minFractionDigits + false + true + + + +Name of the exported scoped variable +which stores the formatted result as a +String. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Parses the string representation of a number, currency, or percentage + + parseNumber + org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag + JSP + + +String to be parsed. + + value + false + true + + + +Specifies whether the string in the value +attribute should be parsed as a number, +currency, or percentage. + + type + false + true + + + +Custom formatting pattern that determines +how the string in the value attribute is to be +parsed. + + pattern + false + true + + + +Locale whose default formatting pattern (for +numbers, currencies, or percentages, +respectively) is to be used during the parse +operation, or to which the pattern specified +via the pattern attribute (if present) is +applied. + + parseLocale + false + true + + + +Specifies whether just the integer portion of +the given value should be parsed. + + integerOnly + false + true + + + +Name of the exported scoped variable which +stores the parsed result (of type +java.lang.Number). + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Formats a date and/or time using the supplied styles and pattern + + formatDate + org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag + empty + + +Date and/or time to be formatted. + + value + true + true + + + +Specifies whether the time, the date, or both +the time and date components of the given +date are to be formatted. + + type + false + true + + + +Predefined formatting style for dates. Follows +the semantics defined in class +java.text.DateFormat. Applied only +when formatting a date or both a date and +time (i.e. if type is missing or is equal to +"date" or "both"); ignored otherwise. + + dateStyle + false + true + + + +Predefined formatting style for times. Follows +the semantics defined in class +java.text.DateFormat. Applied only +when formatting a time or both a date and +time (i.e. if type is equal to "time" or "both"); +ignored otherwise. + + timeStyle + false + true + + + +Custom formatting style for dates and times. + + pattern + false + true + + + +Time zone in which to represent the formatted +time. + + timeZone + false + true + + + +Name of the exported scoped variable which +stores the formatted result as a String. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + + + Parses the string representation of a date and/or time + + parseDate + org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag + JSP + + +Date string to be parsed. + + value + false + true + + + +Specifies whether the date string in the +value attribute is supposed to contain a +time, a date, or both. + + type + false + true + + + +Predefined formatting style for days +which determines how the date +component of the date string is to be +parsed. Applied only when formatting a +date or both a date and time (i.e. if type +is missing or is equal to "date" or "both"); +ignored otherwise. + + dateStyle + false + true + + + +Predefined formatting styles for times +which determines how the time +component in the date string is to be +parsed. Applied only when formatting a +time or both a date and time (i.e. if type +is equal to "time" or "both"); ignored +otherwise. + + timeStyle + false + true + + + +Custom formatting pattern which +determines how the date string is to be +parsed. + + pattern + false + true + + + +Time zone in which to interpret any time +information in the date string. + + timeZone + false + true + + + +Locale whose predefined formatting styles +for dates and times are to be used during +the parse operation, or to which the +pattern specified via the pattern +attribute (if present) is applied. + + parseLocale + false + true + + + +Name of the exported scoped variable in +which the parsing result (of type +java.util.Date) is stored. + + var + false + false + + + +Scope of var. + + scope + false + false + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/jstl/fn.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/jstl/fn.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/jstl/fn.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,207 @@ + + + + + JSTL 1.1 functions library + JSTL functions + 1.1 + fn + http://java.sun.com/jsp/jstl/functions + + + + Tests if an input string contains the specified substring. + + contains + org.apache.taglibs.standard.functions.Functions + boolean contains(java.lang.String, java.lang.String) + + <c:if test="${fn:contains(name, searchString)}"> + + + + + + Tests if an input string contains the specified substring in a case insensitive way. + + containsIgnoreCase + org.apache.taglibs.standard.functions.Functions + boolean containsIgnoreCase(java.lang.String, java.lang.String) + + <c:if test="${fn:containsIgnoreCase(name, searchString)}"> + + + + + + Tests if an input string ends with the specified suffix. + + endsWith + org.apache.taglibs.standard.functions.Functions + boolean endsWith(java.lang.String, java.lang.String) + + <c:if test="${fn:endsWith(filename, ".txt")}"> + + + + + + Escapes characters that could be interpreted as XML markup. + + escapeXml + org.apache.taglibs.standard.functions.Functions + java.lang.String escapeXml(java.lang.String) + + ${fn:escapeXml(param:info)} + + + + + + Returns the index withing a string of the first occurrence of a specified substring. + + indexOf + org.apache.taglibs.standard.functions.Functions + int indexOf(java.lang.String, java.lang.String) + + ${fn:indexOf(name, "-")} + + + + + + Joins all elements of an array into a string. + + join + org.apache.taglibs.standard.functions.Functions + java.lang.String join(java.lang.String[], java.lang.String) + + ${fn:join(array, ";")} + + + + + + Returns the number of items in a collection, or the number of characters in a string. + + length + org.apache.taglibs.standard.functions.Functions + int length(java.lang.Object) + + You have ${fn:length(shoppingCart.products)} in your shopping cart. + + + + + + Returns a string resulting from replacing in an input string all occurrences + of a "before" string into an "after" substring. + + replace + org.apache.taglibs.standard.functions.Functions + java.lang.String replace(java.lang.String, java.lang.String, java.lang.String) + + ${fn:replace(text, "-", "•")} + + + + + + Splits a string into an array of substrings. + + split + org.apache.taglibs.standard.functions.Functions + java.lang.String[] split(java.lang.String, java.lang.String) + + ${fn:split(customerNames, ";")} + + + + + + Tests if an input string starts with the specified prefix. + + startsWith + org.apache.taglibs.standard.functions.Functions + boolean startsWith(java.lang.String, java.lang.String) + + <c:if test="${fn:startsWith(product.id, "100-")}"> + + + + + + Returns a subset of a string. + + substring + org.apache.taglibs.standard.functions.Functions + java.lang.String substring(java.lang.String, int, int) + + P.O. Box: ${fn:substring(zip, 6, -1)} + + + + + + Returns a subset of a string following a specific substring. + + substringAfter + org.apache.taglibs.standard.functions.Functions + java.lang.String substringAfter(java.lang.String, java.lang.String) + + P.O. Box: ${fn:substringAfter(zip, "-")} + + + + + + Returns a subset of a string before a specific substring. + + substringBefore + org.apache.taglibs.standard.functions.Functions + java.lang.String substringBefore(java.lang.String, java.lang.String) + + Zip (without P.O. Box): ${fn:substringBefore(zip, "-")} + + + + + + Converts all of the characters of a string to lower case. + + toLowerCase + org.apache.taglibs.standard.functions.Functions + java.lang.String toLowerCase(java.lang.String) + + Product name: ${fn.toLowerCase(product.name)} + + + + + + Converts all of the characters of a string to upper case. + + toUpperCase + org.apache.taglibs.standard.functions.Functions + java.lang.String toUpperCase(java.lang.String) + + Product name: ${fn.UpperCase(product.name)} + + + + + + Removes white spaces from both ends of a string. + + trim + org.apache.taglibs.standard.functions.Functions + java.lang.String trim(java.lang.String) + + Name: ${fn.trim(name)} + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/jstl/x.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/jstl/x.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/jstl/x.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,448 @@ + + + + + JSTL 1.1 XML library + JSTL XML + 1.1 + x + http://java.sun.com/jsp/jstl/xml + + + + Provides validation features for JSTL XML tags. + + + org.apache.taglibs.standard.tlv.JstlXmlTLV + + + + + + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + + choose + org.apache.taglibs.standard.tag.common.core.ChooseTag + JSP + + + + + Like <%= ... >, but for XPath expressions. + + out + org.apache.taglibs.standard.tag.rt.xml.ExprTag + empty + + +XPath expression to be evaluated. + + select + true + false + + + +Determines whether characters <,>,&,'," in the +resulting string should be converted to their +corresponding character entity codes. Default +value is true. + + escapeXml + false + true + + + + + + XML conditional tag, which evalutes its body if the + supplied XPath expression evalutes to 'true' as a boolean + + if + org.apache.taglibs.standard.tag.common.xml.IfTag + JSP + + +The test condition that tells whether or not the +body content should be processed. + + select + true + false + + + +Name of the exported scoped variable for the +resulting value of the test condition. The type +of the scoped variable is Boolean. + + var + false + false + + + +Scope for var. + + scope + false + false + + + + + + XML iteration tag. + + forEach + org.apache.taglibs.standard.tag.common.xml.ForEachTag + JSP + + +Name of the exported scoped variable for the +current item of the iteration. This scoped variable +has nested visibility. Its type depends on the +result of the XPath expression in the select +attribute. + + var + false + false + + + +XPath expression to be evaluated. + + select + true + false + + + +Iteration begins at the item located at the +specified index. First item of the collection has +index 0. + + begin + false + true + int + + + +Iteration ends at the item located at the specified +index (inclusive). + + end + false + true + int + + + +Iteration will only process every step items of +the collection, starting with the first one. + + step + false + true + int + + + +Name of the exported scoped variable for the +status of the iteration. Object exported is of type +javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility. + + varStatus + false + false + + + + + + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + + otherwise + org.apache.taglibs.standard.tag.common.core.OtherwiseTag + JSP + + + + + Adds a parameter to a containing 'transform' tag's Transformer + + param + org.apache.taglibs.standard.tag.rt.xml.ParamTag + JSP + + +Name of the transformation parameter. + + name + true + true + + + +Value of the parameter. + + value + false + true + + + + + + Parses XML content from 'source' attribute or 'body' + + parse + org.apache.taglibs.standard.tag.rt.xml.ParseTag + org.apache.taglibs.standard.tei.XmlParseTEI + JSP + + +Name of the exported scoped variable for +the parsed XML document. The type of the +scoped variable is implementation +dependent. + + var + false + false + + + +Name of the exported scoped variable for +the parsed XML document. The type of the +scoped variable is +org.w3c.dom.Document. + + varDom + false + false + + + +Scope for var. + + scope + false + false + + + +Scope for varDom. + + scopeDom + false + false + + + +Deprecated. Use attribute 'doc' instead. + + xml + false + true + + + +Source XML document to be parsed. + + doc + false + true + + + +The system identifier (URI) for parsing the +XML document. + + systemId + false + true + + + +Filter to be applied to the source +document. + + filter + false + true + + + + + + Saves the result of an XPath expression evaluation in a 'scope' + + set + org.apache.taglibs.standard.tag.common.xml.SetTag + empty + + +Name of the exported scoped variable to hold +the value specified in the action. The type of the +scoped variable is whatever type the select +expression evaluates to. + + var + true + false + + + +XPath expression to be evaluated. + + select + false + false + + + +Scope for var. + + scope + false + false + + + + + + Conducts a transformation given a source XML document + and an XSLT stylesheet + + transform + org.apache.taglibs.standard.tag.rt.xml.TransformTag + org.apache.taglibs.standard.tei.XmlTransformTEI + JSP + + +Name of the exported +scoped variable for the +transformed XML +document. The type of the +scoped variable is +org.w3c.dom.Document. + + var + false + false + + + +Scope for var. + + scope + false + false + + + +Result +Object that captures or +processes the transformation +result. + + result + false + true + + + +Deprecated. Use attribute +'doc' instead. + + xml + false + true + + + +Source XML document to be +transformed. (If exported by +<x:set>, it must correspond +to a well-formed XML +document, not a partial +document.) + + doc + false + true + + + +Deprecated. Use attribute +'docSystemId' instead. + + xmlSystemId + false + true + + + +The system identifier (URI) +for parsing the XML +document. + + docSystemId + false + true + + + +javax.xml.transform.Source +Transformation stylesheet as +a String, Reader, or +Source object. + + xslt + false + true + + + +The system identifier (URI) +for parsing the XSLT +stylesheet. + + xsltSystemId + false + true + + + + + + Subtag of <choose> that includes its body if its + expression evalutes to 'true' + + when + org.apache.taglibs.standard.tag.common.xml.WhenTag + JSP + + +The test condition that tells whether or +not the body content should be +processed + + select + true + false + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/lams/lams.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/lams/lams.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/lams/lams.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,509 @@ + + + + + 1.0 + lams + + LAMSTags + + + + + Output the basic URL for the current webapp. e.g. http://server/lams/tool/nb11/ + Base URL for the current web app + + + WebAppURL + org.lamsfoundation.lams.web.tag.WebAppURLTag + empty + + + + + Output a random number for the learner and passon flash movies to communicate directly. + generate unique ID + + + generateID + org.lamsfoundation.lams.web.tag.GenerateIDTag + empty + + + Output a random number for the learner and passon flash movies to communicate directly. + id + false + + true + + + + + + + Get the configuration value for the specified key + Configuration value + + + Configuration + org.lamsfoundation.lams.web.tag.ConfigurationTag + empty + + + Get the configuration value for the specified key + key + false + + true + + + + + + + Output the Server URL as defined in the lams.xml configuration file. + LAMS URL + + + LAMSURL + org.lamsfoundation.lams.web.tag.LAMSURLTag + empty + + + + + Render html tag with direction and language + Render html tag with direction and language + + + html + org.lamsfoundation.lams.web.tag.HtmlTag + JSP + + + Render html tag with direction and language + xhtml + false + + true + + + + + + + Converts text from \n or \r\n to <BR> before rendering + Converts text from \n or \r\n to <BR> before rendering + + + out + org.lamsfoundation.lams.web.tag.MultiLinesOutputTag + empty + + + Converts text from \n or \r\n to <BR> before rendering + value + true + + true + + + + Converts text from \n or \r\n to <BR> before rendering + escapeHtml + false + + true + + + + + + + Help tag + Help tag + + + help + org.lamsfoundation.lams.web.tag.HelpTag + empty + + + Help tag + module + false + + true + + + + Help tag + toolSignature + false + + true + + + + Help tag + page + false + + true + + + + Help tag + style + false + + true + + + + + + + Converts role name into form usable as message scratchie key + Converts role name into form usable as message scratchie key + + + role + org.lamsfoundation.lams.web.tag.RoleTag + empty + + + Converts role name into form usable as message scratchie key + role + true + + true + + + + + + + Output stylesheet based on the user preferences. + User's chosen stylesheet + + + css + org.lamsfoundation.lams.web.tag.CssTag + empty + + + Output stylesheet based on the user preferences. + localLinkPath + false + + true + + + + Output stylesheet based on the user preferences. + style + false + + true + + + + + + + Output details from the shared session UserDTO object + user details + + + user + org.lamsfoundation.lams.web.tag.UserTag + empty + + + Output details from the shared session UserDTO object + property + true + + true + + + + + + + STRUTS-textarea + org.lamsfoundation.lams.web.tag.MultiLinesTextareaTag + empty + + accesskey + false + true + + + alt + false + true + + + altKey + false + true + + + bundle + false + true + + + cols + false + true + + + disabled + false + true + + + errorKey + false + true + + + errorStyle + false + true + + + errorStyleClass + false + true + + + errorStyleId + false + true + + + index + false + true + + + indexed + false + true + + + name + false + true + + + onblur + false + true + + + onchange + false + true + + + onclick + false + true + + + ondblclick + false + true + + + onfocus + false + true + + + onkeydown + false + true + + + onkeypress + false + true + + + onkeyup + false + true + + + onmousedown + false + true + + + onmousemove + false + true + + + onmouseout + false + true + + + onmouseover + false + true + + + onmouseup + false + true + + + property + true + true + + + readonly + false + true + + + rows + false + true + + + style + false + true + + + styleClass + false + true + + + styleId + false + true + + + tabindex + false + true + + + title + false + true + + + titleKey + false + true + + + value + false + true + + + + Tab + /WEB-INF/tags/Tab.tag + + + Tabs + /WEB-INF/tags/Tabs.tag + + + TabBody + /WEB-INF/tags/TabBody.tag + + + TabName + /WEB-INF/tags/TabName.tag + + + CKEditor + /WEB-INF/tags/CKEditor.tag + + + AuthoringButton + /WEB-INF/tags/AuthoringButton.tag + + + headItems + /WEB-INF/tags/headItems.tag + + + Passon + /WEB-INF/tags/Passon.tag + + + Date + /WEB-INF/tags/Date.tag + + + DefineLater + /WEB-INF/tags/DefineLater.tag + + + ImgButtonWrapper + /WEB-INF/tags/ImgButtonWrapper.tag + + + textarea + org.lamsfoundation.lams.web.tag.LAMSMultiLinesTextareaTag + JSP + true + + Render text exactly same as original input, which even won't escape the input HTML tag. + + + + + name + true + true + + + + + id + false + true + + + + + onchange + false + true + + + + Checks whether Flash enabled for learner + Checks whether Flash enabled for learner + + + LearnerFlashEnabled + org.lamsfoundation.lams.web.tag.LearnerFlashEnabledTag + empty + + + head + /WEB-INF/tags/Head.tag + + Index: lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-bean.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-bean.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-bean.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,382 @@ + + + + + + + + + + +1.2 +1.1 +bean +http://struts.apache.org/tags-bean + +cookie +org.apache.struts.taglib.bean.CookieTag +org.apache.struts.taglib.bean.CookieTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +define +org.apache.struts.taglib.bean.DefineTag +org.apache.struts.taglib.bean.DefineTei +JSP + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +header +org.apache.struts.taglib.bean.HeaderTag +org.apache.struts.taglib.bean.HeaderTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +include +org.apache.struts.taglib.bean.IncludeTag +org.apache.struts.taglib.bean.IncludeTei +empty + +anchor +false +true + + +forward +false +true + + +href +false +true + + +id +true +false + + +name +false +true + + +page +false +true + + +transaction +false +true + + + +message +org.apache.struts.taglib.bean.MessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +page +org.apache.struts.taglib.bean.PageTag +org.apache.struts.taglib.bean.PageTei +empty + +id +true +false + + +property +true +true + + + +parameter +org.apache.struts.taglib.bean.ParameterTag +org.apache.struts.taglib.bean.ParameterTei +empty + +id +true +false + + +multiple +false +true + + +name +true +true + + +value +false +true + + + +resource +org.apache.struts.taglib.bean.ResourceTag +org.apache.struts.taglib.bean.ResourceTei +empty + +id +true +false + + +input +false +true + + +name +true +true + + + +size +org.apache.struts.taglib.bean.SizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +false + + +name +false +true + + +property +false +true + + +scope +false +true + + + +struts +org.apache.struts.taglib.bean.StrutsTag +org.apache.struts.taglib.bean.StrutsTei +empty + +id +true +false + + +formBean +false +true + + +forward +false +true + + +mapping +false +true + + + +write +org.apache.struts.taglib.bean.WriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +true +true + + +property +false +true + + +scope +false +true + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-html.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-html.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-html.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,3302 @@ + + + + + + + + + + +1.2 +1.1 +html +http://struts.apache.org/tags-html + +base +org.apache.struts.taglib.html.BaseTag +empty + +target +false +true + + +server +false +true + + + +button +org.apache.struts.taglib.html.ButtonTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +cancel +org.apache.struts.taglib.html.CancelTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +checkbox +org.apache.struts.taglib.html.CheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.html.ErrorsTag +empty + +bundle +false +true + + +footer +false +true + + +header +false +true + + +locale +false +true + + +name +false +true + + +prefix +false +true + + +property +false +true + + +suffix +false +true + + + +file +org.apache.struts.taglib.html.FileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.html.FormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +disabled +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +readonly +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +frame +org.apache.struts.taglib.html.FrameTag + +bundle +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +frameborder +false +true + + +frameName +false +true + + +href +false +true + + +longdesc +false +true + + +marginheight +false +true + + +marginwidth +false +true + + +name +false +true + + +noresize +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +scrolling +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + + +hidden +org.apache.struts.taglib.html.HiddenTag +empty + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + +write +false +true + + + +html +org.apache.struts.taglib.html.HtmlTag +JSP + +lang +false +true + + +locale +false +true + + +xhtml +false +true + + + +image +org.apache.struts.taglib.html.ImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.html.ImgTag +empty + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +contextRelative +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +javascript +org.apache.struts.taglib.html.JavascriptValidatorTag +empty + +cdata +false +true + + +dynamicJavascript +false +false + + +formName +false +true + + +method +false +true + + +page +false +true + + +scriptLanguage +false +true + + +src +false +true + + +staticJavascript +false +false + + +htmlComment +false +true + + +bundle +false +true + + + +link +org.apache.struts.taglib.html.LinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +bundle +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.struts.taglib.html.MessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +false + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.html.MultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +option +org.apache.struts.taglib.html.OptionTag + +bundle +false +true + + +disabled +false +true + + +key +false +true + + +locale +false +true + + +style +false +true + + +styleId +false +true + + +styleClass +false +true + + +value +true +true + + + +options +org.apache.struts.taglib.html.OptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.html.OptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.html.PasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.html.RadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +reset +org.apache.struts.taglib.html.ResetTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +rewrite +org.apache.struts.taglib.html.RewriteTag +empty + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +select +org.apache.struts.taglib.html.SelectTag +JSP + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.html.SubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.html.TextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.html.TextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +cols +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +xhtml +org.apache.struts.taglib.html.XhtmlTag +empty + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-logic.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-logic.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-logic.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,652 @@ + + + + + + + + + +1.2 +1.1 +logic +http://struts.apache.org/tags-logic + +empty +org.apache.struts.taglib.logic.EmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.logic.EqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +forward +org.apache.struts.taglib.logic.ForwardTag +empty + +name +true +true + + + +greaterEqual +org.apache.struts.taglib.logic.GreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.logic.GreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.logic.IterateTag +org.apache.struts.taglib.logic.IterateTei +JSP + +collection +false +true + + +id +true +false + + +indexId +false +false + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.logic.LessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.logic.LessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.logic.MatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.logic.MessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.logic.MessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.logic.NotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.logic.NotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.logic.NotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.logic.NotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.logic.PresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +redirect +org.apache.struts.taglib.logic.RedirectTag + +action +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +name +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-nested.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-nested.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-nested.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,3171 @@ + + + + + + + + + +1.2 +1.1 +nested +http://struts.apache.org/tags-nested + +nest +org.apache.struts.taglib.nested.NestedPropertyTag +JSP + +property +false +true + + + +writeNesting +org.apache.struts.taglib.nested.NestedWriteNestingTag +org.apache.struts.taglib.nested.NestedWriteNestingTei +JSP + +property +false +true + + +id +false +true + + +filter +false +true + + + +root +org.apache.struts.taglib.nested.NestedRootTag +JSP + +name +false +true + + + +define +org.apache.struts.taglib.nested.bean.NestedDefineTag +org.apache.struts.taglib.nested.bean.NestedDefineTei +empty + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + +toScope +false +true + + +type +false +true + + +value +false +true + + + +message +org.apache.struts.taglib.nested.bean.NestedMessageTag +empty + +arg0 +false +true + + +arg1 +false +true + + +arg2 +false +true + + +arg3 +false +true + + +arg4 +false +true + + +bundle +false +true + + +key +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +size +org.apache.struts.taglib.nested.bean.NestedSizeTag +org.apache.struts.taglib.bean.SizeTei +empty + +collection +false +true + + +id +true +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +write +org.apache.struts.taglib.nested.bean.NestedWriteTag +empty + +bundle +false +true + + +filter +false +true + + +format +false +true + + +formatKey +false +true + + +ignore +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +scope +false +true + + + +checkbox +org.apache.struts.taglib.nested.html.NestedCheckboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +errors +org.apache.struts.taglib.nested.html.NestedErrorsTag +empty + +bundle +false +true + + +footer +false +true + + +header +false +true + + +locale +false +true + + +name +false +true + + +prefix +false +true + + +property +false +true + + +suffix +false +true + + + +file +org.apache.struts.taglib.nested.html.NestedFileTag + +accesskey +false +true + + +accept +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +form +org.apache.struts.taglib.nested.html.NestedFormTag +JSP + +action +true +true + + +acceptCharset +false +true + + +disabled +false +true + + +enctype +false +true + + +focus +false +true + + +focusIndex +false +true + + +method +false +true + + +onreset +false +true + + +onsubmit +false +true + + +readonly +false +true + + +scriptLanguage +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +target +false +true + + + +hidden +org.apache.struts.taglib.nested.html.NestedHiddenTag + +alt +false +true + + +altKey +false +true + + +indexed +false +true + + +name +false +true + + +property +true +true + + +title +false +true + + +titleKey +false +true + + +styleClass +false +true + + +styleId +false +true + + +value +false +true + + +write +false +true + + + +image +org.apache.struts.taglib.nested.html.NestedImageTag + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +locale +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +pageKey +false +true + + +property +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +img +org.apache.struts.taglib.nested.html.NestedImgTag +empty + +accesskey +false +true + + +align +false +true + + +alt +false +true + + +altKey +false +true + + +border +false +true + + +bundle +false +true + + +height +false +true + + +hspace +false +true + + +imageName +false +true + + +ismap +false +true + + +locale +false +true + + +lowsrc +false +true + + +name +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +paramId +false +true + + +page +false +true + + +pageKey +false +true + + +action +false +true + + +module +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +src +false +true + + +srcKey +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +title +false +true + + +titleKey +false +true + + +useLocalEncoding +false +true + + +usemap +false +true + + +vspace +false +true + + +width +false +true + + + +link +org.apache.struts.taglib.nested.html.NestedLinkTag + +accesskey +false +true + + +action +false +true + + +module +false +true + + +anchor +false +true + + +forward +false +true + + +href +false +true + + +indexed +false +true + + +indexId +false +true + + +bundle +false +true + + +linkName +false +true + + +name +false +true + + +onblur +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +page +false +true + + +paramId +false +true + + +paramName +false +true + + +paramProperty +false +true + + +paramScope +false +true + + +property +false +true + + +scope +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +target +false +true + + +title +false +true + + +titleKey +false +true + + +transaction +false +true + + +useLocalEncoding +false +true + + + +messages +org.apache.struts.taglib.nested.html.NestedMessagesTag +org.apache.struts.taglib.html.MessagesTei +JSP + +id +true +true + + +bundle +false +true + + +locale +false +true + + +name +false +true + + +property +false +true + + +header +false +true + + +footer +false +true + + +message +false +true + + + +multibox +org.apache.struts.taglib.nested.html.NestedMultiboxTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +options +org.apache.struts.taglib.nested.html.NestedOptionsTag +empty + +collection +false +true + + +filter +false +true + + +labelName +false +true + + +labelProperty +false +true + + +name +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + + +optionsCollection +org.apache.struts.taglib.nested.html.NestedOptionsCollectionTag +empty + +filter +false +true + + +label +false +true + + +name +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +value +false +true + + + +password +org.apache.struts.taglib.nested.html.NestedPasswordTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +redisplay +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +size +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +radio +org.apache.struts.taglib.nested.html.NestedRadioTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +property +true +true + + +onmousedown +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +true +true + + +idName +false +true + + + +select +org.apache.struts.taglib.nested.html.NestedSelectTag +JSP + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +multiple +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +size +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +submit +org.apache.struts.taglib.nested.html.NestedSubmitTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +indexed +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +text +org.apache.struts.taglib.nested.html.NestedTextTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +maxlength +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +size +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +textarea +org.apache.struts.taglib.nested.html.NestedTextareaTag + +accesskey +false +true + + +alt +false +true + + +altKey +false +true + + +bundle +false +true + + +cols +false +true + + +disabled +false +true + + +errorKey +false +true + + +errorStyle +false +true + + +errorStyleClass +false +true + + +errorStyleId +false +true + + +indexed +false +true + + +name +false +true + + +onblur +false +true + + +onchange +false +true + + +onclick +false +true + + +ondblclick +false +true + + +onfocus +false +true + + +onkeydown +false +true + + +onkeypress +false +true + + +onkeyup +false +true + + +onmousedown +false +true + + +onmousemove +false +true + + +onmouseout +false +true + + +onmouseover +false +true + + +onmouseup +false +true + + +property +true +true + + +readonly +false +true + + +rows +false +true + + +style +false +true + + +styleClass +false +true + + +styleId +false +true + + +tabindex +false +true + + +title +false +true + + +titleKey +false +true + + +value +false +true + + + +empty +org.apache.struts.taglib.nested.logic.NestedEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +equal +org.apache.struts.taglib.nested.logic.NestedEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterEqual +org.apache.struts.taglib.nested.logic.NestedGreaterEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +greaterThan +org.apache.struts.taglib.nested.logic.NestedGreaterThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +iterate +org.apache.struts.taglib.nested.logic.NestedIterateTag +org.apache.struts.taglib.nested.logic.NestedIterateTei +JSP + +collection +false +true + + +id +false +true + + +indexId +false +true + + +length +false +true + + +name +false +true + + +offset +false +true + + +property +false +true + + +scope +false +true + + +type +false +true + + + +lessEqual +org.apache.struts.taglib.nested.logic.NestedLessEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +lessThan +org.apache.struts.taglib.nested.logic.NestedLessThanTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +match +org.apache.struts.taglib.nested.logic.NestedMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +messagesNotPresent +org.apache.struts.taglib.nested.logic.NestedMessagesNotPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +messagesPresent +org.apache.struts.taglib.nested.logic.NestedMessagesPresentTag +JSP + +name +false +true + + +property +false +true + + +message +false +true + + + +notEmpty +org.apache.struts.taglib.nested.logic.NestedNotEmptyTag +JSP + +name +false +true + + +property +false +true + + +scope +false +true + + + +notEqual +org.apache.struts.taglib.nested.logic.NestedNotEqualTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notMatch +org.apache.struts.taglib.nested.logic.NestedNotMatchTag +JSP + +cookie +false +true + + +header +false +true + + +location +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +scope +false +true + + +value +true +true + + + +notPresent +org.apache.struts.taglib.nested.logic.NestedNotPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + +present +org.apache.struts.taglib.nested.logic.NestedPresentTag +JSP + +cookie +false +true + + +header +false +true + + +name +false +true + + +parameter +false +true + + +property +false +true + + +role +false +true + + +scope +false +true + + +user +false +true + + + + + + Index: lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-tiles.tld =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-tiles.tld (revision 0) +++ lams_tool_scratchie/web/WEB-INF/tlds/struts/struts-tiles.tld (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,344 @@ + + + + + + + + + + +1.2 +1.1 +tiles +http://struts.apache.org/tags-tiles + +insert +org.apache.struts.taglib.tiles.InsertTag +JSP + +template +false +true + + +component +false +true + + +page +false +true + + +definition +false +true + + +attribute +false +false + + +name +false +true + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +flush +false +false + + +ignore +false +true + + +role +false +true + + +controllerUrl +false +true + + +controllerClass +false +true + + + +definition +org.apache.struts.taglib.tiles.DefinitionTag +JSP + +id +true +false + + +scope +false +false + + +template +false +true + + +page +false +true + + +role +false +true + + +extends +false +true + + + +put +org.apache.struts.taglib.tiles.PutTag +JSP + +name +false +false + + +value +false +true + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +putList +org.apache.struts.taglib.tiles.PutListTag +JSP + +name +true +false + + + +add +org.apache.struts.taglib.tiles.AddTag +JSP + +value +false +false + + +content +false +true + + +direct +false +false + + +type +false +false + + +beanName +false +true + + +beanProperty +false +true + + +beanScope +false +false + + +role +false +true + + + +get +org.apache.struts.taglib.tiles.GetTag +empty + +name +true +true + + +ignore +false +true + + +flush +false +false + + +role +false +true + + + +getAsString +org.apache.struts.taglib.tiles.GetAttributeTag +empty + +name +true +true + + +ignore +false +true + + +role +false +true + + + +useAttribute +org.apache.struts.taglib.tiles.UseAttributeTag +org.apache.struts.taglib.tiles.UseAttributeTei +empty + +id +false +false + + +classname +false +false + + +scope +false +false + + +name +true +true + + +ignore +false +true + + + +importAttribute +org.apache.struts.taglib.tiles.ImportAttributeTag +empty + +name +false +true + + +scope +false +false + + +ignore +false +true + + + +initComponentDefinitions +org.apache.struts.taglib.tiles.InitDefinitionsTag +empty + +file +true +false + + +classname +false +false + + + + + + Index: lams_tool_scratchie/web/WEB-INF/web.xml =================================================================== diff -u --- lams_tool_scratchie/web/WEB-INF/web.xml (revision 0) +++ lams_tool_scratchie/web/WEB-INF/web.xml (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,366 @@ + + + + Shared Scratchie + + Shared Scratchie tool + + + javax.servlet.jsp.jstl.fmt.localizationContext + org.lamsfoundation.lams.tool.scratchie.ApplicationResources + + + + contextClass + org.jboss.spring.factory.VFSXmlWebApplicationContext + + + contextConfigLocation + classpath:/org/lamsfoundation/lams/tool/scratchie/dbupdates/autopatchContext.xml + + + locatorFactorySelector + classpath:/org/lamsfoundation/lams/beanRefContext.xml + + + parentContextKey + context.central + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + org.lamsfoundation.lams.web.session.SetMaxTimeoutListener + + + + + hibernateFilter + + org.springframework.orm.hibernate3.support.OpenSessionInViewFilter + + + sessionFactoryBeanName + coreSessionFactory + + + + + SystemSessionFilter + + org.lamsfoundation.lams.web.session.SystemSessionFilter + + + + LocaleFilter + + org.lamsfoundation.lams.web.filter.LocaleFilter + + + encoding + UTF-8 + + + + + hibernateFilter + /* + + + SystemSessionFilter + /* + + + LocaleFilter + /* + + + + + + exportPortfolio + org.lamsfoundation.lams.tool.scratchie.web.servlet.ExportServlet + + + + completeItem + org.lamsfoundation.lams.tool.scratchie.web.servlet.CompleteItemServlet + + + + action + org.apache.struts.action.ActionServlet + + config + /WEB-INF/struts-config.xml + + + debug + 999 + + + detail + 1 + + + validate + true + + 2 + + + + Connector + net.fckeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + + + + Instructions Download + Instructions Download + download + org.lamsfoundation.lams.contentrepository.client.ToolDownload + + toolContentHandlerBeanName + scratchieToolContentHandler + + 3 + + + + action + *.do + + + + Connector + /ckeditor/filemanager/browser/default/connectors/jsp/connector + + + + download + /download/* + + + + exportPortfolio + /exportPortfolio + + + + completeItem + /learning/completeItem + + + + + + + + tags-bean + /WEB-INF/tlds/struts/struts-bean.tld + + + tags-html + /WEB-INF/tlds/struts/struts-html.tld + + + tags-logic + /WEB-INF/tlds/struts/struts-logic.tld + + + tags-tiles + /WEB-INF/tlds/struts/struts-tiles.tld + + + + + + tags-fmt + /WEB-INF/tlds/jstl/fmt.tld + + + tags-core + /WEB-INF/tlds/jstl/c.tld + + + tags-function + /WEB-INF/tlds/jstl/fn.tld + + + tags-xml + /WEB-INF/tlds/jstl/x.tld + + + + + + tags-lams + /WEB-INF/tlds/lams/lams.tld + + + + + + + + Secure Content + /* + + + LEARNER + TEACHER + MONITOR + AUTHOR + ADMIN + SYSADMIN + AUTHOR ADMIN + + + + + + Authoring Update + /authoring/* + + + AUTHOR + AUTHOR ADMIN + SYSADMIN + + + + + Staff Content + /monitoring.do + + + MONITOR + TEACHER + + + + + Staff Content + /definelater.do + + + MONITOR + TEACHER + + + + + + Adminstrator Content + /admin.do + + + ADMIN + + + + + LAMS System Adminstrator Content + /sysadmin.do + + + SYSADMIN + + + + + + Download Files + /download/ + + + LEARNER + AUTHOR + MONITOR + TEACHER + ADMIN + SYSADMIN + AUTHOR ADMIN + + + + + + + + Student + LEARNER + + + Student + TEACHER + + + + Can create/modify a learning design + AUTHOR + + + + Can running and monitoring a learning session + MONITOR + + + + Can add/remove users to the system, set up classes of users for sessions + ADMIN + + + + Can add/remove users to the system, set up classes of users for sessions + SYSADMIN + + + + Can create/modify a learning design and edit default tool content + AUTHOR ADMIN + + + + + FORM + LAMS + + /login.jsp + /login.jsp?failed=y + + + + + 500 + /error.jsp + + + 403 + /403.jsp + + + 404 + /404.jsp + + + Index: lams_tool_scratchie/web/common/footer.jsp =================================================================== diff -u --- lams_tool_scratchie/web/common/footer.jsp (revision 0) +++ lams_tool_scratchie/web/common/footer.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ +
    Index: lams_tool_scratchie/web/common/header.jsp =================================================================== diff -u --- lams_tool_scratchie/web/common/header.jsp (revision 0) +++ lams_tool_scratchie/web/common/header.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,17 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/common/messages.jsp =================================================================== diff -u --- lams_tool_scratchie/web/common/messages.jsp (revision 0) +++ lams_tool_scratchie/web/common/messages.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,8 @@ +<%-- Error Messages --%> + +

    + +
    +
    +

    +
    Index: lams_tool_scratchie/web/common/tabbedheader.jsp =================================================================== diff -u --- lams_tool_scratchie/web/common/tabbedheader.jsp (revision 0) +++ lams_tool_scratchie/web/common/tabbedheader.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,16 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + Index: lams_tool_scratchie/web/common/taglibs.jsp =================================================================== diff -u --- lams_tool_scratchie/web/common/taglibs.jsp (revision 0) +++ lams_tool_scratchie/web/common/taglibs.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,12 @@ +<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> +<%@ taglib uri="tags-tiles" prefix="tiles" %> +<%@ taglib uri="tags-bean" prefix="bean" %> +<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="tags-logic" prefix="logic" %> +<%@ taglib uri="tags-function" prefix="fn" %> +<%@ taglib uri="tags-core" prefix="c" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-xml" prefix="x" %> +<%@ taglib uri="tags-lams" prefix="lams" %> + + Index: lams_tool_scratchie/web/error.jsp =================================================================== diff -u --- lams_tool_scratchie/web/error.jsp (revision 0) +++ lams_tool_scratchie/web/error.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,69 @@ + + +<%@ page language="java" isErrorPage="true" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> + + + + +<%-- Catch JSP Servlet Exception --%> +<% +if (exception != null) { +%> + + <%=exception.getMessage()%> + + + <%=exception.getClass().getName()%> + +<% + java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); + java.io.PrintStream os = new java.io.PrintStream(bos); + exception.printStackTrace(os); + String stack = new String(bos.toByteArray()); +%> + + <%=stack%> + +<% +} else if ((Exception) request.getAttribute("javax.servlet.error.exception") != null) { +%> + + + <%=((Exception) request.getAttribute("javax.servlet.error.exception")).getMessage()%> + + + <%=((Exception) request.getAttribute("javax.servlet.error.exception")).getMessage() + .getClass().getName()%> + +<% + java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream(); + java.io.PrintStream os = new java.io.PrintStream(bos); + ((Exception) request.getAttribute("javax.servlet.error.exception")).printStackTrace(os); + String stack = new String(bos.toByteArray()); +%> + + <%=stack%> + +<% +} +%> + +
    + + + +
    + + + + Index: lams_tool_scratchie/web/images/icon_scratchie.swf =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/css/scratchie.css =================================================================== diff -u --- lams_tool_scratchie/web/includes/css/scratchie.css (revision 0) +++ lams_tool_scratchie/web/includes/css/scratchie.css (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,33 @@ +.innerforms { + border: 0px; + font-size: small; + font-style: normal; + width:100%; +} + +div.error, div.message { + background-color: #ffffcc; + border: 1px solid #000; + color: #000000; + font-family: Arial, Helvetica, sans-serif; + font-weight: normal; + margin: 10px auto; + padding: 3px; + text-align: left; + vertical-align: bottom; +} + +/* use a different color for the errors */ +div.error { + border: 2px solid red; +} + +img.validationWarning, div.errors img.icon, div.messages img.icon { + border: 0; + width: 14px; + height: 13px; + vertical-align: top; +} +div.message img.icon { + vertical-align: middle; +} Index: lams_tool_scratchie/web/includes/images/.cvsignore =================================================================== diff -u --- lams_tool_scratchie/web/includes/images/.cvsignore (revision 0) +++ lams_tool_scratchie/web/includes/images/.cvsignore (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ +Thumbs.db Index: lams_tool_scratchie/web/includes/images/answer-1.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-10.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-2.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-3.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-4.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-5.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-6.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-7.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-8.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/answer-9.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/cross.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/downarrow.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/downarrow_disabled.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/edit.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/indicator.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/scratchie-correct-animation.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/scratchie-correct.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/scratchie-wrong-animation.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/scratchie-wrong.png =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/scratchie.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/spacer.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/tick.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/uparrow.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/images/uparrow_disabled.gif =================================================================== diff -u Binary files differ Index: lams_tool_scratchie/web/includes/javascript/scratchiecommon.js =================================================================== diff -u --- lams_tool_scratchie/web/includes/javascript/scratchiecommon.js (revision 0) +++ lams_tool_scratchie/web/includes/javascript/scratchiecommon.js (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1 @@ \ No newline at end of file Index: lams_tool_scratchie/web/layout/ frame.jsp =================================================================== diff -u --- lams_tool_scratchie/web/layout/ frame.jsp (revision 0) +++ lams_tool_scratchie/web/layout/ frame.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -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 version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + + http://www.gnu.org/licenses/gpl.txt +--%> +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <body class="stripes"> + This tool requires the support of frames. Your browser does not support frames. + </body> + + + Index: lams_tool_scratchie/web/layout/default.jsp =================================================================== diff -u --- lams_tool_scratchie/web/layout/default.jsp (revision 0) +++ lams_tool_scratchie/web/layout/default.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,20 @@ +<%@ include file="/common/taglibs.jsp"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> + + + + + + + + +

    + +

    +
    + + + + +
    Index: lams_tool_scratchie/web/login.jsp =================================================================== diff -u --- lams_tool_scratchie/web/login.jsp (revision 0) +++ lams_tool_scratchie/web/login.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,12 @@ +<%@ 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_scratchie/web/pages/authoring/advance.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/advance.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/advance.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,34 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + +

    + + + +

    + +

    + +

    + Index: lams_tool_scratchie/web/pages/authoring/authoring.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/authoring.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/authoring.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,107 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ page import="org.lamsfoundation.lams.tool.scratchie.ScratchieConstants"%> + + + + + <fmt:message key="label.author.title" /> + + <%@ include file="/common/tabbedheader.jsp"%> + + + + + + + + +
    +

    + +

    + + +
    + + + <%@ include file="/common/messages.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- Default value + cancelButtonLabelKey="label.authoring.cancel.button" + saveButtonLabelKey="label.authoring.save.button" + cancelConfirmMsgKey="authoring.msg.cancel.save" + accessMode="author" + --%> + + + +
    + + + +
    + + +
    Index: lams_tool_scratchie/web/pages/authoring/basic.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/basic.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/basic.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,116 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + +
    +
    + +
    + +
    +
    + +
    + +
    + + +
    +
    + <%@ include file="parts/itemlist.jsp"%> +
    + +
    + + + +
    +
    Index: lams_tool_scratchie/web/pages/authoring/definelater.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/definelater.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/definelater.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,83 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ page import="java.util.HashSet"%> +<%@ page import="org.lamsfoundation.lams.tool.scratchie.ScratchieConstants"%> +<%@ page import="java.util.Set"%> +<%Set tabs = new HashSet(); + tabs.add("label.authoring.heading.basic"); + pageContext.setAttribute("tabs", tabs); + + %> + + + <fmt:message key="label.author.title" /> + + <%@ include file="/common/tabbedheader.jsp"%> + + + + + + + +
    + + + + + + + +

    + +

    + +
    + <%@ include file="/common/messages.jsp"%> + + +
    + + + + + + +
    + + + + +
    + +
    + +
    Index: lams_tool_scratchie/web/pages/authoring/definelaterforbid.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/definelaterforbid.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/definelaterforbid.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,21 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + <fmt:message key="label.author.title" /> + + <%@ include file="/common/header.jsp"%> + + +
    +
    +

    + +

    + + +
    +
    + +
    Index: lams_tool_scratchie/web/pages/authoring/instructions.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/instructions.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/instructions.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,113 @@ +<%@ include file="/common/taglibs.jsp"%> +<%@ page + import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    + +
    + +
    + <%@ include file="parts/instructionfilelist.jsp"%> +
    +
    +
    + +
    + + + + + +
    + +
    +
    +
    + +
    + +
    + +
    + <%@ include file="parts/instructionfilelist.jsp"%> +
    +
    +
    + +
    + + + + + +
    + Index: lams_tool_scratchie/web/pages/authoring/parts/instructionfilelist.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/parts/instructionfilelist.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/parts/instructionfilelist.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,65 @@ +<%@ include file="/common/taglibs.jsp"%> +<%@ page + import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> + + + + + + + + + + + + +<%-- check whehter has target file type --%> + + + + + + +<%-- Display target file type --%> + +
      + + +
    • + + + + + + + + + + + + + + + + + + + + + + + + + + +
    • +
      +
      +
    +
    Index: lams_tool_scratchie/web/pages/authoring/parts/itemlist.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/parts/itemlist.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/parts/itemlist.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,70 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + +
    + + + + + + + + + + +
    + + + &#${status.index + 65};) + +
    + +
    + checked="checked" > + + + + +
    + +
    + + " + onclick="upItem(${status.index})"> + + "> + + + + + + "> + + + " + onclick="downItem(${status.index})"> + + + " + onclick="removeItem(${status.index})" /> +
    Index: lams_tool_scratchie/web/pages/authoring/pedagogicalPlannerForm.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/pedagogicalPlannerForm.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,67 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + <%@ include file="/common/messages.jsp"%> + + + + + + + +

    + + +
    + +
    Index: lams_tool_scratchie/web/pages/authoring/start.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/authoring/start.jsp (revision 0) +++ lams_tool_scratchie/web/pages/authoring/start.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,16 @@ + + +<%@ include file="/common/taglibs.jsp" %> + + + + + + + + + + Index: lams_tool_scratchie/web/pages/export/exportportfolio.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/export/exportportfolio.jsp (revision 0) +++ lams_tool_scratchie/web/pages/export/exportportfolio.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,18 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + <%@ include file="parts/exportLearner.jsp"%> + + + + <%@ include file="parts/exportTeacher.jsp"%> + + Index: lams_tool_scratchie/web/pages/export/parts/exportLearner.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/export/parts/exportLearner.jsp (revision 0) +++ lams_tool_scratchie/web/pages/export/parts/exportLearner.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,64 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + <fmt:message key="export.title" /> + + + + + + +
    + +

    + ${sessionMap.scratchie.title} +

    + +
    + ${sessionMap.scratchie.instructions} +
    + + + + + + + + +
    + ${item.title} +
    + ${item.description} +
    + + + + + + + + + + + +
    + +
    + + + + + + +
    Index: lams_tool_scratchie/web/pages/export/parts/exportTeacher.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/export/parts/exportTeacher.jsp (revision 0) +++ lams_tool_scratchie/web/pages/export/parts/exportTeacher.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,108 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + <fmt:message key="export.title" /> + + + + + + + + + + + + + +
    + +

    + ${sessionMap.scratchie.title} +

    + +
    + ${sessionMap.scratchie.instructions} +
    + + + +
    + +
    +
    + + + +
    + +
    + ${summary.sessionName} +
    +
    + +
    +
    + + + +
    + +
    +
    + +
    + + + + + + +
    Index: lams_tool_scratchie/web/pages/learning/definelater.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/definelater.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/definelater.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,21 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + + <%@ include file="/common/header.jsp"%> + + + + +
    +

    + +

    + +
    + + +
    Index: lams_tool_scratchie/web/pages/learning/finish.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/finish.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/finish.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,16 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%-- This page just for : redir finish page to parent rather that part of the frame --%> + + + + + + + Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/learning.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/learning.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,172 @@ + + +<%@ include file="/common/taglibs.jsp"%> + <%-- param has higher level for request attribute --%> + + + + + + + + + + + + <fmt:message key="label.learning.title" /> + <%@ include file="/common/header.jsp"%> + + + + + + + +
    +

    + ${scratchie.title} +

    + +

    + ${scratchie.instructions} +

    + + <%@ include file="/common/messages.jsp"%> + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + ${item.description} +
    + + + +
    +

    + ${sessionMap.reflectInstructions} +

    + + + +

    + + +

    +
    + +

    + +

    +
    +
    + + + + + + +
    +
    + + +
    + + + + + + + + + + + + +
    +
    + +
    + + + + + + +
    Index: lams_tool_scratchie/web/pages/learning/notebook.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/notebook.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/notebook.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,56 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + <fmt:message key="label.learning.title" /> + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + +
    +

    + ${sessionMap.title} +

    + + <%@ include file="/common/messages.jsp"%> + +

    + +

    + + + +
    + + + +
    +
    +
    + + + + + +
    Index: lams_tool_scratchie/web/pages/learning/runoffline.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/runoffline.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/runoffline.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,85 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + + <%@ include file="/common/header.jsp"%> + + + + + +
    +

    + ${sessionMap.title} +

    + +

    + +

    + + +
    +

    + ${sessionMap.reflectInstructions} +

    + + + +

    + + +

    +
    + +

    + +

    +
    +
    + + + + +
    +
    + +
    + + + + + + + + + + + + +
    +
    + + + + +
    Index: lams_tool_scratchie/web/pages/learning/start.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/start.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/start.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,12 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + Index: lams_tool_scratchie/web/pages/learning/success.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/learning/success.jsp (revision 0) +++ lams_tool_scratchie/web/pages/learning/success.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,17 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + <%@ include file="/common/header.jsp"%> + + + + + Index: lams_tool_scratchie/web/pages/monitoring/editactivity.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/editactivity.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/editactivity.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,43 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + +

    + +

    +
    + + + + + + + + + + + + + + + +
    + + : + + +
    + + : + + +
    + + + + + + + +
    Index: lams_tool_scratchie/web/pages/monitoring/instructions.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/instructions.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/instructions.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,96 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    + +
    +
    + +
    + + + + + +   + + + + + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    + + + + + +   + + + + + +
    Index: lams_tool_scratchie/web/pages/monitoring/monitoring.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/monitoring.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/monitoring.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,68 @@ + + +<%@ include file="/common/taglibs.jsp"%> +<%@ page import="org.lamsfoundation.lams.tool.scratchie.ScratchieConstants"%> + + + + + + <%@ include file="/common/tabbedheader.jsp" %> + + + + + + + + + + + + + + + +
    +

    + +

    + +
    + + + + + + +
    + + +
    + +
    Index: lams_tool_scratchie/web/pages/monitoring/notebook.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/notebook.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/notebook.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,48 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + <fmt:message key="label.learning.title" /> + <%@ include file="/common/header.jsp"%> + + + +
    +

    + +

    + ${userDTO.fullName}

    + + + + + + + +
    + +
    + + + + + + + + +
    + + + + +
    + +
    +
    + + + +
    Index: lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/parts/advanceOptions.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,45 @@ + + +

    + + + + + +

    +
    + + \ No newline at end of file Index: lams_tool_scratchie/web/pages/monitoring/parts/itemSummary.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/parts/itemSummary.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/parts/itemSummary.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,133 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + <%@ include file="/common/header.jsp"%> + + + + + + + + + + + + + + +
    + +

    + + ${item.description} + +

    +

    + <%@ include file="/common/messages.jsp"%> + +

    + ${item.description} + + +
    + ' border='0'> + +
    +
    +

    + + ${item.description} +
    +
    + + +
    +
    + ${summary.sessionName} +
    + +
    +
    +
    + + + + + + + + +
    + + + + + + +
    Index: lams_tool_scratchie/web/pages/monitoring/parts/masterDetailLoadUp.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/parts/masterDetailLoadUp.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/parts/masterDetailLoadUp.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,21 @@ +<%@ include file="/common/taglibs.jsp"%> + + Index: lams_tool_scratchie/web/pages/monitoring/statistic.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/statistic.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/statistic.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,46 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + +
    + ${summary.sessionName} +
    + # + + + + +
    + ${status.index + 1} + + ${user.firstName} ${user.lastName} + + ${user.mark} +
    + Index: lams_tool_scratchie/web/pages/monitoring/summary.jsp =================================================================== diff -u --- lams_tool_scratchie/web/pages/monitoring/summary.jsp (revision 0) +++ lams_tool_scratchie/web/pages/monitoring/summary.jsp (revision 6aaee4b2fe2caa08b0c63a0de11f05042d5a3e18) @@ -0,0 +1,180 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + +<%@ include file="parts/advanceOptions.jsp"%> + + + +
    + +
    +
    + + +
    +

    +
    + +
    + +
    + +
    + <%@ include file="parts/masterDetailLoadUp.jsp"%> +
    + + +
    + +
    + ${summary.sessionName} +
    +
    + +
    +
    +
    +
    +
    + + + +
    + +
    +

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