Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java,v diff -u -r1.2 -r1.3 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java 7 Apr 2008 07:33:30 -0000 1.2 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java 30 May 2008 09:13:33 -0000 1.3 @@ -55,7 +55,7 @@ public String getReflectInstrctions() { return reflectInstrctions; } - public void setReflectInstrctions(String reflectInstrctions) { + public void setReflectInstructions(String reflectInstrctions) { this.reflectInstrctions = reflectInstrctions; } public Long getUserUid() { Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TasListItemDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TasListItemDTO.java,v diff -u -r1.1 -r1.2 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TasListItemDTO.java 22 May 2008 07:34:35 -0000 1.1 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TasListItemDTO.java 30 May 2008 09:13:33 -0000 1.2 @@ -25,7 +25,9 @@ import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; import org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment; @@ -48,8 +50,15 @@ //shows if this TaskListItem shoud be displayed open or close private boolean isDisplayedOpen; + //Set of comments posted by the members of the group to which user belong to + private Set comments; + //Set of files uploaded by the members of the group to which user belong to + private Set attachments; + public TasListItemDTO(TaskListItem taskListItem) { this.taskListItem = taskListItem; + comments = new HashSet(); + attachments = new HashSet(); } // ********************************************************** @@ -157,6 +166,40 @@ public void setDisplayedOpen(boolean isDisplayedOpen) { this.isDisplayedOpen = isDisplayedOpen; } + + /** + * Returns set of comments posted by the members of the group to which user belong to. + * + * @return set of comments posted by the members of the group to which user belong to + */ + public Set getComments() { + return comments; + } + /** + * Sets set of comments posted by the members of the group to which user belong to. + * + * @param comments set of comments posted by the members of the group to which user belong to + */ + public void setComments(Set comments) { + this.comments = comments; + } + + /** + * Returns set of files uploaded by the members of the group to which user belong to. + * + * @return set of files uploaded by the members of the group to which user belong to + */ + public Set getAttachments() { + return attachments; + } + /** + * Sets set of files uploaded by the members of the group to which user belong to. + * + * @param attachments set of files uploaded by the members of the group to which user belong to + */ + public void setAttachments(Set attachments) { + this.attachments = attachments; + } } \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java,v diff -u -r1.17 -r1.18 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java 29 May 2008 08:17:49 -0000 1.17 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java 30 May 2008 09:13:33 -0000 1.18 @@ -156,6 +156,14 @@ * @return */ List getUserListBySessionItem(Long sessionId, Long itemUid); + + /** + * Get user list by sessionId. (thus users belonging to one group) + * + * @param sessionId + * @return + */ + List getUserListBySessionId(Long sessionId); /** * Get user by UID Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java,v diff -u -r1.19 -r1.20 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 29 May 2008 08:17:49 -0000 1.19 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 30 May 2008 09:13:33 -0000 1.20 @@ -31,6 +31,7 @@ import java.util.Comparator; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.List; @@ -358,35 +359,9 @@ return nextUrl; } - public int checkMinimumNumberTasksComplete(Long toolSessionId, Long userUid) { - int completedItems = taskListItemVisitDao.getTasksCompletedCountByUser(toolSessionId, userUid); - TaskListSession session = taskListSessionDao.getSessionBySessionId(toolSessionId); - if(session == null){ - log.error("Failed get session by ID [" + toolSessionId + "]"); - return 0; - } - int minimumNumberTasksComplete = session.getTaskList().getMinimumNumberTasksComplete(); - - return (minimumNumberTasksComplete - completedItems); - } - - /** * {@inheritDoc} */ - public void retrieveComplete(Set taskListItemList, TaskListUser user) { - for(TaskListItem item:taskListItemList){ - TaskListItemVisitLog log = taskListItemVisitDao.getTaskListItemLog(item.getUid(),user.getUserId()); - if(log == null) - item.setComplete(false); - else - item.setComplete(log.isComplete()); - } - } - - /** - * {@inheritDoc} - */ public void setItemComplete(Long taskListItemUid, Long userId, Long sessionId) { TaskListItemVisitLog log = taskListItemVisitDao.getTaskListItemLog(taskListItemUid,userId); if(log == null){ @@ -419,7 +394,36 @@ taskListItemVisitDao.saveObject(log); } } + + /** + * {@inheritDoc} + */ + public int checkMinimumNumberTasksComplete(Long toolSessionId, Long userUid) { + int completedItems = taskListItemVisitDao.getTasksCompletedCountByUser(toolSessionId, userUid); + TaskListSession session = taskListSessionDao.getSessionBySessionId(toolSessionId); + if(session == null){ + log.error("Failed get session by ID [" + toolSessionId + "]"); + return 0; + } + int minimumNumberTasksComplete = session.getTaskList().getMinimumNumberTasksComplete(); + + return (minimumNumberTasksComplete - completedItems); + } + + /** + * {@inheritDoc} + */ + public void retrieveComplete(Set taskListItemList, TaskListUser user) { + for(TaskListItem item:taskListItemList){ + TaskListItemVisitLog log = taskListItemVisitDao.getTaskListItemLog(item.getUid(),user.getUserId()); + if(log == null) + item.setComplete(false); + else + item.setComplete(log.isComplete()); + } + } + /** * {@inheritDoc} */ @@ -479,52 +483,6 @@ /** * {@inheritDoc} */ - public int getNumTasksCompletedByUser(Long toolSessionId, Long userUid) { - return getTaskListItemVisitDao().getTasksCompletedCountByUser(toolSessionId, userUid); - } - - /** - * {@inheritDoc} - */ - public boolean checkCondition(String conditionName, Long toolSessionId, Long userUid) { - TaskListUser user = taskListUserDao.getUserByUserIDAndSessionID(userUid, toolSessionId); - TaskList taskList = taskListSessionDao.getSessionBySessionId(toolSessionId).getTaskList(); - Set conditions = taskList.getConditions(); - TaskListCondition condition = null; - for (TaskListCondition cond:conditions) { - if (cond.getName().equals(conditionName)) { - condition = cond; - break; - } - } - - boolean result = true; - if (condition != null) { - Iterator it = condition.getTaskListItems().iterator(); - while(it.hasNext()) { - TaskListItem item = (TaskListItem) it.next(); - - TaskListItemVisitLog visitLog = taskListItemVisitDao.getTaskListItemLog(item.getUid(), userUid); - if (visitLog != null) { - //result is being calculated depending on visitLog value - result &= visitLog.isComplete(); - } else { - //user hadn't complete this task. So this means the condition isn't met. - result = false; - break; - } - } - } else { - //there is no such a condition - result = false; - } - - return result; - } - - /** - * {@inheritDoc} - */ public List getItemSummary(Long contentId, Long taskListItemUid) { TaskListItem taskListItem = taskListItemDao.getByUid(taskListItemUid); @@ -647,7 +605,53 @@ return eachItemOverallSummaries; } + + /** + * {@inheritDoc} + */ + public int getNumTasksCompletedByUser(Long toolSessionId, Long userUid) { + return getTaskListItemVisitDao().getTasksCompletedCountByUser(toolSessionId, userUid); + } + + /** + * {@inheritDoc} + */ + public boolean checkCondition(String conditionName, Long toolSessionId, Long userUid) { + TaskListUser user = taskListUserDao.getUserByUserIDAndSessionID(userUid, toolSessionId); + TaskList taskList = taskListSessionDao.getSessionBySessionId(toolSessionId).getTaskList(); + Set conditions = taskList.getConditions(); + TaskListCondition condition = null; + for (TaskListCondition cond:conditions) { + if (cond.getName().equals(conditionName)) { + condition = cond; + break; + } + } + boolean result = true; + if (condition != null) { + Iterator it = condition.getTaskListItems().iterator(); + while(it.hasNext()) { + TaskListItem item = (TaskListItem) it.next(); + + TaskListItemVisitLog visitLog = taskListItemVisitDao.getTaskListItemLog(item.getUid(), userUid); + if (visitLog != null) { + //result is being calculated depending on visitLog value + result &= visitLog.isComplete(); + } else { + //user hadn't complete this task. So this means the condition isn't met. + result = false; + break; + } + } + } else { + //there is no such a condition + result = false; + } + + return result; + } + /** * {@inheritDoc} */ @@ -661,6 +665,13 @@ } return userList; } + + /** + * {@inheritDoc} + */ + public List getUserListBySessionId(Long sessionId) { + return taskListUserDao.getBySessionID(sessionId); + } /** * {@inheritDoc} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java,v diff -u -r1.11 -r1.12 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 30 May 2008 03:24:16 -0000 1.11 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 30 May 2008 09:13:33 -0000 1.12 @@ -28,6 +28,8 @@ import java.sql.Timestamp; import java.util.Comparator; import java.util.Date; +import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -57,6 +59,7 @@ import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; import org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment; import org.lamsfoundation.lams.tool.taskList.model.TaskListItemComment; +import org.lamsfoundation.lams.tool.taskList.model.TaskListItemVisitLog; import org.lamsfoundation.lams.tool.taskList.model.TaskListSession; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; import org.lamsfoundation.lams.tool.taskList.service.ITaskListService; @@ -158,9 +161,25 @@ } TaskList taskList = service.getTaskListBySessionId(sessionId); + + //Create set of TaskListItems besides this filtering out items added by users from other groups TreeSet items = new TreeSet (new TaskListItemComparator()); - items.addAll(taskList.getTaskListItems()); - + if (mode.isLearner()) { + + List grouppedUsers = service.getUserListBySessionId(sessionId); + Set allTaskListItems = taskList.getTaskListItems(); + + for(TaskListItem item:allTaskListItems) { + for(TaskListUser grouppedUser:grouppedUsers) { + if (item.isCreateByAuthor() || grouppedUser.getUserId().equals(item.getCreateBy().getUserId())) items.add(item); + } + } + + } else { + items.addAll(taskList.getTaskListItems()); + } + + //check whehter finish lock is on/off boolean lock = taskList.getLockWhenFinished() && taskListUser !=null && taskListUser.isSessionFinished(); @@ -237,6 +256,33 @@ itemDTO.setPreviousTaskCompleted(isPreviousTaskCompleted); isPreviousTaskCompleted = item.isComplete(); + //filter out comments and attachments which belong to another group + Set filteredComments = new HashSet(); + Set filteredAttachments = new HashSet(); + if (mode.isLearner()) { + + List grouppedUsers = service.getUserListBySessionId(sessionId); + Set comments = item.getComments(); + Set attachments = item.getAttachments(); + + for(TaskListItemComment comment:comments) { + for(TaskListUser grouppedUser:grouppedUsers) { + if (grouppedUser.getUserId().equals(comment.getCreateBy().getUserId())) filteredComments.add(comment); + } + } + + for(TaskListItemAttachment attachment:attachments) { + for(TaskListUser grouppedUser:grouppedUsers) { + if (grouppedUser.getUserId().equals(attachment.getCreateBy().getUserId())) filteredAttachments.add(attachment); + } + } + } else { + filteredComments = item.getComments(); + filteredAttachments = item.getAttachments(); + } + itemDTO.setComments(filteredComments); + itemDTO.setAttachments(filteredAttachments); + itemDTOs.add(itemDTO); } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java,v diff -u -r1.9 -r1.10 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java 29 May 2008 08:17:49 -0000 1.9 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java 30 May 2008 09:13:33 -0000 1.10 @@ -181,7 +181,7 @@ refDTO.setFinishReflection(true); refDTO.setReflect(notebookEntry.getEntry()); } - refDTO.setReflectInstrctions(session.getTaskList().getReflectInstructions()); + refDTO.setReflectInstructions(session.getTaskList().getReflectInstructions()); request.setAttribute("userDTO", refDTO); return mapping.findForward("success"); Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java,v diff -u -r1.8 -r1.9 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java 29 May 2008 08:17:49 -0000 1.8 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/servlet/ExportServlet.java 30 May 2008 09:13:33 -0000 1.9 @@ -40,9 +40,15 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.taskList.TaskListConstants; import org.lamsfoundation.lams.tool.taskList.dto.GroupSummary; +import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO; import org.lamsfoundation.lams.tool.taskList.dto.Summary; import org.lamsfoundation.lams.tool.taskList.dto.ItemSummary; import org.lamsfoundation.lams.tool.taskList.model.TaskList; @@ -54,6 +60,7 @@ import org.lamsfoundation.lams.tool.taskList.service.TaskListServiceProxy; import org.lamsfoundation.lams.tool.taskList.util.TaskListToolContentHandler; import org.lamsfoundation.lams.util.FileUtil; +import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.servlet.AbstractExportPortfolioServlet; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; @@ -204,6 +211,8 @@ List> itemSummaries = service.exportForTeacher(toolContentID); + + saveFileToLocal(itemSummaries, directoryName); // put it into HTTPSession @@ -262,4 +271,31 @@ } return handler; } + + private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { + + Long uid = WebUtil.readLongParam(request, TaskListConstants.ATTR_USER_UID); + + ITaskListService service = TaskListServiceProxy.getTaskListService(getServletContext()); + TaskListUser user = service.getUser(uid); + Long sessionID = user.getSession().getSessionId(); + NotebookEntry notebookEntry = service.getEntry(sessionID, + CoreNotebookConstants.NOTEBOOK_TOOL, + TaskListConstants.TOOL_SIGNATURE, user.getUserId().intValue()); + + TaskListSession session = service.getTaskListSessionBySessionId(sessionID); + + ReflectDTO refDTO = new ReflectDTO(user); + if(notebookEntry == null){ + refDTO.setFinishReflection(false); + refDTO.setReflect(null); + }else{ + refDTO.setFinishReflection(true); + refDTO.setReflect(notebookEntry.getEntry()); + } + refDTO.setReflectInstructions(session.getTaskList().getReflectInstructions()); + + request.setAttribute("userDTO", refDTO); + return mapping.findForward("success"); + } } Index: lams_tool_task/web/pages/learning/parts/commentlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/pages/learning/parts/commentlist.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_task/web/pages/learning/parts/commentlist.jsp 22 May 2008 07:34:34 -0000 1.1 +++ lams_tool_task/web/pages/learning/parts/commentlist.jsp 30 May 2008 09:13:33 -0000 1.2 @@ -1,4 +1,4 @@ - +
Index: lams_tool_task/web/pages/learning/parts/filelist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/pages/learning/parts/filelist.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_task/web/pages/learning/parts/filelist.jsp 22 May 2008 07:34:34 -0000 1.1 +++ lams_tool_task/web/pages/learning/parts/filelist.jsp 30 May 2008 09:13:33 -0000 1.2 @@ -1,5 +1,5 @@
- +