Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java,v diff -u -r1.4 -r1.5 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java 10 Oct 2008 05:42:09 -0000 1.4 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/IWikiService.java 15 Oct 2008 05:16:34 -0000 1.5 @@ -56,18 +56,24 @@ public Wiki getDefaultContent(); /** + * Returns an instance of the Wiki tools default content. + * * @param toolSignature * @return */ public Long getDefaultContentIdBySignature(String toolSignature); /** + * Gets a wiki instance by its content id + * * @param toolContentID * @return */ public Wiki getWikiByContentId(Long toolContentID); /** + * Uploads a file to a wiki + * * @param toolContentId * @param file * @param type @@ -76,12 +82,16 @@ public WikiAttachment uploadFileToContent(Long toolContentId, FormFile file, String type); /** + * Deletes a file from the repository + * * @param uuid * @param versionID */ public void deleteFromRepository(Long uuid, Long versionID) throws WikiException; /** + * Deletes an instruction file from the repository + * * @param contentID * @param uuid * @param versionID @@ -90,26 +100,36 @@ public void deleteInstructionFile(Long contentID, Long uuid, Long versionID, String type); /** + * Saves or updates a wiki instance + * * @param wiki */ public void saveOrUpdateWiki(Wiki wiki); /** + * Saves or updates a wiki page * * @param wikiPage */ public void saveOrUpdateWikiPage(WikiPage wikiPage); /** + * Updates a wiki page with the given content in the WikiPageForm + * A new WikiPageContent is to be created for each edit so we have a history * + * If the user is null it signifies that this edit was done in author + * * @param wikiPageForm * @param wikiPage * @param user */ public void updateWikiPage(WikiPageForm wikiPageForm, WikiPage wikiPage, WikiUser user); /** + * Creates a new wiki page from the content in the WikiPageForm * + * If the user and session is null it signifies that this edit was done in author + * * @param wikiPageForm * @param wiki * @param user @@ -118,59 +138,76 @@ public Long insertWikiPage(WikiPageForm wikiPageForm, Wiki wiki, WikiUser user, WikiSession session); /** + * Delete an existing wiki page * * @param wikiPage */ public void deleteWikiPage(WikiPage wikiPage); /** + * Gets a wiki page by wiki and title * + * This method should only be called by author as it will only retrieve + * wikipages where the toolSession is null + * * @param wiki * @param title * @return */ public WikiPage getWikiPageByWikiAndTitle(Wiki wiki, String title); /** + * Gets a wiki page by session and title * + * This method should only be called at runtime because it requires a tool + * session + * * @param wikiSession * @param title * @return */ public WikiPage getWikiBySessionAndTitle(WikiSession wikiSession, String title); /** + * Gets a wiki page by its uid * * @param uid * @return */ public WikiPage getWikiPageByUid(Long uid); /** + * Gets a page content by its uid * * @param uid * @return */ public WikiPageContent getWikiPageContent(Long uid); /** + * Saves or updates a wiki page content * * @param wikiPageContent */ public void saveOrUpdateWikiPageContent(WikiPageContent wikiPageContent); /** + * Gets a tool session + * * @param toolSessionId * @return */ public WikiSession getSessionBySessionId(Long toolSessionId); /** + * Saves or updates a wiki session + * * @param wikiSession */ public void saveOrUpdateWikiSession(WikiSession wikiSession); /** + * Gets a WikiUser from the session and thier LAMS user id * * @param userId * @param toolSessionId @@ -179,19 +216,22 @@ public WikiUser getUserByUserIdAndSessionId(Long userId, Long toolSessionId); /** + * Gets a WikiUser by their uid * * @param uid * @return */ public WikiUser getUserByUID(Long uid); /** + * Saves or updates a wiki user * * @param wikiUser */ public void saveOrUpdateWikiUser(WikiUser wikiUser); /** + * Creates a new wiki user * * @param user * @param wikiSession @@ -224,6 +264,9 @@ void updateEntry(NotebookEntry notebookEntry); /** + * This method compares two strings and returns a java html diff of the two + * The returned value will be a html div that prints unchanged lines as is + * new lines with a green background and removed lines with a red background * * @param old * @param current @@ -232,6 +275,8 @@ String comparePages(String old, String current); /** + * this method gets the number of edits by a learner in a tool session, this + * is used for tool outputs * * @param learnerId * @param toolSessionId @@ -240,7 +285,8 @@ int getEditsNum(Long learnerId, Long toolSessionId); /** - * + * this method gets the number of added pages by a learner in a tool + * session, this is used for tool outputs * @param learnerId * @param toolSessionId * @return Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java,v diff -u -r1.7 -r1.8 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java 15 Oct 2008 02:59:46 -0000 1.7 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/service/WikiService.java 15 Oct 2008 05:16:34 -0000 1.8 @@ -96,6 +96,62 @@ * ToolContentManager and ToolSessionManager. */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ +/** + * @author lfoxton + * + */ public class WikiService implements ToolSessionManager, ToolContentManager, IWikiService, ToolContentImport102Manager { static Logger logger = Logger.getLogger(WikiService.class.getName()); @@ -134,6 +190,13 @@ } /* ************ Methods from ToolSessionManager ************* */ + + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.ToolSessionManager#createToolSession(java.lang.Long, + * java.lang.String, java.lang.Long) + */ public void createToolSession(Long toolSessionId, String toolSessionName, Long toolContentId) throws ToolException { if (logger.isDebugEnabled()) { logger.debug("entering method createToolSession:" + " toolSessionId = " + toolSessionId @@ -148,7 +211,7 @@ // Get the wiki content to start a session Wiki wiki = wikiDAO.getByContentId(toolContentId); session.setWiki(wiki); - + // Generate a unique content folder id for the wiki session.setContentFolderID(FileUtil.generateUniqueContentFolderID()); @@ -157,13 +220,12 @@ // Here we need to clone wikipages and content for tool session versions for (WikiPage childPage : wiki.getWikiPages()) { - + // check that this page does not already have a session - if (childPage.getWikiSession() != null) - { + if (childPage.getWikiSession() != null) { continue; } - + // Clone the wiki page WikiPage newChildPage = (WikiPage) childPage.clone(); wikiPageDAO.saveOrUpdate(newChildPage); @@ -209,8 +271,6 @@ } /** - * Get the tool output for the given tool output names. - * * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.util.List, * java.lang.Long, java.lang.Long) */ @@ -225,8 +285,6 @@ } /** - * Get the tool output for the given tool output name. - * * @see org.lamsfoundation.lams.tool.ToolSessionManager#getToolOutput(java.lang.String, * java.lang.Long, java.lang.Long) */ @@ -257,6 +315,12 @@ /* ************ Methods from ToolContentManager ************************* */ + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.ToolContentManager#copyToolContent(java.lang.Long, + * java.lang.Long) + */ public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException { if (logger.isDebugEnabled()) { @@ -280,41 +344,6 @@ Wiki toContent = Wiki.newInstance(fromContent, toContentId, wikiToolContentHandler); insertUnsavedWikiContent(toContent); - - /* - wikiDAO.saveOrUpdate(toContent); - - // Go through and copy child pages and content - for (WikiPage childPage : fromContent.getWikiPages()) { - // Clone the wiki page - WikiPage newChildPage = (WikiPage) childPage.clone(); - wikiPageDAO.saveOrUpdate(newChildPage); - - // Clone the current content - leave the history null - WikiPageContent newPageContent = (WikiPageContent) childPage.getCurrentWikiContent().clone(); - newPageContent.setWikiPage(newChildPage); - // If the edit date is null, set it to now. - if (newPageContent.getEditDate() == null) { - newPageContent.setEditDate(new Date()); - } - wikiPageContentDAO.saveOrUpdate(newPageContent); - - // Set the current content - newChildPage.setCurrentWikiContent(newPageContent); - newChildPage.setParentWiki(toContent); - newChildPage.getWikiContentVersions().add(newPageContent); - - if (newChildPage.getTitle().equals(fromContent.getMainPage().getTitle())) { - // This is the main page - toContent.setMainPage(newChildPage); - } - - // Add page to the list - toContent.getWikiPages().add(newChildPage); - - } - wikiDAO.saveOrUpdate(toContent); - */ } public void setAsDefineLater(Long toolContentId, boolean value) throws DataMissingException, ToolException { @@ -349,7 +378,6 @@ * @throws ToolException * if any other error occurs */ - public void exportToolContent(Long toolContentId, String rootPath) throws DataMissingException, ToolException { Wiki wiki = wikiDAO.getByContentId(toolContentId); if (wiki == null) { @@ -420,44 +448,30 @@ wiki.setCreateBy(new Long(newUserUid.longValue())); insertUnsavedWikiContent(wiki); - - /* - // Go through the wiki object and save all the pages and content - for (WikiPage wikiPage : wiki.getWikiPages()) { - WikiPageContent currentContent = wikiPage.getCurrentWikiContent(); - currentContent.setEditDate(new Date()); - wikiPageContentDAO.saveOrUpdate(currentContent); - currentContent.setWikiPage(wikiPage); - wikiPage.setCurrentWikiContent(currentContent); - wikiPageDAO.saveOrUpdate(wikiPage); - - if (wiki.getMainPage().getTitle() == wikiPage.getTitle()) { - wiki.setMainPage(wikiPage); - } - - wiki.getWikiPages().add(wikiPage); - } - wikiDAO.saveOrUpdate(wiki); - - // Update the wiki pages to reference their parent - for (WikiPage wikiPage : wiki.getWikiPages()) { - wikiPage.setParentWiki(wiki); - wikiPageDAO.saveOrUpdate(wikiPage); - } - */ - } catch (ImportToolContentException e) { throw new ToolException(e); } } /* ********** IWikiService Methods ********************************* */ + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#createNotebookEntry(java.lang.Long, + * java.lang.Integer, java.lang.String, java.lang.Integer, + * java.lang.String) + */ public Long createNotebookEntry(Long id, Integer idType, String signature, Integer userID, String entry) { return coreNotebookService.createNotebookEntry(id, idType, signature, userID, "", entry); } + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#getEntry(org.lamsfoundation.lams.notebook.model.NotebookEntry) + */ public NotebookEntry getEntry(Long sessionId, Integer idType, String signature, Integer userID) { List list = coreNotebookService.getEntry(sessionId, idType, signature, userID); if (list == null || list.isEmpty()) { @@ -468,12 +482,19 @@ } /** - * @param notebookEntry + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#updateEntry(org.lamsfoundation.lams.notebook.model.NotebookEntry) */ public void updateEntry(NotebookEntry notebookEntry) { coreNotebookService.updateEntry(notebookEntry); } + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#comparePages(String,String) + */ public String comparePages(String old, String current) { String oldArray[] = old.replaceAll("[\\t\\n\\r]", "").split("
"); String currentArray[] = current.replaceAll("[\\t\\n\\r]", "").split("
"); @@ -532,8 +553,6 @@ retBuf.append(line); // fix up lines that dont have the div tag on them - // if(!line.endsWith("
")) - // retBuf.append("
"); if (!line.contains("")) retBuf.append(""); } @@ -542,6 +561,11 @@ return retBuf.toString(); } + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#getDefaultContentIdBySignature(String) + */ public Long getDefaultContentIdBySignature(String toolSignature) { Long toolContentId = null; toolContentId = new Long(toolService.getToolDefaultContentIdBySignature(toolSignature)); @@ -553,6 +577,11 @@ return toolContentId; } + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#getDefaultContent() + */ public Wiki getDefaultContent() { Long defaultContentID = getDefaultContentIdBySignature(WikiConstants.TOOL_SIGNATURE); Wiki defaultContent = getWikiByContentId(defaultContentID); @@ -564,6 +593,11 @@ return defaultContent; } + /** + * (non-Javadoc) + * + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#copyDefaultContent(Long) + */ public Wiki copyDefaultContent(Long newContentID) { if (newContentID == null) { @@ -576,58 +610,18 @@ Wiki newContent = Wiki.newInstance(defaultContent, newContentID, wikiToolContentHandler); insertUnsavedWikiContent(newContent); - - // Go through the wiki object and save all the pages and content - /* - for (WikiPage wikiPage : newContent.getWikiPages()) { - WikiPageContent currentContent = wikiPage.getCurrentWikiContent(); - currentContent.setEditDate(new Date()); - wikiPageContentDAO.saveOrUpdate(currentContent); - currentContent.setWikiPage(wikiPage); - wikiPage.setCurrentWikiContent(currentContent); - wikiPageDAO.saveOrUpdate(wikiPage); - - if (newContent.getMainPage().getTitle() == wikiPage.getTitle()) { - newContent.setMainPage(wikiPage); - } - - newContent.getWikiPages().add(wikiPage); - } - wikiDAO.saveOrUpdate(newContent); - - // Update the wiki pages to reference their parent - for (WikiPage wikiPage : newContent.getWikiPages()) { - wikiPage.setParentWiki(newContent); - wikiPageDAO.saveOrUpdate(wikiPage); - } - */ - - /* - * // create new wiki using the newContentID - * Wiki newContent = new Wiki(); newContent = Wiki.newInstance(defaultContent, newContentID, - * wikiToolContentHandler); wikiDAO.saveOrUpdate(newContent); - * - * WikiPage newMainPage = (WikiPage) - * defaultContent.getMainPage().clone(); - * wikiPageDAO.saveOrUpdate(newMainPage); - * - * WikiPageContent newMainPageContent = (WikiPageContent) - * defaultContent.getMainPage().getCurrentWikiContent() .clone(); - * newMainPageContent.setEditDate(new Date()); - * wikiPageContentDAO.saveOrUpdate(newMainPageContent); - * - * newMainPageContent.setWikiPage(newMainPage); - * newMainPage.setCurrentWikiContent(newMainPageContent); - * newMainPage.setParentWiki(newContent); - * newContent.setMainPage(newMainPage); - * wikiDAO.saveOrUpdate(newContent); - */ return newContent; } - - private Wiki insertUnsavedWikiContent(Wiki wiki) - { + + /** + * Takes a transient wiki object and iterates down the tree ensureing each + * object is saved to the db and all references are maintained + * + * @param wiki + * @return + */ + private Wiki insertUnsavedWikiContent(Wiki wiki) { // Go through the wiki object and save all the pages and content for (WikiPage wikiPage : wiki.getWikiPages()) { WikiPageContent currentContent = wikiPage.getCurrentWikiContent(); @@ -651,7 +645,7 @@ wikiPage.setParentWiki(wiki); wikiPageDAO.saveOrUpdate(wikiPage); } - + return wiki; } @@ -704,12 +698,11 @@ } /** - * Updates the wikiPage from the WikiPageForm, used in author, monitor and - * learner + * (non-Javadoc) * - * @param wikiPageForm - * @param wikiPage - * @param user + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#updateWikiPage(org.lamsfoundation.lams.tool.wiki.web.forms.WikiPageForm, + * org.lamsfoundation.lams.tool.wiki.model.WikiPage, + * org.lamsfoundation.lams.tool.wiki.model.WikiUser) */ public void updateWikiPage(WikiPageForm wikiPageForm, WikiPage wikiPage, WikiUser user) { @@ -742,12 +735,12 @@ } /** - * Inserts the wikiPage from the WikiPageForm, used in author, monitor and - * learner + * (non-Javadoc) * - * @param wikiPageForm - * @param wikiPageUid - * @param user + * @see org.lamsfoundation.lams.tool.wiki.service.IWikiService#insertWikiPage(org.lamsfoundation.lams.tool.wiki.web.forms.WikiPageForm, + * org.lamsfoundation.lams.tool.wiki.model.Wiki, + * org.lamsfoundation.lams.tool.wiki.model.WikiUser, + * org.lamsfoundation.lams.tool.wiki.model.WikiSession) */ public Long insertWikiPage(WikiPageForm wikiPageForm, Wiki wiki, WikiUser user, WikiSession session) { @@ -877,7 +870,7 @@ } /** - * This method verifies the credentials of the SubmitFiles Tool and gives it + * This method verifies the credentials of the Wiki Tool and gives it * the Ticket to login and access the Content Repository. * * A valid ticket is needed in order to access the content from the Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/AuthoringAction.java,v diff -u -r1.2 -r1.3 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/AuthoringAction.java 10 Oct 2008 01:18:47 -0000 1.2 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/AuthoringAction.java 15 Oct 2008 05:16:34 -0000 1.3 @@ -67,7 +67,14 @@ import org.lamsfoundation.lams.web.util.SessionMap; /** - * @author + * This action handles all the authoring actions, which include opening author, + * saving, uploading instruction files and all the wikipage actions + * + * It inherits from the WikiPageAction which inherits from the + * LamsDispatchAction so that common actions can be used in learner, monitor and + * author + * + * @author lfoxton * @version * * @struts.action path="/authoring" name="authoringForm" parameter="dispatch" @@ -78,6 +85,10 @@ * @struts.action-forward name="viewWiki" path="/pages/wiki/viewWiki.jsp" * @struts.action-forward name="message_page" path="tiles:/generic/message" */ +/** + * @author lfoxton + * + */ public class AuthoringAction extends WikiPageAction { private static Logger logger = Logger.getLogger(AuthoringAction.class); @@ -189,18 +200,38 @@ return mapping.findForward("success"); } + /** + * Wrapper method to make sure that the correct wiki is returned to from the + * WikiPageAction class + */ protected ActionForward returnToWiki(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, Long currentWikiPageId) throws Exception { AuthoringForm authForm = (AuthoringForm) form; authForm.setCurrentWikiPageId(currentWikiPageId); return unspecified(mapping, authForm, request, response); } - + + /** + * Implements the abstract method, since this is author we return null here + * as there is no user + */ public WikiUser getCurrentUser(Long toolSessionId) { // return null here to signify that this is in author return null; } + /** + * Saves the Wiki content including uploaded files and advance options + * + * The WikiPage content is not saved here as that is done in the + * WikiPageAction + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward updateContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // TODO need error checking. @@ -284,6 +315,9 @@ /* ========== Private Methods ********** */ + /** + * Upload a file + */ private ActionForward uploadFile(ActionMapping mapping, AuthoringForm authForm, String type, HttpServletRequest request) { SessionMap map = getSessionMap(request, authForm); @@ -339,6 +373,14 @@ return mapping.findForward("success"); } + /** + * Delete a file + * @param mapping + * @param authForm + * @param type + * @param request + * @return + */ private ActionForward deleteFile(ActionMapping mapping, AuthoringForm authForm, String type, HttpServletRequest request) { SessionMap map = getSessionMap(request, authForm); Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java,v diff -u -r1.5 -r1.6 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java 15 Oct 2008 02:59:46 -0000 1.5 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/LearningAction.java 15 Oct 2008 05:16:34 -0000 1.6 @@ -62,6 +62,13 @@ import org.lamsfoundation.lams.web.util.AttributeNames; /** + * This action handles all the learning actions, which include opening learner, + * relection, going to the next activity, and all the wikipage actions + * + * It inherits from the WikiPageAction which inherits from the + * LamsDispatchAction so that common actions can be used in learner, monitor and + * author + * * @author lfoxton * @version * @@ -82,6 +89,10 @@ private IWikiService wikiService; + /** + * unspecified loads the learner window with the current wiki page + * as well as setting all the advanced options and user-specifice info + */ protected ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -207,13 +218,22 @@ return mapping.findForward("wiki"); } + /** + * Wrapper method to make sure that the correct wiki is returned to from the + * WikiPageAction class + */ protected ActionForward returnToWiki(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, Long currentWikiPageId) throws Exception { LearningForm learnForm = (LearningForm) form; learnForm.setCurrentWikiPageId(currentWikiPageId); return unspecified(mapping, learnForm, request, response); } + /** + * Gets the current user by toolSessionId + * + * @param toolSessionId + */ protected WikiUser getCurrentUser(Long toolSessionId) { UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); @@ -228,7 +248,16 @@ return wikiUser; } - + + /** + * Finish the activity, we dont need to save anything here, as that is + * done by the wikipage actions + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward finishActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { @@ -237,20 +266,6 @@ WikiUser wikiUser = getCurrentUser(toolSessionID); if (wikiUser != null) { - - LearningForm learningForm = (LearningForm) form; - - // TODO fix idType to use real value not 999 - /* - * if (wikiUser.getEntryUID() == null) { - * wikiUser.setEntryUID(wikiService.createNotebookEntry(toolSessionID, - * CoreNotebookConstants.NOTEBOOK_TOOL, - * WikiConstants.TOOL_SIGNATURE, wikiUser.getUserId() .intValue(), - * learningForm.getEntryText())); } else { // update existing entry. - * wikiService.updateEntry(wikiUser.getEntryUID(), - * learningForm.getEntryText()); } - */ - wikiUser.setFinishedActivity(true); wikiService.saveOrUpdateWikiUser(wikiUser); } else { @@ -275,6 +290,14 @@ return null; // TODO need to return proper page. } + /** + * Opens the notebook page for reflections + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward openNotebook(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { @@ -296,6 +319,14 @@ return mapping.findForward("notebook"); } + /** + * Submit reflections + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java,v diff -u -r1.5 -r1.6 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java 15 Oct 2008 02:59:46 -0000 1.5 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/actions/MonitoringAction.java 15 Oct 2008 05:16:34 -0000 1.6 @@ -57,7 +57,14 @@ import org.lamsfoundation.lams.web.util.AttributeNames; /** - * @author + * This action handles all the monitoring actions, which include opening + * monitor, and all the wikipage actions + * + * It inherits from the WikiPageAction which inherits from the + * LamsDispatchAction so that common actions can be used in learner, monitor and + * author + * + * @author lfoxton * @version * * @struts.action path="/monitoring" parameter="dispatch" scope="request" @@ -76,6 +83,10 @@ public IWikiService wikiService; + /** + * Sets up the main authoring page which lists the tool sessions and allows + * you to view their respective WikiPages + */ public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -103,13 +114,22 @@ return mapping.findForward("success"); } + /** + * Wrapper method to make sure that the correct wiki is returned to from the + * WikiPageAction class + */ protected ActionForward returnToWiki(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, Long currentWikiPageId) throws Exception { MonitoringForm monitoringForm = (MonitoringForm) form; monitoringForm.setCurrentWikiPageId(currentWikiPageId); return showWiki(mapping, monitoringForm, request, response); } + /** + * Gets the current user by toolSessionId + * + * @param toolSessionId + */ protected WikiUser getCurrentUser(Long toolSessionId) { UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); @@ -125,6 +145,14 @@ return wikiUser; } + /** + * Shows a specific wiki based on the session id + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward showWiki(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Index: lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java,v diff -u -r1.7 -r1.8 --- lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java 15 Oct 2008 02:59:46 -0000 1.7 +++ lams_tool_wiki/src/java/org/lamsfoundation/lams/tool/wiki/web/servlets/ExportServlet.java 15 Oct 2008 05:21:17 -0000 1.8 @@ -48,7 +48,6 @@ import org.lamsfoundation.lams.tool.wiki.dto.WikiUserDTO; import org.lamsfoundation.lams.tool.wiki.model.Wiki; import org.lamsfoundation.lams.tool.wiki.model.WikiPage; -import org.lamsfoundation.lams.tool.wiki.model.WikiPageContent; import org.lamsfoundation.lams.tool.wiki.model.WikiSession; import org.lamsfoundation.lams.tool.wiki.model.WikiUser; import org.lamsfoundation.lams.tool.wiki.service.IWikiService; @@ -60,6 +59,12 @@ import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; +/** + * This servlet does export portfolio for teachers and students + * + * @author lfoxton + * + */ public class ExportServlet extends AbstractExportPortfolioServlet { private static final long serialVersionUID = -2829707715037631881L; @@ -70,6 +75,10 @@ private IWikiService wikiService; + /** + * This is the doGet method, it determines whether this is a student or + * teacher then does the appropriate export + */ protected String doExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { @@ -100,6 +109,9 @@ return FILENAME; } + /** + * Do an offline export + */ protected String doOfflineExport(HttpServletRequest request, HttpServletResponse response, String directoryName, Cookie[] cookies) { if (toolContentID == null && toolSessionID == null) { @@ -124,6 +136,18 @@ return super.doOfflineExport(request, response, directoryName, cookies); } + /** + * Do export for learners, outputs the wiki pages into one page + * which seperates each page into divs which are displayed onclick + * + * @param request + * @param response + * @param directoryName + * @param basePath + * @param cookies + * @throws WikiException + * @throws IOException + */ private void doLearnerExport(HttpServletRequest request, HttpServletResponse response, String directoryName, String basePath, Cookie[] cookies) throws WikiException, IOException { @@ -195,6 +219,17 @@ writeResponseToFile(basePath + "/pages/export/exportPortfolio.jsp", directoryName, FILENAME, cookies); } + /** + * Exports for teacher, does a main file and a file for each session so that + * each session can have its own wiki page + * @param request + * @param response + * @param directoryName + * @param basePath + * @param cookies + * @throws WikiException + * @throws IOException + */ private void doTeacherExport(HttpServletRequest request, HttpServletResponse response, String directoryName, String basePath, Cookie[] cookies) throws WikiException, IOException { @@ -276,6 +311,13 @@ } } + /** + * Goes through the content and changes the references to images so they can + * be referenced locally + * @param body + * @param contentFolderID + * @return + */ private String replaceImageFolderLinks(String body, String contentFolderID) { String fckeditorpath = "/rams//www/secure/" + contentFolderID; String fckeditorsmiley = "/rams//fckeditor/editor/images/smiley";