Index: lams_tool_task/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/conf/language/lams/ApplicationResources.properties,v diff -u -r1.13 -r1.14 --- lams_tool_task/conf/language/lams/ApplicationResources.properties 22 May 2008 07:34:35 -0000 1.13 +++ lams_tool_task/conf/language/lams/ApplicationResources.properties 23 May 2008 10:49:13 -0000 1.14 @@ -57,6 +57,7 @@ label.authoring.advance.monitor.verification.required =Monitor need to verify these tasks before letting participants to complete activity label.authoring.advanced.reflectOnActivity =Add Notebook at end of Task List with the following instructions: label.authoring.advance.run.content.sequentialOrder =Tasks have to be completed in sequential order +label.authoring.advance.minimum.number.tasks =Minimum number of tasks to complete label.authoring.cancel.button =Cancel label.authoring.edit.conditions.button =Edit Conditions label.authoring.save.button =Save @@ -93,6 +94,9 @@ label.learning.info.comment.and.attachment.required =You are required to post a comment and upload an attachment to complete this task. label.learning.info.post.comment.required =You are required to post a comment to complete this task. label.learning.info.upload.attachment.required =You are required to upload an attachment to complete this task. +label.learning.notification.you.must.complete.tasks.1 =You should complete at least +label.learning.notification.you.must.complete.tasks.2 =more tasks. +lable.learning.minimum.view.number.less =You should complete at least {0} more tasks. label.preview.upload.file =Upload file label.preview.upload.button =Upload label.preview.filelist =File list Index: lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.12 -r1.13 --- lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties 22 May 2008 07:34:35 -0000 1.12 +++ lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties 23 May 2008 10:49:13 -0000 1.13 @@ -53,6 +53,7 @@ label.authoring.advance.monitor.verification.required =Monitor need to verify these tasks before letting participants to complete activity label.authoring.advanced.reflectOnActivity =Add Notebook at end of Task List with the following instructions: label.authoring.advance.run.content.sequentialOrder =Tasks have to be completed in sequential order +label.authoring.advance.minimum.number.tasks =Minimum number of tasks to complete label.authoring.cancel.button =Cancel label.authoring.save.button =Save authoring.msg.cancel.save =Do you want to close this window without saving? @@ -78,6 +79,9 @@ label.learning.info.comment.and.attachment.required =You are required to post a comment and upload an attachment to complete this task. label.learning.info.post.comment.required =You are required to post a comment to complete this task. label.learning.info.upload.attachment.required =You are required to upload an attachment to complete this task. +label.learning.notification.you.must.complete.tasks.1 =You should complete at least +label.learning.notification.you.must.complete.tasks.2 =more tasks. +lable.learning.minimum.view.number.less =You should complete at least {0} more tasks. label.preview.upload.file =Upload file label.preview.upload.button =Upload label.preview.filelist =File list Index: lams_tool_task/conf/language/rams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/conf/language/rams/Attic/ApplicationResources.properties,v diff -u -r1.8 -r1.9 --- lams_tool_task/conf/language/rams/ApplicationResources.properties 22 May 2008 07:34:36 -0000 1.8 +++ lams_tool_task/conf/language/rams/ApplicationResources.properties 23 May 2008 10:49:12 -0000 1.9 @@ -57,6 +57,7 @@ label.authoring.advance.monitor.verification.required =Monitor need to verify these tasks before letting participants to complete activity label.authoring.advanced.reflectOnActivity =Add Notebook at end of Task List with the following instructions: label.authoring.advance.run.content.sequentialOrder =Tasks have to be completed in sequential order +label.authoring.advance.minimum.number.tasks =Minimum number of tasks to complete label.authoring.cancel.button =Cancel label.authoring.edit.conditions.button =Edit Conditions label.authoring.save.button =Save @@ -93,6 +94,9 @@ label.learning.info.comment.and.attachment.required =You are required to post a comment and upload an attachment to complete this task. label.learning.info.post.comment.required =You are required to post a comment to complete this task. label.learning.info.upload.attachment.required =You are required to upload an attachment to complete this task. +label.learning.notification.you.must.complete.tasks.1 =You should complete at least +label.learning.notification.you.must.complete.tasks.2 =more tasks. +lable.learning.minimum.view.number.less =You should complete at least {0} more tasks. label.preview.upload.file =Upload file label.preview.upload.button =Upload label.preview.filelist =File list Index: lams_tool_task/conf/language/rams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/conf/language/rams/Attic/ApplicationResources_en_AU.properties,v diff -u -r1.8 -r1.9 --- lams_tool_task/conf/language/rams/ApplicationResources_en_AU.properties 22 May 2008 07:34:36 -0000 1.8 +++ lams_tool_task/conf/language/rams/ApplicationResources_en_AU.properties 23 May 2008 10:49:12 -0000 1.9 @@ -57,6 +57,7 @@ label.authoring.advance.monitor.verification.required =Monitor need to verify these tasks before letting participants to complete activity label.authoring.advanced.reflectOnActivity =Add Notebook at end of Task List with the following instructions: label.authoring.advance.run.content.sequentialOrder =Tasks have to be completed in sequential order +label.authoring.advance.minimum.number.tasks =Minimum number of tasks to complete label.authoring.cancel.button =Cancel label.authoring.edit.conditions.button =Edit Conditions label.authoring.save.button =Save @@ -93,6 +94,9 @@ label.learning.info.comment.and.attachment.required =You are required to post a comment and upload an attachment to complete this task. label.learning.info.post.comment.required =You are required to post a comment to complete this task. label.learning.info.upload.attachment.required =You are required to upload an attachment to complete this task. +label.learning.notification.you.must.complete.tasks.1 =You should complete at least +label.learning.notification.you.must.complete.tasks.2 =more tasks. +lable.learning.minimum.view.number.less =You should complete at least {0} more tasks. label.preview.upload.file =Upload file label.preview.upload.button =Upload label.preview.filelist =File list Index: lams_tool_task/db/model/taskList.clay =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/db/model/taskList.clay,v diff -u -r1.10 -r1.11 Binary files differ Index: lams_tool_task/db/sql/create_lams_tool_taskList.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/db/sql/create_lams_tool_taskList.sql,v diff -u -r1.11 -r1.12 --- lams_tool_task/db/sql/create_lams_tool_taskList.sql 22 May 2008 07:34:34 -0000 1.11 +++ lams_tool_task/db/sql/create_lams_tool_taskList.sql 23 May 2008 10:49:12 -0000 1.12 @@ -46,6 +46,7 @@ content_id bigint unique, lock_when_finished tinyint, is_sequential_order tinyint, + minimum_number_tasks_complete integer, allow_contribute_tasks tinyint, is_monitor_verification_required tinyint, reflect_instructions varchar(255), @@ -145,10 +146,11 @@ -INSERT INTO `tl_latask10_taskList` (`uid`, `create_date`, `update_date`, `create_by`, `title`, `run_offline`, - `instructions`, `online_instructions`, `offline_instructions`, `content_in_use`, `define_later`, `content_id`, - `lock_when_finished`, `is_sequential_order`, `allow_contribute_tasks`, `is_monitor_verification_required`, `reflect_on_activity`) VALUES - (1,NULL,NULL,NULL,'TaskList','0','Instructions ',null,null,0,0,${default_content_id},0,0,0,0,0); +INSERT INTO `tl_latask10_taskList` (`uid`, `create_date`, `update_date`, `create_by`, `title`, `run_offline`, `instructions`, + `online_instructions`, `offline_instructions`, `content_in_use`, `define_later`, `content_id`, `lock_when_finished`, + `minimum_number_tasks_complete`, `is_sequential_order`, `allow_contribute_tasks`, `is_monitor_verification_required`, + `reflect_on_activity`) VALUES + (1,NULL,NULL,NULL,'TaskList','0','Instructions ',null,null,0,0,${default_content_id},0,0,0,0,0,0); INSERT INTO `tl_latask10_taskList_item` (`uid`, `sequence_id`, `description`, `init_item`, `organization_xml`, `title`, `create_by`, `create_date`, `create_by_author`, `is_required`, `is_comments_allowed`, `is_comments_required`, `is_files_allowed`, `is_files_required`, `is_comments_files_allowed`, `show_comments_to_all`, `is_child_task`, `parent_task_name`, `taskList_uid`, `session_uid`) VALUES (1,1,NULL,NULL,NULL,'Task number 1',null,NOW(),1,0,0,0,0,0,0,1,0,NULL,1,NULL); Index: lams_tool_task/db/sql/table-schema.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/db/sql/table-schema.sql,v diff -u -r1.8 -r1.9 --- lams_tool_task/db/sql/table-schema.sql 22 May 2008 07:34:34 -0000 1.8 +++ lams_tool_task/db/sql/table-schema.sql 23 May 2008 10:49:12 -0000 1.9 @@ -27,7 +27,7 @@ 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 text, 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 (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, minimum_number_tasks_complete integer, 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 text, init_item varchar(255), organization_xml text, title varchar(255), create_by bigint, create_date datetime, create_by_author bit, sequence_id integer, is_required bit, is_comments_allowed bit, is_comments_required bit, is_files_allowed bit, is_files_required bit, is_comments_files_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, is_verified_by_monitor bit, primary key (uid)); Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/Attic/TaskList.hbm.xml,v diff -u -r1.2 -r1.3 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.hbm.xml 9 Apr 2008 02:03:29 -0000 1.2 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.hbm.xml 23 May 2008 10:49:12 -0000 1.3 @@ -209,6 +209,14 @@ /> + + TaskList by toolContentID. @@ -225,7 +225,7 @@ * @param item current TaskListItem * @return */ - public void saveOrUpdateTaskListItem(TaskListItem item); + void saveOrUpdateTaskListItem(TaskListItem item); /** * Fill in taskListItemList's complete flags. @@ -277,6 +277,15 @@ * @return */ String finishToolSession(Long toolSessionId, Long userId) throws TaskListException; + + /** + * Checks how many tasks more user should complete to be able to finish this activity. + * + * @param toolSessionId + * @param userUid + * @return + */ + int checkMinimumNumberTasksComplete(Long toolSessionId, Long userUid); /** * Create refection entry into notebook tool. @@ -287,7 +296,7 @@ * @param userId * @param entryText */ - public Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, String entryText); + Long createNotebookEntry(Long sessionId, Integer notebookToolType, String toolSignature, Integer userId, String entryText); /** * Get reflection entry from notebook tool. @@ -298,12 +307,12 @@ * @param userID * @return */ - public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID); + NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID); /** * @param notebookEntry */ - public void updateEntry(NotebookEntry notebookEntry); + void updateEntry(NotebookEntry notebookEntry); //********** Export methods *********************** @@ -315,15 +324,15 @@ * * @return */ - public List exportForLearner(Long contentUid, TaskListUser learner); + List exportForLearner(Long contentUid, TaskListUser learner); /** * Make an export for the whole TaskList. * * @param contentUid * @return */ - public List exportForTeacher(Long contentUid); + List exportForTeacher(Long contentUid); /** * Return summary list for the specified TaskList. Used in monitoring. Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java,v diff -u -r1.15 -r1.16 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 22 May 2008 07:34:36 -0000 1.15 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java 23 May 2008 10:49:13 -0000 1.16 @@ -357,6 +357,18 @@ } return nextUrl; } + + public int checkMinimumNumberTasksComplete(Long toolSessionId, Long userUid) { + int miniView = taskListItemVisitDao.getTasksCompletedCountByUser(toolSessionId, userUid); + TaskListSession session = taskListSessionDao.getSessionBySessionId(toolSessionId); + if(session == null){ + log.error("Failed get session by ID [" + toolSessionId + "]"); + return 0; + } + int reqView = session.getTaskList().getMinimumNumberTasksComplete(); + + return (reqView - miniView); + } /** Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java,v diff -u -r1.12 -r1.13 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java 22 May 2008 07:34:34 -0000 1.12 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java 23 May 2008 10:49:12 -0000 1.13 @@ -428,6 +428,9 @@ service.deleteTaskListItem(item.getUid()); } + //if MinimumNumberTasksComplete is bigger than available items, then set it topics size + if(taskListPO.getMinimumNumberTasksComplete() > items.size()) + taskListPO.setMinimumNumberTasksComplete(items.size()); //********************************************** //finally persist taskListPO again Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java,v diff -u -r1.8 -r1.9 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 22 May 2008 07:34:34 -0000 1.8 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java 23 May 2008 10:49:12 -0000 1.9 @@ -324,7 +324,9 @@ }else request.setAttribute(TaskListConstants.ATTR_RUN_AUTO,false); - + if(!validateBeforeFinish(request, sessionMapID)) + return mapping.getInputForward(); + ITaskListService service = getTaskListService(); // get sessionId from HttpServletRequest String nextActivityUrl = null ; @@ -523,6 +525,9 @@ //get session value String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID); + if(!validateBeforeFinish(request, sessionMapID)) + return mapping.getInputForward(); + ReflectionForm refForm = (ReflectionForm) form; HttpSession ss = SessionManager.getSession(); UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); @@ -626,6 +631,31 @@ return errors; } + + private boolean validateBeforeFinish(HttpServletRequest request, String sessionMapID) { + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + Long userID = new Long(user.getUserID().longValue()); + + ITaskListService service = getTaskListService(); + int miniViewFlag = service.checkMinimumNumberTasksComplete(sessionId, userID); + //if current user view less than reqired view count number, then just return error message. + //if it is runOffline content, then need not check minimum view count + Boolean runOffline = (Boolean) sessionMap.get(TaskListConstants.PARAM_RUN_OFFLINE); + if(miniViewFlag > 0 && !runOffline){ + ActionErrors errors = new ActionErrors(); + errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("lable.learning.minimum.view.number.less",miniViewFlag)); + this.addErrors(request,errors); + return false; + } + + return true; + } + + /** * Set complete flag for given taskList item. * @param request Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java,v diff -u -r1.1 -r1.2 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java 28 Feb 2008 03:50:18 -0000 1.1 +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java 23 May 2008 10:49:13 -0000 1.2 @@ -73,6 +73,7 @@ if(!StringUtils.equals(param,"start") && !StringUtils.equals(param,"initPage")){ taskList.setLockWhenFinished(false); taskList.setSequentialOrder(false); + taskList.setMinimumNumberTasksComplete(0); taskList.setAllowContributeTasks(false); taskList.setMonitorVerificationRequired(false); taskList.setDefineLater(false); Index: lams_tool_task/web/pages/authoring/advance.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/pages/authoring/advance.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_task/web/pages/authoring/advance.jsp 28 Feb 2008 03:50:18 -0000 1.1 +++ lams_tool_task/web/pages/authoring/advance.jsp 23 May 2008 10:49:13 -0000 1.2 @@ -1,56 +1,74 @@ <%@ include file="/common/taglibs.jsp"%> - +

- - +

- - +

- - + + + + + + + + +

+ +

+

- - +

- - +

- +

+ @@ -112,5 +148,10 @@ + + + Index: lams_tool_task/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/pages/learning/learning.jsp,v diff -u -r1.12 -r1.13 --- lams_tool_task/web/pages/learning/learning.jsp 22 May 2008 07:34:35 -0000 1.12 +++ lams_tool_task/web/pages/learning/learning.jsp 23 May 2008 10:49:13 -0000 1.13 @@ -101,6 +101,8 @@

${taskList.instructions}

+ + <%@ include file="/common/messages.jsp"%> Index: lams_tool_task/web/pages/learning/parts/itemlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_task/web/pages/learning/parts/itemlist.jsp,v diff -u -r1.1 -r1.2 --- lams_tool_task/web/pages/learning/parts/itemlist.jsp 22 May 2008 07:34:34 -0000 1.1 +++ lams_tool_task/web/pages/learning/parts/itemlist.jsp 23 May 2008 10:49:12 -0000 1.2 @@ -141,4 +141,14 @@ + + + + + + ${taskList.minimumNumberTasksComplete} + + + +