Index: lams_tool_images/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/lams/ApplicationResources.properties,v diff -u -r1.23.2.11 -r1.23.2.12 --- lams_tool_images/conf/language/lams/ApplicationResources.properties 4 Dec 2016 01:56:16 -0000 1.23.2.11 +++ lams_tool_images/conf/language/lams/ApplicationResources.properties 28 Feb 2017 12:33:43 -0000 1.23.2.12 @@ -166,7 +166,8 @@ label.posted.by ={0} on {1} label.image.options =Image options label.activity.completion =End of activity -errors.maxfilesize =Image exceeds maximum file size +errors.maxfilesize =Image exceeds maximum file size {0} +label.upload.info =Uploaded file must not exceed size of {0} label.rating.criterias =Rating criterias label.add.criteria =Add criteria label.number.of.votes ={0} / {1} votes Index: lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties,v diff -u -r1.32.2.9 -r1.32.2.10 --- lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties 4 Dec 2016 01:56:16 -0000 1.32.2.9 +++ lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties 28 Feb 2017 12:33:43 -0000 1.32.2.10 @@ -166,7 +166,8 @@ label.posted.by ={0} on {1} label.image.options =Image options label.activity.completion =End of activity -errors.maxfilesize =Image exceeds maximum file size +errors.maxfilesize =Image exceeds maximum file size {0} +label.upload.info =Uploaded file must not exceed size of {0} label.rating.criterias =Rating criterias label.add.criteria =Add criteria label.number.of.votes ={0} / {1} votes Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java,v diff -u -r1.27.2.9 -r1.27.2.10 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 17 Nov 2016 16:36:08 -0000 1.27.2.9 +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 28 Feb 2017 12:33:43 -0000 1.27.2.10 @@ -761,7 +761,7 @@ ActionErrors errors = new ActionErrors(); // validate file size - FileValidatorUtil.validateFileSize(itemForm.getFile(), true, errors); + FileValidatorUtil.validateFileSize(itemForm.getFile(), false, errors); // for edit validate: file already exist if (itemForm.getFile() == null || StringUtils.isEmpty(itemForm.getFile().getFileName())) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(ImageGalleryConstants.ERROR_MSG_FILE_BLANK)); @@ -792,7 +792,7 @@ // validate files size for (FormFile file : fileList) { - FileValidatorUtil.validateFileSize(file, true, errors); + FileValidatorUtil.validateFileSize(file, false, errors); // check for allowed format : gif, png, jpg String contentType = file.getContentType(); Index: lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag,v diff -u -r1.11.2.2 -r1.11.2.3 --- lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag 13 Dec 2016 04:22:15 -0000 1.11.2.2 +++ lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag 28 Feb 2017 12:33:43 -0000 1.11.2.3 @@ -123,7 +123,7 @@ }
- + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_images/web/WEB-INF/tags/FileUpload.tag'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_images/web/WEB-INF/tags/WaitingSpinner.tag'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_images/web/WEB-INF/tlds/lams/lams.tld =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/WEB-INF/tlds/lams/lams.tld,v diff -u -r1.6.2.8 -r1.6.2.9 --- lams_tool_images/web/WEB-INF/tlds/lams/lams.tld 25 Nov 2016 17:09:27 -0000 1.6.2.8 +++ lams_tool_images/web/WEB-INF/tlds/lams/lams.tld 28 Feb 2017 12:33:43 -0000 1.6.2.9 @@ -529,5 +529,13 @@ CommentsAuthor /WEB-INF/tags/CommentsAuthor.tag + + FileUpload + /WEB-INF/tags/FileUpload.tag + + + WaitingSpinner + /WEB-INF/tags/WaitingSpinner.tag + Index: lams_tool_images/web/includes/javascript/imageGalleryitem.js =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/includes/javascript/imageGalleryitem.js,v diff -u -r1.4.2.6 -r1.4.2.7 --- lams_tool_images/web/includes/javascript/imageGalleryitem.js 17 Nov 2016 16:36:08 -0000 1.4.2.6 +++ lams_tool_images/web/includes/javascript/imageGalleryitem.js 28 Feb 2017 12:33:43 -0000 1.4.2.7 @@ -50,16 +50,10 @@ } var file = files[0]; - // Check the file type. - if (file.name.length < 1) { - alert("file.name.length < 1"); + // Check the file type and file size + if ( ! validateShowErrorImageType(file, LABEL_NOT_ALLOWED_FORMAT ) || + ! validateShowErrorFileSize(file, UPLOAD_FILE_LARGE_MAX_SIZE, LABEL_MAX_FILE_SIZE) ) { return; - } else if (file.type != 'image/png' && file.type != 'image/jpg' && file.type != 'image/gif' && file.type != 'image/jpeg' ) { - alert(LABEL_NOT_ALLOWED_FORMAT); - return; - } else if (file.size > UPLOAD_FILE_LARGE_MAX_SIZE) { - alert(LABEL_MAX_FILE_SIZE); - return; } // Add the file to the request. @@ -92,29 +86,35 @@ // Get selected files from the inputs var validateFiles = []; + var errorDivs = []; if ($('#file1').val()) { var file = document.getElementById('file1').files[0]; validateFiles.push(file); + errorDivs.push('fileerror1'); formData.append('file1', file, file.name); } if ($('#file2').val()) { var file = document.getElementById('file2').files[0]; validateFiles.push(file); + errorDivs.push('fileerror2'); formData.append('file2', file, file.name); } if ($('#file3').val()) { var file = document.getElementById('file3').files[0]; validateFiles.push(file); + errorDivs.push('fileerror3'); formData.append('file3', file, file.name); } if ($('#file4').val()) { var file = document.getElementById('file4').files[0]; validateFiles.push(file); + errorDivs.push('fileerror4'); formData.append('file4', file, file.name); } if ($('#file5').val()) { var file = document.getElementById('file5').files[0]; validateFiles.push(file); + errorDivs.push('fileerror5'); formData.append('file5', file, file.name); } @@ -123,23 +123,19 @@ alert(LABEL_ITEM_BLANK); return; } + var valid = true; for (var i = 0; i < validateFiles.length; i++) { - var file = validateFiles[i]; - - // Check the file type. - if(file.name.length < 1) { - alert("file.name.length < 1"); - return; - } else if (file.size > UPLOAD_FILE_LARGE_MAX_SIZE) { - alert(LABEL_MAX_FILE_SIZE); - return; - } else if (file.type != 'image/png' && file.type != 'image/jpg' && file.type != 'image/gif' && file.type != 'image/jpeg' ) { - alert(LABEL_NOT_ALLOWED_FORMAT); - return; - } - - // Add the file to the request. + // Check the file type and file size + var file = validateFiles[i]; + var errorDivId = errorDivs[i]; + if ( ! validateShowErrorImageType(file, LABEL_NOT_ALLOWED_FORMAT, false, errorDivId ) || + ! validateShowErrorFileSize(file, UPLOAD_FILE_LARGE_MAX_SIZE, LABEL_MAX_FILE_SIZE, false, errorDivId) ) { + valid=false; + } } + if ( ! valid ) { + return; + } $('#uploadButtons').hide(); $('#itemAttachmentArea_Busy').show(); Index: lams_tool_images/web/pages/authoring/authoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/authoring/authoring.jsp,v diff -u -r1.6.2.5 -r1.6.2.6 --- lams_tool_images/web/pages/authoring/authoring.jsp 12 May 2016 09:54:34 -0000 1.6.2.5 +++ lams_tool_images/web/pages/authoring/authoring.jsp 28 Feb 2017 12:33:43 -0000 1.6.2.6 @@ -3,15 +3,17 @@ <%@ page import="org.lamsfoundation.lams.tool.imageGallery.ImageGalleryConstants"%> <%@ page import="org.lamsfoundation.lams.util.Configuration" %> <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> +<%@ page import="org.lamsfoundation.lams.util.FileValidatorUtil" %> <%=Configuration.get(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE)%> <fmt:message key="label.author.title" /> <%@ include file="/common/tabbedheader.jsp"%> + - + - -
- - - - - -
- - - -
- - - - - -
- - -
- - - - - -
- - - -
- - - - - -
- - + + +
+ + +
+ + +
+ + +
+
Index: lams_tool_images/web/pages/authoring/parts/imagefile.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/authoring/parts/imagefile.jsp,v diff -u -r1.1.10.4 -r1.1.10.5 --- lams_tool_images/web/pages/authoring/parts/imagefile.jsp 17 Nov 2016 16:36:08 -0000 1.1.10.4 +++ lams_tool_images/web/pages/authoring/parts/imagefile.jsp 28 Feb 2017 12:33:43 -0000 1.1.10.5 @@ -1,4 +1,9 @@ <%@ include file="/common/taglibs.jsp"%> +<%@ page import="org.lamsfoundation.lams.util.Configuration" %> +<%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> +<%@ page import="org.lamsfoundation.lams.util.FileValidatorUtil" %> +<%=FileValidatorUtil.formatSize(Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_LARGE_MAX_SIZE))%> + @@ -32,28 +37,6 @@ -
- - - - - -
- - - +
Index: lams_tool_images/web/pages/learning/parts/addimage.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/learning/parts/addimage.jsp,v diff -u -r1.3.2.6 -r1.3.2.7 --- lams_tool_images/web/pages/learning/parts/addimage.jsp 17 Nov 2016 16:36:08 -0000 1.3.2.6 +++ lams_tool_images/web/pages/learning/parts/addimage.jsp 28 Feb 2017 12:33:43 -0000 1.3.2.7 @@ -1,7 +1,10 @@ <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.util.Configuration" %> <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> +<%@ page import="org.lamsfoundation.lams.util.FileValidatorUtil" %> <%=Configuration.get(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE)%> +<%=FileValidatorUtil.formatSize(Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE))%> + @@ -10,8 +13,11 @@ <%@ include file="/common/header.jsp"%> - + + @@ -117,28 +118,7 @@ -
- - - - - -
- - + Index: lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp,v diff -u -r1.1.10.6 -r1.1.10.7 --- lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp 17 Nov 2016 16:36:08 -0000 1.1.10.6 +++ lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp 28 Feb 2017 12:33:43 -0000 1.1.10.7 @@ -1,50 +1,61 @@ <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.util.Configuration" %> <%@ page import="org.lamsfoundation.lams.util.ConfigurationKeys" %> +<%@ page import="org.lamsfoundation.lams.util.FileValidatorUtil" %> <%=Configuration.get(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE)%> +<%=FileValidatorUtil.formatSize(Configuration.getAsInt(ConfigurationKeys.UPLOAD_FILE_MAX_SIZE))%> <fmt:message key="label.learning.title" /> <%@ include file="/common/header.jsp"%> + + - -
- - - - - -
- - - -
- - - - - -
- - - -
- - - - - -
- - - -
- - - - - -
- - + + +
+ + +
+ + +
+ + +
+ +