Index: lams_tool_daco/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/conf/language/lams/ApplicationResources.properties,v diff -u -r1.24.2.6 -r1.24.2.7 --- lams_tool_daco/conf/language/lams/ApplicationResources.properties 4 Dec 2016 01:00:02 -0000 1.24.2.6 +++ lams_tool_daco/conf/language/lams/ApplicationResources.properties 28 Feb 2017 11:20:15 -0000 1.24.2.7 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag,v diff -u -r1.12.2.3 -r1.12.2.4 --- lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag 13 Dec 2016 04:19:05 -0000 1.12.2.3 +++ lams_tool_daco/web/WEB-INF/tags/AuthoringButton.tag 28 Feb 2017 11:21:28 -0000 1.12.2.4 @@ -123,10 +123,10 @@ }
- + - +
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_tool_daco/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_daco/web/WEB-INF/tags/WaitingSpinner.tag'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld,v diff -u -r1.6.2.10 -r1.6.2.11 --- lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld 25 Nov 2016 17:08:57 -0000 1.6.2.10 +++ lams_tool_daco/web/WEB-INF/tlds/lams/lams.tld 28 Feb 2017 11:21:28 -0000 1.6.2.11 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/includes/css/daco.css,v diff -u -r1.9.2.2 -r1.9.2.3 --- lams_tool_daco/web/includes/css/daco.css 27 Apr 2016 13:07:07 -0000 1.9.2.2 +++ lams_tool_daco/web/includes/css/daco.css 28 Feb 2017 11:21:28 -0000 1.9.2.3 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/includes/javascript/dacoLearning.js,v diff -u -r1.5.12.4 -r1.5.12.5 --- lams_tool_daco/web/includes/javascript/dacoLearning.js 15 Feb 2017 05:29:07 -0000 1.5.12.4 +++ lams_tool_daco/web/includes/javascript/dacoLearning.js 28 Feb 2017 11:21:28 -0000 1.5.12.5 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/pages/learning/addRecord.jsp,v diff -u -r1.9.2.4 -r1.9.2.5 --- lams_tool_daco/web/pages/learning/addRecord.jsp 15 Feb 2017 05:29:07 -0000 1.9.2.4 +++ lams_tool_daco/web/pages/learning/addRecord.jsp 28 Feb 2017 11:21:28 -0000 1.9.2.5 @@ -159,15 +159,19 @@ - + - <%-- Image --%> + <%-- Image --%>
- +
<%-- Radio buttons --%> @@ -246,7 +250,7 @@ - + Index: lams_tool_daco/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_daco/web/pages/learning/learning.jsp,v diff -u -r1.12.2.10 -r1.12.2.11 --- lams_tool_daco/web/pages/learning/learning.jsp 15 Feb 2017 05:29:07 -0000 1.12.2.10 +++ lams_tool_daco/web/pages/learning/learning.jsp 28 Feb 2017 11:21:28 -0000 1.12.2.11 @@ -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 = ''; +