Index: lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java =================================================================== diff -u -r4723715bee4472a5a41fc2cafd690b23b7ae4e2a -r8d9e4c3469149e6f15002d5fe92c87d76d0d85c9 --- lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 4723715bee4472a5a41fc2cafd690b23b7ae4e2a) +++ lams_tool_chat/src/java/org/lamsfoundation/lams/tool/chat/web/actions/AuthoringAction.java (.../AuthoringAction.java) (revision 8d9e4c3469149e6f15002d5fe92c87d76d0d85c9) @@ -96,6 +96,8 @@ // Extract toolContentID from parameters. Long toolContentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); + + String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); // set up chatService if (chatService == null) { @@ -125,21 +127,18 @@ chat.setDefineLater(true); chatService.saveOrUpdateChat(chat); - // Set up sessionMap - SessionMap map = new SessionMap(); - initSessionMap(map, request); - updateSessionMap(map, chat); - // Set up the authForm. AuthoringForm authForm = (AuthoringForm) form; updateAuthForm(authForm, chat); - - // add the sessionMapID to form + + // Set up sessionMap + SessionMap map = createSessionMap(chat, getAccessMode(request)); authForm.setSessionMapID(map.getSessionID()); + + authForm.setContentFolderID(contentFolderID); // add the sessionMap to HTTPSession. request.getSession().setAttribute(map.getSessionID(), map); - request.setAttribute(ChatConstants.ATTR_SESSION_MAP, map); return mapping.findForward("success"); @@ -388,15 +387,19 @@ * * @param map * @param chat + * @param mode */ - private void updateSessionMap(SessionMap map, Chat chat) { - - 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(); - + private SessionMap createSessionMap(Chat chat, ToolAccessMode mode) { + + 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 = chat.getChatAttachments().iterator(); while (iter.hasNext()) { ChatAttachment attachment = (ChatAttachment) iter.next(); @@ -408,6 +411,8 @@ getAttList(KEY_ONLINE_FILES, map).add(attachment); } } + + return map; } /**