Index: lams_tool_daco/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r565d9271e54caf3d9a02cb621962c78db60f7e6d -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 565d9271e54caf3d9a02cb621962c78db60f7e6d) +++ lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -252,6 +252,9 @@ label.monitoring.average.number.records.heading =Average Number of Records label.activity.completion =End of activity label.notifications =Notifications +errors.maxfilesize =Uploaded file exceeded maximum size: {0} +error.attachment.executable =Uploaded file is executable +error.attachment.must.be.image =Allowed file formats: JPG, GIF or PNG. +label.upload.info =Uploaded file must not be executable and not exceed size of {0} - #======= End labels: Exported 246 labels for en AU ===== Index: lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u -rb5ab72c783a98abeb08431bafb067ad4b9edf1df -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision b5ab72c783a98abeb08431bafb067ad4b9edf1df) +++ lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -123,10 +123,10 @@ }
- + - +
Index: lams_tool_daco/web/WEB-INF/tags/FileUpload.tag =================================================================== diff -u --- lams_tool_daco/web/WEB-INF/tags/FileUpload.tag (revision 0) +++ lams_tool_daco/web/WEB-INF/tags/FileUpload.tag (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -0,0 +1,80 @@ +<%@ 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"%> +<%@ 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_daco/web/WEB-INF/tags/WaitingSpinner.tag =================================================================== diff -u --- lams_tool_daco/web/WEB-INF/tags/WaitingSpinner.tag (revision 0) +++ lams_tool_daco/web/WEB-INF/tags/WaitingSpinner.tag (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -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_daco/web/WEB-INF/tlds/lams/lams.tld =================================================================== diff -u -r1f99d03199a3995cfffe0cb1536c08f0220e88b0 -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision 1f99d03199a3995cfffe0cb1536c08f0220e88b0) +++ lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld (.../lams.tld) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -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_daco/web/includes/css/daco.css =================================================================== diff -u -rfd2dcf51ae6adf6aee088939b8c616b981e9a6d3 -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/includes/css/daco.css (.../daco.css) (revision fd2dcf51ae6adf6aee088939b8c616b981e9a6d3) +++ lams_tool_daco/web/includes/css/daco.css (.../daco.css) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -44,6 +44,10 @@ form#recordForm input, form#recordForm textarea, form#recordForm select{ margin-top: 6px; } +/* overrides form#recordForm input for file input */ +form#recordForm input.file-input-name{ + margin-top: 0px; +} div.bigNumber{ font-weight: bold; font-size: larger; Index: lams_tool_daco/web/includes/javascript/dacoLearning.js =================================================================== diff -u -rf0769c3a0dcf5d87ba30a8026c27271d88fdd7a6 -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/includes/javascript/dacoLearning.js (.../dacoLearning.js) (revision f0769c3a0dcf5d87ba30a8026c27271d88fdd7a6) +++ lams_tool_daco/web/includes/javascript/dacoLearning.js (.../dacoLearning.js) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -18,11 +18,52 @@ $('.btn-disable-on-submit').prop('disabled', true); document.location.href=continueReflectUrl; } + + function getFile(errorId) { + var arr = errorId.split('-'); + if ( arr.length > 1 ) { + var filenum = arr[1]; + var fileSelect = document.getElementById('file-'+filenum); + if ( fileSelect ) { + var files = fileSelect.files; + if (files.length > 0) { + return files[0]; + } + } + } + return null; + } function saveOrUpdateRecord() { - $('.btn-disable-on-submit').prop('disabled', true); - setHiddenFormValues(); - document.getElementById("recordForm").submit(); + var valid = true; + + $('[id^=fileerror-]').each(function(index, element) { + console.log(element); + var file = getFile(element.id); + if ( file ) { + if ( ! validateShowErrorNotExecutable(file, LABEL_NOT_ALLOWED_EXE, false, EXE_STRING, element.id ) || + ! validateShowErrorFileSize(file, UPLOAD_FILE_MAX_SIZE, LABEL_MAX_FILE_SIZE, false, element.id) ) { + valid = false; + } + } + }); + $('[id^=imageerror-]').each(function(index, element) { + console.log(element); + var file = getFile(element.id); + if ( file ) { + if ( ! validateShowErrorImageType(file, LABEL_NOT_ALLOWED_FORMAT, false, element.id ) || + ! validateShowErrorFileSize(file, UPLOAD_FILE_MAX_SIZE, LABEL_MAX_FILE_SIZE, false, element.id) ) { + valid = false; + } + } + }); + + if ( valid ) { + $('.btn-disable-on-submit').prop('disabled', true); + setHiddenFormValues(); + document.getElementById("recordForm").submit(); + } + return valid; } function setHiddenFormValues(){ Index: lams_tool_daco/web/pages/learning/addRecord.jsp =================================================================== diff -u -rf0769c3a0dcf5d87ba30a8026c27271d88fdd7a6 -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/pages/learning/addRecord.jsp (.../addRecord.jsp) (revision f0769c3a0dcf5d87ba30a8026c27271d88fdd7a6) +++ lams_tool_daco/web/pages/learning/addRecord.jsp (.../addRecord.jsp) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -159,15 +159,19 @@ - + - <%-- Image --%> + <%-- Image --%>
- +
<%-- Radio buttons --%> @@ -246,7 +250,7 @@ - + Index: lams_tool_daco/web/pages/learning/learning.jsp =================================================================== diff -u -rf0769c3a0dcf5d87ba30a8026c27271d88fdd7a6 -rb99c1a3c6fbea3d9a4190f69b95381f14561ffe1 --- lams_tool_daco/web/pages/learning/learning.jsp (.../learning.jsp) (revision f0769c3a0dcf5d87ba30a8026c27271d88fdd7a6) +++ lams_tool_daco/web/pages/learning/learning.jsp (.../learning.jsp) (revision b99c1a3c6fbea3d9a4190f69b95381f14561ffe1) @@ -1,12 +1,18 @@ - - <%@ include file="/common/taglibs.jsp"%> <%@ page import="org.lamsfoundation.lams.tool.daco.DacoConstants"%> +<%@ 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))%> +<%=Configuration.get(ConfigurationKeys.EXE_EXTENSIONS)%> + <fmt:message key="label.learning.title" /> <%@ include file="/common/header.jsp"%> + @@ -37,6 +43,18 @@ var finishUrl = ''; var continueReflectUrl = ''; var refreshQuestionSummariesUrl = ''; + var UPLOAD_FILE_MAX_SIZE = '${UPLOAD_FILE_MAX_SIZE}'; + var EXE_STRING = '${EXE_STRING}'; + + {0} + var LABEL_MAX_FILE_SIZE = ''; + + + var LABEL_NOT_ALLOWED_EXE = ''; + + + var LABEL_NOT_ALLOWED_FORMAT = ''; +