Index: lams_central/web/WEB-INF/struts/struts-config.xml =================================================================== diff -u -r662af4c9490c6c67127cda6c29d7d806a9e9eaca -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_central/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 662af4c9490c6c67127cda6c29d7d806a9e9eaca) +++ lams_central/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -189,24 +189,12 @@ /> - - + + - - - - - - org.lamsfoundation.lams.central.ApplicationResources + contextConfigLocation @@ -607,6 +625,8 @@ /authoringConfirm.jsp /community.jsp /editprofile.jsp + /findUserLessons.jsp + /findUserLessonsAutocomplete.jsp /footer.jsp /group.jsp /groupContents.jsp @@ -632,6 +652,7 @@ /fckeditor/* /toolcontent/* /development/* + /pedagogical_planner/* /JHB/* Index: lams_central/web/fckeditor/editor/plugins/videorecorder/VideoRecorderFCKEditor.jsp =================================================================== diff -u -r0bbad8932a51efb88ac79f78bf2c7d7396554fe9 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_central/web/fckeditor/editor/plugins/videorecorder/VideoRecorderFCKEditor.jsp (.../VideoRecorderFCKEditor.jsp) (revision 0bbad8932a51efb88ac79f78bf2c7d7396554fe9) +++ lams_central/web/fckeditor/editor/plugins/videorecorder/VideoRecorderFCKEditor.jsp (.../VideoRecorderFCKEditor.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -2,7 +2,13 @@ <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> <%@ taglib uri="tags-lams" prefix="lams" %> +<%@ taglib uri="tags-core" prefix="c"%> +<% + String red5Url = Configuration.get(ConfigurationKeys.RED5_SERVER_URL); + String red5RecordingsUrl = Configuration.get(ConfigurationKeys.RED5_RECORDINGS_URL); +%> + @@ -31,24 +37,20 @@ + + + + - - - <%-- initial html / presence.js adds on html into here --%> - + <%-- only pop the message box if im is enabled --%> @@ -93,6 +118,7 @@ + <%-- always pop the roster --%> @@ -111,5 +137,12 @@ + + <%-- div reserved for storing context menus --%> + + + <%-- floating div shown when IE6 is being used --%> + + Sorry, Internet Explorer 6 is not compatible with Presence Chat \ No newline at end of file Index: lams_learning/web/mainflash.jsp =================================================================== diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_learning/web/mainflash.jsp (.../mainflash.jsp) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8) +++ lams_learning/web/mainflash.jsp (.../mainflash.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -153,7 +153,7 @@ - <%@ include file="/includes/presenceChat.jsp" %> + <%@ include file="/includes/presenceChat.jsp" %> " scrolling="auto" style="border: none ; margin-left: 160px;"> Index: lams_tool_videorecorder/build.xml =================================================================== diff -u -r0bbad8932a51efb88ac79f78bf2c7d7396554fe9 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/build.xml (.../build.xml) (revision 0bbad8932a51efb88ac79f78bf2c7d7396554fe9) +++ lams_tool_videorecorder/build.xml (.../build.xml) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -482,7 +482,7 @@ - Index: lams_tool_videorecorder/conf/hibernate/mappings/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.hbm.xml =================================================================== diff -u -r01f1d853607cc14f73aa2429275084f4890f92b7 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/conf/hibernate/mappings/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.hbm.xml (.../VideoRecorder.hbm.xml) (revision 01f1d853607cc14f73aa2429275084f4890f92b7) +++ lams_tool_videorecorder/conf/hibernate/mappings/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.hbm.xml (.../VideoRecorder.hbm.xml) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -250,6 +250,14 @@ + + + + + + sessionDTOs = new TreeSet(); + public VideoRecorderRecordingDTO authorRecording; + public Long currentTab; /* Constructors */ @@ -101,10 +103,13 @@ exportOffline = videoRecorder.isExportOffline(); reflectOnActivity = videoRecorder.isReflectOnActivity(); reflectInstructions = videoRecorder.getReflectInstructions(); - onlineInstructionsFiles = new TreeSet(); offlineInstructionsFiles = new TreeSet(); + if(videoRecorder.getAuthorRecording() != null){ + authorRecording = new VideoRecorderRecordingDTO(); + } + for (Iterator i = videoRecorder.getVideoRecorderAttachments().iterator(); i.hasNext();) { VideoRecorderAttachment att = (VideoRecorderAttachment) i.next(); if (att.getFileType().equals(IToolContentHandler.TYPE_OFFLINE)) { @@ -158,6 +163,14 @@ return offlineInstructionsFiles; } + public VideoRecorderRecordingDTO getAuthorRecording() { + return authorRecording; + } + + public void setAuthorRecording(VideoRecorderRecordingDTO authorRecording) { + this.authorRecording = authorRecording; + } + public void setOfflineInstructionsFiles( Set offlineInstructionsFiles) { this.offlineInstructionsFiles = offlineInstructionsFiles; Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderRecordingDTO.java =================================================================== diff -u -r42aa5319fbd33938828764c43dd0ab1ca80e2416 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderRecordingDTO.java (.../VideoRecorderRecordingDTO.java) (revision 42aa5319fbd33938828764c43dd0ab1ca80e2416) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderRecordingDTO.java (.../VideoRecorderRecordingDTO.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -63,6 +63,8 @@ public Float rating; public Boolean isJustSound; + + public Boolean isLocal; public VideoRecorderSession videoRecorderSession; @@ -85,6 +87,7 @@ this.description = videoRecorderRecording.getDescription(); this.rating = videoRecorderRecording.getRating(); this.isJustSound = videoRecorderRecording.getIsJustSound(); + this.isLocal = videoRecorderRecording.getIsLocal(); this.videoRecorderSession = videoRecorderRecording.getVideoRecorderSession(); this.filename = videoRecorderRecording.getFilename(); this.ratings = VideoRecorderRatingDTO.getVideoRecorderRatingDTOs(videoRecorderRecording.getRatings()); @@ -178,7 +181,15 @@ public void setIsJustSound(Boolean isJustSound) { this.isJustSound = isJustSound; } + + public Boolean getIsLocal() { + return isLocal; + } + public void setIsLocal(Boolean isLocal) { + this.isLocal = isLocal; + } + public VideoRecorderSession getVideoRecorderSession() { return this.videoRecorderSession; } Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderSessionDTO.java =================================================================== diff -u -r3d081de4a45da632ee6029251318fac795d41813 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderSessionDTO.java (.../VideoRecorderSessionDTO.java) (revision 3d081de4a45da632ee6029251318fac795d41813) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/dto/VideoRecorderSessionDTO.java (.../VideoRecorderSessionDTO.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -36,17 +36,20 @@ Long sessionID; + String contentFolderId; + String sessionName; Set userDTOs = new TreeSet(); int numberOfLearners; - int numberOfFinishedLearners;; + int numberOfFinishedLearners; public VideoRecorderSessionDTO(VideoRecorderSession session) { this.sessionID = session.getSessionId(); this.sessionName = session.getSessionName(); + this.contentFolderId = session.getContentFolderId(); numberOfFinishedLearners = 0; for (Iterator iterator = session.getVideoRecorderUsers().iterator(); iterator.hasNext();) { @@ -80,6 +83,14 @@ this.sessionName = sessionName; } + public String getContentFolderId() { + return contentFolderId; + } + + public void setContentFolderId(String contentFolderId) { + this.contentFolderId = contentFolderId; + } + public int compareTo(Object o) { int returnValue; VideoRecorderSessionDTO toSession = (VideoRecorderSessionDTO)o; Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.java =================================================================== diff -u -re1dcf9367f649f3377f37e93da076cb6956cce30 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.java (.../VideoRecorder.java) (revision e1dcf9367f649f3377f37e93da076cb6956cce30) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorder.java (.../VideoRecorder.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -100,6 +100,8 @@ private Set videoRecorderSessions; + private VideoRecorderRecording authorRecording; + private Set conditions = new TreeSet(new TextSearchConditionComparator()); // *********** NON Persisit fields @@ -116,8 +118,8 @@ boolean runOffline, boolean lockOnFinished, boolean filteringEnabled, String filterKeywords, String onlineInstructions, String offlineInstructions, boolean contentInUse, boolean defineLater, boolean allowUseVoice, boolean allowUseCamera, boolean allowLearnerVideoExport, boolean allowLearnerVideoVisibility, - Long toolContentId, Set videoRecorderAttachments, Set videoRecorderSessions, boolean exportAll, - boolean exportOffline, boolean reflectOnActivity, String reflectInstructions) { + Long toolContentId, Set videoRecorderAttachments, Set videoRecorderSessions, VideoRecorderRecording authorRecording, + boolean exportAll, boolean exportOffline, boolean reflectOnActivity, String reflectInstructions) { this.createDate = createDate; this.updateDate = updateDate; this.createBy = createBy; @@ -132,6 +134,7 @@ this.toolContentId = toolContentId; this.videoRecorderAttachments = videoRecorderAttachments; this.videoRecorderSessions = videoRecorderSessions; + this.authorRecording = authorRecording; this.allowUseVoice = allowUseVoice; this.allowUseCamera = allowUseCamera; this.allowLearnerVideoVisibility = allowLearnerVideoVisibility; @@ -446,7 +449,24 @@ public void setVideoRecorderSessions(Set videoRecorderSessions) { this.videoRecorderSessions = videoRecorderSessions; } + + /** + * @return Returns the first recording made by author + * + * @hibernate.one-to-one + * column="author_recording_id" + * cascade="none" + * + */ + public VideoRecorderRecording getAuthorRecording() { + return authorRecording; + } + + public void setAuthorRecording(VideoRecorderRecording authorRecording) { + this.authorRecording = authorRecording; + } + /** * @hibernate.set lazy="true" cascade="all" * sort="org.lamsfoundation.lams.learningdesign.TextSearchConditionComparator" Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderComment.java =================================================================== diff -u -r049932651d9d1c08ed1681df0a044d7f519a4215 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderComment.java (.../VideoRecorderComment.java) (revision 049932651d9d1c08ed1681df0a044d7f519a4215) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderComment.java (.../VideoRecorderComment.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -142,7 +142,7 @@ } /** - * @return Returns the VideoRecorderUser of the person who created the recording + * @return Returns the VideoRecorderRecording of the comment * * @hibernate.many-to-one * column="videoRecorder_recording_uid" Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderRecording.java =================================================================== diff -u -r42aa5319fbd33938828764c43dd0ab1ca80e2416 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderRecording.java (.../VideoRecorderRecording.java) (revision 42aa5319fbd33938828764c43dd0ab1ca80e2416) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderRecording.java (.../VideoRecorderRecording.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -28,6 +28,7 @@ import java.util.List; import java.util.Set; +import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; import org.lamsfoundation.lams.tool.videoRecorder.dto.VideoRecorderRecordingDTO; import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderUser; import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderSession; @@ -60,6 +61,8 @@ private String filename; + private Boolean isLocal; + private Boolean isJustSound; private VideoRecorderUser createBy; @@ -84,6 +87,7 @@ this.title = recording.title; this.description = recording.description; this.rating = recording.rating; + this.isLocal = recording.isLocal; this.isJustSound = recording.isJustSound; this.ratings = VideoRecorderRating.getVideoRecorderRatings(recording.ratings); this.comments = VideoRecorderComment.getVideoRecorderComments(recording.comments); @@ -100,6 +104,7 @@ this.title = recording.title; this.description = recording.description; this.rating = recording.rating; + this.isLocal = recording.isLocal; this.isJustSound = false; this.ratings = null; this.comments = null; @@ -110,7 +115,7 @@ /** full constructor */ public VideoRecorderRecording( Date createDate, Date updateDate, VideoRecorderUser createBy, String title, String description, - Float rating, Boolean isJustSound, Long videoRecorderUid, VideoRecorderSession videoRecorderSession, String filename, + Float rating, Boolean isJustSound, Boolean isLocal, Long videoRecorderUid, VideoRecorderSession videoRecorderSession, String filename, Set ratings, Set comments, Long toolContentId) { this.createDate = createDate; @@ -120,13 +125,14 @@ this.description = description; this.rating = rating; this.isJustSound = isJustSound; + this.isLocal = isLocal; this.ratings = ratings; this.comments = comments; this.videoRecorderSession = videoRecorderSession; this.filename = filename; this.toolContentId = toolContentId; } - + // Property accessors /** * @hibernate.id generator-class="native" type="java.lang.Long" column="uid" @@ -248,6 +254,19 @@ public void setIsJustSound(Boolean isJustSound) { this.isJustSound = isJustSound; } + + /** + * @hibernate.property column="is_local" + * + */ + + public Boolean getIsLocal() { + return isLocal; + } + + public void setIsLocal(Boolean isLocal) { + this.isLocal = isLocal; + } /** * Gets the toolSession Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderSession.java =================================================================== diff -u -r42aa5319fbd33938828764c43dd0ab1ca80e2416 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderSession.java (.../VideoRecorderSession.java) (revision 42aa5319fbd33938828764c43dd0ab1ca80e2416) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/model/VideoRecorderSession.java (.../VideoRecorderSession.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -58,6 +58,8 @@ private Long sessionId; private String sessionName; + + private String contentFolderId; private VideoRecorder videoRecorder; @@ -71,13 +73,14 @@ /** full constructor */ public VideoRecorderSession(Date sessionEndDate, Date sessionStartDate, - Integer status, Long sessionId, String sessionName, VideoRecorder videoRecorder, + Integer status, Long sessionId, String sessionName, String contentFolderId, VideoRecorder videoRecorder, Set videoRecorderUsers) { this.sessionEndDate = sessionEndDate; this.sessionStartDate = sessionStartDate; this.status = status; this.sessionId = sessionId; this.sessionName = sessionName; + this.contentFolderId = contentFolderId; this.videoRecorder = videoRecorder; this.videoRecorderUsers = videoRecorderUsers; } @@ -165,7 +168,20 @@ public void setSessionName(String sessionName) { this.sessionName = sessionName; } + + /** + * @hibernate.property column="content_folder_id" length="32" + * + */ + public String getContentFolderId() { + return this.contentFolderId; + } + + public void setContentFolderId(String contentFolderId) { + this.contentFolderId = contentFolderId; + } + /** * @hibernate.many-to-one not-null="true" * @hibernate.column name="videoRecorder_uid" Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/service/VideoRecorderService.java =================================================================== diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/service/VideoRecorderService.java (.../VideoRecorderService.java) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/service/VideoRecorderService.java (.../VideoRecorderService.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -88,6 +88,7 @@ import org.lamsfoundation.lams.tool.videoRecorder.util.VideoRecorderException; import org.lamsfoundation.lams.tool.videoRecorder.util.VideoRecorderToolContentHandler; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.FileUtil; import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.util.audit.IAuditService; @@ -152,6 +153,8 @@ VideoRecorderSession session = new VideoRecorderSession(); session.setSessionId(toolSessionId); session.setSessionName(toolSessionName); + session.setContentFolderId(FileUtil.generateUniqueContentFolderID()); + // learner starts // TODO need to also set other fields. VideoRecorder videoRecorder = videoRecorderDAO.getByContentId(toolContentId); @@ -283,8 +286,16 @@ // set ResourceToolContentHandler as null to avoid copy file node in // repository again. videoRecorder = VideoRecorder.newInstance(videoRecorder, toolContentId, null); + videoRecorder.setToolContentId(null); videoRecorder.setToolContentHandler(null); videoRecorder.setVideoRecorderSessions(null); + + VideoRecorderRecording authorRecording = (VideoRecorderRecording)getFirstRecordingByToolContentId(toolContentId).clone(); + authorRecording.setToolContentId(null); + authorRecording.setComments(null); + authorRecording.setRatings(null); + videoRecorder.setAuthorRecording(authorRecording); + Set atts = videoRecorder.getVideoRecorderAttachments(); for (VideoRecorderAttachment att : atts) { att.setVideoRecorder(null); @@ -317,12 +328,18 @@ + toolPOJO); } VideoRecorder videoRecorder = (VideoRecorder) toolPOJO; - + + VideoRecorderRecording recording = videoRecorder.getAuthorRecording(); + // reset it to new toolContentId videoRecorder.setToolContentId(toolContentId); - videoRecorder.setCreateBy(new Long(newUserUid.longValue())); + videoRecorder.getAuthorRecording().setToolContentId(toolContentId); videoRecorderDAO.saveOrUpdate(videoRecorder); + + if(recording != null){ + videoRecorderRecordingDAO.saveOrUpdate(recording); + } } catch (ImportToolContentException e) { throw new ToolException(e); } Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/LearningAction.java =================================================================== diff -u -r42aa5319fbd33938828764c43dd0ab1ca80e2416 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/LearningAction.java (.../LearningAction.java) (revision 42aa5319fbd33938828764c43dd0ab1ca80e2416) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/LearningAction.java (.../LearningAction.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -29,13 +29,16 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.dao.IBaseDAO; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.ToolSession; import org.lamsfoundation.lams.tool.ToolSessionManager; import org.lamsfoundation.lams.tool.exception.DataMissingException; import org.lamsfoundation.lams.tool.exception.ToolException; @@ -57,6 +60,8 @@ import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.util.Configuration; import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; /** * @author @@ -79,7 +84,7 @@ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { - + LearningForm learningForm = (LearningForm) form; // 'toolSessionID' and 'mode' paramters are expected to be present. @@ -135,6 +140,14 @@ request.setAttribute("toolSessionId", toolSessionID); request.setAttribute("toolContentId", toolContentID); + // getting the contentfolderid using the session and lesson + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); + IBaseDAO baseDAO =(IBaseDAO) ctx.getBean("baseDAO"); + ToolSession toolSession = (ToolSession)baseDAO.find(ToolSession.class, toolSessionID); + String contentFolderId = toolSession.getLesson().getLearningDesign().getContentFolderID(); + + request.setAttribute("contentFolderId", contentFolderId); + // set language xml request.setAttribute("languageXML", videoRecorderService.getLanguageXML()); Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/VideoRecorderAction.java =================================================================== diff -u --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/VideoRecorderAction.java (revision 0) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/actions/VideoRecorderAction.java (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -0,0 +1,610 @@ +/**************************************************************** + * 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 + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.videoRecorder.web.actions; + +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Set; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.dao.IBaseDAO; +import org.lamsfoundation.lams.tool.ToolSession; +import org.lamsfoundation.lams.tool.videoRecorder.dto.VideoRecorderCommentDTO; +import org.lamsfoundation.lams.tool.videoRecorder.dto.VideoRecorderRatingDTO; +import org.lamsfoundation.lams.tool.videoRecorder.dto.VideoRecorderRecordingDTO; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorder; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderComment; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderRating; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderRecording; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderSession; +import org.lamsfoundation.lams.tool.videoRecorder.model.VideoRecorderUser; +import org.lamsfoundation.lams.tool.videoRecorder.service.IVideoRecorderService; +import org.lamsfoundation.lams.tool.videoRecorder.service.VideoRecorderServiceProxy; +import org.lamsfoundation.lams.tool.videoRecorder.util.VideoRecorderRecordingComparator; +import org.lamsfoundation.lams.util.Base64StringToImageUtil; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.action.LamsDispatchAction; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** +* @author Paul Georges + +* ----------------XDoclet Tags-------------------- +* +* @struts:action path="/videoRecorderActions" +* parameter="method" +* validate="false" +* +* ----------------XDoclet Tags-------------------- +*/ +public class VideoRecorderAction extends LamsDispatchAction { + + private static Logger logger = Logger.getLogger(VideoRecorderAction.class); + + //--------------------------------------------------------------------- + private static final String TOOL_SESSION_ID = "toolSessionId"; + private static final String TOOL_CONTENT_ID = "toolContentId"; + private static final String USER_ID = "userId"; + private static final String TITLE = "title"; + private static final String DESCRIPTION = "description"; + private static final String FILENAME = "filename"; + private static final String RECORDING_ID = "recordingId"; + private static final String COMMENT_ID = "commentId"; + private static final String RATING = "rating"; + private static final String RATING_ID = "ratingId"; + private static final String COMMENT = "comment"; + private static final String IS_JUST_SOUND = "isJustSound"; + private static final String IS_LOCAL = "isLocal"; + private static final String SORT_BY = "sortBy"; + private static final String SORT_DIR = "sortDirection"; + private static final String GET_ALL = "getAll"; + private static final String OK_MSG = "ok"; + private static final String ERROR_MSG = "error"; + private static final String EXTENSTION = "ext"; + private static final String IMAGEDATA = "data"; + private static final String DIR = "dir"; + + private static final String FLV_EXTENSION = ".flv"; + private static final String JPG_EXTENSION = ".jpg"; + + /** + * Desctipion + * + * Input parameters: toolSessionID, userID (possibly null) + * + * Output format: xml + */ + public ActionForward getRecordingsByToolSessionIdAndUserId(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + // get paramaters from POST + Long toolSessionId = WebUtil.readLongParam(request, TOOL_SESSION_ID); + Long toolContentId = WebUtil.readLongParam(request, TOOL_CONTENT_ID); + Long userId = WebUtil.readLongParam(request, USER_ID); + String sortBy = WebUtil.readStrParam(request, SORT_BY); + String sortDirection = WebUtil.readStrParam(request, SORT_DIR); + boolean getAll = WebUtil.readBooleanParam(request, GET_ALL); + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // get session + VideoRecorderSession session = videoRecorderService.getSessionBySessionId(toolSessionId); + + // create list of recording DTOs + List videoRecorderRecordingDTOs; + + // if no user is specified + if(getAll){ + // get all recordings + videoRecorderRecordingDTOs = videoRecorderService.getRecordingsByToolSessionId(toolSessionId, toolContentId); + // otherwise + } else{ + // get all recordings from user specified + videoRecorderRecordingDTOs = videoRecorderService.getRecordingsByToolSessionIdAndUserId(toolSessionId, userId, toolContentId); + } + + // sort the list of recording DTOs in order to create the xml correctly + Comparator comp = new VideoRecorderRecordingComparator(sortBy, sortDirection); + Collections.sort(videoRecorderRecordingDTOs, comp); + + String contentFolderIdLearner = session.getContentFolderId(); + String previewImageLearnerPath = Configuration.get(ConfigurationKeys.SERVER_URL) + File.separator + "www" + File.separator + "secure" + File.separator + contentFolderIdLearner + File.separator + "previewImages" + File.separator; + + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); + IBaseDAO baseDAO =(IBaseDAO) ctx.getBean("baseDAO"); + ToolSession toolSession = (ToolSession)baseDAO.find(ToolSession.class, toolSessionId); + String contentFolderIdAuthor = toolSession.getLesson().getLearningDesign().getContentFolderID(); + String previewImageAuthorPath = Configuration.get(ConfigurationKeys.SERVER_URL) + File.separator + "www" + File.separator + "secure" + File.separator + contentFolderIdAuthor + File.separator + "Recordings" + File.separator; + + String soundOnlyImage = Configuration.get(ConfigurationKeys.SERVER_URL) + File.separator + "tool" + File.separator + "lavidr10" + File.separator + "images" + File.separator + "soundOnly.png"; + + String xmlOutput = buildVideoRecordingsXML(videoRecorderRecordingDTOs, userId, previewImageLearnerPath, previewImageAuthorPath, soundOnlyImage); + + response.setContentType("text/xml"); + response.setCharacterEncoding("UTF-8"); + writeAJAXResponse(response, xmlOutput); + return null; + } + + public ActionForward saveRecording(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + try{ + // get paramaters from POST + Long toolSessionId = WebUtil.readLongParam(request, TOOL_SESSION_ID, true); + Long toolContentId = WebUtil.readLongParam(request, TOOL_CONTENT_ID, true); + Long recordingId = WebUtil.readLongParam(request, RECORDING_ID, true); + Long userId = WebUtil.readLongParam(request, USER_ID, true); + String title = WebUtil.readStrParam(request, TITLE, true); + String description = WebUtil.readStrParam(request, DESCRIPTION, true); + String filename = WebUtil.readStrParam(request, FILENAME, true); + Boolean isJustSound = WebUtil.readBooleanParam(request, IS_JUST_SOUND, false); + Boolean isLocal = WebUtil.readBooleanParam(request, IS_LOCAL, false); + int rating = WebUtil.readIntParam(request, RATING, false); + + title = title.replaceAll("[<>\"]", ""); + description = description.replaceAll("[<>\"]", ""); + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // initialize session, user and recording + VideoRecorderSession session = null; + VideoRecorderUser user = null; + VideoRecorderRecording videoRecording = null; + VideoRecorder videoRecorder = null; + + // if saving from author + if(toolContentId != -1){ + // get video recorder + videoRecorder = videoRecorderService.getVideoRecorderByContentId(toolContentId); + + if(videoRecorder != null){ + // get recording + videoRecording = videoRecorderService.getFirstRecordingByToolContentId(toolContentId); + + // if no recording exists create a new one + if(videoRecording == null){ + videoRecording = new VideoRecorderRecording(); + + videoRecording.setFilename(filename); + videoRecording.setRating((float)rating); + videoRecording.setCreateDate(new Date()); + videoRecording.setIsJustSound(isJustSound); + videoRecording.setIsLocal(isLocal); + videoRecording.setRatings(null); + videoRecording.setComments(null); + videoRecording.setCreateBy(null); + videoRecording.setToolContentId(toolContentId); + } + } + + } + // if saving from learner + else if(toolSessionId != -1){ + // get session + session = videoRecorderService.getSessionBySessionId(toolSessionId); + + // get user + user = videoRecorderService.getUserByUID(userId); + + // if no recording id is specified + if(recordingId == -1){ + // create a new recording + videoRecording = new VideoRecorderRecording(); + videoRecording.setFilename(filename); + videoRecording.setRating((float)rating); + videoRecording.setCreateDate(new Date()); + videoRecording.setIsJustSound(isJustSound); + videoRecording.setIsLocal(isLocal); + videoRecording.setRatings(null); + videoRecording.setComments(null); + videoRecording.setCreateBy(user); + videoRecording.setVideoRecorderSession(session); + } + // otherwise get the recording from the DAO + else{ + videoRecording = videoRecorderService.getRecordingById(recordingId); + } + } + + // add the last common information + videoRecording.setUpdateDate(new Date()); + videoRecording.setTitle(title); + videoRecording.setDescription(description); + videoRecording.setFilename(filename); + + // save + videoRecorderService.saveOrUpdateVideoRecorderRecording(videoRecording); + + writeAJAXResponse(response, OK_MSG); + + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + } + + public ActionForward deleteRecording(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + try{ + // get paramaters from POST + Long recordingId = WebUtil.readLongParam(request, RECORDING_ID); + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // get videoRecording + VideoRecorderRecording videoRecording = videoRecorderService.getRecordingById(recordingId); + + // delete the videoRecording + videoRecorderService.deleteVideoRecorderRecording(videoRecording); + + writeAJAXResponse(response, OK_MSG); + + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + } + + public ActionForward saveComment(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + try{ + Long commentId = WebUtil.readLongParam(request, COMMENT_ID); + Long recordingId = WebUtil.readLongParam(request, RECORDING_ID); + Long toolSessionId = WebUtil.readLongParam(request, TOOL_SESSION_ID); + Long userId = WebUtil.readLongParam(request, USER_ID); + String commentText = WebUtil.readStrParam(request, COMMENT, true); + + commentText = commentText.replaceAll("[<>\"]", ""); + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // create new comment + VideoRecorderComment comment; + + // get user + VideoRecorderUser user = videoRecorderService.getUserByUID(userId); + + // get recording + VideoRecorderRecording recording = videoRecorderService.getRecordingById(recordingId); + + // get session + VideoRecorderSession session = videoRecorderService.getSessionBySessionId(toolSessionId); + + // create a new comment + if(commentId == -1){ + comment = new VideoRecorderComment(); + comment.setCreateBy(user); + comment.setRecording(recording); + comment.setCreateDate(new Date()); + comment.setText(commentText); + comment.setVideoRecorderSession(session); + } + // otherwise get the comment from the DAO + else{ + comment = videoRecorderService.getCommentById(commentId); + comment.setText(commentText); + } + + // get comments from recording + Set comments = recording.getComments(); + + // add new comment to recording's comments + comments.add(comment); + + // save the recording + videoRecorderService.saveOrUpdateVideoRecorderRecording(recording); + + // refresh the recording object in order to get that last comment + recording = videoRecorderService.getRecordingById(recordingId); + + // get the comments from the recording and transform the set into a set of DTOs + Set commentDTOs = VideoRecorderCommentDTO.getVideoRecorderCommentDTOs(recording.getComments()); + + // return a response with all comments for current recording + response.setContentType("text/xml"); + response.setCharacterEncoding("UTF-8"); + writeAJAXResponse(response, buildVideoCommentsXML(commentDTOs)); + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + } + + public ActionForward saveRating(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + try{ + Long ratingId = WebUtil.readLongParam(request, RATING_ID); + Long recordingId = WebUtil.readLongParam(request, RECORDING_ID); + Long toolSessionId = WebUtil.readLongParam(request, TOOL_SESSION_ID); + Long userId = WebUtil.readLongParam(request, USER_ID); + float ratingFloat = Float.valueOf(WebUtil.readStrParam(request, RATING)); + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // create new rating + VideoRecorderRating rating; + + // get user + VideoRecorderUser user = videoRecorderService.getUserByUID(userId); + + // get recording + VideoRecorderRecording recording = videoRecorderService.getRecordingById(recordingId); + + // get session + VideoRecorderSession session = videoRecorderService.getSessionBySessionId(toolSessionId); + + // create new rating + if(ratingId == -1){ + rating = new VideoRecorderRating(); + rating.setCreateBy(user); + rating.setRecording(recording); + rating.setCreateDate(new Date()); + rating.setRating(ratingFloat); + rating.setVideoRecorderSession(session); + } + // otherwise get the rating from the DAO + else{ + rating = videoRecorderService.getRatingById(ratingId); + rating.setRating(ratingFloat); + } + + // get ratings + Set ratings = recording.getRatings(); + + // add new rating + ratings.add(rating); + + // set the average rating through calculation + recording.setRating(calculateRating(ratings)); + + // save recording with new rating + videoRecorderService.saveOrUpdateVideoRecorderRecording(recording); + + // refresh recording + recording = videoRecorderService.getRecordingById(recordingId); + + response.setContentType("text/xml"); + response.setCharacterEncoding("UTF-8"); + writeAJAXResponse(response, buildRatingResultXML(recording.getRating(), ratingFloat)); + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + } + + public ActionForward getLanguageXML(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + // get service + try{ + response.setContentType("text/xml"); + response.setCharacterEncoding("UTF-8"); + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + writeAJAXResponse(response, videoRecorderService.getLanguageXML()); + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + + } + + public ActionForward saveImage(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + try{ + String dir = WebUtil.readStrParam(request, DIR, true); + String filename = WebUtil.readStrParam(request, FILENAME); + String ext = WebUtil.readStrParam(request, EXTENSTION); + String data = WebUtil.readStrParam(request, IMAGEDATA); + Long toolSessionId = WebUtil.readLongParam(request, TOOL_SESSION_ID, true); + + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // if this is being added by a learner + if(toolSessionId != null){ + VideoRecorderSession session = videoRecorderService.getSessionBySessionId(toolSessionId); + String folder = session.getContentFolderId(); + dir = Configuration.get(ConfigurationKeys.LAMS_EAR_DIR) + File.separator + "lams-www.war" + File.separator + "secure" + File.separator + folder + File.separator + "previewImages" + File.separator; + } + + // at this point, the dir variable should contain a path to the learning design content folder (author) + // or a path to the session content folder (learner) + if(dir != null){ + boolean success = Base64StringToImageUtil.create(dir, filename, ext, data); + writeAJAXResponse(response, String.valueOf(success)); + } + else{ + writeAJAXResponse(response, ERROR_MSG); + } + }catch(Exception e){ + writeAJAXResponse(response, ERROR_MSG + e.getMessage()); + } + + return null; + + } + + public ActionForward getLanguageXMLForFCK(ActionMapping mapping, + ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + // get service + try{ + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + response.setContentType("text/xml"); + response.setCharacterEncoding("UTF-8"); + writeAJAXResponse(response, videoRecorderService.getLanguageXMLForFCK()); + }catch(Exception e){ + writeAJAXResponse(response, ""); + } + + return null; + + } + + private String buildVideoRecordingsXML(List videoRecorderRecordingDTOs, Long userId, String previewImageLearnerPath, String previewImageAuthorPath, String soundOnlyImage){ + //start the output + String xmlOutput = ""; + + // get service + IVideoRecorderService videoRecorderService = VideoRecorderServiceProxy.getVideoRecorderService(getServlet().getServletContext()); + + // for all recordings, print out their information + for(VideoRecorderRecordingDTO videoRecorderRecordingDTO: videoRecorderRecordingDTOs){ + VideoRecorderUser user = videoRecorderRecordingDTO.getCreateBy(); + Set comments = videoRecorderRecordingDTO.getComments(); + + Set ratings = videoRecorderRecordingDTO.getRatings(); + + xmlOutput += ""; + xmlOutput += "" + videoRecorderRecordingDTO.getUid() + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getTitle() + ""; + + // user stuff + if(user != null){ + xmlOutput += "false"; + xmlOutput += "" + user.getUid() + ""; + xmlOutput += "" + user.getUserId() + ""; + xmlOutput += "" + user.getFirstName() + " " + user.getLoginName() + ""; + } + else if(user == null && videoRecorderRecordingDTO.getToolContentId() != -1){ + xmlOutput += "true"; + xmlOutput += "" + videoRecorderService.getMessage("videorecorder.instructor") + ""; + } + + xmlOutput += "" + videoRecorderRecordingDTO.getCreateDate().toLocaleString() + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getUpdateDate().toLocaleString() + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getDescription() + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getFilename() + FLV_EXTENSION + ""; + + // preview image stuff + if(videoRecorderRecordingDTO.getIsJustSound()){ + xmlOutput += "" + soundOnlyImage + ""; + }else{ + if(user != null){ + xmlOutput += "" + previewImageLearnerPath + videoRecorderRecordingDTO.getFilename() + JPG_EXTENSION + ""; + } + else if(user == null && videoRecorderRecordingDTO.getToolContentId() != -1){ + xmlOutput += "" + previewImageAuthorPath + videoRecorderRecordingDTO.getFilename() + JPG_EXTENSION + ""; + } + } + xmlOutput += "" + videoRecorderRecordingDTO.getRating() + ""; + xmlOutput += "" + buildUserRating(ratings, userId) + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getIsJustSound() + ""; + xmlOutput += "" + videoRecorderRecordingDTO.getIsLocal() + ""; + + // for every recording, print out its comments + xmlOutput += buildVideoCommentsXML(comments); + xmlOutput += ""; + } + + xmlOutput += ""; + return xmlOutput; + } + + private String buildVideoCommentsXML(Set comments){ + String xmlOutput = ""; + + VideoRecorderCommentDTO[] commentArray = (VideoRecorderCommentDTO[])comments.toArray(new VideoRecorderCommentDTO[comments.size()]); + + //for(VideoRecorderCommentDTO comment: comments){ + for(int i = commentArray.length - 1; i >= 0; i--){ + VideoRecorderCommentDTO comment = commentArray[i]; + xmlOutput += ""; + xmlOutput += "" + comment.getCreateBy().getFirstName() + " " + comment.getCreateBy().getLastName() + ""; + xmlOutput += "" + comment.getCreateDate().toLocaleString() + ""; + xmlOutput += "" + comment.getText() + ""; + xmlOutput += ""; + } + + xmlOutput += ""; + + return xmlOutput; + } + + private String buildRatingResultXML(Float rating, Float userRating){ + String xmlOutput = ""; + xmlOutput += "" + rating.toString() + ""; + xmlOutput += "" + userRating.toString() + ""; + xmlOutput += ""; + return xmlOutput; + } + + private String buildUserRating(Set ratings, Long userId){ + for(VideoRecorderRatingDTO rating: ratings){ + if(rating.createBy.getUid().longValue() == userId.longValue()){ + return "" + rating.rating; + } + } + return "-1"; + } + + private float calculateRating(Set ratings){ + if(ratings.isEmpty() || ratings == null){ + return 0; + } + else{ + float totalRating = 0; + for(VideoRecorderRating rating: ratings){ + totalRating += rating.getRating(); + } + totalRating = totalRating / ratings.size(); + + return totalRating; + } + } +} \ No newline at end of file Index: lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/servlets/ExportServlet.java =================================================================== diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8) +++ lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/servlets/ExportServlet.java (.../ExportServlet.java) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -91,8 +91,6 @@ .getVideoRecorderService(getServletContext()); } - toolSessionID = new Long(request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID)); - try { if (StringUtils.equals(mode, ToolAccessMode.LEARNER.toString())) { request.getSession().setAttribute(AttributeNames.ATTR_MODE, @@ -258,7 +256,7 @@ .getAttribute(AttributeNames.USER); // get video recording dtos from just tool content id - List videoRecorderRecordingDTOs = videoRecorderService.getRecordingsByToolSessionId(new Long(0), toolContentID); + List videoRecorderRecordingDTOs = videoRecorderService.getRecordingsByToolSessionId(toolSessionID, toolContentID); // get nb of recordings int nbRecordings = videoRecorderRecordingDTOs.size(); @@ -303,11 +301,14 @@ // bundling files try { - String[] urls = new String[1]; - urls[0] = VIDEORECORDER_INCLUDES_HTTP_FOLDER_URL; + String[] srcDirs = new String[2]; + srcDirs[0] = VIDEORECORDER_INCLUDES_HTTP_FOLDER_URL; + + String[] targetDirs = new String[2]; + targetDirs[0] = directoryName + File.separator + "files"; MultipleDirFileBundler fileBundler = new MultipleDirFileBundler(); - fileBundler.bundle(request, cookies, directoryName, urls, fileArray); + fileBundler.bundle(request, cookies, srcDirs, targetDirs, fileArray); } catch (Exception e) { logger.error("Could not bundle files", e); } @@ -316,9 +317,7 @@ private void bundleFilesForOffline(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, List videoRecorderRecordingDTOs){ - // prepare the file array - // index 0 is for the files from VIDEORECORDER_INCLUDES_HTTP_FOLDER_URL - // index 1 is for the files from VIDEORECORDER_RECORDINGS_HTTP_FOLDER_URL + // prepare ArrayList[] fileArray = new ArrayList[2]; fileArray[0] = new ArrayList(); fileArray[1] = new ArrayList(); @@ -336,48 +335,24 @@ // get the video recording VideoRecorderRecordingDTO vr = (VideoRecorderRecordingDTO) iter.next(); - // success indicator - int success = 0; - - String absoluteFilePath = VIDEORECORDER_RECORDINGS_FOLDER_DEST + vr.getFilename() + FLV_EXTENSION; - - // fetch file locally - File f = new File(absoluteFilePath); - - // if file doesn't exist locally - if(!f.exists()){ - // create the file - f.createNewFile(); - // fetch from server - success = HttpUrlConnectionUtil.writeResponseToFile(VIDEORECORDER_RECORDINGS_FOLDER_SRC + vr.getFilename() + FLV_EXTENSION, VIDEORECORDER_RECORDINGS_FOLDER_DEST, vr.getFilename() + FLV_EXTENSION, cookies); - } - // if it does exists - else{ - // w00t - success = 1; - } - - // if we have a file - if(success == 1){ - // add the filename to the list - fileArray[1].add(vr.getFilename() + FLV_EXTENSION); - logger.debug("file copy complete"); - }else{ - logger.debug("file copy failed"); - } + fileArray[1].add(vr.getFilename() + FLV_EXTENSION); } } catch (Exception e) { logger.error("Could not find files on Red5 server", e); } // bundling files try { - String[] urls = new String[2]; - urls[0] = VIDEORECORDER_INCLUDES_HTTP_FOLDER_URL; - urls[1] = VIDEORECORDER_RECORDINGS_HTTP_FOLDER_URL; + String[] srcDirs = new String[2]; + srcDirs[0] = VIDEORECORDER_INCLUDES_HTTP_FOLDER_URL; + srcDirs[1] = VIDEORECORDER_RECORDINGS_FOLDER_SRC; + + String[] targetDirs = new String[2]; + targetDirs[0] = directoryName + File.separator + "files"; + targetDirs[1] = directoryName + File.separator + "files"; MultipleDirFileBundler fileBundler = new MultipleDirFileBundler(); - fileBundler.bundle(request, cookies, directoryName, urls, fileArray); + fileBundler.bundle(request, cookies, srcDirs, targetDirs, fileArray); } catch (Exception e) { logger.error("Could not bundle files", e); } Fisheye: Tag f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 refers to a dead (removed) revision in file `lams_tool_videorecorder/src/java/org/lamsfoundation/lams/tool/videoRecorder/web/servlets/VideoRecorderAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_videorecorder/web/images/soundOnly.png =================================================================== diff -u Binary files differ Index: lams_tool_videorecorder/web/includes/flash/VideoRecorder.swf =================================================================== diff -u -r0bbad8932a51efb88ac79f78bf2c7d7396554fe9 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 Binary files differ Index: lams_tool_videorecorder/web/includes/flash/VideoRecorderFCKEditor.swf =================================================================== diff -u -r0bbad8932a51efb88ac79f78bf2c7d7396554fe9 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 Binary files differ Index: lams_tool_videorecorder/web/pages/authoring/authoring.jsp =================================================================== diff -u -r3d081de4a45da632ee6029251318fac795d41813 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 3d081de4a45da632ee6029251318fac795d41813) +++ lams_tool_videorecorder/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -24,7 +24,6 @@ - @@ -58,8 +57,6 @@ - <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> -<%@ taglib uri="tags-lams" prefix="lams" %> <%@ include file="/common/taglibs.jsp"%> - - @@ -46,8 +32,15 @@ - +<%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> <%@ include file="/common/taglibs.jsp"%> @@ -6,5 +8,16 @@ +<% + String red5Url = Configuration.get(ConfigurationKeys.RED5_SERVER_URL); + String red5RecordingsUrl = Configuration.get(ConfigurationKeys.RED5_RECORDINGS_URL); +%> + + + + + Index: lams_tool_videorecorder/web/pages/export/exportPortfolio.jsp =================================================================== diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/web/pages/export/exportPortfolio.jsp (.../exportPortfolio.jsp) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8) +++ lams_tool_videorecorder/web/pages/export/exportPortfolio.jsp (.../exportPortfolio.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -111,10 +111,10 @@ "src", "./files/VideoRecorderFCKEditor", - "FlashVars", "&mode="+'playerModeOffline'+'&red5ServerUrl='+'${red5ServerUrl}'+'&serverUrl='+'${serverUrl}'+'&filename='+'${recording.filename}'+'.flv'+'&languageXML='+"${languageXML}"+"", + "FlashVars", "&mode="+'playerModeOffline' + '&offlinePlayback=false' + '&red5ServerUrl='+'${red5ServerUrl}' + '&serverUrl='+'${serverUrl}' + '&filename='+'${recording.filename}'+'.flv' + '&languageXML=' + "${languageXML}"+"", - "FlashVars", "&mode="+'playerModeOnline'+'&red5ServerUrl='+'${red5ServerUrl}'+'&serverUrl='+'${serverUrl}'+'&filename='+'${recording.filename}'+'.flv'+'&languageXML='+"${languageXML}"+"", + "FlashVars", "&mode="+'playerModeOnline' + '&offlinePlayback=true' + '&red5ServerUrl='+'${red5ServerUrl}' + '&serverUrl='+'${serverUrl}' + '&filename='+'${recording.filename}'+'.flv' + '&languageXML=' + "${languageXML}"+"", "width", "361", Index: lams_tool_videorecorder/web/pages/learning/videoRecorder.jsp =================================================================== diff -u -r0bbad8932a51efb88ac79f78bf2c7d7396554fe9 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/web/pages/learning/videoRecorder.jsp (.../videoRecorder.jsp) (revision 0bbad8932a51efb88ac79f78bf2c7d7396554fe9) +++ lams_tool_videorecorder/web/pages/learning/videoRecorder.jsp (.../videoRecorder.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -1,4 +1,18 @@ +<%@ page import="org.lamsfoundation.lams.util.Configuration" %> +<%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> <%@ include file="/common/taglibs.jsp"%> + +<% + String red5Url = Configuration.get(ConfigurationKeys.RED5_SERVER_URL); + String red5RecordingsUrl = Configuration.get(ConfigurationKeys.RED5_RECORDINGS_URL); +%> + + + + + + + Index: lams_tool_videorecorder/web/pages/monitoring/summary.jsp =================================================================== diff -u -r61df3f3f473a3619f93c63ceb879ae36438020e8 -rf0bef7d11b4f82936c417e6e55c25fe9bfdb9a82 --- lams_tool_videorecorder/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 61df3f3f473a3619f93c63ceb879ae36438020e8) +++ lams_tool_videorecorder/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision f0bef7d11b4f82936c417e6e55c25fe9bfdb9a82) @@ -1,3 +1,5 @@ +<%@ page import="org.lamsfoundation.lams.util.Configuration" %> +<%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> <%@ include file="/common/taglibs.jsp"%> @@ -210,7 +212,21 @@ // embed the Flash Content SWF when all tests are passed AC_FL_RunContent( "src", "./includes/flash/VideoRecorder", - "FlashVars", "contentEditable="+${contentEditable}+'&toolSessionId='+${toolSessionId}+'&toolContentId='+${toolContentId}+'&mode='+'${mode}'+'&userId='+${userId}+'&allowUseVoice='+${videoRecorderDTO.allowUseVoice}+'&allowUseCamera='+${videoRecorderDTO.allowUseCamera}+'&allowLearnerVideoVisibility='+${videoRecorderDTO.allowLearnerVideoVisibility}+'&allowComments='+${videoRecorderDTO.allowComments}+'&allowRatings='+${videoRecorderDTO.allowRatings}+'&red5ServerUrl='+'${red5ServerUrl}'+'&serverUrl='+'${serverUrl}'+'&languageXML='+"${languageXML}"+"", + "FlashVars", "contentEditable="+${contentEditable} + + '&contentFolderUrl=/lams//www/secure/${contentFolderID}/Recordings/' + + '&toolSessionId='+${toolSessionId} + + '&toolContentId='+${toolContentId} + + '&mode='+'${mode}' + + '&userId='+${userId} + + '&allowUseVoice='+${videoRecorderDTO.allowUseVoice} + + '&allowUseCamera='+${videoRecorderDTO.allowUseCamera} + + '&allowLearnerVideoVisibility='+${videoRecorderDTO.allowLearnerVideoVisibility} + + '&allowComments='+${videoRecorderDTO.allowComments} + + '&allowRatings='+${videoRecorderDTO.allowRatings} + + '&red5ServerUrl='+'${red5ServerUrl}' + + '&serverUrl='+'${serverUrl}' + + '&languageXML='+"${languageXML}" + + "", "width", "100%", "height", "676", "align", "middle",