Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -641,6 +641,6 @@ label.type.login =User login label.type.logout =User logout label.type.config.change =Configuration change +config.learning.outcome.add.enable =Enable quick add of learning outcomes in authoring - #======= End labels: Exported 634 labels for en AU ===== Index: lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_admin/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java =================================================================== diff -u -r81e4f5489c431c5e9ff66769f43ebe9b14d36c1a -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision 81e4f5489c431c5e9ff66769f43ebe9b14d36c1a) +++ lams_central/src/java/org/lamsfoundation/lams/web/outcome/OutcomeController.java (.../OutcomeController.java) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -48,6 +48,8 @@ import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; import org.lamsfoundation.lams.util.ExcelCell; import org.lamsfoundation.lams.util.ExcelUtil; import org.lamsfoundation.lams.util.FileUtil; @@ -198,6 +200,7 @@ @ResponseBody public String outcomeSearch(HttpServletRequest request, HttpServletResponse response) throws Exception { String search = WebUtil.readStrParam(request, "term", true); + boolean addEnabled = Configuration.getAsBoolean(ConfigurationKeys.LEARNING_OUTCOME_QUICK_ADD_ENABLE); List outcomes = outcomeService.getOutcomes(search); ArrayNode responseJSON = JsonNodeFactory.instance.arrayNode(); @@ -209,6 +212,7 @@ responseJSON.add(outcomeJSON); } responseJSON.add(search); + responseJSON.add(String.valueOf(addEnabled)); response.setContentType("application/json;charset=utf-8"); return responseJSON.toString(); } @@ -226,6 +230,10 @@ Long itemId = WebUtil.readLongParam(request, "itemId", true); Outcome outcome = null; if (outcomeId == null) { + boolean addEnabled = Configuration.getAsBoolean(ConfigurationKeys.LEARNING_OUTCOME_QUICK_ADD_ENABLE); + if (!addEnabled) { + throw new SecurityException("Adding Learning Outcomes on the fly is disabled"); + } // create a new outcome on the fly String name = WebUtil.readStrParam(request, "name"); String code = null; Index: lams_central/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_central/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_central/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190520.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190520.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20190520.sql (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -0,0 +1,15 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4819 Add configuration setting for disabling Learning Outcome quick add by authors +INSERT INTO lams_configuration VALUES +('LearningOutcomeQuickAddEnable', 'true', 'config.learning.outcome.add.enable', 'config.header.features', 'BOOLEAN', 1); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java =================================================================== diff -u -r781bea2da1fdfb017f99d0a389de8a4d83704cf3 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision 781bea2da1fdfb017f99d0a389de8a4d83704cf3) +++ lams_common/src/java/org/lamsfoundation/lams/util/ConfigurationKeys.java (.../ConfigurationKeys.java) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,7 +47,7 @@ public static String LAMS_EAR_DIR = "EARDir"; public static String SMTP_SERVER = "SMTPServer"; - + public static String SMTP_PORT = "SMTPPort"; public static String LAMS_ADMIN_EMAIL = "LamsSupportEmail"; @@ -86,7 +86,7 @@ /** Default locale for the server. Originally en_AU */ public static String SERVER_LANGUAGE = "ServerLanguage"; - + /** * Default country for the server. Originally AU */ @@ -115,11 +115,11 @@ public static String ALLOW_DIRECT_LESSON_LAUNCH = "AllowDirectLessonLaunch"; public static String ALLOW_EDIT_ON_FLY = "AllowLiveEdit"; - + public static String ALLOW_KUMALIVE = "AllowKumalive"; - + public static String DISPLAY_PORTRAIT = "DisplayPortrait"; - + public static String ENABLE_PORTRAIT_EDITING = "EnablePortraitEditing"; public static String SHOW_ALL_MY_LESSON_LINK = "ShowAllMyLessonLink"; @@ -221,11 +221,11 @@ public static String SMTP_AUTH_USER = "SMTPUser"; public static String SMTP_AUTH_PASSWORD = "SMTPPassword"; - + public static String SMTP_AUTH_SECURITY = "SMTPAuthSecurity"; public static String PROFILE_EDIT_ENABLE = "ProfileEditEnable"; - + public static String FORGOT_YOUR_PASSWORD_LINK_ENABLE = "EnableForgotYourPasswordLink"; public static String PROFILE_PARTIAL_EDIT_ENABLE = "ProfilePartialEditEnable"; @@ -260,36 +260,38 @@ // LDEV-3961 public static String SITE_NAME = "SiteName"; - - // LDEV-4023 Password policy + + // LDEV-4023 Password policy public static String PASSWORD_POLICY_MINIMUM_CHARACTERS = "PasswordPolicyMinChars"; public static String PASSWORD_POLICY_UPPERCASE = "PasswordPolicyUppercase"; - + public static String PASSWORD_POLICY_LOWERCASE = "PasswordPolicyLowercase"; - + public static String PASSWORD_POLICY_NUMERICS = "PasswordPolicyNumerics"; - + public static String PASSWORD_POLICY_SYMBOLS = "PasswordPolicySymbols"; - + // LDEV-4049 Option for not displaying stacktraces in config settings public static String ERROR_STACK_TRACE = "ErrorStackTrace"; - + // LDEV-4030 Disable login for a few minutes after X number of attempts public static String FAILED_ATTEMPTS = "FailedAttempts"; - + public static String LOCK_OUT_TIME = "LockOutTime"; // LDEV-4144 public static String SHOW_TIMEZONE_WARNING = "ShowTimezoneWarning"; // LDEV-4594 / LDEV-4583 Allow/Block access to index.do for integration learners. Default to false - do not allow direct access. public static String ALLOW_DIRECT_ACCESS_FOR_INTEGRATION_LEARNERS = "AllowDirectAccessIntgrtnLrnr"; - + // LDEV-4755 Antivirus public static String ANTIVIRUS_ENABLE = "AntivirusEnable"; public static String ANTIVIRUS_HOST = "AntivirusHost"; public static String ANTIVIRUS_PORT = "AntivirusPort"; - + // LDEV-4819 + public static String LEARNING_OUTCOME_QUICK_ADD_ENABLE = "LearningOutcomeQuickAddEnable"; + } Index: lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_gradebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_learning/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_monitoring/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_assessment/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_chat/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_daco/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_doku/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_forum/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_gmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_images/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_imscc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_lamc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_laqa/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_larsrc/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_leader/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_mindmap/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_nb/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_notebook/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_pixlr/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_preview/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_sbmt/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_scratchie/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_scribe/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_spreadsheet/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_survey/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_task/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_vote/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_wiki/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_tool_zoom/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel }); Index: lams_www/web/WEB-INF/tags/OutcomeAuthor.tag =================================================================== diff -u -r298ac30bd04d6cdffdbbc42d1ceec29831809dc7 -rba2b4e0d8f708d647ab75bf4db71559dfb249e07 --- lams_www/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision 298ac30bd04d6cdffdbbc42d1ceec29831809dc7) +++ lams_www/web/WEB-INF/tags/OutcomeAuthor.tag (.../OutcomeAuthor.tag) (revision ba2b4e0d8f708d647ab75bf4db71559dfb249e07) @@ -47,6 +47,7 @@ }, // keep mapped outcome IDs for search result filtering outcomeMappingIds${outcomeTagId} = [], + outcomeAddEnabled = true, outcomeExistingNoneLabel = '', outcomeCreateNewLabel = '', @@ -61,9 +62,15 @@ 'response' : function(event, ui) { // filter out already mapped outcomes var index = ui.content.length - 1, - term = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // if result is empty, term and outcome add enabled come as objects (label, value) + // if there are results, they come as simple values + outcomeAddEnabled = ui.content[index] instanceof Object ? ui.content[index].label : ui.content[index], + // convert to boolean + outcomeAddEnabled = outcomeAddEnabled == 'true', + term = ui.content[index - 1] instanceof Object ? ui.content[index - 1].label : ui.content[index - 1], sameNameFound = false; - ui.content.splice(index, 1); + index--; + ui.content.splice(index, 2); while(index--) { var label = ui.content[index].label; if (label.split('(')[0].trim() == term) { @@ -74,7 +81,7 @@ ui.content.splice(index, 1); } } - if (!sameNameFound) { + if (outcomeAddEnabled && !sameNameFound) { ui.content.push({ 'label' : term + ' ' + outcomeCreateNewLabel });