Index: lams_admin/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_admin/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_admin/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_build/lib/lams/lams-learning.jar =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 Binary files differ Index: lams_central/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_central/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_central/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch2040066.sql =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch2040066.sql (.../patch2040066.sql) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch2040066.sql (.../patch2040066.sql) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -11,7 +11,10 @@ user_name VARCHAR(191), create_date DATETIME NOT NULL, command_text TEXT, - PRIMARY KEY (uid) + PRIMARY KEY (uid), + INDEX idx_lesson_id (lesson_id), + INDEX idx_user_name (user_name), + INDEX idx_create_date (create_date) )ENGINE=InnoDB; COMMIT; Index: lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/command/Command.hbm.xml =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/command/Command.hbm.xml (.../Command.hbm.xml) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_learning/conf/hibernate/mappings/org/lamsfoundation/lams/learning/command/Command.hbm.xml (.../Command.hbm.xml) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -7,7 +7,7 @@ Fisheye: Tag d19a95db673b7cf90351de4d567299c5fa86b450 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/command/Command.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/command/CommandWebsocketServer.java =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/src/java/org/lamsfoundation/lams/learning/command/CommandWebsocketServer.java (.../CommandWebsocketServer.java) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/command/CommandWebsocketServer.java (.../CommandWebsocketServer.java) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -16,6 +16,7 @@ import javax.websocket.server.ServerEndpoint; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.command.model.Command; import org.lamsfoundation.lams.learning.service.ILearnerService; import org.lamsfoundation.lams.util.hibernate.HibernateSessionManager; import org.lamsfoundation.lams.web.session.SessionManager; @@ -39,7 +40,7 @@ private static class SendWorker extends Thread { private boolean stopFlag = false; // how ofter the thread runs - private static final long CHECK_INTERVAL = 2000; + private static final long CHECK_INTERVAL = 5000; // mapping lessonId -> timestamp when the check was last performed, so the thread does not run too often private final Map lastSendTimes = new TreeMap(); @@ -95,10 +96,13 @@ } /** - * Feeds opened websockets with messages. + * Feeds opened websockets with commands. */ private void send(Long lessonId) throws IOException { Long lastSendTime = lastSendTimes.get(lessonId); + if (lastSendTime == null) { + lastSendTime = System.currentTimeMillis() - CHECK_INTERVAL; + } lastSendTimes.put(lessonId, System.currentTimeMillis()); List commands = CommandWebsocketServer.getLearnerService().getCommandsForLesson(lessonId, Index: lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/ICommandDAO.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/ICommandDAO.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/ICommandDAO.java (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -0,0 +1,11 @@ +package org.lamsfoundation.lams.learning.command.dao; + +import java.util.Date; +import java.util.List; + +import org.lamsfoundation.lams.dao.IBaseDAO; +import org.lamsfoundation.lams.learning.command.model.Command; + +public interface ICommandDAO extends IBaseDAO { + List getNewCommands(Long lessonId, Date lastCheck); +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/hibernate/CommandDAO.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/hibernate/CommandDAO.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/command/dao/hibernate/CommandDAO.java (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -0,0 +1,44 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.learning.command.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.lamsfoundation.lams.dao.hibernate.LAMSBaseDAO; +import org.lamsfoundation.lams.learning.command.dao.ICommandDAO; +import org.lamsfoundation.lams.learning.command.model.Command; +import org.springframework.stereotype.Repository; + +@Repository +public class CommandDAO extends LAMSBaseDAO implements ICommandDAO { + private static final String COMMAND_BY_LESSON_AND_DATE = "FROM Command WHERE lessonId = :lessonId AND createDate >= :lastCheck"; + + @Override + @SuppressWarnings("unchecked") + public List getNewCommands(Long lessonId, Date lastCheck) { + return (List) (doFindByNamedParam(CommandDAO.COMMAND_BY_LESSON_AND_DATE, + new String[] { "lessonId", "lastCheck" }, new Object[] { lessonId, lastCheck })); + } +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/command/model/Command.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/command/model/Command.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/command/model/Command.java (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -0,0 +1,93 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.learning.command.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Stores a command to be sent to a learner via websocket. + */ +public class Command implements Serializable { + + private Long uid; + + private Long lessonId; + + private String userName; + + private Date createDate; + + private String commandText; + + public Command() { + } + + public Command(Long lessonId, String userName, String jsonCommand) { + this.lessonId = lessonId; + this.userName = userName; + this.createDate = new Date(); + this.commandText = jsonCommand; + } + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public Long getLessonId() { + return lessonId; + } + + public void setLessonId(Long lessonId) { + this.lessonId = lessonId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public Date getCreateDate() { + return createDate; + } + + public void setCreateDate(Date createDate) { + this.createDate = createDate; + } + + public String getCommandText() { + return commandText; + } + + public void setCommandText(String commandText) { + this.commandText = commandText; + } +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml =================================================================== diff -u -r0ddeb3a1dcf29cbbba6ed0fccbd139f9c31c347f -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml (.../learningApplicationContext.xml) (revision 0ddeb3a1dcf29cbbba6ed0fccbd139f9c31c347f) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/learningApplicationContext.xml (.../learningApplicationContext.xml) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -54,6 +54,7 @@ + @@ -97,11 +98,13 @@ - + + + Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -26,7 +26,7 @@ import java.util.Date; import java.util.List; -import org.lamsfoundation.lams.learning.command.Command; +import org.lamsfoundation.lams.learning.command.model.Command; import org.lamsfoundation.lams.learning.web.bean.ActivityPositionDTO; import org.lamsfoundation.lams.tool.ToolOutput; Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -37,7 +37,8 @@ import org.apache.log4j.Logger; import org.lamsfoundation.lams.gradebook.service.IGradebookService; -import org.lamsfoundation.lams.learning.command.Command; +import org.lamsfoundation.lams.learning.command.dao.ICommandDAO; +import org.lamsfoundation.lams.learning.command.model.Command; import org.lamsfoundation.lams.learning.progress.ProgressBuilder; import org.lamsfoundation.lams.learning.progress.ProgressEngine; import org.lamsfoundation.lams.learning.progress.ProgressException; @@ -104,6 +105,7 @@ private IGroupUserDAO groupUserDAO; private ProgressEngine progressEngine; private IDataFlowDAO dataFlowDAO; + private ICommandDAO commandDAO; private ILamsCoreToolService lamsCoreToolService; private ActivityMapping activityMapping; private IUserManagementService userManagementService; @@ -1308,6 +1310,14 @@ this.dataFlowDAO = dataFlowDAO; } + public ICommandDAO getCommandDAO() { + return commandDAO; + } + + public void setCommandDAO(ICommandDAO commandDAO) { + this.commandDAO = commandDAO; + } + /** * Gets the concreted tool output (not the definition) from a tool. This method is called by target tool in order to * get data from source tool. @@ -1400,14 +1410,12 @@ @Override public void createCommandForLearner(Long lessonId, String userName, String jsonCommand) { Command command = new Command(lessonId, userName, jsonCommand); - activityDAO.insert(command); + commandDAO.insert(command); } @Override - @SuppressWarnings("unchecked") public List getCommandsForLesson(Long lessonId, Date laterThan) { - String query = "FROM Command WHERE lessonId=? AND createDate >= ?"; - return activityDAO.find(query, new Object[] { lessonId, laterThan }); + return commandDAO.getNewCommands(lessonId, laterThan); } @Override Index: lams_learning/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_monitoring/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2e52631e8d9ec49424ba74b3a003226e2d4302fb -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2e52631e8d9ec49424ba74b3a003226e2d4302fb) +++ lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -270,6 +270,7 @@ force.complete.activity.confirm =Are you sure you want to move learner "[0]" to activity "[1]"? force.complete.drop.fail =You have dropped the learner "[0]" on either its current or on its completed activity "[1]". force.complete.end.lesson.tooltip =To move a learner to the end of lesson, drag the learner icon over to this bar. +force.complete.learner.command.message =Teacher moved you to another activity. learner.group.list.title =Learners: learner.group.count =learners in total. learner.group.show =Double-click to see the full list. Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -134,6 +134,8 @@ private static ILearnerService learnerService; + private static MessageService messageService; + private Integer getUserId() { HttpSession ss = SessionManager.getSession(); UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); @@ -636,7 +638,7 @@ MonitoringAction.auditService.log(MonitoringConstants.MONITORING_MODULE_NAME, auditMessage + " " + message); JSONObject jsonCommand = new JSONObject(); - jsonCommand.put("message", "Teacher moved you to another activity."); + jsonCommand.put("message", getMessageService().getMessage("force.complete.learner.command.message")); jsonCommand.put("redirectURL", "/lams/learning/learner.do?method=joinLesson&lessonID=" + lessonId); User learner = (User) getUserManagementService().findById(User.class, learnerId); getLearnerService().createCommandForLearner(lessonId, learner.getLogin(), jsonCommand.toString()); @@ -1404,6 +1406,15 @@ return MonitoringAction.learnerService; } + private MessageService getMessageService() { + if (MonitoringAction.messageService == null) { + WebApplicationContext ctx = WebApplicationContextUtils + .getRequiredWebApplicationContext(getServlet().getServletContext()); + MonitoringAction.messageService = (MessageService) ctx.getBean("monitoringMessageService"); + } + return MonitoringAction.messageService; + } + /** * Set whether or not the presence available button is available in learner. Expects parameters lessonID and * presenceAvailable. Index: lams_monitoring/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_monitoring/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_monitoring/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_assessment/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_assessment/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_assessment/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_bbb/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_bbb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_bbb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_chat/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_chat/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_chat/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_daco/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_daco/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_daco/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_forum/web/WEB-INF/tags/Page.tag =================================================================== diff -u -re463b64cccfefc6efb39c891fb496bfed47feb4a -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_forum/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision e463b64cccfefc6efb39c891fb496bfed47feb4a) +++ lams_tool_forum/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,8 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar commandWebsocket = null, bars = { @@ -199,8 +200,9 @@ }); } + // it is not an obvious place to init the websocket, but we need lesson ID commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); - //when the server pushes new commands + // when the server pushes new commands commandWebsocket.onmessage = function(e){ // read JSON object var command = JSON.parse(e.data); Index: lams_tool_gmap/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_gmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_gmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_images/web/WEB-INF/tags/CommentsAuthor.tag =================================================================== diff -u -r60ab803bf843562083cfb66764ddfcb3b0a83841 -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_images/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 60ab803bf843562083cfb66764ddfcb3b0a83841) +++ lams_tool_images/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -1,13 +1,16 @@ <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams"%> <%@ attribute name="allowCommentsVariableName" required="false" rtexprvalue="true"%> <%@ attribute name="allowCommentLabelKey" required="false" rtexprvalue="true"%> <%@ attribute name="likeDislikeVariableName" required="false" rtexprvalue="true"%> <%@ attribute name="likeOnlyCommentLabelKey" required="false" rtexprvalue="true"%> <%@ attribute name="likeDislikeLabelKey" required="false" rtexprvalue="true"%> +<%@ attribute name="commentPanelHeaderKey" required="false" rtexprvalue="true"%> + @@ -23,7 +26,11 @@ + + + +
+
Index: lams_tool_imscc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_imscc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_imscc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_kaltura/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_kaltura/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_kaltura/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_lamc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_lamc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_lamc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_laqa/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_laqa/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_laqa/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_larsrc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_larsrc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_larsrc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_leader/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_leader/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_leader/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_mindmap/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_mindmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_mindmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_nb/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_notebook/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_notebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_notebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_pixlr/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_pixlr/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_pixlr/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_preview/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_preview/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_preview/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_sbmt/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_sbmt/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_sbmt/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_scratchie/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_scratchie/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_scratchie/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_scribe/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_scribe/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_scribe/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_survey/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_survey/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_survey/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_task/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_task/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_task/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_vote/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_vote/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_vote/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_tool_wiki/web/WEB-INF/tags/Page.tag =================================================================== diff -u -reb57b4fcf440743783106f853d6d23e4591bbcab -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_tool_wiki/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision eb57b4fcf440743783106f853d6d23e4591bbcab) +++ lams_tool_wiki/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -93,7 +93,10 @@ LAMS_URL = '', APP_URL = LAMS_URL + 'learning/', - + + // it gets initialised along with progress bar + commandWebsocket = null, + bars = { 'learnerMainBar' : { 'containerId' : 'progressBarDiv' @@ -196,9 +199,25 @@ } }); } + + // it is not an obvious place to init the websocket, but we need lesson ID + commandWebsocket = new WebSocket(APP_URL.replace('http', 'ws') + 'commandWebsocket?lessonID=' + lessonId); + // when the server pushes new commands + commandWebsocket.onmessage = function(e){ + // read JSON object + var command = JSON.parse(e.data); + if (command.message) { + alert(command.message); + } + if (command.redirectURL) { + window.location.href = command.redirectURL; + } + }; } }); } + + }); Index: lams_www/web/WEB-INF/tags/Page.tag =================================================================== diff -u -ra86e7d7663a6093c0369048074e955ba9762ba77 -rd19a95db673b7cf90351de4d567299c5fa86b450 --- lams_www/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision a86e7d7663a6093c0369048074e955ba9762ba77) +++ lams_www/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision d19a95db673b7cf90351de4d567299c5fa86b450) @@ -1,49 +1,343 @@ <%@ tag body-content="scriptless"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-fmt" prefix="fmt"%> +<%@ taglib uri="tags-lams" prefix="lams"%> <%@ attribute name="type" required="true" rtexprvalue="true"%> <%@ attribute name="style" required="false" rtexprvalue="true"%> <%@ attribute name="title" required="false" rtexprvalue="true"%> <%@ attribute name="titleHelpURL" required="false" rtexprvalue="true"%> <%@ attribute name="headingContent" required="false" rtexprvalue="true"%> +<%@ attribute name="usePanel" required="false" rtexprvalue="true"%> +<%@ attribute name="hideProgressBar" required="false" rtexprvalue="true"%> + + true + + -
-
+ + <%-- Combined tab and navigation bar used in authoring and monitoring --%> +
+
+ +
+
+
+
+ + + <%-- Learner --%> + + <%-- Try to get authoring preview/learning/monitoring from the tool activity so we don't show the progress bar in monitoring --%> + + + + + + + + + + + <%-- only have sidebar and presence in learner main window, not in popup windows --%> + + + <%-- Links placed in body instead of head. Ugly, but it works. --%> + + + - - - - - -
- -
-
- - - ${titleHelpURL} - -
- - + + + + + + <%-- Desperately try to get tool session ID from the tool activity --%> + + + + + + + + + + + + + + + + + + + + + + + + ${toolForm.toolSessionID} + + + + + + + + + <%-- end of sidebar stuff - only used if in learner screen --%> + + +
+ + + - + \ No newline at end of file