Index: lams_tool_daco/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -ra4e564624bbf22983634d0e77a2e467403d0d7e5 -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a4e564624bbf22983634d0e77a2e467403d0d7e5) +++ lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -16,7 +16,7 @@ errorPage.heading =Some error occurs when handling your request -label.author.title =Data Collection Authoring +label.author.title =Data Collection label.authoring.heading =Data Collection label.authoring.heading.instructions =Instructions label.authoring.heading.instructions.desc =Please input online and offline instructions @@ -124,6 +124,7 @@ label.learning.textfield.hint=Enter a single line of text label.learning.textarea.hint=Enter text label.learning.number.hint=Enter a number +label.learning.number.decimal=The number will be rounded to {0} decimal places. label.learning.date.hint=Enter a date label.learning.date.day=Day: label.learning.date.month=Month: @@ -135,10 +136,10 @@ label.learning.radio.hint=Choose an option label.learning.dropdown.hint=Choose an option label.learning.dropdown.select=SELECT -label.learning.dropdown.noneselected=No answer was selected. +label.learning.dropdown.noneselected=No answer was selected. label.learning.dropdown.selected=Selected answer: label.learning.checkbox.hint=Choose options -label.learning.longlat.hint=Enter two real numbers +label.learning.longlat.hint=Enter two decimal numbers label.learning.longlat.longitude=Longitude: label.learning.longlat.longitude.unit=�N label.learning.longlat.latitude=Latitude: @@ -236,28 +237,30 @@ error.question.file.blank =File can not be blank. error.question.max.blank=The maximum constraint must not be blank. error.question.max.number.int=The maximum constraint must be an integer number. -error.question.max.number.float=The maximum constraint must be a real number. +error.question.max.number.float=The maximum constraint must be a decimal number. error.question.max.negative=The maximum constraint must be a nonnegative number. error.question.max.toohigh=The maximum constraint must be less than {0}. error.question.max.toohigh.answeroption=The maximum constraint must be less or equal to the answer option count. error.question.max.toolow=The maximum constraint must be more than {0}. error.question.min.blank=The minimum constraint must not be blank. error.question.min.number.int=The minimum constraint must be an integer number. -error.question.min.number.float=The minimum constraint must be a real number. +error.question.min.number.float=The minimum constraint must be a decimal number. error.question.min.negative=The minimum constraint must be a nonnegative number. error.question.min.toohigh=The minimum constraint must be less than {0}. error.question.min.toohigh.answeroption=The minimum constraint must be less or equal to the answer option count. error.question.min.toolow=The minimum constraint must be more than {0}. error.question.min.toohigh.max=The minimum constraint must be less than the maximum constraint. error.question.answeroption.repeat=The answer options {0} and {1} are the same. error.question.answeroption.notenough =You should provide at least {0} answer options. +error.question.digitsdecimal.int=The number of digits after decimal point must be an integer number. +error.question.digitsdecimal.nonnegative=The number of digits after decimal point must be a nonnegative number. error.recordlimit.min.toohigh.max=The minimum number of records must be less or equal to the maximum. error.record.blank=An answer for question {0} is required. error.record.textarea.long=The maximum number of words in question {0} is {1}. -error.record.number.min=The number in question {0} should be no less than {1}. +error.record.number.min=The number in question {0} must be at least {1}. error.record.number.max=The number in question {0} should be no more than {1}. -error.record.number.float=The answer in question {0} must be a real number. +error.record.number.float=The answer in question {0} must be a decimal number. error.record.date.day.blank=The day field in question {0} is blank. error.record.date.day.int=The day field in question {0} must be an integer number. error.record.date.day.limit=The day field in question {0} must be between 1 and {1}. @@ -270,12 +273,13 @@ error.record.checkbox.min=The number of answers in question {0} must be no less than {1}. error.record.checkbox.max=The number of answers in question {0} must be no more than {1}. error.record.longlat.longitude.blank=The longitude in question {0} must not be blank. -error.record.longlat.longitude.float=The longitude in question {0} must be an real number. +error.record.longlat.longitude.float=The longitude in question {0} must be an decimal number. error.record.longlat.latitude.blank=The latitude in question {0} must not be blank. -error.record.longlat.latitude.float=The latitude in question {0} must be an real number. +error.record.longlat.latitude.float=The latitude in question {0} must be an decimal number. error.record.notenough=You should enter at least {0} records. error.record.toomuch=You should enter no more than {0} records. + error.upload.failed =Upload file failed: {0} error.msg.upload.file.not.found =Could not find upload file {0}. error.msg.zip.file.exception =Could not handle zip file when uploading file. Index: lams_tool_daco/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -ra4e564624bbf22983634d0e77a2e467403d0d7e5 -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision a4e564624bbf22983634d0e77a2e467403d0d7e5) +++ lams_tool_daco/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -16,7 +16,7 @@ errorPage.heading =Some error occurs when handling your request -label.author.title =Data Collection Authoring +label.author.title =Data Collection label.authoring.heading =Data Collection label.authoring.heading.instructions =Instructions label.authoring.heading.instructions.desc =Please input online and offline instructions @@ -124,6 +124,7 @@ label.learning.textfield.hint=Enter a single line of text label.learning.textarea.hint=Enter text label.learning.number.hint=Enter a number +label.learning.number.decimal=The number will be rounded to {0} decimal places. label.learning.date.hint=Enter a date label.learning.date.day=Day: label.learning.date.month=Month: @@ -138,7 +139,7 @@ label.learning.dropdown.noneselected=No answer was selected. label.learning.dropdown.selected=Selected answer: label.learning.checkbox.hint=Choose options -label.learning.longlat.hint=Enter two real numbers +label.learning.longlat.hint=Enter two decimal numbers label.learning.longlat.longitude=Longitude: label.learning.longlat.longitude.unit=�N label.learning.longlat.latitude=Latitude: @@ -236,28 +237,30 @@ error.question.file.blank =File can not be blank. error.question.max.blank=The maximum constraint must not be blank. error.question.max.number.int=The maximum constraint must be an integer number. -error.question.max.number.float=The maximum constraint must be a real number. +error.question.max.number.float=The maximum constraint must be a decimal number. error.question.max.negative=The maximum constraint must be a nonnegative number. error.question.max.toohigh=The maximum constraint must be less than {0}. error.question.max.toohigh.answeroption=The maximum constraint must be less or equal to the answer option count. error.question.max.toolow=The maximum constraint must be more than {0}. error.question.min.blank=The minimum constraint must not be blank. error.question.min.number.int=The minimum constraint must be an integer number. -error.question.min.number.float=The minimum constraint must be a real number. +error.question.min.number.float=The minimum constraint must be a decimal number. error.question.min.negative=The minimum constraint must be a nonnegative number. error.question.min.toohigh=The minimum constraint must be less than {0}. error.question.min.toohigh.answeroption=The minimum constraint must be less or equal to the answer option count. error.question.min.toolow=The minimum constraint must be more than {0}. error.question.min.toohigh.max=The minimum constraint must be less than the maximum constraint. error.question.answeroption.repeat=The answer options {0} and {1} are the same. error.question.answeroption.notenough =You should provide at least {0} answer options. +error.question.digitsdecimal.int=The number of digits after decimal point must be an integer number. +error.question.digitsdecimal.nonnegative=The number of digits after decimal point must be a nonnegative number. error.recordlimit.min.toohigh.max=The minimum number of records must be less or equal to the maximum. error.record.blank=An answer for question {0} is required. error.record.textarea.long=The maximum number of words in question {0} is {1}. -error.record.number.min=The number in question {0} should be no less than {1}. +error.record.number.min=The number in question {0} must be at least {1}. error.record.number.max=The number in question {0} should be no more than {1}. -error.record.number.float=The answer in question {0} must be a real number. +error.record.number.float=The answer in question {0} must be a decimal number. error.record.date.day.blank=The day field in question {0} is blank. error.record.date.day.int=The day field in question {0} must be an integer number. error.record.date.day.limit=The day field in question {0} must be between 1 and {1}. @@ -270,9 +273,9 @@ error.record.checkbox.min=The number of answers in question {0} must be no less than {1}. error.record.checkbox.max=The number of answers in question {0} must be no more than {1}. error.record.longlat.longitude.blank=The longitude in question {0} must not be blank. -error.record.longlat.longitude.float=The longitude in question {0} must be an real number. +error.record.longlat.longitude.float=The longitude in question {0} must be an decimal number. error.record.longlat.latitude.blank=The latitude in question {0} must not be blank. -error.record.longlat.latitude.float=The latitude in question {0} must be an real number. +error.record.longlat.latitude.float=The latitude in question {0} must be an decimal number. error.record.notenough=You should enter at least {0} records. error.record.toomuch=You should enter no more than {0} records. Index: lams_tool_daco/db/sql/create_lams_tool_daco.sql =================================================================== diff -u -rf12326dca55fbb5b273579ce521c97355a66472d -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/db/sql/create_lams_tool_daco.sql (.../create_lams_tool_daco.sql) (revision f12326dca55fbb5b273579ce521c97355a66472d) +++ lams_tool_daco/db/sql/create_lams_tool_daco.sql (.../create_lams_tool_daco.sql) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -48,7 +48,7 @@ question_type smallint, min_constraint float, max_constraint float, - digits_decimal smallint default 0, + digits_decimal smallint, summary smallint, content_uid bigint, session_uid bigint, Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java =================================================================== diff -u -ra4e564624bbf22983634d0e77a2e467403d0d7e5 -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision a4e564624bbf22983634d0e77a2e467403d0d7e5) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/DacoConstants.java (.../DacoConstants.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -59,8 +59,6 @@ // format for the date question public static final String DATE_PART_DELIMETER = "-"; - public static final String DATE_FORMAT = "dd" + DacoConstants.DATE_PART_DELIMETER + "MM" + DacoConstants.DATE_PART_DELIMETER - + "yyyy"; // for action forward name public static final String SUCCESS = "success"; public static final String ERROR = "error"; @@ -141,6 +139,8 @@ public static final String ERROR_MSG_MIN_TOOHIGH_MAX = "error.question.min.toohigh.max"; public static final String ERROR_MSG_ANSWEROPTION_REPEAT = "error.question.answeroption.repeat"; public static final String ERROR_MSG_ANSWEROPTION_NOTENOUGH = "error.question.answeroption.notenough"; + public static final String ERROR_MSG_DIGITSDECIMAL_INT = "error.question.digitsdecimal.int"; + public static final String ERROR_MSG_DIGITSDECIMAL_NONNEGATIVE = "error.question.digitsdecimal.nonnegative"; public static final String ERROR_MSG_RECORDLIMIT_MIN_TOOHIGH_MAX = "error.recordlimit.min.toohigh.max"; public static final String ERROR_MSG_RECORD_BLANK = "error.record.blank"; Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/DacoServiceImpl.java (.../DacoServiceImpl.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -613,8 +613,6 @@ throw new DacoApplicationException(error); } - defaultDaco.setLockWhenFinished(true); - return defaultDaco; } @@ -1025,4 +1023,8 @@ public void saveOrUpdateAnswer(DacoAnswer answer) { dacoAnswerDao.saveObject(answer); } + + public String getLocalisedMessage(String key, Object[] args) { + return messageService.getMessage(key, args); + } } \ No newline at end of file Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java (.../IDacoService.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/service/IDacoService.java (.../IDacoService.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -282,4 +282,6 @@ * @return */ DacoUser getUser(Long uid); + + public String getLocalisedMessage(String key, Object[] args); } Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -331,6 +331,10 @@ if (!StringUtils.isBlank(constraint)) { question.setMin(Float.parseFloat(constraint)); } + constraint = questionForm.getDigitsDecimal(); + if (!StringUtils.isBlank(constraint)) { + question.setDigitsDecimal(Short.parseShort(constraint)); + } question.setCreateByAuthor(true); question.setHide(false); @@ -350,7 +354,6 @@ question.setDescription(StringUtils.isBlank(questionForm.getDescription()) ? null : questionForm.getDescription().trim()); - question.setDigitsDecimal(questionForm.getDigitsDecimal()); } /** @@ -635,7 +638,6 @@ form.setDescription(question.getDescription()); form.setQuestionRequired(question.isRequired()); form.setSummary(question.getSummary()); - form.setDigitsDecimal(question.getDigitsDecimal()); if (questionIndex >= 0) { form.setQuestionIndex(new Integer(questionIndex).toString()); } @@ -647,6 +649,7 @@ if (questionType == DacoConstants.QUESTION_TYPE_NUMBER) { Short digitsDecimal = question.getDigitsDecimal(); if (digitsDecimal != null) { + form.setDigitsDecimal(digitsDecimal.toString()); if (digitsDecimal == 0) { form.setMin(min == null ? null : String.valueOf(Math.round(min))); form.setMax(max == null ? null : String.valueOf(Math.round(max))); @@ -656,6 +659,9 @@ form.setMax(max == null ? null : String.valueOf(round(max, digitsDecimal))); } } + else { + form.setDigitsDecimal(null); + } } else { form.setMin(min == null ? null : min.toString()); @@ -1206,18 +1212,33 @@ } } + constraint = questionForm.getDigitsDecimal(); + if (!StringUtils.isBlank(constraint)) { + try { + Short digitsDecimal = Short.parseShort(constraint); + if (digitsDecimal < 0) { + errors.add(ActionMessages.GLOBAL_MESSAGE, + new ActionMessage(DacoConstants.ERROR_MSG_DIGITSDECIMAL_NONNEGATIVE)); + } + } + catch (NumberFormatException e) { + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DacoConstants.ERROR_MSG_DIGITSDECIMAL_INT)); + } + } + if (answerOptionList != null) { if (answerOptionList.size() < DacoConstants.ANSWER_OPTION_MINIMUM_COUNT) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DacoConstants.ERROR_MSG_ANSWEROPTION_NOTENOUGH, DacoConstants.ANSWER_OPTION_MINIMUM_COUNT)); } + String ordinal = getDacoService().getLocalisedMessage("label.authoring.basic.answeroption.ordinal", null); for (int firstOptionNumber = 0; firstOptionNumber < answerOptionList.size(); firstOptionNumber++) { String firstOption = answerOptionList.get(firstOptionNumber); for (int secondOptionNumber = firstOptionNumber + 1; secondOptionNumber < answerOptionList.size(); secondOptionNumber++) { String secondOption = answerOptionList.get(secondOptionNumber); if (firstOption.trim().equals(secondOption.trim())) { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(DacoConstants.ERROR_MSG_ANSWEROPTION_REPEAT, - firstOptionNumber + 1, secondOptionNumber + 1)); + ordinal.charAt(firstOptionNumber) + ")", ordinal.charAt(secondOptionNumber) + ")")); } } } Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java =================================================================== diff -u -ra4e564624bbf22983634d0e77a2e467403d0d7e5 -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java (.../LearningAction.java) (revision a4e564624bbf22983634d0e77a2e467403d0d7e5) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/action/LearningAction.java (.../LearningAction.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -25,14 +25,13 @@ package org.lamsfoundation.lams.tool.daco.web.action; import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -70,6 +69,7 @@ import org.lamsfoundation.lams.tool.daco.web.form.ReflectionForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.FileValidatorUtil; +import org.lamsfoundation.lams.util.NumberUtil; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.session.SessionManager; import org.lamsfoundation.lams.web.util.AttributeNames; @@ -331,20 +331,29 @@ } switch (question.getType()) { + case DacoConstants.QUESTION_TYPE_NUMBER: { + String formAnswer = recordForm.getAnswer(formAnswerNumber); + if (!StringUtils.isBlank(formAnswer) && question.getDigitsDecimal() != null) { + formAnswer = NumberUtil.formatLocalisedNumber(Double.parseDouble(formAnswer), (Locale) null, question + .getDigitsDecimal()); + } + answer.setAnswer(formAnswer); + formAnswerNumber++; + } + break; case DacoConstants.QUESTION_TYPE_DATE: { String[] dateParts = new String[] { recordForm.getAnswer(formAnswerNumber++), recordForm.getAnswer(formAnswerNumber++), recordForm.getAnswer(formAnswerNumber) }; if (!(StringUtils.isBlank(dateParts[0]) || StringUtils.isBlank(dateParts[1]) || StringUtils .isBlank(dateParts[2]))) { - DateFormat dateFormat = new SimpleDateFormat(DacoConstants.DATE_FORMAT); Calendar calendar = Calendar.getInstance(); - calendar.set(Integer.parseInt(dateParts[2]), Integer.parseInt(dateParts[1]), Integer + calendar.clear(); + calendar.set(Integer.parseInt(dateParts[2]), Integer.parseInt(dateParts[1]) - 1, Integer .parseInt(dateParts[0])); - answer.setAnswer(dateFormat.format(calendar.getTime())); + answer.setAnswer(calendar.getTime().toString()); } else { answer.setAnswer(null); - } } formAnswerNumber++; Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java (.../DacoForm.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoForm.java (.../DacoForm.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -76,7 +76,7 @@ // so need not reset checkbox to refresh value! if (!StringUtils.equals(param, "start") && !StringUtils.equals(param, "initPage")) { - daco.setLockWhenFinished(true); + daco.setLockWhenFinished(false); daco.setDefineLater(false); daco.setRunOffline(false); Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoQuestionForm.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoQuestionForm.java (.../DacoQuestionForm.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/DacoQuestionForm.java (.../DacoQuestionForm.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -40,7 +40,7 @@ private short questionType; private String min; private String max; - private Short digitsDecimal; + private String digitsDecimal; private Short summary; private String description; @@ -110,11 +110,11 @@ this.summary = summary; } - public Short getDigitsDecimal() { + public String getDigitsDecimal() { return digitsDecimal; } - public void setDigitsDecimal(Short digitsDecimal) { + public void setDigitsDecimal(String digitsDecimal) { this.digitsDecimal = digitsDecimal; } } \ No newline at end of file Index: lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/RecordForm.java =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/RecordForm.java (.../RecordForm.java) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/src/java/org/lamsfoundation/lams/tool/daco/web/form/RecordForm.java (.../RecordForm.java) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -47,6 +47,7 @@ private List answer; private List file; + private List filePath; private int displayedRecordNumber = 1; public void setAnswer(int number, String answer) { @@ -66,6 +67,23 @@ return answer.get(number); } + public void setFilePath(int number, String filePath) { + if (this.filePath == null) { + this.filePath = new ArrayList(); + } + while (number >= this.filePath.size()) { + this.filePath.add(null); + } + this.filePath.set(number, filePath); + } + + public String getFilePath(int number) { + if (filePath == null || number >= filePath.size()) { + return null; + } + return filePath.get(number); + } + public void setFile(int number, FormFile file) { if (file.getFileSize() > 0) { if (this.file == null) { @@ -107,4 +125,8 @@ public void setDisplayedRecordNumber(int displayedRecordNumber) { this.displayedRecordNumber = displayedRecordNumber; } + + public int getFileCount() { + return file.size(); + } } \ No newline at end of file Index: lams_tool_daco/web/includes/css/daco.css =================================================================== diff -u -rbe03cfbba16a388e85d82cb8986f63d6b2ad568b -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/web/includes/css/daco.css (.../daco.css) (revision be03cfbba16a388e85d82cb8986f63d6b2ad568b) +++ lams_tool_daco/web/includes/css/daco.css (.../daco.css) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -92,4 +92,7 @@ border: none; background: transparent; vertical-align: middle; +} +table#recordListTable td.fixedCellWidth{ + width: 160px; } \ No newline at end of file Index: lams_tool_daco/web/includes/javascript/dacoLearning.js =================================================================== diff -u -ra4e564624bbf22983634d0e77a2e467403d0d7e5 -r20efcf1f1ffa7e732d72deaf0c670f34836d9a0a --- lams_tool_daco/web/includes/javascript/dacoLearning.js (.../dacoLearning.js) (revision a4e564624bbf22983634d0e77a2e467403d0d7e5) +++ lams_tool_daco/web/includes/javascript/dacoLearning.js (.../dacoLearning.js) (revision 20efcf1f1ffa7e732d72deaf0c670f34836d9a0a) @@ -1,6 +1,6 @@ function init(){ doSelectTab(currentTab); - readCheckboxQuestionsValues(); + readHiddenFormValues(); } function doSelectTab(tabId) { @@ -19,48 +19,57 @@ } function saveOrUpdateRecord() { - setCheckboxQuestionsValues(); + setHiddenFormValues(); document.getElementById("recordForm").submit(); } - function setCheckboxQuestionsValues(){ + function setHiddenFormValues(){ var elementCount = document.getElementById("recordForm").elements.length; - for (var checkboxQuestionNumber=1;checkboxQuestionNumber<=elementCount;checkboxQuestionNumber++){ - var checkboxQuestion=document.getElementById("checkbox-"+checkboxQuestionNumber); + for (var questionNumber=1;questionNumber<=elementCount;questionNumber++){ + var checkboxQuestion=document.getElementById("checkbox-"+questionNumber); + var fileQuestion = document.getElementById("file-"+questionNumber); if (checkboxQuestion!=null){ var checkboxQuestionValue = ""; var checkboxNumber = 1; - var checkbox = document.getElementById("checkbox-"+checkboxQuestionNumber+"-"+checkboxNumber); + var checkbox = document.getElementById("checkbox-"+questionNumber+"-"+checkboxNumber); while (checkbox!=null){ if (checkbox.checked){ checkboxQuestionValue += checkboxNumber + "&"; } checkboxNumber++; - checkbox = document.getElementById("checkbox-"+checkboxQuestionNumber+"-"+checkboxNumber); + checkbox = document.getElementById("checkbox-"+questionNumber+"-"+checkboxNumber); } checkboxQuestion.value=checkboxQuestionValue; } + + if (fileQuestion!=null){ + document.getElementById("filePath-"+questionNumber).value=document.getElementById("file-"+questionNumber).value; + } } } - function readCheckboxQuestionsValues(){ + function readHiddenFormValues(){ var elementCount = document.getElementById("recordForm").elements.length; - for (var checkboxQuestionNumber=1;checkboxQuestionNumber<=elementCount;checkboxQuestionNumber++){ - var checkboxQuestion=document.getElementById("checkbox-"+checkboxQuestionNumber); + for (var questionNumber=1;questionNumber<=elementCount;questionNumber++){ + var checkboxQuestion=document.getElementById("checkbox-"+questionNumber); + var fileQuestion = document.getElementById("file-"+questionNumber); if (checkboxQuestion!=null){ var checkboxValues = checkboxQuestion.value.split("&"); var checkboxNumber = 1; - var checkbox = document.getElementById("checkbox-"+checkboxQuestionNumber+"-"+checkboxNumber); + var checkbox = document.getElementById("checkbox-"+questionNumber+"-"+checkboxNumber); while (checkbox!=null){ for (var index = 0; index