Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -re4625a3ec2ff39bfe424a857788a54497ff64b7a -ra2d72bee6029b7e05e8cd696c02db214f3049365 Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/util/FileValidatorSpringUtil.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/util/FileValidatorSpringUtil.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/util/FileValidatorSpringUtil.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,199 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.util; + +import java.text.NumberFormat; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.validator.Field; +import org.apache.commons.validator.Validator; +import org.apache.commons.validator.ValidatorAction; +import org.apache.commons.validator.util.ValidatorUtils; +import org.apache.struts.action.ActionMessage; +import org.apache.struts.action.ActionMessages; +import org.springframework.validation.Errors; +import org.springframework.web.multipart.MultipartFile; + +/** + * This class is used by commons validator. To validate various properties + * related to any uploaded files + * + * @author Anthony Xiao + */ +public class FileValidatorSpringUtil { + + public static final String LARGE_FILE = "largeFile"; + private static final String MSG_KEY = "errors.maxfilesize"; + + /** + * To enable this validator copy the XML entry below to validator-rules.xml + * + * + * Then to validate your uploaded file size, by placing it under the corresponding
tag + * + * We could also use maxFileSize to validated large file sizes by setting the largeFile flag + * to true + * + * + * largeFile + * true + * + * + * + * You need to add an errors.maxfilesize entry to your resource bundle or you can change + * the "msg" attribute in the "validator" tag above. The maximum file size is pass to + * the message as arg0. So the following message or something similar could be used. + * errors.maxfilesize=The uploaded file has exceeded the maximum file size limit of {0} bytes + */ +// public static boolean validateFileSize(Object bean, ValidatorAction va, Field field, Errors errors, +// Validator validator, HttpServletRequest request) { +// +// long fileSize = 0; +// try { +// String fileSizeStr = ValidatorUtils.getValueAsString(bean, field.getProperty()); +// fileSize = Long.valueOf(fileSizeStr); +// } catch (Exception e) { +// //catch null point exception: e.g., offlineFile.fileSize, if offlineFile is null, +// //ValidatorUtils.getValueAsString() will throw null. +// //skip, do nothing +// return true; +// } +// +// boolean largeFile = Boolean.valueOf(field.getVarValue(LARGE_FILE)).booleanValue(); +// //so far put message into GLOABLE_MESSAGE rather than special key +// return FileValidatorSpringUtil.validateFileSize(fileSize, largeFile, errors); +// } + + /** + * + * @param file + * @param largeFile + * @param errors + * @return Be careful, if the file size is under maximum size, return TRUE. Otherwise, return false. + */ + + public static boolean validateFileSize(MultipartFile file, boolean largeFile, Errors errors) { + long fileSize = 0; + try { + fileSize = file.getSize(); + } catch (Exception e) { + //skip, do nothing + return true; + } + float maxFileSize = largeFile ? Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE) + : Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE); + + if (fileSize > maxFileSize) { + String maxSize = FileValidatorSpringUtil.formatSize(maxFileSize); + + // set error message + errors.reject(MSG_KEY, new Object[] { maxSize }, null); + return false; + } + return true; + } + + /** + * + * @param file + * @param largeFile + * @param errorKey + * the key in ActionMessages(errorKey,ActionMessage()); + * @param errors + * @return Be careful, if the file size is under maximum size, return TRUE. Otherwise, return false. + */ + public static boolean validateFileSize(MultipartFile file, Long fileSize, boolean largeFile, String errorKey, + Errors errors) { + + try { + fileSize = file.getSize(); + } catch (Exception e) { + //skip, do nothing + return true; + } + + return FileValidatorSpringUtil.validateFileSize(file, fileSize, largeFile, errorKey, errors); + } + + /** + * + * @param file + * @param largeFile + * @return return null if file size is below max filesize, otherwise, return error message + */ + public static Errors validateFileSize(MultipartFile file, Long fileSize, boolean largeFile, Errors errors) { + fileSize = file.getSize(); + Errors errorMessage = null; + boolean isMaxFilesizeExceeded = !FileValidatorSpringUtil.validateFileSize(file, largeFile, errors); + if (isMaxFilesizeExceeded) { + errorMessage = (Errors) errors.getAllErrors(); + } + + return errorMessage; + } + + private static boolean validateFileSize(int fileSize, boolean largeFile, String errorKey, Errors errors) { + float maxFileSize = largeFile ? Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE) + : Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE); + + if (fileSize > maxFileSize) { + String maxSize = FileValidatorSpringUtil.formatSize(maxFileSize); + + // set error message + errors.reject(MSG_KEY, maxSize); + return false; + } + return true; + } + + public static String formatSize(double size) { + String unit = null; + if (size >= 1024) { + size = size / 1024; + if (size >= 1024) { + size = size / 1024; + unit = " MB"; + } else { + unit = " KB"; + } + } else { + unit = " B"; + } + + NumberFormat format = NumberFormat.getInstance(); + format.setMaximumFractionDigits(1); + return format.format(size) + unit; + } +} \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java =================================================================== diff -u -r2f725f8ef2aa09a2663b2335bf67213074426d11 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java (.../NoticeboardConstants.java) (revision 2f725f8ef2aa09a2663b2335bf67213074426d11) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/NoticeboardConstants.java (.../NoticeboardConstants.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -33,12 +33,11 @@ * * @author mtruong */ -public class NoticeboardConstants { +public interface NoticeboardConstants { /** * Private Construtor to avoid instantiation. */ - private NoticeboardConstants() { - } + public final static String TOOL_SIGNATURE = "lanb11"; Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/nbApplicationContext.xml =================================================================== diff -u -r85ef8aca5722a36582117db1e8b988e2c16b6369 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/nbApplicationContext.xml (.../nbApplicationContext.xml) (revision 85ef8aca5722a36582117db1e8b988e2c16b6369) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/nbApplicationContext.xml (.../nbApplicationContext.xml) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -53,8 +53,10 @@ + + + - Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/ClearSessionAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/NbAuthoringAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/NbLearnerAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/NbLearnerStarterAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/NbMonitoringAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag a2d72bee6029b7e05e8cd696c02db214f3049365 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/action/NbPedagogicalPlannerAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/ClearSessionController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/ClearSessionController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/ClearSessionController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,72 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.authoring.web.LamsAuthoringFinishController; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.WebApplicationContext; + +/** + * This class give a chance to clear HttpSession when user save/close authoring page. + * + * @author Steve.Ni + * + * + * + * + * @version $Revision$ + */ +@Controller +public class ClearSessionController extends LamsAuthoringFinishController implements NoticeboardConstants { + private static Logger logger = Logger.getLogger(ClearSessionController.class.getName()); + + @Autowired + private WebApplicationContext applicationContext; + + @RequestMapping("/clearsession") + public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException { + super.execute(request, response, applicationContext); + } + + @Override + public void clearSession(String customiseSessionID, HttpSession session, ToolAccessMode mode) { + session.removeAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG); + if (mode.isAuthor()) { + ClearSessionController.logger.debug("In Author mode"); + session.removeAttribute(customiseSessionID); + } + } +} Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,233 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; +import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbAuthoringForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + *

+ * This class is a simple combination of NbAuthoringStarterAction and NbAuthoringAction. It has been created for the + * purpose of supporting the new authoring page which is done using DHTML. + *

+ * + *

+ * The unspecified method, is the same as the execute method for NbAuthoringStarterAction. It will get called when the + * method parameter is not specified (that is on first entry into the authoring environment). + *

+ * + *

+ * The save, upload and delete method is the same as that of NbAuthoringAction, to see its explanation, please see + * org.lamsfoundation.lams.tool.noticeboard.web.NbAuthoringAction + *

+ * + * @author mtruong + */ +@Controller +@RequestMapping("/authoring") +public class NbAuthoringController { + + private static Logger logger = Logger.getLogger(NbAuthoringController.class.getName()); + public final static String FORM = "NbAuthoringForm"; + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + @Autowired + @Qualifier("nbMessageService") + private MessageService messageService; + + /** Get the user from the shared session */ + public UserDTO getUser(HttpServletRequest request) { + // set up the user details + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if (user == null) { + String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "User"); + logger.error(error); + throw new NbApplicationException(error); + } + return user; + } + + public String unspecified(@ModelAttribute NbAuthoringForm nbAuthoringForm, HttpServletRequest request) { + /* + * Retrieve the Service + */ + + Long contentId = WebUtil.readLongParam(request, NoticeboardConstants.TOOL_CONTENT_ID); + String contentFolderId = WebUtil.readStrParam(request, NoticeboardConstants.CONTENT_FOLDER_ID); + + nbAuthoringForm.setToolContentID(contentId.toString()); + + /* + * DefineLater is used in the basic screen. If defineLater is set, then in the authoring page, + * the two tabs {Advanced, Instructions} are not visible. + */ + nbAuthoringForm.setDefineLater(request.getParameter(NoticeboardConstants.DEFINE_LATER)); + + if (!contentExists(nbService, contentId)) { + // Pre-fill the form with the default content + //NoticeboardContent nb = nbService.retrieveNoticeboard(NoticeboardConstants.DEFAULT_CONTENT_ID); + Long defaultToolContentId = nbService + .getToolDefaultContentIdBySignature(NoticeboardConstants.TOOL_SIGNATURE); + // logger.debug("Default tool content id is " + defaultToolContentId); + NoticeboardContent nb = nbService.retrieveNoticeboard(defaultToolContentId); + + if (nb == null) { + String error = "There is data missing in the database"; + logger.error(error); + throw new NbApplicationException(error); + } + + //initialise the values in the form, so the values will be shown in the jsp + nbAuthoringForm.setToolContentID(contentId.toString()); + nbAuthoringForm.setContentFolderID(contentFolderId); + nbAuthoringForm.setTitle(nb.getTitle()); + nbAuthoringForm.setBasicContent(nb.getContent()); + + //content already exists on the database + } else { + //get the values from the database + NoticeboardContent nb = nbService.retrieveNoticeboard(contentId); + + /* + * If retrieving existing content, check whether the contentInUse flag is set, if set, the + * author is not allowed to edit content + */ + + /* + * Define later set to true when the edit activity tab is brought up + * So that users cannot start using the content while the staff member is editing the content + */ + nbAuthoringForm.populateFormWithNbContentValues(nb); + nbAuthoringForm.setContentFolderID(contentFolderId); + boolean isDefineLater = Boolean.parseBoolean(nbAuthoringForm.getDefineLater()); + nb.setDefineLater(isDefineLater); + nbService.saveNoticeboard(nb); + + if (isDefineLater) { + request.setAttribute(AttributeNames.ATTR_MODE, ToolAccessMode.TEACHER.toString()); + + // audit log the teacher has started editing activity in monitor + nbService.auditLogStartEditingActivityInMonitor(contentId); + } + } + + request.setAttribute(FORM, nbAuthoringForm); + return "authoring/authoring"; + } + + /** + * Checks the session to see if the title and content session variables exist or not. + * + * @param session + * The HttpSession to check. + * @return true if the parameters title and content exists in the session, false otherwise + */ + private boolean contentExists(INoticeboardService service, Long id) { + NoticeboardContent nb = service.retrieveNoticeboard(id); + if (nb == null) { + return false; + } else { + return true; + } + + } + + public String save(@ModelAttribute NbAuthoringForm nbAuthoringForm, HttpServletRequest request) { + + //copyAuthoringFormValuesIntoFormBean(request, nbForm); + + String idAsString = nbAuthoringForm.getToolContentID(); + if (idAsString == null) { + String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "Tool Content Id"); + logger.error(error); + throw new NbApplicationException(error); + } + Long content_id = NbWebUtil.convertToLong(nbAuthoringForm.getToolContentID()); + + //throws exception if the content id does not exist + checkContentId(content_id); + + NoticeboardContent nbContent = nbService.retrieveNoticeboard(content_id); + if (nbContent == null) { + //create a new noticeboard object + nbContent = new NoticeboardContent(); + nbContent.setNbContentId(content_id); + } + + nbAuthoringForm.copyValuesIntoNbContent(nbContent); + if (nbContent.getDateCreated() == null) { + nbContent.setDateCreated(nbContent.getDateUpdated()); + } + + UserDTO user = getUser(request); + nbContent.setCreatorUserId(new Long(user.getUserID().longValue())); + + // Author has finished editing the content and mark the defineLater flag to false + nbContent.setDefineLater(false); + nbService.saveNoticeboard(nbContent); + + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG, Boolean.TRUE); + return "authoring/authoring"; + } + + /** + * It is assumed that the contentId is passed as a http parameter + * if the contentId is null, an exception is thrown, otherwise proceed as normal + * + * @param contentId + * the toolContentId to check + */ + private void checkContentId(Long contentId) { + if (contentId == null) { + String error = "Unable to continue. Tool content id missing."; + + throw new NbApplicationException(error); + } + } + +} Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,220 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import java.io.IOException; +import java.util.Date; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +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.ToolSessionManager; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; +import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbLearnerForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.WebApplicationContext; + +/** + * Creation Date: 29-06-05 + * + * This class has been created so that when a learner finishes an activity, + * leaveToolSession() will be called to inform the progress engine + * that the user has completed this activity. + * + * A note: at the time of writing (11-08-05) a null pointer exception + * occurs when making a call to leaveToolSession(). Will have to wait until + * the learner side of things is tested first. + * + * + * + * + * + * + * + * + */ +@Controller +@RequestMapping("/learner") +public class NbLearnerController implements NoticeboardConstants { + + static Logger logger = Logger.getLogger(NbLearnerController.class.getName()); + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + @Autowired + @Qualifier("nbMessageService") + private MessageService messageService; + + @Autowired + private WebApplicationContext applicationContext; + + /** Get the user id from the shared session */ + public Long getUserID(HttpServletRequest request) { + // set up the user details + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if (user == null) { + String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "User"); + logger.error(error); + throw new NbApplicationException(error); + } + return new Long(user.getUserID().longValue()); + } + + /** + * Indicates that the user has finished viewing the noticeboard. + * The session is set to complete and leaveToolSession is called. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public String finish(@ModelAttribute NbLearnerForm learnerForm, HttpServletRequest request, + HttpServletResponse response) + throws NbApplicationException, ToolException, DataMissingException, ServletException, IOException { + + Long userID = getUserID(request); + + Long toolSessionID = NbWebUtil.convertToLong(learnerForm.getToolSessionID()); + if (toolSessionID == null) { + String error = "Unable to continue. The parameters tool session id is missing"; + logger.error(error); + throw new NbApplicationException(error); + } + + ToolSessionManager sessionMgrService = NoticeboardServiceProxy + .getNbSessionManager(applicationContext.getServletContext()); + + ToolAccessMode mode = WebUtil.getToolAccessMode(learnerForm.getMode()); + if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { + NoticeboardSession nbSession = nbService.retrieveNoticeboardSession(toolSessionID); + NoticeboardUser nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + + nbUser.setUserStatus(NoticeboardUser.COMPLETED); + nbService.updateNoticeboardSession(nbSession); + nbService.updateNoticeboardUser(nbUser); + + // Create the notebook entry if reflection is set. + NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + if (nbContent.getReflectOnActivity()) { + // check for existing notebook entry + NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue()); + + if (entry == null) { + // create new entry + nbService.createNotebookEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue(), learnerForm.getReflectionText()); + } else { + // update existing entry + entry.setEntry(learnerForm.getReflectionText()); + entry.setLastModified(new Date()); + nbService.updateEntry(entry); + } + } + + String nextActivityUrl; + try { + nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, getUserID(request)); + } catch (DataMissingException e) { + log.error(e); + throw new ServletException(e); + } catch (ToolException e) { + log.error(e); + throw new ServletException(e); + } + + response.sendRedirect(nextActivityUrl); + + return null; + + } + request.setAttribute(NoticeboardConstants.READ_ONLY_MODE, "true"); + + return ".learnerContent"; + + } + + /** + * Indicates that the user has finished viewing the noticeboard, and will be + * passed onto the Notebook reflection screen. + * + * @param mapping + * @param form + * @param request + * @param response + * @return + */ + public String reflect(@ModelAttribute NbLearnerForm learnerForm, HttpServletRequest request) { + + Long toolSessionID = NbWebUtil.convertToLong(learnerForm.getToolSessionID()); + NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + request.setAttribute("reflectInstructions", nbContent.getReflectInstructions()); + request.setAttribute("title", nbContent.getTitle()); + request.setAttribute("allowComments", nbContent.isAllowComments()); + request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike()); + request.setAttribute("anonymous", nbContent.isAllowAnonymous()); + + // get the existing reflection entry + NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, getUserID(request).intValue()); + if (entry != null) { + request.setAttribute("reflectEntry", entry.getEntry()); + } + + LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, + applicationContext.getServletContext()); + + return ".reflectOnActivity"; + } +} \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerStarterController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerStarterController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerStarterController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,285 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +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.noticeboard.NoticeboardConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; +import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbLearnerForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.validation.Errors; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.WebApplicationContext; + +/** + * Creation Date: 27-06-05 + * + * The learner url can be of three modes learner, teacher or author. Depending on + * what mode was set, it will trigger the corresponding action. If the mode parameter + * is missing or a key is not found in the keymap, it will call the unspecified method + * which defaults to the learner action. + * + *

+ * The difference between author mode (which is basically the preview) + * is that if the defineLater flag is set, it will not be able to see the noticeboard screen + *

+ * + * + * + * + * + * + * + * + * + */ +@Controller +@RequestMapping("/starter/learner") +public class NbLearnerStarterController { + + static Logger logger = Logger.getLogger(NbLearnerStarterController.class.getName()); + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + @Autowired + @Qualifier("nbMessageService") + private MessageService messageService; + + @Autowired + private WebApplicationContext applicationContext; + + private UserDTO getUserDTO(HttpServletRequest request) { + // set up the user details + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if (user == null) { + String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "User"); + logger.error(error); + throw new NbApplicationException(error); + } + return user; + } + + /** Get the user id from the shared session */ + public Long getUserID(HttpServletRequest request) { + UserDTO user = getUserDTO(request); + return new Long(user.getUserID().longValue()); + } + + /** Get the user id from the url - needed for the monitoring mode */ + public Long getUserIDFromURLCall(HttpServletRequest request) { + return WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); + } + + public String unspecified(@ModelAttribute NbLearnerForm learnerForm, Errors errors, HttpServletRequest request, + HttpServletResponse response) { + + return learner(learnerForm, errors, request, response); + } + + @RequestMapping("/learner") + public String learner(@ModelAttribute NbLearnerForm learnerForm, Errors errors, HttpServletRequest request, + HttpServletResponse response) { + + NoticeboardContent nbContent = null; + NoticeboardUser nbUser = null; + saveMessages(request, null); + + Long toolSessionID = NbWebUtil.convertToLong(learnerForm.getToolSessionID()); + + if (toolSessionID == null) { + String error = "Unable to continue. The parameters tool session id is missing"; + logger.error(error); + throw new NbApplicationException(error); + } + + nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + // nbSession = nbService.retrieveNoticeboardSession(toolSessionId); + + if (nbContent == null) { + String error = "An Internal error has occurred. Please exit and retry this sequence"; + logger.error(error); + throw new NbApplicationException(error); + } + + if (isFlagSet(nbContent, NoticeboardConstants.FLAG_DEFINE_LATER)) { + return "defineLater"; + } + + boolean readOnly = false; + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, false); + Long userID = null; + if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { + userID = getUserID(request); + nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + + if (!nbContent.isContentInUse()) { + /* Set the ContentInUse flag to true, and defineLater flag to false */ + nbContent.setContentInUse(true); + nbService.saveNoticeboard(nbContent); + } + + if (nbUser == null) { + //create a new user with this session id + nbUser = new NoticeboardUser(userID); + UserDTO user = getUserDTO(request); + nbUser.setUsername(user.getLogin()); + nbUser.setFullname(user.getFirstName() + " " + user.getLastName()); + nbService.addUser(toolSessionID, nbUser); + } + } else { + // user will not exist if force completed. + userID = getUserIDFromURLCall(request); + nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + readOnly = true; + } + + learnerForm.copyValuesIntoForm(nbContent, readOnly, mode.toString()); + + NotebookEntry notebookEntry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue()); + if (notebookEntry != null) { + request.setAttribute("reflectEntry", notebookEntry.getEntry()); + } + request.setAttribute("reflectInstructions", nbContent.getReflectInstructions()); + request.setAttribute("reflectOnActivity", nbContent.getReflectOnActivity()); + request.setAttribute("allowComments", nbContent.isAllowComments()); + request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike()); + request.setAttribute("anonymous", nbContent.isAllowAnonymous()); + + Boolean userFinished = (nbUser != null && NoticeboardUser.COMPLETED.equals(nbUser.getUserStatus())); + request.setAttribute("userFinished", userFinished); + + LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, + applicationContext.getServletContext()); + + /* + * Checks to see if the runOffline flag is set. + * If the particular flag is set, control is forwarded to jsp page + * displaying to the user the message according to what flag is set. + */ + if (displayMessageToUser(nbContent, errors)) { + saveMessages(request, message); + return ("displayMessage"); + } + + return "learnerContent"; + + } + + @RequestMapping("/teacher") + public String teacher(@ModelAttribute NbLearnerForm learnerForm, Errors errors, HttpServletRequest request, + HttpServletResponse response) throws NbApplicationException { + return learner(learnerForm, errors, request, response); + } + + public String author(@ModelAttribute NbLearnerForm learnerForm, Errors errors, HttpServletRequest request, + HttpServletResponse response) throws NbApplicationException { + + return learner(learnerForm, errors, request, response); + + } + + /** + *

+ * Performs a check on the flag indicated by flag + * In this noticeboard tool, there are 3 possible flags: + *

  • defineLater
  • + *
  • contentInUse
  • + *
    + * Returns true if the flag is set, false otherwise + *

    + * + * @param content + * The instance of NoticeboardContent + * @param flag + * The flag to check, can take the following set of values (defineLater, contentInUse) + * @return Returns true if flag is set, false otherwise + */ + private boolean isFlagSet(NoticeboardContent content, int flag) throws NbApplicationException { + switch (flag) { + case NoticeboardConstants.FLAG_DEFINE_LATER: + return (content.isDefineLater()); + // break; + case NoticeboardConstants.FLAG_CONTENT_IN_USE: + return (content.isContentInUse()); + // break; + default: + throw new NbApplicationException("Invalid flag"); + } + + } + + /** + *

    + * This methods checks the defineLater and runOffline flag. + * If defineLater flag is set, then a message is added to an ActionMessages + * object saying that the contents have not been defined yet. If the runOffline + * flag is set, a message is added to ActionMessages saying that the contents + * are not being run online. + * This method will return true if any one of the defineLater or runOffline flag is set. + * Otherwise false will be returned. + *

    + * + * @param content + * The instance of NoticeboardContent + * @param message + * the instance of ActtionMessages + * @return true if any of the flags are set, false otherwise + */ + private boolean displayMessageToUser(NoticeboardContent content, Errors errors) { + boolean isDefineLaterSet = isFlagSet(content, NoticeboardConstants.FLAG_DEFINE_LATER); + if (isDefineLaterSet) { + if (isDefineLaterSet) { + errors.reject("message.defineLaterSet"); + } + return true; + } else { + return false; + } + } + +} \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,167 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; +import org.lamsfoundation.lams.tool.noticeboard.dto.ReflectionDTO; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; +import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbMonitoringForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * The buttons are a switch between tabs and will forward to a jsp and display + * the appropriate page. + * + * @author mtruong + */ +@Controller +@RequestMapping("/monitoring") +public class NbMonitoringController { + + static Logger logger = Logger.getLogger(NbMonitoringController.class.getName()); + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + public final static String FORM = "NbMonitoringForm"; + + public String unspecified(@ModelAttribute NbMonitoringForm monitorForm, HttpServletRequest request, + HttpServletResponse response) throws NbApplicationException { + + Long toolContentId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.TOOL_CONTENT_ID)); + String contentFolderID = WebUtil.readStrParam(request, NoticeboardConstants.CONTENT_FOLDER_ID); + if (toolContentId == null) { + String error = "Unable to continue. Tool content id missing"; + logger.error(error); + throw new NbApplicationException(error); + } + + NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId); + + monitorForm.setTitle(content.getTitle()); + monitorForm.setBasicContent(content.getContent()); + + request.setAttribute(NoticeboardConstants.TOOL_CONTENT_ID, toolContentId); + request.setAttribute(NoticeboardConstants.CONTENT_FOLDER_ID, contentFolderID); + + //Get the total number of learners that have participated in this tool activity + monitorForm.setTotalLearners(nbService.calculateTotalNumberOfUsers(toolContentId)); + + Set sessions = content.getNbSessions(); + Iterator i = sessions.iterator(); + Map numUsersMap = new HashMap(); + Map sessionIdMap = new HashMap(); + List reflections = new ArrayList<>(); + while (i.hasNext()) { + NoticeboardSession session = (NoticeboardSession) i.next(); + int numUsersInSession = nbService.getNumberOfUsersInSession(session); + numUsersMap.put(session.getNbSessionName(), new Integer(numUsersInSession)); + sessionIdMap.put(session.getNbSessionName(), session.getNbSessionId()); + // Get list of users that have made a reflection entry + if (content.getReflectOnActivity()) { + List sessionUsers = nbService.getUsersBySession(session.getNbSessionId()); + for (int j = 0; j < sessionUsers.size(); j++) { + NoticeboardUser nbUser = (NoticeboardUser) sessionUsers.get(j); + NotebookEntry nbEntry = nbService.getEntry(session.getNbSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, NoticeboardConstants.TOOL_SIGNATURE, + nbUser.getUserId().intValue()); + if (nbEntry != null) { + ReflectionDTO dto = new ReflectionDTO(nbEntry); + dto.setExternalId(session.getNbSessionId()); + dto.setUserId(nbUser.getUserId()); + dto.setUsername(nbUser.getUsername()); + reflections.add(dto); + } + } + } + } + monitorForm.setGroupStatsMap(numUsersMap); + monitorForm.setSessionIdMap(sessionIdMap); + + boolean isGroupedActivity = nbService.isGroupedActivity(toolContentId); + request.setAttribute("isGroupedActivity", isGroupedActivity); + + // Set reflection statistics, if reflection is set + request.setAttribute("reflectOnActivity", content.getReflectOnActivity()); + request.setAttribute("reflectInstructions", content.getReflectInstructions()); + request.setAttribute("reflections", reflections); + + request.setAttribute("allowComments", content.isAllowComments()); + + String currentTab = WebUtil.readStrParam(request, AttributeNames.PARAM_CURRENT_TAB, true); + monitorForm.setCurrentTab(currentTab != null ? currentTab : "1"); + request.setAttribute(FORM, monitorForm); + return "monitorPage"; + } + + public String viewReflection(HttpServletRequest request) { + Long userId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.USER_ID)); + Long toolSessionId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.TOOL_SESSION_ID)); + NoticeboardUser nbUser = nbService.retrieveNoticeboardUser(userId, toolSessionId); + NotebookEntry nbEntry = nbService.getEntry(nbUser.getNbSession().getNbSessionId(), + CoreNotebookConstants.NOTEBOOK_TOOL, NoticeboardConstants.TOOL_SIGNATURE, userId.intValue()); + if (nbEntry != null) { + request.setAttribute("nbEntry", nbEntry.getEntry()); + request.setAttribute("name", nbUser.getFullname()); + } + + return "monitorReflectionPage"; + } + + public String viewComments(HttpServletRequest request) { + + Long toolSessionID = WebUtil.readLongParam(request, NoticeboardConstants.TOOL_SESSION_ID, false); + NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + + request.setAttribute(NoticeboardConstants.TOOL_SESSION_ID, toolSessionID); + request.setAttribute("anonymous", nbContent.isAllowAnonymous()); + return "monitorCommentsPage"; + } + +} Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,90 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbPedagogicalPlannerForm; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.validation.Errors; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * @author + * @version + * + * + * + * + * + */ +@Controller +@RequestMapping("/pedagogicalPlanner") +public class NbPedagogicalPlannerController { + + private static Logger logger = Logger.getLogger(NbPedagogicalPlannerController.class); + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + protected String unspecified(@ModelAttribute NbPedagogicalPlannerForm plannerForm, HttpServletRequest request) { + return initPedagogicalPlannerForm(plannerForm, request); + } + + public String initPedagogicalPlannerForm(@ModelAttribute NbPedagogicalPlannerForm plannerForm, + HttpServletRequest request) { + Long toolContentID = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID); + NoticeboardContent noticeboard = nbService.retrieveNoticeboard(toolContentID); + plannerForm.fillForm(noticeboard); + String contentFolderId = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); + plannerForm.setContentFolderID(contentFolderId); + return "authoring/pedagogicalPlannerForm"; + + } + + public String saveOrUpdatePedagogicalPlannerForm(@ModelAttribute NbPedagogicalPlannerForm plannerForm, + Errors errors, HttpServletRequest request) { + + plannerForm.validate(errors); + if (!errors.hasErrors()) { + String content = plannerForm.getBasicContent(); + Long toolContentID = plannerForm.getToolContentID(); + NoticeboardContent noticeboard = nbService.retrieveNoticeboard(toolContentID); + noticeboard.setContent(content); + nbService.saveNoticeboard(noticeboard); + } + + return "authoring/pedagogicalPlannerForm"; + } + +} \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/form/NbPedagogicalPlannerForm.java =================================================================== diff -u -r983160690fed1d94b51c2ea9206c58093a29040d -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/form/NbPedagogicalPlannerForm.java (.../NbPedagogicalPlannerForm.java) (revision 983160690fed1d94b51c2ea9206c58093a29040d) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/form/NbPedagogicalPlannerForm.java (.../NbPedagogicalPlannerForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -20,11 +20,12 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.noticeboard.web.form; import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivityForm; +import org.springframework.util.StringUtils; +import org.springframework.validation.Errors; /** * @@ -57,4 +58,21 @@ setToolContentID(noticeboard.getNbContentId()); } } + + public void validate(Errors errors) { + boolean valid = true; + boolean allEmpty = true; + if (basicContent != null && !basicContent.isEmpty()) { + if (!StringUtils.isEmpty(basicContent)) { + allEmpty = false; + } + } + if (allEmpty) { + errors.reject("authoring.msg.no.tasks.save"); + valid = false; + basicContent = null; + } + + setValid(valid); + } } \ No newline at end of file Index: lams_tool_nb/web/WEB-INF/spring-servlet.xml =================================================================== diff -u --- lams_tool_nb/web/WEB-INF/spring-servlet.xml (revision 0) +++ lams_tool_nb/web/WEB-INF/spring-servlet.xml (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -0,0 +1,17 @@ + + + + + + + + + + + \ No newline at end of file Index: lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u -r6dfff2871fa49eb6d8dcc49ede08552a8d73e8b3 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 6dfff2871fa49eb6d8dcc49ede08552a8d73e8b3) +++ lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -123,11 +123,11 @@ } \ No newline at end of file Index: lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag =================================================================== diff -u -r5bdde98b1e94d44d239a50549987293714a5bef1 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision 5bdde98b1e94d44d239a50549987293714a5bef1) +++ lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -284,42 +284,42 @@ - - + + - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + - - + + - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + Index: lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag =================================================================== diff -u -r500ae45f4243aa718eac7436bc903b4f137a3aa7 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 500ae45f4243aa718eac7436bc903b4f137a3aa7) +++ lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -42,23 +42,21 @@
    -     -   +     +  
    Index: lams_tool_nb/web/WEB-INF/tags/TextSearch.tag =================================================================== diff -u -rd56929f06ad90a63082d514e6521adc175f3de27 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision d56929f06ad90a63082d514e6521adc175f3de27) +++ lams_tool_nb/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -88,39 +88,39 @@ - +

    - +
    - +
    - +
    - +
    Index: lams_tool_nb/web/WEB-INF/web.xml =================================================================== diff -u -r26513e4a3a00a82cf700663c7cfe79d39c47732a -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/WEB-INF/web.xml (.../web.xml) (revision 26513e4a3a00a82cf700663c7cfe79d39c47732a) +++ lams_tool_nb/web/WEB-INF/web.xml (.../web.xml) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -90,6 +90,29 @@ 1 + + + spring + + org.springframework.web.servlet.DispatcherServlet + + 1 + + + + Connector + net.fckeditor.connector.ConnectorServlet + + baseDir + /UserFiles/ + + + debug + false + + 1 + + download @@ -102,11 +125,16 @@ - action + spring *.do + Connector + /ckeditor/filemanager/browser/default/connectors/jsp/connector + + + download /download/* Index: lams_tool_nb/web/authoring/advance.jsp =================================================================== diff -u -r6b4aed17af30b7410d1b0938a69b95b05ef2495d -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/authoring/advance.jsp (.../advance.jsp) (revision 6b4aed17af30b7410d1b0938a69b95b05ef2495d) +++ lams_tool_nb/web/authoring/advance.jsp (.../advance.jsp) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -8,13 +8,13 @@
    - + - - - + + + - + @@ -35,10 +35,10 @@ - +
    - + Index: lams_tool_nb/web/template/learnerTemplate.jsp =================================================================== diff -u -r8b5940710ceac2c67320a1954dea1c58120c78b1 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_nb/web/template/learnerTemplate.jsp (.../learnerTemplate.jsp) (revision 8b5940710ceac2c67320a1954dea1c58120c78b1) +++ lams_tool_nb/web/template/learnerTemplate.jsp (.../learnerTemplate.jsp) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -14,6 +14,87 @@ - + <%@ page import="org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants"%> +<%@ include file="/includes/taglibs.jsp"%> + + + + + +
    + +
    + + + + + + +
    + +
    + +
    + + + + + + + + +
    +
    + + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java =================================================================== diff -u -r2abc3485dc2d24ea02044a64271f3ee0d3b8c11b -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision 2abc3485dc2d24ea02044a64271f3ee0d3b8c11b) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/ITaskListService.java (.../ITaskListService.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -27,7 +27,6 @@ import java.util.List; import java.util.Set; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.tool.taskList.dto.ReflectDTO; import org.lamsfoundation.lams.tool.taskList.dto.SessionDTO; @@ -38,6 +37,7 @@ import org.lamsfoundation.lams.tool.taskList.model.TaskListSession; import org.lamsfoundation.lams.tool.taskList.model.TaskListUser; import org.lamsfoundation.lams.util.MessageService; +import org.springframework.web.multipart.MultipartFile; /** * Interface that defines the contract that all TaskLisk service providers must follow. @@ -103,7 +103,7 @@ * @return * @throws UploadTaskListFileException */ - TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, TaskListUser user) + TaskListItemAttachment uploadTaskListItemFile(MultipartFile uploadFile, TaskListUser user) throws UploadTaskListFileException; /** Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java =================================================================== diff -u -r64ee69765400783a3e284e7856aa91cdd01f4831 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision 64ee69765400783a3e284e7856aa91cdd01f4831) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/service/TaskListServiceImpl.java (.../TaskListServiceImpl.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -37,7 +37,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.confidencelevel.ConfidenceLevelDTO; import org.lamsfoundation.lams.contentrepository.NodeKey; import org.lamsfoundation.lams.contentrepository.exception.InvalidParameterException; @@ -83,6 +82,7 @@ import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.util.MessageService; +import org.springframework.web.multipart.MultipartFile; /** * Class implements org.lamsfoundation.lams.tool.taskList.service.ITaskListService. @@ -142,9 +142,9 @@ } @Override - public TaskListItemAttachment uploadTaskListItemFile(FormFile uploadFile, TaskListUser user) + public TaskListItemAttachment uploadTaskListItemFile(MultipartFile uploadFile, TaskListUser user) throws UploadTaskListFileException { - if ((uploadFile == null) || StringUtils.isEmpty(uploadFile.getFileName())) { + if ((uploadFile == null) || StringUtils.isEmpty(uploadFile.getName())) { throw new UploadTaskListFileException( messageService.getMessage("error.msg.upload.file.not.found", new Object[] { uploadFile })); } @@ -156,7 +156,7 @@ TaskListItemAttachment file = new TaskListItemAttachment(); file.setFileUuid(nodeKey.getUuid()); file.setFileVersionId(nodeKey.getVersion()); - file.setFileName(uploadFile.getFileName()); + file.setFileName(uploadFile.getName()); file.setCreated(new Timestamp(new Date().getTime())); file.setCreateBy(user); @@ -967,10 +967,10 @@ * @throws RepositoryCheckedException * @throws InvalidParameterException */ - private NodeKey processFile(FormFile file) throws UploadTaskListFileException { + private NodeKey processFile(MultipartFile file) throws UploadTaskListFileException { NodeKey node = null; - if ((file != null) && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); + if ((file != null) && !StringUtils.isEmpty(file.getName())) { + String fileName = file.getName(); try { node = taskListToolContentHandler.uploadFile(file.getInputStream(), fileName, file.getContentType()); } catch (InvalidParameterException e) { @@ -1008,4 +1008,6 @@ else return new ToolCompletionStatus(ToolCompletionStatus.ACTIVITY_ATTEMPTED,(Date) dates[0], null); } + + } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/controller/LearningController.java =================================================================== diff -u -r74467b8916b85a9d0376e4c2d8f7deaf4511450c -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/controller/LearningController.java (.../LearningController.java) (revision 74467b8916b85a9d0376e4c2d8f7deaf4511450c) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/controller/LearningController.java (.../LearningController.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -61,7 +61,7 @@ import org.lamsfoundation.lams.tool.taskList.web.form.TaskListItemForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; -import org.lamsfoundation.lams.util.FileValidatorUtil; +import org.lamsfoundation.lams.util.FileValidatorSpringUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -73,7 +73,9 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.multipart.MultipartFile; /** * @@ -537,7 +539,7 @@ * @throws UploadTaskListFileException */ @RequestMapping("/uploadFile") - public String uploadFile(@ModelAttribute TaskListItemForm taskListItemForm, Errors errors, + public String uploadFile(@ModelAttribute TaskListItemForm taskListItemForm, @RequestParam("file") MultipartFile file, Errors errors, HttpServletRequest request) throws UploadTaskListFileException { String mode = request.getParameter(AttributeNames.ATTR_MODE); @@ -546,14 +548,12 @@ request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); Long sessionId = (Long) sessionMap.get(TaskListConstants.ATTR_TOOL_SESSION_ID); - FormFile file = taskListItemForm.getUploadedFile(); - - if (file == null || StringUtils.isBlank(file.getFileName())) { + if (file == null || StringUtils.isBlank(file.getName())) { return "pages/learning/learning"; } // validate file size - FileValidatorUtil.validateFileSize(file, false, errors); + FileValidatorSpringUtil.validateFileSize(file, false, errors); if (errors.hasErrors()) { return "pages/learning/learning"; } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/ReflectionForm.java =================================================================== diff -u -rcad516bd852b193b61c821c5177cecacf3e5d016 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/ReflectionForm.java (.../ReflectionForm.java) (revision cad516bd852b193b61c821c5177cecacf3e5d016) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/ReflectionForm.java (.../ReflectionForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -25,7 +25,6 @@ package org.lamsfoundation.lams.tool.taskList.web.form; import org.apache.log4j.Logger; -import org.apache.struts.validator.ValidatorForm; /** * Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListConditionForm.java =================================================================== diff -u -rcad516bd852b193b61c821c5177cecacf3e5d016 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListConditionForm.java (.../TaskListConditionForm.java) (revision cad516bd852b193b61c821c5177cecacf3e5d016) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListConditionForm.java (.../TaskListConditionForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -26,7 +26,6 @@ import java.util.Map; -import org.apache.struts.util.LabelValueBean; import org.lamsfoundation.lams.web.TextSearchForm; /** Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java =================================================================== diff -u -rcad516bd852b193b61c821c5177cecacf3e5d016 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java (.../TaskListForm.java) (revision cad516bd852b193b61c821c5177cecacf3e5d016) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListForm.java (.../TaskListForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -27,10 +27,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.tool.taskList.model.TaskList; +import org.springframework.web.multipart.MultipartFile; /** * @@ -48,8 +46,8 @@ private String sessionMapID; private String contentFolderID; private int currentTab; - private FormFile offlineFile; - private FormFile onlineFile; + private MultipartFile offlineFile; + private MultipartFile onlineFile; private TaskList taskList; @@ -76,19 +74,19 @@ this.currentTab = currentTab; } - public FormFile getOfflineFile() { + public MultipartFile getOfflineFile() { return offlineFile; } - public void setOfflineFile(FormFile offlineFile) { + public void setOfflineFile(MultipartFile offlineFile) { this.offlineFile = offlineFile; } - public FormFile getOnlineFile() { + public MultipartFile getOnlineFile() { return onlineFile; } - public void setOnlineFile(FormFile onlineFile) { + public void setOnlineFile(MultipartFile onlineFile) { this.onlineFile = onlineFile; } Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java =================================================================== diff -u -rcad516bd852b193b61c821c5177cecacf3e5d016 -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision cad516bd852b193b61c821c5177cecacf3e5d016) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListItemForm.java (.../TaskListItemForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -23,8 +23,7 @@ package org.lamsfoundation.lams.tool.taskList.web.form; -import org.apache.struts.action.ActionForm; -import org.apache.struts.upload.FormFile; +import org.springframework.web.multipart.MultipartFile; /** * Form responsible for representing TaskListItem objects on a view layer. @@ -58,12 +57,12 @@ private String parentTaskName; - private FormFile uploadedFile; + private MultipartFile uploadedFile; private String comment; /** * Returns TaskListItem title. - * + * * @return TaskListItem title */ public String getTitle() { @@ -72,7 +71,7 @@ /** * Sets TaskListItem title. - * + * * @param title * TaskListItem title */ @@ -82,7 +81,7 @@ /** * Returns TaskListItem description. - * + * * @return TaskListItem description */ public String getDescription() { @@ -91,7 +90,7 @@ /** * Sets TaskListItem description. - * + * * @param description * TaskListItem description */ @@ -101,7 +100,7 @@ /** * Returns TaskListItem order index. - * + * * @return TaskListItem order index */ public String getItemIndex() { @@ -110,7 +109,7 @@ /** * Sets TaskListItem order index. - * + * * @param itemIndex * TaskListItem order index */ @@ -120,7 +119,7 @@ /** * Returns current SessionMapID. - * + * * @return current SessionMapID */ public String getSessionMapID() { @@ -129,7 +128,7 @@ /** * Sets current SessionMapID. - * + * * @param sessionMapID * current SessionMapID */ @@ -139,7 +138,7 @@ /** * Returns working mode. - * + * * @return working mode */ public String getMode() { @@ -148,7 +147,7 @@ /** * Returns working mode. - * + * * @param mode * working mode */ @@ -158,7 +157,7 @@ /** * Returns whether this TaskLiskItem is required to finish activity. - * + * * @return true if the TaskLiskItem is required to finish activity, false otherwise. */ public boolean isRequired() { @@ -167,7 +166,7 @@ /** * Sets whether this TaskLiskItem is required to finish activity. - * + * * @param isRequired * true if the TaskLiskItem is required to finish activity, false otherwise. */ @@ -177,7 +176,7 @@ /** * Returns whether comments are allowed in this TaskLiskItem. - * + * * @return true if comments are allowed in this TaskLiskItem, false otherwise. */ public boolean isCommentsAllowed() { @@ -186,7 +185,7 @@ /** * Sets whether comments are allowed in this TaskLiskItem. - * + * * @param isCommentsAllowed * true if comments are allowed in this TaskLiskItem, false otherwise. */ @@ -196,7 +195,7 @@ /** * Returns whether comments are required to complete this TaskLiskItem. - * + * * @return true if comments are required to complete this TaskLiskItem, false otherwise. */ public boolean isCommentsRequired() { @@ -205,7 +204,7 @@ /** * Sets whether comments are required to complete this TaskLiskItem. - * + * * @param isCommentsAllowed * true if comments are required to complete this TaskLiskItem, false otherwise. */ @@ -215,7 +214,7 @@ /** * Returns whether files are allowed in this TaskLiskItem. - * + * * @return true if files are allowed in this TaskLiskItem, false otherwise. */ public boolean isFilesAllowed() { @@ -224,7 +223,7 @@ /** * Sets whether files are allowed in this TaskLiskItem. - * + * * @param isCommentsAllowed * true if files are allowed in this TaskLiskItem, false otherwise. */ @@ -234,7 +233,7 @@ /** * Returns whether files are required to complete this TaskLiskItem. - * + * * @return true if files are required to complete this TaskLiskItem, false otherwise. */ public boolean isFilesRequired() { @@ -243,7 +242,7 @@ /** * Sets whether files are required to complete this TaskLiskItem. - * + * * @param isCommentsAllowed * true if files are required to complete this TaskLiskItem, false otherwise. */ @@ -255,7 +254,7 @@ // for the final decision -- if this options will be needed later. /** * Returns whether comments are allowed in this TaskLiskItem. - * + * * @return true if comments are allowed in this TaskLiskItem, false otherwise. */ public boolean isCommentsFilesAllowed() { @@ -264,7 +263,7 @@ /** * Sets whether comments are allowed in this TaskLiskItem. - * + * * @param isCommentsAllowed * true if comments are allowed in this TaskLiskItem, false otherwise. */ @@ -274,7 +273,7 @@ /** * Returns whether comments are allowed to be shown to everybody for this TaskLiskItem. - * + * * @return true if comments are allowed to be shown to everybody for this TaskLiskItem, false * otherwise. */ @@ -284,7 +283,7 @@ /** * Sets whether comments are allowed to be shown to everybody for this TaskLiskItem or not. - * + * * @param showCommentsToAll * true if comments are allowed to be shown to everybody for this TaskLiskItem, false * otherwise. @@ -295,7 +294,7 @@ /** * Returns whether this TaskLiskItem is a child task. - * + * * @return true if this TaskLiskItem is a child task, false otherwise. */ public boolean isChildTask() { @@ -304,7 +303,7 @@ /** * Sets whether this TaskLiskItem is a child task or not. - * + * * @param isChildTask * true if this TaskLiskItem is a child task, false otherwise. */ @@ -314,7 +313,7 @@ /** * If the TaskLiskItem is a child task then it has a parent. So this method returns its title. - * + * * @return parent's title */ public String getParentTaskName() { @@ -323,7 +322,7 @@ /** * If the TaskLiskItem is a child task then it has a parent. So this method sets its title. - * + * * @param parentTaskName * parent's title */ @@ -333,26 +332,26 @@ /** * Returns attachment for this TaskLiskItem. - * + * * @return attachment for this TaskLiskItem */ - public FormFile getUploadedFile() { + public MultipartFile getUploadedFile() { return uploadedFile; } /** * Sets attachment for this TaskLiskItem. - * + * * @param uploadedFile * attachment for this TaskLiskItem */ - public void setUploadedFile(FormFile uploadedFile) { + public void setUploadedFile(MultipartFile uploadedFile) { this.uploadedFile = uploadedFile; } /** * Returns comment for this TaskLiskItem. - * + * * @return comment for this TaskLiskItem */ public String getComment() { @@ -361,7 +360,7 @@ /** * Sets comment for this TaskLiskItem. - * + * * @param comment * comment for this TaskLiskItem */ Index: lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListPedagogicalPlannerForm.java =================================================================== diff -u -rb9f506afc78a6f28e20a87ef15915076fd9d839f -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListPedagogicalPlannerForm.java (.../TaskListPedagogicalPlannerForm.java) (revision b9f506afc78a6f28e20a87ef15915076fd9d839f) +++ lams_tool_task/src/java/org/lamsfoundation/lams/tool/taskList/web/form/TaskListPedagogicalPlannerForm.java (.../TaskListPedagogicalPlannerForm.java) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -30,12 +30,13 @@ import org.lamsfoundation.lams.tool.taskList.model.TaskList; import org.lamsfoundation.lams.tool.taskList.model.TaskListItem; import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivityForm; +import org.lamsfoundation.lams.web.planner.PedagogicalPlannerActivitySpringForm; import org.springframework.validation.Errors; /** * */ -public class TaskListPedagogicalPlannerForm extends PedagogicalPlannerActivityForm { +public class TaskListPedagogicalPlannerForm extends PedagogicalPlannerActivitySpringForm { private List taskListItem; public void validate(Errors errors) { Index: lams_tool_task/web/common/messages.jsp =================================================================== diff -u -r74467b8916b85a9d0376e4c2d8f7deaf4511450c -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/web/common/messages.jsp (.../messages.jsp) (revision 74467b8916b85a9d0376e4c2d8f7deaf4511450c) +++ lams_tool_task/web/common/messages.jsp (.../messages.jsp) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -1,12 +1,17 @@ -<%-- Error Messages --%> - + + + + + + + + <%-- Success Messages - - -
    -
    +
    ---%> \ No newline at end of file +--%> + Index: lams_tool_task/web/common/taglibs.jsp =================================================================== diff -u -rb9f506afc78a6f28e20a87ef15915076fd9d839f -ra2d72bee6029b7e05e8cd696c02db214f3049365 --- lams_tool_task/web/common/taglibs.jsp (.../taglibs.jsp) (revision b9f506afc78a6f28e20a87ef15915076fd9d839f) +++ lams_tool_task/web/common/taglibs.jsp (.../taglibs.jsp) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) @@ -1,7 +1,5 @@ <%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> -<%@ taglib uri="tags-bean" prefix="bean" %> -<%@ taglib uri="tags-html" prefix="html" %> -<%@ taglib uri="tags-logic" prefix="logic" %> + <%@ taglib uri="tags-function" prefix="fn" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %>