Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r0d28a3c01e2b55f13d04519f84de3d290d8ac60c -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 0d28a3c01e2b55f13d04519f84de3d290d8ac60c) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -566,7 +566,6 @@ authoring.fla.ok.button =OK authoring.fla.cancel.button =Cancel authoring.fla.clear.all.button =Clear all -authoring.fla.refresh.button =Refresh authoring.fla.remove.condition.button =Remove authoring.fla.properties.dialog.title =Properties authoring.fla.group.naming.dialog.title =Group Naming @@ -593,7 +592,6 @@ authoring.fla.default.range.condition.title.prefix =Untitled authoring.fla.clear.all.confirm =There are conditions linked to an existing branch.\\nDo you wish to remove them? authoring.fla.remove.condition.confirm =This condition is linked to an existing branch.\\nDo you wish to remove it? -authoring.fla.refresh.conditions.confirm =You are about to update your conditions for the selected output definition.\\n\ This will clear all links to existing branches.\\nDo you wish to continue? authoring.fla.conditions.to.default.gate.state.confirm =All remaining conditions will be mapped to the selected gate\\'s closed state authoring.fla.conditions.to.default.branch.confirm =All remaining conditions will be mapped to the default branch authoring.fla.groups.to.default.branch.confirm =All remaining groups will be mapped to the default branch Index: lams_central/conf/language/lams/ApplicationResources_el_GR.properties =================================================================== diff -u -ref7a0592577864061f4c9d25ab55c1969636a722 -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/conf/language/lams/ApplicationResources_el_GR.properties (.../ApplicationResources_el_GR.properties) (revision ef7a0592577864061f4c9d25ab55c1969636a722) +++ lams_central/conf/language/lams/ApplicationResources_el_GR.properties (.../ApplicationResources_el_GR.properties) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -566,7 +566,6 @@ authoring.fla.ok.button =\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9 authoring.fla.cancel.button =\u0391\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7 authoring.fla.clear.all.button =\u0395\u03ba\u03ba\u03b1\u03b8\u03ac\u03c1\u03b9\u03c3\u03b7 \u03cc\u03bb\u03c9\u03bd -authoring.fla.refresh.button =\u0391\u03bd\u03b1\u03bd\u03ad\u03c9\u03c3\u03b7 authoring.fla.remove.condition.button =\u0391\u03c6\u03b1\u03af\u03c1\u03b5\u03c3\u03b7 authoring.fla.properties.dialog.title =\u0399\u03b4\u03b9\u03cc\u03c4\u03b7\u03c4\u03b5\u03c2 authoring.fla.group.naming.dialog.title =\u038c\u03bd\u03bf\u03bc\u03b1 \u03bf\u03bc\u03ac\u03b4\u03b1\u03c2 @@ -593,7 +592,6 @@ authoring.fla.default.range.condition.title.prefix =\u0391\u03bd\u03ce\u03bd\u03c5\u03bc\u03bf authoring.fla.clear.all.confirm =\u03a5\u03c0\u03ac\u03c1\u03c7\u03bf\u03c5\u03bd \u03c3\u03c5\u03bd\u03b8\u03ae\u03ba\u03b5\u03c2 \u03c0\u03bf\u03c5 \u03c3\u03c5\u03bd\u03b4\u03ad\u03bf\u03bd\u03c4\u03b1\u03b9 \u03c3\u03b5 \u03ad\u03bd\u03b1 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd \u03ba\u03bb\u03ac\u03b4\u03bf. \\ n \u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03c4\u03b9\u03c2 \u03b1\u03c6\u03b1\u03b9\u03c1\u03ad\u03c3\u03b5\u03c4\u03b5; authoring.fla.remove.condition.confirm =\u0397 \u03c3\u03c5\u03bd\u03b8\u03ae\u03ba\u03b7 \u03c3\u03c5\u03bd\u03b4\u03ad\u03b5\u03c4\u03b1\u03b9 \u03bc\u03b5 \u03ad\u03bd\u03b1 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd \u03ba\u03bb\u03ac\u03b4\u03bf. \\n \u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03b1\u03c1\u03b3\u03ae\u03c3\u03b5\u03c4\u03b5; -authoring.fla.refresh.conditions.confirm =\u0395\u03af\u03c3\u03c4\u03b5 \u03ad\u03c4\u03bf\u03b9\u03bc\u03bf\u03b9 \u03bd\u03b1 \u03b5\u03bd\u03b7\u03bc\u03b5\u03c1\u03ce\u03c3\u03b5\u03c4\u03b5 \u03c4\u03b9\u03c2 \u03c3\u03c5\u03bd\u03b8\u03ae\u03ba\u03b5\u03c2 \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03b5\u03c0\u03b9\u03bb\u03b5\u03b3\u03bc\u03ad\u03bd\u03b7 \u03ad\u03be\u03bf\u03b4\u03bf.\\n \ \u0391\u03c5\u03c4\u03cc \u03b8\u03b1 \u03ba\u03b1\u03b8\u03b1\u03c1\u03af\u03c3\u03b5\u03b9 \u03cc\u03bb\u03b5\u03c2 \u03c4\u03b9\u03c2 \u03c3\u03c5\u03bd\u03b4\u03ad\u03c3\u03b5\u03b9\u03c2 \u03c3\u03c4\u03bf\u03c5\u03c2 \u03c5\u03c0\u03ac\u03c1\u03c7\u03bf\u03bd\u03c4\u03b5\u03c2 \u03ba\u03bb\u03ac\u03b4\u03bf\u03c5\u03c2. \\n \u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03bd\u03b1 \u03c3\u03c5\u03bd\u03b5\u03c7\u03af\u03c3\u03b5\u03c4\u03b5; authoring.fla.conditions.to.default.gate.state.confirm =\u038c\u03bb\u03b5\u03c2 \u03bf\u03b9 \u03c5\u03c0\u03cc\u03bb\u03bf\u03b9\u03c0\u03b5\u03c2 \u03c3\u03c5\u03bd\u03b8\u03ae\u03ba\u03b5\u03c2 \u03b8\u03b1 \u03b1\u03c0\u03b5\u03b9\u03ba\u03bf\u03bd\u03af\u03b6\u03bf\u03c5\u03bd \u03c4\u03b7\u03bd \u03b5\u03c0\u03b9\u03bb\u03b5\u03b3\u03bc\u03ad\u03bd\u03b7 \u03c0\u03cd\u03bb\u03b7 \\ 's \u03c9\u03c2 \u03ba\u03bb\u03b5\u03b9\u03c3\u03c4\u03ae. authoring.fla.conditions.to.default.branch.confirm =\u038c\u03bb\u03b5\u03c2 \u03bf\u03b9 \u03c5\u03c0\u03cc\u03bb\u03bf\u03b9\u03c0\u03b5\u03c2 \u03c3\u03c5\u03bd\u03b8\u03ae\u03ba\u03b5\u03c2 \u03b8\u03b1 \u03b1\u03bd\u03c4\u03b9\u03c3\u03c4\u03bf\u03b9\u03c7\u03af\u03b6\u03bf\u03bd\u03c4\u03b1\u03b9 \u03c3\u03c4\u03bf\u03bd \u03c0\u03c1\u03bf\u03b5\u03c0\u03b9\u03bb\u03b5\u03b3\u03bc\u03ad\u03bd\u03bf \u03ba\u03bb\u03ac\u03b4\u03bf authoring.fla.groups.to.default.branch.confirm =\u038c\u03bb\u03b5\u03c2 \u03bf\u03b9 \u03c5\u03c0\u03cc\u03bb\u03bf\u03b9\u03c0\u03b5\u03c2 \u03bf\u03bc\u03ac\u03b4\u03b5\u03c2 \u03b8\u03b1 \u03c3\u03c5\u03bd\u03b4\u03ad\u03bf\u03bd\u03c4\u03b1\u03b9 \u03c3\u03c4\u03bf\u03bd \u03c0\u03c1\u03bf\u03b5\u03c0\u03b9\u03bb\u03b5\u03b3\u03bc\u03ad\u03bd\u03bf \u03ba\u03bb\u03ac\u03b4\u03bf Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r0d28a3c01e2b55f13d04519f84de3d290d8ac60c -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 0d28a3c01e2b55f13d04519f84de3d290d8ac60c) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -566,7 +566,6 @@ authoring.fla.ok.button =OK authoring.fla.cancel.button =Cancel authoring.fla.clear.all.button =Clear all -authoring.fla.refresh.button =Refresh authoring.fla.remove.condition.button =Remove authoring.fla.properties.dialog.title =Properties authoring.fla.group.naming.dialog.title =Group Naming @@ -593,7 +592,6 @@ authoring.fla.default.range.condition.title.prefix =Untitled authoring.fla.clear.all.confirm =There are conditions linked to an existing branch.\\nDo you wish to remove them? authoring.fla.remove.condition.confirm =This condition is linked to an existing branch.\\nDo you wish to remove it? -authoring.fla.refresh.conditions.confirm =You are about to update your conditions for the selected output definition.\\n\ This will clear all links to existing branches.\\nDo you wish to continue? authoring.fla.conditions.to.default.gate.state.confirm =All remaining conditions will be mapped to the selected gate\\'s closed state authoring.fla.conditions.to.default.branch.confirm =All remaining conditions will be mapped to the default branch authoring.fla.groups.to.default.branch.confirm =All remaining groups will be mapped to the default branch Index: lams_central/web/authoring/authoring.jsp =================================================================== diff -u -r38831652c5cf66e8ee70b2ccd86383bb16ce35fc -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 38831652c5cf66e8ee70b2ccd86383bb16ce35fc) +++ lams_central/web/authoring/authoring.jsp (.../authoring.jsp) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -249,8 +249,6 @@ CLEAR_ALL_CONFIRM : decoderDiv.html('').text(), REMOVE_CONDITION_CONFIRM : decoderDiv.html('').text(), - - REFRESH_CONDITIONS_CONFIRM : decoderDiv.html('').text(), CONDITIONS_TO_DEFAULT_GATE_STATE_CONFIRM : decoderDiv.html('').text(), @@ -1055,11 +1053,6 @@ - - Index: lams_central/web/includes/javascript/authoring/authoringActivity.js =================================================================== diff -u -rc0139ca013c585dddf14207a53412df2b7f65924 -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision c0139ca013c585dddf14207a53412df2b7f65924) +++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -1287,7 +1287,7 @@ getOutputDefinitions : function(activity){ if (!activity.toolID) { return; - } + } $.ajax({ url : LAMS_URL + 'authoring/author.do', @@ -1306,10 +1306,10 @@ if (this.isDefaultGradebookMark){ activity.gradebookToolOutputDefinitionName = this.name; return false; - } + } }); } - } + } }); }, @@ -1401,7 +1401,41 @@ } }, + /** + * Refresh conditions of complex output definitions from Tool activity + */ + refreshOutputConditions : function(activity){ + if (!activity.toolID) { + return; + } + + $.ajax({ + url : LAMS_URL + 'authoring/author.do', + data : { + 'method' : 'getToolOutputDefinitions', + 'toolContentID' : activity.toolContentID + || layout.toolMetadata[activity.learningLibraryID].defaultToolContentID + }, + cache : false, + async: false, + dataType : 'json', + success : function(response) { + // find the matching existing output and replace its conditions + $.each(response, function(){ + var output = this; + if (output.conditions) { + $.each(activity.outputDefinitions, function(){ + if (output.name == this.name) { + this.conditions = output.conditions; + } + }); + } + }); + } + }); + }, + /** * Deletes the given activity. */ @@ -1656,4 +1690,4 @@ branchingActivity.longestBranchLength = longestBranchLength; } -}; \ No newline at end of file +}; Index: lams_central/web/includes/javascript/authoring/authoringProperty.js =================================================================== diff -u -r38831652c5cf66e8ee70b2ccd86383bb16ce35fc -r3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0 --- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 38831652c5cf66e8ee70b2ccd86383bb16ce35fc) +++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 3cf8e8bc79ba0a47cc19adeb1caa23284a3aedd0) @@ -983,12 +983,6 @@ } }); - $('#outputConditionsRefreshButton', outputConditionsDialogContents).click(function(){ - // get output definitions again - $(layout.outputConditionsDialog).data('refreshDefinitions')(); - $(layout.outputConditionsDialog).data('buildContent')(true); - }); - $('#outputConditionsCancelButton', outputConditionsDialogContents).click(function(){ layout.outputConditionsDialog.modal('hide'); }); @@ -1040,20 +1034,9 @@ 'close' : null, 'data' : { /** - * Get output definitions from a Tool activity - */ - 'refreshDefinitions' : function(){ - var dialog = layout.outputConditionsDialog, - activity = dialog.data('parentObject'); - // sets the output definitions and their default value - ActivityLib.getOutputDefinitions(activity.input); - }, - - - /** * Link output data to UI widgets */ - 'buildContent' : function(useDefaultConditions) { + 'buildContent' : function() { var dialog = layout.outputConditionsDialog, activity = dialog.data('parentObject'), outputSelect = $('#outputSelect', dialog), @@ -1064,10 +1047,6 @@ // remove all previously defined outputs $('option[value!="none"]', outputSelect).remove(); - if (!activity.input.outputDefinitions) { - dialog.data('refreshDefinitions')(); - } - if (activity.input.outputDefinitions) { // build output dropdown and bind data to each option $.each(activity.input.outputDefinitions,function(){ @@ -1099,19 +1078,20 @@ }); } - dialog.data('outputChange')(useDefaultConditions); + dialog.data('outputChange')(); }, /** * Rebuild dialog content based on selected output */ - 'outputChange' : function(useDefaultConditions){ + 'outputChange' : function(){ var dialog = layout.outputConditionsDialog, activity = dialog.data('parentObject'), outputOption = $('#outputSelect option:selected', dialog), output = outputOption.data('output'); + $('.outputSelectDependent', dialog).hide(); // no output = "none" option was selected if (!output) { @@ -1127,47 +1107,35 @@ complexOutputWidgets.show(); // build a list with immutable conditoon names var list = $('ul', complexConditionNames), - entries = []; - $('li', list).remove(); + mappingEntries = {}; - // see if there are existing mappings; if so, use conditions name from there instead from tool activity's output - $.each(activity.conditionsToBranches, function(){ - if (this.branch && output.name == this.condition.name.split('#')[0]) { - entries.push(this); - } - }); + // extract existing mappings from the list and remove the list + $('li', list).each(function(){ + var mappingEntry = $(this).data('mappingEntry'); + mappingEntries[mappingEntry.condition.conditionID] = mappingEntry; + }).remove(); - // if user choosed to refresh the conditions and there are existing mappings, ask him to confirm - if (entries.length == 0 - || (useDefaultConditions - && confirm(LABELS.REFRESH_CONDITIONS_CONFIRM))) { - if (entries.length > 0) { - // clear existing mappings - entries = []; - activity.conditionsToBranches = []; - } - - if (output.conditions) { - // build list using conditions from Tool activity output definitions - $.each(output.conditions, function(){ - entries.push({ - 'condition' : { - 'name' : this.name, - 'displayName' : this.displayName, - 'type' : 'OUTPUT_COMPLEX', - 'conditionID' : this.conditionId, - 'toolActivityUIID' : output.toolActivityUIID - } - }); - }); - } + PropertyLib.validateConditionMappings(activity.input); + + if (output.conditions) { + // build list using conditions from Tool activity output definitions + $.each(output.conditions, function(){ + // use an existing mapping or build a new one + var mappingEntry = mappingEntries[this.conditionId] || {}; + + mappingEntry.condition = { + 'name' : this.name, + 'displayName' : this.displayName, + 'type' : 'OUTPUT_COMPLEX', + 'conditionID' : this.conditionId, + 'toolActivityUIID' : output.toolActivityUIID + }; + + $('
  • ').text(this.displayName) + .data('mappingEntry', mappingEntry) + .appendTo(list); + }); } - - $.each(entries, function(){ - $('
  • ').text(this.condition.displayName) - .data('mappingEntry', this) - .appendTo(list); - }); } else { // show menu and list of range conditions rangeOutputWidgets.show(); @@ -1884,11 +1852,11 @@ $.each(layout.activities, function() { var consumer = this.branchingActivity || this; // check if the modified activity is an input for a gate or branching activity - if (activity == consumer.input && consumer.conditionsToBranches.length > 0) { + if (activity == consumer.input) { if (conditionIDs == null) { // refresh conditions in the modified activity conditionIDs = []; - ActivityLib.getOutputDefinitions(activity); + ActivityLib.refreshOutputConditions(activity); $.each(activity.outputDefinitions, function(){ if (this.conditions) { $.each(this.conditions, function(){ @@ -1903,7 +1871,7 @@ $.each(consumer.conditionsToBranches, function(){ // a mapped condition is now missing // remove it and inform the user - if (conditionIDs.indexOf(this.condition.conditionID) == -1) { + if (this.condition.conditionID && conditionIDs.indexOf(this.condition.conditionID) == -1) { isBroken = true; } else { newMapping.push(this);