There will usually be 0 or 1 workspace for each tool in LAMS, so this should be a pretty small table.
The main lookup is done on name, but given the small number of rows a complete table scan
should be fine. A name index would probably be about the same size as the table anyway.
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+
Like lams_cr_workspace, there will usually be 0 or 1 workspace for each tool in LAMS, so this should be a pretty small table.
The main lookup is done on name, but given the small number of rows a complete table scan should be fine.
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
All the lams_css_property values matching this lams_css_style make up the CSSStyleDeclaration for this
style. It may be a "base" style for a theme, or it may be for a named visual element.
Each style may have a subset of properties, such as "_tf"
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -4670,111 +4683,111 @@
+
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
Index: lams_common/db/sql/create_lams_11_tables.sql
===================================================================
diff -u -r60cf07d204ba95ce0715d93971b5bdc86634a824 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 60cf07d204ba95ce0715d93971b5bdc86634a824)
+++ lams_common/db/sql/create_lams_11_tables.sql (.../create_lams_11_tables.sql) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -519,6 +519,7 @@
, schedule_start_date_time DATETIME
, end_date_time DATETIME
, schedule_end_date_time DATETIME
+ , previous_state_id INT(3)
, PRIMARY KEY (lesson_id)
, INDEX (learning_design_id)
, CONSTRAINT FK_lams_lesson_1_1 FOREIGN KEY (learning_design_id)
Fisheye: Tag 0ec0d87a13f5cd499a8300d7a51a6d453108545e refers to a dead (removed) revision in file `lams_common/db/sql/insert_users_org_test.sql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java
===================================================================
diff -u -r7e8b71604044e851c877e918e7d6570a9942a356 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision 7e8b71604044e851c877e918e7d6570a9942a356)
+++ lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -103,6 +103,9 @@
private Integer lessonStateId;
/** persistent field */
+ private Integer previousLessonStateId;
+
+ /** persistent field */
private LearningDesign learningDesign;
/** persistent field */
@@ -126,23 +129,28 @@
* organization and class information.
* Cain constructor pattern implementation.
*/
- public Lesson(String name,String description,Date createDateTime, User user, Integer lessonStateId, LearningDesign learningDesign,Set learnerProgresses)
+ public Lesson(String name,String description,Date createDateTime, User user, Integer lessonStateId, Integer previousLessonStateId,
+ LearningDesign learningDesign,Set learnerProgresses)
{
- this(null,name,description,createDateTime,null,null,user,lessonStateId,learningDesign,null,null,learnerProgresses);
+ this(null,name,description,createDateTime,null,null,user,lessonStateId,previousLessonStateId,learningDesign,null,null,learnerProgresses);
}
/**
* Constructor that creates a new lesson with organization and class
* information.
* Chain construtor pattern implementation.
*/
- public Lesson(String name,String description,Date createDateTime, User user, Integer lessonStateId, LearningDesign learningDesign, LessonClass lessonClass, Organisation organisation, Set learnerProgresses)
+ public Lesson(String name,String description,Date createDateTime, User user, Integer lessonStateId, Integer previousLessonStateId,
+ LearningDesign learningDesign, LessonClass lessonClass, Organisation organisation, Set learnerProgresses)
{
- this(null,name,description,createDateTime,null,null,user,lessonStateId,learningDesign,lessonClass,organisation,learnerProgresses);
+ this(null,name,description,createDateTime,null,null,user,lessonStateId,previousLessonStateId,
+ learningDesign,lessonClass,organisation,learnerProgresses);
}
/** full constructor */
- public Lesson(Long lessonId,String name,String description, Date createDateTime, Date startDateTime, Date endDateTime, User user, Integer lessonStateId, LearningDesign learningDesign, LessonClass lessonClass, Organisation organisation, Set learnerProgresses)
+ public Lesson(Long lessonId,String name,String description, Date createDateTime, Date startDateTime, Date endDateTime, User user,
+ Integer lessonStateId, Integer previousLessonStateId, LearningDesign learningDesign, LessonClass lessonClass,
+ Organisation organisation, Set learnerProgresses)
{
this.lessonId = lessonId;
this.lessonName = name;
@@ -152,6 +160,7 @@
this.endDateTime = endDateTime;
this.user = user;
this.lessonStateId = lessonStateId;
+ this.previousLessonStateId = previousLessonStateId;
this.learningDesign = learningDesign;
this.lessonClass = lessonClass;
this.organisation = organisation;
@@ -181,6 +190,7 @@
new Date(System.currentTimeMillis()),
user,
Lesson.CREATED,
+ null,
ld,
newLessonClass,//lesson class
organisation,
@@ -206,6 +216,7 @@
new Date(System.currentTimeMillis()),
user,
Lesson.CREATED,
+ null,
ld,
new HashSet());
}
@@ -350,6 +361,18 @@
}
/**
+ * @hibernate.property type="java.lang.Integer" column="previous_state_id"
+ * length="3"
+ */
+ public Integer getPreviousLessonStateId() {
+ return this.previousLessonStateId;
+ }
+
+ public void setPreviousLessonStateId(Integer previousLessonStateId) {
+ this.previousLessonStateId = previousLessonStateId;
+ }
+
+ /**
* @hibernate.many-to-one not-null="true" cascade="none"
* @hibernate.column name="learning_design_id"
*/
Index: lams_documents/lams_monitoring/Monitoring.doc
===================================================================
diff -u -r75f05a3a0fda5583349caa91972397eca4ef89e4 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
Binary files differ
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml
===================================================================
diff -u -r5176a39390628de74ff3c3ba5bab716164dbdb42 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision 5176a39390628de74ff3c3ba5bab716164dbdb42)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/monitoringApplicationContext.xml (.../monitoringApplicationContext.xml) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -60,6 +60,7 @@
PROPAGATION_REQUIREDPROPAGATION_REQUIREDPROPAGATION_REQUIRED
+ PROPAGATION_REQUIREDPROPAGATION_REQUIREDPROPAGATION_REQUIREDPROPAGATION_REQUIRED
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java
===================================================================
diff -u -r6b2751bb0a75d2d7d73b3297262dffd574d6b313 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 6b2751bb0a75d2d7d73b3297262dffd574d6b313)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -166,16 +166,23 @@
* @param userId checks that the user is a staff member for this lesson
*/
public void archiveLesson(long lessonId, Integer userId) throws UserAccessDeniedException;
+
/**
+ * Unarchive the specified the lesson. Reverts back to its previous state.
+ * @param lessonId the specified the lesson id.
+ */
+ public void unarchiveLesson(long lessonId, Integer userId);
+
+ /**
* A lesson can only be suspended if it is started. The purpose of suspending is
- * to hide the lesson from learners temporarily. If the teacher tries to suspend a lesson that
- * is not in the STARTED_STATE, then an error should be returned.
+ * to hide the lesson from learners temporarily.
* @param lessonId the lesson ID which will be suspended.
* @param userId checks that the user is a staff member for this lesson
*/
public void suspendLesson(long lessonId, Integer userId) throws UserAccessDeniedException;
/**
- * Unsuspend a lesson, which state must be Lesson.SUSPEND_STATE. Otherwise an exception will be thrown.
+ * Unsuspend a lesson, which state must be Lesson.SUSPEND_STATE. Returns the lesson
+ * back to its previous state. Otherwise an exception will be thrown.
* @param lessonId
* @param userId checks that the user is a staff member for this lesson
*/
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java
===================================================================
diff -u -ra3fdc5e46a8081ffeb1a863855dc507d27efc5d4 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision a3fdc5e46a8081ffeb1a863855dc507d27efc5d4)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -668,25 +668,38 @@
throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to set lesson to archived");
}
checkOwnerOrStaffMember(userId, requestedLesson, "archive lesson");
- setLessonState(requestedLesson,Lesson.ARCHIVED_STATE);
-
+ if ( ! Lesson.ARCHIVED_STATE.equals(requestedLesson.getLessonStateId()) &&
+ !Lesson.REMOVED_STATE.equals(requestedLesson.getLessonStateId()) ) {
+ setLessonState(requestedLesson,Lesson.ARCHIVED_STATE);
+ }
}
/**
+ * Unarchive the specified the lesson. Reverts back to its previous state.
+ * @param lessonId the specified the lesson id.
+ */
+ public void unarchiveLesson(long lessonId, Integer userId) {
+ Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId));
+ if ( requestedLesson == null ) {
+ throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to set lesson to archived");
+ }
+ checkOwnerOrStaffMember(userId, requestedLesson, "unarchive lesson");
+ revertLessonState(requestedLesson);
+
+ }
+ /**
*
* @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#suspendLesson(long)
*/
public void suspendLesson(long lessonId, Integer userId) {
Lesson lesson = lessonDAO.getLesson(new Long(lessonId));
checkOwnerOrStaffMember(userId, lesson, "suspend lesson");
- Integer state = lesson.getLessonStateId();
- //only suspend started lesson
- if(!Lesson.STARTED_STATE.equals(state)){
- throw new MonitoringServiceException("Lesson does not started yet. It can not be suspended.");
- }
if ( lesson == null ) {
throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to suspend lesson.");
}
- setLessonState(lesson,Lesson.SUSPENDED_STATE);
+ if ( ! Lesson.SUSPENDED_STATE.equals(lesson.getLessonStateId()) &&
+ !Lesson.REMOVED_STATE.equals(lesson.getLessonStateId()) ) {
+ setLessonState(lesson,Lesson.SUSPENDED_STATE);
+ }
}
/**
*
@@ -703,21 +716,34 @@
if ( lesson == null ) {
throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to suspend lesson.");
}
- setLessonState(lesson,Lesson.STARTED_STATE);
+ revertLessonState(lesson);
}
/**
- * @see setLessonState(long,Integer)
+ * Set a lesson to a particular state. Copies the current state to the previous lesson state.
* @param requestedLesson
* @param status
*/
private void setLessonState(Lesson requestedLesson,Integer status) {
+ requestedLesson.setPreviousLessonStateId(requestedLesson.getLessonStateId());
requestedLesson.setLessonStateId(status);
lessonDAO.updateLesson(requestedLesson);
-
}
+
/**
+ * Sets a lesson back to its previous state. Used when we "unsuspend" or "unarchive"
+ * @param requestedLesson
+ * @param status
+ */
+ private void revertLessonState(Lesson requestedLesson) {
+
+ Integer currentStatus = requestedLesson.getLessonStateId();
+ requestedLesson.setLessonStateId(requestedLesson.getPreviousLessonStateId());
+ requestedLesson.setPreviousLessonStateId(currentStatus);
+ lessonDAO.updateLesson(requestedLesson);
+ }
+/**
* @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#removeLesson(long)
*/
public void removeLesson(long lessonId, Integer userId) {
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java
===================================================================
diff -u -r6b2751bb0a75d2d7d73b3297262dffd574d6b313 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java (.../DummyMonitoringAction.java) (revision 6b2751bb0a75d2d7d73b3297262dffd574d6b313)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java (.../DummyMonitoringAction.java) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -234,16 +234,25 @@
this.monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext());
long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID);
-// Calendar cal = Calendar.getInstance();
-// cal.setTime(new Date());
-// cal.add(Calendar.MILLISECOND, 5000);
-// monitoringService.finishLessonOnSchedule(lessonId,cal.getTime());
-
monitoringService.archiveLesson(lessonId,getUserId());
return unspecified(mapping, form, request, response);
}
+ public ActionForward unarchiveLesson(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ this.monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext());
+
+ long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID);
+ monitoringService.unarchiveLesson(lessonId,getUserId());
+
+ return unspecified(mapping, form, request, response);
+ }
+
/**
* The Struts dispatch method to remove a lesson (marking the lesson by the given lesson ID
* as Lesson.REMOVED_STATE status). Forwards to the control
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java
===================================================================
diff -u -r1f1900e48b3ffad3675a01c8b8ddabd27ba1d470 -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 1f1900e48b3ffad3675a01c8b8ddabd27ba1d470)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -355,6 +355,46 @@
return null;
}
/**
+ * The Struts dispatch method to "unarchive" a lesson. Returns it back to
+ * its previous state. A wddx acknowledgement message will be serialized and sent back to the flash
+ * component.
+ *
+ * @param mapping An ActionMapping class that will be used by the Action class to tell
+ * the ActionServlet where to send the end-user.
+ *
+ * @param form The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param request A standard Servlet HttpServletRequest class.
+ * @param response A standard Servlet HttpServletResponse class.
+ * @return An ActionForward class that will be returned to the ActionServlet indicating where
+ * the user is to go next.
+ * @throws IOException
+ * @throws ServletException
+ */
+ public ActionForward unarchiveLesson(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response) throws IOException,
+ ServletException
+ {
+ FlashMessage flashMessage = null;
+ IMonitoringService monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext());
+
+ try {
+ long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID);
+ monitoringService.unarchiveLesson(lessonId, getUserId(request));
+ flashMessage = new FlashMessage("unarchiveLesson",Boolean.TRUE);
+ } catch (Exception e) {
+ flashMessage = handleException(e, "unarchiveLesson", monitoringService);
+ }
+
+ String message = flashMessage.serializeMessage();
+
+ PrintWriter writer = response.getWriter();
+ writer.println(message);
+ return null;
+ }
+ /**
* The purpose of suspending is to hide the lesson from learners temporarily.
* It doesn't make any sense to suspend a created or a not started (ie scheduled)
* lesson as they will not be shown on the learner interface anyway! If the teacher
Index: lams_monitoring/web/dummyControlFrame.jsp
===================================================================
diff -u -r440554bb4a9a414c6e3e676a93de72de3298951c -r0ec0d87a13f5cd499a8300d7a51a6d453108545e
--- lams_monitoring/web/dummyControlFrame.jsp (.../dummyControlFrame.jsp) (revision 440554bb4a9a414c6e3e676a93de72de3298951c)
+++ lams_monitoring/web/dummyControlFrame.jsp (.../dummyControlFrame.jsp) (revision 0ec0d87a13f5cd499a8300d7a51a6d453108545e)
@@ -72,6 +72,7 @@