Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb7c514c7fa5a7915966d4f555de3e740ee95ae09 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b7c514c7fa5a7915966d4f555de3e740ee95ae09) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -632,6 +632,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] sysadmin.maintain.session.name =Name congfig.header.antivirus =Antivirus config.av.enable =Enable antivirus scanning on files upload Index: lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java =================================================================== diff -u -r8ed3b25f15a9ea80cc6f1c3d92210429404501df -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision 8ed3b25f15a9ea80cc6f1c3d92210429404501df) +++ lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -38,7 +38,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.lamsfoundation.lams.learningdesign.ToolActivity; -import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.outcome.Outcome; import org.lamsfoundation.lams.outcome.OutcomeMapping; import org.lamsfoundation.lams.outcome.OutcomeResult; @@ -207,11 +206,11 @@ outcome.setCode(outcomeForm.getCode()); outcome.setDescription(outcomeForm.getDescription()); outcome.setContentFolderId(outcomeForm.getContentFolderId()); - if (outcomeForm.getScaleId() != null) { - OutcomeScale scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, - outcomeForm.getScaleId()); - outcome.setScale(scale); - } + long scaleId = outcomeForm.getScaleId() == null || outcomeForm.getScaleId() == 0 + ? IOutcomeService.DEFAULT_SCALE_ID + : outcomeForm.getScaleId(); + OutcomeScale scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, scaleId); + outcome.setScale(scale); userManagementService.save(outcome); if (log.isDebugEnabled()) { @@ -269,7 +268,7 @@ Integer userId = getUserDTO().getUserID(); if (StringUtils.isNotBlank(organisationIdString)) { String[] split = organisationIdString.split(","); - organisationIds = new HashSet(split.length); + organisationIds = new HashSet<>(split.length); for (String organisationId : split) { organisationIds.add(Integer.valueOf(organisationId)); } @@ -292,26 +291,60 @@ for (Outcome outcome : outcomes) { ObjectNode outcomeJSON = JsonNodeFactory.instance.objectNode(); outcomeJSON.put("value", outcome.getOutcomeId()); - outcomeJSON.put("label", outcome.getName() + " (" + outcome.getCode() + ")"); + outcomeJSON.put("label", + outcome.getName() + (StringUtils.isBlank(outcome.getCode()) ? "" : " (" + outcome.getCode() + ")")); responseJSON.add(outcomeJSON); } + responseJSON.add(search); response.setContentType("application/json;charset=utf-8"); return responseJSON.toString(); } @RequestMapping("/outcomeMap") @ResponseBody public String outcomeMap(HttpServletRequest request, HttpServletResponse response) throws Exception { - Long outcomeId = WebUtil.readLongParam(request, "outcomeId"); + Long outcomeId = WebUtil.readLongParam(request, "outcomeId", true); Long lessonId = WebUtil.readLongParam(request, "lessonId", true); Long toolContentId = WebUtil.readLongParam(request, "toolContentId", true); if (lessonId == null && toolContentId == null) { throw new IllegalArgumentException( "Either lesson ID or tool content ID must not be null when creating an outcome mapping"); } Long itemId = WebUtil.readLongParam(request, "itemId", true); + Outcome outcome = null; + if (outcomeId == null) { + // create a new outcome on the fly + String name = WebUtil.readStrParam(request, "name"); + String code = null; + // check if name contains code part + String[] nameParts = name.split("\\("); + if (nameParts.length > 1) { + name = nameParts[0].trim(); + code = nameParts[1].replaceFirst("\\)", "").trim(); + } + outcome = new Outcome(); - Outcome outcome = (Outcome) userManagementService.findById(Outcome.class, outcomeId); + Integer userId = getUserDTO().getUserID(); + User user = (User) userManagementService.findById(User.class, userId); + outcome.setCreateBy(user); + outcome.setCreateDateTime(new Date()); + + outcome.setName(name); + outcome.setCode(code); + outcome.setContentFolderId(outcomeService.getContentFolderId(null)); + OutcomeScale scale = (OutcomeScale) userManagementService.findById(OutcomeScale.class, + IOutcomeService.DEFAULT_SCALE_ID); + outcome.setScale(scale); + userManagementService.save(outcome); + + if (log.isDebugEnabled()) { + log.debug("Saved outcome " + outcome.getOutcomeId()); + } + + } else { + outcome = (Outcome) userManagementService.findById(Outcome.class, outcomeId); + } + Integer organisationId = outcome.getOrganisation() == null ? null : outcome.getOrganisation().getOrganisationId(); Integer userId = getUserDTO().getUserID(); @@ -370,11 +403,12 @@ List outcomeMappings = outcomeService.getOutcomeMappings(lessonId, toolContentId, itemId); ArrayNode responseJSON = JsonNodeFactory.instance.arrayNode(); for (OutcomeMapping outcomeMapping : outcomeMappings) { + Outcome outcome = outcomeMapping.getOutcome(); ObjectNode outcomeJSON = JsonNodeFactory.instance.objectNode(); outcomeJSON.put("mappingId", outcomeMapping.getMappingId()); - outcomeJSON.put("outcomeId", outcomeMapping.getOutcome().getOutcomeId()); + outcomeJSON.put("outcomeId", outcome.getOutcomeId()); outcomeJSON.put("label", - outcomeMapping.getOutcome().getName() + " (" + outcomeMapping.getOutcome().getCode() + ")"); + outcome.getName() + (StringUtils.isBlank(outcome.getCode()) ? "" : " (" + outcome.getCode() + ")")); responseJSON.add(outcomeJSON); } response.setContentType("application/json;charset=utf-8"); @@ -400,10 +434,21 @@ securityService.hasOrgRole(organisationId, userId, new String[] { Role.AUTHOR }, "remove outcome mapping", true); } + Outcome outcome = outcomeMapping.getOutcome(); + Long outcomeId = outcome.getOutcomeId(); userManagementService.delete(outcomeMapping); + if (log.isDebugEnabled()) { - log.debug("Deleted outcome mapping " + outcomeMapping); + log.debug("Deleted outcome mapping " + mappingId); } + // if the outcome is not mapped to any activity, remove it + long mappingCount = outcomeService.countOutcomeMappings(outcomeId); + if (mappingCount == 0) { + userManagementService.delete(outcome); + if (log.isDebugEnabled()) { + log.debug("Deleted outcome " + outcomeId + " as it did not have any mappings"); + } + } } @SuppressWarnings("unchecked") @@ -419,7 +464,7 @@ if (lessonId == null) { ToolActivity toolActivity = ((List) userManagementService.findByProperty(ToolActivity.class, "toolContentId", outcomeMapping.getToolContentId())).get(0); - lessonId = ((Lesson) toolActivity.getLearningDesign().getLessons().iterator().next()).getLessonId(); + lessonId = toolActivity.getLearningDesign().getLessons().iterator().next().getLessonId(); } Integer userId = getUserDTO().getUserID(); securityService.isLessonMonitor(lessonId, userId, "set outcome result", true); @@ -770,12 +815,16 @@ if (StringUtils.isBlank(outcomeForm.getName())) { errorMap.add("GLOBAL", messageService.getMessage("outcome.manage.add.error.name.blank")); } - if (StringUtils.isBlank(outcomeForm.getCode())) { - errorMap.add("GLOBAL", messageService.getMessage("outcome.manage.add.error.code.blank")); - } - if (outcomeForm.getScaleId() == null || outcomeForm.getScaleId() == 0) { - errorMap.add("GLOBAL", messageService.getMessage("outcome.manage.add.error.scale.choose")); - } + /** + * LDEV-4786 We allow blank code when creating an outcome straight from outcome select field + * if (StringUtils.isBlank(outcomeForm.getCode())) { + * errorMap.add("GLOBAL", messageService.getMessage("outcome.manage.add.error.code.blank")); + * } + * If no outcome is chosen, the default scale gets chosen + * if (outcomeForm.getScaleId() == null || outcomeForm.getScaleId() == 0) { + * errorMap.add("GLOBAL", messageService.getMessage("outcome.manage.add.error.scale.choose")); + * } + **/ } private void validateScaleForm(OutcomeScaleForm scaleForm, MultiValueMap errorMap) { Index: lams_central/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_central/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_central/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_common/src/java/org/lamsfoundation/lams/outcome/dao/hibernate/OutcomeDAO.java =================================================================== diff -u -rb232f1f11bbdb5c8455f29ab5489dc8f86b0b7d4 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_common/src/java/org/lamsfoundation/lams/outcome/dao/hibernate/OutcomeDAO.java (.../OutcomeDAO.java) (revision b232f1f11bbdb5c8455f29ab5489dc8f86b0b7d4) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/dao/hibernate/OutcomeDAO.java (.../OutcomeDAO.java) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -78,18 +78,18 @@ @SuppressWarnings("unchecked") public List getOutcomesSortedByName(String search, Set organisationIds) { String queryString = FIND_OUTCOMES_SORTED_BY_NAME; - if (organisationIds != null && !organisationIds.isEmpty()) { - queryString = queryString.replace("?", "OR o.organisation.organisationId IN (:organisationIds) ? "); - } +// if (organisationIds != null && !organisationIds.isEmpty()) { +// queryString = queryString.replace("?", "OR o.organisation.organisationId IN (:organisationIds) ? "); +// } if (StringUtils.isNotBlank(search)) { queryString = queryString.replace("?", "AND (o.name LIKE :search OR o.code LIKE :search)"); } queryString = queryString.replace("?", ""); Query query = getSession().createQuery(queryString); - if (organisationIds != null && !organisationIds.isEmpty()) { - query.setParameterList("organisationIds", organisationIds); - } +// if (organisationIds != null && !organisationIds.isEmpty()) { +// query.setParameterList("organisationIds", organisationIds); +// } if (StringUtils.isNotBlank(search)) { query.setParameter("search", "%" + search + "%"); } @@ -100,7 +100,7 @@ @Override @SuppressWarnings("unchecked") public List getOutcomeMappings(Long lessonId, Long toolContentId, Long itemId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (lessonId != null) { properties.put("lessonId", lessonId); } @@ -133,7 +133,7 @@ @Override @SuppressWarnings("unchecked") public List getOutcomeResults(Integer userId, Long lessonId, Long toolContentId, Long itemId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (lessonId != null) { properties.put("mapping.outcome.lessonId", lessonId); } @@ -152,7 +152,7 @@ @Override @SuppressWarnings("unchecked") public OutcomeResult getOutcomeResult(Integer userId, Long mappingId) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); properties.put("user.userId", userId); properties.put("mapping.mappingId", mappingId); List result = findByProperties(OutcomeResult.class, properties); Index: lams_common/src/java/org/lamsfoundation/lams/outcome/service/IOutcomeService.java =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_common/src/java/org/lamsfoundation/lams/outcome/service/IOutcomeService.java (.../IOutcomeService.java) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/service/IOutcomeService.java (.../IOutcomeService.java) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -23,6 +23,8 @@ List getOutcomeMappings(Long lessonId, Long toolContentId, Long itemId); + long countOutcomeMappings(Long outcomeId); + List getScales(Integer organisationId); List getOutcomeResults(Integer userId, Long lessonId, Long toolContentId, Long itemId); Index: lams_common/src/java/org/lamsfoundation/lams/outcome/service/OutcomeService.java =================================================================== diff -u -r889868fbf109f9d5fa9da31d15ee8d5028772a22 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_common/src/java/org/lamsfoundation/lams/outcome/service/OutcomeService.java (.../OutcomeService.java) (revision 889868fbf109f9d5fa9da31d15ee8d5028772a22) +++ lams_common/src/java/org/lamsfoundation/lams/outcome/service/OutcomeService.java (.../OutcomeService.java) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -2,10 +2,12 @@ import java.io.IOException; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Set; import javax.servlet.http.HttpSession; @@ -57,7 +59,7 @@ public List getOutcomes(String search, Set organisationIds) { if (organisationIds == null) { Integer userId = OutcomeService.getUserDTO().getUserID(); - organisationIds = new HashSet(outcomeDAO.getAuthorOrganisations(userId)); + organisationIds = new HashSet<>(outcomeDAO.getAuthorOrganisations(userId)); } return outcomeDAO.getOutcomesSortedByName(search, organisationIds); } @@ -68,6 +70,13 @@ } @Override + public long countOutcomeMappings(Long outcomeId) { + Map properties = new HashMap<>(); + properties.put("outcome.outcomeId", outcomeId); + return outcomeDAO.countByProperties(OutcomeMapping.class, properties); + } + + @Override public List getOutcomeResults(Integer userId, Long lessonId, Long toolContentId, Long itemId) { return outcomeDAO.getOutcomeResults(userId, lessonId, toolContentId, itemId); } @@ -103,10 +112,10 @@ @Override public LinkedHashMap exportScales() { - LinkedHashMap dataToExport = new LinkedHashMap(); + LinkedHashMap dataToExport = new LinkedHashMap<>(); // The entire data list - List rowList = new LinkedList(); + List rowList = new LinkedList<>(); ExcelCell[] row = new ExcelCell[4]; row[0] = new ExcelCell(messageService.getMessage("outcome.manage.add.name"), true); row[1] = new ExcelCell(messageService.getMessage("outcome.manage.add.code"), true); @@ -131,10 +140,10 @@ @Override public LinkedHashMap exportOutcomes() { - LinkedHashMap dataToExport = new LinkedHashMap(); + LinkedHashMap dataToExport = new LinkedHashMap<>(); // The entire data list - List rowList = new LinkedList(); + List rowList = new LinkedList<>(); ExcelCell[] row = new ExcelCell[4]; row[0] = new ExcelCell(messageService.getMessage("outcome.manage.add.name"), true); row[1] = new ExcelCell(messageService.getMessage("outcome.manage.add.code"), true); @@ -148,7 +157,7 @@ row[0] = new ExcelCell(outcome.getName(), false); row[1] = new ExcelCell(outcome.getCode(), false); row[2] = new ExcelCell(outcome.getDescription(), false); - row[3] = new ExcelCell(outcome.getScale().getCode(), false); + row[3] = new ExcelCell(outcome.getScale().getName(), false); rowList.add(row); } @@ -176,17 +185,18 @@ for (int i = startRow; i < (endRow + 1); i++) { row = sheet.getRow(i); + cell = row.getCell(0); + String name = cell.getStringCellValue(); cell = row.getCell(1); String code = cell.getStringCellValue(); - List foundScales = outcomeDAO.findByProperty(OutcomeScale.class, "code", code); + List foundScales = outcomeDAO.findByProperty(OutcomeScale.class, "name", name); if (!foundScales.isEmpty()) { if (log.isDebugEnabled()) { - log.debug("Skipping an outcome scale with existing code: " + code); + log.debug("Skipping an outcome scale with existing name: " + name); } continue; } - cell = row.getCell(0); - String name = cell.getStringCellValue(); + cell = row.getCell(2); String description = cell == null ? null : cell.getStringCellValue(); cell = row.getCell(3); @@ -239,27 +249,28 @@ for (int i = startRow; i < (endRow + 1); i++) { row = sheet.getRow(i); + cell = row.getCell(0); + String name = cell.getStringCellValue(); cell = row.getCell(1); String code = cell.getStringCellValue(); - List foundOutcomes = outcomeDAO.findByProperty(Outcome.class, "code", code); + List foundOutcomes = outcomeDAO.findByProperty(Outcome.class, "name", name); if (!foundOutcomes.isEmpty()) { if (log.isDebugEnabled()) { - log.debug("Skipping an outcome with existing code: " + code); + log.debug("Skipping an outcome with existing name: " + name); } continue; } cell = row.getCell(3); - String scaleCode = cell.getStringCellValue(); - List foundScales = outcomeDAO.findByProperty(OutcomeScale.class, "code", scaleCode); + String scaleName = cell.getStringCellValue(); + List foundScales = outcomeDAO.findByProperty(OutcomeScale.class, "name", scaleName); OutcomeScale scale = foundScales.isEmpty() ? null : foundScales.get(0); if (scale == null) { if (log.isDebugEnabled()) { - log.debug("Skipping an outcome with missing scale with code: " + scaleCode); + log.debug("Skipping an outcome with missing scale with name: " + scaleName); } continue; } - cell = row.getCell(0); - String name = cell.getStringCellValue(); + cell = row.getCell(2); String description = cell == null ? null : cell.getStringCellValue(); Index: lams_gradebook/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb0092dbda1966006748ebd8c44ff0ca0c9292ed0 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_gradebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b0092dbda1966006748ebd8c44ff0ca0c9292ed0) +++ lams_gradebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -122,6 +122,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] outcome.result.not.set =not set outcome.result.error =Error! gradebook.columntitle.attempt =Attempt # Index: lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_learning/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2d9cfa9d7527e4e21780f5a11da3a7e961eeab05 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2d9cfa9d7527e4e21780f5a11da3a7e961eeab05) +++ lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -189,6 +189,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] button.kumalive.poll.chart.switch =Switch chart Index: lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_monitoring/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r27fccb2c00d6a314ef9aee9db5436987090aca1e -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 27fccb2c00d6a314ef9aee9db5436987090aca1e) +++ lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -476,6 +476,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 470 labels for en AU ===== Index: lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_assessment/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r583575676d74a6cfc595aa27e0a98db44c658922 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 583575676d74a6cfc595aa27e0a98db44c658922) +++ lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -343,6 +343,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] authoring.fla.branch.mapping.ordered.asc =Start with branches mapped to highest ordered answers warn.tool.output.change.none =This will delete all existing marks for this activity. Are you sure? output.desc.none =No score Index: lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_chat/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2aa8b406f4e5f4f9063149d708ef7b46e2d191a7 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_chat/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2aa8b406f4e5f4f9063149d708ef7b46e2d191a7) +++ lams_tool_chat/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -121,6 +121,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 115 labels for en AU ===== Index: lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_daco/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2baf59f7cd470e56e94ddbc30b738711f6b4d779 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2baf59f7cd470e56e94ddbc30b738711f6b4d779) +++ lams_tool_daco/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -259,6 +259,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 253 labels for en AU ===== Index: lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_doku/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r62aaf160878735888d077bf28fac3c1989bb8fbd -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_doku/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 62aaf160878735888d077bf28fac3c1989bb8fbd) +++ lams_tool_doku/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -92,4 +92,5 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 164 labels for en AU ===== Index: lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_forum/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r29a9f580b2b8a195d7957d40e0db2abf32b262f4 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_forum/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 29a9f580b2b8a195d7957d40e0db2abf32b262f4) +++ lams_tool_forum/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -250,6 +250,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 244 labels for en AU ===== Index: lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_images/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4fa81491838e947800839b80de1ea11c2013038d -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4fa81491838e947800839b80de1ea11c2013038d) +++ lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -156,6 +156,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 150 labels for en AU ===== Index: lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_imscc/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r28bae3c2c6552c1f243342b3f6e382d9cd4c8fca -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_imscc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 28bae3c2c6552c1f243342b3f6e382d9cd4c8fca) +++ lams_tool_imscc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -134,6 +134,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 128 labels for en AU ===== Index: lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_lamc/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rdc41ab1a82d32dfecca77a3db6936fe116c164b7 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision dc41ab1a82d32dfecca77a3db6936fe116c164b7) +++ lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -232,6 +232,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] warn.tool.output.change.none =This will delete all existing marks for this activity. Are you sure? output.desc.none =No score Index: lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_laqa/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r76bc7d8e8c78984a76af71a244a72bcc872c3cac -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 76bc7d8e8c78984a76af71a244a72bcc872c3cac) +++ lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -223,6 +223,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 217 labels for en AU ===== Index: lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_larsrc/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r92cdd698e46d6dd110fd77947b1a18f7ece6c9c4 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_larsrc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 92cdd698e46d6dd110fd77947b1a18f7ece6c9c4) +++ lams_tool_larsrc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -185,6 +185,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 179 labels for en AU ===== Index: lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_leader/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r7cd1ef5d801bb97fa8b3111fbdbab9421f060c06 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_leader/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7cd1ef5d801bb97fa8b3111fbdbab9421f060c06) +++ lams_tool_leader/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -64,6 +64,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 58 labels for en AU ===== Index: lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_mindmap/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r2284e05d216c098f9c488c66e24a07deff3bee85 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_mindmap/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 2284e05d216c098f9c488c66e24a07deff3bee85) +++ lams_tool_mindmap/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -107,6 +107,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 101 labels for en AU ===== Index: lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_nb/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4a3c968c1abf465fa0ed4c81bda84187bc715fcc -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_nb/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4a3c968c1abf465fa0ed4c81bda84187bc715fcc) +++ lams_tool_nb/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -65,6 +65,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 59 labels for en AU ===== Index: lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_notebook/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -re5d93acb2dfac190c44ac3a6534cab6b60a4606d -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_notebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e5d93acb2dfac190c44ac3a6534cab6b60a4606d) +++ lams_tool_notebook/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -127,6 +127,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 121 labels for en AU ===== Index: lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_pixlr/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r1c0008e6766af70f72f90d6292cf1afd502f274b -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_pixlr/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1c0008e6766af70f72f90d6292cf1afd502f274b) +++ lams_tool_pixlr/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -110,6 +110,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 104 labels for en AU ===== Index: lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_preview/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r1489d49f53be7f344930739af244b7c4a1727c72 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_preview/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1489d49f53be7f344930739af244b7c4a1727c72) +++ lams_tool_preview/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -192,6 +192,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 186 labels for en AU ===== Index: lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_sbmt/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rc23196b01b0884536c5e25b48d2604cd1cf83d86 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_sbmt/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c23196b01b0884536c5e25b48d2604cd1cf83d86) +++ lams_tool_sbmt/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -166,6 +166,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] error.upload =Error while uploading file: {0} Index: lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_scratchie/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4136105c4f65a13360d7f27ff195301735e14595 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4136105c4f65a13360d7f27ff195301735e14595) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -230,6 +230,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 224 labels for en AU ===== Index: lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_scribe/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r321de672688e1c41dafc733583805dd79b63247b -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_scribe/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 321de672688e1c41dafc733583805dd79b63247b) +++ lams_tool_scribe/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -106,6 +106,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 100 labels for en AU ===== Index: lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_spreadsheet/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb2d6eec87f47352b10b655966ceffe059bd5f6aa -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_spreadsheet/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b2d6eec87f47352b10b655966ceffe059bd5f6aa) +++ lams_tool_spreadsheet/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -119,6 +119,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 113 labels for en AU ===== Index: lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_survey/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -re3da1d405b5e453e7cd9fe76ad252df2625c6ed2 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_survey/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e3da1d405b5e453e7cd9fe76ad252df2625c6ed2) +++ lams_tool_survey/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -185,6 +185,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 179 labels for en AU ===== Index: lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_task/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rb8afc8c19898c79009845f2b26ffcc0398b85a52 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision b8afc8c19898c79009845f2b26ffcc0398b85a52) +++ lams_tool_task/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -172,6 +172,6 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] - #======= End labels: Exported 166 labels for en AU ===== Index: lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_vote/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r7e78386b0934f437a21497b0e87b89dc58c5f3e1 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_vote/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7e78386b0934f437a21497b0e87b89dc58c5f3e1) +++ lams_tool_vote/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -165,6 +165,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 159 labels for en AU ===== Index: lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_wiki/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rff61c10fc5b8b6f8030ce3e428ad5ecadfecdfd0 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_wiki/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ff61c10fc5b8b6f8030ce3e428ad5ecadfecdfd0) +++ lams_tool_wiki/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -154,6 +154,7 @@ outcome.authoring.input =Search and select by outcome name or code outcome.authoring.existing =Added outcomes outcome.authoring.existing.none =none +outcome.authoring.create.new = [create new] #======= End labels: Exported 148 labels for en AU ===== Index: lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false, Index: lams_www/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r381e8076e21344e47a250d4c525e44f1c4e10399 -rd2c76e5308cd9eff91c235b3fa8e9309bbc58d50 --- lams_www/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 381e8076e21344e47a250d4c525e44f1c4e10399) +++ lams_www/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision d2c76e5308cd9eff91c235b3fa8e9309bbc58d50) @@ -49,6 +49,7 @@ outcomeMappingIds${outcomeTagId} = [], outcomeExistingNoneLabel = '', + outcomeCreateNewLabel = '', outcomeMappingRemoveButton = ''; $(document).ready(function(){ @@ -58,19 +59,34 @@ 'minLength' : 2, 'response' : function(event, ui) { // filter out already mapped outcomes - var index = ui.content.length; + var index = ui.content.length - 1, + term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + sameNameFound = false; + ui.content.splice(index, 1); while(index--) { + var label = ui.content[index].label; + if (label.split('(')[0].trim() == term) { + // do not offer to create an output which perfectly matches an existing one + sameNameFound = true; + } if (outcomeMappingIds${outcomeTagId}.includes(ui.content[index].value)){ ui.content.splice(index, 1); } } + if (!sameNameFound) { + ui.content.push({ + 'label' : term + outcomeCreateNewLabel + }); + } }, 'select' : function(event, ui){ var input = $(this); $.ajax({ 'url' : 'outcome/outcomeMap.do', 'data': $.extend({ - 'outcomeId' : ui.item.value + 'outcomeId' : ui.item.value, + // if value is null, then it is a new outcome to create; remove ' [create new]' part before sending + 'name' : ui.item.value ? null : ui.item.label.replace(outcomeCreateNewLabel, '') }, outcomeData${outcomeTagId}), 'method' : 'post', 'cache' : false,