Index: lams_tool_whiteboard/web/WEB-INF/tags/Page.tag =================================================================== diff -u -r90e5fd15f6474eb56d0b497d1b73e14bda75e262 -r230d3d5e5abbbcf84aa40fb4b3eba4109716ca8c --- lams_tool_whiteboard/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 90e5fd15f6474eb56d0b497d1b73e14bda75e262) +++ lams_tool_whiteboard/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 230d3d5e5abbbcf84aa40fb4b3eba4109716ca8c) @@ -217,22 +217,41 @@ } else { alert(command.message); } - } + // if learner's currently displayed page has hookTrigger same as in the JSON // then a function also defined on that page will run if (command.hookTrigger && command.hookTrigger == commandWebsocketHookTrigger && typeof commandWebsocketHook === 'function') { commandWebsocketHook(command.hookParams); } + if (command.redirectURL) { window.location.href = command.redirectURL; } + if (command.discussion) { + var discussionCommand = $('#discussion-sentiment-command'); + if (discussionCommand.length === 0) { + discussionCommand = $('
').attr('id', 'discussion-sentiment-command').appendTo('body'); + } + discussionCommand.load(LEARNING_URL + "discussionSentiment/" + command.discussion + ".do", { + lessonId : lessonId + }); + } + // reset ping timer clearTimeout(commandWebsocketPingTimeout); commandWebsocketPingFunc(true); }; + + // check if there is a running discussion; if so, a websocket command will come to display the widget + $.ajax({ + url : LEARNING_URL + "discussionSentiment/checkLearner.do", + data: { + lessonId : lessonId + } + }); } $(document).ready(function() {