Index: lams_tool_forum/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r3bbf998bd845b846a43879fdbfb1145aeaece7f9 -rb2f48331751d34eeac313767c9098492691ebbe0 --- lams_tool_forum/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 3bbf998bd845b846a43879fdbfb1145aeaece7f9) +++ lams_tool_forum/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b2f48331751d34eeac313767c9098492691ebbe0) @@ -177,6 +177,7 @@ label.postingLimits.forum.reminder =Posting limitations for this forum: Minimum {0} and Maximum {1} per thread. label.postingLimits.topic.reminde =Posting for this thread: Minimum {0} and Maximum {1}. You have posted {2} message(s). label.authoring.advance.number.reply =Number of posts per learner per thread. +label.export.reflection = Notebook Entries #======= End labels: Exported 171 labels for en AU ===== Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java =================================================================== diff -u -re7046600ee8bfa53d053e0aee33a16b52ad0e8e2 -rb2f48331751d34eeac313767c9098492691ebbe0 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java (.../ExportServlet.java) (revision e7046600ee8bfa53d053e0aee33a16b52ad0e8e2) +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/ExportServlet.java (.../ExportServlet.java) (revision b2f48331751d34eeac313767c9098492691ebbe0) @@ -34,13 +34,16 @@ import java.util.Map; import java.util.TreeMap; +import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.tool.forum.dto.MessageDTO; import org.lamsfoundation.lams.tool.forum.persistence.Attachment; @@ -67,6 +70,7 @@ private final String FILENAME = "forum_main.html"; ForumToolContentHandler handler; + private static IForumService forumService; private class StringComparator implements Comparator{ public int compare(String o1, String o2) { @@ -79,11 +83,16 @@ } } + @Override + public void init() throws ServletException { + forumService = ForumServiceProxy.getForumService(getServletContext()); + super.init(); + } + protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { if (toolContentID == null && toolSessionID == null) { logger.error("Tool content Id or and session Id are null. Unable to activity title"); } else { - IForumService forumService = ForumServiceProxy.getForumService(getServletContext()); Forum forum = null; if ( toolContentID != null ) { forum = forumService.getForumByContentId(toolContentID); @@ -102,7 +111,7 @@ public String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { -// initial sessionMap + // initial sessionMap SessionMap sessionMap = new SessionMap(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); @@ -120,50 +129,57 @@ return FILENAME; } + public void learner(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) { - - IForumService forumService = ForumServiceProxy.getForumService(getServletContext()); - if (userID == null || toolSessionID == null) { String error = "Tool session Id or user Id is null. Unable to continue"; logger.error(error); throw new ForumException(error); } - ForumUser learner = forumService.getUserByUserAndSession(userID,toolSessionID); + ForumUser forumUser = forumService.getUserByUserAndSession(userID,toolSessionID); + ForumToolSession session = forumUser.getSession(); + Forum content = session.getForum(); - if (learner == null) + if (forumUser == null) { String error="The user with user id " + userID + " does not exist in this session or session may not exist."; logger.error(error); throw new ForumException(error); } - // get root topic list and its children topics - List msgDtoList = getSessionTopicList(toolSessionID, directoryName, forumService); - //set author flag, to decide if display mark of topics.Only author allow see his own mark. + // Get Messages + // Get root topic list and its children topics + List msgDtoList = getSessionTopicList(toolSessionID, directoryName); + // Set author flag, to decide if display mark of topics.Only author allow see his own mark. setAuthorMark(msgDtoList); - ForumToolSession session = forumService.getSessionBySessionId(toolSessionID); + List userDTOList = null; + if (content.isReflectOnActivity()) { + // Get user reflection entries + userDTOList = new ArrayList(); + userDTOList.add(getReflectionEntry(forumUser)); + } - //put all message into Map. Key is session name, value is list of all topics in this session. - Map sessionTopicMap = new TreeMap(); - sessionTopicMap.put(session.getSessionName(), msgDtoList); + // Store both in an object array + Object[] pair = {msgDtoList, userDTOList}; + // Add array to Map + // put all message into Map. Key is session name, value is list of all topics in this session. + Map sessionTopicMap = new TreeMap(); + sessionTopicMap.put(session.getSessionName(), pair); + sessionMap.put(ForumConstants.ATTR_TOOL_CONTENT_TOPICS, sessionTopicMap); - //set forum title - sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, session.getForum().getTitle()); + // Set forum title + sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, content.getTitle()); } - public void teacher(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies, HashMap sessionMap) { - IForumService forumService = ForumServiceProxy.getForumService(getServletContext()); - //check if toolContentId exists in db or not if (toolContentID==null) { @@ -180,20 +196,36 @@ logger.error(error); throw new ForumException(error); } - //return FileDetailsDTO list according to the given sessionID - List sessionList = forumService.getSessionsByContentId(toolContentID); - Iterator iter = sessionList.iterator(); - //put all message into Map. Key is session name, value is list of all topics in this session. - Map> topicsByUser = new TreeMap>(this.new StringComparator()); - while(iter.hasNext()){ - ForumToolSession session = (ForumToolSession) iter.next(); - List sessionMsgDTO = getSessionTopicList(session.getSessionId(), directoryName, forumService); - topicsByUser.put(session.getSessionName(),sessionMsgDTO); + // Return FileDetailsDTO list according to the given sessionID + List sessionList = forumService.getSessionsByContentId(toolContentID); + + // put all message into Map. Key is session name, value is list of all topics in this session. + Map topicsByUser = new TreeMap(this.new StringComparator()); + for(ForumToolSession session: sessionList) { + // Get Messages + List sessionMsgDTO = getSessionTopicList(session.getSessionId(), directoryName); + + List userDTOList = null; + if (content.isReflectOnActivity()) { + // Get user reflection entries + List forumUserList = forumService.getUsersBySessionId(session.getSessionId()); + userDTOList = new ArrayList(); + for (ForumUser forumUser : forumUserList) { + userDTOList.add(getReflectionEntry(forumUser)); + } + } + + // Store both in an object array + Object[] pair = {sessionMsgDTO, userDTOList}; + + // Add array to map + topicsByUser.put(session.getSessionName(), pair); } sessionMap.put(ForumConstants.ATTR_TOOL_CONTENT_TOPICS,topicsByUser); -// set forum title + // Set forum title sessionMap.put(ForumConstants.ATTR_FORUM_TITLE, content.getTitle()); + } /** @@ -203,7 +235,7 @@ * @param forumService * @return */ - private List getSessionTopicList(Long toolSessionID, String directoryName, IForumService forumService) { + private List getSessionTopicList(Long toolSessionID, String directoryName) { List rootTopics = forumService.getRootTopics(toolSessionID); List msgDtoList = new ArrayList(); for(MessageDTO msgDto : rootTopics){ @@ -255,17 +287,17 @@ * * @param msgDtoList */ - private void setAuthorMark(List msgDtoList) { + private void setAuthorMark(List msgDtoList) { // set current user to web page, so that can display "edit" button - // correct. Only author alow to edit. + // correct. Only author allowed to edit. HttpSession ss = SessionManager.getSession(); // get back login user DTO UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); Long currUserId = new Long(user.getUserID().intValue()); - Iterator iter = msgDtoList.iterator(); + Iterator iter = msgDtoList.iterator(); while (iter.hasNext()) { - MessageDTO dto = (MessageDTO) iter.next(); + MessageDTO dto = iter.next(); if (dto.getMessage().getCreatedBy() != null && currUserId.equals(dto.getMessage().getCreatedBy() .getUserId())) @@ -274,5 +306,23 @@ dto.setAuthor(false); } } - + + /** + * Retrieves the reflection entry for the forumUser and stores it in a UserDTO + * @param forumUser + * @param userDTOList + */ + private org.lamsfoundation.lams.tool.forum.dto.UserDTO getReflectionEntry(ForumUser forumUser) { + org.lamsfoundation.lams.tool.forum.dto.UserDTO userDTO = new org.lamsfoundation.lams.tool.forum.dto.UserDTO(); + userDTO.setFullName(forumUser.getFirstName() + " " + forumUser.getLastName()); + NotebookEntry notebookEntry = forumService.getEntry(forumUser.getSession().getSessionId(), CoreNotebookConstants.NOTEBOOK_TOOL, + ForumConstants.TOOL_SIGNATURE, forumUser.getUserId().intValue()); + + // check notebookEntry is not null + if (notebookEntry != null) { + userDTO.setReflect(notebookEntry.getEntry()); + logger.debug("Could not find notebookEntry for ForumUser: " + forumUser.getUid()); + } + return userDTO; + } } Index: lams_tool_forum/web/jsps/export/exportportfolio.jsp =================================================================== diff -u -rdbab108fb2d8f57bc99aaeef05449e7ff59f1d66 -rb2f48331751d34eeac313767c9098492691ebbe0 --- lams_tool_forum/web/jsps/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision dbab108fb2d8f57bc99aaeef05449e7ff59f1d66) +++ lams_tool_forum/web/jsps/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision b2f48331751d34eeac313767c9098492691ebbe0) @@ -17,112 +17,122 @@ -
+
-

- ${title} -

+

+ ${title} +

- - -

- ${sessionName} -

- - - - - -
em;"> - - - - - - - - - - - - - - - - - <%-- display mark for teacher --%> - - - - - - - - -
- - - - - - - - -
- - - - - - - - - ${author} - - - - -
- - - - - - -
- - - -
- -
- - - - - - - - -
- -
- - - - - - - - -
-
-
-
+ + +

+ ${sessionName} +

-
+ + + + +
+ + + + + + + + + + + + + + + + <%-- display mark for teacher --%> + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + ${author} + - + + +
+ + + + + + +
+ + + +
+ +
+ + + + + + + + +
+ +
+ + + + + + + + +
+
+
+ + +

+ +

${userDTO.fullName}

+

+ +

+
+
+ + +
+