Index: lams_tool_task/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/db/model/taskList.clay (.../taskList.clay) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/db/model/taskList.clay (.../taskList.clay) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -557,6 +557,19 @@ + + + + + + + + + + + + + Index: lams_tool_task/db/sql/create_lams_tool_taskList.sql =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/db/sql/create_lams_tool_taskList.sql (.../create_lams_tool_taskList.sql) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/db/sql/create_lams_tool_taskList.sql (.../create_lams_tool_taskList.sql) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/db/sql/table-schema.sql (.../table-schema.sql) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/db/sql/table-schema.sql (.../table-schema.sql) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -rfe31f08d68bebdde45fb5597de931d532ce7aace -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.hbm.xml (.../TaskList.hbm.xml) (revision fe31f08d68bebdde45fb5597de931d532ce7aace) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/model/TaskList.hbm.xml (.../TaskList.hbm.xml) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/action/LearningAction.java (.../LearningAction.java) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java (.../TaskListForm.java) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java (.../TaskListForm.java) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -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 =================================================================== diff -u -r875f56cb6917d1a52bed0545f2933c3b55497a02 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/web/pages/authoring/advance.jsp (.../advance.jsp) (revision 875f56cb6917d1a52bed0545f2933c3b55497a02) +++ lams_tool_task/web/pages/authoring/advance.jsp (.../advance.jsp) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -1,56 +1,74 @@ <%@ include file="/common/taglibs.jsp"%> - +

- - +

- - +

- - + + + + + + + + +

+ +

+

- - +

- - +

- +

+ @@ -112,5 +148,10 @@ + + + Index: lams_tool_task/web/pages/learning/learning.jsp =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/web/pages/learning/learning.jsp (.../learning.jsp) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/web/pages/learning/learning.jsp (.../learning.jsp) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -101,6 +101,8 @@

${taskList.instructions}

+ + <%@ include file="/common/messages.jsp"%> Index: lams_tool_task/web/pages/learning/parts/itemlist.jsp =================================================================== diff -u -r341a816804f6b2b61a5f180479b56d8fd0d1ea29 -r23988377bb0a1acee31a9908d19288fa2916546b --- lams_tool_task/web/pages/learning/parts/itemlist.jsp (.../itemlist.jsp) (revision 341a816804f6b2b61a5f180479b56d8fd0d1ea29) +++ lams_tool_task/web/pages/learning/parts/itemlist.jsp (.../itemlist.jsp) (revision 23988377bb0a1acee31a9908d19288fa2916546b) @@ -141,4 +141,14 @@ + + + + + + ${taskList.minimumNumberTasksComplete} + + + +