Index: lams_tool_forum/conf/language/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/conf/language/Attic/ApplicationResources.properties,v diff -u -r1.31 -r1.32 --- lams_tool_forum/conf/language/ApplicationResources.properties 20 Nov 2006 05:29:11 -0000 1.31 +++ lams_tool_forum/conf/language/ApplicationResources.properties 14 Dec 2006 04:31:09 -0000 1.32 @@ -170,4 +170,5 @@ #======= End labels: Exported 160 labels for en AU ===== -message.no.reflection.available = No notebook available \ No newline at end of file +message.no.reflection.available = No notebook available +errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes \ No newline at end of file Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java,v diff -u -r1.64 -r1.65 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 6 Nov 2006 01:36:16 -0000 1.64 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/actions/AuthoringAction.java 14 Dec 2006 04:31:09 -0000 1.65 @@ -25,6 +25,8 @@ package org.lamsfoundation.lams.tool.forum.web.actions; +import static org.lamsfoundation.lams.tool.forum.util.ForumConstants.OLD_FORUM_STYLE; + import java.io.IOException; import java.util.ArrayList; import java.util.Date; @@ -66,14 +68,13 @@ import org.lamsfoundation.lams.tool.forum.web.forms.ForumForm; import org.lamsfoundation.lams.tool.forum.web.forms.MessageForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -import org.lamsfoundation.lams.util.UploadFileUtil; +import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; import org.lamsfoundation.lams.web.util.SessionMap; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; -import static org.lamsfoundation.lams.tool.forum.util.ForumConstants.OLD_FORUM_STYLE; /** * @author Steve.Ni @@ -449,6 +450,12 @@ if(file == null || StringUtils.isBlank(file.getFileName())) return mapping.findForward("success"); + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors ); + if(!errors.isEmpty()){ + this.saveErrors(request, errors); + return mapping.findForward("success"); + } forumService = getForumManager(); //upload to repository @@ -938,16 +945,7 @@ errors.add(ActionMessages.GLOBAL_MESSAGE, error); } } - if (form.getOnlineFile() != null && !(form.getOnlineFile().getFileName().trim().equals("")) - && convertToMeg(form.getOnlineFile().getFileSize()) > UploadFileUtil.getMaxFileSize()) { - ae = new ActionMessage("error.inputFileTooLarge"); - errors.add(ActionMessages.GLOBAL_MESSAGE, ae); - } - if (form.getOfflineFile() != null && !(form.getOfflineFile().getFileName().trim().equals("")) - && convertToMeg(form.getOfflineFile().getFileSize()) > UploadFileUtil.getMaxFileSize()) { - ae = new ActionMessage("error.inputFileTooLarge"); - errors.add(ActionMessages.GLOBAL_MESSAGE, ae); - } + } catch (Exception e) { log.error(e.toString()); } Index: lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java,v diff -u -r1.12 -r1.13 --- lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java 29 Oct 2006 23:22:13 -0000 1.12 +++ lams_tool_forum/src/java/org/lamsfoundation/lams/tool/forum/web/forms/MessageForm.java 14 Dec 2006 04:31:09 -0000 1.13 @@ -34,6 +34,7 @@ import org.apache.struts.validator.ValidatorForm; import org.lamsfoundation.lams.tool.forum.persistence.Attachment; import org.lamsfoundation.lams.tool.forum.persistence.Message; +import org.lamsfoundation.lams.util.FileValidatorUtil; /** * @@ -79,6 +80,15 @@ ActionMessage error = new ActionMessage("error.body.required"); errors.add("message.body", error); } + + +// validate item size + boolean largeFile = true; + if(request.getRequestURI().indexOf("/learning/") != -1) + largeFile = false; + + FileValidatorUtil.validateFileSize(this.getAttachmentFile(), largeFile,"message.attachment", errors ); + } catch (Exception e) { logger.error("", e); } Index: lams_tool_forum/web/jsps/authoring/message/create.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/authoring/message/create.jsp,v diff -u -r1.34 -r1.35 --- lams_tool_forum/web/jsps/authoring/message/create.jsp 11 Dec 2006 04:55:28 -0000 1.34 +++ lams_tool_forum/web/jsps/authoring/message/create.jsp 14 Dec 2006 04:31:09 -0000 1.35 @@ -15,8 +15,7 @@ enctype="multipart/form-data" styleId="topicFormId"> + value="<%=request.getAttribute(org.apache.struts.taglib.html.Constants.BEAN_KEY)%>" /> @@ -35,7 +34,11 @@
- + + + +
@@ -45,7 +48,8 @@
- +
+
Index: lams_tool_forum/web/jsps/learning/message/topicform.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_forum/web/jsps/learning/message/topicform.jsp,v diff -u -r1.12 -r1.13 --- lams_tool_forum/web/jsps/learning/message/topicform.jsp 18 Oct 2006 19:08:59 -0000 1.12 +++ lams_tool_forum/web/jsps/learning/message/topicform.jsp 14 Dec 2006 04:31:09 -0000 1.13 @@ -19,7 +19,7 @@ - +
Index: lams_tool_nb/conf/language/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/conf/language/Attic/ApplicationResources.properties,v diff -u -r1.18 -r1.19 --- lams_tool_nb/conf/language/ApplicationResources.properties 20 Nov 2006 23:45:15 -0000 1.18 +++ lams_tool_nb/conf/language/ApplicationResources.properties 14 Dec 2006 04:31:30 -0000 1.19 @@ -64,3 +64,4 @@ label.edit = Edit message.no.reflection.available = No notebook available +errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java,v diff -u -r1.33 -r1.34 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java 10 Oct 2006 07:47:02 -0000 1.33 +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbAuthoringAction.java 14 Dec 2006 04:31:30 -0000 1.34 @@ -56,6 +56,7 @@ import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy; import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsLookupDispatchAction; import org.lamsfoundation.lams.web.session.SessionManager; @@ -350,7 +351,16 @@ //throws exception if the content id does not exist checkContentId(content_id); NoticeboardContent nbContent = nbService.retrieveNoticeboard(content_id); - + + //validate file max size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(nbForm.getOnlineFile(), true, errors ); + FileValidatorUtil.validateFileSize(nbForm.getOfflineFile(), true, errors ); + if(!errors.isEmpty()){ + this.saveErrors(request, errors); + return mapping.findForward(NoticeboardConstants.AUTHOR_PAGE); + } + //check if the file uploaded is an online instructions file or offline instructions file. //if one of the types is null, then the other one must have been uploaded. //here we check if the file is an online one Index: lams_tool_nb/web/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_nb/web/authoring/authoring.jsp,v diff -u -r1.18 -r1.19 --- lams_tool_nb/web/authoring/authoring.jsp 26 Oct 2006 02:37:00 -0000 1.18 +++ lams_tool_nb/web/authoring/authoring.jsp 14 Dec 2006 04:31:30 -0000 1.19 @@ -69,7 +69,7 @@ .getAttribute(org.apache.struts.taglib.html.Constants.BEAN_KEY)%>" /> - + <%-- in define later mode we edit only the basic content. But if we don't have the instructions tab, then the instructions are lost when saving. --%>

