Fisheye: Tag acc8d2acf5b6b0002e0c8129947040a779ab4077 refers to a dead (removed) revision in file `lams_central/web/pedagogical_planner/grouping.jsp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_common/db/sql/create_lams_11_tables.sql
===================================================================
diff -u -r4f33380083bd35fd6d0851de9def290c62ffc3c9 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 4f33380083bd35fd6d0851de9def290c62ffc3c9)
+++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -1006,8 +1006,8 @@
CREATE TABLE lams_events (
uid BIGINT NOT NULL UNIQUE auto_increment
- , scope VARCHAR(255) NOT NULL
- , name VARCHAR(255) NOT NULL
+ , scope VARCHAR(128) NOT NULL
+ , name VARCHAR(128) NOT NULL
, event_session_id BIGINT
, triggered TINYINT
, default_subject VARCHAR(255)
Index: lams_common/src/java/org/lamsfoundation/lams/commonContext.xml
===================================================================
diff -u -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077)
+++ lams_common/src/java/org/lamsfoundation/lams/commonContext.xml (.../commonContext.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -42,7 +42,7 @@
classpath:org/lamsfoundation/lams/learningdesign/Activity.hbm.xmlclasspath:org/lamsfoundation/lams/learningdesign/BranchActivityEntry.hbm.xmlclasspath:org/lamsfoundation/lams/learningdesign/BranchCondition.hbm.xml
- classpath:org/lamsfoundation/lams/learningdesign/Group.hbm.xml
+ classpath:org/lamsfoundation/lams/learningdesign/Group.hbm.xmlclasspath:org/lamsfoundation/lams/learningdesign/GroupUser.hbm.xmlclasspath:org/lamsfoundation/lams/learningdesign/Grouping.hbm.xmlclasspath:org/lamsfoundation/lams/learningdesign/LearningDesign.hbm.xml
Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql
===================================================================
diff -u -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql (.../patch0015_updateFrom22.sql) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82)
+++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch0015_updateFrom22.sql (.../patch0015_updateFrom22.sql) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -5,8 +5,10 @@
----------------------Put all sql statements below here-------------------------
+-- LI-192 This script needs to be in updaters - before new tools are deployed
+--ALTER TABLE lams_tool ADD COLUMN pedagogical_planner_url TEXT;
+
-- LDEV-1998 -------------
-ALTER TABLE lams_tool ADD COLUMN pedagogical_planner_url TEXT;
ALTER TABLE lams_system_tool ADD COLUMN pedagogical_planner_url TEXT;
UPDATE lams_system_tool SET pedagogical_planner_url='pedagogicalPlanner/initGrouping.do' WHERE system_tool_id=1;
CREATE TABLE lams_planner_nodes (
@@ -28,6 +30,7 @@
-- LDEV-2074 --------------
ALTER TABLE lams_learning_design ADD COLUMN floating_activity_id BIGINT(20);
CREATE INDEX idx_design_floating_act ON lams_learning_design (floating_activity_id ASC);
+INSERT INTO lams_learning_activity_type VALUES (15, 'FLOATING');
-- LDEV-1983 --------------
insert into lams_configuration (config_key, config_value, description_key, header_name, format, required)
@@ -76,7 +79,8 @@
)TYPE=InnoDB;
-- LDEV-2174 -------------
-ALTER TABLE lams_tool DROP COLUMN classpath_addition, context_file;
+ALTER TABLE lams_tool DROP COLUMN classpath_addition;
+ALTER TABLE lams_tool DROP COLUMN context_file;
-- LDEV-2205 ------------ Adding couse level settings for gradebook
ALTER TABLE lams_organisation ADD COLUMN enable_monitor_gradebook TINYINT(1) NOT NULL DEFAULT 0;
@@ -88,6 +92,7 @@
, activity_id BIGINT(20) NOT NULL
, user_id BIGINT (20) NOT NULL
, mark DOUBLE PRECISION
+ , marked_in_gradebook TINYINT(1) NOT NULL DEFAULT 0
, feedback TEXT
, INDEX (activity_id, user_id)
, CONSTRAINT FK_lams_gradebook_user_activity_1 FOREIGN KEY (activity_id)
@@ -114,6 +119,16 @@
-- LDEV-2207 ------------ Adding flag in lesson to release marks for gradebook
ALTER TABLE lams_lesson ADD COLUMN marks_released TINYINT DEFAULT 0;
+-- LDEV-2165
+ALTER TABLE lams_events modify COLUMN name VARCHAR(128) NOT NULL;
+ALTER TABLE lams_events modify COLUMN scope VARCHAR(128) NOT NULL;
+
+-- LDEV-2125 -------------
+ALTER TABLE lams_user ADD COLUMN timezone TINYINT;
+
+-- LDEV-2054
+ALTER TABLE lams_grouping ADD COLUMN view_students_before_selection TINYINT DEFAULT 0;
+
-- LDEV-2197 ------------ Presence Chat Logging
CREATE TABLE lams_presence_chat_msgs (
uid bigint NOT NULL auto_increment,
@@ -132,6 +147,9 @@
insert into lams_configuration (config_key, config_value, description_key, header_name, format, required)
values ('Red5RecordingsUrl','', 'config.red5.recordings.url', 'config.header.red5', 'STRING', 0);
+-- disable videorecorder
+update lams_learning_library set valid_flag=0 where title="VideoRecorder";
+
----------------------Put all sql statements above here-------------------------
-- If there were no errors, commit and restore autocommit to on
Index: lams_common/src/java/org/lamsfoundation/lams/events/Event.java
===================================================================
diff -u -rdab2e119700d02ac373e69b7c3afeeadf1f21d56 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/events/Event.java (.../Event.java) (revision dab2e119700d02ac373e69b7c3afeeadf1f21d56)
+++ lams_common/src/java/org/lamsfoundation/lams/events/Event.java (.../Event.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -196,15 +196,15 @@
}
/**
- * @hibernate.property column="name"
+ * @hibernate.property column="name" length="128"
* @return
*/
protected String getName() {
return name;
}
/**
- * @hibernate.property column="scope"
+ * @hibernate.property column="scope" length="128"
* @return
*/
protected String getScope() {
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java
===================================================================
diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java (.../TextSearchCondition.java) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/TextSearchCondition.java (.../TextSearchCondition.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -79,15 +79,6 @@
*/
protected static final int PATTERN_MATCHING_OPTIONS = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
| Pattern.MULTILINE;
- /**
- * A regular expression pattern that matches HTML tags.
- */
- public static final String HTML_TAG_REGEX = "\\<.*?>";
- /**
- * A regular expression pattern that matches end-of-line HTML tags. If needed, it can extented to
- * (?: | | | ) . Right now FCKeditor creates only the first option.
- */
- public static final String BR_TAG_REGEX = " ";
private static Logger log = Logger.getLogger(TextSearchCondition.class);
/**
Index: lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java
===================================================================
diff -u -r72e01661ffe932634adbe4b229d9ee44d6928a45 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision 72e01661ffe932634adbe4b229d9ee44d6928a45)
+++ lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -200,6 +200,7 @@
this.learnerProgresses = learnerProgresses;
this.liveEditEnabled = liveEditEnabled;
this.gradebookUserLessons = new HashSet();
+ this.marksReleased = false;
}
/**
* Factory method that create a new lesson. It initialized all necessary
Index: lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LearnerProgressDAO.java
===================================================================
diff -u -r96b3b3ff3f62e1bca1d299f75f512995388e420b -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LearnerProgressDAO.java (.../LearnerProgressDAO.java) (revision 96b3b3ff3f62e1bca1d299f75f512995388e420b)
+++ lams_common/src/java/org/lamsfoundation/lams/lesson/dao/hibernate/LearnerProgressDAO.java (.../LearnerProgressDAO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -55,11 +55,13 @@
"from LearnerProgress p where p.lessonComplete > 0 and p.lesson.id = :lessonId";
private final static String COUNT_ATTEMPTED_ACTIVITY ="select count(*) from LearnerProgress prog, "
- +" Activity act where act.id = :activityId and "
- +" act in elements(prog.attemptedActivities)";
+ +" Activity act join prog.attemptedActivities attAct "
+ +" where act.id = :activityId and "
+ +" index(attAct) = act";
private final static String COUNT_COMPLETED_ACTIVITY ="select count(*) from LearnerProgress prog, "
- +" Activity act where act.id = :activityId and "
- +" act in elements(prog.completedActivities)";
+ +" Activity act join prog.completedActivities compAct "
+ +" where act.id = :activityId and "
+ +" index(compAct) = act";
private final static String COUNT_PROGRESS_BY_LESSON =
"select count(*) from LearnerProgress p where p.lesson.id = :lessonId";
Index: lams_common/src/java/org/lamsfoundation/lams/notebook/model/NotebookEntry.java
===================================================================
diff -u -r38a6c414e30497d03559a85b5c33155e4a2fc22e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/notebook/model/NotebookEntry.java (.../NotebookEntry.java) (revision 38a6c414e30497d03559a85b5c33155e4a2fc22e)
+++ lams_common/src/java/org/lamsfoundation/lams/notebook/model/NotebookEntry.java (.../NotebookEntry.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -54,6 +54,8 @@
private Date lastModified;
+ private String lessonName;
+
public NotebookEntry() {}
public NotebookEntry(Long externalID, Integer externalIDType, String externalSignature, User user, String title, String entry, Date createDate) {
@@ -167,4 +169,12 @@
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
+
+ public void setLessonName(String name) {
+ this.lessonName = name;
+ }
+
+ public String getLessonName() {
+ return this.lessonName;
+ }
}
Index: lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java
===================================================================
diff -u -r38a6c414e30497d03559a85b5c33155e4a2fc22e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision 38a6c414e30497d03559a85b5c33155e4a2fc22e)
+++ lams_common/src/java/org/lamsfoundation/lams/notebook/service/CoreNotebookService.java (.../CoreNotebookService.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -27,21 +27,28 @@
import java.util.Date;
import java.util.List;
+import java.util.ArrayList;
+import java.util.TreeMap;
import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.dao.IBaseDAO;
+import org.lamsfoundation.lams.lesson.Lesson;
import org.lamsfoundation.lams.notebook.dao.INotebookEntryDAO;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
import org.lamsfoundation.lams.usermanagement.service.IUserManagementService;
import org.lamsfoundation.lams.util.MessageService;
import org.lamsfoundation.lams.usermanagement.User;
+import org.lamsfoundation.lams.usermanagement.Role;
public class CoreNotebookService implements ICoreNotebookService, IExtendedCoreNotebookService{
private static Logger log = Logger.getLogger(CoreNotebookService.class);
private INotebookEntryDAO notebookEntryDAO;
+
+ private IBaseDAO baseDAO;
protected IUserManagementService userManagementService;
@@ -55,6 +62,29 @@
saveOrUpdateNotebookEntry(notebookEntry);
return notebookEntry.getUid();
}
+
+ public TreeMap> getEntryByLesson(Integer userID, Integer idType) {
+ TreeMap> entryMap = new TreeMap>();
+ List list = getEntry(userID, idType);
+
+ for (NotebookEntry entry : list) {
+ if(entryMap.containsKey(entry.getExternalID())) {
+ String lessonName = (String) entryMap.get(entry.getExternalID()).get(0).getLessonName();
+ entry.setLessonName(lessonName);
+ entryMap.get(entry.getExternalID()).add(entry);
+ } else {
+ Lesson lesson = (Lesson) baseDAO.find(Lesson.class, entry.getExternalID());
+ List newEntryList = new ArrayList();
+
+ entry.setLessonName(lesson.getLessonName());
+ newEntryList.add(entry);
+
+ entryMap.put(entry.getExternalID(), newEntryList);
+ }
+ }
+
+ return entryMap;
+ }
public List getEntry(Long id, Integer idType, String signature, Integer userID) {
return notebookEntryDAO.get(id, idType, signature, userID);
@@ -111,6 +141,10 @@
this.notebookEntryDAO = notebookEntryDAO;
}
+ public void setBaseDAO(IBaseDAO baseDAO) {
+ this.baseDAO = baseDAO;
+ }
+
/**
*
* @param IUserManagementService The userManagementService to set.
Index: lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java
===================================================================
diff -u -r38a6c414e30497d03559a85b5c33155e4a2fc22e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java (.../ICoreNotebookService.java) (revision 38a6c414e30497d03559a85b5c33155e4a2fc22e)
+++ lams_common/src/java/org/lamsfoundation/lams/notebook/service/ICoreNotebookService.java (.../ICoreNotebookService.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -26,6 +26,7 @@
package org.lamsfoundation.lams.notebook.service;
import java.util.List;
+import java.util.TreeMap;
import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
@@ -37,6 +38,8 @@
Long createNotebookEntry(Long id, Integer idType, String signature,
Integer userID, String title, String entry);
+ TreeMap> getEntryByLesson(Integer userID, Integer idType);
+
List getEntry(Long id, Integer idType, String signature, Integer userID);
List getEntry(Long id, Integer idType, String signature);
Index: lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java
===================================================================
diff -u -r877c6ce4786426422d4e9fad0eac1bf237db2bcf -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java (.../OutputFactory.java) (revision 877c6ce4786426422d4e9fad0eac1bf237db2bcf)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/OutputFactory.java (.../OutputFactory.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -39,268 +39,367 @@
import org.lamsfoundation.lams.learningdesign.BranchCondition;
/**
- * This class forms the basic implementation of an output definition and output value factory, which is the class in a tool that
- * creates the output definition and output values for a tool. Each tool that has outputs should create its own factory class that
- * extends this class and uses the methods implemented in this class to create the actual ToolOutputDefinition and ToolOutput objects.
+ * This class forms the basic implementation of an output definition and output
+ * value factory, which is the class in a tool that creates the output
+ * definition and output values for a tool. Each tool that has outputs should
+ * create its own factory class that extends this class and uses the methods
+ * implemented in this class to create the actual ToolOutputDefinition and
+ * ToolOutput objects.
*
- * The implemented factory (in the tool) needs to supply either (a) its own messageService bean (a Spring bean normally
- * defined in the tool's applicationContext file in the toolMessageService property or (b) the name of its I18N language package/filename AND
- * the the loadedMessageSourceService (which is defined as a Spring bean in the core context). One of the two options (but not
- * both) is required so that the getDescription() method can get the internationalised description of the output definition
- * from the tool's internationalisation files. If neither the messageService or the I18N name is not supplied then the name
- * if the output definition will appear in the description field.
+ * The implemented factory (in the tool) needs to supply either (a) its own
+ * messageService bean (a Spring bean normally defined in the tool's
+ * applicationContext file in the toolMessageService property or (b) the name of
+ * its I18N language package/filename AND the the loadedMessageSourceService
+ * (which is defined as a Spring bean in the core context). One of the two
+ * options (but not both) is required so that the getDescription() method can
+ * get the internationalised description of the output definition from the
+ * tool's internationalisation files. If neither the messageService or the I18N
+ * name is not supplied then the name if the output definition will appear in
+ * the description field.
*
- * The implemented factory should implement public SortedMap getToolOutputDefinitions(Object toolContentObject)
- * and this method should call the buildBlahDefinition() calls to build the definitions.
+ * The implemented factory should implement public SortedMap getToolOutputDefinitions(Object toolContentObject) and
+ * this method should call the buildBlahDefinition() calls to build the
+ * definitions.
*
- * It should also implement two methods similar to SortedMap getToolOutput(List names, various tool objects) and
- * ToolOutput getToolOutput(String name, various tool objects) to get the actual outputs. The "various tool objects" will vary from tool to
- * tool - some tools may wish to pass in the raw session and user ids, others may pass in specific tool objects. As these inputs will vary
- * greatly from tool to tool, no abstract method has been included in this parent class. Putting these calls in the factory allows
- * all the "work" of the output generation to be grouped together and it also allows the getToolOutput() logic to get to getDescription()
- * logic in the factory.
+ * It should also implement two methods similar to SortedMap getToolOutput(List names, various tool objects) and
+ * ToolOutput getToolOutput(String name, various tool objects) to get the actual
+ * outputs. The "various tool objects" will vary from tool to tool - some tools
+ * may wish to pass in the raw session and user ids, others may pass in specific
+ * tool objects. As these inputs will vary greatly from tool to tool, no
+ * abstract method has been included in this parent class. Putting these calls
+ * in the factory allows all the "work" of the output generation to be grouped
+ * together and it also allows the getToolOutput() logic to get to
+ * getDescription() logic in the factory.
*
- * Example definitions for tool factories:
- *
- *
- * org.lamsfoundation.lams.tool.mc.ApplicationResources
- *
- *
- *
- *
- *
- *
+ * Example definitions for tool factories:
+ * org.lamsfoundation.lams.tool.mc.ApplicationResources
+ *
+ *
+ *
+ *
+ *
+ *
*/
public abstract class OutputFactory {
- protected Logger log = Logger.getLogger(OutputFactory.class);
+ protected Logger log = Logger.getLogger(OutputFactory.class);
- private MessageService toolMessageService;
- private ILoadedMessageSourceService loadedMessageSourceService;
- private String languageFilename;
- private MessageSource msgSource = null; // derived from toolMessageService, loadedMessageSourceService, languageFilename
- protected final String KEY_PREFIX = "output.desc.";
- protected final String CONDITION_NAME_SEPARATOR = "#";
-
- /** Create a map of the tool output definitions, suitable for returning from the method
- * getToolOutputDefinitions() in the ToolContentManager interface. The class for the toolContentObject
- * will be unique to each tool e.g. for Multiple Choice tool it will be the McContent object.
- *
- * If the toolContentObject should not be null - if the toolContentId supplied in the call to
- * getToolOutputDefinitions(Long toolContentId) does not match to any existing content, the content
- * should be the tool's default tool content.
- *
- * @param toolContentObject
- * @return SortedMap of ToolOutputDefinitions where the key is the name from each definition
- * @throws ToolException
- */
- public abstract SortedMap getToolOutputDefinitions(Object toolContentObject) throws ToolException;
+ private MessageService toolMessageService;
+ private ILoadedMessageSourceService loadedMessageSourceService;
+ private String languageFilename;
+ private MessageSource msgSource = null; // derived from toolMessageService, loadedMessageSourceService, languageFilename
+ protected final String KEY_PREFIX = "output.desc.";
+ protected final String CONDITION_NAME_SEPARATOR = "#";
- /** Tool specific toolMessageService, such as the forumMessageService in the Forum tool */
- private MessageService getToolMessageService() {
- return toolMessageService;
- }
+ /**
+ * Create a map of the tool output definitions, suitable for returning from
+ * the method getToolOutputDefinitions() in the ToolContentManager
+ * interface. The class for the toolContentObject will be unique to each
+ * tool e.g. for Multiple Choice tool it will be the McContent object.
+ *
+ * If the toolContentObject should not be null - if the toolContentId
+ * supplied in the call to getToolOutputDefinitions(Long toolContentId) does
+ * not match to any existing content, the content should be the tool's
+ * default tool content.
+ *
+ * @param toolContentObject
+ * @return SortedMap of ToolOutputDefinitions where the key is the name from
+ * each definition
+ * @throws ToolException
+ */
+ public abstract SortedMap getToolOutputDefinitions(Object toolContentObject)
+ throws ToolException;
- public void setToolMessageService(MessageService toolMessageService) {
- this.toolMessageService = toolMessageService;
- }
+ /**
+ * Tool specific toolMessageService, such as the forumMessageService in the
+ * Forum tool
+ */
+ private MessageService getToolMessageService() {
+ return toolMessageService;
+ }
+ public void setToolMessageService(MessageService toolMessageService) {
+ this.toolMessageService = toolMessageService;
+ }
- /** Set the common loadedMessageSourceService, based on the bean defined in the common Spring context.
- * If toolMessageService is not set, then the languageFilename
- * and loadedMessageSourceService should be set. */
- private ILoadedMessageSourceService getLoadedMessageSourceService() {
- return loadedMessageSourceService;
- }
+ /**
+ * Set the common loadedMessageSourceService, based on the bean defined in
+ * the common Spring context. If toolMessageService is not set, then the
+ * languageFilename and loadedMessageSourceService should be set.
+ */
+ private ILoadedMessageSourceService getLoadedMessageSourceService() {
+ return loadedMessageSourceService;
+ }
- public void setLoadedMessageSourceService(
- ILoadedMessageSourceService loadedMessageSourceService) {
- this.loadedMessageSourceService = loadedMessageSourceService;
- }
+ public void setLoadedMessageSourceService(ILoadedMessageSourceService loadedMessageSourceService) {
+ this.loadedMessageSourceService = loadedMessageSourceService;
+ }
- /** Set the filename/path for the tool's I18N files. If toolMessageService is not set, then the languageFilename
- * and loadedMessageSourceService should be set. */
- public String getLanguageFilename() {
- return languageFilename;
- }
+ /**
+ * Set the filename/path for the tool's I18N files. If toolMessageService is
+ * not set, then the languageFilename and loadedMessageSourceService should
+ * be set.
+ */
+ public String getLanguageFilename() {
+ return languageFilename;
+ }
- /** Get the filename and path for the tool's I18N files. */
- public void setLanguageFilename(String languageFilename) {
- this.languageFilename = languageFilename;
- }
+ /** Get the filename and path for the tool's I18N files. */
+ public void setLanguageFilename(String languageFilename) {
+ this.languageFilename = languageFilename;
+ }
- /**
- * Get the I18N description for this key. If the tool has supplied a messageService, then this
- * is used to look up the key and hence get the text. Otherwise if the tool has supplied a I18N
- * languageFilename then it is accessed via the shared toolActMessageService. If neither are supplied or
- * the key is not found, then any "." in the name are converted to space and this is used as the return value.
- *
- * This is normally used to get the description for a definition, in whic case the key should be in the format
- * output.desc.[definition name], key = definition name and addPrefix = true. For example a
- * definition name of "learner.mark" becomes output.desc.learner.mark.
- *
- * If you want to use this to get an arbitrary string from the I18N files, then set addPrefix = false and the
- * output.desc will not be added to the beginning.
- */
- protected String getI18NText(String key, boolean addPrefix) {
- String translatedText = null;
+ /**
+ * Get the I18N description for this key. If the tool has supplied a
+ * messageService, then this is used to look up the key and hence get the
+ * text. Otherwise if the tool has supplied a I18N languageFilename then it
+ * is accessed via the shared toolActMessageService. If neither are supplied
+ * or the key is not found, then any "." in the name are converted to space
+ * and this is used as the return value.
+ *
+ * This is normally used to get the description for a definition, in whic
+ * case the key should be in the format output.desc.[definition name], key =
+ * definition name and addPrefix = true. For example a definition name of
+ * "learner.mark" becomes output.desc.learner.mark.
+ *
+ * If you want to use this to get an arbitrary string from the I18N files,
+ * then set addPrefix = false and the output.desc will not be added to the
+ * beginning.
+ */
+ protected String getI18NText(String key, boolean addPrefix) {
+ String translatedText = null;
- MessageSource tmpMsgSource = getMsgSource();
- if ( tmpMsgSource != null ) {
- if ( addPrefix ) key = KEY_PREFIX + key;
- Locale locale = LocaleContextHolder.getLocale();
- try {
- translatedText = tmpMsgSource.getMessage(key,null,locale);
- } catch ( NoSuchMessageException e ) {
- log.warn("Unable to internationalise the text for key "+key+" as no matching key found in the msgSource");
- }
- } else {
- log.warn("Unable to internationalise the text for key "+key+" as no matching key found in the msgSource. The tool's OutputDefinition factory needs to set either (a) messageSource or (b) loadedMessageSourceService and languageFilename.");
- }
-
- if ( translatedText == null || translatedText.length() == 0 ) {
- translatedText = key.replace('.', ' ');
- }
-
- return translatedText;
+ MessageSource tmpMsgSource = getMsgSource();
+ if (tmpMsgSource != null) {
+ if (addPrefix)
+ key = KEY_PREFIX + key;
+ Locale locale = LocaleContextHolder.getLocale();
+ try {
+ translatedText = tmpMsgSource.getMessage(key, null, locale);
+ } catch (NoSuchMessageException e) {
+ log.warn("Unable to internationalise the text for key " + key
+ + " as no matching key found in the msgSource");
+ }
+ } else {
+ log
+ .warn("Unable to internationalise the text for key "
+ + key
+ + " as no matching key found in the msgSource. The tool's OutputDefinition factory needs to set either (a) messageSource or (b) loadedMessageSourceService and languageFilename.");
}
- /**
- * Get the MsgSource, combining getToolMessageService() and getLoadedMessageSourceService(). Caches the result so it only needs to be calculated once (most tools will require
- * more than one call to this code!
- */
- private MessageSource getMsgSource() {
- if ( msgSource == null ) {
- if ( getToolMessageService() != null ) {
- msgSource = getToolMessageService().getMessageSource();
- }
- if ( msgSource == null && getLoadedMessageSourceService() != null && getLanguageFilename() != null) {
- msgSource = getLoadedMessageSourceService().getMessageService(getLanguageFilename());
- }
- }
- return msgSource;
+ if (translatedText == null || translatedText.length() == 0) {
+ translatedText = key.replace('.', ' ');
}
- /** Generic method for building a tool output definition. It will get the definition's description
- * from the I18N file using the getDescription() method.
- * Only use if the other buildBlahDefinitions do not suit your needs. */
- protected ToolOutputDefinition buildDefinition(String definitionName, OutputType type, Object startValue, Object endValue, Object complexValue, Boolean showConditionNameOnly) {
- ToolOutputDefinition definition = new ToolOutputDefinition();
- definition.setName(definitionName);
- definition.setDescription(getI18NText(definitionName, true));
- definition.setType(type);
- definition.setStartValue( startValue );
- definition.setEndValue( endValue );
- definition.setComplexDefinition( complexValue );
- definition.setShowConditionNameOnly( showConditionNameOnly );
- return definition;
- }
+ return translatedText;
+ }
- /** Build a tool definition designed for a range of integer values.
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_LONG. */
- protected ToolOutputDefinition buildRangeDefinition(String definitionName, Long startValue, Long endValue) {
- return buildDefinition(definitionName, OutputType.OUTPUT_LONG, startValue, endValue, null, Boolean.FALSE);
+ /**
+ * Get the MsgSource, combining getToolMessageService() and
+ * getLoadedMessageSourceService(). Caches the result so it only needs to be
+ * calculated once (most tools will require more than one call to this code!
+ */
+ private MessageSource getMsgSource() {
+ if (msgSource == null) {
+ if (getToolMessageService() != null) {
+ msgSource = getToolMessageService().getMessageSource();
+ }
+ if (msgSource == null && getLoadedMessageSourceService() != null && getLanguageFilename() != null) {
+ msgSource = getLoadedMessageSourceService().getMessageService(getLanguageFilename());
+ }
}
-
- /** Build a tool definition designed for a range of string values.
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_LONG. */
- protected ToolOutputDefinition buildRangeDefinition(String definitionName, String startValue, String endValue) {
- return buildDefinition(definitionName, OutputType.OUTPUT_STRING, startValue, endValue, null, Boolean.FALSE);
- }
+ return msgSource;
+ }
- /** Build a tool definition designed for a single double value, which is likely to be a statistic number of
- * questions answered
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_LONG. */
- protected ToolOutputDefinition buildLongOutputDefinition(String definitionName) {
- return buildDefinition(definitionName, OutputType.OUTPUT_LONG, null, null, null, Boolean.FALSE);
- }
+ /**
+ * Generic method for building a tool output definition. It will get the
+ * definition's description from the I18N file using the getDescription()
+ * method. Only use if the other buildBlahDefinitions do not suit your
+ * needs.
+ */
+ protected ToolOutputDefinition buildDefinition(String definitionName, OutputType type, Object startValue,
+ Object endValue, Object complexValue, Boolean showConditionNameOnly) {
+ ToolOutputDefinition definition = new ToolOutputDefinition();
+ definition.setName(definitionName);
+ definition.setDescription(getI18NText(definitionName, true));
+ definition.setType(type);
+ definition.setStartValue(startValue);
+ definition.setEndValue(endValue);
+ definition.setComplexDefinition(complexValue);
+ definition.setShowConditionNameOnly(showConditionNameOnly);
+ return definition;
+ }
- /** Build a tool definition designed for a single double value, which is likely to be a statistic such as average
- * number of posts.
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_DOUBLE. */
- protected ToolOutputDefinition buildDoubleOutputDefinition(String definitionName) {
- return buildDefinition(definitionName, OutputType.OUTPUT_DOUBLE, null, null, null, Boolean.FALSE);
- }
+ /**
+ * Wrapper method for build definition to set the isDefaultGradebookMark
+ * flag
+ */
+ protected ToolOutputDefinition buildDefinition(String definitionName, OutputType type, Object startValue,
+ Object endValue, Object complexValue, Boolean showConditionNameOnly, Boolean isDefaultGradebookMark) {
+ ToolOutputDefinition definition = this.buildDefinition(definitionName, type, startValue, endValue,
+ complexValue, showConditionNameOnly);
+ definition.setIsDefaultGradebookMark(isDefaultGradebookMark);
+ return definition;
+ }
- /** Build a tool definition designed for a single boolean value, which is likely to be a test such as
- * user has answered all questions correctly. It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_BOOLEAN. A Boolean tool definition should have default condition name for the
- * true and false conditions. The code will automatically look for two strings in the I18N file
- * output.desc..true and output.desc..false */
- protected ToolOutputDefinition buildBooleanOutputDefinition(String definitionName) {
- ToolOutputDefinition definition = buildDefinition(definitionName, OutputType.OUTPUT_BOOLEAN, null, null, null, Boolean.FALSE);
+ /**
+ * Build a tool definition designed for a range of integer values. It will
+ * get the definition's description from the I18N file using the
+ * getDescription() method and set the type to OUTPUT_LONG.
+ */
+ protected ToolOutputDefinition buildRangeDefinition(String definitionName, Long startValue, Long endValue) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_LONG, startValue, endValue, null, Boolean.FALSE);
+ }
- List defaultConditions = new ArrayList();
- defaultConditions.add(new BranchCondition(null, null, new Integer(1), definitionName,
- getI18NText(definitionName+".true", true),
- OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.TRUE.toString()));
+ /**
+ * Build a tool definition designed for a range of string values. It will
+ * get the definition's description from the I18N file using the
+ * getDescription() method and set the type to OUTPUT_LONG.
+ */
+ protected ToolOutputDefinition buildRangeDefinition(String definitionName, String startValue, String endValue) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_STRING, startValue, endValue, null, Boolean.FALSE);
+ }
- defaultConditions.add(new BranchCondition(null, null, new Integer(2), definitionName,
- getI18NText(definitionName+".false", true),
- OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.FALSE.toString()));
+ /**
+ * Wrapper for buildRangeDefinition so you can set isDefaultGradebookMark
+ */
+ protected ToolOutputDefinition buildRangeDefinition(String definitionName, Long startValue, Long endValue,
+ Boolean isDefaultGradebookMark) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_LONG, startValue, endValue, null, Boolean.FALSE,
+ isDefaultGradebookMark);
+ }
- definition.setDefaultConditions(defaultConditions);
-
- return definition;
- }
-
- /** Build a tool definition designed for a set of boolean conditions. It will get the definition's description from the
- * I18N file using the getDescription() method and set the type to OUTPUT_SET_BOOLEAN. The tool's factory should then
- * set up a series of conditions, each of type OUTPUT_BOOLEAN. Sets showConditionNameOnly to true so that the user
- * in authoring doesn't see the internal definitions, just the condition name.
- */
- protected ToolOutputDefinition buildBooleanSetOutputDefinition(String definitionName) {
- ToolOutputDefinition definition = buildDefinition(definitionName, OutputType.OUTPUT_SET_BOOLEAN, null, null, null, Boolean.TRUE);
- List defaultConditions = new ArrayList();
- definition.setDefaultConditions(defaultConditions);
- return definition;
- }
-
+ /**
+ * Wrapper for buildRangeDefinition so you can set isDefaultGradebookMark
+ */
+ protected ToolOutputDefinition buildRangeDefinition(String definitionName, String startValue, String endValue,
+ Boolean isDefaultGradebookMark) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_STRING, startValue, endValue, null, Boolean.FALSE,
+ isDefaultGradebookMark);
+ }
- /** Build a tool definition designed for a single String value.
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_STRING. */
- protected ToolOutputDefinition buildStringOutputDefinition(String definitionName) {
- return buildDefinition(definitionName, OutputType.OUTPUT_STRING, null, null, null, Boolean.FALSE);
- }
+ /**
+ * Build a tool definition designed for a single double value, which is
+ * likely to be a statistic number of questions answered It will get the
+ * definition's description from the I18N file using the getDescription()
+ * method and set the type to OUTPUT_LONG.
+ */
+ protected ToolOutputDefinition buildLongOutputDefinition(String definitionName) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_LONG, null, null, null, Boolean.FALSE);
+ }
- /** Build a tool definition for a complex value output.
- * It will get the definition's description from the I18N file using the getDescription() method and
- * set the type to OUTPUT_COMPLEX. */
- protected ToolOutputDefinition buildComplexOutputDefinition(String definitionName) {
- return buildDefinition(definitionName, OutputType.OUTPUT_COMPLEX, null, null, null, Boolean.FALSE);
- }
+ /**
+ * Build a tool definition designed for a single double value, which is
+ * likely to be a statistic such as average number of posts. It will get the
+ * definition's description from the I18N file using the getDescription()
+ * method and set the type to OUTPUT_DOUBLE.
+ */
+ protected ToolOutputDefinition buildDoubleOutputDefinition(String definitionName) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_DOUBLE, null, null, null, Boolean.FALSE);
+ }
- /**
- * Build a condition name based on a definition name. For user customised conditions, the
- * conditions name MUST start with the definition name for Flash to be able to match conditions to definition
- * in the authoring interface, but then each condition name needs to be unique, hence "uniquePart".
- * @param definitionName: Must not be null
- * @param uniquePart: May be null if the condition names are to be the same as the definition name.
- * @return combined string
- */
- protected String buildConditionName(String definitionName, String uniquePart) {
- return uniquePart != null && uniquePart.length() > 0 ? definitionName + CONDITION_NAME_SEPARATOR + uniquePart : definitionName;
- }
+ /**
+ * Build a tool definition designed for a single boolean value, which is
+ * likely to be a test such as user has answered all questions correctly. It
+ * will get the definition's description from the I18N file using the
+ * getDescription() method and set the type to OUTPUT_BOOLEAN. A Boolean
+ * tool definition should have default condition name for the true and false
+ * conditions. The code will automatically look for two strings in the I18N
+ * file output.desc..true and output.desc..false
+ */
+ protected ToolOutputDefinition buildBooleanOutputDefinition(String definitionName) {
+ ToolOutputDefinition definition = buildDefinition(definitionName, OutputType.OUTPUT_BOOLEAN, null, null, null,
+ Boolean.FALSE);
- /**
- * Given a condition name built with buildConditionName, split is back into its definition name and unique part.
- * @param conditionName: Must not be null
- * @return String[definition name, unique part]
- */
- protected String[] splitConditionName(String conditionName) {
- int index = conditionName.indexOf(CONDITION_NAME_SEPARATOR);
- if ( index > -1 ) {
- if ( index+1 defaultConditions = new ArrayList();
+ defaultConditions.add(new BranchCondition(null, null, new Integer(1), definitionName, getI18NText(
+ definitionName + ".true", true), OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.TRUE
+ .toString()));
+
+ defaultConditions.add(new BranchCondition(null, null, new Integer(2), definitionName, getI18NText(
+ definitionName + ".false", true), OutputType.OUTPUT_BOOLEAN.toString(), null, null, Boolean.FALSE
+ .toString()));
+
+ definition.setDefaultConditions(defaultConditions);
+
+ return definition;
+ }
+
+ /**
+ * Build a tool definition designed for a set of boolean conditions. It will
+ * get the definition's description from the I18N file using the
+ * getDescription() method and set the type to OUTPUT_SET_BOOLEAN. The
+ * tool's factory should then set up a series of conditions, each of type
+ * OUTPUT_BOOLEAN. Sets showConditionNameOnly to true so that the user in
+ * authoring doesn't see the internal definitions, just the condition name.
+ */
+ protected ToolOutputDefinition buildBooleanSetOutputDefinition(String definitionName) {
+ ToolOutputDefinition definition = buildDefinition(definitionName, OutputType.OUTPUT_SET_BOOLEAN, null, null,
+ null, Boolean.TRUE);
+ List defaultConditions = new ArrayList();
+ definition.setDefaultConditions(defaultConditions);
+ return definition;
+ }
+
+ /**
+ * Build a tool definition designed for a single String value. It will get
+ * the definition's description from the I18N file using the
+ * getDescription() method and set the type to OUTPUT_STRING.
+ */
+ protected ToolOutputDefinition buildStringOutputDefinition(String definitionName) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_STRING, null, null, null, Boolean.FALSE);
+ }
+
+ /**
+ * Build a tool definition for a complex value output. It will get the
+ * definition's description from the I18N file using the getDescription()
+ * method and set the type to OUTPUT_COMPLEX.
+ */
+ protected ToolOutputDefinition buildComplexOutputDefinition(String definitionName) {
+ return buildDefinition(definitionName, OutputType.OUTPUT_COMPLEX, null, null, null, Boolean.FALSE);
+ }
+
+ /**
+ * Build a condition name based on a definition name. For user customised
+ * conditions, the conditions name MUST start with the definition name for
+ * Flash to be able to match conditions to definition in the authoring
+ * interface, but then each condition name needs to be unique, hence
+ * "uniquePart".
+ *
+ * @param definitionName:
+ * Must not be null
+ * @param uniquePart:
+ * May be null if the condition names are to be the same as
+ * the definition name.
+ * @return combined string
+ */
+ protected String buildConditionName(String definitionName, String uniquePart) {
+ return uniquePart != null && uniquePart.length() > 0 ? definitionName + CONDITION_NAME_SEPARATOR + uniquePart
+ : definitionName;
+ }
+
+ /**
+ * Given a condition name built with buildConditionName, split is back into
+ * its definition name and unique part.
+ *
+ * @param conditionName:
+ * Must not be null
+ * @return String[definition name, unique part]
+ */
+ protected String[] splitConditionName(String conditionName) {
+ int index = conditionName.indexOf(CONDITION_NAME_SEPARATOR);
+ if (index > -1) {
+ if (index + 1 < conditionName.length())
+ return new String[] { conditionName.substring(0, index), conditionName.substring(index + 1) };
+ else
+ return new String[] { conditionName.substring(0, index), "" };
+ } else {
+ return new String[] { conditionName, "" };
}
+ }
}
Index: lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java
===================================================================
diff -u -r55787e184b4775a776ed958656ba17cda1a8c4c8 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java (.../ToolOutputDefinition.java) (revision 55787e184b4775a776ed958656ba17cda1a8c4c8)
+++ lams_common/src/java/org/lamsfoundation/lams/tool/ToolOutputDefinition.java (.../ToolOutputDefinition.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -32,148 +32,174 @@
import org.lamsfoundation.lams.learningdesign.BranchCondition;
/**
- * Each tool that has outputs will define a set of output definitions. Some definitions will be
- * "predefined" for a tool, e.g. "Learner's Mark". Others may be created for a specific tool activity,
- * via a Conditions/Output tab in monitoring, e.g. Second answer contains the word "Mercury".
+ * Each tool that has outputs will define a set of output definitions. Some
+ * definitions will be "predefined" for a tool, e.g. "Learner's Mark". Others
+ * may be created for a specific tool activity, via a Conditions/Output tab in
+ * monitoring, e.g. Second answer contains the word "Mercury".
*
- * If the tool contains generated definitions, then they must be copied when the tool content is copied,
- * as the conditions may be modified via Live Edit. This must not modify the original design.
+ * If the tool contains generated definitions, then they must be copied when the
+ * tool content is copied, as the conditions may be modified via Live Edit. This
+ * must not modify the original design.
*
- * For 2.1, we will not deal with complex outputs, so for now we will not define how a complex definition
- * is defined. The field is placed in the object so that we have the place for it when we do design the
- * complex output definitions.
+ * For 2.1, we will not deal with complex outputs, so for now we will not define
+ * how a complex definition is defined. The field is placed in the object so
+ * that we have the place for it when we do design the complex output
+ * definitions.
*
- * Sample ToolOutputDefinition:
- * ToolOutputDefinition {
- * name = "LEARNERS_MARK",
- * description = "Mark for an individual learner";
- * type = "NUMERIC";
- * startValue = "0.0";
- * endValue = "10.0";
- * complexDefinition = null;
- * }
+ * Sample ToolOutputDefinition: ToolOutputDefinition { name = "LEARNERS_MARK",
+ * description = "Mark for an individual learner"; type = "NUMERIC"; startValue =
+ * "0.0"; endValue = "10.0"; complexDefinition = null; }
*/
public class ToolOutputDefinition implements Comparable {
-
+
private String name;
private String description;
private OutputType type;
private Object startValue;
private Object endValue;
private Object complexDefinition;
private Boolean showConditionNameOnly;
+ private Boolean isDefaultGradebookMark;
private List defaultConditions;
-
- /** Name must be unique within the current tool content. This will be used to identify the output.
- * If the definition is a predefined definition then the name will always be the same (e.g. LEARNER_MARK) but
- * if it is defined in authoring then it will need to made unique for this tool content (e.g. ANSWER_2_CONTAINS_1).
- * At lesson time, the tool will be given back the name and will need to be able to uniquely identify the required
- * output based on name, the tool session id and possibly the learner's user id.
+
+ /**
+ * Name must be unique within the current tool content. This will be used to
+ * identify the output. If the definition is a predefined definition then
+ * the name will always be the same (e.g. LEARNER_MARK) but if it is defined
+ * in authoring then it will need to made unique for this tool content (e.g.
+ * ANSWER_2_CONTAINS_1). At lesson time, the tool will be given back the
+ * name and will need to be able to uniquely identify the required output
+ * based on name, the tool session id and possibly the learner's user id.
*/
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- /** Description: Description is an internationalised text string which is displayed to the
- * user as the output "name". It is the responsibility of the tool to internationalise the
- * string. We suggest that the key for each predefined definition follow the convention
- * OUTPUT_DESC_
)";
/**
*/
public static boolean isTokenValid(HttpServletRequest req, String tokenName) {
if (req.getSession() != null) {
String valueSession = (String) req.getSession().getAttribute(tokenName);
- String valueRequest = (String) req.getParameter(tokenName);
- log.debug("(Session Token) name : " + tokenName + " value : " + valueSession);
- log.debug("(Request Token) name : " + tokenName + " value : " + valueRequest);
- if ((valueSession != null) && (valueRequest != null)) {
+ String valueRequest = req.getParameter(tokenName);
+ WebUtil.log.debug("(Session Token) name : " + tokenName + " value : " + valueSession);
+ WebUtil.log.debug("(Request Token) name : " + tokenName + " value : " + valueRequest);
+ if (valueSession != null && valueRequest != null) {
if (valueSession.equals(valueRequest)) {
return true;
}
@@ -70,7 +77,7 @@
resetToken(req, tokenName);
}
req.getSession().setAttribute(tokenName, tokenValue);
- log.debug("(Save Session Token) name : " + tokenName + " value : " + tokenValue);
+ WebUtil.log.debug("(Save Session Token) name : " + tokenName + " value : " + tokenValue);
}
@@ -91,10 +98,10 @@
* if not set
*/
public static void checkObject(String paramName, Object paramValue) throws IllegalArgumentException {
- boolean isNull = (paramValue == null);
+ boolean isNull = paramValue == null;
if (!isNull && String.class.isInstance(paramValue)) {
String str = (String) paramValue;
- isNull = (str.trim().length() == 0);
+ isNull = str.trim().length() == 0;
}
if (isNull) {
throw new IllegalArgumentException(paramName + " is required '" + paramValue + "'");
@@ -109,8 +116,9 @@
public static Integer checkInteger(String paramName, String paramValue, boolean isOptional)
throws IllegalArgumentException {
try {
- if (!isOptional)
+ if (!isOptional) {
checkObject(paramName, paramValue);
+ }
String value = paramValue != null ? StringUtils.trimToNull(paramValue) : null;
return value != null ? new Integer(value) : null;
@@ -127,8 +135,9 @@
public static Long checkLong(String paramName, String paramValue, boolean isOptional)
throws IllegalArgumentException {
try {
- if (!isOptional)
+ if (!isOptional) {
checkObject(paramName, paramValue);
+ }
String value = paramValue != null ? StringUtils.trimToNull(paramValue) : null;
return value != null ? new Long(value) : null;
@@ -138,16 +147,17 @@
}
/**
- * Get a long version of paramValue, throwing an IllegalArgumentException if
- * isOptional = false and the is value is null
+ * Get a long version of paramValue, throwing an IllegalArgumentException if isOptional = false and the is value is
+ * null
*
* @return long value of paramValue
* @exception IllegalArgumentException -
* if not set or not long
*/
public static long checkLong(String paramName, Long paramValue, boolean isOptional) throws IllegalArgumentException {
- if (!isOptional)
+ if (!isOptional) {
checkObject(paramName, paramValue);
+ }
return paramValue.longValue();
}
@@ -174,8 +184,7 @@
}
/**
- * Read an int parameter, throwing exception if ( not optional and null ) or
- * not a integer
+ * Read an int parameter, throwing exception if ( not optional and null ) or not a integer
*
* @param req -
* @param paramName -
@@ -198,8 +207,7 @@
}
/**
- * Read an long parameter, throwing exception if ( not optional and null )
- * or not a long
+ * Read an long parameter, throwing exception if ( not optional and null ) or not a long
*
* @param req -
* @param paramName -
@@ -226,8 +234,9 @@
* @return parameter value
*/
public static String readStrParam(HttpServletRequest req, String paramName, boolean isOptional) {
- if (!isOptional)
+ if (!isOptional) {
checkObject(paramName, req.getParameter(paramName));
+ }
return req.getParameter(paramName);
}
@@ -246,8 +255,7 @@
* @param req -
* @param paramName -
* @param defaultValue -
- * if valid boolean parameter value is not found, return this
- * value
+ * if valid boolean parameter value is not found, return this value
* @return parameter value
*/
public static boolean readBooleanParam(HttpServletRequest req, String paramName, boolean defaultValue) {
@@ -263,35 +271,37 @@
}
/**
- * TODO default proper exception at lams level to replace RuntimeException
- * TODO isTesting should be removed when login is done properly.
+ * TODO default proper exception at lams level to replace RuntimeException TODO isTesting should be removed when
+ * login is done properly.
*
* @param req -
* @return username from principal object
*/
public static String getUsername(HttpServletRequest req, boolean isTesting) throws RuntimeException {
- if (isTesting)
+ if (isTesting) {
return "test";
+ }
Principal prin = req.getUserPrincipal();
- if (prin == null)
+ if (prin == null) {
throw new RuntimeException("Trying to get username but principal object missing. Request is "
+ req.toString());
+ }
String username = prin.getName();
- if (username == null)
+ if (username == null) {
throw new RuntimeException("Name missing from principal object. Request is " + req.toString()
+ " Principal object is " + prin.toString());
+ }
return username;
}
/**
- * Retrieve the tool access mode from http request. This is a utility used
- * by the tools that share an implementation for the learner screen. They
- * use mode=learner, mode=author and mode=teacher for learning, preview and
- * monitoring respectively. Only used if the tool programmer wants to have
- * one call that supports all three ways of looking at a learner screen.
+ * Retrieve the tool access mode from http request. This is a utility used by the tools that share an implementation
+ * for the learner screen. They use mode=learner, mode=author and mode=teacher for learning, preview and monitoring
+ * respectively. Only used if the tool programmer wants to have one call that supports all three ways of looking at
+ * a learner screen.
*
* @param request
* @param param_mode
@@ -301,44 +311,44 @@
String mode = readStrParam(request, param_mode, optional);
if (mode == null) {
return null;
- } else if (mode.equals(ToolAccessMode.AUTHOR.toString()))
+ } else if (mode.equals(ToolAccessMode.AUTHOR.toString())) {
return ToolAccessMode.AUTHOR;
- else if (mode.equals(ToolAccessMode.LEARNER.toString()))
+ } else if (mode.equals(ToolAccessMode.LEARNER.toString())) {
return ToolAccessMode.LEARNER;
- else if (mode.equals(ToolAccessMode.TEACHER.toString()))
+ } else if (mode.equals(ToolAccessMode.TEACHER.toString())) {
return ToolAccessMode.TEACHER;
- else
+ } else {
throw new IllegalArgumentException("[" + mode + "] is not a legal mode" + "in LAMS");
+ }
}
/**
- * Retrieve the tool access mode from a string value, presumably from a
- * Form. This is a utility used by the tools that share an implementation
- * for the learner screen. They use mode=learner, mode=author and
- * mode=teacher for learning, preview and monitoring respectively. Only used
- * if the tool programmer wants to have one call that supports all three
- * ways of looking at a learner screen.
+ * Retrieve the tool access mode from a string value, presumably from a Form. This is a utility used by the tools
+ * that share an implementation for the learner screen. They use mode=learner, mode=author and mode=teacher for
+ * learning, preview and monitoring respectively. Only used if the tool programmer wants to have one call that
+ * supports all three ways of looking at a learner screen.
*
* @param request
* @param param_mode
* @return the ToolAccessMode object
*/
public static ToolAccessMode getToolAccessMode(String modeValue) {
if (modeValue != null) {
- if (modeValue.equals(ToolAccessMode.AUTHOR.toString()))
+ if (modeValue.equals(ToolAccessMode.AUTHOR.toString())) {
return ToolAccessMode.AUTHOR;
- else if (modeValue.equals(ToolAccessMode.LEARNER.toString()))
+ } else if (modeValue.equals(ToolAccessMode.LEARNER.toString())) {
return ToolAccessMode.LEARNER;
- else if (modeValue.equals(ToolAccessMode.TEACHER.toString()))
+ } else if (modeValue.equals(ToolAccessMode.TEACHER.toString())) {
return ToolAccessMode.TEACHER;
+ }
}
throw new IllegalArgumentException("[" + modeValue + "] is not a legal mode" + "in LAMS");
}
/**
*
- * This helper method create the struts action forward name using the path.
- * It will chop all path related characters, such as "/" and ".do".
+ * This helper method create the struts action forward name using the path. It will chop all path related
+ * characters, such as "/" and ".do".
*
*
*
@@ -377,73 +387,71 @@
*
* This helper append the parameter deliminator for a url.
*
- * It is using a null safe String util method to checkup the url String and
- * append proper deliminator if necessary.
+ * It is using a null safe String util method to checkup the url String and append proper deliminator if necessary.
*
* @param url
* the url needs to append deliminator.
* @return target url with the deliminator;
*/
public static String appendParameterDeliminator(String url) {
- if (url == null)
+ if (url == null) {
return null;
- else if (StringUtils.containsNone(url, "?"))
+ } else if (StringUtils.containsNone(url, "?")) {
return url + "?";
- else
+ } else {
return url + "&";
+ }
}
/**
- * Converts a url (such as one from a tool) to a complete url. If the url
- * starts with "http" then it is assumed to be a complete url and is
- * returned as is. Otherwise it assumes starts with the path of the webapp
- * so it is appended to the server url from the LAMS Configuration.
+ * Converts a url (such as one from a tool) to a complete url. If the url starts with "http" then it is assumed to
+ * be a complete url and is returned as is. Otherwise it assumes starts with the path of the webapp so it is
+ * appended to the server url from the LAMS Configuration.
*
* @param url
* e.g. tool/lanb11/starter/learner.do
* @return complete url
*/
public static String convertToFullURL(String url) {
- if (url == null)
+ if (url == null) {
return null;
- else if (url.startsWith("http"))
+ } else if (url.startsWith("http")) {
return url;
- else {
+ } else {
String serverURL = Configuration.get(ConfigurationKeys.SERVER_URL);
- if (url.charAt(0) == '/')
+ if (url.charAt(0) == '/') {
return serverURL + url;
- else
+ } else {
return serverURL + '/' + url;
+ }
}
}
/**
- * Convert any newslines in a string to . If input = null, returns
- * null.
+ * Convert any newslines in a string to . If input = null, returns null.
*/
public static String convertNewlines(String input) {
- if (input != null)
+ if (input != null) {
return input.replaceAll("[\n\r\f]", " ");
- else
+ } else {
return null;
+ }
}
/**
- * Strips HTML tags and leave "pure" text. Useful for FCKeditor created
- * text.
+ * Strips HTML tags and leave "pure" text. Useful for FCKeditor created text.
*
* @param text
* string to process
* @return string after stripping
*/
public static String removeHTMLtags(String text) {
- return text == null ? null : text.replaceAll(TextSearchCondition.BR_TAG_REGEX, " ").replaceAll(
- TextSearchCondition.HTML_TAG_REGEX, "");
+ return text == null ? null : text.replaceAll(WebUtil.SPACE_TAG_REGEX, " ").replaceAll(WebUtil.HTML_TAG_REGEX,
+ "");
}
/**
- * Makes a request to the specified url with the specified parameters and
- * returns the response inputstream
+ * Makes a request to the specified url with the specified parameters and returns the response inputstream
*
* @param urlStr
* @param params
@@ -453,44 +461,43 @@
*/
public static InputStream getResponseInputStreamFromExternalServer(String urlStr, HashMap params)
throws Exception {
- if (!urlStr.contains("?"))
+ if (!urlStr.contains("?")) {
urlStr += "?";
+ }
for (Entry entry : params.entrySet()) {
urlStr += "&" + entry.getKey() + "=" + entry.getValue();
}
- log.debug("Making request to external servlet: " + urlStr);
+ WebUtil.log.debug("Making request to external servlet: " + urlStr);
URL url = new URL(urlStr);
URLConnection conn = url.openConnection();
if (!(conn instanceof HttpURLConnection)) {
- log.error("Fail to connect to external server though url: " + urlStr);
+ WebUtil.log.error("Fail to connect to external server though url: " + urlStr);
throw new Exception("Fail to connect to external server though url: " + urlStr);
}
HttpURLConnection httpConn = (HttpURLConnection) conn;
if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
- log.error("Response code from external server: " + httpConn.getResponseCode()
- + " Url: " + urlStr);
+ WebUtil.log.error("Response code from external server: " + httpConn.getResponseCode() + " Url: " + urlStr);
}
InputStream is = url.openConnection().getInputStream();
if (is == null) {
- log.error("Fail to fetch data from external server, return InputStream null: " + urlStr);
+ WebUtil.log.error("Fail to fetch data from external server, return InputStream null: " + urlStr);
throw new Exception("Fail to fetch data from external server, return inputStream null: " + urlStr);
}
return is;
}
-
+
/**
- * Uploads a file to the given url. Uses a multi-part http post to
- * post the file as well as the user, course, and hash server-authentication
- * strings.
+ * Uploads a file to the given url. Uses a multi-part http post to post the file as well as the user, course, and
+ * hash server-authentication strings.
*
- * Some of the java multipart posting libraries clashed with existing jboss
- * libraries So instead, the multipart post is put together manually
+ * Some of the java multipart posting libraries clashed with existing jboss libraries So instead, the multipart post
+ * is put together manually
*
* @param f
* @param urlString
@@ -512,20 +519,19 @@
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
- //------------------ CLIENT REQUEST
+ // ------------------ CLIENT REQUEST
FileInputStream fileInputStream = new FileInputStream(f);
- log.debug("Performing multipart post to: " + urlString);
-
- // open a URL connection to the Servlet
+ WebUtil.log.debug("Performing multipart post to: " + urlString);
+
+ // open a URL connection to the Servlet
URL url = new URL(urlString);
// Open a HTTP connection to the URL
conn = (HttpURLConnection) url.openConnection();
-
-
+
if (!(conn instanceof HttpURLConnection)) {
- log.error("Fail to connect to external server though url: " + urlString);
+ WebUtil.log.error("Fail to connect to external server though url: " + urlString);
throw new Exception("Fail to connect to external server though url: " + urlString);
}
@@ -554,10 +560,10 @@
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("Content-Length", new Long(f.length() + httpRequest.getBytes().length + 64).toString());
- log.debug(f.length());
- log.debug(httpRequest.getBytes().length);
- log.debug("" + f.length() + httpRequest.getBytes().length + 64);
- log.debug(httpRequest);
+ WebUtil.log.debug(f.length());
+ WebUtil.log.debug(httpRequest.getBytes().length);
+ WebUtil.log.debug("" + f.length() + httpRequest.getBytes().length + 64);
+ WebUtil.log.debug(httpRequest);
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
@@ -581,19 +587,18 @@
// send multipart form data necessary after file data...
dos.writeBytes(lineEnd);
dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
- // Write the file part into the post-------------------------------
+ // Write the file part into the post-------------------------------
// close streams
fileInputStream.close();
dos.flush();
dos.close();
-
+
InputStream ret = conn.getInputStream();
if (ret == null) {
- log.error("Fail to get response from extenal server, return InputStream null: " + urlString);
+ WebUtil.log.error("Fail to get response from extenal server, return InputStream null: " + urlString);
throw new Exception("Fail to fetch data from external server, return inputStream null: " + urlString);
}
-
return conn.getInputStream();
}
Index: lams_common/src/java/org/lamsfoundation/lams/web/action/LamsDispatchAction.java
===================================================================
diff -u -r240222cfb186fccf09aaac380409fb256d3d613d -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/web/action/LamsDispatchAction.java (.../LamsDispatchAction.java) (revision 240222cfb186fccf09aaac380409fb256d3d613d)
+++ lams_common/src/java/org/lamsfoundation/lams/web/action/LamsDispatchAction.java (.../LamsDispatchAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -34,52 +34,58 @@
import org.lamsfoundation.lams.web.util.TokenProcessor;
/**
- * @author daveg
- *
+ * @author daveg edited by lfoxton
+ *
*/
public abstract class LamsDispatchAction extends DispatchAction {
-
+
protected static String className = "Action";
-
+
+ public static final String ENCODING_UTF8 = "UTF8";
+ public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain";
+ public static final String CONTENT_TYPE_TEXT_HTML = "text/html";
+ public static final String CONTENT_TYPE_TEXT_XML = "text/xml";
+
protected static TokenProcessor token = TokenProcessor.getInstance();
- protected static Logger log = Logger.getLogger(LamsDispatchAction.class);
+ protected static Logger log = Logger.getLogger(LamsDispatchAction.class);
- protected void saveToken(javax.servlet.http.HttpServletRequest request) {
- token.saveToken(request);
- }
-
- protected boolean isTokenValid(javax.servlet.http.HttpServletRequest request) {
- return token.isTokenValid(request, false);
- }
-
- protected boolean isTokenValid(javax.servlet.http.HttpServletRequest request, boolean reset) {
- return token.isTokenValid(request, reset);
- }
-
- protected void resetToken(HttpServletRequest request) {
- token.resetToken(request);
+ protected void saveToken(javax.servlet.http.HttpServletRequest request) {
+ token.saveToken(request);
}
-
- /*protected void saveForward(javax.servlet.http.HttpServletRequest request, ActionForward forward) {
- token.saveForward(request, forward);
+
+ protected boolean isTokenValid(javax.servlet.http.HttpServletRequest request) {
+ return token.isTokenValid(request, false);
}
-
- protected ActionForward getForward(javax.servlet.http.HttpServletRequest request) {
- return token.getForward(request, true);
- }*/
-
- protected void writeAJAXResponse(HttpServletResponse response, String output) throws IOException {
- // set it to unicode (LDEV-1275)
- response.setContentType("text/html;charset=utf-8");
- PrintWriter writer = response.getWriter();
- if (output.length()>0) {
- writer.println(output);
- }
+ protected boolean isTokenValid(javax.servlet.http.HttpServletRequest request, boolean reset) {
+ return token.isTokenValid(request, reset);
+ }
+
+ protected void resetToken(HttpServletRequest request) {
+ token.resetToken(request);
+ }
+
+ protected void writeAJAXResponse(HttpServletResponse response, String output) throws IOException {
+ // set it to unicode (LDEV-1275)
+ response.setContentType("text/html;charset=utf-8");
+ PrintWriter writer = response.getWriter();
+
+ if (output.length() > 0) {
+ writer.println(output);
}
+ }
- protected void writeAJAXOKResponse(HttpServletResponse response) throws IOException {
- writeAJAXResponse(response, "OK");
+ protected void writeAJAXOKResponse(HttpServletResponse response) throws IOException {
+ writeAJAXResponse(response, "OK");
+ }
+
+ protected void writeResponse(HttpServletResponse response, String contentType, String characterEncoding, String output) throws IOException {
+ response.setContentType(contentType);
+ response.setCharacterEncoding(characterEncoding);
+ PrintWriter writer = response.getWriter();
+ if (output.length() > 0) {
+ writer.println(output);
}
+ }
}
Index: lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java
===================================================================
diff -u -rb9c68da61a40efc2425fb80c0c1e7b06f8fcfe78 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java (.../FolderContentDTO.java) (revision b9c68da61a40efc2425fb80c0c1e7b06f8fcfe78)
+++ lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java (.../FolderContentDTO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -24,11 +24,13 @@
package org.lamsfoundation.lams.workspace.dto;
import java.util.Date;
import java.util.SortedSet;
+import java.util.TimeZone;
import java.util.Vector;
-import org.apache.commons.lang.time.DateUtils;
import org.lamsfoundation.lams.learningdesign.LearningDesign;
+import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.WorkspaceFolder;
+import org.lamsfoundation.lams.util.DateUtil;
import org.lamsfoundation.lams.util.wddx.WDDXTAGS;
import org.lamsfoundation.lams.workspace.WorkspaceFolderContent;
@@ -76,12 +78,12 @@
this.versionDetails = null;
this.readOnly = false;
}
- public FolderContentDTO(LearningDesign design, Integer permissionCode){
+ public FolderContentDTO(LearningDesign design, Integer permissionCode, User user){
this.name = design.getTitle();
this.description = design.getDescription();
this.creationDateTime = design.getCreateDateTime();
this.lastModifiedDateTime = design.getLastModifiedDateTime();
- this.formattedLastModifiedDateTime = formatLastModifiedDateTime();
+ this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()]));
this.resourceType = DESIGN;
this.resourceID = design.getLearningDesignId();
this.permissionCode = permissionCode;
@@ -90,12 +92,12 @@
this.versionDetails = null;
this.readOnly = design.getReadOnly();
}
- public FolderContentDTO(WorkspaceFolder workspaceFolder, Integer permissionCode){
+ public FolderContentDTO(WorkspaceFolder workspaceFolder, Integer permissionCode, User user){
this.name = workspaceFolder.getName();
this.description = "Folder";
this.creationDateTime = workspaceFolder.getCreationDate();
this.lastModifiedDateTime = workspaceFolder.getLastModifiedDate();
- this.formattedLastModifiedDateTime = formatLastModifiedDateTime();
+ this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()]));
this.resourceType = FOLDER;
this.resourceTypeID = new Long(workspaceFolder.getWorkspaceFolderType().intValue());
this.resourceID = new Long(workspaceFolder.getWorkspaceFolderId().intValue());
@@ -104,12 +106,12 @@
this.versionDetails = null;
this.readOnly = Boolean.FALSE;
}
- public FolderContentDTO(Integer permissionCode, WorkspaceFolderContent workspaceFolderContent,SortedSet details){
+ public FolderContentDTO(Integer permissionCode, WorkspaceFolderContent workspaceFolderContent, SortedSet details, User user){
this.name =workspaceFolderContent.getName();
this.description = workspaceFolderContent.getDescription();
this.creationDateTime = workspaceFolderContent.getCreateDate();
this.lastModifiedDateTime = workspaceFolderContent.getLastModified();
- this.formattedLastModifiedDateTime = formatLastModifiedDateTime();
+ this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()]));
this.resourceID = workspaceFolderContent.getFolderContentID();
this.permissionCode = permissionCode;
if(workspaceFolderContent.getContentTypeID().equals(WorkspaceFolderContent.CONTENT_TYPE_FILE))
@@ -209,10 +211,10 @@
this.readOnly = readOnly;
}
- private String formatLastModifiedDateTime() {
+ private String formatLastModifiedDateTime(TimeZone tz) {
if(this.lastModifiedDateTime != null) {
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
- return sdf.format(lastModifiedDateTime);
+ return sdf.format(DateUtil.convertToTimeZoneFromDefault(tz, this.lastModifiedDateTime));
} else {
return null;
}
Index: lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java
===================================================================
diff -u -r2f21856ec2ab85b47c93cfcc3fa2c8769be65077 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java (.../GradebookGridRowDTO.java) (revision 2f21856ec2ab85b47c93cfcc3fa2c8769be65077)
+++ lams_gradebook/src/java/org/lamsfoundation/lams/gradebook/dto/GradebookGridRowDTO.java (.../GradebookGridRowDTO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -18,11 +18,11 @@
*
* http://www.gnu.org/licenses/gpl.txt
* ****************************************************************
- */
-
-/* $Id$ */
-package org.lamsfoundation.lams.gradebook.dto;
+ */
+/* $Id$ */
+package org.lamsfoundation.lams.gradebook.dto;
+
import java.text.DecimalFormat;
import java.util.ArrayList;
@@ -40,16 +40,16 @@
// The name for the row, every gradebook row has some sort of name
// Be it the user's name, the activity name, the lesson name etc
public String rowName;
-
+
// A unit of time in milliseconds that determines the time taken for the corressponding task
public Long timeTaken;
-
+
// Another unit of time that represents average time taken for a corresponding task
public Long averageTimeTaken;
-
+
// The mark for the corresponding gradebook grid row task
public Double mark;
-
+
// Average mark for the corresponding task
public Double averageMark;
@@ -94,7 +94,6 @@
return null;
}
}
-
protected String markToString() {
if (mark != null) {
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/ImageBundler.java
===================================================================
diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/ImageBundler.java (.../ImageBundler.java) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/ImageBundler.java (.../ImageBundler.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -47,7 +47,7 @@
private static Logger log = Logger.getLogger(ImageBundler.class);
private static String[] miscImages = new String[] { "dash.gif", "cross.gif", "error.jpg", "spacer.gif", "tick.gif",
- "tree_closed.gif", "tree_open.gif" };
+ "tree_closed.gif", "tree_open.gif" , "help.jpg"};
Map filesToCopy = null;
List directoriesRequired = null;
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml (.../learningApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml (.../learningApplicationContext.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -37,6 +37,7 @@
+
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java
===================================================================
diff -u -rfc2b6751efa103ff475378442632b752c01c2736 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision fc2b6751efa103ff475378442632b752c01c2736)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -21,7 +21,7 @@
* ****************************************************************
*/
-/* $$Id$$ */
+/* $$Id$$ */
package org.lamsfoundation.lams.learning.progress;
import java.util.Date;
@@ -42,234 +42,243 @@
import org.lamsfoundation.lams.usermanagement.User;
/**
- * The Progress Engine controls how a learner progresses
- * through a sequence.
- *
- * Code must be re-entrant, as there is one progress engine object called by a singleton LearnerService.
+ * The Progress Engine controls how a learner progresses through a sequence.
*
- * @author chris, Jacky
+ * Code must be re-entrant, as there is one progress engine object called by a
+ * singleton LearnerService.
+ *
+ * @author chris, Jacky
*/
-public class ProgressEngine
-{
- protected Logger log = Logger.getLogger(ProgressEngine.class);
+public class ProgressEngine {
+ protected Logger log = Logger.getLogger(ProgressEngine.class);
private IActivityDAO activityDAO;
/**
- * Method determines next step for a learner based on the activity
- * they have just completed. Will clear the Parallel Waiting Complete value if it is currently set.
- * @param learner The User who is progressing through the Lesson.
- * @param completedActivity The Activity the learner has just completed.
- * @param lesson The Lesson the learner needs progress for.
+ * Method determines next step for a learner based on the activity they have
+ * just completed. Will clear the Parallel Waiting Complete value if it is
+ * currently set.
+ *
+ * @param learner
+ * The User who is progressing through the
+ * Lesson.
+ * @param completedActivity
+ * The Activity the learner has just
+ * completed.
+ * @param lesson
+ * The Lesson the learner needs progress for.
* @param learnerProgress
- * @return Progress The VO that contains the data needed to send
- * the learner to the next step.
- * @throws ProgressException if progress cannot be calculated successfully.
+ * @return Progress The VO that contains the data needed to send the learner
+ * to the next step.
+ * @throws ProgressException
+ * if progress cannot be calculated successfully.
*/
- public LearnerProgress calculateProgress(User learner,
- Activity completedActivity,
- LearnerProgress learnerProgress) throws ProgressException
- {
- if ( learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING_COMPLETE ) {
- learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_NO_WAIT);
- }
- return doCalculateProgress(learner, completedActivity, learnerProgress, new LinkedList());
+ public LearnerProgress calculateProgress(User learner, Activity completedActivity, LearnerProgress learnerProgress)
+ throws ProgressException {
+ if (learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING_COMPLETE) {
+ learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_NO_WAIT);
+ }
+ return doCalculateProgress(learner, completedActivity, learnerProgress, new LinkedList());
}
-
- /** Internal method used for recursion. Does the actual "work" of calculateProgress. */
- private LearnerProgress doCalculateProgress(User learner,
- Activity completedActivity,
- LearnerProgress learnerProgress,
- List completedActivityList) throws ProgressException
- {
- learnerProgress.setProgressState(completedActivity,
- LearnerProgress.ACTIVITY_COMPLETED,
- activityDAO);
- completedActivityList.add(completedActivity.getActivityId());
- if ( completedActivity.isStopAfterActivity() ) {
- // special case - terminate the lesson here.
- learnerProgress.setProgressState(completedActivity, LearnerProgress.ACTIVITY_COMPLETED,activityDAO);
- for ( Activity parentActivity = completedActivity.getParentActivity() ; parentActivity != null; parentActivity = parentActivity.getParentActivity() ) {
- learnerProgress.setProgressState(parentActivity, LearnerProgress.ACTIVITY_COMPLETED,activityDAO);
- completedActivityList.add(parentActivity.getActivityId());
- }
- populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
- learnerProgress.setFinishDate(new Date());
- return setLessonComplete(learnerProgress, LearnerProgress.LESSON_IN_DESIGN_COMPLETE);
- } else if ( completedActivity.isFloating() && !completedActivity.getParentActivity().isParallelActivity()) {
- // special case - floating activity and not parallel activity (floating) child.
- return learnerProgress;
- } else {
- Transition transition = completedActivity.getTransitionFrom();
- if (transition != null)
- return progressCompletedActivity(learner,
- completedActivity,
- learnerProgress,
- transition,
- completedActivityList);
- else
- return progressParentActivity(learner,
- completedActivity,
- learnerProgress,
- completedActivityList);
- }
+ /**
+ * Internal method used for recursion. Does the actual "work" of
+ * calculateProgress.
+ */
+ private LearnerProgress doCalculateProgress(User learner, Activity completedActivity,
+ LearnerProgress learnerProgress, List completedActivityList) throws ProgressException {
+ learnerProgress.setProgressState(completedActivity, LearnerProgress.ACTIVITY_COMPLETED, activityDAO);
+ completedActivityList.add(completedActivity.getActivityId());
+
+ if (completedActivity.isStopAfterActivity()) {
+ // special case - terminate the lesson here.
+ learnerProgress.setProgressState(completedActivity, LearnerProgress.ACTIVITY_COMPLETED, activityDAO);
+ for (Activity parentActivity = completedActivity.getParentActivity(); parentActivity != null; parentActivity = parentActivity
+ .getParentActivity()) {
+ learnerProgress.setProgressState(parentActivity, LearnerProgress.ACTIVITY_COMPLETED, activityDAO);
+ completedActivityList.add(parentActivity.getActivityId());
+ }
+ populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
+ learnerProgress.setFinishDate(new Date());
+ return setLessonComplete(learnerProgress, LearnerProgress.LESSON_IN_DESIGN_COMPLETE);
+ } else if (completedActivity.isFloating() && !completedActivity.getParentActivity().isParallelActivity()) {
+ // special case - floating activity and not parallel activity (floating) child.
+ return learnerProgress;
+ } else {
+ Transition transition = completedActivity.getTransitionFrom();
+ if (transition != null)
+ return progressCompletedActivity(learner, completedActivity, learnerProgress, transition,
+ completedActivityList);
+ else
+ return progressParentActivity(learner, completedActivity, learnerProgress, completedActivityList);
+ }
}
/**
* Method determines the start point for a learner when they begin a Lesson.
*
- * It is also reused to calculate where the learner should be should the progress
- * "go wrong". For example, the teacher does live edit and the learner moves to
- * the stop gate created for the live edit. When the edit is completed, the stop
- * gate is removed. But now there is no current activity for the learner.
+ * It is also reused to calculate where the learner should be should the
+ * progress "go wrong". For example, the teacher does live edit and the
+ * learner moves to the stop gate created for the live edit. When the edit
+ * is completed, the stop gate is removed. But now there is no current
+ * activity for the learner.
*
- * @param LearnerProgress The user's progress details for the User who is starting the Lesson.
+ * @param LearnerProgress
+ * The user's progress details for the User
+ * who is starting the Lesson.
* @return LearnerProgress The updated user's progress details.
- * @throws ProgressException if the start point cannot be calculated successfully.
+ * @throws ProgressException
+ * if the start point cannot be calculated successfully.
*/
- public LearnerProgress setUpStartPoint(LearnerProgress progress) throws ProgressException
- {
-
- LearningDesign ld = progress.getLesson().getLearningDesign();
-
- if (progress.getLesson().getLockedForEdit()) {
- // special case - currently setting up the stop gates for live edit.
- return clearProgressNowhereToGoNotCompleted(progress,"setUpStartPoint");
- } else if (progress.isComplete() ) {
- return progress;
- } else if(ld.getFirstActivity()==null) {
- throw new ProgressException("Could not find first activity for "
- +"learning design ["+ld.getTitle()+"], id["
- +ld.getLearningDesignId().longValue()
- +"]");
- } else if ( progress.getCompletedActivities().containsKey(ld.getFirstActivity()) ) {
- // special case - recalculating the appropriate current activity.
- return doCalculateProgress(progress.getUser(), ld.getFirstActivity(), progress, new LinkedList());
- } else if ( canDoActivity(progress.getLesson(), ld.getFirstActivity()) ) {
- // normal case
- progress.setCurrentActivity(ld.getFirstActivity());
- progress.setNextActivity(ld.getFirstActivity());
- setActivityAttempted(progress, ld.getFirstActivity());
- return progress;
- } else {
- // special case - trying to get to a whole new activity (past the stop gate)
- // during a live edit
- return clearProgressNowhereToGoNotCompleted(progress,"setUpStartPoint");
- }
+ public LearnerProgress setUpStartPoint(LearnerProgress progress) throws ProgressException {
+
+ LearningDesign ld = progress.getLesson().getLearningDesign();
+
+ if (progress.getLesson().getLockedForEdit()) {
+ // special case - currently setting up the stop gates for live edit.
+ return clearProgressNowhereToGoNotCompleted(progress, "setUpStartPoint");
+ } else if (progress.isComplete()) {
+ return progress;
+ } else if (ld.getFirstActivity() == null) {
+ throw new ProgressException("Could not find first activity for " + "learning design [" + ld.getTitle()
+ + "], id[" + ld.getLearningDesignId().longValue() + "]");
+ } else if (progress.getCompletedActivities().containsKey(ld.getFirstActivity())) {
+ // special case - recalculating the appropriate current activity.
+ return doCalculateProgress(progress.getUser(), ld.getFirstActivity(), progress, new LinkedList());
+ } else if (canDoActivity(progress.getLesson(), ld.getFirstActivity())) {
+ // normal case
+ progress.setCurrentActivity(ld.getFirstActivity());
+ progress.setNextActivity(ld.getFirstActivity());
+ setActivityAttempted(progress, ld.getFirstActivity());
+ return progress;
+ } else {
+ // special case - trying to get to a whole new activity (past the stop gate)
+ // during a live edit
+ return clearProgressNowhereToGoNotCompleted(progress, "setUpStartPoint");
+ }
}
-
- /** Is it okay for me to do this activity? Most of the time yes - but you can do it
- * if the learning design is marked for edit (due to live edit) and the activity isn't read
- * only. This case should only occur if you have snuck past the stop gates while live edit
- * was being set up. Hopefully never!
+
+ /**
+ * Is it okay for me to do this activity? Most of the time yes - but you can
+ * do it if the learning design is marked for edit (due to live edit) and
+ * the activity isn't read only. This case should only occur if you have
+ * snuck past the stop gates while live edit was being set up. Hopefully
+ * never!
*
- * See the live edit documentation on the wiki for more details on the Lesson.lockedForEdit
- * and LearningDesign.activityReadOnly flags. These are set up in AuthoringService.setupEditOnFlyLock()
+ * See the live edit documentation on the wiki for more details on the
+ * Lesson.lockedForEdit and LearningDesign.activityReadOnly flags. These are
+ * set up in AuthoringService.setupEditOnFlyLock()
*
* @param design
* @param activity
* @return
*/
private boolean canDoActivity(Lesson lesson, Activity activity) {
- LearningDesign design = lesson.getLearningDesign();
- return ! lesson.getLockedForEdit() && ( ! design.getEditOverrideLock() || activity.isActivityReadOnly() ) ;
+ LearningDesign design = lesson.getLearningDesign();
+ return !lesson.getLockedForEdit() && (!design.getEditOverrideLock() || activity.isActivityReadOnly());
}
- /**
- * Oh, dear - nowhere to go. Probably because the sequence is being edited
- * while I'm trying to move to an untouched activity, or it is in the process
- * of setting up the stop gates for live edit.
+ /**
+ * Oh, dear - nowhere to go. Probably because the sequence is being edited
+ * while I'm trying to move to an untouched activity, or it is in the
+ * process of setting up the stop gates for live edit.
*
* Set the current activity and next activity to null, and the progress
- * engine should then show the "Sequence Broken" screen.
+ * engine should then show the "Sequence Broken" screen.
*
- * Writes a warning to the log if callingMethod is not null. If it is null, we assume
- * the calling code has written out a warning/error already.
+ * Writes a warning to the log if callingMethod is not null. If it is null,
+ * we assume the calling code has written out a warning/error already.
*/
private LearnerProgress clearProgressNowhereToGoNotCompleted(LearnerProgress progress, String callingMethod) {
- if ( callingMethod != null ) {
- log.warn("Learner "+progress.getUser().getFullName()+"("+progress.getUser().getUserId()
- +") has a problem with the progress for lesson "
- +progress.getLesson().getLessonName()+"("+progress.getLesson().getLessonId()
- +"). Completed activities so far was "+progress.getCurrentCompletedActivitiesList()
- +". Setting current and next activity to null. Problem detected in method "+callingMethod+".");
- }
-
- progress.setCurrentActivity(null);
- progress.setNextActivity(null);
- progress.setLessonComplete(LearnerProgress.LESSON_NOT_COMPLETE);
- return progress;
+ if (callingMethod != null) {
+ log.warn("Learner " + progress.getUser().getFullName() + "(" + progress.getUser().getUserId()
+ + ") has a problem with the progress for lesson " + progress.getLesson().getLessonName() + "("
+ + progress.getLesson().getLessonId() + "). Completed activities so far was "
+ + progress.getCurrentCompletedActivitiesList()
+ + ". Setting current and next activity to null. Problem detected in method " + callingMethod + ".");
+ }
+
+ progress.setCurrentActivity(null);
+ progress.setNextActivity(null);
+ progress.setLessonComplete(LearnerProgress.LESSON_NOT_COMPLETE);
+ return progress;
}
-
- /** Set the current activity as attempted. If it is a parallel activity, mark its children as attempted too. */
+
+ /**
+ * Set the current activity as attempted. If it is a parallel activity, mark
+ * its children as attempted too.
+ */
public void setActivityAttempted(LearnerProgress progress, Activity activity) {
- progress.setProgressState(activity,LearnerProgress.ACTIVITY_ATTEMPTED, activityDAO);
- activity.setReadOnly(true);
-
- if ( activity.isParallelActivity() ) {
- ParallelActivity parallel = (ParallelActivity) activityDAO.getActivityByActivityId(activity.getActivityId(), ParallelActivity.class);
- Iterator iter = parallel.getActivities().iterator();
- while (iter.hasNext()) {
- Activity element = (Activity) iter.next();
- setActivityAttempted(progress,element);
- }
- }
-
- // update activity
- activityDAO.insertOrUpdate(activity);
+ progress.setProgressState(activity, LearnerProgress.ACTIVITY_ATTEMPTED, activityDAO);
+ activity.setReadOnly(true);
+
+ if (activity.isParallelActivity()) {
+ ParallelActivity parallel = (ParallelActivity) activityDAO.getActivityByActivityId(
+ activity.getActivityId(), ParallelActivity.class);
+ Iterator iter = parallel.getActivities().iterator();
+ while (iter.hasNext()) {
+ Activity element = (Activity) iter.next();
+ setActivityAttempted(progress, element);
+ }
+ }
+
+ // update activity
+ activityDAO.insertOrUpdate(activity);
}
+
/**
- * We setup the progress data for a completed activity. This happens when
- * we find a transition to progress to. It should setup all activity states
+ * We setup the progress data for a completed activity. This happens when we
+ * find a transition to progress to. It should setup all activity states
* that allow web layer to calculate the url to move one to.
*
- * @param completedActivity the activity finished either by user or the
- * lams. In terms of lams completed activity, it would be
- * ParallelActivity, SequenceActivity,
- * OptionsActivity and other system driven activities.
- * Whereas user activity will be mostly tool activities.
- * @param learnerProgress the progress we based on.
- * @param transition the transition we progress to.
+ * @param completedActivity
+ * the activity finished either by user or the lams. In terms
+ * of lams completed activity, it would be
+ * ParallelActivity,
+ * SequenceActivity,
+ * OptionsActivity and other system driven
+ * activities. Whereas user activity will be mostly tool
+ * activities.
+ * @param learnerProgress
+ * the progress we based on.
+ * @param transition
+ * the transition we progress to.
* @return the learner progress data we calculated.
- * @throws ProgressException
+ * @throws ProgressException
*/
- private LearnerProgress progressCompletedActivity(User learner,
- Activity completedActivity,
- LearnerProgress learnerProgress,
- Transition transition,
- List completedActivityList) throws ProgressException
- {
- Activity nextActivity = transition.getToActivity();
-
- if ( ! learnerProgress.getCompletedActivities().containsKey(nextActivity) ) {
- // normal case - the next activity is still yet to be done
-
- learnerProgress.setPreviousActivity(completedActivity);
-
- populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
-
- if ( canDoActivity(learnerProgress.getLesson(), nextActivity) ) {
-
- learnerProgress.setCurrentActivity(nextActivity);
- learnerProgress.setNextActivity(nextActivity);
- setActivityAttempted(learnerProgress, nextActivity);
- if ( learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING )
- learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING_COMPLETE );
-
- } else {
- return clearProgressNowhereToGoNotCompleted(learnerProgress,"progressCompletedActivity");
- }
-
- return learnerProgress;
-
- } else {
- // abnormal case: next activity already done. Must have jumped back to an earlier
- // optional activity, done another activity and then kept going
-
- return doCalculateProgress(learner,nextActivity,learnerProgress, completedActivityList);
- }
-
+ private LearnerProgress progressCompletedActivity(User learner, Activity completedActivity,
+ LearnerProgress learnerProgress, Transition transition, List completedActivityList)
+ throws ProgressException {
+ Activity nextActivity = transition.getToActivity();
+
+ if (!learnerProgress.getCompletedActivities().containsKey(nextActivity)) {
+ // normal case - the next activity is still yet to be done
+
+ learnerProgress.setPreviousActivity(completedActivity);
+
+ populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
+
+ if (canDoActivity(learnerProgress.getLesson(), nextActivity)) {
+
+ learnerProgress.setCurrentActivity(nextActivity);
+ learnerProgress.setNextActivity(nextActivity);
+ setActivityAttempted(learnerProgress, nextActivity);
+ if (learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING)
+ learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING_COMPLETE);
+
+ } else {
+ return clearProgressNowhereToGoNotCompleted(learnerProgress, "progressCompletedActivity");
+ }
+
+ return learnerProgress;
+
+ } else {
+ // abnormal case: next activity already done. Must have jumped back to an earlier
+ // optional activity, done another activity and then kept going
+
+ return doCalculateProgress(learner, nextActivity, learnerProgress, completedActivityList);
+ }
+
}
/**
@@ -278,133 +287,127 @@
* is in the leaf node of an activity hierarchy. And we need to travesal the
* activity hierarchy upwards to find the progress information.
*
- * @param learner the current learner.
- * @param lesson the lesson that current learner progress belongs to.
- * @param completedActivity the activity finished either by user or the
- * lams. In terms of lams completed activity, it would be
- * ParallelActivity, SequenceActivity,
- * OptionsActivity and other system driven activities.
- * Whereas user activity will be mostly tool activities.
- * @param learnerProgress the progress we based on.
+ * @param learner
+ * the current learner.
+ * @param lesson
+ * the lesson that current learner progress belongs to.
+ * @param completedActivity
+ * the activity finished either by user or the lams. In terms
+ * of lams completed activity, it would be
+ * ParallelActivity,
+ * SequenceActivity,
+ * OptionsActivity and other system driven
+ * activities. Whereas user activity will be mostly tool
+ * activities.
+ * @param learnerProgress
+ * the progress we based on.
* @return the learner progress data we calculated.
* @throws ProgressException
*/
- private LearnerProgress progressParentActivity(User learner,
- Activity completedActivity,
- LearnerProgress learnerProgress,
- List completedActivityList) throws ProgressException
- {
- Activity parent = completedActivity.getParentActivity();
-
- if (parent != null)
- {
- if(!(parent.isComplexActivity()))
- throw new ProgressException("Parent activity is always expected" +
- " to the complex activity. But activity type"+
- parent.getActivityTypeId()+" has been found");
- //move to next activity within parent if not all children are completed.
-
-
- ComplexActivity complexParent = (ComplexActivity) activityDAO.getActivityByActivityId(parent.getActivityId(),ComplexActivity.class);
- if (! learnerProgress.getCompletedActivities().containsKey(complexParent) && !complexParent.areChildrenCompleted(learnerProgress))
- {
- Activity nextActivity = complexParent.getNextActivityByParent(completedActivity);
-
-
- if (!isNextActivityValid(nextActivity)) {
- log.error("Error occurred in progress engine."
- + " Unexpected Null activity received when progressing"
- + " to the next activity within a incomplete parent activity:"
- + " Parent activity id ["
- + parent.getActivityId()
- + "]");
- learnerProgress = clearProgressNowhereToGoNotCompleted(learnerProgress,null);
- }
- else if(isParallelWaitActivity(nextActivity))
- {
- learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING);
- // learnerProgress.setNextActivity(null);
- populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
- }
- else if ( canDoActivity(learnerProgress.getLesson(), nextActivity) )
- {
- learnerProgress.setNextActivity(nextActivity);
- setActivityAttempted(learnerProgress, nextActivity);
- populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
- }
- else {
- learnerProgress = clearProgressNowhereToGoNotCompleted(learnerProgress, "progressParentActivity");
- }
- }
- //recurvisely call back to calculateProgress to calculate completed
- //parent activity.
- else {
- learnerProgress.setPreviousActivity(complexParent);
- doCalculateProgress(learner, parent, learnerProgress, completedActivityList);
- if ( learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING )
- learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING_COMPLETE );
- }
- }
- //lesson is meant to be completed if there is no transition and no parent.
- else {
- learnerProgress.setFinishDate(new Date());
- learnerProgress = setLessonComplete(learnerProgress, LearnerProgress.LESSON_END_OF_DESIGN_COMPLETE);
- }
+ private LearnerProgress progressParentActivity(User learner, Activity completedActivity,
+ LearnerProgress learnerProgress, List completedActivityList) throws ProgressException {
+ Activity parent = completedActivity.getParentActivity();
- return learnerProgress;
- }
+ if (parent != null) {
+ if (!(parent.isComplexActivity()))
+ throw new ProgressException("Parent activity is always expected"
+ + " to the complex activity. But activity type" + parent.getActivityTypeId()
+ + " has been found");
+ //move to next activity within parent if not all children are completed.
- /**
- * Set the lesson to complete for this learner.
- *
- * @param learnerProgress
- * @return updated learnerProgress
- */
- private LearnerProgress setLessonComplete(LearnerProgress learnerProgress, byte completionStatus) {
- learnerProgress.setCurrentActivity(null);
- learnerProgress.setNextActivity(null);
- learnerProgress.setLessonComplete(completionStatus);
- return learnerProgress;
+ ComplexActivity complexParent = (ComplexActivity) activityDAO.getActivityByActivityId(parent
+ .getActivityId(), ComplexActivity.class);
+ if (!learnerProgress.getCompletedActivities().containsKey(complexParent)
+ && !complexParent.areChildrenCompleted(learnerProgress)) {
+ Activity nextActivity = complexParent.getNextActivityByParent(completedActivity);
+
+ if (!isNextActivityValid(nextActivity)) {
+ log.error("Error occurred in progress engine."
+ + " Unexpected Null activity received when progressing"
+ + " to the next activity within a incomplete parent activity:" + " Parent activity id ["
+ + parent.getActivityId() + "]");
+ learnerProgress = clearProgressNowhereToGoNotCompleted(learnerProgress, null);
+ } else if (isParallelWaitActivity(nextActivity)) {
+ learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING);
+ // learnerProgress.setNextActivity(null);
+ populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
+ } else if (canDoActivity(learnerProgress.getLesson(), nextActivity)) {
+ learnerProgress.setNextActivity(nextActivity);
+ setActivityAttempted(learnerProgress, nextActivity);
+ populateCurrentCompletedActivityList(learnerProgress, completedActivityList);
+ } else {
+ learnerProgress = clearProgressNowhereToGoNotCompleted(learnerProgress, "progressParentActivity");
+ }
+ }
+ //recurvisely call back to calculateProgress to calculate completed
+ //parent activity.
+ else {
+ learnerProgress.setPreviousActivity(complexParent);
+ doCalculateProgress(learner, parent, learnerProgress, completedActivityList);
+ if (learnerProgress.getParallelWaiting() == LearnerProgress.PARALLEL_WAITING)
+ learnerProgress.setParallelWaiting(LearnerProgress.PARALLEL_WAITING_COMPLETE);
+ }
}
+ //lesson is meant to be completed if there is no transition and no parent.
+ else {
+ learnerProgress.setFinishDate(new Date());
+ learnerProgress = setLessonComplete(learnerProgress, LearnerProgress.LESSON_END_OF_DESIGN_COMPLETE);
+ }
+ return learnerProgress;
+ }
+
/**
+ * Set the lesson to complete for this learner.
+ *
+ * @param learnerProgress
+ * @return updated learnerProgress
+ */
+ private LearnerProgress setLessonComplete(LearnerProgress learnerProgress, byte completionStatus) {
+ learnerProgress.setCurrentActivity(null);
+ learnerProgress.setNextActivity(null);
+ learnerProgress.setLessonComplete(completionStatus);
+ return learnerProgress;
+ }
+
+ /**
* The helper method to setup the completed activity list since the last
- * transition.
+ * transition.
+ *
* @param learnerProgress
*/
- private void populateCurrentCompletedActivityList(LearnerProgress learnerProgress, List completedActivityList)
- {
- learnerProgress.setCurrentCompletedActivitiesList(completedActivityList);
- completedActivityList.clear();
+ private void populateCurrentCompletedActivityList(LearnerProgress learnerProgress, List completedActivityList) {
+ learnerProgress.setCurrentCompletedActivitiesList(completedActivityList);
+ completedActivityList.clear();
}
-
+
/**
* The next valid is valid if it is not null activity or if it is a parallel
* waiting activity.
- * @param nextActivity the next activity we progress to.
+ *
+ * @param nextActivity
+ * the next activity we progress to.
* @return is the next activity valid.
*/
- private boolean isNextActivityValid(Activity nextActivity)
- {
- return !nextActivity.isNull()||isParallelWaitActivity(nextActivity);
+ private boolean isNextActivityValid(Activity nextActivity) {
+ return !nextActivity.isNull() || isParallelWaitActivity(nextActivity);
}
/**
- * Check up the object type to see whether it is a parallel waiting
+ * Check up the object type to see whether it is a parallel waiting
* activity.
- * @param nextActivity the next activity we progress to.
+ *
+ * @param nextActivity
+ * the next activity we progress to.
* @return is the next activity the type of parallel activity.
*/
- private boolean isParallelWaitActivity(Activity nextActivity)
- {
- return nextActivity.getActivityTypeId()!=null && nextActivity.getActivityTypeId().intValue()==ParallelWaitActivity.PARALLEL_WAIT_ACTIVITY_TYPE;
+ private boolean isParallelWaitActivity(Activity nextActivity) {
+ return nextActivity.getActivityTypeId() != null
+ && nextActivity.getActivityTypeId().intValue() == ParallelWaitActivity.PARALLEL_WAIT_ACTIVITY_TYPE;
}
- public void setActivityDAO(IActivityDAO activityDAO) {
- this.activityDAO = activityDAO;
- }
-
+ public void setActivityDAO(IActivityDAO activityDAO) {
+ this.activityDAO = activityDAO;
+ }
-
-
}
\ No newline at end of file
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java
===================================================================
diff -u -rc4bbe0b084234edffd2c0c43dce7d7b1fbf14863 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision c4bbe0b084234edffd2c0c43dce7d7b1fbf14863)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -35,12 +35,15 @@
import java.util.TreeMap;
import org.apache.log4j.Logger;
+import org.lamsfoundation.lams.gradebook.GradebookUserActivity;
+import org.lamsfoundation.lams.gradebook.service.IGradebookService;
import org.lamsfoundation.lams.learning.progress.ProgressBuilder;
import org.lamsfoundation.lams.learning.progress.ProgressEngine;
import org.lamsfoundation.lams.learning.progress.ProgressException;
import org.lamsfoundation.lams.learning.web.bean.GateActivityDTO;
import org.lamsfoundation.lams.learning.web.util.ActivityMapping;
import org.lamsfoundation.lams.learningdesign.Activity;
+import org.lamsfoundation.lams.learningdesign.ActivityEvaluation;
import org.lamsfoundation.lams.learningdesign.BranchActivityEntry;
import org.lamsfoundation.lams.learningdesign.BranchCondition;
import org.lamsfoundation.lams.learningdesign.BranchingActivity;
@@ -65,6 +68,7 @@
import org.lamsfoundation.lams.lesson.service.ILessonService;
import org.lamsfoundation.lams.lesson.service.LessonServiceException;
import org.lamsfoundation.lams.tool.ToolOutput;
+import org.lamsfoundation.lams.tool.ToolOutputValue;
import org.lamsfoundation.lams.tool.ToolSession;
import org.lamsfoundation.lams.tool.dao.IToolSessionDAO;
import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
@@ -98,6 +102,7 @@
private ILessonService lessonService;
private static HashMap syncMap = new HashMap();
protected MessageService messageService;
+ private IGradebookService gradebookService;
// ---------------------------------------------------------------------
// Inversion of Control Methods - Constructor injection
@@ -109,8 +114,9 @@
}
/**
- * Creates a new instance of LearnerService. To be used by Spring, assuming the Spring will set up the progress
- * engine via method injection. If you are creating the bean manually then use the other constructor.
+ * Creates a new instance of LearnerService. To be used by Spring, assuming
+ * the Spring will set up the progress engine via method injection. If you
+ * are creating the bean manually then use the other constructor.
*/
public LearnerService() {
}
@@ -219,7 +225,8 @@
}
/**
- * Get the lesson data for a particular lesson. In a DTO format suitable for sending to the client.
+ * Get the lesson data for a particular lesson. In a DTO format suitable for
+ * sending to the client.
*/
public LessonDTO getLessonData(Long lessonId) {
Lesson lesson = getLesson(lessonId);
@@ -228,18 +235,21 @@
/**
*
- * Joins a User to a lesson as a learner. It could either be a new lesson or a lesson that has been started.
+ * Joins a User to a lesson as a learner. It could either be a new lesson or
+ * a lesson that has been started.
*
*
*
- * In terms of new lesson, a new learner progress would be initialized. Tool session for the next activity will be
- * initialized if necessary.
+ * In terms of new lesson, a new learner progress would be initialized. Tool
+ * session for the next activity will be initialized if necessary.
*
*
*
- * In terms of an started lesson, the learner progress will be returned without calculation. Tool session will be
- * initialized if necessary. Note that we won't initialize tool session for current activity because we assume tool
- * session will always initialize before it becomes a current activity.
0) {
+
+ // Getting the first activity evaluation
+ ActivityEvaluation eval = toolActivity.getActivityEvaluations().iterator().next();
+
+ try {
+ ToolOutput toolOutput = lamsCoreToolService.getOutputFromTool(eval.getToolOutputDefinition(),
+ toolSession, learner.getUserId());
+
+ if (toolOutput != null) {
+ ToolOutputValue outputVal = toolOutput.getValue();
+ if (outputVal != null) {
+ Double outputDouble = outputVal.getDouble();
+
+ GradebookUserActivity gradebookUserActivity = gradebookService.getGradebookUserActivity(
+ toolActivity.getActivityId(), learner.getUserId());
+
+ // Only set the mark if it hasnt previously been set by a teacher
+ if (gradebookUserActivity == null || !gradebookUserActivity.getMarkedInGradebook()) {
+ gradebookService.updateUserActivityGradebookMark(lesson, learner, toolActivity, outputDouble, false);
+ }
+ }
+ }
+
+ } catch (ToolException e) {
+ log.debug("Runtime exception when attempted to get outputs for activity: "
+ + toolActivity.getActivityId(), e);
+ }
+ }
+
+ }
+ }
+
/**
* Exit a lesson.
*
@@ -632,8 +692,8 @@
/**
* @throws LearnerServiceException
- * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#performGrouping(java.lang.Long, java.lang.Long,
- * java.lang.Integer)
+ * @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#performGrouping(java.lang.Long,
+ * java.lang.Long, java.lang.Integer)
*/
public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId, boolean forceGrouping)
throws LearnerServiceException {
@@ -803,9 +863,10 @@
}
/**
- * Get all the learners who may come through this gate. For a Group Based branch and the Teacher Grouped branch, it
- * is the group of users in the Branch's group, but only the learners who have started the lesson. Otherwise we just
- * get all learners who have started the lesson.
+ * Get all the learners who may come through this gate. For a Group Based
+ * branch and the Teacher Grouped branch, it is the group of users in the
+ * Branch's group, but only the learners who have started the lesson.
+ * Otherwise we just get all learners who have started the lesson.
*
* @param gate
* @param lesson
@@ -880,8 +941,8 @@
}
/**
- * Get the lesson for this activity. If the activity is not part of a lesson (ie is from an authoring design then it
- * will return null.
+ * Get the lesson for this activity. If the activity is not part of a lesson
+ * (ie is from an authoring design then it will return null.
*/
public Lesson getLessonByActivity(Activity activity) {
Lesson lesson = lessonDAO.getLessonForActivity(activity.getActivityId());
@@ -899,13 +960,16 @@
/**
*
- * Create a lams tool session for learner against a tool activity. This will have concurrency issues interms of
- * grouped tool session because it might be inserting some tool session that has already been inserted by other
- * member in the group. If the unique_check is broken, we need to query the database to get the instance instead of
- * inserting it. It should be done in the Spring rollback strategy.
+ * Create a lams tool session for learner against a tool activity. This will
+ * have concurrency issues interms of grouped tool session because it might
+ * be inserting some tool session that has already been inserted by other
+ * member in the group. If the unique_check is broken, we need to query the
+ * database to get the instance instead of inserting it. It should be done
+ * in the Spring rollback strategy.
*
*
- * Once lams tool session is inserted, we need to notify the tool to its own session.
+ * Once lams tool session is inserted, we need to notify the tool to its own
+ * session.
*
* @param toolActivity
* @param learner
@@ -940,7 +1004,8 @@
/**
* @throws LearnerServiceException
* @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#determineBranch(org.lamsfoundation.lams.lesson.Lesson,
- * org.lamsfoundation.lams.learningdesign.BranchingActivity, java.lang.Integer)
+ * org.lamsfoundation.lams.learningdesign.BranchingActivity,
+ * java.lang.Integer)
*/
public SequenceActivity determineBranch(Lesson lesson, BranchingActivity branchingActivity, Integer learnerId)
throws LearnerServiceException {
@@ -969,9 +1034,10 @@
}
/**
- * Get all the conditions for this branching activity, ordered by order id. Go through each condition until we find
- * one that passes and that is the required branch. If no conditions match, use the branch that is the "default"
- * branch for this branching activity.
+ * Get all the conditions for this branching activity, ordered by order id.
+ * Go through each condition until we find one that passes and that is the
+ * required branch. If no conditions match, use the branch that is the
+ * "default" branch for this branching activity.
*/
private SequenceActivity determineToolBasedBranch(Lesson lesson, ToolBranchingActivity branchingActivity,
User learner) {
@@ -1103,7 +1169,8 @@
* gate to check
* @param learner
* learner who is knocking to the gate
- * @return true if learner satisfied any of the conditions and is allowed to pass
+ * @return true if learner satisfied any of the conditions
+ * and is allowed to pass
*/
private boolean determineConditionGateStatus(GateActivity gate, User learner) {
boolean shouldOpenGate = false;
@@ -1163,11 +1230,13 @@
}
/**
- * Select a particular branch - we are in preview mode and the author has selected a particular activity.
+ * Select a particular branch - we are in preview mode and the author has
+ * selected a particular activity.
*
* @throws LearnerServiceException
* @see org.lamsfoundation.lams.learning.service.ICoreLearnerService#determineBranch(org.lamsfoundation.lams.lesson.Lesson,
- * org.lamsfoundation.lams.learningdesign.BranchingActivity, java.lang.Integer)
+ * org.lamsfoundation.lams.learningdesign.BranchingActivity,
+ * java.lang.Integer)
*/
public SequenceActivity selectBranch(Lesson lesson, BranchingActivity branchingActivity, Integer learnerId,
Long branchId) throws LearnerServiceException {
@@ -1298,4 +1367,8 @@
public Grouping getGrouping(Long groupingId) {
return groupingDAO.getGroupingById(groupingId);
}
+
+ public void setGradebookService(IGradebookService gradebookService) {
+ this.gradebookService = gradebookService;
+ }
}
\ No newline at end of file
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/NotebookAction.java
===================================================================
diff -u -r38a6c414e30497d03559a85b5c33155e4a2fc22e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/NotebookAction.java (.../NotebookAction.java) (revision 38a6c414e30497d03559a85b5c33155e4a2fc22e)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/NotebookAction.java (.../NotebookAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -25,6 +25,7 @@
package org.lamsfoundation.lams.learning.web.action;
import java.util.List;
+import java.util.TreeMap;
import java.lang.Integer;
import java.io.IOException;
@@ -123,9 +124,11 @@
Long lessonID = (Long) notebookForm.get(AttributeNames.PARAM_LESSON_ID);
// get all notebook entries for the learner
- List entries = notebookService.getEntry(learnerID, CoreNotebookConstants.SCRATCH_PAD);
- request.getSession().setAttribute("entries", entries);
+
+ TreeMap> entries = notebookService.getEntryByLesson(learnerID, CoreNotebookConstants.SCRATCH_PAD);
+
+ request.getSession().setAttribute("entries", entries.values());
request.setAttribute("lessonID", lessonID);
return mapping.findForward(VIEW_ALL);
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java
===================================================================
diff -u -r02df1b4f76fac80d72ff5583feddace3897844d9 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 02df1b4f76fac80d72ff5583feddace3897844d9)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -21,7 +21,7 @@
* ****************************************************************
*/
-/* $$Id$$ */
+/* $$Id$$ */
package org.lamsfoundation.lams.learning.web.util;
import java.io.UnsupportedEncodingException;
@@ -33,7 +33,6 @@
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.lamsfoundation.lams.learning.service.ICoreLearnerService;
import org.lamsfoundation.lams.learning.service.LearnerServiceException;
@@ -52,311 +51,323 @@
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
-
/**
*
* @author Jacky Fang
- * @since 2005-3-10
+ * @since 2005-3-10
* @version
*
*/
-public class LearningWebUtil
-{
-
- private static Logger log = Logger.getLogger(LearningWebUtil.class);
+public class LearningWebUtil {
+
+ private static Logger log = Logger.getLogger(LearningWebUtil.class);
//---------------------------------------------------------------------
// Class level constants - session attributes
//---------------------------------------------------------------------
- public static final String PARAM_PROGRESS_ID = "progressID";
-// public static final String POPUP_WINDOW_NAME = "LearnerActivity";
-// public static final String LEARNER_WINDOW_NAME = "lWindow";
-
+ public static final String PARAM_PROGRESS_ID = "progressID";
+
+ // public static final String POPUP_WINDOW_NAME = "LearnerActivity";
+ // public static final String LEARNER_WINDOW_NAME = "lWindow";
+
/**
- * Helper method to retrieve the user data. Gets the id from the user details
- * in the shared session
+ * Helper method to retrieve the user data. Gets the id from the user
+ * details in the shared session
+ *
* @return the user id
*/
- public static Integer getUserId()
- {
- HttpSession ss = SessionManager.getSession();
- UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
- return learner != null ? learner.getUserID() : null;
+ public static Integer getUserId() {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return learner != null ? learner.getUserID() : null;
}
-
+
/**
- * Helper method to retrieve the user data. Gets the id from the user details
- * in the shared session then retrieves the real user object.
+ * Helper method to retrieve the user data. Gets the id from the user
+ * details in the shared session then retrieves the real user object.
*/
- public static User getUser(ICoreLearnerService learnerService)
- {
- HttpSession ss = SessionManager.getSession();
- UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
- return learner != null ? (User)learnerService.getUserManagementService().findById(User.class,learner.getUserID()) : null;
+ public static User getUser(ICoreLearnerService learnerService) {
+ HttpSession ss = SessionManager.getSession();
+ UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ return learner != null ? (User) learnerService.getUserManagementService().findById(User.class,
+ learner.getUserID()) : null;
}
-
- /**
- * Put the learner progress in the request. This allows some optimisation between the
- * code that updates the progress and the next action which will access the progress.
- */
- public static void putLearnerProgressInRequest(HttpServletRequest request, LearnerProgress progress) {
- if ( progress != null ) {
- request.setAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE, progress);
- } else {
- request.removeAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE);
- }
+
+ /**
+ * Put the learner progress in the request. This allows some optimisation
+ * between the code that updates the progress and the next action which will
+ * access the progress.
+ */
+ public static void putLearnerProgressInRequest(HttpServletRequest request, LearnerProgress progress) {
+ if (progress != null) {
+ request.setAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE, progress);
+ } else {
+ request.removeAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE);
}
-
- /**
- * Get the current learner progress. Check the request - in some cases it may be there.
- *
- * If not, the learner progress id might be in the request (if we've just come from complete activity).
- * If so, get it from the db using the learner progress.
- *
- * If the learner progress id isn't available, then we have to look it up using activity
- * based on the activity / activity id in the request.
- */
- public static LearnerProgress getLearnerProgress(HttpServletRequest request, ICoreLearnerService learnerService) {
- LearnerProgress learnerProgress = (LearnerProgress)request.getAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE);
- if ( learnerProgress != null ) {
- if ( log.isDebugEnabled() ) {
- log.debug("getLearnerProgress: found progress in the request");
- }
- return learnerProgress;
+ }
+
+ /**
+ * Get the current learner progress. Check the request - in some cases it
+ * may be there.
+ *
+ * If not, the learner progress id might be in the request (if we've just
+ * come from complete activity). If so, get it from the db using the learner
+ * progress.
+ *
+ * If the learner progress id isn't available, then we have to look it up
+ * using activity based on the activity / activity id in the request.
+ */
+ public static LearnerProgress getLearnerProgress(HttpServletRequest request, ICoreLearnerService learnerService) {
+ LearnerProgress learnerProgress = (LearnerProgress) request
+ .getAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE);
+ if (learnerProgress != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("getLearnerProgress: found progress in the request");
+ }
+ return learnerProgress;
+ }
+
+ if (learnerProgress == null) {
+ Long learnerProgressId = WebUtil.readLongParam(request, LearningWebUtil.PARAM_PROGRESS_ID, true);
+ // temp hack until Flash side updates it call.
+ if (learnerProgressId == null) {
+ learnerProgressId = WebUtil.readLongParam(request, "progressId", true);
+ if (learnerProgressId != null)
+ log.warn("Flash client still using progressId, instead of progressID in a learner call");
+ }
+
+ if (learnerProgressId != null) {
+ learnerProgress = learnerService.getProgressById(new Long(learnerProgressId));
+ if (learnerProgress != null && log.isDebugEnabled()) {
+ log.debug("getLearnerProgress: found progress via progress id");
}
-
- if (learnerProgress == null)
- {
- Long learnerProgressId = WebUtil.readLongParam(request,LearningWebUtil.PARAM_PROGRESS_ID, true);
- // temp hack until Flash side updates it call.
- if ( learnerProgressId == null ) {
- learnerProgressId = WebUtil.readLongParam(request,"progressId", true);
- if ( learnerProgressId != null )
- log.warn("Flash client still using progressId, instead of progressID in a learner call");
- }
-
- if ( learnerProgressId != null ) {
- learnerProgress = learnerService.getProgressById(new Long(learnerProgressId));
- if ( learnerProgress != null && log.isDebugEnabled() ) {
- log.debug("getLearnerProgress: found progress via progress id");
- }
- }
-
- }
-
- if (learnerProgress == null)
- {
- Integer learnerId = getUserId();
- Activity act = getActivityFromRequest(request, learnerService);
- Lesson lesson = learnerService.getLessonByActivity(act);
- learnerProgress = learnerService.getProgress(learnerId, lesson.getLessonId());
- if ( learnerProgress != null && log.isDebugEnabled() ) {
- log.debug("getLearnerProgress: found progress via learner id and activity");
- }
- }
-
- putLearnerProgressInRequest(request, learnerProgress);
- return learnerProgress;
+ }
+
}
-
+
+ if (learnerProgress == null) {
+ Integer learnerId = getUserId();
+ Activity act = getActivityFromRequest(request, learnerService);
+ Lesson lesson = learnerService.getLessonByActivity(act);
+ learnerProgress = learnerService.getProgress(learnerId, lesson.getLessonId());
+ if (learnerProgress != null && log.isDebugEnabled()) {
+ log.debug("getLearnerProgress: found progress via learner id and activity");
+ }
+ }
+
+ putLearnerProgressInRequest(request, learnerProgress);
+ return learnerProgress;
+ }
+
/**
* Get the activity from request. We assume there is a parameter coming in
- * if there is no activity can be found in the http request. Then the
+ * if there is no activity can be found in the http request. Then the
* activity id parameter is used to retrieve from database.
+ *
* @param request
* @return
*/
- public static Activity getActivityFromRequest(HttpServletRequest request,
- ICoreLearnerService learnerService)
- {
- Activity activity = (Activity)request.getAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE);
-
- if(activity == null)
- {
- long activityId = WebUtil.readLongParam(request,AttributeNames.PARAM_ACTIVITY_ID);
-
- activity = learnerService.getActivity(new Long(activityId));
-
- if ( activity != null ) {
- // getActivityFromRequest() may be called multiple times, so make it quicker next time
- request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, activity);
- }
- }
- return activity;
+ public static Activity getActivityFromRequest(HttpServletRequest request, ICoreLearnerService learnerService) {
+ Activity activity = (Activity) request.getAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE);
+
+ if (activity == null) {
+ long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID);
+
+ activity = learnerService.getActivity(new Long(activityId));
+
+ if (activity != null) {
+ // getActivityFromRequest() may be called multiple times, so make it quicker next time
+ request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, activity);
+ }
+ }
+ return activity;
}
-
+
/**
- * Put an activity into the request. Calls LearnerService to get the activity, to ensure
- * that it is a "real" activity, not one of the cglib proxies.
- * activity.
+ * Put an activity into the request. Calls LearnerService to get the
+ * activity, to ensure that it is a "real" activity, not one of the cglib
+ * proxies. activity.
+ *
* @param request
* @param activity
*/
public static void putActivityInRequest(HttpServletRequest request, Activity activity,
- ICoreLearnerService learnerService)
- {
- if ( activity != null ) {
- Activity realActivity = learnerService.getActivity(activity.getActivityId());
- request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, realActivity);
- } else {
- request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, null);
- }
+ ICoreLearnerService learnerService) {
+ if (activity != null) {
+ Activity realActivity = learnerService.getActivity(activity.getActivityId());
+ request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, realActivity);
+ } else {
+ request.setAttribute(ActivityAction.ACTIVITY_REQUEST_ATTRIBUTE, null);
+ }
}
- /** "Complete" an activity from the web layer's perspective. Used for CompleteActivityAction and the Gate and Grouping actions.
- * Calls the learningService to actually complete the activity and progress.
- * @param redirect Should this call redirect to the next screen (true) or use a forward (false)
- * @param windowName Name of the window that triggered this code. Normally LearnerActivity (the popup window) or lWindow (normal learner window)
- * @throws UnsupportedEncodingException
- *
+ /**
+ * "Complete" an activity from the web layer's perspective. Used for
+ * CompleteActivityAction and the Gate and Grouping actions. Calls the
+ * learningService to actually complete the activity and progress.
+ *
+ * @param redirect
+ * Should this call redirect to the next screen (true) or use
+ * a forward (false)
+ * @param windowName
+ * Name of the window that triggered this code. Normally
+ * LearnerActivity (the popup window) or lWindow (normal
+ * learner window)
+ * @throws UnsupportedEncodingException
+ *
*/
public static ActionForward completeActivity(HttpServletRequest request, HttpServletResponse response,
- ActivityMapping actionMappings, LearnerProgress currentProgress, Activity currentActivity,
- Integer learnerId, ICoreLearnerService learnerService, boolean redirect) throws LearnerServiceException, UnsupportedEncodingException {
-
- LearnerProgress progress=currentProgress;
- Lesson lesson = progress.getLesson();
-
- if ( currentActivity == null ) {
- progress = learnerService.joinLesson(learnerId, lesson.getLessonId());
- } else if ( progress.getCompletedActivities().containsKey(currentActivity) ) {
- return actionMappings.getCloseForward(currentActivity, lesson.getLessonId());
- } else {
- // Set activity as complete
- progress = learnerService.completeActivity(learnerId, currentActivity,progress);
- }
-
- if ( currentActivity.isFloating() )
- return actionMappings.getCloseForward(currentActivity, lesson.getLessonId());
-
- LearningWebUtil.putActivityInRequest(request, progress.getNextActivity(), learnerService);
- LearningWebUtil.putLearnerProgressInRequest(request,progress);
- return actionMappings.getProgressForward(progress, redirect, false, request, learnerService);
+ ActivityMapping actionMappings, LearnerProgress currentProgress, Activity currentActivity,
+ Integer learnerId, ICoreLearnerService learnerService, boolean redirect) throws LearnerServiceException,
+ UnsupportedEncodingException {
+
+ LearnerProgress progress = currentProgress;
+ Lesson lesson = progress.getLesson();
+
+ if (currentActivity == null) {
+ progress = learnerService.joinLesson(learnerId, lesson.getLessonId());
+ } else if (progress.getCompletedActivities().containsKey(currentActivity)) {
+ return actionMappings.getCloseForward(currentActivity, lesson.getLessonId());
+ } else {
+ // Set activity as complete
+ progress = learnerService.completeActivity(learnerId, currentActivity, progress);
+ }
+
+ if (currentActivity != null && currentActivity.isFloating())
+ return actionMappings.getCloseForward(currentActivity, lesson.getLessonId());
+
+ LearningWebUtil.putActivityInRequest(request, progress.getNextActivity(), learnerService);
+ LearningWebUtil.putLearnerProgressInRequest(request, progress);
+ return actionMappings.getProgressForward(progress, redirect, false, request, learnerService);
}
-
- /**
- * Get the ActionMappings.
- */
- public static ActivityMapping getActivityMapping(ServletContext context) {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
- return (ActivityMapping)wac.getBean("activityMapping");
+
+ /**
+ * Get the ActionMappings.
+ */
+ public static ActivityMapping getActivityMapping(ServletContext context) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
+ return (ActivityMapping) wac.getBean("activityMapping");
+ }
+
+ /** Setup the progress string, version and lesson id in the activityForm. */
+ public static void setupProgressInRequest(ActivityForm activityForm, HttpServletRequest request,
+ LearnerProgress learnerProgress) {
+
+ putLearnerProgressInRequest(request, learnerProgress);
+
+ // Calculate the progress summary. On join this method gets called twice, and we
+ // only want to calculate once
+ String progressSummary = activityForm.getProgressSummary();
+ if (progressSummary == null) {
+ progressSummary = getProgressSummary(learnerProgress);
+ activityForm.setProgressSummary(progressSummary);
}
-
- /** Setup the progress string, version and lesson id in the activityForm. */
- public static void setupProgressInRequest(ActivityForm activityForm, HttpServletRequest request, LearnerProgress learnerProgress) {
-
- putLearnerProgressInRequest(request, learnerProgress);
-
- // Calculate the progress summary. On join this method gets called twice, and we
- // only want to calculate once
- String progressSummary = activityForm.getProgressSummary();
- if ( progressSummary == null ) {
- progressSummary = getProgressSummary(learnerProgress);
- activityForm.setProgressSummary(progressSummary);
- }
-
- Lesson currentLesson = learnerProgress.getLesson();
- if(currentLesson != null){
- activityForm.setLessonID(currentLesson.getLessonId());
-
- LearningDesign currentDesign = currentLesson.getLearningDesign();
- if(currentDesign != null)
- activityForm.setVersion(currentDesign.getDesignVersion());
- }
-
-
- if(log.isDebugEnabled())
- log.debug("Entering activity: progress summary is "+activityForm.getProgressSummary());
-
+
+ Lesson currentLesson = learnerProgress.getLesson();
+ if (currentLesson != null) {
+ activityForm.setLessonID(currentLesson.getLessonId());
+
+ LearningDesign currentDesign = currentLesson.getLearningDesign();
+ if (currentDesign != null)
+ activityForm.setVersion(currentDesign.getDesignVersion());
}
-
- /** Setup the progress string, version and lesson id in the actionForm. The values will go in the map with the
- * keys "progressSummary", "lessonID", "version". */
- public static void setupProgressInRequest(DynaActionForm actionForm, HttpServletRequest request, LearnerProgress learnerProgress) {
-
- putLearnerProgressInRequest(request, learnerProgress);
- // Calculate the progress summary. On join this method gets called twice, and we
- // only want to calculate once
- String progressSummary = (String) actionForm.get("progressSummary");
- if ( progressSummary == null ) {
- progressSummary = getProgressSummary(learnerProgress);
- actionForm.set("progressSummary",progressSummary);
- }
-
- Lesson currentLesson = learnerProgress.getLesson();
- if(currentLesson != null){
- actionForm.set("lessonID",currentLesson.getLessonId());
-
- LearningDesign currentDesign = currentLesson.getLearningDesign();
- if(currentDesign != null)
- actionForm.set("version",currentDesign.getDesignVersion());
- }
-
-
- if(log.isDebugEnabled())
- log.debug("Entering activity: progress summary is "+actionForm.get("progressSummary"));
-
+ if (log.isDebugEnabled())
+ log.debug("Entering activity: progress summary is " + activityForm.getProgressSummary());
+
+ }
+
+ /**
+ * Setup the progress string, version and lesson id in the actionForm. The
+ * values will go in the map with the keys "progressSummary", "lessonID",
+ * "version".
+ */
+ public static void setupProgressInRequest(DynaActionForm actionForm, HttpServletRequest request,
+ LearnerProgress learnerProgress) {
+
+ putLearnerProgressInRequest(request, learnerProgress);
+
+ // Calculate the progress summary. On join this method gets called twice, and we
+ // only want to calculate once
+ String progressSummary = (String) actionForm.get("progressSummary");
+ if (progressSummary == null) {
+ progressSummary = getProgressSummary(learnerProgress);
+ actionForm.set("progressSummary", progressSummary);
}
- private static String getProgressSummary(LearnerProgress learnerProgress) {
- StringBuffer progressSummary = new StringBuffer(100);
- if ( learnerProgress == null ) {
- progressSummary.append("attempted=&completed=¤t=");
- progressSummary.append("&lessonID=");
- Lesson currentLesson = learnerProgress.getLesson();
- if(currentLesson != null){
- progressSummary.append(currentLesson.getLessonId());
- }
+ Lesson currentLesson = learnerProgress.getLesson();
+ if (currentLesson != null) {
+ actionForm.set("lessonID", currentLesson.getLessonId());
+
+ LearningDesign currentDesign = currentLesson.getLearningDesign();
+ if (currentDesign != null)
+ actionForm.set("version", currentDesign.getDesignVersion());
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("Entering activity: progress summary is " + actionForm.get("progressSummary"));
+
+ }
+
+ private static String getProgressSummary(LearnerProgress learnerProgress) {
+ StringBuffer progressSummary = new StringBuffer(100);
+ if (learnerProgress == null) {
+ progressSummary.append("attempted=&completed=¤t=");
+ progressSummary.append("&lessonID=");
+ Lesson currentLesson = learnerProgress.getLesson();
+ if (currentLesson != null) {
+ progressSummary.append(currentLesson.getLessonId());
+ }
+ } else {
+ progressSummary.append("attempted=");
+ boolean first = true;
+ for (Object obj : learnerProgress.getAttemptedActivities().keySet()) {
+ Activity activity = (Activity) obj;
+ if (!first) {
+ progressSummary.append("_");
} else {
- progressSummary.append("attempted=");
- boolean first = true;
- for (Object obj : learnerProgress.getAttemptedActivities().keySet()) {
- Activity activity = (Activity ) obj;
- if ( ! first ) {
- progressSummary.append("_");
- } else {
- first = false;
- }
- progressSummary.append(activity.getActivityId());
- }
-
- progressSummary.append("&completed=");
- first = true;
- for ( Object obj : learnerProgress.getCompletedActivities().keySet() ) {
- Activity activity = (Activity ) obj;
- if ( ! first ) {
- progressSummary.append("_");
- } else {
- first = false;
- }
- progressSummary.append(activity.getActivityId());
- }
+ first = false;
+ }
+ progressSummary.append(activity.getActivityId());
+ }
- progressSummary.append("¤t=");
- Activity currentActivity = learnerProgress.getCurrentActivity();
- if ( currentActivity != null ) {
- progressSummary.append(currentActivity.getActivityId());
- }
-
+ progressSummary.append("&completed=");
+ first = true;
+ for (Object obj : learnerProgress.getCompletedActivities().keySet()) {
+ Activity activity = (Activity) obj;
+ if (!first) {
+ progressSummary.append("_");
+ } else {
+ first = false;
}
- return progressSummary.toString();
+ progressSummary.append(activity.getActivityId());
+ }
+
+ progressSummary.append("¤t=");
+ Activity currentActivity = learnerProgress.getCurrentActivity();
+ if (currentActivity != null) {
+ progressSummary.append(currentActivity.getActivityId());
+ }
+
}
+ return progressSummary.toString();
+ }
- public static ActivityURL getActivityURL( ActivityMapping activityMapping, LearnerProgress learnerProgress, Activity activity, boolean defaultURL, boolean isFloating) {
- ActivityURL activityURL = new ActivityURL();
- String url = activityMapping.getActivityURL(activity);
- activityURL.setUrl(url);
- activityURL.setActivityId(activity.getActivityId());
- activityURL.setTitle(activity.getTitle());
- activityURL.setDescription(activity.getDescription());
-
- byte status = learnerProgress.getProgressState(activity);
- activityURL.setStatus(status);
- if ( status == LearnerProgress.ACTIVITY_COMPLETED) {
- activityURL.setComplete(true);
- }
- activityURL.setFloating(isFloating);
- activityURL.setDefaultURL(defaultURL);
- return activityURL;
+ public static ActivityURL getActivityURL(ActivityMapping activityMapping, LearnerProgress learnerProgress,
+ Activity activity, boolean defaultURL, boolean isFloating) {
+ ActivityURL activityURL = new ActivityURL();
+ String url = activityMapping.getActivityURL(activity);
+ activityURL.setUrl(url);
+ activityURL.setActivityId(activity.getActivityId());
+ activityURL.setTitle(activity.getTitle());
+ activityURL.setDescription(activity.getDescription());
+
+ byte status = learnerProgress.getProgressState(activity);
+ activityURL.setStatus(status);
+ if (status == LearnerProgress.ACTIVITY_COMPLETED) {
+ activityURL.setComplete(true);
}
+ activityURL.setFloating(isFloating);
+ activityURL.setDefaultURL(defaultURL);
+ return activityURL;
+ }
}
Index: lams_learning/web/WEB-INF/tags/AuthoringButton.tag
===================================================================
diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8)
+++ lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -1,93 +1,93 @@
-<%
-/****************************************************************
- * 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" %>
-
-<%@ 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 --%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+<%
+/****************************************************************
+ * 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" %>
+
+<%@ 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_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java
===================================================================
diff -u -rd9f9e33ff90f8ff1a0077688ad3ee5dbc233c209 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java (.../MonitoringConstants.java) (revision d9f9e33ff90f8ff1a0077688ad3ee5dbc233c209)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/MonitoringConstants.java (.../MonitoringConstants.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -48,4 +48,5 @@
public static final String KEY_GROUP_ORDER_ID = "orderID";
public static final String KEY_GROUP_LEARNERS = "learners";
public static final Object KEY_USERS = "users";
+ public static final String PARAM_SCHEDULE_TIME_ZONE_IDX = "scheduleTimeZoneIdx";
}
Index: lams_monitoring/web/WEB-INF/web.xml
===================================================================
diff -u -re851ecbb7a28dba597688df7f4466b2ab603405c -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_monitoring/web/WEB-INF/web.xml (.../web.xml) (revision e851ecbb7a28dba597688df7f4466b2ab603405c)
+++ lams_monitoring/web/WEB-INF/web.xml (.../web.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -5,20 +5,24 @@
javax.servlet.jsp.jstl.fmt.localizationContextorg.lamsfoundation.lams.monitoring.ApplicationResources
+
+ messageSource
+ monitoringMessageSource
+
+
+contextConfigLocation
-
- classpath:/org/lamsfoundation/lams/applicationContext.xml
- classpath:/org/lamsfoundation/lams/lesson/lessonApplicationContext.xml
- classpath:/org/lamsfoundation/lams/toolApplicationContext.xml
- classpath:/org/lamsfoundation/lams/learning/learningApplicationContext.xml
- classpath:/org/lamsfoundation/lams/authoring/authoringApplicationContext.xml
- classpath:/org/lamsfoundation/lams/workspace/workspaceApplicationContext.xml
- classpath:/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml
- classpath:/org/lamsfoundation/lams/contentrepository/applicationContext.xml
-
-
+
+
+ locatorFactorySelector
+ classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+
+
+ parentContextKey
+ context.central
+SystemSessionFilter
@@ -67,6 +71,11 @@
org.springframework.web.context.ContextLoaderListener
+
+
+ org.lamsfoundation.lams.web.session.SetMaxTimeoutListener
+
+initializeLesson
@@ -79,6 +88,11 @@
+ initializeAndCreateLessons
+ org.lamsfoundation.lams.monitoring.web.InitializeAndCreateLessonsServlet
+
+
+ branchingExportPortfolioorg.lamsfoundation.lams.monitoring.web.BranchingExportPortfolioServlet
@@ -135,6 +149,10 @@
/monitoring/performChosenGrouping
+ initializeAndCreateLessons
+ /initializeAndCreateLessons
+
+ branchingExportPortfolio/branchingExportPortfolio
@@ -151,6 +169,10 @@
/createLessonClass
+
+ 120
+
+
\ No newline at end of file
Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddModuleToApplicationXmlTask.java
===================================================================
diff -u -rc4aa762e8a0657466906e592c0847747a148b6fe -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddModuleToApplicationXmlTask.java (.../AddModuleToApplicationXmlTask.java) (revision c4aa762e8a0657466906e592c0847747a148b6fe)
+++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/AddModuleToApplicationXmlTask.java (.../AddModuleToApplicationXmlTask.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -55,7 +55,7 @@
}
/**
- * Add the given web app to the application.xml file
+ * Add the given module to the application.xml file
* @param args
* @throws Exception
*/
Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/CreatePackageTask.java
===================================================================
diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/CreatePackageTask.java (.../CreatePackageTask.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf)
+++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/CreatePackageTask.java (.../CreatePackageTask.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -38,154 +38,184 @@
import org.apache.tools.ant.DynamicConfigurator;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
+
/**
* @author mtruong, Original design by Fiona Malikoff
- *
+ *
* Parent class to all tasks related to the creation of the deployment package.
*
*/
-public abstract class CreatePackageTask extends Task implements DynamicConfigurator {
-
- public static final String MODE = "mode";
- public static final String MODE_DEVELOPMENT = "development";
- public static final String MODE_PRODUCTION = "production";
-
- public static final String CONFIG_FILE = "configFile";
- public static final String OUTPUT_PATH = "outputPath";
- public static final String SCRIPT_PATH = "scriptPath";
-
- protected DeployConfig deployConfig;
-
- private Properties inputProperties;
- private Properties deployProperties;
-
- // private static String defaultFilename = "templateDeployTool.xml";
- private static String outputFilename = "deploy.xml";
-
- /* Ant Task Attributes */
- public String mode = MODE_PRODUCTION;
- public File outputPath = null;
- public File configFile = null;
-
- /* Dependent on outputPath, and set when outputPath is set */
- private File outputPathLib = null;
- private File outputPathSql = null;
+public abstract class CreatePackageTask extends Task implements
+ DynamicConfigurator {
- public CreatePackageTask()
- {
- super();
- deployConfig = null;
- deployProperties = null;
- inputProperties = new Properties();
- }
-
- /* ************** Dynamic Configurator Methods *****************************/
- public void setDynamicAttribute(String name, String value) {
- inputProperties.setProperty(name, value);
- }
-
- public Object createDynamicElement(String name) throws BuildException {
- throw new BuildException("CreatePackage does not support elements");
- }
-
- public abstract void execute();
-
- /**
- * add the ant defined properties to deployConfig
- */
- protected void applyParameters() {
+ public static final String MODE = "mode";
+ public static final String MODE_DEVELOPMENT = "development";
+ public static final String MODE_PRODUCTION = "production";
- log("Applying task properties");
-
- Iterator iter = inputProperties.keySet().iterator();
- while ( iter.hasNext() ) {
- String key = (String) iter.next();
- // any keys not known to the deployConfig are ignored, so it doesn't matter if we pass mode, etc.
- // The only vectors will be filesets.
- deployConfig.setProperty(key, (String) inputProperties.getProperty(key));
- }
- }
+ public static final String CONFIG_FILE = "configFile";
+ public static final String OUTPUT_PATH = "outputPath";
+ public static final String SCRIPT_PATH = "scriptPath";
- protected void applyFilesets(String key, Vector filesets) {
- ArrayList filenames = new ArrayList();
- for ( FileSet fileset : filesets) {
- DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
- String[] files = ds.getIncludedFiles();
- for ( String filename: files ) {
- filenames.add(ds.getBasedir()+File.separator+filename);
- }
- }
-
- deployConfig.setFilenames(key, filenames);
- }
+ protected DeployConfig deployConfig;
- protected void createDirectory(File dir) {
- if ( dir.exists() ) {
- if ( ! dir.isDirectory() ) {
- throw new BuildException("Unable to write out deploy.properties - path "
- +dir+" exists but is not a directory.");
- }
- if ( ! dir.canWrite() ) {
- throw new BuildException("Unable to write out deploy.properties - path "
- +dir+" exists but is read only.");
- }
- } else {
- dir.mkdirs();
- }
- }
-
- /**
- * @param deployConfig
- */
- protected void writeConfigFile() throws IOException {
-
- String outputName = outputPath+File.separator+outputFilename;
-
- BufferedWriter out=null;
- try {
- out = new BufferedWriter(new FileWriter(outputName));
- deployConfig.writePropertiesToFile(out);
- } catch (Exception e) {
- throw new BuildException("Unable to write out "
- +outputName+". Error "+e.getMessage(),e);
- }
- log("File "+outputName+" written.");
- out.close();
- }
+ private Properties inputProperties;
+ private Properties deployProperties;
- /* private URL getTemplateDeployName() {
- URL url = CreatePackageTask_original.class.getResource(defaultFilename);
- return url;
- } */
-
- /**
- * @param configFile The configFile to set.
- */
- public void setConfigFile(File configFile) {
- this.configFile = configFile;
- }
- /**
- * @param mode The mode to set.
- */
- public void setMode(String mode) {
- this.mode = mode;
- }
- /**
- * @param outputPath The outputPath to set.
- */
- public void setOutputPath(File outputPath) {
- this.outputPath = outputPath;
- if ( outputPath != null ) {
- this.outputPathLib = new File(outputPath.getAbsoluteFile()+File.separator+"lib");
- this.outputPathSql = new File(outputPath.getAbsoluteFile()+File.separator+"sql");
- } else {
- this.outputPathLib = null;
- this.outputPathSql = null;
- }
- }
-
-
-
-
+ // private static String defaultFilename = "templateDeployTool.xml";
+ private static String outputFilename = "deploy.xml";
+ private static String templateFileName = "deploy_template.xml";
+ /* Ant Task Attributes */
+ public String mode = MODE_PRODUCTION;
+ public File outputPath = null;
+ public File configFile = null;
+
+ /* Dependent on outputPath, and set when outputPath is set */
+ private File outputPathLib = null;
+ private File outputPathSql = null;
+
+ public CreatePackageTask() {
+ super();
+ deployConfig = null;
+ deployProperties = null;
+ inputProperties = new Properties();
+ }
+
+ /* ************** Dynamic Configurator Methods **************************** */
+ public void setDynamicAttribute(String name, String value) {
+ inputProperties.setProperty(name, value);
+ }
+
+ public Object createDynamicElement(String name) throws BuildException {
+ throw new BuildException("CreatePackage does not support elements");
+ }
+
+ public abstract void execute();
+
+ /**
+ * add the ant defined properties to deployConfig
+ */
+ protected void applyParameters() {
+
+ log("Applying task properties");
+
+ Iterator iter = inputProperties.keySet().iterator();
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ // any keys not known to the deployConfig are ignored, so it doesn't
+ // matter if we pass mode, etc.
+ // The only vectors will be filesets.
+ deployConfig.setProperty(key, (String) inputProperties
+ .getProperty(key));
+ }
+ }
+
+ protected void applyFilesets(String key, Vector filesets) {
+ ArrayList filenames = new ArrayList();
+ for (FileSet fileset : filesets) {
+ DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
+ String[] files = ds.getIncludedFiles();
+ for (String filename : files) {
+ filenames.add(ds.getBasedir() + File.separator + filename);
+ }
+ }
+
+ deployConfig.setFilenames(key, filenames);
+ }
+
+ protected void createDirectory(File dir) {
+ if (dir.exists()) {
+ if (!dir.isDirectory()) {
+ throw new BuildException(
+ "Unable to write out deploy.properties - path " + dir
+ + " exists but is not a directory.");
+ }
+ if (!dir.canWrite()) {
+ throw new BuildException(
+ "Unable to write out deploy.properties - path " + dir
+ + " exists but is read only.");
+ }
+ } else {
+ dir.mkdirs();
+ }
+ }
+
+ /**
+ * @param deployConfig
+ */
+ protected void writeConfigFile() throws IOException {
+
+ String outputName = outputPath + File.separator + outputFilename;
+
+ BufferedWriter out = null;
+ try {
+ out = new BufferedWriter(new FileWriter(outputName));
+ deployConfig.writePropertiesToFile(out);
+ } catch (Exception e) {
+ throw new BuildException("Unable to write out " + outputName
+ + ". Error " + e.getMessage(), e);
+ }
+ log("File " + outputName + " written.");
+ out.close();
+
+ // Writing the template file for tools
+ BufferedWriter out2 = null;
+ try {
+ if (deployConfig instanceof DeployToolConfig) {
+ DeployToolConfig deployToolConfig = (DeployToolConfig) deployConfig;
+ deployToolConfig.setGenerateForInstallers(true);
+ deployToolConfig.convertForInstallers();
+ String outputName2 = outputPath + File.separator
+ + templateFileName;
+
+ out2 = new BufferedWriter(new FileWriter(outputName2));
+ deployToolConfig.writePropertiesToFile(out2);
+ log("File " + outputName2 + " written.");
+ }
+ } catch (Exception e) {
+
+ } finally {
+ out.close();
+ }
+ }
+
+ /*
+ * private URL getTemplateDeployName() { URL url =
+ * CreatePackageTask_original.class.getResource(defaultFilename); return
+ * url; }
+ */
+
+ /**
+ * @param configFile
+ * The configFile to set.
+ */
+ public void setConfigFile(File configFile) {
+ this.configFile = configFile;
+ }
+
+ /**
+ * @param mode
+ * The mode to set.
+ */
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
+ /**
+ * @param outputPath
+ * The outputPath to set.
+ */
+ public void setOutputPath(File outputPath) {
+ this.outputPath = outputPath;
+ if (outputPath != null) {
+ this.outputPathLib = new File(outputPath.getAbsoluteFile()
+ + File.separator + "lib");
+ this.outputPathSql = new File(outputPath.getAbsoluteFile()
+ + File.separator + "sql");
+ } else {
+ this.outputPathLib = null;
+ this.outputPathSql = null;
+ }
+ }
+
}
Index: lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveModuleFromApplicationXmlTask.java
===================================================================
diff -u -r2fe3031016f4bc473032ce3f6f08d9ea4ab641e3 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveModuleFromApplicationXmlTask.java (.../RemoveModuleFromApplicationXmlTask.java) (revision 2fe3031016f4bc473032ce3f6f08d9ea4ab641e3)
+++ lams_tool_deploy/src/java/org/lamsfoundation/lams/tool/deploy/RemoveModuleFromApplicationXmlTask.java (.../RemoveModuleFromApplicationXmlTask.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -19,7 +19,7 @@
public static void main(String[] args) throws Exception
{
- if ((args.length < 1) || (args[0] == null))
+ if ((args.length < 2) || (args[0] == null))
{
throw new IllegalArgumentException("Usage: RemoveModuleFromApplicationXmlTask ");
}
@@ -28,7 +28,7 @@
System.out.println("Attempting to update " + args[0] + "\\META-INF\\application.xml");
RemoveModuleFromApplicationXmlTask remModAppTask = new RemoveModuleFromApplicationXmlTask();
remModAppTask.setLamsEarPath(args[0]);
- remModAppTask.setModule("ehcache-1.1.jar");
+ remModAppTask.setModule(args[1]);
remModAppTask.execute();
System.out.println("application.xml update completed");
}
Index: lams_tool_dimdim/conf/xdoclet/web-settings.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_dimdim/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_dimdim/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -5,13 +5,17 @@
org.lamsfoundation.lams.tool.dimdim.ApplicationResources
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/dimdim/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
Index: lams_tool_forum/build.xml
===================================================================
diff -u -r10f17eaf12892fe30d780538f96999dd27eb8d84 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/build.xml (.../build.xml) (revision 10f17eaf12892fe30d780538f96999dd27eb8d84)
+++ lams_tool_forum/build.xml (.../build.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -102,11 +102,14 @@
+
Index: lams_tool_forum/conf/xdoclet/web-settings.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_forum/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -9,13 +9,17 @@
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/forum/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20081118_updateFrom22.sql
===================================================================
diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20081118_updateFrom22.sql (.../patch20081118_updateFrom22.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/dbupdates/patch20081118_updateFrom22.sql (.../patch20081118_updateFrom22.sql) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -7,6 +7,21 @@
UPDATE lams_tool SET pedagogical_planner_url='tool/lafrum11/authoring/initPedagogicalPlannerForm.do' WHERE tool_signature='lafrum11';
+-- timestamp table
+create table tl_lafrum11_timestamp (
+ uid BIGINT(20) not null auto_increment,
+ message_uid BIGINT(20) not null,
+ timestamp_date DATETIME not null,
+ forum_user_uid BIGINT(20) not null,
+ primary key (`uid`),
+ unique key `uid` (`uid`),
+ key `message_uid` (`message_uid`),
+ key `forum_user_uid` (`forum_user_uid`)
+)TYPE=InnoDB;
+
+alter table tl_lafrum11_timestamp add index ForumUserFK (forum_user_uid), add constraint ForumUserFK foreign key (forum_user_uid) references tl_lafrum11_forum_user (uid);
+alter table tl_lafrum11_timestamp add index MessageFK (message_uid), add constraint MessageFK foreign key (message_uid) references tl_lafrum11_message (uid);
+
----------------------Put all sql statements above here-------------------------
-- If there were no errors, commit and restore autocommit to on
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/forumApplicationContext.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/forumApplicationContext.xml (.../forumApplicationContext.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/forumApplicationContext.xml (.../forumApplicationContext.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -130,6 +130,9 @@
+
+
+ 0) {
+ return ((Number) list.get(0)).intValue();
+ } else {
+ return 0;
}
-
- public int getNumOfPostsByTopic(Long userID, Long topicID) {
- List list = this.getHibernateTemplate().find(SQL_QUERY_NUM_POSTS_BY_TOPIC, new Object[]{userID,topicID});
- if(list != null && list.size() > 0)
- return ((Number)list.get(0)).intValue();
- else
- return 0;
- }
+ }
-
}
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java
===================================================================
diff -u -rb5af051561cba50d0c72d74c66a19e7e9e403396 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision b5af051561cba50d0c72d74c66a19e7e9e403396)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/service/ForumService.java (.../ForumService.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -56,6 +56,7 @@
import org.lamsfoundation.lams.contentrepository.service.IRepositoryService;
import org.lamsfoundation.lams.contentrepository.service.SimpleCredentials;
import org.lamsfoundation.lams.events.IEventNotificationService;
+import org.lamsfoundation.lams.gradebook.service.IGradebookService;
import org.lamsfoundation.lams.learning.service.ILearnerService;
import org.lamsfoundation.lams.learningdesign.service.ExportToolContentException;
import org.lamsfoundation.lams.learningdesign.service.IExportToolContentService;
@@ -120,7 +121,7 @@
private AttachmentDao attachmentDao;
private MessageDao messageDao;
-
+
private TimestampDao timestampDao;
private MessageSeqDao messageSeqDao;
@@ -152,6 +153,8 @@
private ForumOutputFactory forumOutputFactory;
+ private IGradebookService gradebookService;
+
private IEventNotificationService eventNotificationService;
private Random generator = new Random();
@@ -247,7 +250,7 @@
MessageSeq msgSeq = messageSeqDao.getByTopicId(message.getUid());
Message root = msgSeq.getRootMessage();
// update reply date
- //messageDao.saveOrUpdate(root); // do not update date of root posting
+ // messageDao.saveOrUpdate(root); // do not update date of root posting
return message;
}
@@ -329,7 +332,7 @@
root.setLastReplyDate(new Date());
// update reply message number for root
root.setReplyNumber(root.getReplyNumber() + 1);
- //messageDao.saveOrUpdate(root); // do not update the date of root posting
+ // messageDao.saveOrUpdate(root); // do not update the date of root posting
return replyMessage;
}
@@ -538,6 +541,7 @@
}
}
messageDao.saveOrUpdate(msg);
+
}
if (notifyLearnersOnMarkRelease) {
notificationMessageParameters = new Object[1];
@@ -546,9 +550,18 @@
getEventNotificationService().triggerForSingleUser(ForumConstants.TOOL_SIGNATURE,
ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(), userID,
notificationMessageParameters);
+
}
}
+ List users = getUsersBySessionId(sessionID);
+ if (users != null) {
+ for (ForumUser user : users) {
+ // send marks to gradebook where applicable
+ sendMarksToGradebook(user, sessionID);
+ }
+ }
+
// update session to set MarkRelease flag.
session.setMarkReleased(true);
forumToolSessionDao.saveOrUpdate(session);
@@ -1102,7 +1115,9 @@
}
- /** Set the description, throws away the title value as this is not supported in 2.0 */
+ /**
+ * 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 {
@@ -1116,6 +1131,33 @@
toolContentObj.setReflectInstructions(description);
}
+ /**
+ * Sends marks straight to gradebook from a forum report
+ *
+ * @param user
+ * @param toolSessionID
+ */
+ @SuppressWarnings("unchecked")
+ public void sendMarksToGradebook(ForumUser user, Long toolSessionID) {
+
+ List messages = getMessagesByUserUid(user.getUid(), toolSessionID);
+ if (messages != null) {
+ Float totalMark = null;
+ for (MessageDTO message : messages) {
+ if (totalMark == null) {
+ totalMark = message.getMark();
+ } else if (message.getMark() != null) {
+ totalMark += message.getMark();
+ }
+ }
+ if (totalMark != null) {
+ Double mark = new Double(totalMark);
+ gradebookService.updateActivityMark(mark, null, user.getUserId().intValue(), toolSessionID, false);
+ }
+ }
+
+ }
+
// ***************************************************************************************************************
// Get / Set methods
// ***************************************************************************************************************
@@ -1142,13 +1184,13 @@
public void setForumDao(ForumDao forumDao) {
this.forumDao = forumDao;
}
-
+
public TimestampDao getTimestampDao() {
- return timestampDao;
+ return timestampDao;
}
public void setTimestampDao(TimestampDao timestampDao) {
- this.timestampDao = timestampDao;
+ this.timestampDao = timestampDao;
}
public MessageDao getMessageDao() {
@@ -1251,6 +1293,10 @@
return messageService.getMessage(key, args);
}
+ public void setGradebookService(IGradebookService gradebookService) {
+ this.gradebookService = gradebookService;
+ }
+
/**
* {@inheritDoc}
*/
@@ -1267,47 +1313,47 @@
} while (uniqueNumber == null);
return getForumOutputFactory().buildTextSearchConditionName(uniqueNumber);
}
-
+
/**
* Get number of new postings.
*
* @param messageId
* @param userId
- * @return
+ * @return
*/
public int getNewMessagesNum(Long messageId, Long userId) {
return timestampDao.getNewMessagesNum(messageId, userId);
}
-
+
/**
* Get last topic date.
*
* @param messageId
- * @return
+ * @return
*/
public Date getLastTopicDate(Long messageId) {
return messageDao.getLastTopicDate(messageId);
}
-
+
/**
* Get timestamp.
*
* @param messageId
* @param forumUserId
- * @return
+ * @return
*/
public Timestamp getTimestamp(Long MessageId, Long forumUserId) throws PersistenceException {
return timestampDao.getTimestamp(MessageId, forumUserId);
}
-
+
/**
* Save timestamp.
*
* @param timestamp
- * @return
+ * @return
*/
public void saveTimestamp(Timestamp timestamp) {
timestampDao.saveOrUpdate(timestamp);
}
-
+
}
\ No newline at end of file
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java
===================================================================
diff -u -r59e4b8d442ec5f40e2e7a5bef1bda2059953b59a -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java (.../ForumConstants.java) (revision 59e4b8d442ec5f40e2e7a5bef1bda2059953b59a)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/util/ForumConstants.java (.../ForumConstants.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -24,6 +24,8 @@
/* $$Id$$ */
package org.lamsfoundation.lams.tool.forum.util;
+import java.util.regex.Pattern;
+
/**
* User: conradb Date: 14/06/2005 Time: 10:33:00
*/
@@ -140,7 +142,7 @@
public static final String ATTR_REFLECTION_INSTRUCTION = "reflectInstructions";
public static final String ATTR_REFLECTION_ENTRY = "reflectEntry";
-
+
public static final String ATTR_MINIMUM_REPLY = "minimumReply";
public static final String ATTR_MAXIMUM_REPLY = "maximumReply";
@@ -167,4 +169,10 @@
// a forward key
public static final String SUCCESS = "success";
-}
+ public static final String WORD_REGEX = "\\w+";
+
+ public static final short SUBJECT_WORD_COUNT = 3;
+
+ public static final int PATTERN_MATCHING_OPTIONS = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE
+ | Pattern.MULTILINE;
+}
\ No newline at end of file
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java
===================================================================
diff -u -r8a0ce21a725377050cc155f9edb0edad71ac2fd4 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 8a0ce21a725377050cc155f9edb0edad71ac2fd4)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -37,6 +37,8 @@
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -1107,21 +1109,46 @@
ActionMessages errors = plannerForm.validate();
if (errors.isEmpty()) {
Forum forum = getForumManager().getForumByContentId(plannerForm.getToolContentID());
+ forum.setInstructions(plannerForm.getInstructions());
int topicIndex = 0;
String topic = null;
+ String subject = null;
Message message = null;
List newTopics = new LinkedList();
Iterator forumTopicIterator = forum.getMessages().iterator();
+ Pattern regexPattern = Pattern.compile(ForumConstants.WORD_REGEX, ForumConstants.PATTERN_MATCHING_OPTIONS);
+
+ Matcher matcher = null;
+
do {
topic = plannerForm.getTopic(topicIndex);
+ subject = WebUtil.removeHTMLtags(topic);
+
+ // Getting 3 first words from body and making the subject out of it
+ if (StringUtils.isBlank(subject)) {
+ subject = null;
+ } else {
+ matcher = regexPattern.matcher(subject);
+ int currentEnd = subject.length();
+ for (short wordIndex = 0; wordIndex < ForumConstants.SUBJECT_WORD_COUNT; wordIndex++) {
+ if (matcher.find()) {
+ currentEnd = matcher.end();
+ } else {
+ break;
+ }
+ }
+ subject = subject.substring(0, currentEnd).concat("...");
+ }
+
if (StringUtils.isEmpty(topic)) {
plannerForm.removeTopic(topicIndex);
} else {
if (forumTopicIterator.hasNext()) {
message = forumTopicIterator.next();
message.setUpdated(new Date());
- message.setSubject(topic);
+ message.setSubject(subject);
+ message.setBody(topic);
} else {
message = new Message();
message.setIsAuthored(true);
@@ -1136,7 +1163,8 @@
message.setCreatedBy(forumUser);
message.setModifiedBy(forumUser);
- message.setSubject(topic);
+ message.setSubject(subject);
+ message.setBody(topic);
newTopics.add(message);
message.setForum(forum);
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java
===================================================================
diff -u -r59e4b8d442ec5f40e2e7a5bef1bda2059953b59a -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision 59e4b8d442ec5f40e2e7a5bef1bda2059953b59a)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/LearningAction.java (.../LearningAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -47,7 +47,6 @@
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
-import org.hibernate.Session;
import org.lamsfoundation.lams.events.IEventNotificationService;
import org.lamsfoundation.lams.notebook.model.NotebookEntry;
import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants;
@@ -64,7 +63,6 @@
import org.lamsfoundation.lams.tool.forum.persistence.Message;
import org.lamsfoundation.lams.tool.forum.persistence.PersistenceException;
import org.lamsfoundation.lams.tool.forum.persistence.Timestamp;
-import org.lamsfoundation.lams.tool.forum.service.ForumService;
import org.lamsfoundation.lams.tool.forum.service.ForumServiceProxy;
import org.lamsfoundation.lams.tool.forum.service.IForumService;
import org.lamsfoundation.lams.tool.forum.util.ForumConstants;
@@ -82,955 +80,946 @@
* User: conradb Date: 24/06/2005 Time: 10:54:09
*/
public class LearningAction extends Action {
- private static Logger log = Logger.getLogger(LearningAction.class);
+ private static Logger log = Logger.getLogger(LearningAction.class);
- private static final boolean MODE_OPTIONAL = false;
+ private static final boolean MODE_OPTIONAL = false;
- private IForumService forumService;
+ private IForumService forumService;
- @Override
- public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- String param = mapping.getParameter();
- // --------------Forum Level ------------------
- if (param.equals("viewForum")) {
- return viewForum(mapping, form, request, response);
- }
- if (param.equals("finish")) {
- return finish(mapping, form, request, response);
- }
+ @Override
+ public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ String param = mapping.getParameter();
+ // --------------Forum Level ------------------
+ if (param.equals("viewForum")) {
+ return viewForum(mapping, form, request, response);
+ }
+ if (param.equals("finish")) {
+ return finish(mapping, form, request, response);
+ }
- // --------------Topic Level ------------------
- if (param.equals("viewTopic")) {
- return viewTopic(mapping, form, request, response);
- }
- if (param.equals("newTopic")) {
- return newTopic(mapping, form, request, response);
- }
- if (param.equals("createTopic")) {
- return createTopic(mapping, form, request, response);
- }
- if (param.equals("newReplyTopic")) {
- return newReplyTopic(mapping, form, request, response);
- }
- if (param.equals("replyTopic")) {
- return replyTopic(mapping, form, request, response);
- }
- if (param.equals("editTopic")) {
- return editTopic(mapping, form, request, response);
- }
- if (param.equals("updateTopic")) {
- return updateTopic(mapping, form, request, response);
- }
- if (param.equals("deleteAttachment")) {
- return deleteAttachment(mapping, form, request, response);
- }
- if (param.equals("updateMessageHideFlag")) {
- return updateMessageHideFlag(mapping, form, request, response);
- }
+ // --------------Topic Level ------------------
+ if (param.equals("viewTopic")) {
+ return viewTopic(mapping, form, request, response);
+ }
+ if (param.equals("newTopic")) {
+ return newTopic(mapping, form, request, response);
+ }
+ if (param.equals("createTopic")) {
+ return createTopic(mapping, form, request, response);
+ }
+ if (param.equals("newReplyTopic")) {
+ return newReplyTopic(mapping, form, request, response);
+ }
+ if (param.equals("replyTopic")) {
+ return replyTopic(mapping, form, request, response);
+ }
+ if (param.equals("editTopic")) {
+ return editTopic(mapping, form, request, response);
+ }
+ if (param.equals("updateTopic")) {
+ return updateTopic(mapping, form, request, response);
+ }
+ if (param.equals("deleteAttachment")) {
+ return deleteAttachment(mapping, form, request, response);
+ }
+ if (param.equals("updateMessageHideFlag")) {
+ return updateMessageHideFlag(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("error");
+ // ================ Reflection =======================
+ if (param.equals("newReflection")) {
+ return newReflection(mapping, form, request, response);
}
+ if (param.equals("submitReflection")) {
+ return submitReflection(mapping, form, request, response);
+ }
- // ==========================================================================================
- // Forum level methods
- // ==========================================================================================
- /**
- * Display root topics of a forum. This page will be the initial page of
- * Learner page.
- * @throws Exception
- *
- */
- private ActionForward viewForum(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
+ return mapping.findForward("error");
+ }
- //initial Session Map
- String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID);
- SessionMap sessionMap;
- //refresh forum page, not initial enter
- if (sessionMapID != null) {
- sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
- }
- else {
- sessionMap = new SessionMap();
- request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ // ==========================================================================================
+ // Forum level methods
+ // ==========================================================================================
+ /**
+ * Display root topics of a forum. This page will be the initial page of Learner page.
+ *
+ * @throws Exception
+ *
+ */
+ private ActionForward viewForum(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
- }
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ // initial Session Map
+ String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap;
+ // refresh forum page, not initial enter
+ if (sessionMapID != null) {
+ sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ } else {
+ sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
- // set the mode into http session
- ToolAccessMode mode = null;
- try {
- mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, LearningAction.MODE_OPTIONAL);
- }
- catch (Exception exp) {
- }
- if (mode == null) {
- //set it as default mode
- mode = ToolAccessMode.LEARNER;
- }
+ }
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
- // get sessionId from HttpServletRequest
- Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+ // set the mode into http session
+ ToolAccessMode mode = null;
+ try {
+ mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, LearningAction.MODE_OPTIONAL);
+ } catch (Exception exp) {
+ }
+ if (mode == null) {
+ // set it as default mode
+ mode = ToolAccessMode.LEARNER;
+ }
- // Try to get ForumID according to sessionId
- forumService = getForumManager();
- ForumToolSession session = forumService.getSessionBySessionId(sessionId);
+ // get sessionId from HttpServletRequest
+ Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
- if (session == null || session.getForum() == null) {
- LearningAction.log.error("Failed on getting session by given sessionID:" + sessionId);
- throw new Exception("Failed on getting session by given sessionID:" + sessionId);
- }
+ // Try to get ForumID according to sessionId
+ forumService = getForumManager();
+ ForumToolSession session = forumService.getSessionBySessionId(sessionId);
- Forum forum = session.getForum();
- //lock on finish
- ForumUser forumUser = getCurrentUser(request, sessionId);
- boolean lock = forum.getLockWhenFinished() && forumUser.isSessionFinished();
+ if (session == null || session.getForum() == null) {
+ LearningAction.log.error("Failed on getting session by given sessionID:" + sessionId);
+ throw new Exception("Failed on getting session by given sessionID:" + sessionId);
+ }
- //set some option flag to HttpSession
- // if allowRichEditor = true then don't restrict the number of chars
- // if isLimitedInput = false then don't restrict the number of chars
- // Indicate don't restrict number of chars by allowNumber = 0
- Long forumId = forum.getUid();
- Boolean allowRichEditor = new Boolean(forum.isAllowRichEditor());
- int allowNumber = forum.isLimitedInput() || forum.isAllowRichEditor() ? forum.getLimitedChar() : 0;
+ Forum forum = session.getForum();
+ // lock on finish
+ ForumUser forumUser = getCurrentUser(request, sessionId);
+ boolean lock = forum.getLockWhenFinished() && forumUser.isSessionFinished();
- sessionMap.put(ForumConstants.FORUM_ID, forumId);
- sessionMap.put(AttributeNames.ATTR_MODE, mode);
- sessionMap.put(ForumConstants.ATTR_FINISHED_LOCK, new Boolean(lock));
- sessionMap.put(ForumConstants.ATTR_LOCK_WHEN_FINISHED, forum.getLockWhenFinished());
- sessionMap.put(ForumConstants.ATTR_USER_FINISHED, forumUser.isSessionFinished());
- sessionMap.put(ForumConstants.ATTR_ALLOW_EDIT, forum.isAllowEdit());
- sessionMap.put(ForumConstants.ATTR_ALLOW_UPLOAD, forum.isAllowUpload());
- sessionMap.put(ForumConstants.ATTR_ALLOW_NEW_TOPICS, forum.isAllowNewTopic());
- sessionMap.put(ForumConstants.ATTR_ALLOW_RICH_EDITOR, allowRichEditor);
- sessionMap.put(ForumConstants.ATTR_LIMITED_CHARS, new Integer(allowNumber));
- sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
- sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, forum.getTitle());
- sessionMap.put(ForumConstants.ATTR_FORUM_INSTRCUTION, forum.getInstructions());
- sessionMap.put(ForumConstants.ATTR_MINIMUM_REPLY, forum.getMinimumReply());
- sessionMap.put(ForumConstants.ATTR_MAXIMUM_REPLY, forum.getMaximumReply());
+ // set some option flag to HttpSession
+ // if allowRichEditor = true then don't restrict the number of chars
+ // if isLimitedInput = false then don't restrict the number of chars
+ // Indicate don't restrict number of chars by allowNumber = 0
+ Long forumId = forum.getUid();
+ Boolean allowRichEditor = new Boolean(forum.isAllowRichEditor());
+ int allowNumber = forum.isLimitedInput() || forum.isAllowRichEditor() ? forum.getLimitedChar() : 0;
- // Should we show the reflection or not? We shouldn't show it when the screen is accessed
- // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
- // Need to constantly past this value on, rather than hiding just the once, as the View Forum
- // screen has a refresh button.
- boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
- sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
+ sessionMap.put(ForumConstants.FORUM_ID, forumId);
+ sessionMap.put(AttributeNames.ATTR_MODE, mode);
+ sessionMap.put(ForumConstants.ATTR_FINISHED_LOCK, new Boolean(lock));
+ sessionMap.put(ForumConstants.ATTR_LOCK_WHEN_FINISHED, forum.getLockWhenFinished());
+ sessionMap.put(ForumConstants.ATTR_USER_FINISHED, forumUser.isSessionFinished());
+ sessionMap.put(ForumConstants.ATTR_ALLOW_EDIT, forum.isAllowEdit());
+ sessionMap.put(ForumConstants.ATTR_ALLOW_UPLOAD, forum.isAllowUpload());
+ sessionMap.put(ForumConstants.ATTR_ALLOW_NEW_TOPICS, forum.isAllowNewTopic());
+ sessionMap.put(ForumConstants.ATTR_ALLOW_RICH_EDITOR, allowRichEditor);
+ sessionMap.put(ForumConstants.ATTR_LIMITED_CHARS, new Integer(allowNumber));
+ sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
+ sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, forum.getTitle());
+ sessionMap.put(ForumConstants.ATTR_FORUM_INSTRCUTION, forum.getInstructions());
+ sessionMap.put(ForumConstants.ATTR_MINIMUM_REPLY, forum.getMinimumReply());
+ sessionMap.put(ForumConstants.ATTR_MAXIMUM_REPLY, forum.getMaximumReply());
- if (hideReflection) {
- sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, false);
- sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, "");
- sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, "");
- }
- else {
- sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, forum.isReflectOnActivity());
- sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, forum.getReflectInstructions());
+ // Should we show the reflection or not? We shouldn't show it when the screen is accessed
+ // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
+ // Need to constantly past this value on, rather than hiding just the once, as the View Forum
+ // screen has a refresh button.
+ boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
+ sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
- NotebookEntry notebookEntry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
- ForumConstants.TOOL_SIGNATURE, forumUser.getUserId().intValue());
- sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, notebookEntry != null ? notebookEntry.getEntry() : "");
- }
+ if (hideReflection) {
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, false);
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, "");
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, "");
+ } else {
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_ON, forum.isReflectOnActivity());
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_INSTRUCTION, forum.getReflectInstructions());
- //add define later support
- if (forum.isDefineLater()) {
- return mapping.findForward("defineLater");
- }
+ NotebookEntry notebookEntry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ ForumConstants.TOOL_SIGNATURE, forumUser.getUserId().intValue());
+ sessionMap.put(ForumConstants.ATTR_REFLECTION_ENTRY, notebookEntry != null ? notebookEntry.getEntry() : "");
+ }
- //set contentInUse flag to true!
- forum.setContentInUse(true);
- forum.setDefineLater(false);
- forumService.updateForum(forum);
+ // add define later support
+ if (forum.isDefineLater()) {
+ return mapping.findForward("defineLater");
+ }
- //add run offline support
- if (forum.getRunOffline()) {
- return mapping.findForward("runOffline");
- }
+ // set contentInUse flag to true!
+ forum.setContentInUse(true);
+ forum.setDefineLater(false);
+ forumService.updateForum(forum);
- // get all root topic to display on init page
- List rootTopics = forumService.getRootTopics(sessionId);
- if (!forum.isAllowNewTopic()) {
- // add the number post the learner has made for each topic.
- updateNumOfPosts(rootTopics, forumUser);
- }
- request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
+ // add run offline support
+ if (forum.getRunOffline()) {
+ return mapping.findForward("runOffline");
+ }
- if (forum.isNotifyLearnersOnMarkRelease()) {
- forumService.getEventNotificationService().createEvent(ForumConstants.TOOL_SIGNATURE,
- ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(),
- forumService.getLocalisedMessage("event.mark.release.subject", null),
- forumService.getLocalisedMessage("event.mark.release.body", null));
+ // get all root topic to display on init page
+ List rootTopics = forumService.getRootTopics(sessionId);
+ if (!forum.isAllowNewTopic()) {
+ // add the number post the learner has made for each topic.
+ updateNumOfPosts(rootTopics, forumUser);
+ }
+ request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
- forumService.getEventNotificationService().subscribe(ForumConstants.TOOL_SIGNATURE,
- ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(),
- forumUser.getUserId().longValue(), IEventNotificationService.DELIVERY_METHOD_MAIL,
- IEventNotificationService.PERIODICITY_SINGLE);
- }
-
- // displaying new postings
- for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
- MessageDTO messageDTO = (MessageDTO) iterator.next();
- int numOfNewPosts = forumService.getNewMessagesNum(
- messageDTO.getMessage().getUid(), forumUser.getUid());
- if (numOfNewPosts == -1) // first time; show all postings as new, including root message
- messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1);
- else
- messageDTO.setNewPostingsNum(numOfNewPosts);
-
- messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid()));
- }
+ if (forum.isNotifyLearnersOnMarkRelease()) {
+ forumService.getEventNotificationService().createEvent(ForumConstants.TOOL_SIGNATURE,
+ ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(),
+ forumService.getLocalisedMessage("event.mark.release.subject", null),
+ forumService.getLocalisedMessage("event.mark.release.body", null));
- return mapping.findForward("success");
+ forumService.getEventNotificationService().subscribe(ForumConstants.TOOL_SIGNATURE,
+ ForumConstants.EVENT_NAME_NOTIFY_LEARNERS_ON_MARK_RELEASE, forum.getContentId(),
+ forumUser.getUserId().longValue(), IEventNotificationService.DELIVERY_METHOD_MAIL,
+ IEventNotificationService.PERIODICITY_SINGLE);
}
- private void updateNumOfPosts(List rootTopics, ForumUser forumUser) {
- for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
- MessageDTO messageDTO = (MessageDTO) iterator.next();
- int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), messageDTO.getMessage().getUid());
- messageDTO.setNumOfPosts(numOfPosts);
- }
+ // displaying new postings
+ for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
+ MessageDTO messageDTO = (MessageDTO) iterator.next();
+ int numOfNewPosts = forumService.getNewMessagesNum(messageDTO.getMessage().getUid(), forumUser.getUid());
+ if (numOfNewPosts == -1) {
+ messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1);
+ } else {
+ messageDTO.setNewPostingsNum(numOfNewPosts);
+ }
+
+ messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid()));
}
- /**
- * Learner click "finish" button in forum page, this method will turn on
- * session status flag for this learner.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
- String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ return mapping.findForward("success");
+ }
- ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ private void updateNumOfPosts(List rootTopics, ForumUser forumUser) {
+ for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
+ MessageDTO messageDTO = (MessageDTO) iterator.next();
+ int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), messageDTO.getMessage().getUid());
+ messageDTO.setNumOfPosts(numOfPosts);
+ }
+ }
- forumService = getForumManager();
+ /**
+ * Learner click "finish" button in forum page, this method will turn on session status flag for this learner.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
- if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) {
- if (!validateBeforeFinish(request, sessionMapID)) {
- return mapping.getInputForward();
- }
+ ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
- String nextActivityUrl;
- try {
- // get session from shared session.
- HttpSession ss = SessionManager.getSession();
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- Long userID = new Long(user.getUserID().longValue());
+ forumService = getForumManager();
- //finish current session for user
- forumService.finishUserSession(getCurrentUser(request, sessionId));
- ToolSessionManager sessionMgrService = ForumServiceProxy.getToolSessionManager(getServlet().getServletContext());
- nextActivityUrl = sessionMgrService.leaveToolSession(sessionId, userID);
- response.sendRedirect(nextActivityUrl);
- }
- catch (DataMissingException e) {
- throw new ForumException(e);
- }
- catch (ToolException e) {
- throw new ForumException(e);
- }
- catch (IOException e) {
- throw new ForumException(e);
- }
- return null;
+ if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) {
+ if (!validateBeforeFinish(request, sessionMapID)) {
+ return mapping.getInputForward();
+ }
- }
- // get all root topic to display on init page
- List rootTopics = forumService.getRootTopics(sessionId);
- request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
+ String nextActivityUrl;
+ try {
+ // get session from shared session.
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userID = new Long(user.getUserID().longValue());
- return mapping.getInputForward();
+ // finish current session for user
+ forumService.finishUserSession(getCurrentUser(request, sessionId));
+ ToolSessionManager sessionMgrService = ForumServiceProxy.getToolSessionManager(getServlet()
+ .getServletContext());
+ nextActivityUrl = sessionMgrService.leaveToolSession(sessionId, userID);
+ response.sendRedirect(nextActivityUrl);
+ } catch (DataMissingException e) {
+ throw new ForumException(e);
+ } catch (ToolException e) {
+ throw new ForumException(e);
+ } catch (IOException e) {
+ throw new ForumException(e);
+ }
+ return null;
+
}
+ // get all root topic to display on init page
+ List rootTopics = forumService.getRootTopics(sessionId);
+ request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
- /**
- * 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();
+ return mapping.getInputForward();
+ }
- String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ /**
+ * 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();
- // check for existing notebook entry
- NotebookEntry entry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
- ForumConstants.TOOL_SIGNATURE, userId);
+ String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
- if (entry == null) {
- // create new entry
- forumService.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, ForumConstants.TOOL_SIGNATURE,
- userId, refForm.getEntryText());
- }
- else {
- // update existing entry
- entry.setEntry(refForm.getEntryText());
- entry.setLastModified(new Date());
- forumService.updateEntry(entry);
- }
+ // check for existing notebook entry
+ NotebookEntry entry = forumService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ ForumConstants.TOOL_SIGNATURE, userId);
- return finish(mapping, form, request, response);
+ if (entry == null) {
+ // create new entry
+ forumService.createNotebookEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL,
+ ForumConstants.TOOL_SIGNATURE, userId, refForm.getEntryText());
+ } else {
+ // update existing entry
+ entry.setEntry(refForm.getEntryText());
+ entry.setLastModified(new Date());
+ forumService.updateEntry(entry);
}
- /**
- * Display empty reflection form.
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ return finish(mapping, form, request, response);
+ }
- //get session value
- String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
- if (!validateBeforeFinish(request, sessionMapID)) {
- return mapping.getInputForward();
- }
+ /**
+ * Display empty reflection form.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- ReflectionForm refForm = (ReflectionForm) form;
- HttpSession ss = SessionManager.getSession();
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ // get session value
+ String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
+ if (!validateBeforeFinish(request, sessionMapID)) {
+ return mapping.getInputForward();
+ }
- refForm.setUserID(user.getUserID());
- refForm.setSessionMapID(sessionMapID);
+ ReflectionForm refForm = (ReflectionForm) form;
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- // get the existing reflection entry
- IForumService submitFilesService = getForumManager();
+ refForm.setUserID(user.getUserID());
+ refForm.setSessionMapID(sessionMapID);
- 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,
- ForumConstants.TOOL_SIGNATURE, user.getUserID());
+ // get the existing reflection entry
+ IForumService submitFilesService = getForumManager();
- if (entry != null) {
- refForm.setEntryText(entry.getEntry());
- }
+ 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,
+ ForumConstants.TOOL_SIGNATURE, user.getUserID());
- return mapping.findForward("success");
+ if (entry != null) {
+ refForm.setEntryText(entry.getEntry());
}
- // ==========================================================================================
- // Topic level methods
- // ==========================================================================================
+ return mapping.findForward("success");
+ }
- /**
- * Display read-only page for a special topic. Topic will arrange by Tree
- * structure.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ // ==========================================================================================
+ // Topic level methods
+ // ==========================================================================================
- forumService = getForumManager();
+ /**
+ * Display read-only page for a special topic. Topic will arrange by Tree structure.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
+ forumService = getForumManager();
- String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
- sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId);
+ Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
- // get forum user and forum
- ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID));
- Forum forum = forumUser.getSession().getForum();
+ String sessionMapID = WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, rootTopicId);
- // get root topic list
- List msgDtoList = forumService.getTopicThread(rootTopicId);
- updateMesssageFlag(msgDtoList);
- request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
+ // get forum user and forum
+ ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID));
+ Forum forum = forumUser.getSession().getForum();
- // check if we can still make posts in this topic
- int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), msgDtoList.get(0).getMessage().getUid());
- boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE
- : Boolean.FALSE;
- request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
- request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
+ // get root topic list
+ List msgDtoList = forumService.getTopicThread(rootTopicId);
+ updateMesssageFlag(msgDtoList);
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
- //transfer SessionMapID as well
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ // check if we can still make posts in this topic
+ int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), msgDtoList.get(0).getMessage()
+ .getUid());
+ boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply()
+ && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE;
+ request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
+ request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
- // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
- // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
- // Need to constantly past this value on, rather than hiding just the once, as the View Forum
- // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
- // as it has a link from the view topic screen back to View Forum screen.
- boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
- sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
-
- // Saving or updating user timestamp
- saveUserTimestamp(rootTopicId, forumUser);
-
- return mapping.findForward("success");
+ // transfer SessionMapID as well
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+
+ // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
+ // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
+ // Need to constantly past this value on, rather than hiding just the once, as the View Forum
+ // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
+ // as it has a link from the view topic screen back to View Forum screen.
+ boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
+ sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
+
+ // Saving or updating user timestamp
+ saveUserTimestamp(rootTopicId, forumUser);
+
+ return mapping.findForward("success");
+ }
+
+ /**
+ * Saving user timestamp
+ *
+ * @param toorTopicId
+ * @param forumUser
+ * @return
+ */
+ private void saveUserTimestamp(Long rootTopicId, ForumUser forumUser) {
+ Date curDate = new Date();
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ try {
+ curDate = dateFormat.parse(dateFormat.format(new Date()));
+ } catch (ParseException pe) {
+ pe.printStackTrace();
}
-
- /**
- * Saving user timestamp
- *
- * @param toorTopicId
- * @param forumUser
- * @return
- */
- private void saveUserTimestamp(Long rootTopicId, ForumUser forumUser)
- {
- Date curDate = new Date();
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- curDate = dateFormat.parse(dateFormat.format(new Date()));
- } catch(ParseException pe) {
- pe.printStackTrace();
- }
-
- Timestamp timestamp = forumService.getTimestamp(rootTopicId, forumUser.getUid());
- if (timestamp != null)
- {
- timestamp.setTimestamp(curDate);
- forumService.saveTimestamp(timestamp);
- }
- else
- {
- timestamp = new Timestamp();
- timestamp.setMessage(forumService.getMessage(rootTopicId));
- timestamp.setTimestamp(curDate);
- timestamp.setForumUser(forumUser);
- forumService.saveTimestamp(timestamp);
- }
+
+ Timestamp timestamp = forumService.getTimestamp(rootTopicId, forumUser.getUid());
+ if (timestamp != null) {
+ timestamp.setTimestamp(curDate);
+ forumService.saveTimestamp(timestamp);
+ } else {
+ timestamp = new Timestamp();
+ timestamp.setMessage(forumService.getMessage(rootTopicId));
+ timestamp.setTimestamp(curDate);
+ timestamp.setForumUser(forumUser);
+ forumService.saveTimestamp(timestamp);
}
+ }
- /**
- * Display empty page for a new topic in forum
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward newTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- //transfer SessionMapID as well
- ((MessageForm) form).setSessionMapID(WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID));
+ /**
+ * Display empty page for a new topic in forum
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ // transfer SessionMapID as well
+ ((MessageForm) form).setSessionMapID(WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID));
- return mapping.findForward("success");
- }
+ return mapping.findForward("success");
+ }
- /**
- * Create a new root topic.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws IOException
- * @throws ServletException
- * @throws PersistenceException
- */
- public ActionForward createTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws IOException, ServletException, PersistenceException {
+ /**
+ * Create a new root topic.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws PersistenceException
+ */
+ public ActionForward createTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws IOException, ServletException, PersistenceException {
- MessageForm messageForm = (MessageForm) form;
- SessionMap sessionMap = getSessionMap(request, messageForm);
- Long forumId = (Long) sessionMap.get(ForumConstants.FORUM_ID);
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ MessageForm messageForm = (MessageForm) form;
+ SessionMap sessionMap = getSessionMap(request, messageForm);
+ Long forumId = (Long) sessionMap.get(ForumConstants.FORUM_ID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
- Message message = messageForm.getMessage();
- message.setIsAuthored(false);
- message.setCreated(new Date());
- message.setUpdated(new Date());
- message.setLastReplyDate(new Date());
- ForumUser forumUser = getCurrentUser(request, sessionId);
- message.setCreatedBy(forumUser);
- message.setModifiedBy(forumUser);
- setAttachment(messageForm, message);
+ Message message = messageForm.getMessage();
+ message.setIsAuthored(false);
+ message.setCreated(new Date());
+ message.setUpdated(new Date());
+ message.setLastReplyDate(new Date());
+ ForumUser forumUser = getCurrentUser(request, sessionId);
+ message.setCreatedBy(forumUser);
+ message.setModifiedBy(forumUser);
+ setAttachment(messageForm, message);
- // save message into database
- forumService = getForumManager();
- forumService.createRootTopic(forumId, sessionId, message);
+ // save message into database
+ forumService = getForumManager();
+ forumService.createRootTopic(forumId, sessionId, message);
- // echo back current root topic to forum init page
- List rootTopics = forumService.getRootTopics(sessionId);
- request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
-
- saveUserTimestamp(message.getUid(), forumUser);
-
- for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
- MessageDTO messageDTO = (MessageDTO) iterator.next();
- int numOfNewPosts = forumService.getNewMessagesNum(
- messageDTO.getMessage().getUid(), forumUser.getUid());
- if (numOfNewPosts == -1) // first time; show all postings as new, including root message
- messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1);
- else
- messageDTO.setNewPostingsNum(numOfNewPosts);
-
- messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid()));
- }
-
- return mapping.findForward("success");
- }
+ // echo back current root topic to forum init page
+ List rootTopics = forumService.getRootTopics(sessionId);
+ request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
- /**
- * Display replay topic page. Message form subject will include parent
- * topics same subject.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward newReplyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID);
+ saveUserTimestamp(message.getUid(), forumUser);
- MessageForm msgForm = (MessageForm) form;
- msgForm.setSessionMapID(sessionMapID);
+ for (Iterator iterator = rootTopics.iterator(); iterator.hasNext();) {
+ MessageDTO messageDTO = (MessageDTO) iterator.next();
+ int numOfNewPosts = forumService.getNewMessagesNum(messageDTO.getMessage().getUid(), forumUser.getUid());
+ if (numOfNewPosts == -1) {
+ messageDTO.setNewPostingsNum(messageDTO.getMessage().getReplyNumber() + 1);
+ } else {
+ messageDTO.setNewPostingsNum(numOfNewPosts);
+ }
- Long parentId = WebUtil.readLongParam(request, ForumConstants.ATTR_PARENT_TOPIC_ID);
- // get parent topic, it can decide default subject of reply.
- MessageDTO topic = getTopic(parentId);
+ messageDTO.setLastTopicDate(forumService.getLastTopicDate(messageDTO.getMessage().getUid()));
+ }
- if (topic != null && topic.getMessage() != null) {
- String reTitle = topic.getMessage().getSubject();
+ return mapping.findForward("success");
+ }
- MessageDTO originalMessage = MessageDTO.getMessageDTO(topic.getMessage());
+ /**
+ * Display replay topic page. Message form subject will include parent topics same subject.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward newReplyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ String sessionMapID = request.getParameter(ForumConstants.ATTR_SESSION_MAP_ID);
- request.setAttribute(ForumConstants.ATTR_ORIGINAL_MESSAGE, originalMessage);
+ MessageForm msgForm = (MessageForm) form;
+ msgForm.setSessionMapID(sessionMapID);
- // echo back current topic subject to web page
- if (reTitle != null && !reTitle.trim().startsWith("Re:")) {
- msgForm.getMessage().setSubject("Re:" + reTitle);
- }
- else {
- msgForm.getMessage().setSubject(reTitle);
- }
- }
- SessionMap sessionMap = getSessionMap(request, msgForm);
- sessionMap.put(ForumConstants.ATTR_PARENT_TOPIC_ID, parentId);
+ Long parentId = WebUtil.readLongParam(request, ForumConstants.ATTR_PARENT_TOPIC_ID);
+ // get parent topic, it can decide default subject of reply.
+ MessageDTO topic = getTopic(parentId);
- // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
- // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
- // Need to constantly past this value on, rather than hiding just the once, as the View Forum
- // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
- // as it has a link from the view topic screen back to View Forum screen.
- boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
- sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
+ if (topic != null && topic.getMessage() != null) {
+ String reTitle = topic.getMessage().getSubject();
- return mapping.findForward("success");
- }
+ MessageDTO originalMessage = MessageDTO.getMessageDTO(topic.getMessage());
- /**
- * Create a replayed topic for a parent topic.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ request.setAttribute(ForumConstants.ATTR_ORIGINAL_MESSAGE, originalMessage);
- MessageForm messageForm = (MessageForm) form;
- SessionMap sessionMap = getSessionMap(request, messageForm);
- Long parentId = (Long) sessionMap.get(ForumConstants.ATTR_PARENT_TOPIC_ID);
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ // echo back current topic subject to web page
+ if (reTitle != null && !reTitle.trim().startsWith("Re:")) {
+ msgForm.getMessage().setSubject("Re:" + reTitle);
+ } else {
+ msgForm.getMessage().setSubject(reTitle);
+ }
+ }
+ SessionMap sessionMap = getSessionMap(request, msgForm);
+ sessionMap.put(ForumConstants.ATTR_PARENT_TOPIC_ID, parentId);
- Message message = messageForm.getMessage();
- message.setIsAuthored(false);
- message.setCreated(new Date());
- message.setUpdated(new Date());
- message.setLastReplyDate(new Date());
- ForumUser forumUser = getCurrentUser(request, sessionId);
- message.setCreatedBy(forumUser);
- message.setModifiedBy(forumUser);
- setAttachment(messageForm, message);
+ // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
+ // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
+ // Need to constantly past this value on, rather than hiding just the once, as the View Forum
+ // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
+ // as it has a link from the view topic screen back to View Forum screen.
+ boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
+ sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
- // save message into database
- forumService = getForumManager();
- forumService.replyTopic(parentId, sessionId, message);
+ return mapping.findForward("success");
+ }
- // echo back this topic thread into page
- Long rootTopicId = forumService.getRootTopicId(parentId);
- List msgDtoList = forumService.getTopicThread(rootTopicId);
- updateMesssageFlag(msgDtoList);
+ /**
+ * Create a replayed topic for a parent topic.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws InterruptedException
+ */
+ private synchronized ActionForward replyTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws InterruptedException {
- request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
+ MessageForm messageForm = (MessageForm) form;
+ SessionMap sessionMap = getSessionMap(request, messageForm);
+ Long parentId = (Long) sessionMap.get(ForumConstants.ATTR_PARENT_TOPIC_ID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
- //check whether allow more posts for this user
- ForumToolSession session = forumService.getSessionBySessionId(sessionId);
- Forum forum = session.getForum();
- int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)).getMessage()
- .getUid());
- boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE
- : Boolean.FALSE;
- request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
- request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
+ Message message = messageForm.getMessage();
+ message.setIsAuthored(false);
+ message.setCreated(new Date());
+ message.setUpdated(new Date());
+ message.setLastReplyDate(new Date());
+ ForumUser forumUser = getCurrentUser(request, sessionId);
+ message.setCreatedBy(forumUser);
+ message.setModifiedBy(forumUser);
+ setAttachment(messageForm, message);
- sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE);
-
- // Saving or updating user timestamp
- saveUserTimestamp(rootTopicId, forumUser);
+ // save message into database
+ forumService = getForumManager();
- return mapping.findForward("success");
- }
+ forumService.replyTopic(parentId, sessionId, message);
- /**
- * Display a editable form for a special topic in order to update it.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws PersistenceException
- */
- public ActionForward editTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws PersistenceException {
- Long topicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
+ // echo back this topic thread into page
+ Long rootTopicId = forumService.getRootTopicId(parentId);
+ List msgDtoList = forumService.getTopicThread(rootTopicId);
+ updateMesssageFlag(msgDtoList);
- MessageDTO topic = getTopic(topicId);
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
- // echo current topic content to web page
- MessageForm msgForm = (MessageForm) form;
- if (topic != null) {
- msgForm.setMessage(topic.getMessage());
- request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic);
- }
+ // check whether allow more posts for this user
+ ForumToolSession session = forumService.getSessionBySessionId(sessionId);
+ Forum forum = session.getForum();
+ int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0))
+ .getMessage().getUid());
+ boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply()
+ && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE;
+ request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
+ request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
- //cache this topicID, using in Update topic
- SessionMap sessionMap = getSessionMap(request, msgForm);
- sessionMap.put(ForumConstants.ATTR_TOPIC_ID, topicId);
+ sessionMap.remove(ForumConstants.ATTR_ORIGINAL_MESSAGE);
- // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
- // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
- // Need to constantly past this value on, rather than hiding just the once, as the View Forum
- // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
- // as it has a link from the view topic screen back to View Forum screen.
- boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
- sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
+ // Saving or updating user timestamp
+ saveUserTimestamp(rootTopicId, forumUser);
- return mapping.findForward("success");
- }
+ return mapping.findForward("success");
+ }
- /**
- * Delete attachment from topic. This method only reset attachment information in memory. The finally update
- * will happen in updateTopic method. So topic can keep this attachment if user choose "Cancel" edit
- * topic.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward deleteAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ /**
+ * Display a editable form for a special topic in order to update it.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws PersistenceException
+ */
+ public ActionForward editTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws PersistenceException {
+ Long topicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
- //only reset not attachment flag.
- MessageDTO dto = new MessageDTO();
- dto.setHasAttachment(false);
- request.setAttribute(ForumConstants.AUTHORING_TOPIC, dto);
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
- WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID));
- request.setAttribute(ForumConstants.ATTR_ALLOW_UPLOAD, sessionMap.get(ForumConstants.ATTR_ALLOW_UPLOAD));
+ MessageDTO topic = getTopic(topicId);
- return mapping.findForward("success");
+ // echo current topic content to web page
+ MessageForm msgForm = (MessageForm) form;
+ if (topic != null) {
+ msgForm.setMessage(topic.getMessage());
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC, topic);
}
- /**
- * Update a topic.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- * @throws PersistenceException
- */
- public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws PersistenceException {
+ // cache this topicID, using in Update topic
+ SessionMap sessionMap = getSessionMap(request, msgForm);
+ sessionMap.put(ForumConstants.ATTR_TOPIC_ID, topicId);
- forumService = getForumManager();
+ // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
+ // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
+ // Need to constantly past this value on, rather than hiding just the once, as the View Forum
+ // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
+ // as it has a link from the view topic screen back to View Forum screen.
+ boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
+ sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
- MessageForm messageForm = (MessageForm) form;
- SessionMap sessionMap = getSessionMap(request, messageForm);
- Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID);
- Message message = messageForm.getMessage();
+ return mapping.findForward("success");
+ }
- boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE));
- String oldMessageString = null;
+ /**
+ * Delete attachment from topic. This method only reset attachment information in memory. The finally update will
+ * happen in updateTopic method. So topic can keep this attachment if user choose "Cancel" edit
+ * topic.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward deleteAttachment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- // get PO from database and sync with Form
- Message messagePO = forumService.getMessage(topicId);
- if (makeAuditEntry) {
- oldMessageString = messagePO.toString();
- }
- messagePO.setSubject(message.getSubject());
- messagePO.setBody(message.getBody());
- messagePO.setUpdated(new Date());
- messagePO.setModifiedBy(getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)));
- setAttachment(messageForm, messagePO);
+ // only reset not attachment flag.
+ MessageDTO dto = new MessageDTO();
+ dto.setHasAttachment(false);
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC, dto);
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(
+ WebUtil.readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID));
+ request.setAttribute(ForumConstants.ATTR_ALLOW_UPLOAD, sessionMap.get(ForumConstants.ATTR_ALLOW_UPLOAD));
- if (makeAuditEntry) {
- Long userId = 0L;
- String loginName = "Default";
- if (message.getCreatedBy() != null) {
- userId = message.getCreatedBy().getUserId();
- loginName = message.getCreatedBy().getLoginName();
- }
- forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName, oldMessageString,
- messagePO.toString());
- }
+ return mapping.findForward("success");
+ }
- // save message into database
- // if we are in monitoring then we are probably editing some else's entry so log the change.
- forumService.updateTopic(messagePO);
+ /**
+ * Update a topic.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ * @throws PersistenceException
+ */
+ public ActionForward updateTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws PersistenceException {
- // echo back this topic thread into page
- Long rootTopicId = forumService.getRootTopicId(topicId);
- List msgDtoList = forumService.getTopicThread(rootTopicId);
- updateMesssageFlag(msgDtoList);
+ forumService = getForumManager();
- // check if we can still make posts in this topic
- ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID));
- Forum forum = forumUser.getSession().getForum();
- int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0)).getMessage()
- .getUid());
- boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply() && !forum.isAllowNewTopic() ? Boolean.TRUE
- : Boolean.FALSE;
- request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
- request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
+ MessageForm messageForm = (MessageForm) form;
+ SessionMap sessionMap = getSessionMap(request, messageForm);
+ Long topicId = (Long) sessionMap.get(ForumConstants.ATTR_TOPIC_ID);
+ Message message = messageForm.getMessage();
- request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
-
- // Saving or updating user timestamp
- saveUserTimestamp(rootTopicId, forumUser);
-
- return mapping.findForward("success");
+ boolean makeAuditEntry = ToolAccessMode.TEACHER.equals(sessionMap.get(AttributeNames.ATTR_MODE));
+ String oldMessageString = null;
+
+ // get PO from database and sync with Form
+ Message messagePO = forumService.getMessage(topicId);
+ if (makeAuditEntry) {
+ oldMessageString = messagePO.toString();
}
+ messagePO.setSubject(message.getSubject());
+ messagePO.setBody(message.getBody());
+ messagePO.setUpdated(new Date());
+ messagePO.setModifiedBy(getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID)));
+ setAttachment(messageForm, messagePO);
- /**
- * Sets the visibility of a message by updating the hide flag for a message
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- public ActionForward updateMessageHideFlag(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ if (makeAuditEntry) {
+ Long userId = 0L;
+ String loginName = "Default";
+ if (message.getCreatedBy() != null) {
+ userId = message.getCreatedBy().getUserId();
+ loginName = message.getCreatedBy().getLoginName();
+ }
+ forumService.getAuditService().logChange(ForumConstants.TOOL_SIGNATURE, userId, loginName,
+ oldMessageString, messagePO.toString());
+ }
- Long msgId = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID));
- Boolean hideFlag = new Boolean(WebUtil.readBooleanParam(request, "hideFlag"));
- forumService = getForumManager();
+ // save message into database
+ // if we are in monitoring then we are probably editing some else's entry so log the change.
+ forumService.updateTopic(messagePO);
- // TODO Skipping permissions for now, currently having issues with default learning designs not having an create_by field
- // Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
- // check if the user has permission to hide posts.
- // ForumToolSession toolSession = forumService
- // .getSessionBySessionId(sessionId);
- //
- // Forum forum = toolSession.getForum();
- // ForumUser currentUser = getCurrentUser(request,sessionId);
- // ForumUser forumCreatedBy = forum.getCreatedBy();
+ // echo back this topic thread into page
+ Long rootTopicId = forumService.getRootTopicId(topicId);
+ List msgDtoList = forumService.getTopicThread(rootTopicId);
+ updateMesssageFlag(msgDtoList);
- // we should be looking at whether a user is a teacher and more specifically staff
- // if (currentUser.getUserId().equals(forumCreatedBy.getUserId())) {
- forumService.updateMessageHideFlag(msgId, hideFlag.booleanValue());
- // } else {
- // log.info(currentUser + "does not have permission to hide/show postings in forum: " + forum.getUid());
- // log.info("Forum created by :" + forumCreatedBy.getUid() + ", Current User is: " + currentUser.getUid());
- // }
+ // check if we can still make posts in this topic
+ ForumUser forumUser = getCurrentUser(request, (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID));
+ Forum forum = forumUser.getSession().getForum();
+ int numOfPosts = forumService.getNumOfPostsByTopic(forumUser.getUserId(), ((MessageDTO) msgDtoList.get(0))
+ .getMessage().getUid());
+ boolean noMorePosts = forum.getMaximumReply() != 0 && numOfPosts >= forum.getMaximumReply()
+ && !forum.isAllowNewTopic() ? Boolean.TRUE : Boolean.FALSE;
+ request.setAttribute(ForumConstants.ATTR_NO_MORE_POSTS, noMorePosts);
+ request.setAttribute(ForumConstants.ATTR_NUM_OF_POSTS, numOfPosts);
- // echo back this topic thread into page
- Long rootTopicId = forumService.getRootTopicId(msgId);
- List msgDtoList = forumService.getTopicThread(rootTopicId);
- updateMesssageFlag(msgDtoList);
- request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, WebUtil
- .readStrParam(request, ForumConstants.ATTR_SESSION_MAP_ID));
-
- return mapping.findForward("success");
- }
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, messageForm.getSessionMapID());
- // ==========================================================================================
- // Utility methods
- // ==========================================================================================
- /**
- * Validation method to check whether user posts meet minimum number.
- */
- private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) {
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ // Saving or updating user timestamp
+ saveUserTimestamp(rootTopicId, forumUser);
- ForumToolSession session = forumService.getSessionBySessionId(sessionId);
- Forum forum = session.getForum();
- // get session from shared session.
- HttpSession ss = SessionManager.getSession();
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- Long userID = new Long(user.getUserID().longValue());
- if (!forum.getRunOffline() && !forum.isAllowNewTopic()) {
+ return mapping.findForward("success");
+ }
- List list = forumService.getRootTopics(sessionId);
- for (MessageDTO msgDto : list) {
- Long topicId = msgDto.getMessage().getUid();
- int numOfPostsInTopic = forumService.getNumOfPostsByTopic(userID, topicId);
- if (numOfPostsInTopic < forum.getMinimumReply()) {
- //create error
- ActionMessages errors = new ActionMessages();
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.less.mini.post", forum.getMinimumReply()));
- saveErrors(request, errors);
+ /**
+ * Sets the visibility of a message by updating the hide flag for a message
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ public ActionForward updateMessageHideFlag(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- // get all root topic to display on init page
- List rootTopics = forumService.getRootTopics(sessionId);
- request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID);
- return false;
- }
+ Long msgId = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID));
+ Boolean hideFlag = new Boolean(WebUtil.readBooleanParam(request, "hideFlag"));
+ forumService = getForumManager();
- }
- }
- return true;
- }
+ // TODO Skipping permissions for now, currently having issues with default learning designs not having an
+ // create_by field
+ // Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+ // check if the user has permission to hide posts.
+ // ForumToolSession toolSession = forumService
+ // .getSessionBySessionId(sessionId);
+ //
+ // Forum forum = toolSession.getForum();
+ // ForumUser currentUser = getCurrentUser(request,sessionId);
+ // ForumUser forumCreatedBy = forum.getCreatedBy();
- /**
- * This method will set flag in message DTO:
- *
If this topic is created by current login user, then set Author mark
- * true.
- *
- * @param msgDtoList
- */
- private void updateMesssageFlag(List msgDtoList) {
- // set current user to web page, so that can display "edit" button
- // correct. Only author alow to edit.
- HttpSession ss = SessionManager.getSession();
- // get back login user DTO
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ // we should be looking at whether a user is a teacher and more specifically staff
+ // if (currentUser.getUserId().equals(forumCreatedBy.getUserId())) {
+ forumService.updateMessageHideFlag(msgId, hideFlag.booleanValue());
+ // } else {
+ // log.info(currentUser + "does not have permission to hide/show postings in forum: " + forum.getUid());
+ // log.info("Forum created by :" + forumCreatedBy.getUid() + ", Current User is: " + currentUser.getUid());
+ // }
- Long currUserId = new Long(user.getUserID().intValue());
- Iterator iter = msgDtoList.iterator();
- while (iter.hasNext()) {
- MessageDTO dto = (MessageDTO) iter.next();
- if (dto.getMessage().getCreatedBy() != null && currUserId.equals(dto.getMessage().getCreatedBy().getUserId())) {
- dto.setAuthor(true);
- }
- else {
- dto.setAuthor(false);
- }
+ // echo back this topic thread into page
+ Long rootTopicId = forumService.getRootTopicId(msgId);
+ List msgDtoList = forumService.getTopicThread(rootTopicId);
+ updateMesssageFlag(msgDtoList);
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, WebUtil.readStrParam(request,
+ ForumConstants.ATTR_SESSION_MAP_ID));
+
+ return mapping.findForward("success");
+ }
+
+ // ==========================================================================================
+ // Utility methods
+ // ==========================================================================================
+ /**
+ * Validation method to check whether user posts meet minimum number.
+ */
+ private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) {
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+
+ ForumToolSession session = forumService.getSessionBySessionId(sessionId);
+ Forum forum = session.getForum();
+ // get session from shared session.
+ HttpSession ss = SessionManager.getSession();
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ Long userID = new Long(user.getUserID().longValue());
+ if (!forum.getRunOffline() && !forum.isAllowNewTopic()) {
+
+ List list = forumService.getRootTopics(sessionId);
+ for (MessageDTO msgDto : list) {
+ Long topicId = msgDto.getMessage().getUid();
+ int numOfPostsInTopic = forumService.getNumOfPostsByTopic(userID, topicId);
+ if (numOfPostsInTopic < forum.getMinimumReply()) {
+ // create error
+ ActionMessages errors = new ActionMessages();
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.less.mini.post", forum
+ .getMinimumReply()));
+ saveErrors(request, errors);
+
+ // get all root topic to display on init page
+ List rootTopics = forumService.getRootTopics(sessionId);
+ request.setAttribute(ForumConstants.AUTHORING_TOPICS_LIST, rootTopics);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMapID);
+ return false;
}
- }
- /**
- * @param topicId
- * @return
- */
- private MessageDTO getTopic(Long topicId) {
- // get Topic content according to TopicID
- forumService = getForumManager();
- MessageDTO topic = MessageDTO.getMessageDTO(forumService.getMessage(topicId));
- return topic;
+ }
}
+ return true;
+ }
- /**
- * Get login user information from system level session. Check it whether it
- * exists in database or not, and save it if it does not exists. Return an
- * instance of PO of ForumUser.
- *
- * @param request
- * @param sessionId
- * @return Current user instance
- */
- private ForumUser getCurrentUser(HttpServletRequest request, Long sessionId) {
- // get login user (author)
- HttpSession ss = SessionManager.getSession();
- // get back login user DTO
- UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
- ForumUser forumUser = forumService.getUserByUserAndSession(new Long(user.getUserID().intValue()), sessionId);
- if (forumUser == null) {
- // if user not exist, create new one in database
- ForumToolSession session = forumService.getSessionBySessionId(sessionId);
- forumUser = new ForumUser(user, session);
- forumService.createUser(forumUser);
- }
- return forumUser;
+ /**
+ * This method will set flag in message DTO:
+ *
If this topic is created by current login user, then set Author mark true.
+ *
+ * @param msgDtoList
+ */
+ private void updateMesssageFlag(List msgDtoList) {
+ // set current user to web page, so that can display "edit" button
+ // correct. Only author alow to edit.
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+
+ Long currUserId = new Long(user.getUserID().intValue());
+ Iterator iter = msgDtoList.iterator();
+ while (iter.hasNext()) {
+ MessageDTO dto = (MessageDTO) iter.next();
+ if (dto.getMessage().getCreatedBy() != null
+ && currUserId.equals(dto.getMessage().getCreatedBy().getUserId())) {
+ dto.setAuthor(true);
+ } else {
+ dto.setAuthor(false);
+ }
}
+ }
- /**
- * Get Forum Service.
- *
- * @return
- */
- private IForumService getForumManager() {
- if (forumService == null) {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
- .getServletContext());
- forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE);
- }
- return forumService;
+ /**
+ * @param topicId
+ * @return
+ */
+ private MessageDTO getTopic(Long topicId) {
+ // get Topic content according to TopicID
+ forumService = getForumManager();
+ MessageDTO topic = MessageDTO.getMessageDTO(forumService.getMessage(topicId));
+ return topic;
+ }
+
+ /**
+ * Get login user information from system level session. Check it whether it exists in database or not, and save it
+ * if it does not exists. Return an instance of PO of ForumUser.
+ *
+ * @param request
+ * @param sessionId
+ * @return Current user instance
+ */
+ private ForumUser getCurrentUser(HttpServletRequest request, Long sessionId) {
+ // get login user (author)
+ HttpSession ss = SessionManager.getSession();
+ // get back login user DTO
+ UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
+ ForumUser forumUser = forumService.getUserByUserAndSession(new Long(user.getUserID().intValue()), sessionId);
+ if (forumUser == null) {
+ // if user not exist, create new one in database
+ ForumToolSession session = forumService.getSessionBySessionId(sessionId);
+ forumUser = new ForumUser(user, session);
+ forumService.createUser(forumUser);
}
+ return forumUser;
+ }
- /**
- * @param messageForm
- * @param message
- */
- private void setAttachment(MessageForm messageForm, Message message) {
- if (messageForm.getAttachmentFile() != null && !StringUtils.isBlank(messageForm.getAttachmentFile().getFileName())) {
- forumService = getForumManager();
- Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile());
- Set attSet = message.getAttachments();
- if (attSet == null) {
- attSet = new HashSet();
- }
- // only allow one attachment, so replace whatever
- attSet.clear();
- attSet.add(att);
- message.setAttachments(attSet);
- }
- else if (!messageForm.isHasAttachment()) {
- //user already called deleteAttachment in AJAX call
- if (message.getAttachments() != null) {
- Set atts = message.getAttachments();
- atts.clear();
- message.setAttachments(atts);
- }
- else {
- message.setAttachments(null);
- }
- }
+ /**
+ * Get Forum Service.
+ *
+ * @return
+ */
+ private IForumService getForumManager() {
+ if (forumService == null) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE);
}
+ return forumService;
+ }
- private SessionMap getSessionMap(HttpServletRequest request, MessageForm messageForm) {
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(messageForm.getSessionMapID());
- return sessionMap;
+ /**
+ * @param messageForm
+ * @param message
+ */
+ private void setAttachment(MessageForm messageForm, Message message) {
+ if (messageForm.getAttachmentFile() != null
+ && !StringUtils.isBlank(messageForm.getAttachmentFile().getFileName())) {
+ forumService = getForumManager();
+ Attachment att = forumService.uploadAttachment(messageForm.getAttachmentFile());
+ Set attSet = message.getAttachments();
+ if (attSet == null) {
+ attSet = new HashSet();
+ }
+ // only allow one attachment, so replace whatever
+ attSet.clear();
+ attSet.add(att);
+ message.setAttachments(attSet);
+ } else if (!messageForm.isHasAttachment()) {
+ // user already called deleteAttachment in AJAX call
+ if (message.getAttachments() != null) {
+ Set atts = message.getAttachments();
+ atts.clear();
+ message.setAttachments(atts);
+ } else {
+ message.setAttachments(null);
+ }
}
+ }
+ private SessionMap getSessionMap(HttpServletRequest request, MessageForm messageForm) {
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(messageForm.getSessionMapID());
+ return sessionMap;
+ }
+
}
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java
===================================================================
diff -u -rbcc173ec7635b144dd12f22e8472bd81a2b5f12e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision bcc173ec7635b144dd12f22e8472bd81a2b5f12e)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -81,812 +81,794 @@
public class MonitoringAction extends Action {
- private static Logger log = Logger.getLogger(MonitoringAction.class);
+ private static Logger log = Logger.getLogger(MonitoringAction.class);
- private IForumService forumService;
+ private IForumService forumService;
- private class SessionDTOComparator implements Comparator {
- public int compare(SessionDTO o1, SessionDTO o2) {
- if (o1 != null && o2 != null) {
- return o1.getSessionName().compareTo(o2.getSessionName());
- }
- else if (o1 != null) {
- return 1;
- }
- else {
- return -1;
- }
- }
+ private class SessionDTOComparator implements Comparator {
+ public int compare(SessionDTO o1, SessionDTO o2) {
+ if (o1 != null && o2 != null) {
+ return o1.getSessionName().compareTo(o2.getSessionName());
+ } else if (o1 != null) {
+ return 1;
+ } else {
+ return -1;
+ }
}
+ }
- private class ForumUserComparator implements Comparator {
- public int compare(ForumUser o1, ForumUser o2) {
- if (o1 != null && o2 != null) {
- return o1.getLoginName().compareTo(o2.getLoginName());
- }
- else if (o1 != null) {
- return 1;
- }
- else {
- return -1;
- }
- }
+ private class ForumUserComparator implements Comparator {
+ public int compare(ForumUser o1, ForumUser o2) {
+ if (o1 != null && o2 != null) {
+ return o1.getLoginName().compareTo(o2.getLoginName());
+ } else if (o1 != null) {
+ return 1;
+ } else {
+ return -1;
+ }
}
+ }
- private class UserDTOComparator implements Comparator {
- public int compare(UserDTO o1, UserDTO o2) {
- if (o1 != null && o2 != null) {
- return o1.getLoginName().compareTo(o2.getLoginName());
- }
- else if (o1 != null) {
- return 1;
- }
- else {
- return -1;
- }
- }
+ private class UserDTOComparator implements Comparator {
+ public int compare(UserDTO o1, UserDTO o2) {
+ if (o1 != null && o2 != null) {
+ return o1.getLoginName().compareTo(o2.getLoginName());
+ } else if (o1 != null) {
+ return 1;
+ } else {
+ return -1;
+ }
}
+ }
- /**
- * Action method entry.
- */
- @Override
- public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- String param = mapping.getParameter();
+ /**
+ * Action method entry.
+ */
+ @Override
+ public final ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ String param = mapping.getParameter();
- if (param.equals("init")) {
- return init(mapping, form, request, response);
- }
- //refresh statistic page by Ajax call.
- if (param.equals("statistic")) {
- return statistic(mapping, form, request, response);
- }
- // ***************** Marks Functions ********************
- if (param.equals("viewAllMarks")) {
- return viewAllMarks(mapping, form, request, response);
- }
- if (param.equals("downloadMarks")) {
- return downloadMarks(mapping, form, request, response);
- }
- if (param.equals("viewUserMark")) {
- return viewUserMark(mapping, form, request, response);
- }
- if (param.equals("editMark")) {
- return editMark(mapping, form, request, response);
- }
- if (param.equals("updateMark")) {
- return updateMark(mapping, form, request, response);
- }
+ if (param.equals("init")) {
+ return init(mapping, form, request, response);
+ }
+ //refresh statistic page by Ajax call.
+ if (param.equals("statistic")) {
+ return statistic(mapping, form, request, response);
+ }
+ // ***************** Marks Functions ********************
+ if (param.equals("viewAllMarks")) {
+ return viewAllMarks(mapping, form, request, response);
+ }
+ if (param.equals("downloadMarks")) {
+ return downloadMarks(mapping, form, request, response);
+ }
+ if (param.equals("viewUserMark")) {
+ return viewUserMark(mapping, form, request, response);
+ }
+ if (param.equals("editMark")) {
+ return editMark(mapping, form, request, response);
+ }
+ if (param.equals("updateMark")) {
+ return updateMark(mapping, form, request, response);
+ }
- if (param.equals("releaseMark")) {
- return releaseMark(mapping, form, request, response);
- }
+ if (param.equals("releaseMark")) {
+ return releaseMark(mapping, form, request, response);
+ }
- // ***************** Miscellaneous ********************
- if (param.equals("viewTopic")) {
- return viewTopic(mapping, form, request, response);
- }
- if (param.equals("viewTopicTree")) {
- return viewTopicTree(mapping, form, request, response);
- }
+ // ***************** Miscellaneous ********************
+ if (param.equals("viewTopic")) {
+ return viewTopic(mapping, form, request, response);
+ }
+ if (param.equals("viewTopicTree")) {
+ return viewTopicTree(mapping, form, request, response);
+ }
- if (param.equals("viewReflection")) {
- return viewReflection(mapping, form, request, response);
- }
-
- return mapping.findForward("error");
+ if (param.equals("viewReflection")) {
+ return viewReflection(mapping, form, request, response);
}
- /**
- * The initial method for monitoring
- */
- private ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
+ return mapping.findForward("error");
+ }
- // perform the actions for all the tabs.
- doTabs(mapping, form, request, response);
+ /**
+ * The initial method for monitoring
+ */
+ private ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- return mapping.findForward("load");
- }
+ // perform the actions for all the tabs.
+ doTabs(mapping, form, request, response);
- private ActionForward doTabs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
- //set back tool content ID
- String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
- request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
+ return mapping.findForward("load");
+ }
- Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
- request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentID);
+ private ActionForward doTabs(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ //set back tool content ID
+ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID);
+ request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID);
- request.setAttribute("initialTabId", WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true));
+ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentID);
- this.summary(mapping, form, request, response);
- this.viewInstructions(mapping, form, request, response);
- this.viewActivity(mapping, form, request, response, toolContentID);
- this.statistic(mapping, form, request, response);
- return mapping.findForward("load");
- }
+ request.setAttribute("initialTabId", WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true));
- /**
- * The initial method for monitoring. List all users according to given
- * Content ID.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
- Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ this.summary(mapping, form, request, response);
+ this.viewInstructions(mapping, form, request, response);
+ this.viewActivity(mapping, form, request, response, toolContentID);
+ this.statistic(mapping, form, request, response);
+ return mapping.findForward("load");
+ }
- forumService = getForumService();
- List sessionsList = forumService.getSessionsByContentId(toolContentID);
+ /**
+ * The initial method for monitoring. List all users according to given
+ * Content ID.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
- // A forum clone required for listing the advanced options LDEV-1662
- Forum forumClone = null;
+ forumService = getForumService();
+ List sessionsList = forumService.getSessionsByContentId(toolContentID);
- Map sessionUsersMap = new TreeMap(this.new SessionDTOComparator());
- // build a map with all users in the submitFilesSessionList
- Iterator it = sessionsList.iterator();
- while (it.hasNext()) {
- SessionDTO sessionDto = new SessionDTO();
- ForumToolSession fts = (ForumToolSession) it.next();
- boolean hasReflection = fts.getForum().isReflectOnActivity();
+ // A forum clone required for listing the advanced options LDEV-1662
+ Forum forumClone = null;
- if (forumClone == null) {
- forumClone = (Forum) fts.getForum().clone();
- request.setAttribute("forum", forumClone);
- }
+ Map sessionUsersMap = new TreeMap(this.new SessionDTOComparator());
+ // build a map with all users in the submitFilesSessionList
+ Iterator it = sessionsList.iterator();
+ while (it.hasNext()) {
+ SessionDTO sessionDto = new SessionDTO();
+ ForumToolSession fts = (ForumToolSession) it.next();
+ boolean hasReflection = fts.getForum().isReflectOnActivity();
- sessionDto.setSessionID(fts.getSessionId());
- sessionDto.setSessionName(fts.getSessionName());
- List userList = forumService.getUsersBySessionId(fts.getSessionId());
+ if (forumClone == null) {
+ forumClone = (Forum) fts.getForum().clone();
+ request.setAttribute("forum", forumClone);
+ }
- //sort and create DTO list
- List topicList = forumService.getAllTopicsFromSession(fts.getSessionId());
- Map topicsByUser = getTopicsSortedByAuthor(topicList);
+ sessionDto.setSessionID(fts.getSessionId());
+ sessionDto.setSessionName(fts.getSessionName());
+ List userList = forumService.getUsersBySessionId(fts.getSessionId());
- Set dtoList = new TreeSet(this.new UserDTOComparator());
- Iterator iter = userList.iterator();
- while (iter.hasNext()) {
- ForumUser user = (ForumUser) iter.next();
- UserDTO userDTO = new UserDTO(user);
- userDTO.setHasRefection(hasReflection);
+ //sort and create DTO list
+ List topicList = forumService.getAllTopicsFromSession(fts.getSessionId());
+ Map topicsByUser = getTopicsSortedByAuthor(topicList);
- userDTO.setAnyPostsMarked(false);
- userDTO.setNoOfPosts(0);
+ Set dtoList = new TreeSet(this.new UserDTOComparator());
+ Iterator iter = userList.iterator();
+ while (iter.hasNext()) {
+ ForumUser user = (ForumUser) iter.next();
+ UserDTO userDTO = new UserDTO(user);
+ userDTO.setHasRefection(hasReflection);
- List messages = (List) topicsByUser.get(user);
- if (messages != null && messages.size() > 0) {
- userDTO.setNoOfPosts(messages.size());
- for (MessageDTO message : messages) {
- if (message.getMark() != null) {
- userDTO.setAnyPostsMarked(true);
- break;
- }
- }
- }
- dtoList.add(userDTO);
- }
+ userDTO.setAnyPostsMarked(false);
+ userDTO.setNoOfPosts(0);
- sessionUsersMap.put(sessionDto, dtoList);
+ List messages = (List) topicsByUser.get(user);
+ if (messages != null && messages.size() > 0) {
+ userDTO.setNoOfPosts(messages.size());
+ for (MessageDTO message : messages) {
+ if (message.getMark() != null) {
+ userDTO.setAnyPostsMarked(true);
+ break;
+ }
+ }
}
+ dtoList.add(userDTO);
+ }
- // request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID);
- request.setAttribute("sessionUserMap", sessionUsersMap);
- return mapping.findForward("success");
-
+ sessionUsersMap.put(sessionDto, dtoList);
}
- /**
- * Download marks for all users in a speical session.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward downloadMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
- forumService = getForumService();
- List topicList = forumService.getAllTopicsFromSession(sessionID);
- // construct Excel file format and download
- ActionMessages errors = new ActionMessages();
- try {
- // create an empty excel file
- HSSFWorkbook wb = new HSSFWorkbook();
+ // request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID);
+ request.setAttribute("sessionUserMap", sessionUsersMap);
+ return mapping.findForward("success");
- HSSFSheet sheet = wb.createSheet("Marks");
- sheet.setColumnWidth((short) 0, (short) 5000);
- HSSFRow row = null;
- HSSFCell cell;
- Iterator iter = getTopicsSortedByAuthor(topicList).values().iterator();
- Iterator dtoIter;
- boolean first = true;
- int idx = 0;
- int fileCount = 0;
- while (iter.hasNext()) {
- List list = (List) iter.next();
- dtoIter = list.iterator();
- first = true;
+ }
- while (dtoIter.hasNext()) {
- MessageDTO dto = (MessageDTO) dtoIter.next();
- if (first) {
- first = false;
- row = sheet.createRow(0);
- cell = row.createCell((short) idx);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(getMessageService().getMessage("lable.topic.title.subject"));
- sheet.setColumnWidth((short) idx, (short) 8000);
- ++idx;
+ /**
+ * Download marks for all users in a speical session.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward downloadMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
+ forumService = getForumService();
+ List topicList = forumService.getAllTopicsFromSession(sessionID);
+ // construct Excel file format and download
+ ActionMessages errors = new ActionMessages();
+ try {
+ // create an empty excel file
+ HSSFWorkbook wb = new HSSFWorkbook();
- cell = row.createCell((short) idx);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(getMessageService().getMessage("lable.topic.title.author"));
- sheet.setColumnWidth((short) idx, (short) 8000);
- ++idx;
+ HSSFSheet sheet = wb.createSheet("Marks");
+ sheet.setColumnWidth((short) 0, (short) 5000);
+ HSSFRow row = null;
+ HSSFCell cell;
+ Iterator iter = getTopicsSortedByAuthor(topicList).values().iterator();
+ Iterator dtoIter;
+ boolean first = true;
+ int idx = 0;
+ int fileCount = 0;
+ while (iter.hasNext()) {
+ List list = (List) iter.next();
+ dtoIter = list.iterator();
+ first = true;
- cell = row.createCell((short) idx);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.date"));
- sheet.setColumnWidth((short) idx, (short) 8000);
- ++idx;
+ while (dtoIter.hasNext()) {
+ MessageDTO dto = (MessageDTO) dtoIter.next();
+ if (first) {
+ first = false;
+ row = sheet.createRow(0);
+ cell = row.createCell((short) idx);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(getMessageService().getMessage("lable.topic.title.subject"));
+ sheet.setColumnWidth((short) idx, (short) 8000);
+ ++idx;
- cell = row.createCell((short) idx);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.marks"));
- sheet.setColumnWidth((short) idx, (short) 8000);
- ++idx;
+ cell = row.createCell((short) idx);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(getMessageService().getMessage("lable.topic.title.author"));
+ sheet.setColumnWidth((short) idx, (short) 8000);
+ ++idx;
- cell = row.createCell((short) idx);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.comments"));
- sheet.setColumnWidth((short) idx, (short) 8000);
- ++idx;
- }
- ++fileCount;
- idx = 0;
- row = sheet.createRow(fileCount);
- cell = row.createCell((short) idx++);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(dto.getMessage().getSubject());
+ cell = row.createCell((short) idx);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.date"));
+ sheet.setColumnWidth((short) idx, (short) 8000);
+ ++idx;
- cell = row.createCell((short) idx++);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(dto.getAuthor());
+ cell = row.createCell((short) idx);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.marks"));
+ sheet.setColumnWidth((short) idx, (short) 8000);
+ ++idx;
- cell = row.createCell((short) idx++);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- cell.setCellValue(DateFormat.getInstance().format(dto.getMessage().getCreated()));
+ cell = row.createCell((short) idx);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(getMessageService().getMessage("label.download.marks.heading.comments"));
+ sheet.setColumnWidth((short) idx, (short) 8000);
+ ++idx;
+ }
+ ++fileCount;
+ idx = 0;
+ row = sheet.createRow(fileCount);
+ cell = row.createCell((short) idx++);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(dto.getMessage().getSubject());
- cell = row.createCell((short) idx++);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell = row.createCell((short) idx++);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(dto.getAuthor());
- if (dto.getMessage() != null && dto.getMessage().getReport() != null
- && dto.getMessage().getReport().getMark() != null) {
- cell.setCellValue(NumberUtil.formatLocalisedNumber(dto.getMessage().getReport().getMark(), request
- .getLocale(), 2));
- }
- else {
- cell.setCellValue("");
- }
+ cell = row.createCell((short) idx++);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ cell.setCellValue(DateFormat.getInstance().format(dto.getMessage().getCreated()));
- cell = row.createCell((short) idx++);
- cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- if (dto.getMessage() != null && dto.getMessage().getReport() != null) {
- cell.setCellValue(dto.getMessage().getReport().getComment());
- }
- else {
- cell.setCellValue("");
- }
- }
- }
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- wb.write(bos);
- // construct download file response header
- String fileName = "marks" + sessionID + ".xls";
- String mineType = "application/vnd.ms-excel";
- String header = "attachment; filename=\"" + fileName + "\";";
- response.setContentType(mineType);
- response.setHeader("Content-Disposition", header);
+ cell = row.createCell((short) idx++);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
- byte[] data = bos.toByteArray();
- response.getOutputStream().write(data, 0, data.length);
- response.getOutputStream().flush();
- }
- catch (IOException e) {
- MonitoringAction.log.error(e);
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("monitoring.download.error", e.toString()));
- }
+ if (dto.getMessage() != null && dto.getMessage().getReport() != null
+ && dto.getMessage().getReport().getMark() != null) {
+ cell.setCellValue(NumberUtil.formatLocalisedNumber(dto.getMessage().getReport().getMark(),
+ request.getLocale(), 2));
+ } else {
+ cell.setCellValue("");
+ }
- if (!errors.isEmpty()) {
- saveErrors(request, errors);
- request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, sessionID);
- return mapping.getInputForward();
+ cell = row.createCell((short) idx++);
+ cell.setEncoding(HSSFCell.ENCODING_UTF_16);
+ if (dto.getMessage() != null && dto.getMessage().getReport() != null) {
+ cell.setCellValue(dto.getMessage().getReport().getComment());
+ } else {
+ cell.setCellValue("");
+ }
}
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ wb.write(bos);
+ // construct download file response header
+ String fileName = "marks" + sessionID + ".xls";
+ String mineType = "application/vnd.ms-excel";
+ String header = "attachment; filename=\"" + fileName + "\";";
+ response.setContentType(mineType);
+ response.setHeader("Content-Disposition", header);
- return null;
+ byte[] data = bos.toByteArray();
+ response.getOutputStream().write(data, 0, data.length);
+ response.getOutputStream().flush();
+ } catch (IOException e) {
+ MonitoringAction.log.error(e);
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("monitoring.download.error", e.toString()));
}
- /**
- * View activity for content.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response, Long toolContentID) {
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, sessionID);
+ return mapping.getInputForward();
+ }
- forumService = getForumService();
- Forum forum = forumService.getForumByContentId(toolContentID);
- // if can not find out forum, echo back error message
- if (forum == null) {
- ActionErrors errors = new ActionErrors();
- errors.add("activity.globel", new ActionMessage("error.fail.get.forum"));
- this.addErrors(request, errors);
- return mapping.getInputForward();
- }
- String title = forum.getTitle();
- String instruction = forum.getInstructions();
+ return null;
+ }
- boolean isForumEditable = ForumWebUtils.isForumEditable(forum);
- request.setAttribute(ForumConstants.PAGE_EDITABLE, new Boolean(isForumEditable));
- request.setAttribute("title", title);
- request.setAttribute("instruction", instruction);
- return mapping.findForward("success");
+ /**
+ * View activity for content.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response, Long toolContentID) {
+
+ forumService = getForumService();
+ Forum forum = forumService.getForumByContentId(toolContentID);
+ // if can not find out forum, echo back error message
+ if (forum == null) {
+ ActionErrors errors = new ActionErrors();
+ errors.add("activity.globel", new ActionMessage("error.fail.get.forum"));
+ this.addErrors(request, errors);
+ return mapping.getInputForward();
}
+ String title = forum.getTitle();
+ String instruction = forum.getInstructions();
- /**
- * View instruction information for a content.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewInstructions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ boolean isForumEditable = ForumWebUtils.isForumEditable(forum);
+ request.setAttribute(ForumConstants.PAGE_EDITABLE, new Boolean(isForumEditable));
+ request.setAttribute("title", title);
+ request.setAttribute("instruction", instruction);
+ return mapping.findForward("success");
+ }
- forumService = getForumService();
- Forum forum = forumService.getForumByContentId(toolContentID);
- // if can not find out forum, echo back error message
- if (forum == null) {
- ActionErrors errors = new ActionErrors();
- errors.add("instruction.globel", new ActionMessage("error.fail.get.forum"));
- this.addErrors(request, errors);
- return mapping.getInputForward();
- }
+ /**
+ * View instruction information for a content.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewInstructions(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
- ForumForm forumForm = new ForumForm();
- forumForm.setForum(forum);
-
- request.setAttribute("forumBean", forumForm);
- return mapping.findForward("success");
+ forumService = getForumService();
+ Forum forum = forumService.getForumByContentId(toolContentID);
+ // if can not find out forum, echo back error message
+ if (forum == null) {
+ ActionErrors errors = new ActionErrors();
+ errors.add("instruction.globel", new ActionMessage("error.fail.get.forum"));
+ this.addErrors(request, errors);
+ return mapping.getInputForward();
}
- /**
- * Show statisitc page for a session.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward statistic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
+ ForumForm forumForm = new ForumForm();
+ forumForm.setForum(forum);
- forumService = getForumService();
- Map sessionTopicsMap = new TreeMap>(this.new SessionDTOComparator());
- Map sessionAvaMarkMap = new HashMap();
- Map sessionTotalMsgMap = new HashMap();
+ request.setAttribute("forumBean", forumForm);
+ return mapping.findForward("success");
+ }
- List sessList = forumService.getSessionsByContentId(toolContentID);
- Iterator sessIter = sessList.iterator();
- while (sessIter.hasNext()) {
- ForumToolSession session = (ForumToolSession) sessIter.next();
- List topicList = forumService.getRootTopics(session.getSessionId());
- Iterator iter = topicList.iterator();
- int totalMsg = 0;
- int msgNum;
- float totalMsgMarkSum = 0;
- float msgMarkSum = 0;
- for (; iter.hasNext();) {
- MessageDTO msgDto = (MessageDTO) iter.next();
- // get all message under this topic
- List topicThread = forumService.getTopicThread(msgDto.getMessage().getUid());
- // loop all message under this topic
- msgMarkSum = 0;
- Iterator threadIter = topicThread.iterator();
- for (msgNum = 0; threadIter.hasNext(); msgNum++) {
- MessageDTO dto = (MessageDTO) threadIter.next();
- if (dto.getMark() != null) {
- msgMarkSum += dto.getMark().floatValue();
- }
- }
- // summary to total mark
- totalMsgMarkSum += msgMarkSum;
- // set average mark to topic message DTO for display use
- msgDto.setMark(msgMarkSum / msgNum);
- totalMsg += msgNum;
- }
+ /**
+ * Show statisitc page for a session.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward statistic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID));
- float averMark = totalMsg == 0 ? 0 : totalMsgMarkSum / totalMsg;
+ forumService = getForumService();
+ Map sessionTopicsMap = new TreeMap>(this.new SessionDTOComparator());
+ Map sessionAvaMarkMap = new HashMap();
+ Map sessionTotalMsgMap = new HashMap();
- SessionDTO sessionDto = new SessionDTO();
- sessionDto.setSessionID(session.getSessionId());
- sessionDto.setSessionName(session.getSessionName());
-
- sessionTopicsMap.put(sessionDto, topicList);
- sessionAvaMarkMap.put(session.getSessionId(), averMark);
- sessionTotalMsgMap.put(session.getSessionId(), new Integer(totalMsg));
+ List sessList = forumService.getSessionsByContentId(toolContentID);
+ Iterator sessIter = sessList.iterator();
+ while (sessIter.hasNext()) {
+ ForumToolSession session = (ForumToolSession) sessIter.next();
+ List topicList = forumService.getRootTopics(session.getSessionId());
+ Iterator iter = topicList.iterator();
+ int totalMsg = 0;
+ int msgNum;
+ float totalMsgMarkSum = 0;
+ float msgMarkSum = 0;
+ for (; iter.hasNext();) {
+ MessageDTO msgDto = (MessageDTO) iter.next();
+ // get all message under this topic
+ List topicThread = forumService.getTopicThread(msgDto.getMessage().getUid());
+ // loop all message under this topic
+ msgMarkSum = 0;
+ Iterator threadIter = topicThread.iterator();
+ for (msgNum = 0; threadIter.hasNext(); msgNum++) {
+ MessageDTO dto = (MessageDTO) threadIter.next();
+ if (dto.getMark() != null) {
+ msgMarkSum += dto.getMark().floatValue();
+ }
}
- request.setAttribute("topicList", sessionTopicsMap);
- request.setAttribute("markAverage", sessionAvaMarkMap);
- request.setAttribute("totalMessage", sessionTotalMsgMap);
- return mapping.findForward("success");
- }
+ // summary to total mark
+ totalMsgMarkSum += msgMarkSum;
+ // set average mark to topic message DTO for display use
+ msgDto.setMark(msgMarkSum / msgNum);
+ totalMsg += msgNum;
+ }
- /**
- * View all messages under one topic.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewTopicTree(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ float averMark = totalMsg == 0 ? 0 : totalMsgMarkSum / totalMsg;
- Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
- forumService = getForumService();
- // get root topic list
- List msgDtoList = forumService.getTopicThread(rootTopicId);
- request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
+ SessionDTO sessionDto = new SessionDTO();
+ sessionDto.setSessionID(session.getSessionId());
+ sessionDto.setSessionName(session.getSessionName());
- return mapping.findForward("success");
+ sessionTopicsMap.put(sessionDto, topicList);
+ sessionAvaMarkMap.put(session.getSessionId(), averMark);
+ sessionTotalMsgMap.put(session.getSessionId(), new Integer(totalMsg));
}
+ request.setAttribute("topicList", sessionTopicsMap);
+ request.setAttribute("markAverage", sessionAvaMarkMap);
+ request.setAttribute("totalMessage", sessionTotalMsgMap);
+ return mapping.findForward("success");
+ }
- private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ /**
+ * View all messages under one topic.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewTopicTree(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- Long uid = WebUtil.readLongParam(request, ForumConstants.ATTR_USER_UID);
- Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
+ Long rootTopicId = WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID);
+ forumService = getForumService();
+ // get root topic list
+ List msgDtoList = forumService.getTopicThread(rootTopicId);
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC_THREAD, msgDtoList);
- ForumUser user = forumService.getUser(uid);
- NotebookEntry notebookEntry = forumService.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
- ForumConstants.TOOL_SIGNATURE, user.getUserId().intValue());
+ return mapping.findForward("success");
+ }
- ForumToolSession session = forumService.getSessionBySessionId(sessionID);
+ private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- UserDTO userDTO = new UserDTO(user);
- if (notebookEntry == null) {
- userDTO.setFinishReflection(false);
- userDTO.setReflect(null);
- }
- else {
- userDTO.setFinishReflection(true);
- userDTO.setReflect(notebookEntry.getEntry());
- }
- userDTO.setReflectInstrctions(session.getForum().getReflectInstructions());
+ Long uid = WebUtil.readLongParam(request, ForumConstants.ATTR_USER_UID);
+ Long sessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID);
- request.setAttribute("userDTO", userDTO);
- return mapping.findForward("success");
- }
+ ForumUser user = forumService.getUser(uid);
+ NotebookEntry notebookEntry = forumService.getEntry(sessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
+ ForumConstants.TOOL_SIGNATURE, user.getUserId().intValue());
- /**
- * View topic subject, content and attachement.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
+ ForumToolSession session = forumService.getSessionBySessionId(sessionID);
- Long msgUid = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID));
-
- forumService = getForumService();
- Message topic = forumService.getMessage(msgUid);
-
- request.setAttribute(ForumConstants.AUTHORING_TOPIC, MessageDTO.getMessageDTO(topic));
- return mapping.findForward("success");
+ UserDTO userDTO = new UserDTO(user);
+ if (notebookEntry == null) {
+ userDTO.setFinishReflection(false);
+ userDTO.setReflect(null);
+ } else {
+ userDTO.setFinishReflection(true);
+ userDTO.setReflect(notebookEntry.getEntry());
}
+ userDTO.setReflectInstrctions(session.getForum().getReflectInstructions());
- private ActionForward releaseMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- //get service then update report table
- forumService = getForumService();
- Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
- forumService.releaseMarksForSession(sessionID);
+ request.setAttribute("userDTO", userDTO);
+ return mapping.findForward("success");
+ }
- try {
- response.setContentType("text/html;charset=utf-8");
- PrintWriter out = response.getWriter();
- ForumToolSession session = forumService.getSessionBySessionId(sessionID);
- String sessionName = "";
- if (session != null) {
- sessionName = session.getSessionName();
- }
- out.write(getMessageService().getMessage("msg.mark.released", new String[] { sessionName }));
- out.flush();
+ /**
+ * View topic subject, content and attachement.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewTopic(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
- }
- catch (IOException e) {
- }
- return null;
- }
+ Long msgUid = new Long(WebUtil.readLongParam(request, ForumConstants.ATTR_TOPIC_ID));
- // ==========================================================================================
- // View and update marks methods
- // ==========================================================================================
+ forumService = getForumService();
+ Message topic = forumService.getMessage(msgUid);
- /**
- * View all user marks for a special Session ID
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewAllMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- //only one param for session scope marks
- Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
+ request.setAttribute(ForumConstants.AUTHORING_TOPIC, MessageDTO.getMessageDTO(topic));
+ return mapping.findForward("success");
+ }
- //create sessionMap
- SessionMap sessionMap = new SessionMap();
- request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
- sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionID);
- sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_SESSION);
+ private ActionForward releaseMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ //get service then update report table
+ forumService = getForumService();
+ Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
+ forumService.releaseMarksForSession(sessionID);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ try {
+ response.setContentType("text/html;charset=utf-8");
+ PrintWriter out = response.getWriter();
+ ForumToolSession session = forumService.getSessionBySessionId(sessionID);
+ String sessionName = "";
+ if (session != null) {
+ sessionName = session.getSessionName();
+ }
+ out.write(getMessageService().getMessage("msg.mark.released", new String[] { sessionName }));
+ out.flush();
- //get tool session scope topics
- forumService = getForumService();
- List topicList = forumService.getAllTopicsFromSession(sessionID);
-
- Map topicsByUser = getTopicsSortedByAuthor(topicList);
- request.setAttribute(ForumConstants.ATTR_REPORT, topicsByUser);
- return mapping.findForward("success");
+ } catch (IOException e) {
}
+ return null;
+ }
- /**
- * View a special user's mark
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward viewUserMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- Long userUid = new Long(WebUtil.readLongParam(request, ForumConstants.USER_UID));
- Long sessionId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
+ // ==========================================================================================
+ // View and update marks methods
+ // ==========================================================================================
- //create sessionMap
- SessionMap sessionMap = new SessionMap();
- request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ /**
+ * View all user marks for a special Session ID
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewAllMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ //only one param for session scope marks
+ Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
- sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
- sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_USER);
+ //create sessionMap
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
+ sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionID);
+ sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_SESSION);
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
- //get this user's all topics
- forumService = getForumService();
- List messageList = forumService.getMessagesByUserUid(userUid, sessionId);
- ForumUser user = forumService.getUser(userUid);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
- // each back to web page
- Map> report = new TreeMap(this.new ForumUserComparator());
- report.put(user, messageList);
- request.setAttribute(ForumConstants.ATTR_REPORT, report);
+ //get tool session scope topics
+ forumService = getForumService();
+ List topicList = forumService.getAllTopicsFromSession(sessionID);
- return mapping.findForward("success");
- }
+ Map topicsByUser = getTopicsSortedByAuthor(topicList);
+ request.setAttribute(ForumConstants.ATTR_REPORT, topicsByUser);
+ return mapping.findForward("success");
+ }
- /**
- * Edit a special user's mark.
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward editMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- MarkForm markForm = (MarkForm) form;
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(markForm.getSessionMapID());
- String updateMode = (String) sessionMap.get(ForumConstants.PARAM_UPDATE_MODE);
- //view forum mode
- if (StringUtils.isBlank(updateMode)) {
- sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_FORUM);
- sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, markForm.getTopicID());
- }
+ /**
+ * View a special user's mark
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward viewUserMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ Long userUid = new Long(WebUtil.readLongParam(request, ForumConstants.USER_UID));
+ Long sessionId = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID));
- // get Message and User from database
- forumService = getForumService();
- Message msg = forumService.getMessage(markForm.getTopicID());
- ForumUser user = msg.getCreatedBy();
+ //create sessionMap
+ SessionMap sessionMap = new SessionMap();
+ request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap);
- // echo back to web page
- if (msg.getReport() != null) {
- if (msg.getReport().getMark() != null) {
- markForm.setMark(NumberUtil.formatLocalisedNumber(msg.getReport().getMark(), request.getLocale(), 2));
- }
- else {
- markForm.setMark("");
- }
- markForm.setComment(msg.getReport().getComment());
- }
+ sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId);
+ sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_USER);
- // each back to web page
- request.setAttribute(ForumConstants.ATTR_TOPIC, MessageDTO.getMessageDTO(msg));
- request.setAttribute(ForumConstants.ATTR_USER, user);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID());
+ //get this user's all topics
+ forumService = getForumService();
+ List messageList = forumService.getMessagesByUserUid(userUid, sessionId);
+ ForumUser user = forumService.getUser(userUid);
- // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
- // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
- // Need to constantly past this value on, rather than hiding just the once, as the View Forum
- // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
- // as it has a link from the view topic screen back to View Forum screen.
- boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
- sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
+ // each back to web page
+ Map> report = new TreeMap(this.new ForumUserComparator());
+ report.put(user, messageList);
+ request.setAttribute(ForumConstants.ATTR_REPORT, report);
- return mapping.findForward("success");
+ return mapping.findForward("success");
+ }
+
+ /**
+ * Edit a special user's mark.
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward editMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ MarkForm markForm = (MarkForm) form;
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(markForm.getSessionMapID());
+ String updateMode = (String) sessionMap.get(ForumConstants.PARAM_UPDATE_MODE);
+ //view forum mode
+ if (StringUtils.isBlank(updateMode)) {
+ sessionMap.put(ForumConstants.PARAM_UPDATE_MODE, ForumConstants.MARK_UPDATE_FROM_FORUM);
+ sessionMap.put(ForumConstants.ATTR_ROOT_TOPIC_UID, markForm.getTopicID());
}
- /**
- * Update mark for a special user
- *
- * @param mapping
- * @param form
- * @param request
- * @param response
- * @return
- */
- private ActionForward updateMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
- HttpServletResponse response) {
- MarkForm markForm = (MarkForm) form;
+ // get Message and User from database
+ forumService = getForumService();
+ Message msg = forumService.getMessage(markForm.getTopicID());
+ ForumUser user = msg.getCreatedBy();
- request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, markForm.getSessionMapID());
- String markStr = markForm.getMark();
- Float mark = null;
- ActionMessages errors = new ActionMessages();
- if (StringUtils.isBlank(markStr)) {
- ActionMessage error = new ActionMessage("error.valueReqd");
- errors.add("report.mark", error);
- }
- else {
- try {
- mark = NumberUtil.getLocalisedFloat(markStr, request.getLocale());
- }
- catch (Exception e) {
- ActionMessage error = new ActionMessage("error.mark.invalid.number");
- errors.add("report.mark", error);
- }
- }
+ // echo back to web page
+ if (msg.getReport() != null) {
+ if (msg.getReport().getMark() != null) {
+ markForm.setMark(NumberUtil.formatLocalisedNumber(msg.getReport().getMark(), request.getLocale(), 2));
+ } else {
+ markForm.setMark("");
+ }
+ markForm.setComment(msg.getReport().getComment());
+ }
- forumService = getForumService();
- // echo back to web page
- Message msg = forumService.getMessage(markForm.getTopicID());
- ForumUser user = msg.getCreatedBy();
+ // each back to web page
+ request.setAttribute(ForumConstants.ATTR_TOPIC, MessageDTO.getMessageDTO(msg));
+ request.setAttribute(ForumConstants.ATTR_USER, user);
- request.setAttribute(ForumConstants.ATTR_USER, user);
- if (!errors.isEmpty()) {
- // each back to web page
- request.setAttribute(ForumConstants.ATTR_TOPIC, MessageDTO.getMessageDTO(msg));
- saveErrors(request, errors);
- return mapping.getInputForward();
- }
+ // Should we show the reflection or not? We shouldn't show it when the View Forum screen is accessed
+ // from the Monitoring Summary screen, but we should when accessed from the Learner Progress screen.
+ // Need to constantly past this value on, rather than hiding just the once, as the View Forum
+ // screen has a refresh button. Need to pass it through the view topic screen and dependent screens
+ // as it has a link from the view topic screen back to View Forum screen.
+ boolean hideReflection = WebUtil.readBooleanParam(request, ForumConstants.ATTR_HIDE_REFLECTION, false);
+ sessionMap.put(ForumConstants.ATTR_HIDE_REFLECTION, hideReflection);
- //update message report
+ return mapping.findForward("success");
+ }
- forumService = getForumService();
- ForumReport report = msg.getReport();
- if (report == null) {
- report = new ForumReport();
- msg.setReport(report);
- }
+ /**
+ * Update mark for a special user
+ *
+ * @param mapping
+ * @param form
+ * @param request
+ * @param response
+ * @return
+ */
+ private ActionForward updateMark(ActionMapping mapping, ActionForm form, HttpServletRequest request,
+ HttpServletResponse response) {
+ MarkForm markForm = (MarkForm) form;
- SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(markForm.getSessionMapID());
- Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
- String updateMode = (String) sessionMap.get(ForumConstants.PARAM_UPDATE_MODE);
+ request.setAttribute(ForumConstants.ATTR_SESSION_MAP_ID, markForm.getSessionMapID());
+ String markStr = markForm.getMark();
+ Float mark = null;
+ ActionMessages errors = new ActionMessages();
+ if (StringUtils.isBlank(markStr)) {
+ ActionMessage error = new ActionMessage("error.valueReqd");
+ errors.add("report.mark", error);
+ } else {
+ try {
+ mark = NumberUtil.getLocalisedFloat(markStr, request.getLocale());
+ } catch (Exception e) {
+ ActionMessage error = new ActionMessage("error.mark.invalid.number");
+ errors.add("report.mark", error);
+ }
+ }
- //only session has been released mark, the data of mark release will have value.
- ForumToolSession toolSession = forumService.getSessionBySessionId(sessionId);
- if (toolSession.isMarkReleased()) {
- report.setDateMarksReleased(new Date());
- }
+ forumService = getForumService();
+ // echo back to web page
+ Message msg = forumService.getMessage(markForm.getTopicID());
+ ForumUser user = msg.getCreatedBy();
- report.setMark(mark);
- report.setComment(markForm.getComment());
- forumService.updateTopic(msg);
+ request.setAttribute(ForumConstants.ATTR_USER, user);
+ if (!errors.isEmpty()) {
+ // each back to web page
+ request.setAttribute(ForumConstants.ATTR_TOPIC, MessageDTO.getMessageDTO(msg));
+ saveErrors(request, errors);
+ return mapping.getInputForward();
+ }
- //echo back to topic list page: it depends which screen is come from: view special user mark, or view all user marks.
- if (StringUtils.equals(updateMode, ForumConstants.MARK_UPDATE_FROM_SESSION)) {
- List topicList = forumService.getAllTopicsFromSession(sessionId);
- Map topicsByUser = getTopicsSortedByAuthor(topicList);
- request.setAttribute(ForumConstants.ATTR_REPORT, topicsByUser);
- //listMark or listAllMark.
- return mapping.findForward("success");
- }
- else if (StringUtils.equals(updateMode, ForumConstants.MARK_UPDATE_FROM_USER)) {
- List messageList = forumService.getMessagesByUserUid(user.getUid(), sessionId);
- Map> topicMap = new TreeMap(this.new ForumUserComparator());
- topicMap.put(user, messageList);
- request.setAttribute(ForumConstants.ATTR_REPORT, topicMap);
- //listMark or listAllMark.
- return mapping.findForward("success");
- }
- else { //mark from view forum
- return mapping.findForward("viewTopic");
- }
+ //update message report
+ forumService = getForumService();
+ ForumReport report = msg.getReport();
+ if (report == null) {
+ report = new ForumReport();
+ msg.setReport(report);
}
- // ==========================================================================================
- // Utility methods
- // ==========================================================================================
+ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(markForm.getSessionMapID());
+ Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID);
+ String updateMode = (String) sessionMap.get(ForumConstants.PARAM_UPDATE_MODE);
- /**
- * Get Forum Service.
- *
- * @return
- */
- private IForumService getForumService() {
- if (forumService == null) {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
- .getServletContext());
- forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE);
- }
- return forumService;
+ report.setMark(mark);
+ report.setComment(markForm.getComment());
+ forumService.updateTopic(msg);
+
+ //echo back to topic list page: it depends which screen is come from: view special user mark, or view all user marks.
+ if (StringUtils.equals(updateMode, ForumConstants.MARK_UPDATE_FROM_SESSION)) {
+ List topicList = forumService.getAllTopicsFromSession(sessionId);
+ Map topicsByUser = getTopicsSortedByAuthor(topicList);
+ request.setAttribute(ForumConstants.ATTR_REPORT, topicsByUser);
+ //listMark or listAllMark.
+ return mapping.findForward("success");
+ } else if (StringUtils.equals(updateMode, ForumConstants.MARK_UPDATE_FROM_USER)) {
+ List messageList = forumService.getMessagesByUserUid(user.getUid(), sessionId);
+ Map> topicMap = new TreeMap(this.new ForumUserComparator());
+ topicMap.put(user, messageList);
+ request.setAttribute(ForumConstants.ATTR_REPORT, topicMap);
+ //listMark or listAllMark.
+ return mapping.findForward("success");
+ } else { //mark from view forum
+ return mapping.findForward("viewTopic");
}
- /**
- * @param topicList
- * @return
- */
- private Map getTopicsSortedByAuthor(List topicList) {
- Map> topicsByUser = new TreeMap(this.new ForumUserComparator());
- Iterator iter = topicList.iterator();
- forumService = getForumService();
- while (iter.hasNext()) {
- MessageDTO dto = (MessageDTO) iter.next();
- if (dto.getMessage().getIsAuthored()) {
- continue;
- }
- dto.getMessage().getReport();
- ForumUser user = (ForumUser) dto.getMessage().getCreatedBy().clone();
- List list = topicsByUser.get(user);
- if (list == null) {
- list = new ArrayList();
- topicsByUser.put(user, list);
- }
- list.add(dto);
- }
- return topicsByUser;
+ }
+
+ // ==========================================================================================
+ // Utility methods
+ // ==========================================================================================
+
+ /**
+ * Get Forum Service.
+ *
+ * @return
+ */
+ private IForumService getForumService() {
+ if (forumService == null) {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ forumService = (IForumService) wac.getBean(ForumConstants.FORUM_SERVICE);
}
+ return forumService;
+ }
- /**
- * Return ResourceService bean.
- */
- private MessageService getMessageService() {
- WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext());
- return (MessageService) wac.getBean("forumMessageService");
+ /**
+ * @param topicList
+ * @return
+ */
+ private Map getTopicsSortedByAuthor(List topicList) {
+ Map> topicsByUser = new TreeMap(this.new ForumUserComparator());
+ Iterator iter = topicList.iterator();
+ forumService = getForumService();
+ while (iter.hasNext()) {
+ MessageDTO dto = (MessageDTO) iter.next();
+ if (dto.getMessage().getIsAuthored()) {
+ continue;
+ }
+ dto.getMessage().getReport();
+ ForumUser user = (ForumUser) dto.getMessage().getCreatedBy().clone();
+ List list = topicsByUser.get(user);
+ if (list == null) {
+ list = new ArrayList();
+ topicsByUser.put(user, list);
+ }
+ list.add(dto);
}
+ return topicsByUser;
+ }
+
+ /**
+ * Return ResourceService bean.
+ */
+ private MessageService getMessageService() {
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet()
+ .getServletContext());
+ return (MessageService) wac.getBean("forumMessageService");
+ }
}
Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java
===================================================================
diff -u -r00a6e145b37916eb1561ea5c68319b0fc691681b -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java (.../ForumPedagogicalPlannerForm.java) (revision 00a6e145b37916eb1561ea5c68319b0fc691681b)
+++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/ForumPedagogicalPlannerForm.java (.../ForumPedagogicalPlannerForm.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -40,6 +40,7 @@
public class ForumPedagogicalPlannerForm extends PedagogicalPlannerActivityForm {
private List topic;
private String contentFolderID;
+ private String instructions;
@Override
public ActionMessages validate() {
@@ -68,13 +69,14 @@
public void fillForm(Forum forum) {
if (forum != null) {
setToolContentID(forum.getContentId());
+ setInstructions(forum.getInstructions());
topic = new ArrayList();
Set messages = forum.getMessages();
if (messages != null) {
int topicIndex = 0;
for (Message message : (Set) messages) {
- setTopic(topicIndex++, message.getSubject());
+ setTopic(topicIndex++, message.getBody());
}
}
}
@@ -120,4 +122,12 @@
public List getTopicList() {
return topic;
}
+
+ public String getInstructions() {
+ return instructions;
+ }
+
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
}
\ No newline at end of file
Fisheye: Tag b1ef965ad3a0cd4ea7bb807bd313d1f0cf68d1e7 refers to a dead (removed) revision in file `lams_tool_forum/web/WEB-INF/struts/validator-rules.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_tool_forum/web/jsps/authoring/addCondition.jsp
===================================================================
diff -u -rc081e2b0c9c82fc97d2d39fb7109c9c2f10ff224 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_forum/web/jsps/authoring/addCondition.jsp (.../addCondition.jsp) (revision c081e2b0c9c82fc97d2d39fb7109c9c2f10ff224)
+++ lams_tool_forum/web/jsps/authoring/addCondition.jsp (.../addCondition.jsp) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -38,9 +38,9 @@
-
-
<%@ include file="/common/messages.jsp"%>
-
+
+
+
+
+
+
Index: lams_tool_gmap/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -rae79693b9b338e156d4c2b82d947876e2d9b9f66 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_gmap/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ae79693b9b338e156d4c2b82d947876e2d9b9f66)
+++ lams_tool_gmap/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -2,7 +2,7 @@
#language code: en
#locale code: AU
- # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Mon Nov 24 01:10:52 GMT 2008
+ # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu May 14 00:22:06 CST 2009
#=================== labels for Google Maps =================#
@@ -112,13 +112,14 @@
admin.gmapKey =Google Maps API Key
admin.success =Configuration successfully saved.
admin.return =Return to maintain LAMS
+label.unsavedMarkers =You have one or more markers on the map without a title, if you continue these markers will not be saved. Do you want to continue anyway?
advanced.reflectOnActivity =Add Notebook at end of Gmap with the following instructions:
button.continue =Continue
monitor.summary.td.addNotebook =Add Notebook at end of Gmap
button.placeMarker =Place marker
message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
button.fitMarkers =Fit All Markers in Map
-label.unsavedMarkers =You have one or more markers on the map without a title, if you continue these markers will not be saved. Do you want to continue anyway?
+label.nogroups =No groups found for activity.
-#======= End labels: Exported 113 labels for en AU =====
+#======= End labels: Exported 114 labels for en AU =====
Index: lams_tool_gmap/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
diff -u -rae79693b9b338e156d4c2b82d947876e2d9b9f66 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_gmap/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision ae79693b9b338e156d4c2b82d947876e2d9b9f66)
+++ lams_tool_gmap/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -2,7 +2,7 @@
#language code: en
#locale code: AU
- # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Mon Nov 24 01:10:52 GMT 2008
+ # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu May 14 00:22:06 CST 2009
#=================== labels for Google Maps =================#
@@ -112,13 +112,14 @@
admin.gmapKey =Google Maps API Key
admin.success =Configuration successfully saved.
admin.return =Return to maintain LAMS
+label.unsavedMarkers =You have one or more markers on the map without a title, if you continue these markers will not be saved. Do you want to continue anyway?
advanced.reflectOnActivity =Add Notebook at end of Gmap with the following instructions:
button.continue =Continue
monitor.summary.td.addNotebook =Add Notebook at end of Gmap
button.placeMarker =Place marker
message.alertContentEdit =Warning: One of more learners have accessed this activity. Changing this content will result in learners getting different information.
button.fitMarkers =Fit All Markers in Map
-label.unsavedMarkers =You have one or more markers on the map without a title, if you continue these markers will not be saved. Do you want to continue anyway?
+label.nogroups =No groups found for activity.
-#======= End labels: Exported 113 labels for en AU =====
+#======= End labels: Exported 114 labels for en AU =====
Index: lams_tool_gmap/conf/xdoclet/web-settings.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_gmap/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_gmap/conf/xdoclet/web-settings.xml (.../web-settings.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -5,13 +5,17 @@
org.lamsfoundation.lams.tool.gmap.ApplicationResources
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/gmap/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
Index: lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/MonitoringAction.java
===================================================================
diff -u -r941ce68be457b4cb4fcf2d830a44a9361f6f5370 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision 941ce68be457b4cb4fcf2d830a44a9361f6f5370)
+++ lams_tool_gmap/src/java/org/lamsfoundation/lams/tool/gmap/web/actions/MonitoringAction.java (.../MonitoringAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -89,22 +89,25 @@
GmapDTO gmapDT0 = new GmapDTO(gmap);
// Adding the markers lists to a map with tool sessions as the key
- //Map > sessionMarkersMap = new HashMap >();
- for (GmapSessionDTO sessionDTO : gmapDT0.getSessionDTOs()) {
- Long toolSessionID = sessionDTO.getSessionID();
- sessionDTO.setMarkerDTOs(gmapService.getGmapMarkersBySessionId(toolSessionID));
- for (GmapUserDTO userDTO : sessionDTO.getUserDTOs()) {
- // get the notebook entry.
- NotebookEntry notebookEntry = gmapService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL,
- GmapConstants.TOOL_SIGNATURE, userDTO.getUserId().intValue());
- if (notebookEntry != null) {
- userDTO.setFinishedReflection(true);
- //userDTO.setNotebookEntry(notebookEntry.getEntry());
- } else {
- userDTO.setFinishedReflection(false);
+ if (gmapDT0.getSessionDTOs() != null) {
+ for (GmapSessionDTO sessionDTO : gmapDT0.getSessionDTOs()) {
+ Long toolSessionID = sessionDTO.getSessionID();
+ sessionDTO.setMarkerDTOs(gmapService.getGmapMarkersBySessionId(toolSessionID));
+
+ for (GmapUserDTO userDTO : sessionDTO.getUserDTOs()) {
+ // get the notebook entry.
+ NotebookEntry notebookEntry = gmapService.getEntry(toolSessionID,
+ CoreNotebookConstants.NOTEBOOK_TOOL, GmapConstants.TOOL_SIGNATURE, userDTO.getUserId()
+ .intValue());
+ if (notebookEntry != null) {
+ userDTO.setFinishedReflection(true);
+ //userDTO.setNotebookEntry(notebookEntry.getEntry());
+ } else {
+ userDTO.setFinishedReflection(false);
+ }
+ sessionDTO.getUserDTOs().add(userDTO);
}
- sessionDTO.getUserDTOs().add(userDTO);
}
}
Index: lams_tool_gmap/web/pages/monitoring/summary.jsp
===================================================================
diff -u -rcf00c458d8f6d4cef59b8280c3ecfc45db474bee -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_gmap/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision cf00c458d8f6d4cef59b8280c3ecfc45db474bee)
+++ lams_tool_gmap/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -195,7 +195,7 @@
-
No groups found for lesson.
+
Index: lams_tool_images/web/WEB-INF/web.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_images/web/WEB-INF/web.xml (.../web.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_images/web/WEB-INF/web.xml (.../web.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -9,13 +9,18 @@
javax.servlet.jsp.jstl.fmt.localizationContextorg.lamsfoundation.lams.tool.imageGallery.ApplicationResources
+
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/imageGallery/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
@@ -213,10 +218,10 @@
-
- Secure Content
+
+ Secure Content/*
-
+
LEARNERTEACHER
@@ -229,61 +234,61 @@
-
- Authoring Update
+
+ Authoring Update/authoring/*
-
+
AUTHORAUTHOR ADMINSYSADMIN
-
- Staff Content
+
+ Staff Content/monitoring.do
-
+
MONITORTEACHER
-
- Staff Content
+
+ Staff Content/definelater.do
-
+
MONITORTEACHER
-
- Adminstrator Content
+
+ Adminstrator Content/admin.do
-
+
ADMIN
-
- LAMS System Adminstrator Content
+
+ LAMS System Adminstrator Content/sysadmin.do
-
+
SYSADMIN
-
- Download Files
+
+ Download Files/download/
-
+
LEARNERAUTHOR
Index: lams_tool_lamc/conf/language/lams/ApplicationResources_ja_JP.properties
===================================================================
diff -u -r063e7b6d6e0c516f5ef5c570c543b5fe956f6986 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_lamc/conf/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision 063e7b6d6e0c516f5ef5c570c543b5fe956f6986)
+++ lams_tool_lamc/conf/language/lams/ApplicationResources_ja_JP.properties (.../ApplicationResources_ja_JP.properties) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -2,10 +2,13 @@
#language code: ja
#locale code: JP
- # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Tue Jul 08 08:45:31 BST 2008
+ # CVS ID: $Id$ Exported from the LAMS Community by Ernie Ghiglione on Thu Jun 18 01:30:20 CST 2009
#=================== labels for Multiple Choice Questions =================#
+monitor.summary.th.advancedSettings =\u9ad8\u5ea6\u306a\u8a2d\u5b9a
+label.off =OFF
+label.reflect =\u4ee5\u4e0b\u306e\u6307\u793a\u306b\u5f93\u3063\u3066\u3001\u9078\u629e\u554f\u984c\u306e\u5b8c\u4e86\u6642\u306b\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044:
label.final.attempt =\u6700\u5f8c\u306e\u53d7\u9a13:
errors.maxfilesize =\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u6700\u5927\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u5236\u9650\u306e {0} \u30d0\u30a4\u30c8\u3092\u8d85\u3048\u3066\u3044\u307e\u3059
output.desc.learner.mark =\u5b66\u7fd2\u8005\u306e\u5408\u8a08\u70b9
@@ -20,6 +23,7 @@
label.monitoring.downloadMarks.button =\u8a55\u70b9\u306e\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9
label.monitoring.downloadMarks.username =\u30e6\u30fc\u30b6\u30fc\u540d
label.yourAnswers =\u5b66\u7fd2\u8005\u306e\u56de\u7b54:
+error.noStudentActivity =\u30ec\u30dd\u30fc\u30c8\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u3069\u306e\u5b66\u7fd2\u8005\u3082\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u307e\u3060\u5b9f\u884c\u3057\u3066\u3044\u307e\u305b\u3093\u3002
label.learner =\u5b66\u7fd2\u8005
button.try.again =\u518d\u8a66\u884c
label.feedback =\u554f\u984c\u306e\u30d5\u30a3\u30fc\u30c9\u30d0\u30c3\u30af:
@@ -40,8 +44,6 @@
label.report.title.col =\u30ec\u30dd\u30fc\u30c8\u30bf\u30a4\u30c8\u30eb:
label.report.endLearningMessage.col =\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306e\u7d42\u4e86\u30e1\u30c3\u30bb\u30fc\u30b8:
label.continue =\u7d9a\u884c
-label.notebook.entries =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u30fb\u30a8\u30f3\u30c8\u30ea
-label.reflection =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u30fb\u30a8\u30f3\u30c8\u30ea
label.view.reflection =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306e\u9805\u76ee\u3092\u8868\u793a\u3059\u308b
label.close =\u9589\u3058\u308b
label.question.marks =\u70b9\u6570
@@ -61,7 +63,6 @@
label.tip.moveCandidateDown =\u9078\u629e\u80a2\u3092\u4e0b\u306b\u79fb\u52d5
label.tip.moveCandidateUp =\u9078\u629e\u80a2\u3092\u4e0a\u306b\u79fb\u52d5
label.upload =\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9
-question.blank =\u4fee\u6b63\u70b9: \u554f\u984c\u6587\u306f\u30d6\u30e9\u30f3\u30af\u306b\u3067\u304d\u307e\u305b\u3093\u3002
question.duplicate =\u4fee\u6b63\u70b9: \u91cd\u8907\u3059\u308b\u9078\u629e\u80a2\u304c\u3042\u308a\u307e\u3059\u3002
questions.none.submitted =\u554f\u984c\u304c\u4e00\u3064\u3082\u3042\u308a\u307e\u305b\u3093\u3002\u5c11\u306a\u304f\u3068\u3082\u554f\u984c\u3092 1 \u3064\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044\u3002
label.edit.question =\u554f\u984c\u3092\u7de8\u96c6
@@ -71,7 +72,6 @@
candidates.groupSize.warning =\u4fee\u6b63\u70b9: \u5c11\u306a\u304f\u3068\u3082 2 \u3064\u306e\u9078\u629e\u80a2\u304c\u5fc5\u8981\u3067\u3059\u3002
candidates.unremovable.groupSize =2 \u3064\u4ee5\u4e0a\u306e\u9078\u629e\u80a2\u304c\u5fc5\u8981\u3067\u3042\u308b\u305f\u3081\u3001\u9078\u629e\u80a2\u3092\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002
candidates.setFirst =\u6700\u521d\u306e\u9078\u629e\u80a2\u304c\u9078\u629e\u3055\u308c\u305f\u3053\u3068\u3092\u628a\u63e1\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002
-candidates.blank =\u4fee\u6b63\u70b9: \u9078\u629e\u80a2\u306f\u30d6\u30e9\u30f3\u30af\u306b\u3067\u304d\u307e\u305b\u3093\u3002
answers.submitted.none =\u9001\u4fe1\u3067\u304d\u307e\u305b\u3093\u3002\u5404\u554f\u984c\u306b\u56de\u7b54\u3057\u3066\u304f\u3060\u3055\u3044\u3002
message.no.reflection.available =\u5229\u7528\u3067\u304d\u308b\u30ce\u30fc\u30c8\u304c\u3042\u308a\u307e\u305b\u3093
label.attempt.count =\u53d7\u9a13\u56de\u6570:
@@ -110,7 +110,6 @@
label.response =\u56de\u7b54
label.learning.forceOfflineMessage =\u3053\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306f\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u5148\u751f\u306b\u805e\u3044\u3066\u304f\u3060\u3055\u3044\u3002
error.defineLater =\u5148\u751f\u304c\u3053\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306e\u5185\u5bb9\u3092\u5b8c\u6210\u3055\u305b\u308b\u307e\u3067\u3001\u304a\u5f85\u3061\u304f\u3060\u3055\u3044\u3002
-error.noStudentActivity =\u30ec\u30dd\u30fc\u30c8\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u5b66\u7fd2\u8005\u306f\u307e\u3060\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u305b\u3093\u3002
group.label =\u30b0\u30eb\u30fc\u30d7
button.summary =\u6982\u8981
button.editActivity =\u7de8\u96c6
@@ -254,7 +253,14 @@
label.mcqSummary =\u9078\u629e\u554f\u984c\u306e\u6982\u8981
label.displayAnswers =\u6700\u5f8c\u306e\u554f\u306b\u56de\u7b54\u3057\u305f\u5f8c\u306b\u3001\u6b63\u89e3\u3068\u5f97\u70b9\u3092\u8868\u793a\u3057\u307e\u3059\u3002
label.showMarks =\u6700\u9ad8\u70b9\u3068\u5e73\u5747\u70b9\u3092\u8868\u793a\u3059\u308b
-label.reflect =\u4ee5\u4e0b\u306e\u6307\u793a\u306b\u5f93\u3063\u3066\u3001\u9078\u629e\u554f\u984c\u306e\u5b8c\u4e86\u6642\u306b\u30ce\u30fc\u30c8\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044:
+monitor.summary.td.notebookInstructions =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306e\u6307\u793a
+label.notebook.entries =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u30fb\u30a8\u30f3\u30c8\u30ea
+label.reflection =\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u30fb\u30a8\u30f3\u30c8\u30ea
+monitor.summary.td.addNotebook =\u9078\u629e\u554f\u984c\u306e\u5b8c\u4e86\u6642\u306b\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u8ffd\u52a0\u3057\u3066\u304f\u3060\u3055\u3044
+label.on =\u30aa\u30f3
+candidates.blank =\u4fee\u6b63\u70b9: \u9078\u629e\u80a2\u306f\u7a7a\u6b04\u306b\u3067\u304d\u307e\u305b\u3093\u3002
+question.blank =\u4fee\u6b63\u70b9: \u554f\u984c\u6587\u306f\u7a7a\u6b04\u306b\u3067\u304d\u307e\u305b\u3093\u3002
+error.pedagogical.planner.empty.answer.selected =\u554f\u984c {0} \u3067\u306e\u6b63\u89e3\u306f\u7a7a\u6b04\u306b\u3067\u304d\u307e\u305b\u3093\u3002
-#======= End labels: Exported 249 labels for ja JP =====
+#======= End labels: Exported 255 labels for ja JP =====
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java
===================================================================
diff -u -r6afc94420f7d7de30f01461b904f7a99a630fc37 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java (.../MCOutputFactory.java) (revision 6afc94420f7d7de30f01461b904f7a99a630fc37)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/MCOutputFactory.java (.../MCOutputFactory.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -23,11 +23,8 @@
/* $Id$ */
package org.lamsfoundation.lams.tool.mc.service;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -40,140 +37,140 @@
import org.lamsfoundation.lams.tool.mc.pojos.McQueUsr;
import org.lamsfoundation.lams.tool.mc.pojos.McSession;
import org.lamsfoundation.lams.tool.mc.pojos.McUsrAttempt;
-import org.lamsfoundation.lams.tool.mc.web.LearningUtil;
public class MCOutputFactory extends OutputFactory {
- protected static final String OUTPUT_NAME_LEARNER_MARK = "learner.mark";
- protected static final String OUTPUT_NAME_LEARNER_ALL_CORRECT = "learner.all.correct";
-
- /**
- * @see org.lamsfoundation.lams.tool.OutputDefinitionFactory#getToolOutputDefinitions(java.lang.Object)
- */
- public SortedMap getToolOutputDefinitions(Object toolContentObject) {
-
- TreeMap definitionMap = new TreeMap();
- ToolOutputDefinition definition = buildBooleanOutputDefinition(OUTPUT_NAME_LEARNER_ALL_CORRECT);
- definitionMap.put(OUTPUT_NAME_LEARNER_ALL_CORRECT, definition);
+ protected static final String OUTPUT_NAME_LEARNER_MARK = "learner.mark";
+ protected static final String OUTPUT_NAME_LEARNER_ALL_CORRECT = "learner.all.correct";
- if ( toolContentObject != null ) {
- McContent content = (McContent) toolContentObject;
-
- definition = buildRangeDefinition(OUTPUT_NAME_LEARNER_MARK,
- new Long(0),
- new Long ( content.getTotalMarksPossible().longValue() ) );
- definitionMap.put(OUTPUT_NAME_LEARNER_MARK, definition);
- } else {
- log.error("Unable to build content based output definitions for Multiple Choice as no tool content object supplied. Only including the definitions that do not need any content.");
- }
+ /**
+ * @see org.lamsfoundation.lams.tool.OutputDefinitionFactory#getToolOutputDefinitions(java.lang.Object)
+ */
+ public SortedMap getToolOutputDefinitions(Object toolContentObject) {
- return definitionMap;
+ TreeMap definitionMap = new TreeMap();
+ ToolOutputDefinition definition = buildBooleanOutputDefinition(OUTPUT_NAME_LEARNER_ALL_CORRECT);
+ definitionMap.put(OUTPUT_NAME_LEARNER_ALL_CORRECT, definition);
+
+ if (toolContentObject != null) {
+ McContent content = (McContent) toolContentObject;
+
+ definition = buildRangeDefinition(OUTPUT_NAME_LEARNER_MARK, new Long(0), new Long(content
+ .getTotalMarksPossible().longValue()), true);
+ definitionMap.put(OUTPUT_NAME_LEARNER_MARK, definition);
+ } else {
+ log
+ .error("Unable to build content based output definitions for Multiple Choice as no tool content object supplied. Only including the definitions that do not need any content.");
}
- public SortedMap getToolOutput(List names, IMcService mcService, Long toolSessionId, Long learnerId) {
-
- TreeMap output = new TreeMap();
+ return definitionMap;
+ }
- McSession session = mcService.findMcSessionById(toolSessionId);
- if ( session != null ) {
+ public SortedMap getToolOutput(List names, IMcService mcService, Long toolSessionId,
+ Long learnerId) {
- McQueUsr queUser = mcService.getMcUserBySession(learnerId, session.getUid());
- if ( queUser != null ) {
-
- if ( names == null || names.contains(OUTPUT_NAME_LEARNER_MARK) ) {
- output.put(OUTPUT_NAME_LEARNER_MARK, getLearnerMark(queUser) );
- }
- if ( names == null || names.contains(OUTPUT_NAME_LEARNER_ALL_CORRECT) ) {
- output.put(OUTPUT_NAME_LEARNER_ALL_CORRECT, getLearnerAllCorrect(mcService, queUser) );
- }
- }
- }
-
- return output;
- }
+ TreeMap output = new TreeMap();
- public ToolOutput getToolOutput(String name, IMcService mcService, Long toolSessionId, Long learnerId) {
- if ( name != null ) {
- McSession session = mcService.findMcSessionById(toolSessionId);
- if ( session != null ) {
- McQueUsr queUser = mcService.getMcUserBySession(learnerId, session.getUid());
-
- if ( queUser != null ) {
- if ( name.equals(OUTPUT_NAME_LEARNER_MARK) ) {
- return getLearnerMark(queUser);
- } else if ( name.equals(OUTPUT_NAME_LEARNER_ALL_CORRECT) ){
- return getLearnerAllCorrect(mcService, queUser);
- }
- }
- }
+ McSession session = mcService.findMcSessionById(toolSessionId);
+ if (session != null) {
+
+ McQueUsr queUser = mcService.getMcUserBySession(learnerId, session.getUid());
+ if (queUser != null) {
+
+ if (names == null || names.contains(OUTPUT_NAME_LEARNER_MARK)) {
+ output.put(OUTPUT_NAME_LEARNER_MARK, getLearnerMark(queUser));
}
- return null;
+ if (names == null || names.contains(OUTPUT_NAME_LEARNER_ALL_CORRECT)) {
+ output.put(OUTPUT_NAME_LEARNER_ALL_CORRECT, getLearnerAllCorrect(mcService, queUser));
+ }
+ }
}
- /**
- * Get the mark for a specific user. This gets the mark associated with the last attempt.
- * Will always return a ToolOutput object.
- */
- private ToolOutput getLearnerMark(McQueUsr queUser) {
- Long mark;
- if (queUser != null && queUser.getLastAttemptTotalMark() != null) {
- mark = queUser.getLastAttemptTotalMark().longValue();
- } else {
- mark = new Long(0);
+ return output;
+ }
+
+ public ToolOutput getToolOutput(String name, IMcService mcService, Long toolSessionId, Long learnerId) {
+ if (name != null) {
+ McSession session = mcService.findMcSessionById(toolSessionId);
+ if (session != null) {
+ McQueUsr queUser = mcService.getMcUserBySession(learnerId, session.getUid());
+
+ if (queUser != null) {
+ if (name.equals(OUTPUT_NAME_LEARNER_MARK)) {
+ return getLearnerMark(queUser);
+ } else if (name.equals(OUTPUT_NAME_LEARNER_ALL_CORRECT)) {
+ return getLearnerAllCorrect(mcService, queUser);
+ }
}
- return new ToolOutput(MCOutputFactory.OUTPUT_NAME_LEARNER_MARK,
- getI18NText(MCOutputFactory.OUTPUT_NAME_LEARNER_MARK, true), mark);
+ }
}
+ return null;
+ }
- /**
- * Did the user get the questions all correct. This checks the answers associated with the last attempt.
- * Assumes all correct if the mark is equal to the maximum possible mark.
- * Will always return a ToolOutput object.
- */
- private ToolOutput getLearnerAllCorrect(IMcService mcService, McQueUsr queUser) {
- boolean allCorrect = allQuestionsCorrect(mcService, queUser);
- return new ToolOutput(MCOutputFactory.OUTPUT_NAME_LEARNER_ALL_CORRECT,
- getI18NText(MCOutputFactory.OUTPUT_NAME_LEARNER_ALL_CORRECT, true), allCorrect);
+ /**
+ * Get the mark for a specific user. This gets the mark associated with the
+ * last attempt. Will always return a ToolOutput object.
+ */
+ private ToolOutput getLearnerMark(McQueUsr queUser) {
+ Long mark;
+ if (queUser != null && queUser.getLastAttemptTotalMark() != null) {
+ mark = queUser.getLastAttemptTotalMark().longValue();
+ } else {
+ mark = new Long(0);
}
+ return new ToolOutput(MCOutputFactory.OUTPUT_NAME_LEARNER_MARK, getI18NText(
+ MCOutputFactory.OUTPUT_NAME_LEARNER_MARK, true), mark);
+ }
- // written to cope with more than one correct option for each question but only tested with
- // one correct option for a question.
+ /**
+ * Did the user get the questions all correct. This checks the answers
+ * associated with the last attempt. Assumes all correct if the mark is
+ * equal to the maximum possible mark. Will always return a ToolOutput
+ * object.
+ */
+ private ToolOutput getLearnerAllCorrect(IMcService mcService, McQueUsr queUser) {
+ boolean allCorrect = allQuestionsCorrect(mcService, queUser);
+ return new ToolOutput(MCOutputFactory.OUTPUT_NAME_LEARNER_ALL_CORRECT, getI18NText(
+ MCOutputFactory.OUTPUT_NAME_LEARNER_ALL_CORRECT, true), allCorrect);
+ }
+
+ // written to cope with more than one correct option for each question but only tested with
+ // one correct option for a question.
private boolean allQuestionsCorrect(IMcService mcService, McQueUsr queUser) {
- // Build a list of all the correct answers. If we hit any options that are not a correct option
- // we can abort as we know there is a wrong answer.
- // Otherwise count the number of correct options overall (for comparison later).
- long correctlearnerOptions = 0;
- List latestAttempts = (List) mcService.getLatestAttemptsForAUser(queUser.getUid());
- for ( McUsrAttempt mcUsrAttempt : latestAttempts ) {
- McOptsContent mcOptsContent = mcUsrAttempt.getMcOptionsContent();
- if ( ! mcOptsContent.isCorrectOption() ) {
- // wrong answer so no point going any further
- return false;
- } else {
- correctlearnerOptions++;
- }
- }
+ // Build a list of all the correct answers. If we hit any options that are not a correct option
+ // we can abort as we know there is a wrong answer.
+ // Otherwise count the number of correct options overall (for comparison later).
+ long correctlearnerOptions = 0;
+ List latestAttempts = (List) mcService.getLatestAttemptsForAUser(queUser.getUid());
+ for (McUsrAttempt mcUsrAttempt : latestAttempts) {
+ McOptsContent mcOptsContent = mcUsrAttempt.getMcOptionsContent();
+ if (!mcOptsContent.isCorrectOption()) {
+ // wrong answer so no point going any further
+ return false;
+ } else {
+ correctlearnerOptions++;
+ }
+ }
- // now count the overall number of correct options
- long correctOptions = 0;
- McContent mcContent = queUser.getMcSession().getMcContent();
- Iterator questionIterator = mcContent.getMcQueContents().iterator();
- while (questionIterator.hasNext())
- {
- McQueContent mcQueContent = (McQueContent) questionIterator.next();
- Iterator optionIterator = mcQueContent.getMcOptionsContents().iterator();
- while ( optionIterator.hasNext() ) {
- McOptsContent mcOptsContent = (McOptsContent) optionIterator.next();
- if ( mcOptsContent.isCorrectOption() ) {
- correctOptions++;
- }
- }
- }
+ // now count the overall number of correct options
+ long correctOptions = 0;
+ McContent mcContent = queUser.getMcSession().getMcContent();
+ Iterator questionIterator = mcContent.getMcQueContents().iterator();
+ while (questionIterator.hasNext()) {
+ McQueContent mcQueContent = (McQueContent) questionIterator.next();
+ Iterator optionIterator = mcQueContent.getMcOptionsContents().iterator();
+ while (optionIterator.hasNext()) {
+ McOptsContent mcOptsContent = (McOptsContent) optionIterator.next();
+ if (mcOptsContent.isCorrectOption()) {
+ correctOptions++;
+ }
+ }
+ }
- // We know the user didn't get everything wrong, but did they answer enough options correctly?
- // This case is used when there is more than one correct option for each answer. Simple way, compare counts!
- return correctOptions == correctlearnerOptions;
+ // We know the user didn't get everything wrong, but did they answer enough options correctly?
+ // This case is used when there is more than one correct option for each answer. Simple way, compare counts!
+ return correctOptions == correctlearnerOptions;
}
}
Index: lams_tool_lamc/web/WEB-INF/web.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_lamc/web/WEB-INF/web.xml (.../web.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_lamc/web/WEB-INF/web.xml (.../web.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -6,13 +6,17 @@
org.lamsfoundation.lams.tool.mc.ApplicationResources
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/mc/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
Index: lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml
===================================================================
diff -u -r33f9171c071c179459972380a9b732f1aeec87bf -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision 33f9171c071c179459972380a9b732f1aeec87bf)
+++ lams_tool_laqa/conf/hibernate/mappings/org/lamsfoundation/lams/tool/qa/QaContent.hbm.xml (.../QaContent.hbm.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -138,7 +138,13 @@
length="1"
/>
-
+ conditions) {
+ Set qaSessions, Set qaUploadedFiles, Set conditions, boolean allowRichEditor) {
this.qaContentId = qaContentId;
this.content = content;
this.title = title;
@@ -164,6 +166,7 @@
this.qaSessions = qaSessions;
this.qaUploadedFiles = qaUploadedFiles;
this.conditions = conditions;
+ this.allowRichEditor = allowRichEditor;
QaContent.logger.debug(QaContent.logger + " " + this.getClass().getName() + "in full constructor: QaContent()");
}
@@ -186,7 +189,7 @@
.isQuestionsSequenced(), qa.isUsernameVisible(), qa.isSynchInMonitor(), qa.isLockWhenFinished(), qa
.isContentLocked(), qa.isShowOtherAnswers(), qa.isReflect(), qa.getReflectionSubject(), qa
.getCreationDate(), qa.getUpdateDate(), new TreeSet(), new TreeSet(), new TreeSet(),
- new TreeSet(new TextSearchConditionComparator()));
+ new TreeSet(new TextSearchConditionComparator()), qa.isAllowRichEditor());
newContent.setQaQueContents(qa.deepCopyQaQueContent(newContent));
@@ -628,7 +631,16 @@
public void setLockWhenFinished(boolean lockWhenFinished) {
this.lockWhenFinished = lockWhenFinished;
}
+
+
+ public boolean isAllowRichEditor() {
+ return allowRichEditor;
+ }
+ public void setAllowRichEditor(boolean allowRichEditor) {
+ this.allowRichEditor = allowRichEditor;
+ }
+
/**
* @return Returns the showOtherAnswers.
*/
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (.../QaGeneralAuthoringDTO.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaGeneralAuthoringDTO.java (.../QaGeneralAuthoringDTO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -59,6 +59,7 @@
protected String lockWhenFinished;
protected String editActivityEditMode;
protected String reflectionSubject;
+ protected Boolean allowRichEditor;
protected String monitoredContentInUse;
@@ -600,4 +601,14 @@
public void setShowOtherAnswers(String showOtherAnswers) {
this.showOtherAnswers = showOtherAnswers;
}
+
+ public Boolean getAllowRichEditor() {
+ return allowRichEditor;
+ }
+
+ public void setAllowRichEditor(Boolean allowRichEditor) {
+ this.allowRichEditor = allowRichEditor;
+ }
+
+
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dao/hibernate/QaQueUsrDAO.java (.../QaQueUsrDAO.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -38,8 +38,8 @@
/**
* @author Ozgur Demirtas
*
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
+ * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
+ * Templates
*/
public class QaQueUsrDAO extends HibernateDaoSupport implements IQaQueUsrDAO {
@@ -51,14 +51,15 @@
private static final String GET_USER_COUNT_FOR_CONTENT = "select count(*) from QaQueUsr quser, QaSession qses, QaQueContent qcon where "
+ "quser.qaSession=qses and " + "qses.qaContent=qcon and " + "qcon.uid=:uid";
- // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and qses.qa_content_id=5378;
+ // select count(*) from tl_laqa11_que_usr quser, tl_laqa11_session qses where quser.qa_session_id=qses.uid and
+ // qses.qa_content_id=5378;
public QaQueUsr getQaUserByUID(Long uid) {
return (QaQueUsr) this.getHibernateTemplate().get(QaQueUsr.class, uid);
}
public int countSessionUser(QaSession qaSession) {
- return (getHibernateTemplate().findByNamedParam(COUNT_SESSION_USER, "qaSession", qaSession)).size();
+ return getHibernateTemplate().findByNamedParam(QaQueUsrDAO.COUNT_SESSION_USER, "qaSession", qaSession).size();
}
public QaQueUsr getQaQueUsrById(long qaQueUsrId) {
@@ -90,7 +91,7 @@
public List getUserBySessionOnly(final QaSession qaSession) {
HibernateTemplate templ = this.getHibernateTemplate();
- List list = getSession().createQuery(LOAD_USER_FOR_SESSION).setLong("qaSessionId",
+ List list = getSession().createQuery(QaQueUsrDAO.LOAD_USER_FOR_SESSION).setLong("qaSessionId",
qaSession.getUid().longValue()).list();
return list;
}
@@ -118,13 +119,14 @@
int returnInt = 0;
if (qa != null && qa.getUid() != null) {
- List result = getSession().createQuery(GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid()).list();
- Integer resultInt = (result.get(0) != null) ? (Integer) result.get(0) : new Integer(0);
- returnInt = resultInt.intValue();
+ List result = getSession().createQuery(QaQueUsrDAO.GET_USER_COUNT_FOR_CONTENT).setLong("uid", qa.getUid())
+ .list();
+ Long resultLong = result.get(0) != null ? (Long) result.get(0) : new Long(0);
+ returnInt = resultLong.intValue();
} else {
- logger.error("Attempt to count users from null content");
+ QaQueUsrDAO.logger.error("Attempt to count users from null content");
}
- return returnInt;
+ return returnInt;
}
}
\ No newline at end of file
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql
===================================================================
diff -u -r05db875c7974d705f89231416ff6dfe91a5e70f1 -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql (.../patch20081126_updateFrom22.sql) (revision 05db875c7974d705f89231416ff6dfe91a5e70f1)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/dbupdates/patch20081126_updateFrom22.sql (.../patch20081126_updateFrom22.sql) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -7,6 +7,8 @@
UPDATE lams_tool SET pedagogical_planner_url='tool/laqa11/pedagogicalPlanner.do' WHERE tool_signature='laqa11';
+alter table tl_laqa11_content add column allow_rich_editor TINYINT(1) NOT NULL DEFAULT 0;
+
----------------------Put all sql statements above here-------------------------
-- If there were no errors, commit and restore autocommit to on
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -49,6 +49,7 @@
import org.lamsfoundation.lams.tool.qa.util.QaQueContentComparator;
import org.lamsfoundation.lams.tool.qa.util.QaQuestionContentDTOComparator;
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;
@@ -349,6 +350,9 @@
String questionsSequenced = request.getParameter(QaAppConstants.QUESTIONS_SEQUENCED);
String lockWhenFinished = request.getParameter("lockWhenFinished");
+
+ String allowRichEditor = request.getParameter("allowRichEditor");
+
String richTextOfflineInstructions = request.getParameter(QaAppConstants.OFFLINE_INSTRUCTIONS);
String richTextOnlineInstructions = request.getParameter(QaAppConstants.ONLINE_INSTRUCTIONS);
@@ -370,6 +374,7 @@
boolean usernameVisibleBoolean = false;
boolean showOtherAnswersBoolean = false;
boolean reflectBoolean = false;
+ boolean allowRichEditorBoolean = false;
if (questionsSequenced != null && questionsSequenced.equalsIgnoreCase("1")) {
questionsSequencedBoolean = true;
@@ -390,6 +395,10 @@
if (showOtherAnswers != null && showOtherAnswers.equalsIgnoreCase("1")) {
showOtherAnswersBoolean = true;
}
+
+ if (allowRichEditor != null && allowRichEditor.equalsIgnoreCase("1")) {
+ allowRichEditorBoolean = true;
+ }
if (reflect != null && reflect.equalsIgnoreCase("1")) {
reflectBoolean = true;
@@ -431,6 +440,7 @@
qaContent.setSynchInMonitor(synchInMonitorBoolean);
qaContent.setReflect(reflectBoolean);
qaContent.setReflectionSubject(reflectionSubject);
+ qaContent.setAllowRichEditor(allowRichEditorBoolean);
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java
===================================================================
diff -u -rc527318c8c79f72151f6261342c5cc1a830d1e4d -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision c527318c8c79f72151f6261342c5cc1a830d1e4d)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaAuthoringForm.java (.../QaAuthoringForm.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -97,6 +97,8 @@
protected String defaultContentIdStr;
protected Map mapQuestionContent;
protected IQaService qaService;
+
+ protected boolean allowRichEditor;
public void resetUserAction() {
this.addContent = null;
@@ -112,6 +114,7 @@
this.editActivityMonitoring = null;
this.statsMonitoring = null;
this.edit = null;
+ this.allowRichEditor = false;
}
public void reset() {
@@ -143,6 +146,7 @@
this.questionsSequenced = null;
this.lockWhenFinished = null;
this.reflect = null;
+ this.allowRichEditor = false;
this.summaryMonitoring = null;
this.instructionsMonitoring = null;
@@ -159,6 +163,7 @@
this.questionsSequenced = OPTION_OFF;
this.lockWhenFinished = OPTION_OFF;
this.reflect = OPTION_OFF;
+ this.allowRichEditor = false;
}
public String toString() {
@@ -878,4 +883,12 @@
public void setShowOtherAnswers(String showOtherAnswers) {
this.showOtherAnswers = showOtherAnswers;
}
+
+ public boolean isAllowRichEditor() {
+ return allowRichEditor;
+ }
+
+ public void setAllowRichEditor(boolean allowRichEditor) {
+ this.allowRichEditor = allowRichEditor;
+ }
}
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -230,6 +230,9 @@
boolean lockWhenFinished = qaContent.isLockWhenFinished();
generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString());
+
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
boolean showOtherAnswers = qaContent.isShowOtherAnswers();
generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(showOtherAnswers).toString());
@@ -311,6 +314,9 @@
generalLearnerFlowDTO.setUserNameVisible(new Boolean(qaContent.isUsernameVisible()).toString());
generalLearnerFlowDTO.setShowOtherAnswers(new Boolean(qaContent.isShowOtherAnswers()).toString());
+
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
/*
* Learning mode requires this setting for jsp to generate the user's report
@@ -526,6 +532,9 @@
boolean lockWhenFinished = qaContent.isLockWhenFinished();
generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString());
+
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
HttpSession ss = SessionManager.getSession();
/* get back login user DTO */
@@ -642,6 +651,9 @@
boolean lockWhenFinished = qaContent.isLockWhenFinished();
generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString());
+
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
HttpSession ss = SessionManager.getSession();
/* get back login user DTO */
@@ -995,6 +1007,9 @@
boolean lockWhenFinished = qaContent.isLockWhenFinished();
generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString());
+
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), CoreNotebookConstants.NOTEBOOK_TOOL,
MY_SIGNATURE, new Integer(userID));
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -435,9 +435,13 @@
boolean lockWhenFinished = qaContent.isLockWhenFinished();
logger.debug("lockWhenFinished: " + lockWhenFinished);
+ boolean allowRichEditor = qaContent.isAllowRichEditor();
+ generalLearnerFlowDTO.setAllowRichEditor(new Boolean(allowRichEditor).toString());
+
String sessionStatus = qaSession.getSession_status();
logger.debug("sessionStatus: " + sessionStatus);
+
if (userID != null) {
QaQueUsr qaQueUsr = qaService.getQaUserBySession(new Long(userID), qaSession.getUid());
Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java
===================================================================
diff -u -r328cd4dbe60d9e5c588e13cc16b7e7414893b0af -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 328cd4dbe60d9e5c588e13cc16b7e7414893b0af)
+++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -359,7 +359,9 @@
SortedSet conditionList = getQaConditionList(sessionMap);
conditionList.clear();
conditionList.addAll(qaContent.getConditions());
-
+
+ qaGeneralAuthoringDTO.setAllowRichEditor(qaContent.isAllowRichEditor());
+ qaAuthoringForm.setAllowRichEditor(qaContent.isAllowRichEditor());
sessionMap.put(QaAppConstants.ATTR_QA_AUTHORING_FORM, qaAuthoringForm);
Index: lams_tool_laqa/web/WEB-INF/web.xml
===================================================================
diff -u -r126d84999e520648cb187e465cb4aaa3baad222e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/web/WEB-INF/web.xml (.../web.xml) (revision 126d84999e520648cb187e465cb4aaa3baad222e)
+++ lams_tool_laqa/web/WEB-INF/web.xml (.../web.xml) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -6,14 +6,18 @@
javax.servlet.jsp.jstl.fmt.localizationContextorg.lamsfoundation.lams.tool.qa.ApplicationResources
-
+
+
+ contextClass
+ org.jboss.spring.factory.VFSXmlWebApplicationContext
+contextConfigLocationclasspath:/org/lamsfoundation/lams/tool/qa/dbupdates/autopatchContext.xmllocatorFactorySelector
- classpath*:/org/lamsfoundation/lams/**/beanRefContext.xml
+ classpath:/org/lamsfoundation/lams/beanRefContext.xmlparentContextKey
Index: lams_tool_laqa/web/authoring/AdvancedContent.jsp
===================================================================
diff -u -r1c37dbd473cc5cb2e200de97fb96eb4c5535ca7e -racc8d2acf5b6b0002e0c8129947040a779ab4077
--- lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 1c37dbd473cc5cb2e200de97fb96eb4c5535ca7e)
+++ lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision acc8d2acf5b6b0002e0c8129947040a779ab4077)
@@ -86,11 +86,18 @@
+