Index: lams_tool_images/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rd2624c4473743b70bb5681fcb359a5008b609878 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2624c4473743b70bb5681fcb359a5008b609878) +++ lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rd2624c4473743b70bb5681fcb359a5008b609878 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d2624c4473743b70bb5681fcb359a5008b609878) +++ lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rf8b98e45847fcee40188af4c9db5d13e1bd61e25 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision f8b98e45847fcee40188af4c9db5d13e1bd61e25) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rb5ab72c783a98abeb08431bafb067ad4b9edf1df -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision b5ab72c783a98abeb08431bafb067ad4b9edf1df) +++ lams_tool_images/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -123,7 +123,7 @@ }
- + Index: lams_tool_images/web/WEB-INF/tags/FileUpload.tag =================================================================== diff -u --- lams_tool_images/web/WEB-INF/tags/FileUpload.tag (revision 0) +++ lams_tool_images/web/WEB-INF/tags/FileUpload.tag (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -0,0 +1,84 @@ +<%@ taglib uri="tags-core" prefix="c"%> +<%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="tags-function" prefix="fn" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> + +<%-- Usually fileFieldname and fileFieldId are the same, but DACO needs them to be different. + If they can be the same, set fileFieldname and fileFieldId will be set to the same. + If you need them different, then define both. + If you define neither, fileFieldname = fileFieldId = "fileSelector" --%> +<%@ attribute name="fileFieldname" required="false" rtexprvalue="true"%> +<%@ attribute name="fileFieldId" required="false" rtexprvalue="true"%> + +<%@ attribute name="fileInputNameFieldname" required="false" rtexprvalue="true"%> +<%@ attribute name="fileInputMessageKey" required="false" rtexprvalue="true"%> + +<%-- Set uploadInfoMessageKey to '-' to NOT show the "not exe and max file size" type message. Leave it blank for the default key label.upload.info --%> +<%@ attribute name="uploadInfoMessageKey" required="false" rtexprvalue="true"%> +<%@ attribute name="maxFileSize" required="true" rtexprvalue="true"%> +<%@ attribute name="tabindex" required="false" rtexprvalue="true"%> + +<%-- Only set if you have more than one file field on the screen (such as DACO) --%> +<%@ attribute name="errorMsgDiv" required="false" rtexprvalue="true"%> +<%@ attribute name="fileButtonBrowse" required="false" rtexprvalue="true"%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ <%-- font-size:inherit needed for Share Resources authoring or the button is too small --%> + + + + +
+ +

${maxFileSize}

+
+ + + + Index: lams_tool_images/web/WEB-INF/tags/WaitingSpinner.tag =================================================================== diff -u --- lams_tool_images/web/WEB-INF/tags/WaitingSpinner.tag (revision 0) +++ lams_tool_images/web/WEB-INF/tags/WaitingSpinner.tag (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -0,0 +1,17 @@ +<%@ taglib uri="tags-core" prefix="c"%> + +<%@ attribute name="id" required="false" rtexprvalue="true"%> +<%@ attribute name="showInline" required="false" rtexprvalue="true"%> + + + id="${id}" + + + + + + + + + + \ No newline at end of file Index: lams_tool_images/web/WEB-INF/tlds/lams/lams.tld =================================================================== diff -u -r1f99d03199a3995cfffe0cb1536c08f0220e88b0 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 1f99d03199a3995cfffe0cb1536c08f0220e88b0) +++ lams_tool_images/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rf8b98e45847fcee40188af4c9db5d13e1bd61e25 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/includes/javascript/imageGalleryitem.js (.../imageGalleryitem.js) (revision f8b98e45847fcee40188af4c9db5d13e1bd61e25) +++ lams_tool_images/web/includes/javascript/imageGalleryitem.js (.../imageGalleryitem.js) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -r60ab803bf843562083cfb66764ddfcb3b0a83841 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 60ab803bf843562083cfb66764ddfcb3b0a83841) +++ lams_tool_images/web/pages/authoring/authoring.jsp (.../authoring.jsp) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rf8b98e45847fcee40188af4c9db5d13e1bd61e25 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/pages/authoring/parts/imagefile.jsp (.../imagefile.jsp) (revision f8b98e45847fcee40188af4c9db5d13e1bd61e25) +++ lams_tool_images/web/pages/authoring/parts/imagefile.jsp (.../imagefile.jsp) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rf8b98e45847fcee40188af4c9db5d13e1bd61e25 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/pages/learning/parts/addimage.jsp (.../addimage.jsp) (revision f8b98e45847fcee40188af4c9db5d13e1bd61e25) +++ lams_tool_images/web/pages/learning/parts/addimage.jsp (.../addimage.jsp) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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 =================================================================== diff -u -rf8b98e45847fcee40188af4c9db5d13e1bd61e25 -r67dcb9996bea686f86b32184b900f6aa36fd11f0 --- lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp (.../addmultipleimages.jsp) (revision f8b98e45847fcee40188af4c9db5d13e1bd61e25) +++ lams_tool_images/web/pages/learning/parts/addmultipleimages.jsp (.../addmultipleimages.jsp) (revision 67dcb9996bea686f86b32184b900f6aa36fd11f0) @@ -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"%> + + - -
- - - - - -
- - - -
- - - - - -
- - - -
- - - - - -
- - - -
- - - - - -
- - + + +
+ + +
+ + +
+ + +
+ +