Index: lams_tool_task/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -88,6 +88,8 @@ label.learning.suggest.new.task =Suggest a new task label.learning.comment.or.instruction =Description label.learning.required.tasks =* - required tasks +label.preview.upload.file =Upload file +label.preview.upload.button =Upload monitoring.tab.summary =Summary monitoring.tab.statistics =Statistic monitoring.tab.instructions =Instruction @@ -160,6 +162,10 @@ message.alertContentEdit =Warning: One of more students have accessed this activity. Changing this content will result in students getting different information. label.finished =Next Activity label.finish =Next Activity +lable.topic.title.comment =Comment +lable.topic.title.createDate =Date +lable.topic.title.author =Author +label.default.user.name =Instructor #======= End labels: Exported 156 labels for en AU ===== Index: lams_tool_task/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -112,25 +112,35 @@ parameter="downItem"> - - - + - + name="taskListItemForm" + scope="request" + parameter="reviewTask" + validate="false"> + - - + parameter="addNewComment" + name="taskListItemForm" + scope="request" + validate="false"> + - - + name="taskListItemForm" + scope="request" + validate="false" + parameter="uploadFile"> + - + - Index: lams_tool_task/db/model/taskList.clay =================================================================== diff -u -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/db/model/taskList.clay (.../taskList.clay) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/db/model/taskList.clay (.../taskList.clay) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -6,15 +6,221 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
- + @@ -112,7 +318,7 @@
- + @@ -260,7 +466,7 @@
- + @@ -449,7 +655,7 @@
- + @@ -537,7 +743,7 @@
- + @@ -629,7 +835,7 @@
- + Index: lams_tool_task/db/sql/create_lams_tool_taskList.sql =================================================================== diff -u -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/db/sql/create_lams_tool_taskList.sql (.../create_lams_tool_taskList.sql) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/db/sql/create_lams_tool_taskList.sql (.../create_lams_tool_taskList.sql) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -3,6 +3,8 @@ drop table if exists tl_latask10_taskList; drop table if exists tl_latask10_taskList_item; drop table if exists tl_latask10_taskList_item_visit_log; +drop table if exists tl_latask10_item_attachment; +drop table if exists tl_latask10_item_comment; drop table if exists tl_latask10_session; drop table if exists tl_latask10_user; create table tl_latask10_attachment ( @@ -65,6 +67,25 @@ session_id bigint, primary key (uid) ); +create table tl_latask10_item_attachment ( + uid bigint not null auto_increment, + file_version_id bigint, + file_type varchar(255), + file_name varchar(255), + file_uuid bigint, + create_date datetime, + taskList_item_uid bigint, + create_by bigint, + primary key (uid) +); +create table tl_latask10_item_comment ( + uid bigint not null auto_increment, + comment varchar(255), + taskList_item_uid bigint, + create_by bigint, + create_date datetime, + primary key (uid) +); create table tl_latask10_session ( uid bigint not null auto_increment, session_end_date datetime, @@ -93,6 +114,10 @@ alter table tl_latask10_taskList_item add index FK_NEW_174079138_F52D1F93EC0D3147 (session_uid), add constraint FK_NEW_174079138_F52D1F93EC0D3147 foreign key (session_uid) references tl_latask10_session (uid); alter table tl_latask10_item_log add index FK_NEW_174079138_693580A438BF8DFE (taskList_item_uid), add constraint FK_NEW_174079138_693580A438BF8DFE foreign key (taskList_item_uid) references tl_latask10_taskList_item (uid); alter table tl_latask10_item_log add index FK_NEW_174079138_693580A441F9365D (user_uid), add constraint FK_NEW_174079138_693580A441F9365D foreign key (user_uid) references tl_latask10_user (uid); +alter table tl_latask10_item_attachment add index FK_tl_latask10_item_attachment_1 (taskList_item_uid), add constraint FK_tl_latask10_item_attachment_1 foreign key (taskList_item_uid) references tl_latask10_taskList (uid); +alter table tl_latask10_item_attachment add index FK_tl_latask10_item_attachment_2 (create_by), add constraint FK_tl_latask10_item_attachment_2 foreign key (create_by) references tl_latask10_user (uid); +alter table tl_latask10_item_comment add index FK_tl_latask10_item_comment_3 (taskList_item_uid), add constraint FK_tl_latask10_item_comment_3 foreign key (taskList_item_uid) references tl_latask10_taskList (uid); +alter table tl_latask10_item_comment add index FK_tl_latask10_item_comment_2 (create_by), add constraint FK_tl_latask10_item_comment_2 foreign key (create_by) references tl_latask10_user (uid); alter table tl_latask10_session add index FK_NEW_174079138_24AA78C530E79035 (taskList_uid), add constraint FK_NEW_174079138_24AA78C530E79035 foreign key (taskList_uid) references tl_latask10_taskList (uid); alter table tl_latask10_user add index FK_NEW_174079138_30113BFCEC0D3147 (session_uid), add constraint FK_NEW_174079138_30113BFCEC0D3147 foreign key (session_uid) references tl_latask10_session (uid); alter table tl_latask10_user add index FK_NEW_174079138_30113BFC309ED320 (taskList_uid), add constraint FK_NEW_174079138_30113BFC309ED320 foreign key (taskList_uid) references tl_latask10_taskList (uid); Index: lams_tool_task/db/sql/drop_lams_tool_taskList.sql =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/db/sql/drop_lams_tool_taskList.sql (.../drop_lams_tool_taskList.sql) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/db/sql/drop_lams_tool_taskList.sql (.../drop_lams_tool_taskList.sql) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -3,6 +3,8 @@ drop table if exists tl_latask10_taskList; drop table if exists tl_latask10_taskList_item; drop table if exists tl_latask10_item_log; +drop table if exists tl_latask10_item_attachment; +drop table if exists tl_latask10_item_comment; drop table if exists tl_latask10_session; drop table if exists tl_latask10_user; SET FOREIGN_KEY_CHECKS=1; Index: lams_tool_task/db/sql/table-schema.sql =================================================================== diff -u -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/db/sql/table-schema.sql (.../table-schema.sql) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/db/sql/table-schema.sql (.../table-schema.sql) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -1,6 +1,10 @@ alter table tl_latask10_attachment drop foreign key FK281134C2994F51CE; alter table tl_latask10_item_log drop foreign key FK6CFEC3773324488D; alter table tl_latask10_item_log drop foreign key FK6CFEC377B20A10E1; +alter table tl_latask10_item_attachment drop foreign key FK_tl_latask10_item_attachment_1; +alter table tl_latask10_item_attachment drop foreign key FK_tl_latask10_item_attachment_2; +alter table tl_latask10_item_comment drop foreign key FK_tl_latask10_item_comment_3; +alter table tl_latask10_item_comment drop foreign key FK_tl_latask10_item_comment_2; alter table tl_latask10_session drop foreign key FK3DC26357994F51CE; alter table tl_latask10_taskList drop foreign key FKE544722E5916D7F; alter table tl_latask10_taskList_item drop foreign key FK2DB1121025521843; @@ -11,20 +15,28 @@ drop table if exists tl_latask10_attachment; drop table if exists tl_latask10_item_instruction; drop table if exists tl_latask10_item_log; +drop table if exists tl_latask10_item_attachment; +drop table if exists tl_latask10_item_comment; drop table if exists tl_latask10_session; drop table if exists tl_latask10_taskList; drop table if exists tl_latask10_taskList_item; drop table if exists tl_latask10_user; create table tl_latask10_attachment (uid bigint not null auto_increment, file_version_id bigint, file_type varchar(255), file_name varchar(255), file_uuid bigint, create_date datetime, taskList_uid bigint, primary key (uid)); create table tl_latask10_item_instruction (uid bigint not null auto_increment, description varchar(255), sequence_id integer, primary key (uid)); create table tl_latask10_item_log (uid bigint not null auto_increment, access_date datetime, taskList_item_uid bigint, user_uid bigint, complete bit, session_id bigint, primary key (uid)); +create table tl_latask10_item_attachment (uid bigint not null auto_increment, file_version_id bigint, file_type varchar(255), file_name varchar(255), file_uuid bigint, create_date datetime, taskList_uid bigint, create_by bigint, primary key (uid)); +create table tl_latask10_item_comment (uid bigint not null auto_increment, comment varchar(255), taskList_item_uid bigint, create_by bigint, create_date datetime, primary key (uid)); create table tl_latask10_session (uid bigint not null auto_increment, session_end_date datetime, session_start_date datetime, status integer, taskList_uid bigint, session_id bigint, session_name varchar(250), primary key (uid)); create table tl_latask10_taskList (uid bigint not null auto_increment, create_date datetime, update_date datetime, create_by bigint, title varchar(255), run_offline bit, instructions text, online_instructions text, offline_instructions text, content_in_use bit, define_later bit, content_id bigint unique, lock_when_finished bit, allow_contribute_tasks bit, is_monitor_verification_required bit, is_sequential_order bit, reflect_instructions varchar(255), reflect_on_activity bit, primary key (uid)); create table tl_latask10_taskList_item (uid bigint not null auto_increment, description varchar(255), init_item varchar(255), organization_xml text, title varchar(255), create_by bigint, create_date datetime, create_by_author bit, is_hide bit, sequence_id integer, is_required bit, is_comments_allowed bit, show_comments_to_all bit, is_child_task bit, parent_task_name varchar(255), taskList_uid bigint, session_uid bigint, primary key (uid)); create table tl_latask10_user (uid bigint not null auto_increment, user_id bigint, last_name varchar(255), first_name varchar(255), login_name varchar(255), session_uid bigint, taskList_uid bigint, session_finished bit, primary key (uid)); alter table tl_latask10_attachment add index FK281134C2994F51CE (taskList_uid), add constraint FK281134C2994F51CE foreign key (taskList_uid) references tl_latask10_taskList (uid); alter table tl_latask10_item_log add index FK6CFEC3773324488D (taskList_item_uid), add constraint FK6CFEC3773324488D foreign key (taskList_item_uid) references tl_latask10_taskList_item (uid); alter table tl_latask10_item_log add index FK6CFEC377B20A10E1 (user_uid), add constraint FK6CFEC377B20A10E1 foreign key (user_uid) references tl_latask10_user (uid); +alter table tl_latask10_item_attachment add index FK_tl_latask10_item_attachment_1 (taskList_item_uid), add constraint FK_tl_latask10_item_attachment_1 foreign key (taskList_item_uid) references tl_latask10_taskList (uid); +alter table tl_latask10_item_attachment add index FK_tl_latask10_item_attachment_2 (create_by), add constraint FK_tl_latask10_item_attachment_2 foreign key (create_by) references tl_latask10_user (uid); +alter table tl_latask10_item_comment add index FK_tl_latask10_item_comment_3 (taskList_item_uid), add constraint FK_tl_latask10_item_comment_3 foreign key (taskList_item_uid) references tl_latask10_taskList (uid); +alter table tl_latask10_item_comment add index FK_tl_latask10_item_comment_2 (create_by), add constraint FK_tl_latask10_item_comment_2 foreign key (create_by) references tl_latask10_user (uid); alter table tl_latask10_session add index FK3DC26357994F51CE (taskList_uid), add constraint FK3DC26357994F51CE foreign key (taskList_uid) references tl_latask10_taskList (uid); alter table tl_latask10_taskList add index FKE544722E5916D7F (create_by), add constraint FKE544722E5916D7F foreign key (create_by) references tl_latask10_user (uid); alter table tl_latask10_taskList_item add index FK2DB1121025521843 (session_uid), add constraint FK2DB1121025521843 foreign key (session_uid) references tl_latask10_session (uid); Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/TaskListConstants.java =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/TaskListConstants.java (.../TaskListConstants.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/TaskListConstants.java (.../TaskListConstants.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -72,9 +72,15 @@ public static final String ATTR_FINISH_LOCK = "finishedLock"; public static final String ATTR_SESSION_MAP_ID = "sessionMapID"; public static final String ATTR_RESOURCE_FORM = "taskListForm"; + public static final String ATTR_TASKLIST_FORM = "taskListItemForm"; public static final String ATTR_FILE_TYPE_FLAG = "fileTypeFlag"; public static final String ATTR_TITLE = "title"; public static final String ATTR_USER_FINISHED = "userFinished"; + public static final String ATTR_TASK_LIST_ITEM = "taskListItem"; + public static final String ATTR_TASK_LIST_ITEM_TITLE = "taskListItemTitle"; + public static final String ATTR_TASK_LIST_ITEM_DESCRIPTION = "taskListItemDescription"; + public static final String ATTR_TASK_LIST_ITEM_ATTACHMENT_LIST = "taskListItemAttachmentList"; + public static final String ATTR_TASK_LIST_ITEM_COMMENT_LIST = "taskListItemCommentList"; //error message keys public static final String ERROR_MSG_TITLE_BLANK = "error.resource.item.title.blank"; Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemAttachmentDAO.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemAttachmentDAO.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemAttachmentDAO.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,29 @@ +/**************************************************************** + * 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.dao; + +public interface TaskListItemAttachmentDAO extends DAO { + +} + \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemCommentDAO.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemCommentDAO.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/TaskListItemCommentDAO.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,29 @@ +/**************************************************************** + * 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.dao; + +public interface TaskListItemCommentDAO extends DAO { + +} + \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemAttachmentDAOHibernate.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemAttachmentDAOHibernate.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemAttachmentDAOHibernate.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,31 @@ +/**************************************************************** + * 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.dao.hibernate; + +import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemAttachmentDAO; + +public class TaskListItemAttachmentDAOHibernate extends BaseDAOHibernate implements TaskListItemAttachmentDAO{ + +} + \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemCommentDAOHibernate.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemCommentDAOHibernate.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/dao/hibernate/TaskListItemCommentDAOHibernate.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,31 @@ +/**************************************************************** + * 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 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.dao.hibernate; + +import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemCommentDAO; + +public class TaskListItemCommentDAOHibernate extends BaseDAOHibernate implements TaskListItemCommentDAO{ + + +} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItem.java =================================================================== diff -u -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItem.java (.../TaskListItem.java) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItem.java (.../TaskListItem.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -24,6 +24,7 @@ package org.lamsfoundation.lams.tool.taskList.model; import java.util.Date; +import java.util.List; import org.apache.log4j.Logger; @@ -65,6 +66,9 @@ //DTO fields: private boolean complete; + private List uploadedFileList; + private List comments; + public Object clone(){ TaskListItem obj = null; try { @@ -262,5 +266,19 @@ public void setParentTaskName(String parentTaskName) { this.parentTaskName = parentTaskName; } + + public List getUploadedFileList() { + return uploadedFileList; + } + public void setUploadedFileList(List uploadedFileList) { + this.uploadedFileList = uploadedFileList; + } + + public List getComments() { + return comments; + } + public void setComments(List comments) { + this.comments = comments; + } } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemAttachment.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,177 @@ +/**************************************************************** + * 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 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.model; + +import java.util.Date; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.log4j.Logger; + + +/** + * @author Andrey Balan + * + * A Wrapper class for uploaded files. An Attachment cannot exist independently + * and must belong to a TaskListItem. + * + * + * @hibernate.class table="tl_latask10_item_attachment" + * + */ +public class TaskListItemAttachment implements Cloneable{ + private static final Logger log = Logger.getLogger(TaskListItemAttachment.class); + + private Long uid; + private Long fileUuid; + private Long fileVersionId; + private String fileType; + private String fileName; + private Date created; + private String 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(); + } + +// ********************************************************** + // get/set methods +// ********************************************************** + /** + * @hibernate.id column="uid" generator-class="native" + */ + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + /** + * @hibernate.property column="file_version_id" + * + */ + public Long getFileVersionId() { + return fileVersionId; + } + + public void setFileVersionId(Long version) { + this.fileVersionId = version; + } + + /** + * @hibernate.property column="file_type" + */ + public String getFileType() { + return fileType; + } + + public void setFileType(String type) { + this.fileType = type; + } + + /** + * @hibernate.property column="file_name" + */ + public String getFileName() { + return fileName; + } + + public void setFileName(String name) { + this.fileName = name; + } + + + /** + * @hibernate.property column="file_uuid" + * @return + */ + public Long getFileUuid() { + return fileUuid; + } + + public void setFileUuid(Long uuid) { + this.fileUuid = uuid; + } + /** + * @hibernate.property column="create_date" + * @return + */ + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + /** + * @hibernate.property column="create_by" + * @return + */ + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } +} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskListItemComment.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -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.model; + +import java.util.Date; +/** + * TaskList + * @author Andrey Balan + * + * @hibernate.class table="tl_latask10_item_comment" + * + */ +public class TaskListItemComment { + + private Long uid; + private String comment; + private TaskListItem taskListItem; + private TaskListUser createBy; + private Date createDate; + + /** + * @hibernate.property column="create_date" + * @return + */ + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + /** + * @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="create_by" + * cascade="none" + * @return + */ + public TaskListUser getCreateBy() { + return createBy; + } + public void setCreateBy(TaskListUser createBy) { + this.createBy = createBy; + } + /** + * @hibernate.property column="comment" + * @return + */ + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } +} Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -35,6 +35,7 @@ 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.TaskListSession; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; @@ -76,6 +77,18 @@ */ TaskListAttachment uploadInstructionFile(FormFile file, String type) throws UploadTaskListFileException; + + /** + * Upload tasklistItem file to repository. + * + * @param uploadFile + * @param fileType + * @param userLogin + * @return + * @throws UploadTaskListFileException + */ + TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, String fileType, String userLogin) throws UploadTaskListFileException; + //********** for user methods ************* /** * Create a new user in database. Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -75,6 +75,8 @@ import org.lamsfoundation.lams.tool.taskList.TaskListConstants; import org.lamsfoundation.lams.tool.taskList.dao.TaskListAttachmentDAO; import org.lamsfoundation.lams.tool.taskList.dao.TaskListDAO; +import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemAttachmentDAO; +import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemCommentDAO; import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemDAO; import org.lamsfoundation.lams.tool.taskList.dao.TaskListItemVisitDAO; import org.lamsfoundation.lams.tool.taskList.dao.TaskListSessionDAO; @@ -84,6 +86,7 @@ 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.TaskListItemVisitLog; import org.lamsfoundation.lams.tool.taskList.model.TaskListSession; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; @@ -102,17 +105,16 @@ * @author Dapeng.Ni * */ -public class TaskListServiceImpl implements - ITaskListService,ToolContentManager, ToolSessionManager, ToolContentImport102Manager - -{ +public class TaskListServiceImpl implements ITaskListService,ToolContentManager, ToolSessionManager, ToolContentImport102Manager { static Logger log = Logger.getLogger(TaskListServiceImpl.class.getName()); private TaskListDAO taskListDao; private TaskListItemDAO taskListItemDao; private TaskListAttachmentDAO taskListAttachmentDao; private TaskListUserDAO taskListUserDao; private TaskListSessionDAO taskListSessionDao; private TaskListItemVisitDAO taskListItemVisitDao; + private TaskListItemAttachmentDAO taskListItemAttachmentDao; + private TaskListItemCommentDAO taskListItemCommentDAO; //tool service private TaskListToolContentHandler taskListToolContentHandler; private MessageService messageService; @@ -209,7 +211,6 @@ } } - public TaskList getTaskListByContentId(Long contentId) { TaskList rs = taskListDao.getByContentId(contentId); if(rs == null){ @@ -218,7 +219,6 @@ return rs; } - public TaskList getDefaultContent(Long contentId) throws TaskListApplicationException { if (contentId == null) { @@ -255,6 +255,25 @@ return file; } + + public TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, String fileType, String userLogin) throws UploadTaskListFileException { + if(uploadFile == null || StringUtils.isEmpty(uploadFile.getFileName())) + throw new UploadTaskListFileException(messageService.getMessage("error.msg.upload.file.not.found",new Object[]{uploadFile})); + + //upload file to repository + NodeKey nodeKey = processFile(uploadFile,fileType); + + //create new attachement + TaskListItemAttachment file = new TaskListItemAttachment(); + file.setFileType(fileType); + file.setFileUuid(nodeKey.getUuid()); + file.setFileVersionId(nodeKey.getVersion()); + file.setFileName(uploadFile.getFileName()); + file.setCreated(new Timestamp(new Date().getTime())); + file.setCreateBy(userLogin); + + return file; + } public void createUser(TaskListUser taskListUser) { @@ -293,8 +312,11 @@ public void deleteTaskListAttachment(Long attachmentUid) { taskListAttachmentDao.removeObject(TaskListAttachment.class, attachmentUid); - } + + public void deleteTaskListItemAttachment(Long attachmentUid) { + taskListItemAttachmentDao.removeObject(TaskListItemAttachment.class, attachmentUid); + } public void saveOrUpdateTaskListItem(TaskListItem item) { Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemAttachmentComparator.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemAttachmentComparator.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemAttachmentComparator.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,49 @@ +/**************************************************************** + * 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.util; + +import java.util.Comparator; + +import org.lamsfoundation.lams.tool.taskList.model.TaskListItemAttachment; + +/** + * + * @author Andrey Balan + * + */ +public class TaskListItemAttachmentComparator implements Comparator { + + /** + * {@inheritDoc} + */ + public int compare(TaskListItemAttachment o1, TaskListItemAttachment o2) { + if(o1 != null && o2 != null){ + return o1.getCreated().compareTo(o2.getCreated()); + }else if(o1 != null) + return 1; + else + return -1; + } +} + \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemCommentComparator.java =================================================================== diff -u --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemCommentComparator.java (revision 0) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/util/TaskListItemCommentComparator.java (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,49 @@ +/**************************************************************** + * 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.util; + +import java.util.Comparator; + +import org.lamsfoundation.lams.tool.taskList.model.TaskListItemComment; + +/** + * + * @author Andrey Balan + * + */ +public class TaskListItemCommentComparator implements Comparator { + + /** + * {@inheritDoc} + */ + public int compare(TaskListItemComment o1, TaskListItemComment o2) { + if(o1 != null && o2 != null){ + return o1.getCreateDate().compareTo(o2.getCreateDate()); + }else if(o1 != null) + return 1; + else + return -1; + } +} + \ No newline at end of file Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java =================================================================== diff -u -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -83,8 +83,7 @@ private static Logger log = Logger.getLogger(AuthoringAction.class); - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) throws Exception{ + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String param = mapping.getParameter(); //-----------------------TaskList Author function --------------------------- Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -79,8 +79,7 @@ private static Logger log = Logger.getLogger(LearningAction.class); - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String param = mapping.getParameter(); //-----------------------TaskList Learner function --------------------------- @@ -95,11 +94,12 @@ if(param.equals("finish")){ return finish(mapping, form, request, response); } + if (param.equals("addtask")) { return addTask(mapping, form, request, response); } - if (param.equals("saveOrUpdateItem")) { - return saveOrUpdateItem(mapping, form, request, response); + if (param.equals("saveNewTask")) { + return saveNewTask(mapping, form, request, response); } //================ Reflection ======================= @@ -112,6 +112,7 @@ return mapping.findForward(TaskListConstants.ERROR); } + /** * Initial page for add taskList item (single file or URL). * @param mapping @@ -126,6 +127,7 @@ itemForm.setSessionMapID(WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID)); return mapping.findForward(TaskListConstants.SUCCESS); } + /** * Read taskList data from database and put them into HttpSession. It will redirect to init.do directly after this * method run successfully. @@ -231,6 +233,7 @@ return mapping.findForward(TaskListConstants.SUCCESS); } + /** * Mark taskList item as complete status. * @param mapping @@ -304,7 +307,7 @@ * @param response * @return */ - private ActionForward saveOrUpdateItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { + private ActionForward saveNewTask(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); Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/ViewItemAction.java (.../ViewItemAction.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -46,9 +46,11 @@ 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; @@ -58,11 +60,17 @@ 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; import org.lamsfoundation.lams.util.WebUtil; @@ -75,107 +83,40 @@ public class ViewItemAction extends Action { private static final Logger log = Logger.getLogger(ViewItemAction.class); - private static final String DEFUALT_PROTOCOL_REFIX = "http://"; - private static final String ALLOW_PROTOCOL_REFIX = new String("[http://|https://|ftp://|nntp://]"); - public ActionForward execute(ActionMapping mapping, ActionForm form, - HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { + public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, UploadTaskListFileException { String param = mapping.getParameter(); //-----------------------Display Learning Object function --------------------------- - if (param.equals("reviewItem")) { - return reviewItem(mapping, form, request, response); + if (param.equals("reviewTask")) { + return reviewTask(mapping, form, request, response); } + if (param.equals("addNewComment")) { + return addNewComment(mapping, form, request, response); + } + if (param.equals("uploadFile")) { + return uploadFile(mapping, form, request, response); + } return mapping.findForward(TaskListConstants.ERROR); } -// /** -// * 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 + * Read taskList data from database and put them into HttpSession. It will redirect to init.do directly after this + * method run successfully. + * + * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page", + * @throws ServletException + * */ - private ActionForward reviewItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { + private ActionForward reviewTask(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { 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); + 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)){ ITaskListService service = getTaskListService(); @@ -188,28 +129,174 @@ if(item == null){ return mapping.findForward(TaskListConstants.ERROR); } - - //these attribute will be use to instruction navigator page + + //these attribute will be use to instruction navigator page + request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); + request.setAttribute(AttributeNames.ATTR_MODE,mode); + request.setAttribute(TaskListConstants.ATTR_TOOL_SESSION_ID,sessionId); 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); + //basic information + sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM, item); + sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM_TITLE, item.getTitle()); + sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM_DESCRIPTION,item.getDescription()); + sessionMap.put(TaskListConstants.ATTR_TOOL_SESSION_ID,sessionId); - //TODO!!!!!!!!!!!!!!!!!!!!!!!!! -// sessionMap.put(TaskListConstants.ATTR_RESOURCE,taskList); + //init taskList item list + SortedSet commentList = getCommentList(sessionMap); + List dbComments = item.getComments(); + commentList.clear(); + if(dbComments != null){ + for(TaskListItemComment comment : dbComments){ + commentList.add(comment); + } + } + //init taskList item list + SortedSet attachmentList = getAttachmentList(sessionMap); + List dbAttachments = item.getUploadedFileList(); + attachmentList.clear(); + if(dbAttachments != null){ + for(TaskListItemAttachment comment : dbAttachments){ + attachmentList.add(comment); + } + } + return mapping.findForward(TaskListConstants.SUCCESS); + } + + /** + * Adds new user commment. + * @param mapping + * @param form + * @param request + * @param response + * @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); + } + + /** + * Uploads specified file to repository and associates it with current TaskListItem. + * @param mapping + * @param form + * @param type + * @param request + * @return + * @throws UploadTaskListFileException + */ + private ActionForward uploadFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws UploadTaskListFileException { + 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); + + FormFile file = (FormFile) taskListItemForm.getUploadedFile(); + if(file == null || StringUtils.isBlank(file.getFileName())) + return mapping.findForward(TaskListConstants.SUCCESS); + + //validate file size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors ); + if(!errors.isEmpty()){ + this.saveErrors(request, errors); + return mapping.findForward(TaskListConstants.SUCCESS); + } + + ITaskListService service = getTaskListService(); + //upload to repository + UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + TaskListItemAttachment att = service.uploadTaskListItemFile(file, IToolContentHandler.TYPE_ONLINE, user.getLogin()); + //handle session value + SortedSet attachmentList = getAttachmentList(sessionMap); + //add to attachmentList + attachmentList.add(att); + + + //finally persist taskListPO again + TaskListItem item = (TaskListItem) sessionMap.get(TaskListConstants.ATTR_TASK_LIST_ITEM); + List dbAttachments = item.getUploadedFileList(); + if(dbAttachments == null){ + dbAttachments = new ArrayList(); + item.setUploadedFileList(dbAttachments); + } + dbAttachments.add(att); + + //save content to DB + TaskList taskList = service.getTaskListBySessionId(sessionId); + service.saveOrUpdateTaskList(taskList); + + form.reset(mapping, request); + + return mapping.findForward(TaskListConstants.SUCCESS); } - //************************************************************************************* // Private methods //************************************************************************************* + /** * Return resoruce item according to ToolAccessMode. * @param request @@ -240,7 +327,7 @@ } /** - * List save current taskList items. + * Returns list of taskList items. * @param request * @return */ @@ -253,447 +340,148 @@ return list; } + /** + * Returns list of taskitem attachments. + * @param sessionMap + * @return + */ + private SortedSet getAttachmentList(SessionMap sessionMap) { + SortedSet list = (SortedSet) sessionMap.get(TaskListConstants.ATTR_TASK_LIST_ITEM_ATTACHMENT_LIST); + if(list == null){ + list = new TreeSet(new TaskListItemAttachmentComparator()); + sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM_ATTACHMENT_LIST,list); + } + return list; + } + /** + * Returns list of taskitem comments. + * @param sessionMap + * @return + */ + private SortedSet getCommentList(SessionMap sessionMap) { + SortedSet list = (SortedSet) sessionMap.get(TaskListConstants.ATTR_TASK_LIST_ITEM_COMMENT_LIST); + if(list == null){ + list = new TreeSet(new TaskListItemCommentComparator()); + sessionMap.put(TaskListConstants.ATTR_TASK_LIST_ITEM_COMMENT_LIST,list); + } + return list; + } -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// // /** -// * Read taskList data from database and put them into HttpSession. It will redirect to init.do directly after this -// * method run successfully. -// * -// * This method will avoid read database again and lost un-saved resouce item lost when user "refresh page", -// * @throws ServletException -// * -// */ -// private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { -// -// 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); -// } -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// //save toolContentID into HTTPSession -// Long contentId = new Long(WebUtil.readLongParam(request,TaskListConstants.PARAM_TOOL_CONTENT_ID)); -// -//// get back the taskList and item list and display them on page -// ITaskListService service = getTaskListService(); -// -// List items = null; -// TaskList taskList = null; -// TaskListForm taskListForm = (TaskListForm)form; -// -// // Get contentFolderID and save to form. -// String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); -// taskListForm.setContentFolderID(contentFolderID); -// -// //initial Session Map -// SessionMap sessionMap = new SessionMap(); -// request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); -// taskListForm.setSessionMapID(sessionMap.getSessionID()); -// -// try { -// taskList = service.getTaskListByContentId(contentId); -// //if taskList does not exist, try to use default content instead. -// if(taskList == null){ -// taskList = service.getDefaultContent(contentId); -// if(taskList.getTaskListItems() != null){ -// items = new ArrayList(taskList.getTaskListItems()); -// }else -// items = null; -// }else -// items = service.getAuthoredItems(taskList.getUid()); -// -// taskListForm.setTaskList(taskList); -// -// //initialize instruction attachment list -// List attachmentList = getAttachmentList(sessionMap); -// attachmentList.clear(); -// attachmentList.addAll(taskList.getAttachments()); -// } catch (Exception e) { -// log.error(e); -// throw new ServletException(e); -// } -// -// //init it to avoid null exception in following handling -// if(items == null) -// items = new ArrayList(); -// else{ -// TaskListUser taskListUser = null; -// //handle system default question: createBy is null, now set it to current user -// for (TaskListItem item : items) { -// if(item.getCreateBy() == null){ -// if(taskListUser == null){ -// //get back login user DTO -// HttpSession ss = SessionManager.getSession(); -// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); -// taskListUser = new TaskListUser(user,taskList); -// } -// item.setCreateBy(taskListUser); -// } -// } -// } -// //init taskList item list -// SortedSet taskListItemList = getTaskListItemList(sessionMap); -// taskListItemList.clear(); -// taskListItemList.addAll(items); -// -// sessionMap.put(TaskListConstants.ATTR_RESOURCE_FORM, taskListForm); -// return mapping.findForward(TaskListConstants.SUCCESS); -// } -// -// -// /** -// * Display same entire authoring page content from HttpSession variable. +// * Open url in popup window page. // * @param mapping // * @param form // * @param request // * @param response // * @return -// * @throws ServletException // */ -// private ActionForward initPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, -// HttpServletResponse response) throws ServletException { -// String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); -// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); -// TaskListForm existForm = (TaskListForm) sessionMap.get(TaskListConstants.ATTR_RESOURCE_FORM); -// -// TaskListForm taskListForm = (TaskListForm )form; -// try { -// PropertyUtils.copyProperties(taskListForm, existForm); -// } catch (Exception e) { -// throw new ServletException(e); -// } -// -// ToolAccessMode mode = getAccessMode(request); -// if(mode.isAuthor()) -// return mapping.findForward(TaskListConstants.SUCCESS); -// else -// return mapping.findForward(TaskListConstants.DEFINE_LATER); +// 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); // } + // /** -// * This method will persist all inforamtion in this authoring page, include all taskList item, information etc. -// * +// * 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 -// * @throws ServletException // */ -// private ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, -// HttpServletResponse response) throws Exception { -// TaskListForm taskListForm = (TaskListForm)(form); +// private ActionForward nextInstruction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { +// String mode = request.getParameter(AttributeNames.ATTR_MODE); // -// //get back sessionMAP -// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(taskListForm.getSessionMapID()); -// -// ToolAccessMode mode = getAccessMode(request); -// -// ActionMessages errors = validate(taskListForm, mapping, request); -// if(!errors.isEmpty()){ -// saveErrors(request, errors); -// if(mode.isAuthor()) -// return mapping.findForward("author"); -// else -// return mapping.findForward("monitor"); +// 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); // } -// // -// TaskList taskList = taskListForm.getTaskList(); -// ITaskListService service = getTaskListService(); +// int currIns = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_CURRENT_INSTRUCTION_INDEX),0); // -// //**********************************Get TaskList PO********************* -// TaskList taskListPO = service.getTaskListByContentId(taskListForm.getTaskList().getContentId()); -// if(taskListPO == null){ -// //new TaskList, create it. -// taskListPO = taskList; -// taskListPO.setCreated(new Timestamp(new Date().getTime())); -// taskListPO.setUpdated(new Timestamp(new Date().getTime())); +// 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{ -// if(mode.isAuthor()){ -// Long uid = taskListPO.getUid(); -// PropertyUtils.copyProperties(taskListPO,taskList); -// //get back UID -// taskListPO.setUid(uid); -// }else{ //if it is Teacher, then just update basic tab content (definelater) -// taskListPO.setInstructions(taskList.getInstructions()); -// taskListPO.setTitle(taskList.getTitle()); -//// change define later status -// taskListPO.setDefineLater(false); -// } -// taskListPO.setUpdated(new Timestamp(new Date().getTime())); +// navDto.setAllInstructions(new ArrayList(instructions)); // } -// -// //*******************************Handle user******************* -// //try to get form system session -// HttpSession ss = SessionManager.getSession(); -// //get back login user DTO -// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); -// TaskListUser taskListUser = service.getUserByIDAndContent(new Long(user.getUserID().intValue()) -// ,taskListForm.getTaskList().getContentId()); -// if(taskListUser == null){ -// taskListUser = new TaskListUser(user,taskListPO); +// 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); // } // -// taskListPO.setCreatedBy(taskListUser); -// -// //**********************************Handle Authoring Instruction Attachement ********************* -// //merge attachment info -// //so far, attPOSet will be empty if content is existed. because PropertyUtils.copyProperties() is executed -// Set attPOSet = taskListPO.getAttachments(); -// if(attPOSet == null) -// attPOSet = new HashSet(); -// List attachmentList = getAttachmentList(sessionMap); -// List deleteAttachmentList = getDeletedAttachmentList(sessionMap); -// -// //current attachemnt in authoring instruction tab. -// Iterator iter = attachmentList.iterator(); -// while(iter.hasNext()){ -// TaskListAttachment newAtt = (TaskListAttachment) iter.next(); -// attPOSet.add(newAtt); -// } -// attachmentList.clear(); -// -// //deleted attachment. 2 possible types: one is persist another is non-persist before. -// iter = deleteAttachmentList.iterator(); -// while(iter.hasNext()){ -// TaskListAttachment delAtt = (TaskListAttachment) iter.next(); -// iter.remove(); -// //it is an existed att, then delete it from current attachmentPO -// if(delAtt.getUid() != null){ -// Iterator attIter = attPOSet.iterator(); -// while(attIter.hasNext()){ -// TaskListAttachment att = (TaskListAttachment) attIter.next(); -// if(delAtt.getUid().equals(att.getUid())){ -// attIter.remove(); -// break; -// } -// } -// service.deleteTaskListAttachment(delAtt.getUid()); -// }//end remove from persist value -// } -// -// //copy back -// taskListPO.setAttachments(attPOSet); -// //************************* Handle taskList items ******************* -// //Handle taskList items -// Set itemList = new LinkedHashSet(); -// SortedSet topics = getTaskListItemList(sessionMap); -// iter = topics.iterator(); -// while(iter.hasNext()){ -// TaskListItem item = (TaskListItem) iter.next(); -// if(item != null){ -// //This flushs user UID info to message if this user is a new user. -// item.setCreateBy(taskListUser); -// itemList.add(item); -// } -// } -// taskListPO.setTaskListItems(itemList); -// //delete instructino file from database. -// List delTaskListItemList = getDeletedTaskListItemList(sessionMap); -// iter = delTaskListItemList.iterator(); -// while(iter.hasNext()){ -// TaskListItem item = (TaskListItem) iter.next(); -// iter.remove(); -// if(item.getUid() != null) -// service.deleteTaskListItem(item.getUid()); -// } -// //handle taskList item attachment file: -// List delItemAttList = getDeletedItemAttachmentList(sessionMap); -// iter = delItemAttList.iterator(); -// while(iter.hasNext()){ -// TaskListItem delAtt = (TaskListItem) iter.next(); -// iter.remove(); -// } -// -// //********************************************** -// //finally persist taskListPO again -// service.saveOrUpdateTaskList(taskListPO); -// -// //initialize attachmentList again -// attachmentList = getAttachmentList(sessionMap); -// attachmentList.addAll(taskList.getAttachments()); -// taskListForm.setTaskList(taskListPO); -// -// request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE); -// if(mode.isAuthor()) -// return mapping.findForward("author"); -// else -// return mapping.findForward("monitor"); +// request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID,sessionMapID); +// request.setAttribute(TaskListConstants.ATTR_RESOURCE_INSTRUCTION,navDto); +// return mapping.findForward(TaskListConstants.SUCCESS); // } // +// // /** -// * Handle upload online instruction files request. +// * Display main frame to display instrcution and item content. // * @param mapping // * @param form // * @param request // * @param response // * @return -// * @throws UploadTaskListFileException // */ -// public ActionForward uploadOnline(ActionMapping mapping, ActionForm form, -// HttpServletRequest request, HttpServletResponse response) throws UploadTaskListFileException { -// return uploadFile(mapping, form, IToolContentHandler.TYPE_ONLINE,request); -// } -// /** -// * Common method to upload online or offline instruction files request. -// * @param mapping -// * @param form -// * @param type -// * @param request -// * @return -// * @throws UploadTaskListFileException -// */ -// private ActionForward uploadFile(ActionMapping mapping, ActionForm form, -// String type,HttpServletRequest request) throws UploadTaskListFileException { -// -// TaskListForm taskListForm = (TaskListForm) form; -// //get back sessionMAP -// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(taskListForm.getSessionMapID()); -// -// FormFile file; -// if(StringUtils.equals(IToolContentHandler.TYPE_OFFLINE,type)) -// file = (FormFile) taskListForm.getOfflineFile(); -// else -// file = (FormFile) taskListForm.getOnlineFile(); +// private ActionForward reviewItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { +// String mode = request.getParameter(AttributeNames.ATTR_MODE); // -// if(file == null || StringUtils.isBlank(file.getFileName())) -// return mapping.findForward(TaskListConstants.SUCCESS); +// String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); +// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); // -// //validate file size -// ActionMessages errors = new ActionMessages(); -// FileValidatorUtil.validateFileSize(file, true, errors ); -// if(!errors.isEmpty()){ -// this.saveErrors(request, errors); -// return mapping.findForward(TaskListConstants.SUCCESS); +// 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); // } // -// ITaskListService service = getTaskListService(); -// //upload to repository -// TaskListAttachment att = service.uploadInstructionFile(file, type); -// //handle session value -// List attachmentList = getAttachmentList(sessionMap); -// List deleteAttachmentList = getDeletedAttachmentList(sessionMap); -// //first check exist attachment and delete old one (if exist) to deletedAttachmentList -// Iterator iter = attachmentList.iterator(); -// TaskListAttachment existAtt; -// while(iter.hasNext()){ -// existAtt = (TaskListAttachment) iter.next(); -// if(StringUtils.equals(existAtt.getFileName(),att.getFileName())){ -// //if there is same name attachment, delete old one -// deleteAttachmentList.add(existAtt); -// iter.remove(); -// break; -// } +// if(item == null){ +// return mapping.findForward(TaskListConstants.ERROR); // } -// //add to attachmentList -// attachmentList.add(att); // -// return mapping.findForward(TaskListConstants.SUCCESS); -// -// } -// /** -// * Delete online instruction file from current TaskList authoring page. -// * @param mapping -// * @param form -// * @param request -// * @param response -// * @return -// */ -// public ActionForward deleteOnlineFile(ActionMapping mapping, ActionForm form, -// HttpServletRequest request, HttpServletResponse response) { -// return deleteFile(mapping, request, response,form, IToolContentHandler.TYPE_ONLINE); -// } -// -// /** -// * General method to delete file (online or offline) -// * @param mapping -// * @param request -// * @param response -// * @param form -// * @param type -// * @return -// */ -// private ActionForward deleteFile(ActionMapping mapping, HttpServletRequest request, HttpServletResponse response, ActionForm form, String type) { -// Long versionID = new Long(WebUtil.readLongParam(request,TaskListConstants.PARAM_FILE_VERSION_ID)); -// Long uuID = new Long(WebUtil.readLongParam(request,TaskListConstants.PARAM_FILE_UUID)); +// //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); // -// //get back sessionMAP -// String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); -// SessionMap sessionMap = (SessionMap)request.getSession().getAttribute(sessionMapID); // -// //handle session value -// List attachmentList = getAttachmentList(sessionMap); -// List deleteAttachmentList = getDeletedAttachmentList(sessionMap); -// //first check exist attachment and delete old one (if exist) to deletedAttachmentList -// Iterator iter = attachmentList.iterator(); -// TaskListAttachment existAtt; -// while(iter.hasNext()){ -// existAtt = (TaskListAttachment) iter.next(); -// if(existAtt.getFileUuid().equals(uuID) && existAtt.getFileVersionId().equals(versionID)){ -// //if there is same name attachment, delete old one -// deleteAttachmentList.add(existAtt); -// iter.remove(); -// } -// } -// -// request.setAttribute(TaskListConstants.ATTR_FILE_TYPE_FLAG, type); -// 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 -r98c5d28841932a01a986591dd46c12881c9a8b7b -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision 98c5d28841932a01a986591dd46c12881c9a8b7b) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -24,6 +24,8 @@ package org.lamsfoundation.lams.tool.taskList.web.form; import org.apache.struts.action.ActionForm; +import org.apache.struts.upload.FormFile; +import org.lamsfoundation.lams.tool.taskList.model.TaskListItemComment; /** * TaskList Item Form. * @struts.form name="taskListItemForm" @@ -48,6 +50,9 @@ private String parentTaskName; + private FormFile uploadedFile; + private TaskListItemComment comment; + public String getDescription() { return description; } @@ -113,4 +118,18 @@ public void setParentTaskName(String parentTaskName) { this.parentTaskName = parentTaskName; } + + public FormFile getUploadedFile() { + return uploadedFile; + } + public void setUploadedFile(FormFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public TaskListItemComment getComment() { + return comment; + } + public void setComment(TaskListItemComment comment) { + this.comment = comment; + } } Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/initnav.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/instructionsnav.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/mainframe.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/openurl.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/taskfilelist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e12e54b34d1312f79a1c8b1fb3662fb5a6da9676 refers to a dead (removed) revision in file `lams_tool_task/web/pages/itemreview/taskreview.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_task/web/pages/learning/addtask.jsp =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/web/pages/learning/addtask.jsp (.../addtask.jsp) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/web/pages/learning/addtask.jsp (.../addtask.jsp) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -9,7 +9,7 @@ - + Index: lams_tool_task/web/pages/learning/learning.jsp =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -re12e54b34d1312f79a1c8b1fb3662fb5a6da9676 --- lams_tool_task/web/pages/learning/learning.jsp (.../learning.jsp) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/web/pages/learning/learning.jsp (.../learning.jsp) (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -27,7 +27,7 @@ return false; } function viewItem(itemUid){ - var myUrl = "?sessionMapID=${sessionMapID}&mode=${mode}&toolSessionID=${toolSessionID}&itemUid=" + itemUid; + var myUrl = "?sessionMapID=${sessionMapID}&mode=${mode}&toolSessionID=${toolSessionID}&itemUid=" + itemUid; launchPopup(myUrl,"LearnerView"); } function completeItem(itemUid){ Index: lams_tool_task/web/pages/reviewtask/initnav.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/initnav.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/initnav.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,25 @@ +<%-- +To avoid use HttpSession (LDEV-199), try to +use request.setAttribute() transfer value. But this page is embeded into a Frame html page, directly +request can not block on frame page, so use this trick page redirect request, then server side could handle this +request using this page as target +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + Index: lams_tool_task/web/pages/reviewtask/instructionsnav.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/instructionsnav.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/instructionsnav.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,102 @@ + +<%@ include file="/common/taglibs.jsp"%> + + +<%-- runAuto and reflectOn does not set when authoring preview mode then set false as default value --%> + + + + + + + + + + + + + + + + + + + + + ${instructions.title} + + <%@ include file="/common/header.jsp"%> + + <%-- param has higher level for request attribute --%> + + + + + + + +
+

+ + +

+ + + + + + + + + + + + + + +

+ + + + + ${instructions.instruction.description} + +

+ + + + + +
+ +
Index: lams_tool_task/web/pages/reviewtask/mainframe.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/mainframe.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/mainframe.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,53 @@ +<%-- +Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) +License Information: http://lamsfoundation.org/licensing/lams/2.0/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + USA + + http://www.gnu.org/licenses/gpl.txt +--%> +<%@ include file="/common/taglibs.jsp"%> + + ?mode=${mode}&itemIndex=${itemIndex}&itemUid=${itemUid}&toolSessionID=${toolSessionID}&sessionMapID=${sessionMapID}" + name=headerFrame " marginheight="0" scrolling="YES"> + + + +<%-- +To avoid use HttpSession (LDEV-199), try to +use request.setAttribute() transfer value. But this page is embeded into a Frame html page, directly +request can not block on frame page, so use this trick page redirect request, then server side could handle this +request using this page as target +--%> + +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + Index: lams_tool_task/web/pages/reviewtask/openurl.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/openurl.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/openurl.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,18 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + <%@ include file="/common/header.jsp"%> + + + +
+

${title}

+

+
+ + Index: lams_tool_task/web/pages/reviewtask/reviewtask.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/reviewtask.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/reviewtask.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,120 @@ + +<%@ include file="/common/taglibs.jsp"%> +<%-- +<%@ page import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> +<%@ page import="org.lamsfoundation.lams.tool.taskList.TaskListConstants"%> + --%> + + + + + <fmt:message key="label.learning.title" /> + <%@ include file="/common/header.jsp"%> + + + + + + + + + +
+ + + + + + + +

${sessionMap.taskListItemTitle}

+ +

${sessionMap.taskListItemDescription}

+ + +<%@ include file="topiclist.jsp"%> + + + +
+ + + AAA + BBB + CCC + + + + + + + +<%-- + + + +--%> + + + + + + + +
+ +
+
+
+ +
+ +
+
+ + + <%-- Display target file type --%> +
    + +
  • + + + + [${file.createBy}] + + + + + + + + + +
  • +
    +
+
+
+
+ +
+ + + + + + +
+ + + + + + Index: lams_tool_task/web/pages/reviewtask/start.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/start.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/start.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,16 @@ + + +<%@ include file="/common/taglibs.jsp"%> + + + + <%-- --%> + + + + + + Index: lams_tool_task/web/pages/reviewtask/taskfilelist.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/taskfilelist.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/taskfilelist.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,43 @@ +<%@ include file="/common/taglibs.jsp"%> +<%@ page + import="org.lamsfoundation.lams.contentrepository.client.IToolContentHandler"%> + +" / + + + +<%-- check whehter has target file type --%> + + + + + + +<%-- Display target file type --%> + +
    + + +
  • + + + + + + + + + + + + + + + + + +
  • +
    +
    +
+
Index: lams_tool_task/web/pages/reviewtask/topiclist.jsp =================================================================== diff -u --- lams_tool_task/web/pages/reviewtask/topiclist.jsp (revision 0) +++ lams_tool_task/web/pages/reviewtask/topiclist.jsp (revision e12e54b34d1312f79a1c8b1fb3662fb5a6da9676) @@ -0,0 +1,36 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + ${author} + + +