Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java =================================================================== diff -u -r2e04c22a17d342830e35d4d7d227b479a7ef1e58 -r7127d07bc4def279d7a3f7ec3478000198f2b6d4 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 2e04c22a17d342830e35d4d7d227b479a7ef1e58) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 7127d07bc4def279d7a3f7ec3478000198f2b6d4) @@ -54,7 +54,6 @@ import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; - /** * @author * @version @@ -97,14 +96,18 @@ Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); + String contentFolderID = WebUtil.readStrParam(request, + AttributeNames.PARAM_CONTENT_FOLDER_ID); + // set up notebookService if (notebookService == null) { - notebookService = NotebookServiceProxy.getNotebookService(this.getServlet() - .getServletContext()); + notebookService = NotebookServiceProxy.getNotebookService(this + .getServlet().getServletContext()); } // retrieving Notebook with given toolContentID - Notebook notebook = notebookService.getNotebookByContentId(toolContentID); + Notebook notebook = notebookService + .getNotebookByContentId(toolContentID); if (notebook == null) { notebook = notebookService.copyDefaultContent(toolContentID); notebook.setCreateDate(new Date()); @@ -125,23 +128,21 @@ notebook.setDefineLater(true); notebookService.saveOrUpdateNotebook(notebook); - // Set up sessionMap - SessionMap map = new SessionMap(); - initSessionMap(map, request); - updateSessionMap(map, notebook); - // Set up the authForm. AuthoringForm authForm = (AuthoringForm) form; updateAuthForm(authForm, notebook); - // add the sessionMapID to form + // Set up sessionMap + SessionMap map = createSessionMap(notebook, + getAccessMode(request)); authForm.setSessionMapID(map.getSessionID()); + authForm.setContentFolderID(contentFolderID); + // add the sessionMap to HTTPSession. request.getSession().setAttribute(map.getSessionID(), map); - request.setAttribute(NotebookConstants.ATTR_SESSION_MAP, map); - + return mapping.findForward("success"); } @@ -154,7 +155,8 @@ SessionMap map = getSessionMap(request, authForm); // get notebook content. - Notebook notebook = notebookService.getNotebookByContentId(authForm.getToolContentID()); + Notebook notebook = notebookService.getNotebookByContentId(authForm + .getToolContentID()); // update notebook content using form inputs. updateNotebook(notebook, authForm); @@ -171,11 +173,11 @@ .getFileVersionId()); attachments.remove(att); } - + // add unsaved attachments attachments.addAll(getAttList(KEY_UNSAVED_ONLINE_FILES, map)); attachments.addAll(getAttList(KEY_UNSAVED_OFFLINE_FILES, map)); - + // set attachments in case it didn't exist notebook.setNotebookAttachments(attachments); @@ -189,10 +191,10 @@ request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); - + // add the sessionMapID to form authForm.setSessionMapID(map.getSessionID()); - + request.setAttribute(NotebookConstants.ATTR_SESSION_MAP, map); return mapping.findForward("success"); @@ -258,8 +260,8 @@ } // upload file to repository - NotebookAttachment newAtt = notebookService.uploadFileToContent(authForm - .getToolContentID(), file, type); + NotebookAttachment newAtt = notebookService.uploadFileToContent( + authForm.getToolContentID(), file, type); // Add attachment to unsavedFiles // check to see if file with same name exists @@ -380,17 +382,23 @@ /** * Updates SessionMap using Notebook content. * - * @param map * @param notebook + * @param mode */ - private void updateSessionMap(SessionMap map, Notebook notebook) { + private SessionMap createSessionMap(Notebook notebook, + ToolAccessMode mode) { - getAttList(KEY_UNSAVED_OFFLINE_FILES, map).clear(); - getAttList(KEY_UNSAVED_ONLINE_FILES, map).clear(); - getAttList(KEY_DELETED_FILES, map).clear(); - getAttList(KEY_OFFLINE_FILES, map).clear(); - getAttList(KEY_ONLINE_FILES, map).clear(); + SessionMap map = new SessionMap(); + map.put(KEY_MODE, mode); + map.put(KEY_ONLINE_FILES, new LinkedList()); + map.put(KEY_OFFLINE_FILES, new LinkedList()); + map.put(KEY_UNSAVED_ONLINE_FILES, new LinkedList()); + map + .put(KEY_UNSAVED_OFFLINE_FILES, + new LinkedList()); + map.put(KEY_DELETED_FILES, new LinkedList()); + Iterator iter = notebook.getNotebookAttachments().iterator(); while (iter.hasNext()) { NotebookAttachment attachment = (NotebookAttachment) iter.next(); @@ -402,6 +410,8 @@ getAttList(KEY_ONLINE_FILES, map).add(attachment); } } + + return map; } /** @@ -429,12 +439,15 @@ * @param map * @param request */ - private void initSessionMap(SessionMap map, HttpServletRequest request) { + private void initSessionMap(SessionMap map, + HttpServletRequest request) { map.put(KEY_MODE, getAccessMode(request)); map.put(KEY_ONLINE_FILES, new LinkedList()); map.put(KEY_OFFLINE_FILES, new LinkedList()); map.put(KEY_UNSAVED_ONLINE_FILES, new LinkedList()); - map.put(KEY_UNSAVED_OFFLINE_FILES, new LinkedList()); + map + .put(KEY_UNSAVED_OFFLINE_FILES, + new LinkedList()); map.put(KEY_DELETED_FILES, new LinkedList()); } @@ -445,7 +458,8 @@ * @param map * @return */ - private List getAttList(String key, SessionMap map) { + private List getAttList(String key, + SessionMap map) { List list = (List) map.get(key); return list; } @@ -457,8 +471,9 @@ * @param authForm * @return */ - private SessionMap getSessionMap(HttpServletRequest request, - AuthoringForm authForm) { - return (SessionMap) request.getSession().getAttribute(authForm.getSessionMapID()); + private SessionMap getSessionMap( + HttpServletRequest request, AuthoringForm authForm) { + return (SessionMap) request.getSession().getAttribute( + authForm.getSessionMapID()); } } \ No newline at end of file Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/AuthoringForm.java =================================================================== diff -u -r1d4d39bc99bceeb2f3400228a83823b8cd67c6da -r7127d07bc4def279d7a3f7ec3478000198f2b6d4 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/AuthoringForm.java (.../AuthoringForm.java) (revision 1d4d39bc99bceeb2f3400228a83823b8cd67c6da) +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/forms/AuthoringForm.java (.../AuthoringForm.java) (revision 7127d07bc4def279d7a3f7ec3478000198f2b6d4) @@ -53,6 +53,8 @@ String onlineInstruction; Long toolContentID; + + String contentFolderID; boolean lockOnFinished; @@ -192,4 +194,12 @@ public void setAllowRichEditor(boolean allowRichEditor) { this.allowRichEditor = allowRichEditor; } + + public String getContentFolderID() { + return contentFolderID; + } + + public void setContentFolderID(String contentFolderID) { + this.contentFolderID = contentFolderID; + } } Index: lams_tool_notebook/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u -r5948e17402e1ad574aeddbe55f93dca2f58bbbec -r7127d07bc4def279d7a3f7ec3478000198f2b6d4 --- lams_tool_notebook/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 5948e17402e1ad574aeddbe55f93dca2f58bbbec) +++ lams_tool_notebook/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 7127d07bc4def279d7a3f7ec3478000198f2b6d4) @@ -37,6 +37,7 @@ <%@ attribute name="formID" required="true" rtexprvalue="true" %> <%@ attribute name="toolSignature" required="true" rtexprvalue="true" %> <%@ attribute name="toolContentID" required="true" rtexprvalue="true" %> +<%@ attribute name="contentFolderID" required="true" rtexprvalue="true" %> <%@ attribute name="clearSessionActionUrl" required="true" rtexprvalue="true" %> <%-- Optional attribute --%> @@ -64,7 +65,7 @@ -

