Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java =================================================================== diff -u -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java (.../AuthoringController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java (.../AuthoringController.java) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -42,14 +42,12 @@ import org.lamsfoundation.lams.tool.wiki.service.IWikiService; import org.lamsfoundation.lams.tool.wiki.util.WikiConstants; import org.lamsfoundation.lams.tool.wiki.web.forms.AuthoringForm; -import org.lamsfoundation.lams.tool.wiki.web.forms.WikiPageForm; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; @@ -170,35 +168,99 @@ return "pages/authoring/authoring"; } - @Override - public String removePage(HttpServletRequest request) throws Exception { + @RequestMapping("/editPage") + public String editPage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + super.editPage(authoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(authoringForm, request, currentWikiPageId); + } - AuthoringForm authoringForm = new AuthoringForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(authoringForm); - binder.bind(request); + @RequestMapping("/revertPage") + public String revertPage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + super.revertPage(authoringForm, request); + return unspecified(authoringForm, request); + } + @RequestMapping("/comparePage") + public String comparePage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) + throws Exception { + super.comparePage(authoringForm, request); + return "pages/wiki/compare"; + } + + @RequestMapping("/viewPage") + public String viewPage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + super.viewPage(authoringForm, request); + return "pages/wiki/viewWiki"; + } + + @RequestMapping("/changePage") + public String changePage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + super.changePage(authoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(authoringForm, request, currentWikiPageId); + } + + @RequestMapping("/addPage") + public String addPage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + super.addPage(authoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(authoringForm, request, currentWikiPageId); + } + + @RequestMapping("/removePage") + public String removePage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { + Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); + Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); Wiki wiki = wikiService.getWikiByContentId(toolContentID); if (wiki.isDefineLater()) { // Only mark as removed if editing a live version (monitor/live edit) - return super.removePage(request); + super.removePage(authoringForm, request); + return returnToWiki(authoringForm, request, currentPageUid); } - super.removePage(request); + WikiPage wikiPage = wikiService.getWikiPageByUid(currentPageUid); + wikiService.deleteWikiPage(wikiPage); - return unspecified(authoringForm, request); + // return to the main page, by setting the current page to null + return this.returnToWiki(authoringForm, request, null); } + @RequestMapping("/restorePage") + public String restorePage(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) + throws Exception { + super.restorePage(authoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(authoringForm, request, currentWikiPageId); + } + + @RequestMapping("/toggleLearnerSubsciption") + public String toggleLearnerSubsciption(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) + throws Exception { + super.toggleLearnerSubsciption(authoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(authoringForm, request, currentWikiPageId); + } + + @Override + @RequestMapping("/notifyWikiChange") + public void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, + HttpServletRequest request) throws Exception { + super.notifyWikiChange(toolSessionID, subjectLangKey, bodyLangKey, wikiUser, request); + } + + @RequestMapping("/revertJavascriptTokenReplacement") + public void revertJavascriptTokenReplacement(AuthoringForm authoringForm) { + super.revertJavascriptTokenReplacement(authoringForm); + } + /** * Wrapper method to make sure that the correct wiki is returned to from the WikiPageAction class */ - @Override - protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) + protected String returnToWiki(AuthoringForm authoringForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - AuthoringForm authForm = new AuthoringForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(authForm); - binder.bind(request); - authForm.setCurrentWikiPageId(currentWikiPageId); - return unspecified(authForm, request); + authoringForm.setCurrentWikiPageId(currentWikiPageId); + return unspecified(authoringForm, request); } /** Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java =================================================================== diff -u -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java (.../LearningController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java (.../LearningController.java) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -55,7 +55,6 @@ import org.lamsfoundation.lams.tool.wiki.util.WikiConstants; import org.lamsfoundation.lams.tool.wiki.util.WikiException; import org.lamsfoundation.lams.tool.wiki.web.forms.LearningForm; -import org.lamsfoundation.lams.tool.wiki.web.forms.WikiPageForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; @@ -64,7 +63,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.WebApplicationContext; @@ -108,9 +106,8 @@ * as setting all the advanced options and user-specifice info */ @RequestMapping("/learning") - public String unspecified(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { + public String unspecified(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { - LearningForm learningForm = new LearningForm(); // 'toolSessionID' and 'mode' parameters are expected to be present. // TODO need to catch exceptions and handle errors. ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, MODE_OPTIONAL); @@ -234,7 +231,6 @@ Date submissionDeadline = wikiDTO.getSubmissionDeadline(); request.setAttribute("wikiDTO", wikiDTO); - request.setAttribute("learningForm", learningForm); if (submissionDeadline != null) { HttpSession ss = SessionManager.getSession(); @@ -248,22 +244,91 @@ if (currentLearnerDate.after(tzSubmissionDeadline)) { return "pages/learning/submissionDeadline"; } - } return "pages/learning/wiki"; } + @RequestMapping("/editPage") + public String editPage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.editPage(learningForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(learningForm, request, currentWikiPageId); + } + + @RequestMapping("/revertPage") + public String revertPage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.revertPage(learningForm, request); + return unspecified(learningForm, request); + } + + @RequestMapping("/comparePage") + public String comparePage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.comparePage(learningForm, request); + return "pages/wiki/compare"; + } + + @RequestMapping("/viewPage") + public String viewPage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.viewPage(learningForm, request); + return "pages/wiki/viewWiki"; + } + + @RequestMapping("/changePage") + public String changePage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.changePage(learningForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(learningForm, request, currentWikiPageId); + } + + @RequestMapping("/addPage") + public String addPage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.addPage(learningForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(learningForm, request, currentWikiPageId); + } + + @RequestMapping("/removePage") + public String removePage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + + Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + super.removePage(learningForm, request); + // return to the main page, by setting the current page to null + return this.returnToWiki(learningForm, request, currentPageUid); + } + + @RequestMapping("/restorePage") + public String restorePage(@ModelAttribute LearningForm learningForm, HttpServletRequest request) throws Exception { + super.restorePage(learningForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(learningForm, request, currentWikiPageId); + } + + @RequestMapping("/toggleLearnerSubsciption") + public String toggleLearnerSubsciption(@ModelAttribute LearningForm learningForm, HttpServletRequest request) + throws Exception { + super.toggleLearnerSubsciption(learningForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(learningForm, request, currentWikiPageId); + } + + @RequestMapping("/notifyWikiChange") + public void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, + HttpServletRequest request) throws Exception { + super.notifyWikiChange(toolSessionID, subjectLangKey, bodyLangKey, wikiUser, request); + } + + @RequestMapping("/revertJavascriptTokenReplacement") + public void revertJavascriptTokenReplacement(LearningForm learningForm) { + super.revertJavascriptTokenReplacement(learningForm); + } + /** * Wrapper method to make sure that the correct wiki is returned to from the * WikiPageAction class */ - @Override - protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) + protected String returnToWiki(LearningForm learnForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - LearningForm learnForm = new LearningForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(learnForm); - binder.bind(request); learnForm.setCurrentWikiPageId(currentWikiPageId); // put the tool session id in the attributes so that the progress bar can pick it up. request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, learnForm.getToolSessionID()); Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java =================================================================== diff -u -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java (.../MonitoringController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java (.../MonitoringController.java) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -50,7 +50,6 @@ import org.lamsfoundation.lams.tool.wiki.util.WikiConstants; import org.lamsfoundation.lams.tool.wiki.util.WikiException; import org.lamsfoundation.lams.tool.wiki.web.forms.MonitoringForm; -import org.lamsfoundation.lams.tool.wiki.web.forms.WikiPageForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.WebUtil; @@ -60,7 +59,6 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.ServletRequestDataBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -90,7 +88,8 @@ * you to view their respective WikiPages */ @RequestMapping("/monitoring") - public String unspecified(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { + public String unspecified(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); @@ -139,16 +138,92 @@ return "pages/monitoring/monitoring"; } + @RequestMapping("/editPage") + public String editPage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) throws Exception { + super.editPage(monitoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(monitoringForm, request, currentWikiPageId); + } + + @RequestMapping("/revertPage") + public String revertPage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + super.revertPage(monitoringForm, request); + return unspecified(monitoringForm, request); + } + + @RequestMapping("/comparePage") + public String comparePage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + super.comparePage(monitoringForm, request); + return "pages/wiki/compare"; + } + + @RequestMapping("/viewPage") + public String viewPage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) throws Exception { + super.viewPage(monitoringForm, request); + return "pages/wiki/viewWiki"; + } + + @RequestMapping("/changePage") + public String changePage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + super.changePage(monitoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(monitoringForm, request, currentWikiPageId); + } + + @RequestMapping("/addPage") + public String addPage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) throws Exception { + super.addPage(monitoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(monitoringForm, request, currentWikiPageId); + } + + @RequestMapping("/removePage") + public String removePage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + + Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + super.removePage(monitoringForm, request); + // return to the main page, by setting the current page to null + return this.returnToWiki(monitoringForm, request, currentPageUid); + } + + @RequestMapping("/restorePage") + public String restorePage(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + super.restorePage(monitoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(monitoringForm, request, currentWikiPageId); + } + + @RequestMapping("/toggleLearnerSubsciption") + public String toggleLearnerSubsciption(@ModelAttribute MonitoringForm monitoringForm, HttpServletRequest request) + throws Exception { + super.toggleLearnerSubsciption(monitoringForm, request); + Long currentWikiPageId = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + return this.returnToWiki(monitoringForm, request, currentWikiPageId); + } + + @Override + @RequestMapping("/notifyWikiChange") + public void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, + HttpServletRequest request) throws Exception { + super.notifyWikiChange(toolSessionID, subjectLangKey, bodyLangKey, wikiUser, request); + } + + @RequestMapping("/revertJavascriptTokenReplacement") + public void revertJavascriptTokenReplacement(MonitoringForm monitoringForm) { + super.revertJavascriptTokenReplacement(monitoringForm); + } + /** * Wrapper method to make sure that the correct wiki is returned to from the * WikiPageAction class */ - @Override - protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) + protected String returnToWiki(MonitoringForm monitoringForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - MonitoringForm monitoringForm = new MonitoringForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(monitoringForm); - binder.bind(request); monitoringForm.setCurrentWikiPageId(currentWikiPageId); return showWiki(monitoringForm, request); } Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/WikiPageController.java =================================================================== diff -u -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/WikiPageController.java (.../WikiPageController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/WikiPageController.java (.../WikiPageController.java) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -73,30 +73,15 @@ @Autowired private WebApplicationContext applicationContext; - /** - * Default method when no dispatch parameter is specified. - */ -// protected abstract String unspecified(WikiPageForm wikiForm, HttpServletRequest request) throws Exception; - - /** - * This action returns to the current wiki by updating the form accordingly - */ - protected abstract String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) - throws Exception; - protected abstract WikiUser getCurrentUser(Long toolSessionId); /** * Edit a page and make a new page content entry */ - protected String editPage(HttpServletRequest request) throws Exception { + protected void editPage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - // Set up the wiki form revertJavascriptTokenReplacement(wikiForm); @@ -142,9 +127,6 @@ } } - - // Make sure the current page is set correctly then return to the wiki - return returnToWiki(wikiForm, request, currentPageUid); } /** @@ -188,7 +170,7 @@ /** * Compare two page content history items and return the result */ - protected String comparePage(HttpServletRequest request) throws Exception { + protected void comparePage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { Long revertPageContentVersion = new Long( WebUtil.readLongParam(request, WikiConstants.ATTR_HISTORY_PAGE_CONTENT_ID)); @@ -208,14 +190,12 @@ compareContent.getVersion().toString() + "-" + currentContent.getVersion().toString()); request.setAttribute(WikiConstants.ATTR_COMPARE_TITLE, currentWikiPage.getTitle()); request.setAttribute(WikiConstants.ATTR_COMPARE_STRING, diff); - - return "pages/wiki/compare"; } /** * View a page content from a wiki page's history */ - protected String viewPage(HttpServletRequest request) throws Exception { + protected void viewPage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { Long revertPageContentVersion = new Long( WebUtil.readLongParam(request, WikiConstants.ATTR_HISTORY_PAGE_CONTENT_ID)); @@ -233,19 +213,13 @@ pageDTO.setCurrentWikiContentDTO(new WikiPageContentDTO(oldContent)); request.setAttribute(WikiConstants.ATTR_CURRENT_WIKI, pageDTO); - - return "pages/wiki/viewWiki"; } /** * Change the active page of the wiki form */ - protected String changePage(HttpServletRequest request) throws Exception { + protected void changePage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - Wiki wiki = null; WikiSession session = null; WikiPage wikiPage = null; @@ -272,21 +246,13 @@ if (wikiPage == null) { // TODO: Error handling page does not exist } - - // go through unspecified to display the author screen, using wrapper - // method to set the current page - return this.returnToWiki(wikiForm, request, wikiPage.getUid()); } /** * Add a new wiki page to this wiki instance */ - protected String addPage(HttpServletRequest request) throws Exception { + protected void addPage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - Wiki wiki = null; WikiSession session = null; WikiUser user = null; @@ -335,20 +301,13 @@ if ((toolSessionID != null) && (user != null)) { notifyWikiChange(toolSessionID, "notify.pageAdded.subject", "notify.pageAdded.body", user, request); } - - // go to the new wiki page - return returnToWiki(wikiForm, request, currentPageUid); } /** * Remove a wiki page from the wiki instance */ - protected String removePage(HttpServletRequest request) throws Exception { + protected void removePage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - // The page to be removed Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -366,18 +325,13 @@ if ((toolSessionID != null) && (user != null)) { notifyWikiChange(toolSessionID, "notify.pageRemoved.subject", "notify.pageRemoved.body", user, request); } - return null; } /** * Restore a page previously marked as removed. */ - protected String restorePage(HttpServletRequest request) throws Exception { + protected void restorePage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - // The page to be restored Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -394,21 +348,13 @@ if ((toolSessionID != null) && (user != null)) { notifyWikiChange(toolSessionID, "notify.pageRestored.subject", "notify.pageRestored.body", user, request); } - - // return to the same page - return this.returnToWiki(wikiForm, request, currentPageUid); - } /** * Toggles whether a learner wants to receive notifications for wiki changes */ - protected String toggleLearnerSubsciption(HttpServletRequest request) throws Exception { + protected void toggleLearnerSubsciption(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - Long toolSessionID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID, true); Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -433,10 +379,6 @@ notificationService.subscribe(WikiConstants.TOOL_SIGNATURE, WikiConstants.EVENT_NOTIFY_LEARNERS, toolSessionID, user.getUserID(), IEventNotificationService.DELIVERY_METHOD_MAIL); } - - // return to the wiki page - return returnToWiki(wikiForm, request, currentPageUid); - } protected void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, @@ -498,7 +440,7 @@ /** * Replaces codeword back to "javascript", so the content works correctly after displaying. */ - private void revertJavascriptTokenReplacement(WikiPageForm form) { + protected void revertJavascriptTokenReplacement(WikiPageForm form) { String encodedWikiBody = form.getNewPageWikiBody(); if (encodedWikiBody != null) { form.setNewPageWikiBody( Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/struts-config.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tiles-defs.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_wiki/web/WEB-INF/tlds/lams/lams.tld =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_wiki/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -212,192 +212,6 @@ - - STRUTS-textarea - org.lamsfoundation.lams.web.tag.MultiLinesTextareaTag - empty - - accesskey - false - true - - - alt - false - true - - - altKey - false - true - - - bundle - false - true - - - cols - false - true - - - disabled - false - true - - - errorKey - false - true - - - errorStyle - false - true - - - errorStyleClass - false - true - - - errorStyleId - false - true - - - index - false - true - - - indexed - false - true - - - name - false - true - - - onblur - false - true - - - onchange - false - true - - - onclick - false - true - - - ondblclick - false - true - - - onfocus - false - true - - - onkeydown - false - true - - - onkeypress - false - true - - - onkeyup - false - true - - - onmousedown - false - true - - - onmousemove - false - true - - - onmouseout - false - true - - - onmouseover - false - true - - - onmouseup - false - true - - - property - true - true - - - readonly - false - true - - - rows - false - true - - - style - false - true - - - styleClass - false - true - - - styleId - false - true - - - tabindex - false - true - - - title - false - true - - - titleKey - false - true - - - value - false - true - - - Small portrait of a user User Portrait Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-bean-el.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-bean.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-html-el.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-html.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-logic-el.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-logic.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-nested.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-tiles-el.tld'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/WEB-INF/tlds/struts/struts-tiles.tld'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_wiki/web/common/taglibs.jsp =================================================================== diff -u -rf51c134807fd14e670b53b36ffc7388f72d1b446 -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/common/taglibs.jsp (.../taglibs.jsp) (revision f51c134807fd14e670b53b36ffc7388f72d1b446) +++ lams_tool_wiki/web/common/taglibs.jsp (.../taglibs.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -1,4 +1,5 @@ <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> +<%@ page import="org.lamsfoundation.lams.tool.wiki.util.WikiConstants"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_tool_wiki/web/includes/javascript/authoring.js =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/includes/javascript/authoring.js (.../authoring.js) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_wiki/web/includes/javascript/authoring.js (.../authoring.js) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -1,4 +1,3 @@ - function init() { // open the current tab var tag = document.getElementById("currentTab"); @@ -8,6 +7,7 @@ selectTab(1); } } + function doSelectTab(tabId) { var tag = document.getElementById("currentTab"); tag.value = tabId; @@ -25,3 +25,4 @@ finishButtonDiv.style.display = "block"; } } + Index: lams_tool_wiki/web/includes/javascript/wikiCommon.js =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/includes/javascript/wikiCommon.js (.../wikiCommon.js) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_tool_wiki/web/includes/javascript/wikiCommon.js (.../wikiCommon.js) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -57,12 +57,11 @@ } var compareWindow = null; -function doCompareOrView(webAppUrl, historyId, currentPageId, dispatch) +function doCompareOrView(webAppUrl, historyId, currentPageId, actionMethod) { - var url = webAppUrl + "/learning.do?"; + var url = webAppUrl + "/learning/"+ actionMethod +".do?"; url += "&historyPageContentId=" + historyId; url += "¤tWikiPage=" + currentPageId; - url += "&dispatch=" + dispatch; if(compareWindow && compareWindow.open && !compareWindow.closed){ compareWindow.close(); Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/layouts/defaultLayout.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/layouts/learningLayout.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f6959ef7792273a7ff3f05439513533678f9cc1f refers to a dead (removed) revision in file `lams_tool_wiki/web/layouts/tabLayout.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_wiki/web/pages/authoring/authoring.jsp =================================================================== diff -u -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) +++ lams_tool_wiki/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -1,32 +1,35 @@ -<%@ page import="org.lamsfoundation.lams.tool.wiki.util.WikiConstants"%> - + <%@ include file="/common/taglibs.jsp"%> - - - - - - - - - - - - - - - - - - - + + - + + + <fmt:message key="activity.title" /> + + + + + + + + + + + + + + + + + + + @@ -63,7 +66,7 @@ -s + <%-- Page tabs --%> @@ -86,6 +89,6 @@ - + Index: lams_tool_wiki/web/pages/authoring/basic.jsp =================================================================== diff -u -r169ce779d0f88147f00cffb353f45f595b8c1a7c -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/authoring/basic.jsp (.../basic.jsp) (revision 169ce779d0f88147f00cffb353f45f595b8c1a7c) +++ lams_tool_wiki/web/pages/authoring/basic.jsp (.../basic.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -107,7 +107,7 @@ - + @@ -249,9 +249,10 @@ } - function submitWiki(dispatch) + function submitWiki(actionMethod) { - document.getElementById("dispatch").value=dispatch; + document.forms.authoringForm.action=actionMethod+".do"; + document.forms.authoringForm.submit(); replaceJavascriptTokenAndSubmit("authoringForm"); } @@ -260,10 +261,10 @@ editorInstance.wikiLinkArray = wikiLinkArray; }); - function doEditOrAdd(dispatch) + function doEditOrAdd(actionMethod) { var title=""; - if(dispatch == "editPage") + if(actionMethod == "editPage") { title = document.getElementById("title").value; } @@ -282,7 +283,7 @@ for (i=0; i - <%@ include file="/common/taglibs.jsp"%> Index: lams_tool_wiki/web/pages/learning/parts/finishButton.jsp =================================================================== diff -u -r6c3d39685a1c47ef53b41a1eb29818b6f23f85cc -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/learning/parts/finishButton.jsp (.../finishButton.jsp) (revision 6c3d39685a1c47ef53b41a1eb29818b6f23f85cc) +++ lams_tool_wiki/web/pages/learning/parts/finishButton.jsp (.../finishButton.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -7,14 +7,14 @@ } } - function continueOrFinish(dispatch) { + function continueOrFinish(action) { document.getElementById("learningButtonForm").action; document.getElementById("learningButtonForm").submit(); } - +
@@ -42,9 +42,9 @@ - - - + + +
@@ -55,7 +55,7 @@
- @@ -65,9 +65,9 @@ - +
-
+ Index: lams_tool_wiki/web/pages/learning/wiki.jsp =================================================================== diff -u -r6c3d39685a1c47ef53b41a1eb29818b6f23f85cc -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/learning/wiki.jsp (.../wiki.jsp) (revision 6c3d39685a1c47ef53b41a1eb29818b6f23f85cc) +++ lams_tool_wiki/web/pages/learning/wiki.jsp (.../wiki.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -1,17 +1,12 @@ - <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.tool.wiki.util.WikiConstants"%> - - - - - - + + @@ -23,63 +18,64 @@ <script type="text/javascript" src="${tool}includes/javascript/wikiCommon.js"></script> <script type="text/javascript" src="${lams}includes/javascript/jquery.js"></script> <script type="text/javascript" src="${lams}includes/javascript/bootstrap.min.js"></script> + + <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery.js"></script> + <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery-ui.js"></script> + <script language="JavaScript" type="text/javascript" src="includes/javascript/validation.js"></script> + <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/jquery.timeago.js"></script> + <c:set var="localeLanguage"><lams:user property="localeLanguage" /></c:set> + <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/timeagoi18n/jquery.timeago.${fn:toLowerCase(localeLanguage)}.js"></script> + + <script type="text/javascript"> + <!-- + var mode = "${mode}"; + var formName = "learningForm" + + $(document).ready(function() { + $("time.timeago").timeago(); + }); + + function disableFinishButton() { + document.getElementById("finishButton").disabled = true; + } + + function validateForm() { + + // Validates that there's input from the user. + + // disables the Finish button to avoid double submission + disableFinishButton(); + + if (mode == "learner") { + // if this is learner mode, then we add this validation see (LDEV-1319) + + if (document.forms.learningForm.entryText.value == "") { + + // if the input is blank, then we further inquire to make sure it is correct + if (confirm("<fmt:message>message.learner.blank.input</fmt:message>")) { + // if correct, submit form + return true; + } else { + // otherwise, focus on the text area + document.forms.learningForm.entryText.focus(); + document.getElementById("finishButton").disabled = false; + return false; + } + } else { + // there was something on the form, so submit the form + return true; + } + } + } + + --> + </script> </lams:head> <body class="stripes"> - <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery.js"></script> - <script language="JavaScript" type="text/javascript" src="<lams:LAMSURL/>includes/javascript/jquery-ui.js"></script> - <script language="JavaScript" type="text/javascript" src="includes/javascript/validation.js"></script> - <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/jquery.timeago.js"></script> - <c:set var="localeLanguage"><lams:user property="localeLanguage" /></c:set> - <script type="text/javascript" src="<lams:LAMSURL />/includes/javascript/timeagoi18n/jquery.timeago.${fn:toLowerCase(localeLanguage)}.js"></script> - - <script type="text/javascript"> - <!-- - var mode = "${mode}"; - var formName = "learningForm" - - $(document).ready(function() { - $("time.timeago").timeago(); - }); - - function disableFinishButton() { - document.getElementById("finishButton").disabled = true; - } - - function validateForm() { - - // Validates that there's input from the user. - - // disables the Finish button to avoid double submission - disableFinishButton(); - - if (mode == "learner") { - // if this is learner mode, then we add this validation see (LDEV-1319) - - if (document.learningForm.entryText.value == "") { - - // if the input is blank, then we further inquire to make sure it is correct - if (confirm("<fmt:message>message.learner.blank.input</fmt:message>")) { - // if correct, submit form - return true; - } else { - // otherwise, focus on the text area - document.learningForm.entryText.focus(); - document.getElementById("finishButton").disabled = false; - return false; - } - } else { - // there was something on the form, so submit the form - return true; - } - } - } - - --> - </script> - - <lams:Page type="learner" usePanel="false"formID="learningForm"> + + <lams:Page type="learner" usePanel="false" formID="learningForm"> <form:form action="learning.do" method="post" id="learningForm" modelAttribute="learningForm" enctype="multipart/form-data"> @@ -283,7 +279,7 @@ <form:hidden path="toolSessionID" id = "toolSessionID" /> <form:hidden path="mode" /> <input type="hidden" name="userID" value="${userDTO.userId}"/> - <form:hidden path="currentWikiPage" value="${currentWikiPage.uid}" id="currentWikiPage" /> + <input type="hidden" name="currentWikiPage" value="${currentWikiPage.uid}" id="currentWikiPage" /> <input type="hidden" id="wikiLinks" /> <form:hidden path="newPageName" id="newPageName" /> <form:hidden path="historyPageContentId" id="historyPageContentId" /> @@ -313,7 +309,7 @@ <fmt:message key="label.wiki.history.actions"></fmt:message> </th> </tr> - <c:forEach var="wikiContentPageVersion"items="${wikiPageContentHistory}"> + <c:forEach var="wikiContentPageVersion" items="${wikiPageContentHistory}"> <c:if test="${wikiContentPageVersion.version != currentWikiPage.currentWikiContentDTO.version}"> <tr> <td>${wikiContentPageVersion.version}</td> @@ -487,11 +483,11 @@ document.getElementById("wikiLinks").value = wikiLinkArray.toString(); } - function doEditOrAdd(dispatch) + function doEditOrAdd(actionMethod) { var title=""; - if(dispatch == "editPage") + if(actionMethod == "editPage") { title = document.getElementById("title").value; } @@ -510,7 +506,7 @@ for (i=0; i<wikiLinkArray.length; i++) { - if(dispatch == "editPage" && wikiLinkArray[i] == '${fn:escapeXml(currentWikiPage.javaScriptTitle)}') + if(actionMethod == "editPage" && wikiLinkArray[i] == '${fn:escapeXml(currentWikiPage.javaScriptTitle)}') { continue; } @@ -524,16 +520,16 @@ // if all validation fulfilled, we can continue document.getElementById("title").value = trim(title); - submitWiki(dispatch); + submitWiki(actionMethod); } - function submitWiki(dispatch) - { - document.getElementById("learningForm").action += "?dispatch=" + dispatch; - replaceJavascriptTokenAndSubmit("learningForm"); - } + function submitWiki(actionMethod) + { + document.forms.learningForm.action=actionMethod+".do"; + document.forms.learningForm.submit(); + replaceJavascriptTokenAndSubmit("learningForm"); + } - function hideToolbarItem(editorInstance, itemName) { editorInstance.ui.items[itemName].setState(CKEDITOR.TRISTATE_DISABLED); @@ -558,7 +554,7 @@ function refreshPage() { var toolSessionID = $("#toolSessionID").val(); - var url = "<lams:WebAppURL/>/learning.do?mode=${mode}&toolSessionID="+toolSessionID+"¤tWikiPageId=${currentWikiPage.uid}" + var url = "<lams:WebAppURL/>/learning/learning.do?mode=${mode}&toolSessionID="+toolSessionID+"¤tWikiPageId=${currentWikiPage.uid}" window.location=url; } Index: lams_tool_wiki/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -r82c8ee6bc80d47736337c5b07ccc686c5ea3ba32 -rf6959ef7792273a7ff3f05439513533678f9cc1f --- lams_tool_wiki/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision 82c8ee6bc80d47736337c5b07ccc686c5ea3ba32) +++ lams_tool_wiki/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision f6959ef7792273a7ff3f05439513533678f9cc1f) @@ -4,24 +4,34 @@ <%@ page import="org.lamsfoundation.lams.tool.wiki.util.WikiConstants"%> <lams:html> - <c:set var="tool"> - <lams:WebAppURL /> - </c:set> - <c:set var="localeLanguage"><lams:user property="localeLanguage" /></c:set> + + <c:set var="lams"> <lams:LAMSURL /> </c:set> + <c:set var="tool"> <lams:WebAppURL /> </c:set> - <script type="text/javascript" src="<lams:LAMSURL/>/includes/javascript/jquery.timeago.js"></script> - <script type="text/javascript" src="<lams:LAMSURL/>/includes/javascript/timeagoi18n/jquery.timeago.${fn:toLowerCase(localeLanguage)}.js"></script> - <script type="text/javascript" src="<lams:LAMSURL/>/includes/javascript/portrait.js"></script> + <lams:head> + <title> + <fmt:message key="activity.title" /> + - - - - - + + + + + + + + + + + + + + + @@ -22,6 +28,9 @@ + + + - + - - + @@ -254,8 +262,8 @@   - - + +
@@ -320,9 +328,9 @@ document.getElementById("wikiLinks").value = wikiLinkArray.toString(); } - function doEditOrAdd(dispatch) { + function doEditOrAdd(actionMethod) { var title=""; - if(dispatch == "editPage") { + if(actionMethod == "editPage") { title = document.getElementById("title").value; } else { @@ -337,7 +345,7 @@ } for (i=0; i