Index: lams_tool_task/.classpath =================================================================== diff -u -r9e2dc03fe28e3c80540446ea36654baeb862a888 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/.classpath (.../.classpath) (revision 9e2dc03fe28e3c80540446ea36654baeb862a888) +++ lams_tool_task/.classpath (.../.classpath) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -14,6 +14,11 @@ + + + + + Index: lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rfd67b35d233f4ae667c65d43a42c382fb2cd58d4 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision fd67b35d233f4ae667c65d43a42c382fb2cd58d4) +++ lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -165,6 +165,7 @@ monitor.summary.date.restriction.removed =Deadline has been removed label.submit =Finish label.download =Download +label.confirm =Confirm #======= End labels: Exported 159 labels for en AU ===== Index: lams_tool_task/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r8b97231e320c0c5b674f07c14da711f232ba9e1c -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 8b97231e320c0c5b674f07c14da711f232ba9e1c) +++ lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -254,10 +254,9 @@ parameter="setVerifiedByMonitor"> - - + parameter="getPagedUsers" > getTaskListItemLogBySession(Long sessionId,Long itemUid); - + /** + * Returns TaskListItemVisitLog which corresponds to specified taskListItemUid and userId. + * + * @param itemUid + * specified taskListItemUid + * @param userId + * specified userId + * @return TaskListItemVisitLog wich corresponds to specified taskListItemUid and userId + */ + TaskListItemVisitLog getTaskListItemLog(Long itemUid, Long userId); - /** - * - * - * @param toolSessionId - * @param userUid - * @return - */ - public int getTasksCompletedCountByUser(Long toolSessionId ,Long userUid); + /** + * Return list of taskListItemVisitLogs which corresponds to specified sessionId and itemUid + * + * @param sessionId + * specified sessionId + * @param itemUid + * specified itemUid + * @return list of taskListItemVisitLogs which corresponds to specified sessionId and itemUid + */ + List getTaskListItemLogBySession(Long sessionId, Long itemUid); + /** + * + * + * @param toolSessionId + * @param userId + * @return + */ + int getCountCompletedTasksByUser(Long toolSessionId, Long userId); + + int getCountCompletedTasksBySessionAndItem(Long toolSessionId, Long itemUid); + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListUserDAO.java =================================================================== diff -u -r0e7e464ded505f35e6ade3811f3f74658668e13a -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListUserDAO.java (.../TaskListUserDAO.java) (revision 0e7e464ded505f35e6ade3811f3f74658668e13a) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListUserDAO.java (.../TaskListUserDAO.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -23,8 +23,10 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.taskList.dao; +import java.util.Collection; import java.util.List; +import org.lamsfoundation.lams.tool.taskList.dto.TaskListUserDTO; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; /** @@ -35,29 +37,72 @@ */ public interface TaskListUserDAO extends DAO { - /** - * Returns user with the specified userID and sessionId. - * - * @param userID specified userID - * @param sessionId specified sessionId - * @return user with the specified userID and sessionId - */ - TaskListUser getUserByUserIDAndSessionID(Long userID, Long sessionId); + /** + * Returns user with the specified userID and sessionId. + * + * @param userID + * specified userID + * @param sessionId + * specified sessionId + * @return user with the specified userID and sessionId + */ + TaskListUser getUserByUserIDAndSessionID(Long userID, Long sessionId); - /** - * Returns user with the specified userID and contentId. - * - * @param userId specified userID - * @param contentId specified contentId - * @return user with the specified userID and contentId - */ - TaskListUser getUserByUserIDAndContentID(Long userId, Long contentId); + /** + * Returns user with the specified userID and contentId. + * + * @param userId + * specified userID + * @param contentId + * specified contentId + * @return user with the specified userID and contentId + */ + TaskListUser getUserByUserIDAndContentID(Long userId, Long contentId); - /** - * Returns list of users corresponds to specified sessionId. - * - * @param sessionId specified sessionId - * @return list of users corresponds to specified sessionId - */ - List getBySessionID(Long sessionId); + /** + * Returns list of users corresponds to specified sessionId. + * + * @param sessionId + * specified sessionId + * @return list of users corresponds to specified sessionId + */ + List getBySessionID(Long sessionId); + + /** + * Returns paged users for jqGrid based on sessionId. + * + * @param sessionId + * @param page + * @param size + * @param sortBy + * @param sortOrder + * @param searchString + * @return + */ + Collection getPagedUsersBySession(Long sessionId, int page, int size, String sortBy, + String sortOrder, String searchString); + + /** + * Returns paged users for jqGrid based on sessionId and taskListItemUid. + * + * @param sessionId + * @param taskListItemUid + * @param page + * @param size + * @param sortBy + * @param sortOrder + * @param searchString + * @return + */ + Collection getPagedUsersBySessionAndItem(Long sessionId, Long taskListItemUid, int page, int size, String sortBy, + String sortOrder, String searchString); + + /** + * Returns total number of users in a specified session. + * + * @param sessionId + * @param searchString + * @return + */ + int getCountPagedUsersBySession(Long sessionId, String searchString); } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java =================================================================== diff -u -r8b97231e320c0c5b674f07c14da711f232ba9e1c -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java (.../TaskListItemVisitDAOHibernate.java) (revision 8b97231e320c0c5b674f07c14da711f232ba9e1c) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemVisitDAOHibernate.java (.../TaskListItemVisitDAOHibernate.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -34,66 +34,51 @@ * @author Andrey Balan * @see org.lamsfoundation.lams.tool.taskList.dao.TaskListItemVisitDAO */ -public class TaskListItemVisitDAOHibernate extends BaseDAOHibernate implements TaskListItemVisitDAO{ - - private static final String FIND_BY_ITEM_AND_USER = "from " + TaskListItemVisitLog.class.getName() - + " as r where r.user.userId = ? and r.taskListItem.uid=?"; +public class TaskListItemVisitDAOHibernate extends BaseDAOHibernate implements TaskListItemVisitDAO { - private static final String FIND_BY_ITEM_BYSESSION = "from " + TaskListItemVisitLog.class.getName() - + " as r where r.sessionId = ? and r.taskListItem.uid=?"; - - private static final String FIND_TASKS_COMPLETED_COUNT_BY_USER = "select count(*) from " + TaskListItemVisitLog.class.getName() - + " as r where r.complete=true and r.sessionId=? and r.user.userId =?"; + private static final String FIND_BY_ITEM_AND_USER = "from " + TaskListItemVisitLog.class.getName() + + " as r where r.user.userId = ? and r.taskListItem.uid=?"; -// private static final String FIND_SUMMARY = "select v.taskListItem.uid, count(v.taskListItem) from " -// + TaskListItemVisitLog.class.getName() + " as v , " -// + TaskListSession.class.getName() + " as s, " -// + TaskList.class.getName() + " as r " -// +" where v.sessionId = s.sessionId " -// +" and s.taskList.uid = r.uid " -// +" and r.contentId =? " -// +" group by v.sessionId, v.taskListItem.uid "; - - /** - * {@inheritDoc} - */ - public TaskListItemVisitLog getTaskListItemLog(Long itemUid,Long userId){ - List list = getHibernateTemplate().find(FIND_BY_ITEM_AND_USER,new Object[]{userId,itemUid}); - if(list == null || list.size() ==0) - return null; - return (TaskListItemVisitLog) list.get(0); - } + private static final String FIND_BY_ITEM_BYSESSION = "from " + TaskListItemVisitLog.class.getName() + + " as r where r.sessionId = ? and r.taskListItem.uid=?"; - /** - * {@inheritDoc} - */ - public int getTasksCompletedCountByUser(Long toolSessionId ,Long userUid) { - List list = getHibernateTemplate().find(FIND_TASKS_COMPLETED_COUNT_BY_USER, new Object[]{toolSessionId, userUid}); - if(list == null || list.size() ==0) - return 0; - return ((Number) list.get(0)).intValue(); - } + private static final String FIND_COUNT_COMPLETED_TASKS_BY_USER = "select count(*) from " + + TaskListItemVisitLog.class.getName() + + " as r where r.complete=true and r.sessionId=? and r.user.userId =?"; + + private static final String FIND_COUNT_COMPLETED_TASKS_BY_SESSION_AND_ITEM = "select count(*) from " + + TaskListItemVisitLog.class.getName() + + " as r where r.complete=true and r.sessionId=? and r.taskListItem.uid =?"; -// public Map getSummary(Long contentId) { -// -// // Note: Hibernate 3.1 query.uniqueResult() returns Integer, Hibernate 3.2 query.uniqueResult() returns Long -// List result = getHibernateTemplate().find(FIND_SUMMARY,contentId); -// Map summaryList = new HashMap (result.size()); -// for(Object[] list : result){ -// if ( list[1] != null ) { -// summaryList.put((Long)list[0],new Integer(((Number)list[1]).intValue())); -// } -// } -// return summaryList; -// -// } + @Override + public TaskListItemVisitLog getTaskListItemLog(Long itemUid, Long userId) { + List list = getHibernateTemplate().find(FIND_BY_ITEM_AND_USER, new Object[] { userId, itemUid }); + if (list == null || list.size() == 0) + return null; + return (TaskListItemVisitLog) list.get(0); + } - /** - * {@inheritDoc} - */ - public List getTaskListItemLogBySession(Long sessionId, Long itemUid) { - - return getHibernateTemplate().find(FIND_BY_ITEM_BYSESSION,new Object[]{sessionId,itemUid}); - } + @Override + public int getCountCompletedTasksByUser(Long toolSessionId, Long userId) { + List list = getHibernateTemplate().find(FIND_COUNT_COMPLETED_TASKS_BY_USER, + new Object[] { toolSessionId, userId }); + if (list == null || list.size() == 0) + return 0; + return ((Number) list.get(0)).intValue(); + } + + @Override + public int getCountCompletedTasksBySessionAndItem(Long toolSessionId, Long itemUid) { + List list = getHibernateTemplate().find(FIND_COUNT_COMPLETED_TASKS_BY_SESSION_AND_ITEM, + new Object[] { toolSessionId, itemUid }); + if (list == null || list.size() == 0) + return 0; + return ((Number) list.get(0)).intValue(); + } + @Override + public List getTaskListItemLogBySession(Long sessionId, Long itemUid) { + return getHibernateTemplate().find(FIND_BY_ITEM_BYSESSION, new Object[] { sessionId, itemUid }); + } + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListUserDAOHibernate.java =================================================================== diff -u -r0e7e464ded505f35e6ade3811f3f74658668e13a -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListUserDAOHibernate.java (.../TaskListUserDAOHibernate.java) (revision 0e7e464ded505f35e6ade3811f3f74658668e13a) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListUserDAOHibernate.java (.../TaskListUserDAOHibernate.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -23,9 +23,16 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.taskList.dao.hibernate; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; +import org.hibernate.Query; +import org.hibernate.SQLQuery; import org.lamsfoundation.lams.tool.taskList.dao.TaskListUserDAO; +import org.lamsfoundation.lams.tool.taskList.dto.TaskListUserDTO; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; /** @@ -34,37 +41,162 @@ * @author Andrey Balan * @see org.lamsfoundation.lams.tool.taskList.dao.TaskListUserDAO */ -public class TaskListUserDAOHibernate extends BaseDAOHibernate implements TaskListUserDAO{ +public class TaskListUserDAOHibernate extends BaseDAOHibernate implements TaskListUserDAO { + + private static final String FIND_BY_USER_ID_CONTENT_ID = "from " + TaskListUser.class.getName() + + " as u where u.userId =? and u.taskList.contentId=?"; + private static final String FIND_BY_USER_ID_SESSION_ID = "from " + TaskListUser.class.getName() + + " as u where u.userId =? and u.session.sessionId=?"; + private static final String FIND_BY_SESSION_ID = "from " + TaskListUser.class.getName() + + " as u where u.session.sessionId=?"; + + @Override + public TaskListUser getUserByUserIDAndSessionID(Long userID, Long sessionId) { + List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_SESSION_ID, new Object[] { userID, sessionId }); + if (list == null || list.size() == 0) + return null; + return (TaskListUser) list.get(0); + } + + @Override + public TaskListUser getUserByUserIDAndContentID(Long userId, Long contentId) { + List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_CONTENT_ID, new Object[] { userId, contentId }); + if (list == null || list.size() == 0) + return null; + return (TaskListUser) list.get(0); + } + + @Override + public List getBySessionID(Long sessionId) { + return this.getHibernateTemplate().find(FIND_BY_SESSION_ID, sessionId); + } + + @Override + public Collection getPagedUsersBySession(Long sessionId, int page, int size, String sortBy, + String sortOrder, String searchString) { - private static final String FIND_BY_USER_ID_CONTENT_ID = "from " + TaskListUser.class.getName() + " as u where u.userId =? and u.taskList.contentId=?"; - private static final String FIND_BY_USER_ID_SESSION_ID = "from " + TaskListUser.class.getName() + " as u where u.userId =? and u.session.sessionId=?"; - private static final String FIND_BY_SESSION_ID = "from " + TaskListUser.class.getName() + " as u where u.session.sessionId=?"; + String LOAD_USERS = "SELECT user.uid, CONCAT(user.last_name, ' ', user.first_name), user.is_verified_by_monitor, visitLog.taskList_item_uid" + + " FROM tl_latask10_user user" + + " INNER JOIN tl_latask10_session session" + + " ON user.session_uid=session.uid" + + + " LEFT OUTER JOIN tl_latask10_item_log visitLog " + + " ON visitLog.user_uid = user.uid" + + " AND visitLog.complete = 1" + + + " WHERE session.session_id = :sessionId " + + " AND (CONCAT(user.last_name, ' ', user.first_name) LIKE CONCAT('%', :searchString, '%')) " + + " ORDER BY " + + " CASE " + + " WHEN :sortBy='userName' THEN CONCAT(user.last_name, ' ', user.first_name) " + + " WHEN :sortBy='grade' THEN visitLog.complete " + + " END " + sortOrder; - /** - * {@inheritDoc} - */ - public TaskListUser getUserByUserIDAndSessionID(Long userID, Long sessionId) { - List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_SESSION_ID,new Object[]{userID,sessionId}); - if(list == null || list.size() == 0) - return null; - return (TaskListUser) list.get(0); + SQLQuery query = getSession().createSQLQuery(LOAD_USERS); + query.setLong("sessionId", sessionId); + // support for custom search from a toolbar + searchString = searchString == null ? "" : searchString; + query.setString("searchString", searchString); + query.setString("sortBy", sortBy); + query.setFirstResult(page * size); + query.setMaxResults(size); + List list = query.list(); + + //group by userId as long as it returns all completed visitLogs for each user + HashMap userIdToUserDto = new LinkedHashMap(); + if (list != null && list.size() > 0) { + for (Object[] element : list) { + + Long userId = ((Number) element[0]).longValue(); + String fullName = (String) element[1]; + boolean isVerifiedByMonitor = new Boolean(((Byte) element[2]).intValue() == 1); + Long completedTaskUid = element[3] == null ? 0 : ((Number) element[3]).longValue(); + + TaskListUserDTO userDto = (userIdToUserDto.get(userId) == null) ? new TaskListUserDTO() + : userIdToUserDto.get(userId); + userDto.setUserId(userId); + userDto.setFullName(fullName); + userDto.setVerifiedByMonitor(isVerifiedByMonitor); + userDto.getCompletedTaskUids().add(completedTaskUid); + + userIdToUserDto.put(userId, userDto); + } } - /** - * {@inheritDoc} - */ - public TaskListUser getUserByUserIDAndContentID(Long userId, Long contentId) { - List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_CONTENT_ID,new Object[]{userId,contentId}); - if(list == null || list.size() == 0) - return null; - return (TaskListUser) list.get(0); + return userIdToUserDto.values(); + } + + @Override + public Collection getPagedUsersBySessionAndItem(Long sessionId, Long taskListItemUid, int page, int size, String sortBy, + String sortOrder, String searchString) { + + String LOAD_USERS = "SELECT user.user_id, CONCAT(user.last_name, ' ', user.first_name), visitLog.complete" + + " FROM tl_latask10_user user" + + " INNER JOIN tl_latask10_session session" + + " ON user.session_uid=session.uid" + + + " LEFT OUTER JOIN tl_latask10_item_log visitLog " + + " ON visitLog.user_uid = user.uid" + + " AND visitLog.taskList_item_uid = :taskListItemUid" + + + " WHERE session.session_id = :sessionId " + + " AND (CONCAT(user.last_name, ' ', user.first_name) LIKE CONCAT('%', :searchString, '%')) " + + " ORDER BY " + + " CASE " + + " WHEN :sortBy='userName' THEN CONCAT(user.last_name, ' ', user.first_name) " + + " WHEN :sortBy='grade' THEN question_result.mark " + + " END " + sortOrder; + + SQLQuery query = getSession().createSQLQuery(LOAD_USERS); + query.setLong("sessionId", sessionId); + query.setLong("taskListItemUid", taskListItemUid); + // support for custom search from a toolbar + searchString = searchString == null ? "" : searchString; + query.setString("searchString", searchString); + query.setString("sortBy", sortBy); + query.setFirstResult(page * size); + query.setMaxResults(size); + List list = query.list(); + + Collection userDtos = new LinkedList(); + if (list != null && list.size() > 0) { + for (Object[] element : list) { + + Long userId = ((Number) element[0]).longValue(); + String fullName = (String) element[1]; + Integer isCompleted = element[2] == null ? 0 : ((Number) element[2]).intValue(); + + TaskListUserDTO userDto = new TaskListUserDTO(); + userDto.setUserId(userId); + userDto.setFullName(fullName); + userDto.setCompleted(Boolean.parseBoolean(isCompleted.toString())); + + userDtos.add(userDto); + } } - /** - * {@inheritDoc} - */ - public List getBySessionID(Long sessionId) { - return this.getHibernateTemplate().find(FIND_BY_SESSION_ID,sessionId); + return userDtos; + } + + @Override + public int getCountPagedUsersBySession(Long sessionId, String searchString) { + + String LOAD_USERS_ORDERED_BY_NAME = "SELECT COUNT(*) FROM " + TaskListUser.class.getName() + " user" + + " WHERE user.session.sessionId = :sessionId " + + " AND (CONCAT(user.lastName, ' ', user.firstName) LIKE CONCAT('%', :searchString, '%')) "; + + Query query = getSession().createQuery(LOAD_USERS_ORDERED_BY_NAME); + query.setLong("sessionId", sessionId); + // support for custom search from a toolbar + searchString = searchString == null ? "" : searchString; + query.setString("searchString", searchString); + List list = query.list(); + + if ((list == null) || (list.size() == 0)) { + return 0; + } else { + return ((Number) list.get(0)).intValue(); } - + } + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java =================================================================== diff -u -r5d4c7c430b9dd0fc2247d9e5fa5babbac5fb4571 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java (.../ReflectDTO.java) (revision 5d4c7c430b9dd0fc2247d9e5fa5babbac5fb4571) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/ReflectDTO.java (.../ReflectDTO.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -1,5 +1,7 @@ package org.lamsfoundation.lams.tool.taskList.dto; +import java.util.Date; + import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; /** @@ -8,60 +10,82 @@ * @author Dapeng Ni */ public class ReflectDTO { - private Long userUid; - private String fullName; - private String loginName; - private boolean hasRefection; - private String reflectInstrctions; - private boolean finishReflection; - private String reflect; - - public ReflectDTO(TaskListUser user) { - this.setLoginName(user.getLoginName()); - this.setFullName(user.getFirstName()+" "+user.getLastName()); - this.setUserUid(user.getUid()); - } - - public boolean isFinishReflection() { - return finishReflection; - } - public void setFinishReflection(boolean finishReflection) { - this.finishReflection = finishReflection; - } - public String getFullName() { - return fullName; - } - public void setFullName(String fullName) { - this.fullName = fullName; - } - public boolean isHasRefection() { - return hasRefection; - } - public void setHasRefection(boolean hasRefection) { - this.hasRefection = hasRefection; - } - public String getLoginName() { - return loginName; - } - public void setLoginName(String loginName) { - this.loginName = loginName; - } - public String getReflect() { - return reflect; - } - public void setReflect(String reflect) { - this.reflect = reflect; - } - public String getReflectInstrctions() { - return reflectInstrctions; - } - public void setReflectInstructions(String reflectInstrctions) { - this.reflectInstrctions = reflectInstrctions; - } - public Long getUserUid() { - return userUid; - } - public void setUserUid(Long userUid) { - this.userUid = userUid; - } + private Long userUid; + private String fullName; + private String loginName; + private boolean hasRefection; + private String reflectInstrctions; + private boolean finishReflection; + private String reflect; + private Date date; + + public ReflectDTO(TaskListUser user) { + this.setLoginName(user.getLoginName()); + this.setFullName(user.getFirstName() + " " + user.getLastName()); + this.setUserUid(user.getUid()); + } + + public boolean isFinishReflection() { + return finishReflection; + } + + public void setFinishReflection(boolean finishReflection) { + this.finishReflection = finishReflection; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public boolean isHasRefection() { + return hasRefection; + } + + public void setHasRefection(boolean hasRefection) { + this.hasRefection = hasRefection; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getReflect() { + return reflect; + } + + public void setReflect(String reflect) { + this.reflect = reflect; + } + + public String getReflectInstrctions() { + return reflectInstrctions; + } + + public void setReflectInstructions(String reflectInstrctions) { + this.reflectInstrctions = reflectInstrctions; + } + + public Long getUserUid() { + return userUid; + } + + public void setUserUid(Long userUid) { + this.userUid = userUid; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/SessionDTO.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/SessionDTO.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/SessionDTO.java (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -0,0 +1,96 @@ +/**************************************************************** + * 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.0 + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.taskList.dto; + +import java.util.List; + +import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; +import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; + +/** + * List contains following element:
+ * + *
  • session_id
  • + *
  • isMonitorVerificationRequired
  • + *
  • taskListItems
  • + *
  • visitNumbers
  • + * + * @author Andrey Balan + */ +public class SessionDTO { + + private Long sessionId; + private String sessionName; + + private List taskListItems; + + private int[] visitNumbers; + + public SessionDTO() { + } + + /** + * Contruction method for monitoring summary function. + */ + public SessionDTO(Long sessionId, String sessionName, List taskListItems, int[] visitNumbers) { + this.sessionId = sessionId; + this.sessionName = sessionName; + this.taskListItems = taskListItems; + this.visitNumbers = visitNumbers; + } + + public Long getSessionId() { + return sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + + public String getSessionName() { + return sessionName; + } + + public void setSessionName(String sessionName) { + this.sessionName = sessionName; + } + + public List getTaskListItems() { + return taskListItems; + } + + public void setTaskListItems(List taskListItems) { + this.taskListItems = taskListItems; + } + + public int[] getVisitNumbers() { + return visitNumbers; + } + + public void setVisitNumbers(int[] visitNumbers) { + this.visitNumbers = visitNumbers; + } + +} Fisheye: Tag 091abac9dddc7312350403cbd0fec84bd38380c8 refers to a dead (removed) revision in file `lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/Summary.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TaskListUserDTO.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TaskListUserDTO.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dto/TaskListUserDTO.java (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -0,0 +1,49 @@ +package org.lamsfoundation.lams.tool.taskList.dto; + +import java.util.LinkedHashSet; +import java.util.Set; + +public class TaskListUserDTO { + private Long userId; + private String fullName; + private boolean verifiedByMonitor; + + private Set completedTaskUids = new LinkedHashSet(); + private boolean completed; + + public Long getUserId() { + return userId; + } + public void setUserId(Long userID) { + this.userId = userID; + } + + public String getFullName() { + return fullName; + } + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public boolean isVerifiedByMonitor() { + return verifiedByMonitor; + } + public void setVerifiedByMonitor(boolean verifiedByMonitor) { + this.verifiedByMonitor = verifiedByMonitor; + } + + public Set getCompletedTaskUids() { + return completedTaskUids; + } + public void setCompletedTaskUids(Set completedTaskUids) { + this.completedTaskUids = completedTaskUids; + } + + public boolean isCompleted() { + return completed; + } + public void setCompleted(boolean completed) { + this.completed = completed; + } + +} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemVisitLog.java =================================================================== diff -u -r9bd21433617c6dbccfacfb09752344c640570966 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemVisitLog.java (.../TaskListItemVisitLog.java) (revision 9bd21433617c6dbccfacfb09752344c640570966) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemVisitLog.java (.../TaskListItemVisitLog.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -25,87 +25,93 @@ package org.lamsfoundation.lams.tool.taskList.model; import java.util.Date; + /** * TaskList - * @author Dapeng Ni + * + * @author Andrey Balan * - * @hibernate.class table="tl_latask10_item_log" - * + * @hibernate.class table="tl_latask10_item_log" */ public class TaskListItemVisitLog { - private Long uid; - private TaskListUser user; - private TaskListItem taskListItem; - private boolean complete; - private Date accessDate; - private Long sessionId; - - /** - * @hibernate.property column="access_date" - * @return - */ - public Date getAccessDate() { - return accessDate; - } - public void setAccessDate(Date accessDate) { - this.accessDate = accessDate; - } - /** - * @hibernate.many-to-one column="taskList_item_uid" - * cascade="none" - * @return - */ - public TaskListItem getTaskListItem() { - return taskListItem; - } - public void setTaskListItem(TaskListItem item) { - this.taskListItem = item; - } - - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * @return Returns the log Uid. - */ - public Long getUid() { - return uid; - } - public void setUid(Long uid) { - this.uid = uid; - } - /** - * @hibernate.many-to-one column="user_uid" - * cascade="save-update" - * @return - */ - public TaskListUser getUser() { - return user; - } - public void setUser(TaskListUser user) { - this.user = user; - } - /** - * @hibernate.property column="complete" - * @return - */ - public boolean isComplete() { - return complete; - } - public void setComplete(boolean complete) { - this.complete = complete; - } - /** - * @hibernate.property column="session_id" - * @return - */ - public Long getSessionId() { - return sessionId; - } - public void setSessionId(Long sessionId) { - this.sessionId = sessionId; - } + private Long uid; + private TaskListUser user; + private TaskListItem taskListItem; + private boolean complete; + private Date accessDate; + private Long sessionId; + /** + * @hibernate.property column="access_date" + * @return + */ + public Date getAccessDate() { + return accessDate; + } - - + public void setAccessDate(Date accessDate) { + this.accessDate = accessDate; + } + + /** + * @hibernate.many-to-one column="taskList_item_uid" cascade="none" + * @return + */ + public TaskListItem getTaskListItem() { + return taskListItem; + } + + public void setTaskListItem(TaskListItem item) { + this.taskListItem = item; + } + + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the log Uid. + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.many-to-one column="user_uid" cascade="save-update" + * @return + */ + public TaskListUser getUser() { + return user; + } + + public void setUser(TaskListUser user) { + this.user = user; + } + + /** + * @hibernate.property column="complete" + * @return + */ + public boolean isComplete() { + return complete; + } + + public void setComplete(boolean complete) { + this.complete = complete; + } + + /** + * @hibernate.property column="session_id" + * @return + */ + public Long getSessionId() { + return sessionId; + } + + public void setSessionId(Long sessionId) { + this.sessionId = sessionId; + } + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java =================================================================== diff -u -r8b97231e320c0c5b674f07c14da711f232ba9e1c -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision 8b97231e320c0c5b674f07c14da711f232ba9e1c) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -23,13 +23,16 @@ /* $$Id$$ */ package org.lamsfoundation.lams.tool.taskList.service; +import java.util.Collection; import java.util.List; import java.util.Set; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.taskList.dto.ItemSummary; -import org.lamsfoundation.lams.tool.taskList.dto.Summary; +import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO; +import org.lamsfoundation.lams.tool.taskList.dto.SessionDTO; +import org.lamsfoundation.lams.tool.taskList.dto.TaskListUserDTO; import org.lamsfoundation.lams.tool.taskList.model.TaskList; import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; import org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment; @@ -44,292 +47,350 @@ * @author Andrey Balan */ public interface ITaskListService { - - - /** - * Returns number of tasks completed by user. Used in TaskListOutputFactory. - * - * @param toolSessionId - * @param userUid - * @return - */ - int getNumTasksCompletedByUser(Long toolSessionId, Long userUid); - - /** - * Checks current condition for matching. This condition belongs to the - * taskList from this particular toolSession.Used in - * TaskListOutputFactory. - * - * @param conditionName name of a condition - * @param toolSessionId session Id contains particular taskList - * @param userUid user for whom this condition is being checked - * @return - */ - boolean checkCondition(String conditionName, Long toolSessionId, Long userUid); - - /** - * Get TaskList by toolContentID. - * - * @param contentId - * @return - */ - TaskList getTaskListByContentId(Long contentId); - - /** - * Get a cloned copy of tool default tool content (TaskList) and assign the toolContentId of that copy as the - * given contentId - * - * @param contentId - * @return - * @throws TaskListException - */ - TaskList getDefaultContent(Long contentId) throws TaskListException; - - /** - * Get list of taskList items by given taskListUid. These taskList items must be created by author. - * - * @param taskListUid - * @return - */ - List getAuthoredItems(Long taskListUid); - - - /** - * Upload tasklistItem file to repository. - * - * @param uploadFile - * @param userLogin - * @return - * @throws UploadTaskListFileException - */ - TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, TaskListUser user) throws UploadTaskListFileException; - - /** - * Returns Message service. It makes available to have access to message resources files. - * - * @return MessageService - */ - MessageService getMessageService(); - - //********** for user methods ************* - /** - * Create a new user in database. - */ - void createUser(TaskListUser taskListUser); - - /** - * Get user by given userID and toolContentID. - * - * @param long1 - * @return - */ - TaskListUser getUserByIDAndContent(Long userID, Long contentId); + /** + * Returns number of tasks completed by user. Used in TaskListOutputFactory. + * + * @param toolSessionId + * @param userUid + * @return + */ + int getNumTasksCompletedByUser(Long toolSessionId, Long userUid); - /** - * Get user by sessionID and UserID - * - * @param long1 - * @param sessionId - * @return - */ - TaskListUser getUserByIDAndSession(Long long1, Long sessionId); - - /** - * Get user list by sessionId and itemUid - * - * @param sessionId - * @param uid - * @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); + /** + * Checks current condition for matching. This condition belongs to the taskList from this particular + * toolSession.Used in TaskListOutputFactory. + * + * @param conditionName + * name of a condition + * @param toolSessionId + * session Id contains particular taskList + * @param userUid + * user for whom this condition is being checked + * @return + */ + boolean checkCondition(String conditionName, Long toolSessionId, Long userUid); - /** - * Get user by UID - * - * @param uid - * @return - */ - TaskListUser getUser(Long uid); + /** + * Get TaskList by toolContentID. + * + * @param contentId + * @return + */ + TaskList getTaskListByContentId(Long contentId); - //********** Repository methods *********************** + /** + * Get a cloned copy of tool default tool content (TaskList) and assign the toolContentId of that copy as the given + * contentId + * + * @param contentId + * @return + * @throws TaskListException + */ + TaskList getDefaultContent(Long contentId) throws TaskListException; - /** - * Save or update taskList into database. - * - * @param TaskList - */ - void saveOrUpdateTaskList(TaskList TaskList); - - /** - * Delete resoruce item from database. - * - * @param uid - */ - void deleteTaskListItem(Long uid); - - /** - * Delete tasklist condition from the database. - * - * @param uid - */ - void deleteTaskListCondition(Long uid); - - /** - * Get taskList which is relative with the special toolSession. - * - * @param sessionId - * @return - */ - TaskList getTaskListBySessionId(Long sessionId); - - /** - * Get taskList with the specified itemUid. - * - * @param itemUid - * @return - */ - TaskListItem getTaskListItemByUid(Long itemUid); - - /** - * Save/update current TaskListItem. - * - * @param item current TaskListItem - * @return - */ - void saveOrUpdateTaskListItem(TaskListItem item); - - /** - * Fill in taskListItemList's complete flags. - * - * @param taskListItemList - * @param user - */ - void retrieveComplete(Set taskListItemList, TaskListUser user); - - /** - * Mark taskListItem as completed. - * - * @param taskListItemUid - * @param userId - * @param sessionId - */ - void setItemComplete(Long taskListItemUid, Long userId , Long sessionId); - - - /** - * Creates a new TaskListItemVisitLog describing access to specifeid taskListItem. - * - * @param taskListItemUid Uid of the specified taskListItem - * @param userId Id of a user who accessed this taskListItem - * @param sessionId id of a session during which it occured - */ - void setItemAccess(Long taskListItemUid, Long userId, Long sessionId); - - /** - * Get taskList toolSession by toolSessionId - * - * @param sessionId - * @return - */ - TaskListSession getTaskListSessionBySessionId(Long sessionId); + /** + * Get list of taskList items by given taskListUid. These taskList items must be created by author. + * + * @param taskListUid + * @return + */ + List getAuthoredItems(Long taskListUid); - /** - * Save or update taskList session. - * - * @param resSession - */ - void saveOrUpdateTaskListSession(TaskListSession resSession); - - /** - * If success return next activity's url, otherwise return null. - * - * @param toolSessionId - * @param userId - * @return - */ - String finishToolSession(Long toolSessionId, Long userId) throws TaskListException; - - /** - * Create refection entry into notebook tool. - * - * @param sessionId - * @param notebook_tool - * @param tool_signature - * @param userId - * @param entryText - */ - Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, String entryText); - - /** - * Get reflection entry from notebook tool. - * - * @param sessionId - * @param idType - * @param signature - * @param userID - * @return - */ - NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID); + /** + * Upload tasklistItem file to repository. + * + * @param uploadFile + * @param userLogin + * @return + * @throws UploadTaskListFileException + */ + TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, TaskListUser user) + throws UploadTaskListFileException; - /** - * @param notebookEntry - */ - void updateEntry(NotebookEntry notebookEntry); - - //********** Export methods *********************** - - /** - * Make an export for the specified learner. - * - * @param sessionId - * @param learner user which portfolio is being exported - * - * @return - */ - List exportForLearner(Long contentUid, TaskListUser learner); - - /** - * Make an export for the whole TaskList. - * - * @param contentUid - * @return - */ - List exportForTeacher(Long contentUid); - - /** - * Return summary list for the specified TaskList. Used in monitoring. - * - * @param contentId specified TaskList uid - * @return - */ - List getSummary(Long contentId); - - /** - * Return task summary for the specified TaskListItem. Used in monitoring. - * - * @param contentId toolContenId - * @param taskListItemUid specified TaskListItem uid - * @param isExportProcessing true if this method called for export, false otherwise - * @return - */ - ItemSummary getItemSummary(Long contentId, Long taskListItemUid, boolean isExportProcessing); - - /** - * Returns whether activity is grouped and therefore it is expected more than one tool session. - * - * @param toolContentID - * @return - */ - boolean isGroupedActivity(long toolContentID); - -} + /** + * Returns Message service. It makes available to have access to message resources files. + * + * @return MessageService + */ + MessageService getMessageService(); + // ********** for user methods ************* + /** + * Create a new user in database. + */ + void createUser(TaskListUser taskListUser); + + /** + * Get user by given userID and toolContentID. + * + * @param long1 + * @return + */ + TaskListUser getUserByIDAndContent(Long userID, Long contentId); + + /** + * Get user by sessionID and UserID + * + * @param long1 + * @param sessionId + * @return + */ + TaskListUser getUserByIDAndSession(Long long1, Long sessionId); + + /** + * Get user list by sessionId and itemUid + * + * @param sessionId + * @param uid + * @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 + * + * @param uid + * @return + */ + TaskListUser getUser(Long uid); + + // ********** Repository methods *********************** + + /** + * Save or update taskList into database. + * + * @param TaskList + */ + void saveOrUpdateTaskList(TaskList TaskList); + + /** + * Delete resoruce item from database. + * + * @param uid + */ + void deleteTaskListItem(Long uid); + + /** + * Delete tasklist condition from the database. + * + * @param uid + */ + void deleteTaskListCondition(Long uid); + + /** + * Get taskList which is relative with the special toolSession. + * + * @param sessionId + * @return + */ + TaskList getTaskListBySessionId(Long sessionId); + + /** + * Get taskList with the specified itemUid. + * + * @param itemUid + * @return + */ + TaskListItem getTaskListItemByUid(Long itemUid); + + /** + * Save/update current TaskListItem. + * + * @param item + * current TaskListItem + * @return + */ + void saveOrUpdateTaskListItem(TaskListItem item); + + /** + * Fill in taskListItemList's complete flags. + * + * @param taskListItemList + * @param user + */ + void retrieveComplete(Set taskListItemList, TaskListUser user); + + /** + * Mark taskListItem as completed. + * + * @param taskListItemUid + * @param userId + * @param sessionId + */ + void setItemComplete(Long taskListItemUid, Long userId, Long sessionId); + + /** + * Creates a new TaskListItemVisitLog describing access to specifeid taskListItem. + * + * @param taskListItemUid + * Uid of the specified taskListItem + * @param userId + * Id of a user who accessed this taskListItem + * @param sessionId + * id of a session during which it occured + */ + void setItemAccess(Long taskListItemUid, Long userId, Long sessionId); + + /** + * Get taskList toolSession by toolSessionId + * + * @param sessionId + * @return + */ + TaskListSession getTaskListSessionBySessionId(Long sessionId); + + /** + * Save or update taskList session. + * + * @param resSession + */ + void saveOrUpdateTaskListSession(TaskListSession resSession); + + /** + * If success return next activity's url, otherwise return null. + * + * @param toolSessionId + * @param userId + * @return + */ + String finishToolSession(Long toolSessionId, Long userId) throws TaskListException; + + /** + * Create refection entry into notebook tool. + * + * @param sessionId + * @param notebook_tool + * @param tool_signature + * @param userId + * @param entryText + */ + Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, + String entryText); + + /** + * Get reflection entry from notebook tool. + * + * @param sessionId + * @param idType + * @param signature + * @param userID + * @return + */ + NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID); + + /** + * @param notebookEntry + */ + void updateEntry(NotebookEntry notebookEntry); + + // ********** Export methods *********************** + + /** + * Make an export for the specified learner. + * + * @param sessionId + * @param learner + * user which portfolio is being exported + * + * @return + */ + List exportForLearner(Long contentUid, TaskListUser learner); + + /** + * Make an export for the whole TaskList. + * + * @param contentUid + * @return + */ + List exportForTeacher(Long contentUid); + + /** + * Returns paged users for jqGrid based on sessionId. + * + * @param sessionId + * @param page + * @param size + * @param sortBy + * @param sortOrder + * @param searchString + * @return + */ + Collection getPagedUsersBySession(Long sessionId, int page, int size, String sortBy, + String sortOrder, String searchString); + + /** + * Returns paged users for jqGrid based on sessionId and taskListItemUid. + * + * @param sessionId + * @param taskListItemUid + * @param page + * @param size + * @param sortBy + * @param sortOrder + * @param searchString + * @return + */ + Collection getPagedUsersBySessionAndItem(Long sessionId, Long taskListItemUid, int page, int size, String sortBy, + String sortOrder, String searchString); + + /** + * Returns total number of users in a specified session. + * + * @param sessionId + * @param searchString + * @return + */ + int getCountPagedUsersBySession(Long sessionId, String searchString); + + /** + * Return summary list for the specified TaskList. Used in monitoring. + * + * @param contentId + * specified TaskList uid + * @return + */ + List getSummary(Long contentId); + + /** + * Return task summary for the specified TaskListItem. Used in monitoring. + * + * @param contentId + * toolContenId + * @param taskListItemUid + * specified TaskListItem uid + * @param isExportProcessing + * true if this method called for export, false otherwise + * @return + */ + ItemSummary getItemSummary(Long contentId, Long taskListItemUid, boolean isExportProcessing); + + NotebookEntry getEntry(Long sessionId, Integer userId); + + List getReflectList(Long contentId); + + /** + * Returns whether activity is grouped and therefore it is expected more than one tool session. + * + * @param toolContentID + * @return + */ + boolean isGroupedActivity(long toolContentID); + + /** + * Get localized message. + * + * @param key + * @return + */ + String getMessage(String key); + +} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== diff -u -r9aad33f52b06632e7a8ed3705a7708338bcc00f8 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 9aad33f52b06632e7a8ed3705a7708338bcc00f8) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -27,9 +27,11 @@ import java.io.IOException; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; import java.util.Date; import java.util.Hashtable; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.SortedMap; @@ -68,8 +70,9 @@ import org.lamsfoundation.lams.tool.taskList.dto.GroupSummary; import org.lamsfoundation.lams.tool.taskList.dto.ItemSummary; import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO; -import org.lamsfoundation.lams.tool.taskList.dto.Summary; +import org.lamsfoundation.lams.tool.taskList.dto.SessionDTO; import org.lamsfoundation.lams.tool.taskList.dto.TaskListItemVisitLogSummary; +import org.lamsfoundation.lams.tool.taskList.dto.TaskListUserDTO; import org.lamsfoundation.lams.tool.taskList.model.TaskList; import org.lamsfoundation.lams.tool.taskList.model.TaskListCondition; import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; @@ -87,7 +90,6 @@ /** * Class implements org.lamsfoundation.lams.tool.taskList.service.ITaskListService. * - * @author Dapeng.Ni * @author Andrey Balan * @see org.lamsfoundation.lams.tool.taskList.service.ITaskListService */ @@ -293,48 +295,48 @@ } } } + + @Override + public Collection getPagedUsersBySession(Long sessionId, int page, int size, String sortBy, + String sortOrder, String searchString) { + return taskListUserDao.getPagedUsersBySession(sessionId, page, size, sortBy, sortOrder, searchString); + } + + @Override + public Collection getPagedUsersBySessionAndItem(Long sessionId, Long taskListItemUid, int page, int size, String sortBy, + String sortOrder, String searchString) { + return taskListUserDao.getPagedUsersBySessionAndItem(sessionId, taskListItemUid, page, size, sortBy, sortOrder, searchString); + } @Override - public List getSummary(Long contentId) { + public int getCountPagedUsersBySession(Long sessionId, String searchString) { + return taskListUserDao.getCountPagedUsersBySession(sessionId, searchString); + } - TaskList taskList = taskListDao.getByContentId(contentId); + @Override + public List getSummary(Long contentId) { + List sessionList = taskListSessionDao.getByContentId(contentId); - List summaryList = new ArrayList(); + List summaryList = new ArrayList(); // create the user list of all whom were started this task for (TaskListSession session : sessionList) { + Long toolSessionId = session.getSessionId(); - List itemList = getItemListForGroup(contentId, session.getSessionId()); + List itemList = getItemListForGroup(contentId, toolSessionId); + List userList = taskListUserDao.getBySessionID(toolSessionId); - List userList = taskListUserDao.getBySessionID(session.getSessionId()); - - // Fill up the copmletion table - boolean[][] complete = new boolean[userList.size()][itemList.size()]; // Fill up the array of visitNumbers int[] visitNumbers = new int[itemList.size()]; - for (int i = 0; i < userList.size(); i++) { - TaskListUser user = userList.get(i); + for (int j = 0; j < itemList.size(); j++) { + TaskListItem item = itemList.get(j); - for (int j = 0; j < itemList.size(); j++) { - TaskListItem item = itemList.get(j); - - // retreiving TaskListItemVisitLog for current taskList and user - TaskListItemVisitLog visitLog = taskListItemVisitDao.getTaskListItemLog(item.getUid(), - user.getUserId()); - if (visitLog != null) { - complete[i][j] = visitLog.isComplete(); - if (visitLog.isComplete()) { - visitNumbers[j]++; - } - } else { - complete[i][j] = false; - } - } + // retreiving TaskListItemVisitLog for current taskList and user + visitNumbers[j] = taskListItemVisitDao.getCountCompletedTasksBySessionAndItem(toolSessionId, item.getUid()); } - Summary summary = new Summary(session.getSessionName(), itemList, userList, complete, visitNumbers, - taskList.isMonitorVerificationRequired()); + SessionDTO summary = new SessionDTO(toolSessionId, session.getSessionName(), itemList, visitNumbers); summaryList.add(summary); } @@ -424,7 +426,45 @@ return itemSummary; } + + @Override + public NotebookEntry getEntry(Long sessionId, Integer userId) { + List list = coreNotebookService.getEntry(sessionId, CoreNotebookConstants.NOTEBOOK_TOOL, + TaskListConstants.TOOL_SIGNATURE, userId); + if ((list == null) || list.isEmpty()) { + return null; + } else { + return list.get(0); + } + } + + @Override + public List getReflectList(Long contentId) { + List reflectList = new LinkedList(); + List sessionList = taskListSessionDao.getByContentId(contentId); + for (TaskListSession session : sessionList) { + Long sessionId = session.getSessionId(); + // get all users in this session + List users = taskListUserDao.getBySessionID(sessionId); + for (TaskListUser user : users) { + + NotebookEntry entry = getEntry(sessionId, user.getUserId().intValue()); + if (entry != null) { + ReflectDTO ref = new ReflectDTO(user); + ref.setReflect(entry.getEntry()); + Date postedDate = (entry.getLastModified() != null) ? entry.getLastModified() + : entry.getCreateDate(); + ref.setDate(postedDate); + reflectList.add(ref); + } + + } + } + + return reflectList; + } + @Override public List exportForTeacher(Long contentId) { TaskList taskList = taskListDao.getByContentId(contentId); @@ -487,8 +527,8 @@ } @Override - public int getNumTasksCompletedByUser(Long toolSessionId, Long userUid) { - return getTaskListItemVisitDao().getTasksCompletedCountByUser(toolSessionId, userUid); + public int getNumTasksCompletedByUser(Long toolSessionId, Long userId) { + return getTaskListItemVisitDao().getCountCompletedTasksByUser(toolSessionId, userId); } @Override @@ -571,6 +611,11 @@ public boolean isGroupedActivity(long toolContentID) { return toolService.isGroupedActivity(toolContentID); } + + @Override + public String getMessage(String key) { + return messageService.getMessage(key); + } // ***************************************************************************** // Set methods for Spring Bean Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java =================================================================== diff -u -r883c4cc054a636dc8017da1b244b89bdaf0ff974 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision 883c4cc054a636dc8017da1b244b89bdaf0ff974) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -350,7 +350,7 @@ } - sessionMap.put(TaskListConstants.ATTR_RESOURCE, taskList); + sessionMap.put(TaskListConstants.ATTR_TASKLIST, taskList); return mapping.findForward(TaskListConstants.SUCCESS); } @@ -481,7 +481,7 @@ item.setCreateBy(taskListUser); // setting SequenceId - TaskList taskList = (TaskList) sessionMap.get(TaskListConstants.ATTR_RESOURCE); + TaskList taskList = (TaskList) sessionMap.get(TaskListConstants.ATTR_TASKLIST); Set taskListItems = taskList.getTaskListItems(); int maxSeq = 0; for (TaskListItem dbItem : taskListItems) { Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java =================================================================== diff -u -r8b97231e320c0c5b674f07c14da711f232ba9e1c -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 8b97231e320c0c5b674f07c14da711f232ba9e1c) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/MonitoringAction.java (.../MonitoringAction.java) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -25,32 +25,39 @@ package org.lamsfoundation.lams.tool.taskList.web.action; import java.io.IOException; +import java.io.PrintWriter; +import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Set; import java.util.TimeZone; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.commons.lang.StringEscapeUtils; import org.apache.log4j.Logger; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionRedirect; -import org.lamsfoundation.lams.notebook.model.NotebookEntry; -import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.apache.tomcat.util.json.JSONArray; +import org.apache.tomcat.util.json.JSONException; +import org.apache.tomcat.util.json.JSONObject; import org.lamsfoundation.lams.tool.taskList.TaskListConstants; import org.lamsfoundation.lams.tool.taskList.dto.ItemSummary; import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO; -import org.lamsfoundation.lams.tool.taskList.dto.Summary; +import org.lamsfoundation.lams.tool.taskList.dto.SessionDTO; +import org.lamsfoundation.lams.tool.taskList.dto.TaskListUserDTO; import org.lamsfoundation.lams.tool.taskList.model.TaskList; -import org.lamsfoundation.lams.tool.taskList.model.TaskListSession; +import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; import org.lamsfoundation.lams.tool.taskList.service.ITaskListService; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; @@ -60,148 +67,286 @@ import org.springframework.web.context.support.WebApplicationContextUtils; public class MonitoringAction extends Action { - public static Logger log = Logger.getLogger(MonitoringAction.class); - - public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - String param = mapping.getParameter(); + public static Logger log = Logger.getLogger(MonitoringAction.class); - if (param.equals("summary")) { - return summary(mapping, form, request, response); - } - if (param.equals("itemSummary")) { - return itemSummary(mapping, form, request, response); - } - if(param.equals("setVerifiedByMonitor")){ - return setVerifiedByMonitor(mapping, form, request, response); - } - if (param.equals("listuser")) { - return listuser(mapping, form, request, response); - } - if (param.equals("viewReflection")) { - return viewReflection(mapping, form, request, response); - } + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException, JSONException { + String param = mapping.getParameter(); - if (param.equals("setSubmissionDeadline")) { - return setSubmissionDeadline(mapping, form, request, response); - } + if (param.equals("summary")) { + return summary(mapping, form, request, response); + } + if (param.equals("itemSummary")) { + return itemSummary(mapping, form, request, response); + } + if (param.equals("getPagedUsers")) { + return getPagedUsers(mapping, form, request, response); + } + if (param.equals("getPagedUsersByItem")) { + return getPagedUsersByItem(mapping, form, request, response); + } + if (param.equals("setVerifiedByMonitor")) { + return setVerifiedByMonitor(mapping, form, request, response); + } - return mapping.findForward(TaskListConstants.ERROR); + if (param.equals("setSubmissionDeadline")) { + return setSubmissionDeadline(mapping, form, request, response); } - private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - - //initial Session Map - SessionMap sessionMap = new SessionMap(); - request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - - request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); - request.setAttribute("initialTabId",WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB,true)); - Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); - request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, contentId); + return mapping.findForward(TaskListConstants.ERROR); + } - ITaskListService service = getTaskListService(); - TaskList taskList = service.getTaskListByContentId(contentId); - - List summaryList = service.getSummary(contentId); - - //cache into sessionMap - sessionMap.put(TaskListConstants.ATTR_SUMMARY_LIST, summaryList); - sessionMap.put(TaskListConstants.PAGE_EDITABLE, taskList.isContentInUse()); - sessionMap.put(TaskListConstants.ATTR_RESOURCE, taskList); - sessionMap.put(TaskListConstants.ATTR_TOOL_CONTENT_ID, contentId); - sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID,WebUtil.readStrParam(request,AttributeNames.PARAM_CONTENT_FOLDER_ID)); + private ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { - if (taskList.getSubmissionDeadline() != null) { - Date submissionDeadline = taskList.getSubmissionDeadline(); - HttpSession ss = SessionManager.getSession(); - UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); - TimeZone teacherTimeZone = teacher.getTimeZone(); - Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(teacherTimeZone, submissionDeadline); - sessionMap.put(TaskListConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); - - } - - return mapping.findForward(TaskListConstants.SUCCESS); + // initial Session Map + SessionMap sessionMap = new SessionMap(); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + + request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + request.setAttribute("initialTabId", WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_TAB, true)); + Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, contentId); + + ITaskListService service = getTaskListService(); + TaskList taskList = service.getTaskListByContentId(contentId); + + List sessionDtos = service.getSummary(contentId); + + // cache into sessionMap + sessionMap.put(TaskListConstants.ATTR_SESSION_DTOS, sessionDtos); + sessionMap.put(TaskListConstants.ATTR_MONITOR_VERIFICATION_REQUIRED, taskList.isMonitorVerificationRequired()); + sessionMap.put(TaskListConstants.PAGE_EDITABLE, taskList.isContentInUse()); + sessionMap.put(TaskListConstants.ATTR_TASKLIST, taskList); + sessionMap.put(TaskListConstants.ATTR_TOOL_CONTENT_ID, contentId); + sessionMap.put(AttributeNames.PARAM_CONTENT_FOLDER_ID, + WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID)); + + if (taskList.getSubmissionDeadline() != null) { + Date submissionDeadline = taskList.getSubmissionDeadline(); + HttpSession ss = SessionManager.getSession(); + UserDTO teacher = (UserDTO) ss.getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + Date tzSubmissionDeadline = DateUtil.convertToTimeZoneFromDefault(teacherTimeZone, submissionDeadline); + sessionMap.put(TaskListConstants.ATTR_SUBMISSION_DEADLINE, tzSubmissionDeadline.getTime()); } - private ActionForward itemSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - ITaskListService service = getTaskListService(); - - Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); - Long taskListItemId = WebUtil.readLongParam(request, TaskListConstants.ATTR_TASK_LIST_ITEM_UID); - ItemSummary ItemSummary = service.getItemSummary(contentId, taskListItemId, false); - - request.setAttribute(TaskListConstants.ATTR_ITEM_SUMMARY, ItemSummary); - request.setAttribute(TaskListConstants.ATTR_IS_GROUPED_ACTIVITY, service.isGroupedActivity(contentId)); - return mapping.findForward(TaskListConstants.SUCCESS); + // Create reflectList if reflection is enabled. + if (taskList.isReflectOnActivity()) { + List reflectList = service.getReflectList(taskList.getContentId()); + // Add reflectList to sessionMap + sessionMap.put(TaskListConstants.ATTR_REFLECT_LIST, reflectList); } - - /** - * Mark taskList item as complete status. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward setVerifiedByMonitor(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - Long uid = WebUtil.readLongParam(request, TaskListConstants.ATTR_USER_UID); - ITaskListService service = getTaskListService(); - TaskListUser user = service.getUser(uid); - user.setVerifiedByMonitor(true); - service.createUser(user); + return mapping.findForward(TaskListConstants.SUCCESS); + } - Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); - String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - - ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig(TaskListConstants.SUCCESS)); - redirect.addParameter(AttributeNames.PARAM_TOOL_CONTENT_ID, contentId); - redirect.addParameter(AttributeNames.PARAM_CONTENT_FOLDER_ID, contentFolderID); - return redirect; + private ActionForward itemSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) { + ITaskListService service = getTaskListService(); + + Long contentId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + Long taskListItemId = WebUtil.readLongParam(request, TaskListConstants.ATTR_TASK_LIST_ITEM_UID); + ItemSummary ItemSummary = service.getItemSummary(contentId, taskListItemId, false); + + request.setAttribute(TaskListConstants.ATTR_ITEM_SUMMARY, ItemSummary); + request.setAttribute(TaskListConstants.ATTR_IS_GROUPED_ACTIVITY, service.isGroupedActivity(contentId)); + return mapping.findForward(TaskListConstants.SUCCESS); + } + + /** + * Refreshes user list. + */ + public ActionForward getPagedUsers(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse res) throws IOException, ServletException, JSONException { + ITaskListService service = getTaskListService(); + String serverUrl = Configuration.get(ConfigurationKeys.SERVER_URL) + "/tool/" + TaskListConstants.TOOL_SIGNATURE + "/"; + + String sessionMapID = request.getParameter(TaskListConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapID); + TaskList tasklist = (TaskList) sessionMap.get(TaskListConstants.ATTR_TASKLIST); + Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + List sessionDtos = (List) sessionMap.get(TaskListConstants.ATTR_SESSION_DTOS); + + //find according sessionDto + SessionDTO sessionDto = null; + for (SessionDTO sessionDtoIter : sessionDtos) { + if (sessionDtoIter.getSessionId().equals(sessionId)) { + sessionDto = sessionDtoIter; + } } + List items = sessionDto.getTaskListItems(); - private ActionForward listuser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); - Long itemUid = WebUtil.readLongParam(request, TaskListConstants.PARAM_RESOURCE_ITEM_UID); + // Getting the params passed in from the jqGrid + int page = WebUtil.readIntParam(request, AttributeNames.PARAM_PAGE); + int rowLimit = WebUtil.readIntParam(request, AttributeNames.PARAM_ROWS); + String sortOrder = WebUtil.readStrParam(request, AttributeNames.PARAM_SORD); + String sortBy = WebUtil.readStrParam(request, AttributeNames.PARAM_SIDX, true); + if (sortBy == "") { + sortBy = "userName"; + } + String searchString = WebUtil.readStrParam(request, "userName", true); - //get user list by given item uid - ITaskListService service = getTaskListService(); - List list = service.getUserListBySessionItem(sessionId, itemUid); - - //set to request - request.setAttribute(TaskListConstants.ATTR_USER_LIST, list); - return mapping.findForward(TaskListConstants.SUCCESS); + // Get the user list from the db + Collection userDtos = service.getPagedUsersBySession(sessionId, page - 1, rowLimit, sortBy, + sortOrder, searchString); + int countSessionUsers = service.getCountPagedUsersBySession(sessionId, searchString); + + int totalPages = new Double( + Math.ceil(new Integer(countSessionUsers).doubleValue() / new Integer(rowLimit).doubleValue())) + .intValue(); + + JSONArray rows = new JSONArray(); + int i = 1; + for (TaskListUserDTO userDto : userDtos) { + + JSONArray userData = new JSONArray(); + userData.put(userDto.getUserId()); +// userData.put(sessionId); + String fullName = StringEscapeUtils.escapeHtml(userDto.getFullName()); + userData.put(fullName); + + Set completedTaskUids = userDto.getCompletedTaskUids(); + for (TaskListItem item : items) { + String completionImage = completedTaskUids.contains(item.getUid()) + ? "" + : ""; + userData.put(completionImage); + } + + if (tasklist.isMonitorVerificationRequired()) { + String label = StringEscapeUtils.escapeHtml(service.getMessage("label.confirm")); + + String verificationStatus = userDto.isVerifiedByMonitor() + ? "" + : "" + label + ""; + userData.put(verificationStatus); + } + + JSONObject userRow = new JSONObject(); + userRow.put("id", i++); + userRow.put("cell", userData); + + rows.put(userRow); } + + JSONObject responseJSON = new JSONObject(); + responseJSON.put("total", totalPages); + responseJSON.put("page", page); + responseJSON.put("records", countSessionUsers); + responseJSON.put("rows", rows); + + res.setContentType("application/json;charset=utf-8"); + res.getWriter().print(new String(responseJSON.toString())); + return null; + } + + /** + * Refreshes user list. + */ + public ActionForward getPagedUsersByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse res) throws IOException, ServletException, JSONException { + ITaskListService service = getTaskListService(); - private ActionForward viewReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - - Long uid = WebUtil.readLongParam(request, TaskListConstants.ATTR_USER_UID); - - ITaskListService service = getTaskListService(); - 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"); + String sessionMapID = request.getParameter(TaskListConstants.ATTR_SESSION_MAP_ID); + SessionMap sessionMap = (SessionMap) request.getSession() + .getAttribute(sessionMapID); + TaskList tasklist = (TaskList) sessionMap.get(TaskListConstants.ATTR_TASKLIST); + Long sessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + Long questionUid = WebUtil.readLongParam(request, "questionUid"); + + // Getting the params passed in from the jqGrid + int page = WebUtil.readIntParam(request, AttributeNames.PARAM_PAGE); + int rowLimit = WebUtil.readIntParam(request, AttributeNames.PARAM_ROWS); + String sortOrder = WebUtil.readStrParam(request, AttributeNames.PARAM_SORD); + String sortBy = WebUtil.readStrParam(request, AttributeNames.PARAM_SIDX, true); + if (sortBy == "") { + sortBy = "userName"; } + String searchString = WebUtil.readStrParam(request, "userName", true); + + // Get the user list from the db + Collection userDtos = service.getPagedUsersBySessionAndItem(sessionId, questionUid, page - 1, + rowLimit, sortBy, sortOrder, searchString); + int countSessionUsers = service.getCountPagedUsersBySession(sessionId, searchString); + + int totalPages = new Double( + Math.ceil(new Integer(countSessionUsers).doubleValue() / new Integer(rowLimit).doubleValue())) + .intValue(); + + JSONArray rows = new JSONArray(); + int i = 1; +// for (TaskListUserDTO userDto : userDtos) { +// +// Long questionResultUid = userDto.getQuestionResultUid(); +// String fullName = StringEscapeUtils.escapeHtml(userDto.getFullName()); +// +// JSONArray userData = new JSONArray(); +// if (questionResultUid != null) { +// AssessmentQuestionResult questionResult = service.getAssessmentQuestionResultByUid(questionResultUid); +// +// userData.put(questionResultUid); +// userData.put(questionResult.getMaxMark()); +// userData.put(fullName); +// userData.put(AssessmentEscapeUtils.printResponsesForJqgrid(questionResult)); +// userData.put(questionResult.getMark()); +// +// } else { +// userData.put(""); +// userData.put(""); +// userData.put(fullName); +// userData.put("-"); +// userData.put("-"); +// } +// +// JSONObject userRow = new JSONObject(); +// userRow.put("id", i++); +// userRow.put("cell", userData); +// +// rows.put(userRow); +// } + + JSONObject responseJSON = new JSONObject(); + responseJSON.put("total", totalPages); + responseJSON.put("page", page); + responseJSON.put("records", countSessionUsers); + responseJSON.put("rows", rows); + + res.setContentType("application/json;charset=utf-8"); + res.getWriter().print(new String(responseJSON.toString())); + return null; + } + + /** + * Mark taskList user as verified. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + * @throws IOException + */ + private ActionForward setVerifiedByMonitor(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException { + + Long userUid = WebUtil.readLongParam(request, TaskListConstants.ATTR_USER_UID); + ITaskListService service = getTaskListService(); + TaskListUser user = service.getUser(userUid); + user.setVerifiedByMonitor(true); + service.createUser(user); + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + out.write(userUid.toString()); + out.flush(); + out.close(); + return null; + } + /** * Set Submission Deadline * @@ -213,34 +358,33 @@ */ public ActionForward setSubmissionDeadline(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - - ITaskListService service = getTaskListService(); - Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); - TaskList taskList = service.getTaskListByContentId(contentID); - - Long dateParameter = WebUtil.readLongParam(request, TaskListConstants.ATTR_SUBMISSION_DEADLINE, true); - Date tzSubmissionDeadline = null; - if (dateParameter != null) { - Date submissionDeadline = new Date(dateParameter); - HttpSession ss = SessionManager.getSession(); - org.lamsfoundation.lams.usermanagement.dto.UserDTO teacher = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) ss.getAttribute(AttributeNames.USER); - TimeZone teacherTimeZone = teacher.getTimeZone(); - tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline); - } - taskList.setSubmissionDeadline(tzSubmissionDeadline); - service.saveOrUpdateTaskList(taskList); - return null; + + ITaskListService service = getTaskListService(); + Long contentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + TaskList taskList = service.getTaskListByContentId(contentID); + + Long dateParameter = WebUtil.readLongParam(request, TaskListConstants.ATTR_SUBMISSION_DEADLINE, true); + Date tzSubmissionDeadline = null; + if (dateParameter != null) { + Date submissionDeadline = new Date(dateParameter); + HttpSession ss = SessionManager.getSession(); + org.lamsfoundation.lams.usermanagement.dto.UserDTO teacher = (org.lamsfoundation.lams.usermanagement.dto.UserDTO) ss + .getAttribute(AttributeNames.USER); + TimeZone teacherTimeZone = teacher.getTimeZone(); + tzSubmissionDeadline = DateUtil.convertFromTimeZoneToDefault(teacherTimeZone, submissionDeadline); + } + taskList.setSubmissionDeadline(tzSubmissionDeadline); + service.saveOrUpdateTaskList(taskList); + return null; } - - - - // ************************************************************************************* - // Private method - // ************************************************************************************* - private ITaskListService getTaskListService() { - WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); - return (ITaskListService) wac.getBean(TaskListConstants.RESOURCE_SERVICE); - } - + // ************************************************************************************* + // Private method + // ************************************************************************************* + private ITaskListService getTaskListService() { + WebApplicationContext wac = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()); + return (ITaskListService) wac.getBean(TaskListConstants.RESOURCE_SERVICE); + } + } Index: lams_tool_task/web/pages/monitoring/itemsummary.jsp =================================================================== diff -u -r9160b34eb0b4725a21c894d886c89f418868888a -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/web/pages/monitoring/itemsummary.jsp (.../itemsummary.jsp) (revision 9160b34eb0b4725a21c894d886c89f418868888a) +++ lams_tool_task/web/pages/monitoring/itemsummary.jsp (.../itemsummary.jsp) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -1,17 +1,14 @@ - - + <%@ include file="/common/taglibs.jsp"%> + + - <fmt:message key="label.learning.title" /> - + <fmt:message key="label.learning.title" /> <%@ include file="/common/header.jsp"%> - -

    @@ -73,10 +70,11 @@

    - -

    ${groupSummary.sessionName}

    +

    + ${groupSummary.sessionName} +

    @@ -91,15 +89,13 @@ - - @@ -123,7 +119,7 @@ - +
      @@ -154,10 +150,7 @@
    -
    - -

    Index: lams_tool_task/web/pages/monitoring/parts/advanceoptions.jsp =================================================================== diff -u --- lams_tool_task/web/pages/monitoring/parts/advanceoptions.jsp (revision 0) +++ lams_tool_task/web/pages/monitoring/parts/advanceoptions.jsp (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -0,0 +1,109 @@ +

    + + + + + +

    +
    + + \ No newline at end of file Index: lams_tool_task/web/pages/monitoring/parts/reflections.jsp =================================================================== diff -u --- lams_tool_task/web/pages/monitoring/parts/reflections.jsp (revision 0) +++ lams_tool_task/web/pages/monitoring/parts/reflections.jsp (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -0,0 +1,23 @@ +<%@ include file="/common/taglibs.jsp"%> + +
    + + + + + + + + + + + + +
    + +
    + - +
    + + +
    Index: lams_tool_task/web/pages/monitoring/statistic.jsp =================================================================== diff -u -r9160b34eb0b4725a21c894d886c89f418868888a -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/web/pages/monitoring/statistic.jsp (.../statistic.jsp) (revision 9160b34eb0b4725a21c894d886c89f418868888a) +++ lams_tool_task/web/pages/monitoring/statistic.jsp (.../statistic.jsp) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -1,17 +1,17 @@ <%@ include file="/common/taglibs.jsp"%> - + - +
    - + <%-- display group name on first row--%> -

    ${summary.sessionName}

    +

    ${sessionDto.sessionName}

    @@ -26,7 +26,7 @@ - + @@ -46,14 +46,11 @@
    - ${summary.visitNumbers[status.index]} + ${sessionDto.visitNumbers[status.index]}
    - - - Index: lams_tool_task/web/pages/monitoring/summary.jsp =================================================================== diff -u -r65a83a957c6c1160566e3e9d11a9c9a4d6e704f6 -r091abac9dddc7312350403cbd0fec84bd38380c8 --- lams_tool_task/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 65a83a957c6c1160566e3e9d11a9c9a4d6e704f6) +++ lams_tool_task/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 091abac9dddc7312350403cbd0fec84bd38380c8) @@ -1,12 +1,24 @@ <%@ include file="/common/taglibs.jsp"%> - + + + - + - + +

    @@ -47,233 +129,34 @@
    -<%-- Summary list --%> - +<%-- Summary list --%> +
    - - -

    ${summary.sessionName}

    -

    - - - - - - - + - - - - - - - +
    + +
    + ${sessionDto.sessionName} +
    +
    -
    - +
    - - - - - - - -
    - -
    +
    + - - - - - - - - - - - - - - - - - - - - - - - [ for ${user.loginName}] - - - - - - - - -
    - - - <%-- Reflection list --%> - - - -

    - - - - - - - - - - - - - - - -
    - - - -
    - - - - - - - - -
    -
    -
    - - + - -
    -<%-- Overall TaskList information --%> -

    - +
    + + <%@ include file="parts/reflections.jsp"%> + - - - -

    -
    - - - +<%@include file="parts/advanceoptions.jsp"%> <%@include file="daterestriction.jsp"%> \ No newline at end of file Fisheye: Tag 091abac9dddc7312350403cbd0fec84bd38380c8 refers to a dead (removed) revision in file `lams_tool_task/web/pages/monitoring/userlist.jsp'. Fisheye: No comparison available. Pass `N' to diff?