Index: lams_documents/lams_monitoring/Monitoring.doc =================================================================== RCS file: /usr/local/cvsroot/lams_documents/lams_monitoring/Monitoring.doc,v diff -u -r1.6 -r1.7 Binary files differ Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java,v diff -u -r1.24 -r1.25 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 22 Dec 2005 01:25:32 -0000 1.24 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 19 Jan 2006 01:26:49 -0000 1.25 @@ -92,7 +92,18 @@ */ public void archiveLesson(long lessonId); + /** + *
+ * Teachers sometimes find that there are just too many "old" designs and + * wish to remove them and never access them again. This function disables + * the lesson - it does not remove the contents from the database + *
+ * @param lessonId + * the specified the lesson id. + */ + public void removeLesson(long lessonId); + /** * Set the gate to open to let all the learners through. This learning service * is triggerred by the system scheduler. Will return true GateActivity (or subclass) * object, rather than a hibernate proxy. This is needed so that the class can @@ -302,4 +313,5 @@ /* TODO Dummy methods - to be removed */ public List getOrganisationsUsers(Integer userId); public List getLearningDesigns(Long userId); + } Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java,v diff -u -r1.32 -r1.33 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 13 Jan 2006 04:14:07 -0000 1.32 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 19 Jan 2006 01:26:49 -0000 1.33 @@ -356,9 +356,19 @@ lessonDAO.updateLesson(requestedLesson); } + /** + * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#removeLesson(long) + */ + public void removeLesson(long lessonId) { + Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); + if ( requestedLesson == null) { + throw new MonitoringServiceException("Lesson for id="+lessonId+" is missing. Unable to start lesson."); + } - - + requestedLesson.setLessonStateId(Lesson.DISABLED_STATE); + lessonDAO.updateLesson(requestedLesson); + + } /** * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#openGate(org.lamsfoundation.lams.learningdesign.GateActivity) */ Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java,v diff -u -r1.10 -r1.11 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 19 Jan 2006 00:53:15 -0000 1.10 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 19 Jan 2006 01:26:49 -0000 1.11 @@ -189,8 +189,45 @@ return outputPacket(mapping,request,response,message,"details"); } - - public ActionForward getAllLessons(ActionMapping mapping, + /** + *
+ * The STRUTS action will send back a WDDX message after marking the lesson by the given lesson ID
+ * as Lesson.DISABLED_STATE
status.
+ *
+ * This action need a lession ID as input. + *
+ * @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 removeLesson(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException{ + FlashMessage flashMessage = null; + this.monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext()); + long lessonId = WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID); + + try { + monitoringService.removeLesson(lessonId); + flashMessage = new FlashMessage("removeLesson",Boolean.TRUE); + } catch (Exception e) { + flashMessage = new FlashMessage("removeLesson", + "Invalid lessonID :" + lessonId, + FlashMessage.ERROR); + } + String message = flashMessage.serializeMessage(); + return outputPacket(mapping,request,response,message,"details"); + + } + public ActionForward getAllLessons(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException{