Index: lams_build/lib/lams/lams-monitoring.jar
===================================================================
diff -u -r9e3eb5c4381864be1d02d6d2936ee21c6fa171ea -r04ddbcceec831fcb71c1c9d160300569ac1547f6
Binary files differ
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java
===================================================================
diff -u -r374085d62f6975a2b7e03f2419e2475f67757138 -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 374085d62f6975a2b7e03f2419e2475f67757138)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java (.../IMonitoringService.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -77,7 +77,7 @@
* lams and tool interaction to start a
* lesson.
*/
- public void startlesson(long lessonId);
+ public void startLesson(long lessonId);
/**
* Force the learner to complete all the activities for current lesson.
@@ -292,4 +292,8 @@
* @return
*/
public String releaseGate(Long activityID) throws IOException;
+
+ /* 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 -rbf77e0e7ce264dac574577c0d61cc94caad9a1fb -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision bf77e0e7ce264dac574577c0d61cc94caad9a1fb)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java (.../MonitoringService.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -55,6 +55,7 @@
import org.lamsfoundation.lams.tool.exception.ToolException;
import org.lamsfoundation.lams.tool.service.ILamsCoreToolService;
import org.lamsfoundation.lams.usermanagement.Organisation;
+import org.lamsfoundation.lams.usermanagement.Role;
import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.usermanagement.WorkspaceFolder;
import org.lamsfoundation.lams.usermanagement.dao.IOrganisationDAO;
@@ -310,7 +311,7 @@
/**
* @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#startlesson(long)
*/
- public void startlesson(long lessonId)
+ public void startLesson(long lessonId)
{
if(log.isDebugEnabled())
log.debug("=============Starting Lesson "+lessonId+"==============");
@@ -1003,8 +1004,27 @@
}
return table;
}
-
+
+ /* ** Temporary methods to support the dummy monitoring pages */
+ /** Get a map of organisations. Their users shoulc and their users. */
+ public List getOrganisationsUsers(Integer userId) {
+
+ User user = userManagementService.getUserById(userId);
+ List orgs = userManagementService.getOrganisationsForUserByRole(user, Role.STAFF);
+ // Make sure the users are loaded
+ Iterator iter = orgs.iterator();
+ while (iter.hasNext()) {
+ Organisation element = (Organisation) iter.next();
+ element.getUsers();
+ }
+ return orgs;
+ }
+ /** Get all the learning designs for this user */
+ public List getLearningDesigns(Long userId) {
+
+ return learningDesignDAO.getLearningDesignByUserId(userId);
+ }
}
\ No newline at end of file
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyForm.java
===================================================================
diff -u -r4ffb4f1a2bfc99e753289a089a51c92129409397 -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyForm.java (.../DummyForm.java) (revision 4ffb4f1a2bfc99e753289a089a51c92129409397)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyForm.java (.../DummyForm.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -37,6 +37,7 @@
private String title;
private String desc;
private Long learningDesignId;
+ private Integer organisationId;
public void reset(ActionMapping mapping, HttpServletRequest request) {
@@ -82,4 +83,14 @@
}
+ public Integer getOrganisationId() {
+ return organisationId;
+ }
+
+
+ public void setOrganisationId(Integer organisationId) {
+ this.organisationId = organisationId;
+ }
+
+
}
\ No newline at end of file
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java
===================================================================
diff -u -re99f20a4942e2da662332122dd8926e9d236b2d5 -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java (.../DummyMonitoringAction.java) (revision e99f20a4942e2da662332122dd8926e9d236b2d5)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/DummyMonitoringAction.java (.../DummyMonitoringAction.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -23,6 +23,7 @@
package org.lamsfoundation.lams.monitoring.web;
import java.io.IOException;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -64,7 +65,10 @@
* type="org.lamsfoundation.lams.monitoring.service.MonitoringServiceException"
* path=".systemError"
* handler="org.lamsfoundation.lams.web.util.CustomStrutsExceptionHandler"
- * @struts:action-forward name="dummy" path="/dummy.jsp"
+ * @struts:action-forward name="detail" path="/dummyDetail.jsp"
+ * @struts:action-forward name="start" path="/dummyStart.jsp"
+ * @struts:action-forward name="started" path="/dummyStarted.jsp"
+ * @struts:action-forward name="control" path="/dummyControlFrame.jsp"
*
* ----------------XDoclet Tags--------------------
*/
@@ -81,13 +85,50 @@
//---------------------------------------------------------------------
// input parameters
// output parameters
- private static final String DUMMY_FORWARD = "dummy";
+ private static final String CONTROL_FORWARD = "control";
+ private static final String DETAIL_FORWARD = "detail";
+ private static final String START_LESSON_FORWARD = "start";
+ private static final String LESSON_STARTED_FORWARD = "started";
+
+ private static final String LESSON_PARAMETER = "lesson";
private static final String LESSONS_PARAMETER = "lessons";
+ private static final String ORGS_PARAMETER = "organisations";
+ private static final String DESIGNS_PARAMETER = "designs";
- private static final Integer ORGANIZATION_ID = new Integer(1);
+ /** Default method for this action. Gets all the current lessons and forwards to the control page */
+ public ActionForward unspecified(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)throws IOException{
+
+ setupServices();
+
+ User user = getUser();
+ List lessons = monitoringService.getAllLessons(user.getUserId());
+ request.getSession().setAttribute(LESSONS_PARAMETER,lessons);
+ return mapping.findForward(CONTROL_FORWARD);
+
+ }
-
+ /** Sets up the "create a lesson" screen, forwarding to dummyStart.jsp */
+ public ActionForward initStartScreen(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)throws IOException{
+ setupServices();
+
+ User user = getUser();
+
+ List designs = monitoringService.getLearningDesigns(new Long(user.getUserId().longValue()));
+ request.getSession().setAttribute(DESIGNS_PARAMETER,designs);
+
+ List organisations = monitoringService.getOrganisationsUsers(user.getUserId());
+ request.getSession().setAttribute(ORGS_PARAMETER,organisations);
+
+ return mapping.findForward(START_LESSON_FORWARD);
+ }
+
//---------------------------------------------------------------------
// Struts Dispatch Method
//---------------------------------------------------------------------
@@ -117,51 +158,88 @@
// set up all the data needed
DummyForm dummyForm = (DummyForm) form;
- Long ldId = dummyForm.getLearningDesignId();
+
+ User user = getUser();
+
+ Long ldId = dummyForm.getLearningDesignId();
if ( ldId == null )
throw new IOException("Learning design id must be set");
- String title = dummyForm.getTitle();
+ Integer organisationId = dummyForm.getOrganisationId();
+ if ( organisationId == null )
+ throw new IOException("Organisation must be set");
+ Organisation organisation = usermanageService.getOrganisationById(organisationId);
+ if ( organisation == null )
+ throw new IOException("Organisation cannot be found. Id was "+organisationId);
+
+ String title = dummyForm.getTitle();
if ( title == null ) title = "lesson";
String desc = dummyForm.getDesc();
if ( desc == null ) desc = "description";
- User user = getUser();
- Organisation organisation = usermanageService.getOrganisationById(ORGANIZATION_ID);
-
// initialize the lesson
Lesson testLesson = monitoringService.initializeLesson(title,desc,ldId.longValue(),user);
- // create the lesson class
+ // create the lesson class - add all the users in this organisation to the lesson class
+ // add user as staff
LinkedList learners = new LinkedList();
+ Iterator iter = organisation.getUsers().iterator();
learners.add(user);
+ while (iter.hasNext()) {
+ User element = (User) iter.next();
+ learners.add(element);
+ }
+
LinkedList staffs = new LinkedList();
staffs.add(user);
+
testLesson = monitoringService.createLessonClassForLesson(testLesson.getLessonId().longValue(),
organisation,
learners,
staffs);
// start the lesson.
this.monitoringService = MonitoringServiceProxy.getMonitoringService(getServlet().getServletContext());
- monitoringService.startlesson(testLesson.getLessonId().longValue());
-
- // now got back to the dummy screen with an updated list of lessons to the user
- return unspecified(mapping, form, request, response);
+ monitoringService.startLesson(testLesson.getLessonId().longValue());
+ return mapping.findForward(LESSON_STARTED_FORWARD);
}
- /** Default method for this action. Gets a list of all the current lessons for this user and forwards to dummy.jsp */
- public ActionForward unspecified(ActionMapping mapping,
- ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response)throws IOException{
+ /**
+ * The Struts dispatch method that lists a lesson's details. Forwards to the detail screen
+ *
+ * @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 getLesson(ActionMapping mapping,
+ ActionForm form,
+ HttpServletRequest request,
+ HttpServletResponse response)throws IOException{
+
setupServices();
User user = getUser();
+ Long lessonId = new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_LESSON_ID));
List lessons = monitoringService.getAllLessons(user.getUserId());
- request.getSession().setAttribute(LESSONS_PARAMETER,lessons);
- return mapping.findForward(DUMMY_FORWARD);
+
+ Iterator iter = lessons.iterator();
+ while (iter.hasNext()) {
+ Lesson element = (Lesson) iter.next();
+ if ( element.getLessonId().equals(lessonId) )
+ request.getSession().setAttribute(LESSON_PARAMETER,element);
+ }
+ return mapping.findForward(DETAIL_FORWARD);
+
}
private void setupServices() {
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java
===================================================================
diff -u -r4ffb4f1a2bfc99e753289a089a51c92129409397 -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 4ffb4f1a2bfc99e753289a089a51c92129409397)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -145,7 +145,7 @@
long lessonId = WebUtil.readLongParam(request,PARAM_LESSON_ID);
- monitoringService.startlesson(lessonId);
+ monitoringService.startLesson(lessonId);
//TODO add the wddx acknowledgement code.
Index: lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java
===================================================================
diff -u -r4ffb4f1a2bfc99e753289a089a51c92129409397 -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java (.../TestMonitoringService.java) (revision 4ffb4f1a2bfc99e753289a089a51c92129409397)
+++ lams_monitoring/test/java/org/lamsfoundation/lams/monitoring/service/TestMonitoringService.java (.../TestMonitoringService.java) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -194,7 +194,7 @@
public void testStartlesson() throws LamsToolServiceException
{
- monitoringService.startlesson(TEST_LESSON_ID.longValue());
+ monitoringService.startLesson(TEST_LESSON_ID.longValue());
assertTrue(true);
Lesson startedLesson = lessonDao.getLesson(TEST_LESSON_ID);
Index: lams_monitoring/web/WEB-INF/struts/struts-config.xml
===================================================================
diff -u -r411ed0a4c93b7bc699baee8c66bdc540ec34c7cb -r04ddbcceec831fcb71c1c9d160300569ac1547f6
--- lams_monitoring/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 411ed0a4c93b7bc699baee8c66bdc540ec34c7cb)
+++ lams_monitoring/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6)
@@ -136,10 +136,25 @@
scope="request"
/>
This is a dummy page for Lesson Management. It is to be used until the - Flash interface is ready. It pull the urls from the database so if the - urls are invalid, you need to check the tool deployment scripts.
+<%@ page language="java"%> +<%@ taglib uri="tags-bean" prefix="bean"%> +<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-lams" prefix="lams" %> + +Before you can start a lesson, you will need to create a learning design.
- At the moment, the only way to do this is to go into the authoring client
- and save a learning design containing your tool. Get the id of the learning
- design from the database. Once that is done, you can start a lesson
- using the learning design id.
-
-
-
-
-
- learningDesignId
-
- title
-
- desc
-
-
-
All the links below should pop-up in new windows.
-Start new lesson |
Refresh List |
" target="contentFrame">Monitor Lesson + |
Lesson Id: | +||
Description: | +||
State: | +
+ |
+
All the links below should pop-up in new windows.
+');>Export Portfolio for all users | +||
');>Export Portfolio as | ||
&lessonId= | ||
+ | ||
+ Activity |
+ + ');"> + Monitor + | +
+ ');">
+ Define Later + |
+
Login | +Progress | +|
Current Activity: | +||
+ | Completed Activities: | +
+ + |
+
Before you can start a lesson, you will need to create a learning design + using the authoring client. When you save the learning design, note down the id of + design ( or look it up in the lams_learning_design table in the database). + Once that is done, you can start a lesson using the learning design id.
+ +Authoring does not support the entry of a title or description for a design yet, so all we are able to display is the list + of learning design ids.
+ +Please select the organisation to which the lesson should be created. The lesson + will be started with all the users that are members of that organisation.
+ +Learning Design | ++ + |
Title | +|
Description | +|
Organisation | ++ + |
+ |
The lesson is started. Please refresh the control list on the left (using the "Refresh List") link to see your new lesson.
+ +To participate in the lesson, go back to the main page and click on the Learner button. The Learner interface should appear and the + new lesson should be listed.
+ + + Index: lams_monitoring/web/welcome.jsp =================================================================== diff -u --- lams_monitoring/web/welcome.jsp (revision 0) +++ lams_monitoring/web/welcome.jsp (revision 04ddbcceec831fcb71c1c9d160300569ac1547f6) @@ -0,0 +1,47 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +http://www.gnu.org/licenses/gpl.txt +--%> + +<%@ page language="java"%> +<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="tags-lams" prefix="lams" %> + + +
+
+
+ This is a dummy page for Lesson Management. It is to be used until the Flash interface is ready. +Select an option from the control frame on the left hand side. + |
+