Index: lams_learning/conf/language/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/conf/language/Attic/ApplicationResources.properties,v
diff -u -r1.4 -r1.5
--- lams_learning/conf/language/ApplicationResources.properties 17 May 2006 07:25:02 -0000 1.4
+++ lams_learning/conf/language/ApplicationResources.properties 2 Jun 2006 07:56:27 -0000 1.5
@@ -10,6 +10,8 @@
message.activity.options.activityCount=You must complete at least {0} of these {1} activities.
message.activity.options.note=Note: Once you finish any of the above activities you can revisit them by using the progress bar on the left.
+label.activity.options.choose=Choose
+label.activity.finish=Finish
label.synch.gate.title=Synch Gate
label.synch.gate.message=You have stopped at a gate. You cannot continue until all of your group/class reach this point.
label.permission.gate.title=Permission Gate
@@ -20,9 +22,12 @@
label.gate.waiting.learners={0} out of {1} are waiting in front of the gate.
label.gate.refresh.message=Click Next if you are told that the gate is open. This page will refresh automatically in 1 minute.
label.gate.next.button=Next
-label.activity.options.choose=Choose
-label.activity.finish=Finish
+# Heading for the two "grouping" pages
+label.view.groups.title=Groups
+# Message displayed to learner who is waiting for chosen grouping to occur
+message.view.groups.wait=Some of your following tasks require a group. You cannot continue until the groups have been selected. Click Next if you are told that the groups have been created. This page will refresh automatically in 5 minutes.
+
# Export Portfolio internal system error
error.system.exportPortfolio=An internal error has occurred with the Export Portfolio Functionality. If reporting this error, please report:
{0}
# Export Portfolio system error in the learner module
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java,v
diff -u -r1.27 -r1.28
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java 1 Jun 2006 22:58:57 -0000 1.27
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java 2 Jun 2006 07:56:26 -0000 1.28
@@ -191,34 +191,18 @@
public Integer getCountActiveLearnersByLesson(long lessonId);
/**
- * Perform random grouping for the learners who have started the lesson,
- * based on the grouping activity. This method should be used when we don't
- * have an grouping activity that is already part of the Hibernate session.
+ * Perform grouping for the learners who have started the lesson,
+ * based on the grouping activity.
*
* @param lessonId lesson id
* @param groupingActivityId the activity that has create grouping.
+ * @param learnerId the learner who triggers the grouping.
+ * @return true if grouping done, false if waiting for grouping to occur
*/
- public void performGrouping(Long lessonId, Long groupingActivityId);
+ public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId);
/**
- * Perform random grouping for the learners who have started the lesson,
- * based on the grouping activity. This method should be used when we do
- * have an grouping activity that is already part of the Hibernate session.
- *
- * @param lessonId lesson id
- * @param groupingActivityId the activity that has create grouping.
- */
- public void performGrouping(Long lessonId, GroupingActivity groupingActivity);
-
- /**
- * Perform random grouping a single learner based on the grouping activity.
- * @param groupingActivityId the activity that has create grouping.
- * @param learner the learner needs to be grouped
- */
- public void performGrouping(Long groupingActivityId, User learner);
-
- /**
* Check up the gate status to go through the gate. This also updates the gate.
* This method should be used when we do not have an grouping activity
* that is already part of the Hibernate session.
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java,v
diff -u -r1.46 -r1.47
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java 1 Jun 2006 22:58:57 -0000 1.46
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java 2 Jun 2006 07:56:26 -0000 1.47
@@ -50,6 +50,7 @@
import org.lamsfoundation.lams.lesson.dto.LearnerProgressDTO;
import org.lamsfoundation.lams.lesson.dto.LessonDTO;
import org.lamsfoundation.lams.lesson.service.ILessonService;
+import org.lamsfoundation.lams.lesson.service.LessonServiceException;
import org.lamsfoundation.lams.tool.ToolSession;
import org.lamsfoundation.lams.tool.dao.IToolSessionDAO;
import org.lamsfoundation.lams.tool.exception.LamsToolServiceException;
@@ -406,58 +407,36 @@
}
/**
- * @see org.lamsfoundation.lams.learning.service.ILearnerService#performGrouping(java.lang.Long, java.lang.Long)
+ * @throws LearnerServiceException
+ * @see org.lamsfoundation.lams.learning.service.ILearnerService#performGrouping(java.lang.Long, java.lang.Long, java.lang.Integer)
*/
- public void performGrouping(Long lessonId, Long groupingActivityId)
+ public boolean performGrouping(Long lessonId, Long groupingActivityId, Integer learnerId) throws LearnerServiceException
{
GroupingActivity groupingActivity = (GroupingActivity) activityDAO.getActivityByActivityId(groupingActivityId, GroupingActivity.class);
- if ( groupingActivity != null ) {
- performGrouping(lessonId, groupingActivity);
-
- } else {
-
- String error = "Grouping activity "+groupingActivityId+" does not exist. Cannot perform grouping.";
- log.error(error);
- throw new LearnerServiceException(error);
-
+ User learner = userManagementService.getUserById(learnerId);
+
+ boolean groupingDone = false;
+ try {
+ if ( groupingActivity != null && groupingActivity.getCreateGrouping()!=null && learner != null ) {
+ Grouping grouping = groupingActivity.getCreateGrouping();
+ if ( grouping.isRandomGrouping() ) {
+ lessonService.performGrouping(lessonId, groupingActivity, learner);
+ groupingDone = true;
+ } else {
+ groupingDone = grouping.doesLearnerExist(learner);
+ }
+ } else {
+ String error = "Grouping activity "+groupingActivityId+" learner "+learnerId+" does not exist. Cannot perform grouping.";
+ log.error(error);
+ throw new LearnerServiceException(error);
+ }
+ } catch ( LessonServiceException e ) {
+ throw new LearnerServiceException("performGrouping failed due to "+e.getMessage(), e);
}
-
+ return groupingDone;
}
-
- /**
- * @see org.lamsfoundation.lams.learning.service.ILearnerService#performGrouping(java.lang.Long, org.lamsfoundation.lams.learningdesign.GroupingActivity)
- */
- public void performGrouping(Long lessonId, GroupingActivity groupingActivity) {
- List learners = lessonService.getActiveLessonLearners(lessonId.longValue());
- Grouping grouping = groupingActivity.getCreateGrouping();
- grouping.doGrouping(learners);
- groupingDAO.update(grouping);
- }
-
-
- /**
- * @see org.lamsfoundation.lams.learning.service.ILearnerService#performGrouping(org.lamsfoundation.lams.learningdesign.GroupingActivity, org.lamsfoundation.lams.usermanagement.User)
- */
- public void performGrouping(Long groupingActivityId, User learner)
- {
- GroupingActivity groupingActivity = (GroupingActivity) activityDAO.getActivityByActivityId(groupingActivityId, GroupingActivity.class);
- if ( groupingActivity != null ) {
- Grouping grouping = groupingActivity.getCreateGrouping();
- grouping.doGrouping(learner);
- groupingDAO.update(grouping);
-
- } else {
-
- String error = "Grouping activity "+groupingActivityId+" does not exist. Cannot perform grouping.";
- log.error(error);
- throw new LearnerServiceException(error);
-
- }
-
- }
-
/**
* @see org.lamsfoundation.lams.learning.service.ILearnerService#knockGate(java.lang.Long, java.lang.Long, org.lamsfoundation.lams.usermanagement.User)
*/
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceException.java
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceException.java,v
diff -u -r1.3 -r1.4
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceException.java 5 Apr 2006 23:08:09 -0000 1.3
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerServiceException.java 2 Jun 2006 07:56:26 -0000 1.4
@@ -48,4 +48,28 @@
{
super(msg);
}
+
+ /**
+ * Constructs an instance of LearnerServiceException
+ * for wrapping both the customized error message and
+ * throwable exception object.
+ * @param message
+ * @param cause
+ */
+ public LearnerServiceException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ /**
+ * Constructs an instance of LearnerServiceException
+ * for wrapping an throwable exception object.
+ * @param message
+ * @param cause
+ */
+ public LearnerServiceException(Throwable cause)
+ {
+ super(cause);
+ }
+
}
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java,v
diff -u -r1.13 -r1.14
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java 1 Jun 2006 22:58:57 -0000 1.13
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GroupingAction.java 2 Jun 2006 07:56:26 -0000 1.14
@@ -25,8 +25,8 @@
package org.lamsfoundation.lams.learning.web.action;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -41,10 +41,10 @@
import org.lamsfoundation.lams.learning.service.LearnerServiceProxy;
import org.lamsfoundation.lams.learning.web.util.LearningWebUtil;
import org.lamsfoundation.lams.learningdesign.Activity;
+import org.lamsfoundation.lams.learningdesign.GroupComparator;
+import org.lamsfoundation.lams.learningdesign.Grouping;
import org.lamsfoundation.lams.learningdesign.GroupingActivity;
import org.lamsfoundation.lams.lesson.LearnerProgress;
-import org.lamsfoundation.lams.lesson.Lesson;
-import org.lamsfoundation.lams.usermanagement.User;
import org.lamsfoundation.lams.web.action.LamsDispatchAction;
@@ -68,8 +68,9 @@
* type="org.lamsfoundation.lams.learning.service.LearnerServiceException"
* path=".systemError"
* handler="org.lamsfoundation.lams.learning.util.CustomStrutsExceptionHandler"
- * @struts:action-forward name="viewGrouping" path="/grouping.do?method=viewGrouping"
- * @struts:action-forward name="showGroup" path=".grouping"
+ * @struts:action-forward name="viewGroup" path="/grouping.do?method=viewGrouping"
+ * @struts:action-forward name="showGroup" path=".showgroup"
+ * @struts:action-forward name="waitGroup" path=".waitgroup"
* ----------------XDoclet Tags--------------------
*
*/
@@ -88,7 +89,8 @@
//---------------------------------------------------------------------
// Class level constants - Struts forward
//---------------------------------------------------------------------
- private static final String VIEW_GROUPING = "viewGrouping";
+ private static final String VIEW_GROUP = "viewGroup";
+ private static final String WAIT_GROUP = "waitGroup";
private static final String SHOW_GROUP = "showGroup";
//---------------------------------------------------------------------
@@ -117,15 +119,15 @@
//initialize service object
ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext());
-
- learnerService.performGrouping(learnerProgress.getLesson().getLessonId(),
- learnerProgress.getNextActivity().getActivityId());
+ boolean groupingDone = learnerService.performGrouping(learnerProgress.getLesson().getLessonId(),
+ learnerProgress.getNextActivity().getActivityId(),
+ LearningWebUtil.getUserId());
LearningWebUtil.putActivityInRequest(request, learnerProgress.getNextActivity(), learnerService);
LearningWebUtil.setLessonId(learnerProgress.getLesson().getLessonId());
- return mapping.findForward(VIEW_GROUPING);
+ return mapping.findForward(groupingDone ? VIEW_GROUP : WAIT_GROUP);
}
/**
@@ -148,15 +150,19 @@
//initialize service object
ILearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext());
- Activity groupingActivity = LearningWebUtil.getActivityFromRequest(request,learnerService);
- List groups = new ArrayList(((GroupingActivity)groupingActivity).getCreateGrouping().getGroups());
+ SortedSet groups = new TreeSet(new GroupComparator());
+
+ Activity activity = LearningWebUtil.getActivityFromRequest(request,learnerService);
+ Grouping grouping = ((GroupingActivity)activity).getCreateGrouping();
+ if ( grouping != null)
+ groups.addAll(grouping.getGroups());
+
request.getSession().setAttribute(GROUPS,groups);
- request.setAttribute(LearningWebUtil.PARAM_ACTIVITY_ID,
- groupingActivity.getActivityId());
+ request.setAttribute(LearningWebUtil.PARAM_ACTIVITY_ID, activity.getActivityId());
return mapping.findForward(SHOW_GROUP);
}
-
+
/**
* Complete the current tool activity and forward to the url of next activity
* in the learning design.
Index: lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/test/java/org/lamsfoundation/lams/learning/service/Attic/TestLearnerService.java,v
diff -u -r1.32 -r1.33
--- lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java 1 Jun 2006 22:58:57 -0000 1.32
+++ lams_learning/test/java/org/lamsfoundation/lams/learning/service/TestLearnerService.java 2 Jun 2006 07:56:27 -0000 1.33
@@ -337,7 +337,7 @@
assertTrue("verify the existance of test user",!randomGrouping.doesLearnerExist(testUser));
- learnerService.performGrouping(randomGroupingActivity.getActivityId(),testUser);
+ learnerService.performGrouping(Test_Lesson_ID,randomGroupingActivity.getActivityId(),testUser.getUserId());
assertTrue("verify the existance of test user",randomGrouping.doesLearnerExist(testUser));
}
Index: lams_learning/web/controlFrame.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/web/Attic/controlFrame.jsp,v
diff -u -r1.7 -r1.8
--- lams_learning/web/controlFrame.jsp 25 May 2006 01:02:50 -0000 1.7
+++ lams_learning/web/controlFrame.jsp 2 Jun 2006 07:56:26 -0000 1.8
@@ -32,7 +32,7 @@
-
+
Fisheye: Tag 1.6 refers to a dead (removed) revision in file `lams_learning/web/grouping/grouping.jsp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_learning/web/grouping/show.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/web/grouping/show.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_learning/web/grouping/show.jsp 2 Jun 2006 07:56:26 -0000 1.1
@@ -0,0 +1,62 @@
+<%--
+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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ http://www.gnu.org/licenses/gpl.txt
+--%>
+
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-bean" prefix="bean" %>
+<%@ taglib uri="tags-logic" prefix="logic" %>
+<%@ taglib uri="tags-core" prefix="c" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
\ No newline at end of file
Index: lams_learning/web/grouping/wait.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/web/grouping/wait.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_learning/web/grouping/wait.jsp 2 Jun 2006 07:56:26 -0000 1.1
@@ -0,0 +1,46 @@
+<%--
+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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ http://www.gnu.org/licenses/gpl.txt
+--%>
+
+<%@ taglib uri="tags-html" prefix="html" %>
+<%@ taglib uri="tags-bean" prefix="bean" %>
+<%@ taglib uri="tags-logic" prefix="logic" %>
+<%@ taglib uri="tags-core" prefix="c" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="tags-lams" prefix="lams" %>
+
+
\ No newline at end of file
Index: lams_learning/web/layout/groupWaitLayout.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_learning/web/layout/groupWaitLayout.jsp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_learning/web/layout/groupWaitLayout.jsp 2 Jun 2006 07:56:27 -0000 1.1
@@ -0,0 +1,46 @@
+<%--
+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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ http://www.gnu.org/licenses/gpl.txt
+--%>
+
+<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %>
+<%@ taglib uri="tags-bean" prefix="bean"%>
+<%@ taglib uri="tags-html" prefix="html"%>
+<%@ taglib uri="tags-tiles" prefix="tiles"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-lams" prefix="lams" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+