Index: lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rfbaf103704f81cec6090f430a55f12349113eb47 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision fbaf103704f81cec6090f430a55f12349113eb47) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -184,9 +184,8 @@ label.scratchie.options =Question options label.activity.completion =End of activity label.authoring.advanced.burning.questions =Option for burning questions -label.continue.burning.questions =Continue with burning questions label.burning.questions =Burning questions -label.burning.question =Burning question +label.burning.question =Burning question? label.time.limit =Time limit (minutes) label.countdown.time.left =Time left label.time.is.over =Time is over. Processing your answers... @@ -198,7 +197,6 @@ label.general.burning.question =General burning question label.waiting.for.leader.launch.time.limit =Leader has not started the activity. Please wait until he commences it. label.waiting.for.leader.submit.notebook =Time limit set by teacher is expired. Please wait until a group leader submits notebook. -label.waiting.for.leader.submit.burning.questions =Time limit set by teacher is expired. Please wait until a group leader submits burning questions. label.authoring.advanced.shuffle.items =Shuffle questions label.summary.downloaded =Excel file downloaded. label.number.groups.finished =Number of groups finished @@ -214,5 +212,7 @@ label.no.confidence.levels.activities =There are no activities with confidence levels to choose from. label.save.learning.design =In order to select activity with confidence levels please save your sequence first. +label.burning.questions.autosaved =Burning questions autosaved + #======= End labels: Exported 203 labels for en AU ===== Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java =================================================================== diff -u -rbbe9589ceab063d62380b9fe3f02648a4581e109 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (.../IScratchieService.java) (revision bbe9589ceab063d62380b9fe3f02648a4581e109) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/IScratchieService.java (.../IScratchieService.java) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -98,12 +98,12 @@ void launchTimeLimit(Long sessionId) throws SchedulerException; /** - * Checks if non-leaders should still wait for leader to submit either notebook or burning questions. + * Checks if non-leaders should still wait for leader to submit notebook. * * @param toolSession * @return */ - boolean isWaitingForLeaderToSubmit(ScratchieSession toolSession); + boolean isWaitingForLeaderToSubmitNotebook(ScratchieSession toolSession); List getBurningQuestionsBySession(Long sessionId); Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java =================================================================== diff -u -rf899620dd37f54eb375d29a5b15a7793c5dc3bb4 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision f899620dd37f54eb375d29a5b15a7793c5dc3bb4) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/service/ScratchieServiceImpl.java (.../ScratchieServiceImpl.java) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -319,7 +319,7 @@ } @Override - public boolean isWaitingForLeaderToSubmit(ScratchieSession toolSession) { + public boolean isWaitingForLeaderToSubmitNotebook(ScratchieSession toolSession) { Long toolSessionId = toolSession.getSessionId(); Scratchie scratchie = toolSession.getScratchie(); ScratchieUser groupLeader = toolSession.getGroupLeader(); @@ -331,15 +331,9 @@ notebookEntry = getEntry(toolSessionId, CoreNotebookConstants.NOTEBOOK_TOOL, ScratchieConstants.TOOL_SIGNATURE, groupLeader.getUserId().intValue()); } - List burningQuestions = null; - if (scratchie.isBurningQuestionsEnabled()) { - burningQuestions = getBurningQuestionsBySession(toolSessionId); - } - boolean isWaitingForLeaderToSubmitNotebook = isReflectOnActivity && (notebookEntry == null); - boolean isWaitingForLeaderToSubmitBurningQuestions = scratchie.isBurningQuestionsEnabled() - && ((burningQuestions == null) || burningQuestions.isEmpty()) && !toolSession.isSessionFinished(); - - return isWaitingForLeaderToSubmitNotebook || isWaitingForLeaderToSubmitBurningQuestions; + + // return whether it's waiting for the leader to submit notebook + return isReflectOnActivity && (notebookEntry == null); } @Override Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java =================================================================== diff -u -rbbe9589ceab063d62380b9fe3f02648a4581e109 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java (.../LearningAction.java) (revision bbe9589ceab063d62380b9fe3f02648a4581e109) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java (.../LearningAction.java) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -105,12 +105,9 @@ if (param.equals("finish")) { return finish(mapping, form, request, response); } - if (param.equals("showBurningQuestions")) { - return showBurningQuestions(mapping, form, request, response); + if (param.equals("autosaveBurningQuestions")) { + return autosaveBurningQuestions(mapping, form, request, response); } - if (param.equals("saveBurningQuestions")) { - return saveBurningQuestions(mapping, form, request, response); - } if (param.equals("showResults")) { return showResults(mapping, form, request, response); } @@ -133,13 +130,7 @@ } /** - * Read scratchie 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 ScratchieApplicationException - * + * Read scratchie data from database and put them into HttpSession. */ private ActionForward start(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ScratchieApplicationException { @@ -314,33 +305,24 @@ boolean isScratchingFinished = toolSession.isScratchingFinished(); boolean isWaitingForLeaderToSubmitNotebook = isReflectOnActivity && (notebookEntry == null); - boolean isWaitingForLeaderToSubmitBurningQuestions = scratchie.isBurningQuestionsEnabled() - && ((burningQuestions == null) || burningQuestions.isEmpty()) && !toolSession.isSessionFinished(); - boolean isShowResults = (isScratchingFinished && !isWaitingForLeaderToSubmitNotebook - && !isWaitingForLeaderToSubmitBurningQuestions) && !mode.isTeacher(); + boolean isShowResults = (isScratchingFinished && !isWaitingForLeaderToSubmitNotebook) && !mode.isTeacher(); - // show showBurningQuestions page to the leader - if (isUserLeader && isScratchingFinished && isWaitingForLeaderToSubmitBurningQuestions) { - ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("showBurningQuestions")); - redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); - return redirect; - - // show notebook page to the leader - } else if (isUserLeader && isScratchingFinished && isWaitingForLeaderToSubmitNotebook) { + // show notebook page to the leader + if (isUserLeader && isScratchingFinished && isWaitingForLeaderToSubmitNotebook) { ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("newReflection")); redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); redirect.addParameter(AttributeNames.ATTR_MODE, mode); return redirect; - // show results page + // show results page } else if (isShowResults) { ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("showResults")); redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); redirect.addParameter(AttributeNames.ATTR_MODE, mode); return redirect; - // show learning.jsp page + // show learning.jsp page } else { // time limit feature @@ -381,26 +363,20 @@ request.setAttribute(ScratchieConstants.ATTR_WAITING_MESSAGE_KEY, "label.waiting.for.leader.submit.notebook"); return mapping.findForward(ScratchieConstants.WAIT_FOR_LEADER_TIME_LIMIT); - } else if (isTimeLimitExceeded && isWaitingForLeaderToSubmitBurningQuestions) { - request.setAttribute(ScratchieConstants.ATTR_WAITING_MESSAGE_KEY, - "label.waiting.for.leader.submit.burning.questions"); - return mapping.findForward(ScratchieConstants.WAIT_FOR_LEADER_TIME_LIMIT); } } sessionMap.put(ScratchieConstants.ATTR_IS_SCRATCHING_FINISHED, isScratchingFinished); - // make non leaders also wait for burning questions submit + // make non-leaders wait for notebook to be submitted, if required sessionMap.put(ScratchieConstants.ATTR_IS_WAITING_FOR_LEADER_TO_SUBMIT_NOTEBOOK, - isWaitingForLeaderToSubmitNotebook | isWaitingForLeaderToSubmitBurningQuestions); + isWaitingForLeaderToSubmitNotebook); return mapping.findForward(ScratchieConstants.SUCCESS); } } /** - * Record in DB that leader has scratched specified answer. And return whether scratchie answer is correct or not - * - * @throws ScratchieApplicationException + * Record in DB that leader has scratched specified answer. And return whether scratchie answer is correct or not. */ private ActionForward recordItemScratched(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws JSONException, IOException, ScratchieApplicationException { @@ -450,10 +426,7 @@ } /** - * Stores date when user has started activity with time limit - * - * @throws ScratchieApplicationException - * @throws SchedulerException + * Stores date when user has started activity with time limit. */ private ActionForward launchTimeLimit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ScratchieApplicationException, SchedulerException { @@ -477,15 +450,6 @@ /** * Displays results page. When leader gets to this page, scratchingFinished column is set to true for all users. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws ScratchieApplicationException - * @throws IOException - * @throws JSONException */ private ActionForward showResults(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ScratchieApplicationException, JSONException, IOException { @@ -501,8 +465,13 @@ final Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); ScratchieSession toolSession = service.getScratchieSessionBySessionId(toolSessionId); + Scratchie scratchie = toolSession.getScratchie(); Long userUid = (Long) sessionMap.get(ScratchieConstants.ATTR_USER_UID); - boolean isUserFinished = (boolean) sessionMap.get(ScratchieConstants.ATTR_USER_FINISHED); + + //handle burning questions saving if needed + if (toolSession.isUserGroupLeader(userUid) && scratchie.isBurningQuestionsEnabled() && !toolSession.isScratchingFinished()) { + saveBurningQuestions(request); + } if (toolSession.isUserGroupLeader(userUid) && !toolSession.isScratchingFinished()) { service.setScratchingFinished(toolSessionId); @@ -516,7 +485,6 @@ // display other groups' BurningQuestions if (isBurningQuestionsEnabled) { - Scratchie scratchie = toolSession.getScratchie(); List burningQuestionItemDtos = service.getBurningQuestionDtos(scratchie, toolSessionId); request.setAttribute(ScratchieConstants.ATTR_BURNING_QUESTION_ITEM_DTOS, burningQuestionItemDtos); @@ -606,12 +574,6 @@ /** * Finish learning session. - * - * @param mapping - * @param form - * @param request - * @param response - * @return */ private ActionForward finish(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { @@ -638,109 +600,60 @@ } /** - * Displays burning questions page. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws ScratchieApplicationException - * @throws IOException - * @throws JSONException + * Autosaves burning questions. Only leaders can perform it. */ - private ActionForward showBurningQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ScratchieApplicationException, JSONException, IOException { + private ActionForward autosaveBurningQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws ScratchieApplicationException { initializeScratchieService(); String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); - request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); - final Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - Long userUid = (Long) sessionMap.get(ScratchieConstants.ATTR_USER_UID); - - // set scratched flag for display purpose - Collection items = (Collection) sessionMap.get(ScratchieConstants.ATTR_ITEM_LIST); - service.getItemsWithIndicatedScratches(toolSessionId, items); - - // in case of the leader we should let all other learners see Next Activity button - ScratchieSession toolSession = service.getScratchieSessionBySessionId(toolSessionId); - if (toolSession.isUserGroupLeader(userUid) && !toolSession.isScratchingFinished()) { - service.setScratchingFinished(toolSessionId); + final Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); + + // only leader is allowed to submit burning questions + ScratchieUser leader = getCurrentUser(sessionId); + ScratchieSession toolSession = service.getScratchieSessionBySessionId(sessionId); + if (!toolSession.isUserGroupLeader(leader.getUid())) { + return null; } + + saveBurningQuestions(request); - return mapping.findForward(ScratchieConstants.SUCCESS); + return null; } - + /** - * Submit reflection form input database. Only leaders can submit reflections. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws ScratchieApplicationException + * Saves burning questions entered by user. It also updates its values in SessionMap. */ - private ActionForward saveBurningQuestions(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ScratchieApplicationException { + private void saveBurningQuestions(HttpServletRequest request) { initializeScratchieService(); String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); - Scratchie scratchie = (Scratchie) sessionMap.get(ScratchieConstants.ATTR_SCRATCHIE); final Long sessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); Collection items = (Collection) sessionMap.get(ScratchieConstants.ATTR_ITEM_LIST); - for (int i = 0; i < items.size(); i++) { - final Long itemUid = WebUtil.readLongParam(request, ScratchieConstants.ATTR_ITEM_UID + i); - ScratchieItem item = null; - for (ScratchieItem itemIter : items) { - if (itemIter.getUid().equals(itemUid)) { - item = itemIter; - break; - } - } + for (ScratchieItem item : items) { + final Long itemUid = item.getUid(); - final String question = request.getParameter(ScratchieConstants.ATTR_BURNING_QUESTION_PREFIX + i); + final String burningQuestion = request.getParameter(ScratchieConstants.ATTR_BURNING_QUESTION_PREFIX + itemUid); // update question in sessionMap - item.setBurningQuestion(question); + item.setBurningQuestion(burningQuestion); // update new entry - service.saveBurningQuestion(sessionId, itemUid, question); + service.saveBurningQuestion(sessionId, itemUid, burningQuestion); } // handle general burning question final String generalQuestion = request.getParameter(ScratchieConstants.ATTR_GENERAL_BURNING_QUESTION); service.saveBurningQuestion(sessionId, null, generalQuestion); // update general question in sessionMap sessionMap.put(ScratchieConstants.ATTR_GENERAL_BURNING_QUESTION, generalQuestion); - - boolean isNotebookSubmitted = sessionMap.get(ScratchieConstants.ATTR_REFLECTION_ENTRY) != null; - ActionRedirect redirect; - if (scratchie.isReflectOnActivity() && !isNotebookSubmitted) { - redirect = new ActionRedirect(mapping.findForwardConfig("newReflection")); - // show results page - } else { - redirect = new ActionRedirect(mapping.findForwardConfig("showResults")); - } - - redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); - return redirect; } /** * Display empty reflection form. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws ScratchieApplicationException - * @throws IOException - * @throws JSONException */ private ActionForward newReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ScratchieApplicationException, JSONException, IOException { @@ -768,6 +681,12 @@ } ScratchieSession toolSession = service.getScratchieSessionBySessionId(toolSessionId); + Scratchie scratchie = toolSession.getScratchie(); + + //handle burning questions saving if needed + if (toolSession.isUserGroupLeader(userUid) && scratchie.isBurningQuestionsEnabled() && !toolSession.isScratchingFinished()) { + saveBurningQuestions(request); + } // in case of the leader we should let all other learners see Next Activity button if (toolSession.isUserGroupLeader(userUid) && !toolSession.isScratchingFinished()) { @@ -779,13 +698,6 @@ /** * Submit reflection form input database. Only leaders can submit reflections. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - * @throws ScratchieApplicationException */ private ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ScratchieApplicationException { Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningWebsocketServer.java =================================================================== diff -u -r610c43f31f6cbf2fd1931c0a33acef5a82f67b12 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 610c43f31f6cbf2fd1931c0a33acef5a82f67b12) +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningWebsocketServer.java (.../LearningWebsocketServer.java) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -100,7 +100,7 @@ } boolean isWaitingForLeaderToSubmit = LearningWebsocketServer.getScratchieService() - .isWaitingForLeaderToSubmit(toolSession); + .isWaitingForLeaderToSubmitNotebook(toolSession); if (timeLimitUp) { // time limit is up if (isWaitingForLeaderToSubmit) { Index: lams_tool_scratchie/web/WEB-INF/struts-config.xml =================================================================== diff -u -r911eb9cfa3db76d9b0f495f76833dc82545bee9d -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 911eb9cfa3db76d9b0f495f76833dc82545bee9d) +++ lams_tool_scratchie/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -207,7 +207,6 @@ - @@ -232,19 +231,11 @@ - - - - - - - + + +
+
@@ -172,9 +173,39 @@ + + <%-- show burning questions --%> + +
+ + + + + +
in"> + +
+
+
+<%-- show general burning question --%> + +
+ + + + + +
in"> + +
+
+
+ + + <%-- show reflection (only for teacher) --%>
@@ -204,13 +235,6 @@
- - - - - -
- - - + + +
-
@@ -267,6 +266,7 @@
+
@@ -308,6 +308,7 @@
+
- Index: lams_tool_scratchie/web/pages/learning/submissionDeadline.jsp =================================================================== diff -u -rc9759e81d08842b6202f62bc08a78cc13ca5bcf8 -r868cbadb5ccd51c7172a97cfd02b31edbaa9d97a --- lams_tool_scratchie/web/pages/learning/submissionDeadline.jsp (.../submissionDeadline.jsp) (revision c9759e81d08842b6202f62bc08a78cc13ca5bcf8) +++ lams_tool_scratchie/web/pages/learning/submissionDeadline.jsp (.../submissionDeadline.jsp) (revision 868cbadb5ccd51c7172a97cfd02b31edbaa9d97a) @@ -1,8 +1,7 @@ - - <%@include file="/common/taglibs.jsp"%> + <%@ include file="/common/header.jsp"%> @@ -76,9 +75,8 @@
- - - + + +