Index: lams_tool_scratchie/.classpath =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/.classpath,v diff -u -r1.6.2.11 -r1.6.2.12 --- lams_tool_scratchie/.classpath 25 Nov 2014 10:47:15 -0000 1.6.2.11 +++ lams_tool_scratchie/.classpath 14 Apr 2016 12:19:51 -0000 1.6.2.12 @@ -23,5 +23,6 @@ + Index: lams_tool_scratchie/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/build.xml,v diff -u -r1.2 -r1.2.4.1 --- lams_tool_scratchie/build.xml 28 Aug 2012 15:22:19 -0000 1.2 +++ lams_tool_scratchie/build.xml 14 Apr 2016 12:19:51 -0000 1.2.4.1 @@ -2,5 +2,23 @@ - + + + + + + ${ant.project.name}: Copying additional Java classes to WAR + + \ No newline at end of file Index: lams_tool_scratchie/conf/xdoclet/struts-actions.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/conf/xdoclet/struts-actions.xml,v diff -u -r1.20.2.4 -r1.20.2.5 --- lams_tool_scratchie/conf/xdoclet/struts-actions.xml 8 Apr 2016 16:38:25 -0000 1.20.2.4 +++ lams_tool_scratchie/conf/xdoclet/struts-actions.xml 14 Apr 2016 12:19:51 -0000 1.20.2.5 @@ -167,19 +167,6 @@ - - - - - - - Index: lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java,v diff -u -r1.44.2.10 -r1.44.2.11 --- lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java 8 Apr 2016 16:38:25 -0000 1.44.2.10 +++ lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningAction.java 14 Apr 2016 12:19:52 -0000 1.44.2.11 @@ -88,19 +88,13 @@ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) - throws IOException, ServletException, JSONException, ScratchieApplicationException { + throws IOException, ServletException, JSONException, ScratchieApplicationException { String param = mapping.getParameter(); // -----------------------Scratchie Learner function --------------------------- if (param.equals("start")) { return start(mapping, form, request, response); } - if (param.equals("refreshQuestionList")) { - return refreshQuestionList(mapping, form, request, response); - } - if (param.equals("checkLeaderSubmittedNotebook")) { - return checkLeaderSubmittedNotebook(mapping, form, request, response); - } if (param.equals("recordItemScratched")) { return recordItemScratched(mapping, form, request, response); } @@ -343,36 +337,6 @@ } /** - * Refresh - * - * @throws ScratchieApplicationException - */ - private ActionForward refreshQuestionList(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ScratchieApplicationException { - initializeScratchieService(); - String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID); - - Long toolSessionId = (Long) sessionMap.get(AttributeNames.PARAM_TOOL_SESSION_ID); - ScratchieSession toolSession = LearningAction.service.getScratchieSessionBySessionId(toolSessionId); - - // set scratched flag for display purpose - Collection items = LearningAction.service.getItemsWithIndicatedScratches(toolSessionId); - sessionMap.put(ScratchieConstants.ATTR_ITEM_LIST, items); - - // refresh leadership status - ScratchieUser user = this.getCurrentUser(toolSessionId); - boolean isUserLeader = toolSession.isUserGroupLeader(user.getUid()); - sessionMap.put(ScratchieConstants.ATTR_IS_USER_LEADER, isUserLeader); - - // refresh ScratchingFinished status - sessionMap.put(ScratchieConstants.ATTR_IS_SCRATCHING_FINISHED, toolSession.isScratchingFinished()); - - return mapping.findForward(ScratchieConstants.SUCCESS); - } - - /** * Return whether leader still needs submit notebook. */ private ActionForward checkLeaderSubmittedNotebook(ActionMapping mapping, ActionForm form, @@ -477,9 +441,11 @@ * @param response * @return * @throws ScratchieApplicationException + * @throws IOException + * @throws JSONException */ private ActionForward showResults(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws ScratchieApplicationException { + HttpServletResponse response) throws ScratchieApplicationException, JSONException, IOException { initializeScratchieService(); // get back SessionMap String sessionMapID = request.getParameter(ScratchieConstants.ATTR_SESSION_MAP_ID); @@ -498,6 +464,8 @@ // see Next Activity button if (toolSession.isUserGroupLeader(userUid) && !toolSession.isScratchingFinished()) { LearningAction.service.setScratchingFinished(toolSessionId); + + LearningWebsocketServer.sendCloseRequest(toolSessionId); } // get updated score from ScratchieSession @@ -509,7 +477,8 @@ // display other groups' BurningQuestions if (isBurningQuestionsEnabled) { Scratchie scratchie = toolSession.getScratchie(); - List burningQuestionItemDtos = LearningAction.service.getBurningQuestionDtos(scratchie, toolSessionId); + List burningQuestionItemDtos = LearningAction.service + .getBurningQuestionDtos(scratchie, toolSessionId); request.setAttribute(ScratchieConstants.ATTR_BURNING_QUESTION_ITEM_DTOS, burningQuestionItemDtos); } @@ -539,15 +508,16 @@ return mapping.findForward(ScratchieConstants.SUCCESS); } - + /** - * @throws ServletException - * @throws ScratchieApplicationException + * @throws ServletException + * @throws ScratchieApplicationException */ private synchronized ActionForward like(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException, ServletException, ScratchieApplicationException { + HttpServletResponse response) + throws JSONException, IOException, ServletException, ScratchieApplicationException { initializeScratchieService(); - + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); @@ -570,15 +540,16 @@ response.getWriter().print(JSONObject); return null; } - + /** - * @throws ServletException - * @throws ScratchieApplicationException + * @throws ServletException + * @throws ScratchieApplicationException */ private synchronized ActionForward removeLike(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws JSONException, IOException, ServletException, ScratchieApplicationException { + HttpServletResponse response) + throws JSONException, IOException, ServletException, ScratchieApplicationException { initializeScratchieService(); - + String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID); SessionMap sessionMap = (SessionMap) request.getSession() .getAttribute(sessionMapID); @@ -713,11 +684,11 @@ ActionRedirect redirect; if (scratchie.isReflectOnActivity() && !isNotebookSubmitted) { redirect = new ActionRedirect(mapping.findForwardConfig("newReflection")); - // show results page + // show results page } else { redirect = new ActionRedirect(mapping.findForwardConfig("showResults")); } - + redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); return redirect; } @@ -804,7 +775,7 @@ LearningAction.service.updateEntry(entry); } sessionMap.put(ScratchieConstants.ATTR_REFLECTION_ENTRY, entryText); - + ActionRedirect redirect = new ActionRedirect(mapping.findForwardConfig("showResults")); redirect.addParameter(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); return redirect; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_scratchie/src/java/org/lamsfoundation/lams/tool/scratchie/web/action/LearningWebsocketServer.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/learning.jsp,v diff -u -r1.18.2.5 -r1.18.2.6 --- lams_tool_scratchie/web/pages/learning/learning.jsp 7 Mar 2016 23:22:53 -0000 1.18.2.5 +++ lams_tool_scratchie/web/pages/learning/learning.jsp 14 Apr 2016 12:19:51 -0000 1.18.2.6 @@ -35,12 +35,21 @@ } - + Index: lams_tool_scratchie/web/pages/learning/questionlist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/questionlist.jsp,v diff -u -r1.12.2.2 -r1.12.2.3 --- lams_tool_scratchie/web/pages/learning/questionlist.jsp 7 Mar 2016 23:22:53 -0000 1.12.2.2 +++ lams_tool_scratchie/web/pages/learning/questionlist.jsp 14 Apr 2016 12:19:51 -0000 1.12.2.3 @@ -15,45 +15,40 @@ - + //init the connection with server using server URL but with different protocol + var websocket = new WebSocket(''.replace('http', 'ws') + + 'learningWebsocket?toolSessionID=' + ${toolSessionID}); + + // run when the server pushes new reports and vote statistics + websocket.onmessage = function(e) { + // create JSON object + var input = JSON.parse(e.data); + + if (input.close) { + // leader finished the activity + $('#finishButton').show(); + return; + } + + $.each(input, function(itemUid, answers) { + $.each(answers, function(answerUid, isCorrect){ + // only updates come via websockets + scratchImage(itemUid, answerUid, isCorrect); + }); + }); + }; + +
@@ -68,14 +63,16 @@ - + - + - + - + - +
\ No newline at end of file