@@ -88,7 +88,14 @@
- <%@ include file="../errorbox.jsp"%> + +

+ +
+
+

+
+ Index: lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java,v diff -u -r1.12 -r1.13 --- lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java 1 Nov 2006 23:51:33 -0000 1.12 +++ lams_tool_notebook/src/java/org/lamsfoundation/lams/tool/notebook/web/actions/AuthoringAction.java 14 Dec 2006 04:31:49 -0000 1.13 @@ -39,6 +39,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.apache.struts.action.ActionMessages; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.authoring.web.AuthoringConstants; import org.lamsfoundation.lams.contentrepository.client.IToolContentHandler; @@ -49,6 +50,7 @@ import org.lamsfoundation.lams.tool.notebook.service.NotebookServiceProxy; import org.lamsfoundation.lams.tool.notebook.util.NotebookConstants; import org.lamsfoundation.lams.tool.notebook.web.forms.AuthoringForm; +import org.lamsfoundation.lams.util.FileValidatorUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -265,6 +267,16 @@ savedFiles = getAttList(KEY_ONLINE_FILES, map); } + + //validate file max size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors ); + if(!errors.isEmpty()){ + request.setAttribute(NotebookConstants.ATTR_SESSION_MAP, map); + this.saveErrors(request, errors); + return mapping.findForward("success"); + } + if (file.getFileName().length() != 0) { // upload file to repository Index: lams_tool_notebook/web/pages/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_notebook/web/pages/authoring/authoring.jsp,v diff -u -r1.6 -r1.7 --- lams_tool_notebook/web/pages/authoring/authoring.jsp 1 Nov 2006 23:07:51 -0000 1.6 +++ lams_tool_notebook/web/pages/authoring/authoring.jsp 14 Dec 2006 04:31:49 -0000 1.7 @@ -39,6 +39,13 @@ + +

+ +
+
+

+