Index: lams_documents/lams_monitoring/Monitoring.doc =================================================================== diff -u -r02f616a769197988d05f368164e1e51d1ae53210 -rbafa5fcba1d36d41f07976921a588b497e03801b Binary files differ Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== diff -u -r58daf95f59242b997de7f49a9d81ee9c1c104d5f -rbafa5fcba1d36d41f07976921a588b497e03801b --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 58daf95f59242b997de7f49a9d81ee9c1c104d5f) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision bafa5fcba1d36d41f07976921a588b497e03801b) @@ -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 =================================================================== diff -u -r72dd00c7f25eac454497a9ec2096016e5db0a90c -rbafa5fcba1d36d41f07976921a588b497e03801b --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 72dd00c7f25eac454497a9ec2096016e5db0a90c) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision bafa5fcba1d36d41f07976921a588b497e03801b) @@ -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 =================================================================== diff -u -r289df789024db64589a1960380d27cc90a4f53fd -rbafa5fcba1d36d41f07976921a588b497e03801b --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 289df789024db64589a1960380d27cc90a4f53fd) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision bafa5fcba1d36d41f07976921a588b497e03801b) @@ -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{