Index: lams_tool_task/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -90,6 +90,11 @@ label.learning.required.tasks =* - required tasks label.preview.upload.file =Upload file label.preview.upload.button =Upload +label.preview.filelist =File list +label.preview.comments =Comments +label.preview.leave.your.comment =Leave your comment +label.preview.post =Post +lable.preview.by =By monitoring.tab.summary =Summary monitoring.tab.statistics =Statistic monitoring.tab.instructions =Instruction Index: lams_tool_task/conf/xdoclet/struts-actions.xml =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -129,7 +129,7 @@ name="taskListItemForm" scope="request" validate="false"> - + comments; + //Set of user comments + private Set comments; - public Object clone(){ - TaskListItem obj = null; - try { - obj = (TaskListItem) super.clone(); - ((TaskListItem)obj).setUid(null); - //clone ReourceUser as well - if(this.createBy != null) - ((TaskListItem)obj).setCreateBy((TaskListUser) this.createBy.clone()); + //*************** NON Persist Fields ******************** + private boolean complete; + + /** + * Default contruction method. + * + */ + public TaskListItem(){ + uploadedFileList = new HashSet(); + comments = new HashSet(); + } + + // ********************************************************** + // Function method for TaskList + // ********************************************************** + public Object clone(){ + + TaskListItem taskListItem = null; + try{ + taskListItem = (TaskListItem) super.clone(); + taskListItem.setUid(null); + +// //clone set of taskListItemsAttachment +// if(uploadedFileList != null){ +// Iterator iter = uploadedFileList.iterator(); +// Set set = new HashSet(); +// while(iter.hasNext()){ +// TaskListItemAttachment file = (TaskListItemAttachment)iter.next(); +// TaskListItemAttachment newFile = (TaskListItemAttachment) file.clone(); +// //just clone old file without duplicate it in repository +// set.add(newFile); +// } +// taskListItem.uploadedFileList = set; +// } +// +// //clone set of taskListItemsComment +// if(comments != null){ +// Iterator iter = comments.iterator(); +// Set set = new HashSet(); +// while(iter.hasNext()){ +// TaskListItemComment comment = (TaskListItemComment)iter.next(); +// TaskListItemComment newComment = (TaskListItemComment) comment.clone(); +// //just clone old file without duplicate it in repository +// set.add(newComment); +// } +// taskListItem.comments = set; +// } + //clone ReourceUser as well + if(this.createBy != null){ + taskListItem.setCreateBy((TaskListUser) this.createBy.clone()); + } } catch (CloneNotSupportedException e) { log.error("When clone " + TaskListItem.class + " failed"); } - - return obj; - } -// ********************************************************** -// Get/Set methods -// ********************************************************** - /** - * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" - * @return Returns the uid. - */ - public Long getUid() { - return uid; - } - /** - * @param uid The uid to set. - */ - public void setUid(Long userID) { - this.uid = userID; - } + + return taskListItem; + } + + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof TaskListItem)) + return false; - /** - * @hibernate.property column="description" - * @return - */ - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } + final TaskListItem genericEntity = (TaskListItem) o; - /** - * @hibernate.property column="init_item" - * @return - */ - public String getInitialItem() { - return initialItem; - } - public void setInitialItem(String initialItem) { - this.initialItem = initialItem; - } + return new EqualsBuilder() + .append(this.uid,genericEntity.uid) + .append(this.title,genericEntity.title) + .append(this.description,genericEntity.description) + .append(this.createDate,genericEntity.createDate) + .append(this.createBy,genericEntity.createBy) + .isEquals(); + } - /** - * @hibernate.property - * column="organization_xml" - * length="65535" - * @return - */ - public String getOrganizationXml() { - return organizationXml; - } - public void setOrganizationXml(String organizationXml) { - this.organizationXml = organizationXml; - } - - /** - * @hibernate.property column="title" length="255" - * @return - */ - public String getTitle() { - return title; - } - public void setTitle(String title) { - this.title = title; - } + public int hashCode() { + return new HashCodeBuilder().append(uid).append(title) + .append(description).append(createDate) + .append(createBy).toHashCode(); + } + + //********************************************************** + // Get/Set methods + //********************************************************** + + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the uid. + */ + public Long getUid() { + return uid; + } + /** + * @param uid The uid to set. + */ + public void setUid(Long userID) { + this.uid = userID; + } + /** + * @hibernate.property column="description" + * @return + */ + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + /** + * @hibernate.property column="init_item" + * @return + */ + public String getInitialItem() { + return initialItem; + } + public void setInitialItem(String initialItem) { + this.initialItem = initialItem; + } + + /** + * @hibernate.property + * column="organization_xml" + * length="65535" + * @return + */ + public String getOrganizationXml() { + return organizationXml; + } + public void setOrganizationXml(String organizationXml) { + this.organizationXml = organizationXml; + } + + /** + * @hibernate.property column="title" length="255" + * @return + */ + public String getTitle() { + return title; + } + public void setTitle(String title) { + this.title = title; + } /** - * @hibernate.many-to-one - * cascade="none" - * column="create_by" - * - * @return - */ - public TaskListUser getCreateBy() { - return createBy; - } - public void setCreateBy(TaskListUser createBy) { - this.createBy = createBy; - } + * @hibernate.many-to-one + * cascade="none" + * column="create_by" + * + * @return + */ + public TaskListUser getCreateBy() { + return createBy; + } + public void setCreateBy(TaskListUser createBy) { + this.createBy = createBy; + } + + /** + * @hibernate.property column="create_date" + * @return + */ + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + /** + * @hibernate.property column="create_by_author" + * @return + */ + public boolean isCreateByAuthor() { + return isCreateByAuthor; + } + public void setCreateByAuthor(boolean isCreateByAuthor) { + this.isCreateByAuthor = isCreateByAuthor; + } + + /** + * @hibernate.property column="is_hide" + * @return + */ + public boolean isHide() { + return isHide; + } + public void setHide(boolean isHide) { + this.isHide = isHide; + } + + public void setComplete(boolean complete) { + this.complete=complete; + } + public boolean isComplete() { + return complete; + } + + /** + * @hibernate.property column="sequence_id" + * @return + */ + public int getSequenceId() { + return sequenceId; + } + public void setSequenceId(int sequenceId) { + this.sequenceId = sequenceId; + } - /** - * @hibernate.property column="create_date" - * @return - */ - public Date getCreateDate() { - return createDate; - } - public void setCreateDate(Date createDate) { - this.createDate = createDate; - } + /** + * @hibernate.property column="is_required" + * @return + */ + public boolean isRequired() { + return isRequired; + } + public void setRequired(boolean isRequired) { + this.isRequired = isRequired; + } - /** - * @hibernate.property column="create_by_author" - * @return - */ - public boolean isCreateByAuthor() { - return isCreateByAuthor; - } - public void setCreateByAuthor(boolean isCreateByAuthor) { - this.isCreateByAuthor = isCreateByAuthor; - } + /** + * @hibernate.property column="show_comments_to_all" + * @return + */ + public boolean getShowCommentsToAll() { + return showCommentsToAll; + } + public void setShowCommentsToAll(boolean showCommentsToAll) { + this.showCommentsToAll = showCommentsToAll; + } - /** - * @hibernate.property column="is_hide" - * @return - */ - public boolean isHide() { - return isHide; - } - public void setHide(boolean isHide) { - this.isHide = isHide; - } - - public void setComplete(boolean complete) { - this.complete=complete; - } - public boolean isComplete() { - return complete; - } + /** + * @hibernate.property column="is_comments_allowed" + * @return + */ + public boolean isCommentsAllowed() { + return isCommentsAllowed; + } + public void setCommentsAllowed(boolean isCommentsAllowed) { + this.isCommentsAllowed = isCommentsAllowed; + } - /** - * @hibernate.property column="sequence_id" - * @return - */ - public int getSequenceId() { - return sequenceId; - } - public void setSequenceId(int sequenceId) { - this.sequenceId = sequenceId; - } + /** + * @hibernate.property column="is_child_task" + * @return + */ + public boolean isChildTask() { + return isChildTask; + } + public void setChildTask(boolean isChildTask) { + this.isChildTask = isChildTask; + } - /** - * @hibernate.property column="is_required" - * @return - */ - public boolean isRequired() { - return isRequired; - } - public void setRequired(boolean isRequired) { - this.isRequired = isRequired; - } + /** + * @hibernate.property column="parent_task_name" + * @return + */ + public String getParentTaskName() { + return parentTaskName; + } + public void setParentTaskName(String parentTaskName) { + this.parentTaskName = parentTaskName; + } - /** - * @hibernate.property column="show_comments_to_all" - * @return - */ - public boolean getShowCommentsToAll() { - return showCommentsToAll; - } - public void setShowCommentsToAll(boolean showCommentsToAll) { - this.showCommentsToAll = showCommentsToAll; - } - - /** - * @hibernate.property column="is_comments_allowed" - * @return - */ - public boolean isCommentsAllowed() { - return isCommentsAllowed; - } - public void setCommentsAllowed(boolean isCommentsAllowed) { - this.isCommentsAllowed = isCommentsAllowed; - } - - /** - * @hibernate.property column="is_child_task" - * @return - */ - public boolean isChildTask() { - return isChildTask; - } - public void setChildTask(boolean isChildTask) { - this.isChildTask = isChildTask; - } - - /** - * @hibernate.property column="parent_task_name" - * @return - */ - public String getParentTaskName() { - return parentTaskName; - } - public void setParentTaskName(String parentTaskName) { - this.parentTaskName = parentTaskName; - } - - /** - * - * @hibernate.set cascade="all-delete-orphan" - * inverse="false" - * @hibernate.collection-key column="taskList_item_uid" - * @hibernate.collection-one-to-many - * class="org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment" - * - * @return a set of Attachments to this TaskListItem. - */ - public Set getUploadedFileList() { - return uploadedFileList; - } - public void setUploadedFileList(Set uploadedFileList) { - this.uploadedFileList = uploadedFileList; - } - - public List getComments() { - return comments; - } - public void setComments(List comments) { - this.comments = comments; - } - + /** + * @hibernate.set lazy="true" + * cascade="all" + * inverse="false" + * order-by="create_date desc" + * @hibernate.collection-key column="taskList_item_uid" + * @hibernate.collection-one-to-many + * class="org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment" + * + * @return a set of Attachments to this TaskListItem. + */ + public Set getUploadedFileList() { + return uploadedFileList; + } + public void setUploadedFileList(Set uploadedFileList) { + this.uploadedFileList = uploadedFileList; + } + + /** + * @hibernate.set lazy="true" + * cascade="all" + * inverse="false" + * order-by="create_date desc" + * @hibernate.collection-key column="taskList_item_uid" + * @hibernate.collection-one-to-many + * class="org.lamsfoundation.lams.tool.taskList.model.TaskListItemComment" + * + * @return a set of Comments to this TaskListItem. + */ + public Set getComments() { + return comments; + } + public void setComments(Set comments) { + this.comments = comments; + } } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.hbm.xml =================================================================== diff -u -r972362fd3b15f3887b276091d6731b78d2d1296a -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.hbm.xml (.../TaskListItemAttachment.hbm.xml) (revision 972362fd3b15f3887b276091d6731b78d2d1296a) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.hbm.xml (.../TaskListItemAttachment.hbm.xml) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -1,84 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java (.../TaskListItemAttachment.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java (.../TaskListItemAttachment.java) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -49,54 +49,57 @@ private String fileType; private String fileName; private Date created; - private String createBy; + private TaskListUser createBy; - //Default contruction method - public TaskListItemAttachment(){ - - } -// ********************************************************** - // Function method for Attachment -// ********************************************************** - public Object clone(){ - Object obj = null; - try { - obj = super.clone(); - ((TaskListItemAttachment)obj).setUid(null); - } catch (CloneNotSupportedException e) { - log.error("When clone " + TaskListItemAttachment.class + " failed"); - } - - return obj; - } - public boolean equals(Object o) { - if (this == o) - return true; - if (!(o instanceof TaskListItemAttachment)) - return false; - - final TaskListItemAttachment genericEntity = (TaskListItemAttachment) o; - - return new EqualsBuilder() - .append(this.uid,genericEntity.uid) - .append(this.fileVersionId,genericEntity.fileVersionId) - .append(this.fileName,genericEntity.fileName) - .append(this.fileType,genericEntity.fileType) - .append(this.created,genericEntity.created) - .isEquals(); - } - - public int hashCode() { - return new HashCodeBuilder().append(uid).append(fileVersionId).append(fileName).append(fileType).append(created) - .toHashCode(); - } +// //Default contruction method +// public TaskListItemAttachment(){ +// +// } +// // ********************************************************** +// // Function method for Attachment +// // ********************************************************** +// public Object clone(){ +// Object obj = null; +// try { +// obj = super.clone(); +// ((TaskListItemAttachment)obj).setUid(null); +// } catch (CloneNotSupportedException e) { +// log.error("When clone " + TaskListItemAttachment.class + " failed"); +// } +// +// return obj; +// } +// public boolean equals(Object o) { +// if (this == o) +// return true; +// if (!(o instanceof TaskListItemAttachment)) +// return false; +// +// final TaskListItemAttachment genericEntity = (TaskListItemAttachment) o; +// +// return new EqualsBuilder() +// .append(this.uid,genericEntity.uid) +// .append(this.fileVersionId,genericEntity.fileVersionId) +// .append(this.fileName,genericEntity.fileName) +// .append(this.fileType,genericEntity.fileType) +// .append(this.created,genericEntity.created) +// .append(this.createBy,genericEntity.createBy) +// .isEquals(); +// } +// +// public int hashCode() { +// return new HashCodeBuilder().append(uid).append(fileVersionId).append( +// fileName).append(fileType).append(created).append(createBy) +// .toHashCode(); +// } -// ********************************************************** + // ********************************************************** // get/set methods -// ********************************************************** - /** - * @hibernate.id column="uid" generator-class="native" - */ + // ********************************************************** + /** + * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" + * @return Returns the log Uid. + */ public Long getUid() { return uid; } @@ -151,6 +154,7 @@ public void setFileUuid(Long uuid) { this.fileUuid = uuid; } + /** * @hibernate.property column="create_date" * @return @@ -162,16 +166,17 @@ public void setCreated(Date created) { this.created = created; } - + /** - * @hibernate.property column="create_by" + * @hibernate.many-to-one column="create_by" + * cascade="none" * @return */ - public String getCreateBy() { + public TaskListUser getCreateBy() { return createBy; } - public void setCreateBy(String createBy) { + public void setCreateBy(TaskListUser createBy) { this.createBy = createBy; } } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.hbm.xml =================================================================== diff -u -r972362fd3b15f3887b276091d6731b78d2d1296a -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.hbm.xml (.../TaskListItemComment.hbm.xml) (revision 972362fd3b15f3887b276091d6731b78d2d1296a) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.hbm.xml (.../TaskListItemComment.hbm.xml) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -34,16 +34,6 @@ /> - - org/lamsfoundation/lams/tool/taskList/model/TaskListItem.hbm.xml org/lamsfoundation/lams/tool/taskList/model/TaskListItemVisitLog.hbm.xml org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.hbm.xml + org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.hbm.xml org/lamsfoundation/lams/tool/taskList/model/TaskListAttachment.hbm.xml org/lamsfoundation/lams/tool/taskList/model/TaskListSession.hbm.xml Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java =================================================================== diff -u -r972362fd3b15f3887b276091d6731b78d2d1296a -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision 972362fd3b15f3887b276091d6731b78d2d1296a) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -29,8 +29,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.SortedSet; @@ -41,35 +39,27 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.log4j.Logger; import org.apache.struts.action.Action; -import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import org.apache.struts.upload.FormFile; -import org.lamsfoundation.lams.authoring.web.AuthoringConstants; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.taskList.TaskListConstants; -import org.lamsfoundation.lams.tool.taskList.model.TaskList; -import org.lamsfoundation.lams.tool.taskList.model.TaskListAttachment; 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.TaskListSession; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; import org.lamsfoundation.lams.tool.taskList.service.ITaskListService; import org.lamsfoundation.lams.tool.taskList.service.UploadTaskListFileException; import org.lamsfoundation.lams.tool.taskList.util.TaskListItemAttachmentComparator; import org.lamsfoundation.lams.tool.taskList.util.TaskListItemCommentComparator; import org.lamsfoundation.lams.tool.taskList.util.TaskListItemComparator; -import org.lamsfoundation.lams.tool.taskList.web.form.TaskListForm; import org.lamsfoundation.lams.tool.taskList.web.form.TaskListItemForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.FileValidatorUtil; @@ -115,7 +105,6 @@ SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); TaskListItem item = getTaskListItem(request,sessionMap, mode); Long sessionId = NumberUtils.createLong(request.getParameter(TaskListConstants.ATTR_TOOL_SESSION_ID)); - Long sessionId2 = new Long(request.getParameter(TaskListConstants.PARAM_TOOL_SESSION_ID)); //mark this item access flag if it is learner if(ToolAccessMode.LEARNER.toString().equals(mode)){ @@ -124,6 +113,9 @@ //get back login user DTO UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); service.setItemAccess(item.getUid(),new Long(user.getUserID().intValue()),sessionId); + + //put user login into session + sessionMap.put(TaskListConstants.ATTR_USER_LOGIN, user.getLogin()); } if(item == null){ @@ -139,6 +131,8 @@ Long itemUid = NumberUtils.createLong(request.getParameter(TaskListConstants.PARAM_RESOURCE_ITEM_UID)); request.setAttribute(TaskListConstants.PARAM_RESOURCE_ITEM_UID,itemUid); + sessionMap.put(TaskListConstants.PARAM_RESOURCE_ITEM_UID,itemUid); + //basic information sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM, item); sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM_TITLE, item.getTitle()); @@ -147,7 +141,7 @@ //init taskList item list SortedSet commentList = getCommentList(sessionMap); - List dbComments = item.getComments(); + Set dbComments = item.getComments(); commentList.clear(); if(dbComments != null){ for(TaskListItemComment comment : dbComments){ @@ -177,63 +171,41 @@ * @return */ private ActionForward addNewComment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { -// //get back SessionMap -// String sessionMapID = request.getParameter(TaskListConstants.ATTR_SESSION_MAP_ID); -// SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); -// request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMapID); -// -// Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID); -// -// String mode = request.getParameter(AttributeNames.ATTR_MODE); -// TaskListItemForm itemForm = (TaskListItemForm)form; -// ActionErrors errors = validateTaskListItem(itemForm); -// -// if(!errors.isEmpty()){ -// this.addErrors(request,errors); -// return mapping.findForward("task"); -// } -// -// //create a new TaskListItem -// TaskListItem item = new TaskListItem(); -// ITaskListService service = getTaskListService(); -// TaskListUser taskListUser = getCurrentUser(service,sessionId); -// item.setTitle(itemForm.getTitle()); -// item.setDescription(itemForm.getDescription()); -// item.setCreateDate(new Timestamp(new Date().getTime())); -// item.setCreateByAuthor(false); -// item.setCreateBy(taskListUser); -// -// //setting SequenceId -// SortedSet taskListList = getTaskListItemList(sessionMap); -// int maxSeq = 1; -// if(taskListList != null && taskListList.size() > 0){ -// TaskListItem last = taskListList.last(); -// maxSeq = last.getSequenceId()+1; -// } -// item.setSequenceId(maxSeq); -// -// //save and update session -// TaskListSession resSession = service.getTaskListSessionBySessionId(sessionId); -// if(resSession == null){ -// log.error("Failed update TaskListSession by ID[" + sessionId + "]"); -// return mapping.findForward(TaskListConstants.ERROR); -// } -// Set items = resSession.getTaskListItems(); -// if(items == null){ -// items = new HashSet(); -// resSession.setTaskListItems(items); -// } -// items.add(item); -// service.saveOrUpdateTaskListSession(resSession); -// -// //update session value -// SortedSet taskListItemList = getTaskListItemList(sessionMap); -// taskListItemList.add(item); -// -// //URL or file upload -// request.setAttribute(AttributeNames.ATTR_MODE,mode); -// itemForm.reset(mapping, request); - return mapping.findForward(TaskListConstants.SUCCESS); + TaskListItemForm taskListItemForm = (TaskListItemForm) form; + SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(taskListItemForm.getSessionMapID()); + request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID); + + String commentMessage = taskListItemForm.getComment(); + if(commentMessage == null || StringUtils.isBlank(commentMessage)) + return mapping.findForward(TaskListConstants.SUCCESS); + + TaskListItemComment comment = new TaskListItemComment(); + comment.setComment(commentMessage); + UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + ITaskListService service = getTaskListService(); + TaskListUser taskListUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()),sessionId); + comment.setCreateBy(taskListUser); + comment.setCreateDate(new Timestamp(new Date().getTime())); + + //handle session value + SortedSet commentList = getCommentList(sessionMap); + commentList.add(comment); + + //finally persist taskListPO again + TaskListItem httpSessionItem = (TaskListItem) sessionMap.get(TaskListConstants.ATTR_TASK_LIST_ITEM); + TaskListItem dbItem = service.getTaskListItemByUid(httpSessionItem.getUid()); + Set dbComments = dbItem.getComments(); + if(dbComments == null){ + dbComments = new HashSet(); + dbItem.setComments(dbComments); + } + dbComments.add(comment); + service.saveOrUpdateTaskListItem(dbItem); + + form.reset(mapping, request); + + return mapping.findForward(TaskListConstants.SUCCESS); } /** @@ -265,16 +237,15 @@ return mapping.findForward(TaskListConstants.SUCCESS); } - ITaskListService service = getTaskListService(); //upload to repository + ITaskListService service = getTaskListService(); UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); - TaskListItemAttachment att = service.uploadTaskListItemFile(file, IToolContentHandler.TYPE_ONLINE, user.getLogin()); + TaskListUser taskListUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()),sessionId); + TaskListItemAttachment att = service.uploadTaskListItemFile(file, IToolContentHandler.TYPE_ONLINE, taskListUser); //handle session value - SortedSet attachmentList = getAttachmentList(sessionMap); - //add to attachmentList + SortedSet attachmentList = getAttachmentList(sessionMap); attachmentList.add(att); - //finally persist taskListPO again TaskListItem httpSessionItem = (TaskListItem) sessionMap.get(TaskListConstants.ATTR_TASK_LIST_ITEM); TaskListItem dbItem = service.getTaskListItemByUid(httpSessionItem.getUid()); @@ -303,19 +274,12 @@ * @return */ private TaskListItem getTaskListItem(HttpServletRequest request, SessionMap sessionMap, String mode) { - TaskListItem item = null; - if(TaskListConstants.MODE_AUTHOR_SESSION.equals(mode)){ - int itemIdx = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_ITEM_INDEX),0); - //authoring: does not save item yet, so only has ItemList from session and identity by Index - List taskListList = new ArrayList(getTaskListItemList(sessionMap)); - item = taskListList.get(itemIdx); - }else{ - Long itemUid = NumberUtils.createLong(request.getParameter(TaskListConstants.PARAM_RESOURCE_ITEM_UID)); - - // get back the taskList and item list and display them on page - ITaskListService service = getTaskListService(); - item = service.getTaskListItemByUid(itemUid); - } + Long itemUid = NumberUtils.createLong(request.getParameter(TaskListConstants.PARAM_RESOURCE_ITEM_UID)); + + // get back the taskList and item list and display them on page + ITaskListService service = getTaskListService(); + TaskListItem item = service.getTaskListItemByUid(itemUid); + return item; } @@ -365,121 +329,5 @@ } return list; } - -// /** -// * Open url in popup window page. -// * @param mapping -// * @param form -// * @param request -// * @param response -// * @return -// */ -// private ActionForward openUrlPopup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { -// String url = request.getParameter(TaskListConstants.PARAM_OPEN_URL_POPUP); -// String title = request.getParameter(TaskListConstants.PARAM_TITLE); -// request.setAttribute(TaskListConstants.PARAM_OPEN_URL_POPUP,url); -// request.setAttribute(TaskListConstants.PARAM_TITLE,title); -// return mapping.findForward(TaskListConstants.SUCCESS); -// } - -// /** -// * Return next instrucion to page. It need four input parameters, mode, itemIndex or itemUid, and insIdx. -// * @param mapping -// * @param form -// * @param request -// * @param response -// * @return -// */ -// private ActionForward nextInstruction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { -// String mode = request.getParameter(AttributeNames.ATTR_MODE); -// -// String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); -// SessionMap sesionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); -// -// TaskListItem item = getTaskListItem(request, sesionMap, mode); -// if(item == null){ -// return mapping.findForward(TaskListConstants.ERROR); -// } -// -// int currIns = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_CURRENT_INSTRUCTION_INDEX),0); -// -// Set instructions = item.getItemInstructions(); -// InstructionNavDTO navDto = new InstructionNavDTO(); -// //For Learner upload item, its instruction will display description/comment fields in ReosourceItem. -// if(!item.isCreateByAuthor()){ -// List navItems = new ArrayList(1); -// //create a new instruction and put TaskListItem description into it: just for display use. -// TaskListItemInstruction ins = new TaskListItemInstruction(); -// ins.setSequenceId(1); -// ins.setDescription(item.getDescription()); -// navItems.add(ins); -// navDto.setAllInstructions(navItems); -// instructions.add(ins); -// }else{ -// navDto.setAllInstructions(new ArrayList(instructions)); -// } -// navDto.setTitle(item.getTitle()); -// navDto.setType(item.getType()); -// navDto.setTotal(instructions.size()); -// if(instructions.size() > 0){ -// navDto.setInstruction((TaskListItemInstruction) new ArrayList(instructions).get(currIns)); -// navDto.setCurrent(currIns+1); -// }else{ -// navDto.setCurrent(0); -// navDto.setInstruction(null); -// } -// -// request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID,sessionMapID); -// request.setAttribute(TaskListConstants.ATTR_RESOURCE_INSTRUCTION,navDto); -// return mapping.findForward(TaskListConstants.SUCCESS); -// } -// -// -// /** -// * Display main frame to display instrcution and item content. -// * @param mapping -// * @param form -// * @param request -// * @param response -// * @return -// */ -// private ActionForward reviewItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { -// String mode = request.getParameter(AttributeNames.ATTR_MODE); -// -// String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); -// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); -// -// TaskListItem item = getTaskListItem(request,sessionMap, mode); -// -// String idStr = request.getParameter(TaskListConstants.ATTR_TOOL_SESSION_ID); -// Long sessionId = NumberUtils.createLong(idStr); -// //mark this item access flag if it is learner -// if(ToolAccessMode.LEARNER.toString().equals(mode)){ -// ITaskListService service = getTaskListService(); -// HttpSession ss = SessionManager.getSession(); -// //get back login user DTO -// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); -// service.setItemAccess(item.getUid(),new Long(user.getUserID().intValue()),sessionId); -// } -// -// if(item == null){ -// return mapping.findForward(TaskListConstants.ERROR); -// } -// -// //these attribute will be use to instruction navigator page -// int itemIdx = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_ITEM_INDEX)); -// request.setAttribute(TaskListConstants.PARAM_ITEM_INDEX,itemIdx); -// Long itemUid = NumberUtils.createLong(request.getParameter(TaskListConstants.PARAM_RESOURCE_ITEM_UID)); -// request.setAttribute(TaskListConstants.PARAM_RESOURCE_ITEM_UID,itemUid); -// request.setAttribute(TaskListConstants.ATTR_TOOL_SESSION_ID,sessionId); -// request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID,sessionMapID); -// -// -// //TODO!!!!!!!!!!!!!!!!!!!!!!!!! -//// sessionMap.put(TaskListConstants.ATTR_RESOURCE,taskList); -// -// return mapping.findForward(TaskListConstants.SUCCESS); -// -// -// } + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -51,7 +51,7 @@ private String parentTaskName; private FormFile uploadedFile; - private TaskListItemComment comment; + private String comment; public String getDescription() { return description; @@ -126,10 +126,10 @@ this.uploadedFile = uploadedFile; } - public TaskListItemComment getComment() { + public String getComment() { return comment; } - public void setComment(TaskListItemComment comment) { + public void setComment(String comment) { this.comment = comment; } } Index: lams_tool_task/web/pages/reviewtask/commentlist.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/commentlist.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/commentlist.jsp (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -0,0 +1,36 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + ${author} + + +
Fisheye: Tag 5d767fb50e700c22e857db49f7ec2ab40d4e3744 refers to a dead (removed) revision in file `lams_tool_task/web/pages/reviewtask/initnav.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 5d767fb50e700c22e857db49f7ec2ab40d4e3744 refers to a dead (removed) revision in file `lams_tool_task/web/pages/reviewtask/instructionsnav.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 5d767fb50e700c22e857db49f7ec2ab40d4e3744 refers to a dead (removed) revision in file `lams_tool_task/web/pages/reviewtask/mainframe.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 5d767fb50e700c22e857db49f7ec2ab40d4e3744 refers to a dead (removed) revision in file `lams_tool_task/web/pages/reviewtask/openurl.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_task/web/pages/reviewtask/reviewtask.jsp =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/web/pages/reviewtask/reviewtask.jsp (.../reviewtask.jsp) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/web/pages/reviewtask/reviewtask.jsp (.../reviewtask.jsp) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -1,17 +1,6 @@ <%@ include file="/common/taglibs.jsp"%> -<%-- -<%@ page import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> -<%@ page import="org.lamsfoundation.lams.tool.taskList.TaskListConstants"%> - --%> - @@ -22,99 +11,100 @@ + +
- - +

