Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java =================================================================== diff -u -r169ce779d0f88147f00cffb353f45f595b8c1a7c -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java (.../AuthoringController.java) (revision 169ce779d0f88147f00cffb353f45f595b8c1a7c) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/AuthoringController.java (.../AuthoringController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) @@ -49,6 +49,7 @@ 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; @@ -84,10 +85,9 @@ * */ @RequestMapping("/authoring") - public String unspecified(@ModelAttribute WikiPageForm wikiForm, HttpServletRequest request) + public String unspecified(@ModelAttribute AuthoringForm authoringForm, HttpServletRequest request) throws Exception { - AuthoringForm authoringForm = new AuthoringForm(); // Extract toolContentID from parameters. Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); @@ -166,29 +166,26 @@ // add the sessionMap to HTTPSession. request.getSession().setAttribute(map.getSessionID(), map); request.setAttribute(WikiConstants.ATTR_SESSION_MAP, map); - request.setAttribute("authoringForm", authoringForm); return "pages/authoring/authoring"; } @Override public String removePage(HttpServletRequest request) throws Exception { - WikiPageForm wikiForm = new WikiPageForm(); + AuthoringForm authoringForm = new AuthoringForm(); + ServletRequestDataBinder binder = new ServletRequestDataBinder(authoringForm); + binder.bind(request); + Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); Wiki wiki = wikiService.getWikiByContentId(toolContentID); if (wiki.isDefineLater()) { // Only mark as removed if editing a live version (monitor/live edit) return super.removePage(request); } - // Completely delete the page - Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); + super.removePage(request); - WikiPage wikiPage = wikiService.getWikiPageByUid(currentPageUid); - wikiService.deleteWikiPage(wikiPage); - - // return to the main page, by setting the current page to null - return this.returnToWiki(wikiForm, request, null); + return unspecified(authoringForm, request); } /** @@ -197,8 +194,11 @@ @Override protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - wikiForm.setCurrentWikiPageId(currentWikiPageId); - return unspecified((AuthoringForm) wikiForm, request); + AuthoringForm authForm = new AuthoringForm(); + ServletRequestDataBinder binder = new ServletRequestDataBinder(authForm); + binder.bind(request); + authForm.setCurrentWikiPageId(currentWikiPageId); + return unspecified(authForm, request); } /** Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java =================================================================== diff -u -r169ce779d0f88147f00cffb353f45f595b8c1a7c -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java (.../LearningController.java) (revision 169ce779d0f88147f00cffb353f45f595b8c1a7c) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/LearningController.java (.../LearningController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) @@ -64,6 +64,7 @@ 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; @@ -258,13 +259,15 @@ * WikiPageAction class */ @Override - public String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) + protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - wikiForm.setCurrentWikiPageId(currentWikiPageId); + 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. - LearningForm learnerForm = new LearningForm(); - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, learnerForm.getToolSessionID()); - return unspecified((LearningForm) wikiForm, request); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, learnForm.getToolSessionID()); + return unspecified(learnForm, request); } /** Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java =================================================================== diff -u -r169ce779d0f88147f00cffb353f45f595b8c1a7c -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java (.../MonitoringController.java) (revision 169ce779d0f88147f00cffb353f45f595b8c1a7c) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/MonitoringController.java (.../MonitoringController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) @@ -60,6 +60,7 @@ 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; @@ -143,10 +144,13 @@ * WikiPageAction class */ @Override - public String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) + protected String returnToWiki(WikiPageForm wikiForm, HttpServletRequest request, Long currentWikiPageId) throws Exception { - wikiForm.setCurrentWikiPageId(currentWikiPageId); - return showWiki((MonitoringForm) wikiForm, request); + 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 -r169ce779d0f88147f00cffb353f45f595b8c1a7c -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/WikiPageController.java (.../WikiPageController.java) (revision 169ce779d0f88147f00cffb353f45f595b8c1a7c) +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/controller/WikiPageController.java (.../WikiPageController.java) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) @@ -53,7 +53,6 @@ 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.context.WebApplicationContext; /** @@ -77,7 +76,7 @@ /** * Default method when no dispatch parameter is specified. */ - protected abstract String unspecified(WikiPageForm wikiForm, HttpServletRequest request) throws Exception; +// protected abstract String unspecified(WikiPageForm wikiForm, HttpServletRequest request) throws Exception; /** * This action returns to the current wiki by updating the form accordingly @@ -90,7 +89,7 @@ /** * Edit a page and make a new page content entry */ - public String editPage(HttpServletRequest request) throws Exception { + protected String editPage(HttpServletRequest request) throws Exception { Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -151,12 +150,8 @@ /** * Revert to a previous page content in the page history */ - public String revertPage(HttpServletRequest request) throws Exception { - - WikiPageForm wikiForm = new WikiPageForm(); - ServletRequestDataBinder binder = new ServletRequestDataBinder(wikiForm); - binder.bind(request); - + protected void revertPage(WikiPageForm wikiForm, HttpServletRequest request) throws Exception { + Long revertPageContentVersion = new Long( WebUtil.readLongParam(request, WikiConstants.ATTR_HISTORY_PAGE_CONTENT_ID)); Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -188,14 +183,12 @@ // put the tool session id in the attributes so that the progress bar can pick it up. request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, toolSessionID); } - - return unspecified(wikiForm, request); } /** * Compare two page content history items and return the result */ - public String comparePage(HttpServletRequest request) throws Exception { + protected String comparePage(HttpServletRequest request) throws Exception { Long revertPageContentVersion = new Long( WebUtil.readLongParam(request, WikiConstants.ATTR_HISTORY_PAGE_CONTENT_ID)); @@ -222,8 +215,8 @@ /** * View a page content from a wiki page's history */ - public String viewPage(HttpServletRequest request) throws Exception { - + protected String viewPage(HttpServletRequest request) throws Exception { + Long revertPageContentVersion = new Long( WebUtil.readLongParam(request, WikiConstants.ATTR_HISTORY_PAGE_CONTENT_ID)); Long currentPageUid = WebUtil.readLongParam(request, WikiConstants.ATTR_CURRENT_WIKI); @@ -247,12 +240,12 @@ /** * Change the active page of the wiki form */ - public String changePage(HttpServletRequest request) throws Exception { + protected String changePage(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; @@ -288,12 +281,12 @@ /** * Add a new wiki page to this wiki instance */ - public String addPage(HttpServletRequest request) throws Exception { + protected String addPage(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; @@ -350,12 +343,12 @@ /** * Remove a wiki page from the wiki instance */ - public String removePage(HttpServletRequest request) throws Exception { - + protected String removePage(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); @@ -373,21 +366,18 @@ if ((toolSessionID != null) && (user != null)) { notifyWikiChange(toolSessionID, "notify.pageRemoved.subject", "notify.pageRemoved.body", user, request); } - - // return to the same page with information about being removed displayed - return this.returnToWiki(wikiForm, request, currentPageUid); - + return null; } /** * Restore a page previously marked as removed. */ - public String restorePage(HttpServletRequest request) throws Exception { - + protected String restorePage(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); @@ -413,13 +403,12 @@ /** * Toggles whether a learner wants to receive notifications for wiki changes */ - public String toggleLearnerSubsciption(HttpServletRequest request) - throws Exception { + protected String toggleLearnerSubsciption(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); @@ -450,7 +439,7 @@ } - private void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, + protected void notifyWikiChange(Long toolSessionID, String subjectLangKey, String bodyLangKey, WikiUser wikiUser, HttpServletRequest request) throws Exception { WikiSession wikiSession = wikiService.getSessionBySessionId(toolSessionID); @@ -469,9 +458,8 @@ Integer monitorUserId = monitor.getUserId(); String contentFolderId = wikiService.getLearnerContentFolder(toolSessionID, monitorUserId.longValue()); - String relativePath = "/tool/" + WikiConstants.TOOL_SIGNATURE - + "/monitoring/showWiki.do?toolSessionID=" + toolSessionID.toString() - + "&contentFolderID=" + contentFolderId; + String relativePath = "/tool/" + WikiConstants.TOOL_SIGNATURE + "/monitoring/showWiki.do?toolSessionID=" + + toolSessionID.toString() + "&contentFolderID=" + contentFolderId; String hash = relativePath + "," + toolSessionID.toString() + ",t"; hash = new String(Base64.encodeBase64(hash.getBytes())); Index: lams_tool_wiki/web/pages/authoring/authoring.jsp =================================================================== diff -u -rf51c134807fd14e670b53b36ffc7388f72d1b446 -rc7a2e895ae695aefaafcfcc96aac897ee4b720ce --- lams_tool_wiki/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision f51c134807fd14e670b53b36ffc7388f72d1b446) +++ lams_tool_wiki/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision c7a2e895ae695aefaafcfcc96aac897ee4b720ce) @@ -54,7 +54,7 @@ - + @@ -80,17 +80,12 @@ contentFolderID="${sessionMap.contentFolderID}" /> - + - - - - -