+

Index: lams_tool_notebook/web/WEB-INF/tags/FCKEditor.tag =================================================================== diff -u --- lams_tool_notebook/web/WEB-INF/tags/FCKEditor.tag (revision 0) +++ lams_tool_notebook/web/WEB-INF/tags/FCKEditor.tag (revision 7127d07bc4def279d7a3f7ec3478000198f2b6d4) @@ -0,0 +1,57 @@ +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="fck-editor" prefix="fck"%> + +<%@ attribute name="id" required="true" rtexprvalue="true"%> +<%@ attribute name="value" required="true" rtexprvalue="true"%> +<%@ attribute name="toolbarSet" required="false" rtexprvalue="true"%> +<%@ attribute name="contentFolderID" required="true" rtexprvalue="true"%> + + + + + + + + + + + + + + + ${value} + + + + + Fisheye: Tag 7127d07bc4def279d7a3f7ec3478000198f2b6d4 refers to a dead (removed) revision in file `lams_tool_notebook/web/WEB-INF/tags/HTMLEditor.tag'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7127d07bc4def279d7a3f7ec3478000198f2b6d4 refers to a dead (removed) revision in file `lams_tool_notebook/web/WEB-INF/tags/SetEditor.tag'. Fisheye: No comparison available. Pass `N' to diff?