${sessionMap.taskListItemTitle}

-

${sessionMap.taskListItemTitle}

+

${sessionMap.taskListItemDescription}

-

${sessionMap.taskListItemDescription}

+ + + +

+ <%@ include file="commentlist.jsp"%> + + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+
+ + + +
+
+ <%@ include file="filelist.jsp"%> +
+
+ +
+ + + + + + +
+
-<%@ include file="topiclist.jsp"%> - - - - - - - AAA - BBB - CCC - - - - - - - -<%-- - - - ---%> - - - - - - - -
- -
-
-
- -
- -
-
- - - <%-- Display target file type --%> -
    - -
  • - - - - [${file.createBy}] - - - - - - - - - -
  • -
    -
-
-
-
- -
- - - - - - -
- - + +


+
+ +
- +
+ +
+
Index: lams_tool_task/web/pages/reviewtask/taskfilelist.jsp =================================================================== diff -u -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 -r5d767fb50e700c22e857db49f7ec2ab40d4e3744 --- lams_tool_task/web/pages/reviewtask/taskfilelist.jsp (.../taskfilelist.jsp) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) +++ lams_tool_task/web/pages/reviewtask/taskfilelist.jsp (.../taskfilelist.jsp) (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -1,43 +1,34 @@ -<%@ include file="/common/taglibs.jsp"%> -<%@ page - import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> - -" / - - - -<%-- check whehter has target file type --%> - - - +
+ + + +
+ +
- - -<%-- Display target file type --%> - + + <%-- Display target file type --%>
    - + +
  • - - - - - - - + + + [${file.createBy.loginName}] + + - - - +
-
+
+
Fisheye: Tag 5d767fb50e700c22e857db49f7ec2ab40d4e3744 refers to a dead (removed) revision in file `lams_tool_task/web/pages/reviewtask/topiclist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_task/web/pages/reviewtask/topicview.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/topicview.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/topicview.jsp (revision 5d767fb50e700c22e857db49f7ec2ab40d4e3744) @@ -0,0 +1,45 @@ +<%@ include file="/common/taglibs.jsp"%> + + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + ${author} + - + +
+
+ +
+
+ +
+