Index: lams_tool_larsrc/conf/language/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/conf/language/Attic/ApplicationResources.properties,v diff -u -r1.41 -r1.42 --- lams_tool_larsrc/conf/language/ApplicationResources.properties 24 Nov 2006 20:02:49 -0000 1.41 +++ lams_tool_larsrc/conf/language/ApplicationResources.properties 14 Dec 2006 03:42:17 -0000 1.42 @@ -162,3 +162,4 @@ #======= End labels: Exported 153 labels for en AU ===== +errors.maxfilesize =The uploaded file has exceeded the maximum file size limit of {0} bytes \ No newline at end of file Index: lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/AuthoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/AuthoringAction.java,v diff -u -r1.45 -r1.46 --- lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/AuthoringAction.java 6 Nov 2006 01:36:34 -0000 1.45 +++ lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/AuthoringAction.java 14 Dec 2006 03:42:17 -0000 1.46 @@ -72,6 +72,7 @@ import org.lamsfoundation.lams.tool.rsrc.web.form.ResourceForm; import org.lamsfoundation.lams.tool.rsrc.web.form.ResourceItemForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +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; @@ -667,6 +668,13 @@ if(file == null || StringUtils.isBlank(file.getFileName())) return mapping.findForward(ResourceConstants.SUCCESS); + //validate file size + ActionMessages errors = new ActionMessages(); + FileValidatorUtil.validateFileSize(file, true, errors ); + if(!errors.isEmpty()){ + this.saveErrors(request, errors); + return mapping.findForward(ResourceConstants.SUCCESS); + } IResourceService service = getResourceService(); //upload to repository @@ -1047,6 +1055,8 @@ if(itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_WEBSITE ||itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_LEARNING_OBJECT ||itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_FILE){ + //validate item size + FileValidatorUtil.validateFileSize(itemForm.getFile(), true, errors ); //for edit validate: file already exist if(!itemForm.isHasFile() && (itemForm.getFile() == null || StringUtils.isEmpty(itemForm.getFile().getFileName()))) @@ -1077,6 +1087,7 @@ // ActionMessage error = new ActionMessage("error.resource.item.title.blank"); // errors.add(ActionMessages.GLOBAL_MESSAGE, error); // } + //define it later mode(TEACHER) skip below validation. String modeStr = request.getParameter(AttributeNames.ATTR_MODE); if(StringUtils.equals(modeStr, ToolAccessMode.TEACHER.toString())){ Index: lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/LearningAction.java,v diff -u -r1.26 -r1.27 --- lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/LearningAction.java 24 Nov 2006 00:28:45 -0000 1.26 +++ lams_tool_larsrc/src/java/org/lamsfoundation/lams/tool/rsrc/web/action/LearningAction.java 14 Dec 2006 03:42:17 -0000 1.27 @@ -63,6 +63,7 @@ import org.lamsfoundation.lams.tool.rsrc.web.form.ReflectionForm; import org.lamsfoundation.lams.tool.rsrc.web.form.ResourceItemForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +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; @@ -584,6 +585,9 @@ if(itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_WEBSITE ||itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_LEARNING_OBJECT ||itemForm.getItemType() == ResourceConstants.RESOURCE_TYPE_FILE){ +// validate item size + FileValidatorUtil.validateFileSize(itemForm.getFile(), false, errors ); + //for edit validate: file already exist if(!itemForm.isHasFile() && (itemForm.getFile() == null || StringUtils.isEmpty(itemForm.getFile().getFileName())))