Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_tool_wiki/.settings/org.eclipse.jdt.core.prefs'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20130716.sql =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20130716.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dbupdates/patch20130716.sql 17 Jul 2013 08:45:12 -0000 1.1 @@ -0,0 +1,17 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; + +----------------------Put all sql statements below here------------------------- + +SET FOREIGN_KEY_CHECKS=0; + +-- LDEV-3078 Wiki tool should start uploading images to www/secure/runtime/ folder +ALTER TABLE tl_lawiki10_session DROP COLUMN content_folder_id; + +SET FOREIGN_KEY_CHECKS=1; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; \ No newline at end of file Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dto/WikiSessionDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dto/WikiSessionDTO.java,v diff -u -r1.3 -r1.4 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dto/WikiSessionDTO.java 15 Oct 2008 02:59:46 -0000 1.3 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/dto/WikiSessionDTO.java 17 Jul 2013 08:45:12 -0000 1.4 @@ -46,12 +46,9 @@ boolean reflectOnActivity; - String contentFolderID; - public WikiSessionDTO(WikiSession session) { this.sessionID = session.getSessionId(); this.sessionName = session.getSessionName(); - this.contentFolderID = session.getContentFolderID(); numberOfFinishedLearners = 0; for (Iterator iterator = session.getWikiUsers().iterator(); iterator.hasNext();) { @@ -130,12 +127,4 @@ this.reflectOnActivity = reflectOnActivity; } - public String getContentFolderID() { - return contentFolderID; - } - - public void setContentFolderID(String contentFolderID) { - this.contentFolderID = contentFolderID; - } - } Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/model/WikiSession.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/model/WikiSession.java,v diff -u -r1.3 -r1.4 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/model/WikiSession.java 15 Oct 2008 02:59:46 -0000 1.3 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/model/WikiSession.java 17 Jul 2013 08:45:12 -0000 1.4 @@ -65,8 +65,6 @@ private Set wikiPages; // Need a runtime copy for each wikiPage private WikiPage mainPage; //Need a runtime reference to the main page - - private String contentFolderID; //Need a runtime content folder to share files // Constructors @@ -76,7 +74,7 @@ /** full constructor */ public WikiSession(Date sessionEndDate, Date sessionStartDate, Integer status, Long sessionId, String sessionName, - Wiki wiki, Set wikiUsers, Set wikiPages, String contentFolderID) { + Wiki wiki, Set wikiUsers, Set wikiPages) { this.sessionEndDate = sessionEndDate; this.sessionStartDate = sessionStartDate; this.status = status; @@ -85,7 +83,6 @@ this.wiki = wiki; this.wikiUsers = wikiUsers; this.wikiPages = wikiPages; - this.contentFolderID = contentFolderID; } // Property accessors @@ -223,20 +220,7 @@ public void setMainPage(WikiPage mainPage) { this.mainPage = mainPage; } - - - /** - * @hibernate.property column="content_folder_id" length="255" - * - */ - public String getContentFolderID() { - return contentFolderID; - } - public void setContentFolderID(String contentFolderID) { - this.contentFolderID = contentFolderID; - } - /** * toString * Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java,v diff -u -r1.9 -r1.10 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java 19 Mar 2012 19:36:00 -0000 1.9 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java 17 Jul 2013 08:45:12 -0000 1.10 @@ -347,4 +347,14 @@ * @return */ boolean isGroupedActivity(long toolContentID); + + /** + * Return content folder (unique to each learner and lesson) which is used for storing user generated content. + * It's been used by CKEditor. + * + * @param toolSessionId + * @param userId + * @return + */ + String getLearnerContentFolder(Long toolSessionId, Long userId); } Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java,v diff -u -r1.18 -r1.19 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java 19 Mar 2012 19:36:00 -0000 1.18 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java 17 Jul 2013 08:45:12 -0000 1.19 @@ -163,9 +163,6 @@ Wiki wiki = wikiDAO.getByContentId(toolContentId); session.setWiki(wiki); - // Generate a unique content folder id for the wiki - session.setContentFolderID(FileUtil.generateUniqueContentFolderID()); - // Create an empty list to copy the wiki pages into Set sessionWikiPages = new HashSet(); @@ -815,9 +812,15 @@ this.auditService = auditService; } + @Override public boolean isGroupedActivity(long toolContentID) { return toolService.isGroupedActivity(toolContentID); } + + @Override + public String getLearnerContentFolder(Long toolSessionId, Long userId) { + return toolService.getLearnerContentFolder(toolSessionId, userId); + } private NodeKey processFile(FormFile file, String type) { NodeKey node = null; Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java,v diff -u -r1.9 -r1.10 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java 9 Apr 2013 12:45:26 -0000 1.9 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java 17 Jul 2013 08:45:12 -0000 1.10 @@ -218,7 +218,8 @@ request.setAttribute(WikiConstants.ATTR_WIKI_PAGE_CONTENT_HISTORY, currentWikiPageHistoryDTOs); // Set the content folder id - request.setAttribute(WikiConstants.ATTR_CONTENT_FOLDER_ID, wikiSession.getContentFolderID()); + request.setAttribute(WikiConstants.ATTR_CONTENT_FOLDER_ID, + wikiService.getLearnerContentFolder(toolSessionID, wikiUser.getUserId())); // set readOnly flag. if (mode.equals(ToolAccessMode.TEACHER) || (wiki.isLockOnFinished() && wikiUser.isFinishedActivity())) { Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java,v diff -u -r1.9 -r1.10 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java 15 Feb 2011 20:37:59 -0000 1.9 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java 17 Jul 2013 08:45:12 -0000 1.10 @@ -194,9 +194,6 @@ wikiPageDTOs.add(pageDTO); } - // Set the content folder id - request.setAttribute(WikiConstants.ATTR_CONTENT_FOLDER_ID, wikiSession.getContentFolderID()); - request.setAttribute(WikiConstants.ATTR_WIKI_PAGES, wikiPageDTOs); request.setAttribute(WikiConstants.ATTR_MAIN_WIKI_PAGE, new WikiPageDTO(wikiSession.getMainPage())); Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java,v diff -u -r1.14 -r1.15 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java 4 Jul 2013 11:34:47 -0000 1.14 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/WikiPageAction.java 17 Jul 2013 08:45:12 -0000 1.15 @@ -546,27 +546,27 @@ if (wikiSession.getWiki().isNotifyUpdates()) { boolean isHtmlFormat = false; - List users = wikiService.getMonitorsByToolSessionId(toolSessionID); - Integer[] monitoringUsersIds = new Integer[users.size()]; - for (int i = 0; i < monitoringUsersIds.length; i++) { - monitoringUsersIds[i] = users.get(i).getUserId(); - } + List monitors = wikiService.getMonitorsByToolSessionId(toolSessionID); + for (User monitor : monitors) { + Integer monitorUserId = monitor.getUserId(); + String contentFolderId = wikiService.getLearnerContentFolder(toolSessionID, monitorUserId.longValue()); + + String relativePath = "/tool/" + WikiConstants.TOOL_SIGNATURE + + "/monitoring.do?dispatch=showWiki&toolSessionID=" + toolSessionID.toString() + + "&contentFolderID=" + contentFolderId; - String relativePath = "/tool/" + WikiConstants.TOOL_SIGNATURE - + "/monitoring.do?dispatch=showWiki&toolSessionID=" + toolSessionID.toString() - + "&contentFolderID=" + wikiSession.getContentFolderID(); - - String hash = relativePath + "," + toolSessionID.toString() + ",t"; - hash = new String(Base64.encodeBase64(hash.getBytes())); - - String link = Configuration.get(ConfigurationKeys.SERVER_URL) + "r.do?" + - "h=" + hash; - - String body = wikiService.getLocalisedMessage(bodyLangKey, new Object[] { fullName, - wikiSession.getSessionName(), link }); + String hash = relativePath + "," + toolSessionID.toString() + ",t"; + hash = new String(Base64.encodeBase64(hash.getBytes())); - notificationService.sendMessage(null, monitoringUsersIds, IEventNotificationService.DELIVERY_METHOD_MAIL, - subject, body, isHtmlFormat); + String link = Configuration.get(ConfigurationKeys.SERVER_URL) + "r.do?" + "h=" + hash; + + String body = wikiService.getLocalisedMessage(bodyLangKey, + new Object[] { fullName, wikiSession.getSessionName(), link }); + + notificationService.sendMessage(null, monitorUserId, + IEventNotificationService.DELIVERY_METHOD_MAIL, subject, body, isHtmlFormat); + } + } // trigger the event if exists for all the learners who are subscribed Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java,v diff -u -r1.12 -r1.13 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java 11 Dec 2012 13:15:28 -0000 1.12 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java 17 Jul 2013 08:45:12 -0000 1.13 @@ -184,7 +184,6 @@ // Update image links WikiPageContentDTO contentDTO = wikiPageDTO.getCurrentWikiContentDTO(); - contentDTO.setBody(replaceImageFolderLinks(contentDTO.getBody(), wikiSession.getContentFolderID())); wikiPageDTO.setCurrentWikiContentDTO(contentDTO); wikiPageDTOs.add(wikiPageDTO); @@ -198,11 +197,6 @@ request.getSession() .setAttribute(WikiConstants.ATTR_MAIN_WIKI_PAGE, new WikiPageDTO(wikiSession.getMainPage())); - // bundle all user uploaded content and CKEditor smileys with the - // package - ImageBundler imageBundler = new ImageBundler(directoryName, wikiSession.getContentFolderID()); - imageBundler.bundleImages(); - // Construct the user dto UserDTO lamsUserDTO = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); WikiUser wikiUser = wikiService.getUserByUserIdAndSessionId(new Long(lamsUserDTO.getUserID()), toolSessionID); @@ -285,7 +279,6 @@ // Update image links WikiPageContentDTO contentDTO = wikiPageDTO.getCurrentWikiContentDTO(); - contentDTO.setBody(replaceImageFolderLinks(contentDTO.getBody(), wikiSession.getContentFolderID())); wikiPageDTO.setCurrentWikiContentDTO(contentDTO); wikiPageDTOs.add(wikiPageDTO); @@ -300,11 +293,6 @@ request.getSession().setAttribute(WikiConstants.ATTR_MAIN_WIKI_PAGE, new WikiPageDTO(wikiSession.getMainPage())); - // bundle all user uploaded content and CKEditor smileys with the - // package - ImageBundler imageBundler = new ImageBundler(directoryName, wikiSession.getContentFolderID()); - imageBundler.bundleImages(); - writeResponseToFile(basePath + "/pages/export/exportPortfolio.jsp", directoryName, wikiSession.getSessionId() + ".html", cookies); @@ -313,35 +301,4 @@ } } - /** - * Goes through the content and changes the references to images so they can be referenced locally - * - * @param body - * @param contentFolderID - * @return - */ - private String replaceImageFolderLinks(String body, String contentFolderID) { - String ckeditorpath = "/lams/www/secure/" + contentFolderID; - String newckeditorpath = "./" + contentFolderID; - - String ckeditorsmiley = "/lams/ckeditor/images/smiley"; - String newckeditorsmiley = "./ckeditor/images/smiley"; - - // The pattern matches control characters - Pattern p = Pattern.compile(ckeditorpath); - Matcher m = p.matcher(""); - - Pattern p2 = Pattern.compile(ckeditorsmiley); - Matcher m2 = p2.matcher(""); - - // Replace the p matching pattern with the newckeditorpath - m.reset(body); - String result = m.replaceAll(newckeditorpath); - - m2.reset(result); - result = m2.replaceAll(newckeditorsmiley); - - return result; - } - }