diff --git a/admin/tool/behat/tests/behat/data_generators.feature b/admin/tool/behat/tests/behat/data_generators.feature
index 0f3e3afc8ee..cac5f633456 100644
--- a/admin/tool/behat/tests/behat/data_generators.feature
+++ b/admin/tool/behat/tests/behat/data_generators.feature
@@ -439,7 +439,7 @@ Feature: Set up contextual data for tests
And I follow "Edit Test Outcome Grade Item 1"
And the field "Outcome" matches value "Grade outcome 1"
And I expand all fieldsets
- And "//div[contains(@class, 'fitem')]/div[contains(@class, 'fitemtitle')]/div[contains(@class, fstaticlabel) and contains(., 'Grade category')]/../../div[contains(@class, 'felement') and contains(., 'Grade category 1')]" "xpath_element" should exist
+ And I should see "Grade category 1" in the "Grade category" "form_row"
And I press "Cancel"
Scenario: Add a block
diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js
index 6d7ad52ad9f..41d64eaa381 100644
--- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js
+++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js
@@ -56,7 +56,7 @@ M.availability_completion.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_completion.form.addedEvents) {
M.availability_completion.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Whichever dropdown changed, just update the form.
M.core_availability.form.update();
diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js
index 17f1813fa3d..e780555c04a 100644
--- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js
+++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.util.get_string("title","availability_completion")+' '+''+M.util.get_string("label_cm","availability_completion")+" "+''+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=' '+M.util.get_string("label_completion","availability_completion")+' '+''+M.util.get_string("option_complete","availability_completion")+" "+''+M.util.get_string("option_incomplete","availability_completion")+" "+''+M.util.get_string("option_pass","availability_completion")+" "+''+M.util.get_string("option_fail","availability_completion")+" "+" ";var s=e.Node.create(""+n+" ");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
+YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.util.get_string("title","availability_completion")+' '+''+M.util.get_string("label_cm","availability_completion")+" "+''+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=' '+M.util.get_string("label_completion","availability_completion")+' '+''+M.util.get_string("option_complete","availability_completion")+" "+''+M.util.get_string("option_incomplete","availability_completion")+" "+''+M.util.get_string("option_pass","availability_completion")+" "+''+M.util.get_string("option_fail","availability_completion")+" "+" ";var s=e.Node.create(""+n+" ");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js
index 6d7ad52ad9f..41d64eaa381 100644
--- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js
+++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form.js
@@ -56,7 +56,7 @@ M.availability_completion.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_completion.form.addedEvents) {
M.availability_completion.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Whichever dropdown changed, just update the form.
M.core_availability.form.update();
diff --git a/availability/condition/completion/yui/src/form/js/form.js b/availability/condition/completion/yui/src/form/js/form.js
index be694ed49ad..89b1058e2b5 100644
--- a/availability/condition/completion/yui/src/form/js/form.js
+++ b/availability/condition/completion/yui/src/form/js/form.js
@@ -54,7 +54,7 @@ M.availability_completion.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_completion.form.addedEvents) {
M.availability_completion.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Whichever dropdown changed, just update the form.
M.core_availability.form.update();
diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js
index e338aac9c7e..7530a28bf2b 100644
--- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js
+++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-debug.js
@@ -72,7 +72,7 @@ M.availability_date.form.getNode = function(json) {
if (!M.availability_date.form.addedEvents) {
M.availability_date.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the direction, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js
index eeb12a37229..8a9bd5d3142 100644
--- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js
+++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.util.get_string("direction_before","availability_date")+' '+''+M.util.get_string("direction_label","availability_date")+" "+''+''+M.util.get_string("direction_from","availability_date")+" "+''+M.util.get_string("direction_until","availability_date")+" "+" "+this.html,r=e.Node.create(""+n+" ");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one("#fitem_id_availabilityconditionsjson");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
+YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.util.get_string("direction_before","availability_date")+' '+''+M.util.get_string("direction_label","availability_date")+" "+''+''+M.util.get_string("direction_from","availability_date")+" "+''+M.util.get_string("direction_until","availability_date")+" "+" "+this.html,r=e.Node.create(""+n+" ");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one(".availability-field");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
diff --git a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
index e338aac9c7e..7530a28bf2b 100644
--- a/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
+++ b/availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
@@ -72,7 +72,7 @@ M.availability_date.form.getNode = function(json) {
if (!M.availability_date.form.addedEvents) {
M.availability_date.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the direction, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/date/yui/src/form/js/form.js b/availability/condition/date/yui/src/form/js/form.js
index 2c5df1e523f..e1ee836d225 100644
--- a/availability/condition/date/yui/src/form/js/form.js
+++ b/availability/condition/date/yui/src/form/js/form.js
@@ -70,7 +70,7 @@ M.availability_date.form.getNode = function(json) {
if (!M.availability_date.form.addedEvents) {
M.availability_date.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the direction, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js
index f5c41def5cb..734994e22a5 100644
--- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js
+++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-debug.js
@@ -86,7 +86,7 @@ M.availability_grade.form.getNode = function(json) {
if (!M.availability_grade.form.addedEvents) {
M.availability_grade.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the grade item, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js
index c7467b5fdd6..4d4a50c63bf 100644
--- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js
+++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=""+M.util.get_string("title","availability_grade")+' '+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=' '+M.util.get_string("option_min","availability_grade")+' '+M.util.get_string("label_min","availability_grade")+' % '+''+' '+M.util.get_string("option_max","availability_grade")+' '+M.util.get_string("label_max","availability_grade")+' % ';var s=e.Node.create(""+n+" ");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
+YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n=""+M.util.get_string("title","availability_grade")+' '+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=' '+M.util.get_string("option_min","availability_grade")+' '+M.util.get_string("label_min","availability_grade")+' % '+''+' '+M.util.get_string("option_max","availability_grade")+' '+M.util.get_string("label_max","availability_grade")+' % ';var s=e.Node.create(""+n+" ");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one(".availability-field");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
diff --git a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js
index f5c41def5cb..734994e22a5 100644
--- a/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js
+++ b/availability/condition/grade/yui/build/moodle-availability_grade-form/moodle-availability_grade-form.js
@@ -86,7 +86,7 @@ M.availability_grade.form.getNode = function(json) {
if (!M.availability_grade.form.addedEvents) {
M.availability_grade.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the grade item, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grade/yui/src/form/js/form.js b/availability/condition/grade/yui/src/form/js/form.js
index 7a51507e37c..0286eb7a57f 100644
--- a/availability/condition/grade/yui/src/form/js/form.js
+++ b/availability/condition/grade/yui/src/form/js/form.js
@@ -84,7 +84,7 @@ M.availability_grade.form.getNode = function(json) {
if (!M.availability_grade.form.addedEvents) {
M.availability_grade.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// For the grade item, just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js
index a1b8a652531..9ddaa663918 100644
--- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js
+++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-debug.js
@@ -58,7 +58,7 @@ M.availability_group.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_group.form.addedEvents) {
M.availability_group.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js
index 39491185315..040d3951568 100644
--- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js
+++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n=""+M.util.get_string("title","availability_group")+' '+''+''+M.util.get_string("choosedots","moodle")+" "+''+M.util.get_string("anygroup","availability_group")+" ";for(var r=0;r'+i.name+""}n+=" ";var s=e.Node.create(""+n+" ");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
+YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n=""+M.util.get_string("title","availability_group")+' '+''+''+M.util.get_string("choosedots","moodle")+" "+''+M.util.get_string("anygroup","availability_group")+" ";for(var r=0;r'+i.name+""}n+=" ";var s=e.Node.create(""+n+" ");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
diff --git a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js
index a1b8a652531..9ddaa663918 100644
--- a/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js
+++ b/availability/condition/group/yui/build/moodle-availability_group-form/moodle-availability_group-form.js
@@ -58,7 +58,7 @@ M.availability_group.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_group.form.addedEvents) {
M.availability_group.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/group/yui/src/form/js/form.js b/availability/condition/group/yui/src/form/js/form.js
index f9ec44f1052..84eaa3391b1 100644
--- a/availability/condition/group/yui/src/form/js/form.js
+++ b/availability/condition/group/yui/src/form/js/form.js
@@ -56,7 +56,7 @@ M.availability_group.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_group.form.addedEvents) {
M.availability_group.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js
index f3d616a5206..c60c6816e51 100644
--- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js
+++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-debug.js
@@ -53,7 +53,7 @@ M.availability_grouping.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_grouping.form.addedEvents) {
M.availability_grouping.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js
index 34c9759f0cc..5f1bcbc4abc 100644
--- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js
+++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n=""+M.util.get_string("title","availability_grouping")+' '+''+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=" ";var s=e.Node.create(""+n+" ");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
+YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n=""+M.util.get_string("title","availability_grouping")+' '+''+''+M.util.get_string("choosedots","moodle")+" ";for(var r=0;r'+i.name+""}n+=" ";var s=e.Node.create(""+n+" ");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
diff --git a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js
index f3d616a5206..c60c6816e51 100644
--- a/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js
+++ b/availability/condition/grouping/yui/build/moodle-availability_grouping-form/moodle-availability_grouping-form.js
@@ -53,7 +53,7 @@ M.availability_grouping.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_grouping.form.addedEvents) {
M.availability_grouping.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/grouping/yui/src/form/js/form.js b/availability/condition/grouping/yui/src/form/js/form.js
index b0fd7c969a4..ad3135e3aae 100644
--- a/availability/condition/grouping/yui/src/form/js/form.js
+++ b/availability/condition/grouping/yui/src/form/js/form.js
@@ -51,7 +51,7 @@ M.availability_grouping.form.getNode = function(json) {
// Add event handlers (first time only).
if (!M.availability_grouping.form.addedEvents) {
M.availability_grouping.form.addedEvents = true;
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
// Just update the form fields.
M.core_availability.form.update();
diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js
index be46a7e9a87..9909ea23649 100644
--- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js
+++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-debug.js
@@ -91,7 +91,7 @@ M.availability_profile.form.getNode = function(json) {
ancestorNode.one('input[name=value]').set('disabled', novalue);
M.core_availability.form.update();
};
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
updateForm(this);
}, '.availability_profile select');
diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js
index 63a87d32db6..303b419e58a 100644
--- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js
+++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form-min.js
@@ -1 +1 @@
-YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n=''+M.util.get_string("conditiontitle","availability_profile")+" "+''+''+M.util.get_string("choosedots","moodle")+" ",r;for(var i=0;i'+r.display+"";for(i=0;i'+r.display+"";n+=' '+M.util.get_string("label_operator","availability_profile")+' ';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i'+M.util.get_string("op_"+s[i],"availability_profile")+"";n+=' '+M.util.get_string("label_value","availability_profile")+' ';var o=e.Node.create(""+n+" ");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
+YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n=''+M.util.get_string("conditiontitle","availability_profile")+" "+''+''+M.util.get_string("choosedots","moodle")+" ",r;for(var i=0;i'+r.display+"";for(i=0;i'+r.display+"";n+=' '+M.util.get_string("label_operator","availability_profile")+' ';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i'+M.util.get_string("op_"+s[i],"availability_profile")+"";n+=' '+M.util.get_string("label_value","availability_profile")+' ';var o=e.Node.create(""+n+" ");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one(".availability-field");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
diff --git a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js
index be46a7e9a87..9909ea23649 100644
--- a/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js
+++ b/availability/condition/profile/yui/build/moodle-availability_profile-form/moodle-availability_profile-form.js
@@ -91,7 +91,7 @@ M.availability_profile.form.getNode = function(json) {
ancestorNode.one('input[name=value]').set('disabled', novalue);
M.core_availability.form.update();
};
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
updateForm(this);
}, '.availability_profile select');
diff --git a/availability/condition/profile/yui/src/form/js/form.js b/availability/condition/profile/yui/src/form/js/form.js
index 5336589fe10..db73335bdca 100644
--- a/availability/condition/profile/yui/src/form/js/form.js
+++ b/availability/condition/profile/yui/src/form/js/form.js
@@ -89,7 +89,7 @@ M.availability_profile.form.getNode = function(json) {
ancestorNode.one('input[name=value]').set('disabled', novalue);
M.core_availability.form.update();
};
- var root = Y.one('#fitem_id_availabilityconditionsjson');
+ var root = Y.one('.availability-field');
root.delegate('change', function() {
updateForm(this);
}, '.availability_profile select');
diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js
index c75e14aa9d5..40b36ad0e46 100644
--- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js
+++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js
@@ -1154,4 +1154,14 @@ M.core_availability.DeleteIcon = function(toDelete) {
M.core_availability.DeleteIcon.prototype.span = null;
-}, '@VERSION@', {"requires": ["base", "node", "event", "panel", "moodle-core-notification-dialogue", "json"]});
+}, '@VERSION@', {
+ "requires": [
+ "base",
+ "node",
+ "event",
+ "event-delegate",
+ "panel",
+ "moodle-core-notification-dialogue",
+ "json"
+ ]
+});
diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js
index 76c433953ca..2668730afad 100644
--- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js
+++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js
@@ -1,3 +1,3 @@
YUI.add("moodle-core_availability-form",function(e,t){M.core_availability=M.core_availability||{},M.core_availability.form={plugins:{},field:null,mainDiv:null,rootList:null,idCounter:0,restrictByGroup:null,init:function(t){for(var n in t){var r=t[n],i=M[r[0]].form;i.init.apply(i,r)}this.field=e.one("#id_availabilityconditionsjson"),this.field.setAttribute("aria-hidden","true"),this.mainDiv=e.Node.create('
'),this.field.insert(this.mainDiv,"after");var s=this.field.get("value"),o=null;if(s!=="")try{o=e.JSON.parse(s)}catch(u){this.field.set("value","")}this.rootList=new M.core_availability.List(o,!0),this.mainDiv.appendChild(this.rootList.node),this.update(),this.rootList.renumber(),this.mainDiv.setAttribute("aria-live","polite"),this.field.ancestor("form").on("submit",function(){this.mainDiv.all("input,textarea,select").set("disabled",!0)},this),this.restrictByGroup=e.one("#restrictbygroup");if(this.restrictByGroup){this.restrictByGroup.on("click",this.addRestrictByGroup,this);var a=e.one("#id_groupmode"),f=e.one("#id_groupingid");a&&a.on("change",this.updateRestrictByGroup,this),f&&f.on("change",this.updateRestrictByGroup,this),this.updateRestrictByGroup()}},update:function(){var t=this.rootList.getValue(),n=[];this.rootList.fillErrors(n),n.length!==0&&(t.errors=n),this.field.set("value",e.JSON.stringify(t)),this.updateRestrictByGroup()},updateRestrictByGroup:function(){if(!this.restrictByGroup)return;if(this.rootList.getValue().op!=="&"){this.restrictByGroup.set("disabled",!0);return}var t=this.rootList.hasItemOfType("group")||this.rootList.hasItemOfType("grouping");if(t){this.restrictByGroup.set("disabled",!0);return}var n=e.one("#id_groupmode"),r=e.one("#id_groupingid");if((!n||Number(n.get("value"))===0)&&(!r||Number(r.get("value"))===0)){this.restrictByGroup.set("disabled",!0);return}this.restrictByGroup.set("disabled",!1)},addRestrictByGroup:function(t){t.preventDefault();var n=e.one("#id_groupingid"),r;n&&Number(n.get("value"))!==0?r=new M.core_availability.Item({type:"grouping",id:Number(n.get("value"))},!0):r=new M.core_availability.Item({type:"group"},!0),this.rootList.addChild(r),this.update(),this.rootList.renumber(),this.rootList.updateHtml()}},M.core_availability.plugin={allowAdd:!1,init:function(e,t,n){var r=e.replace(/^availability_/,"");this.allowAdd=t,M.core_availability.form.plugins[r]=this,this.initInner.apply(this,n)},initInner:function(){},getNode:function(){throw"getNode not implemented"},fillValue:function(){throw"fillValue not implemented"},fillErrors:function(){},focusAfterAdd:function(e){var t=e.one("input:not([disabled]),select:not([disabled])");t.focus()}},M.core_availability.List=function(t,n,r){this.children=[],n!==undefined&&(this.root=n),this.node=e.Node.create('"+'
'+'
'+M.util.get_string("none","moodle")+"
"+'
'),n||this.node.addClass("availability-childlist"),this.inner=this.node.one("> .availability-inner");var i=!0;n?(t&&t.show!==undefined&&(i=t.show),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.node.one(".availability-header").get("firstChild").insert(this.eyeIcon.span,"before")):r&&(t&&t.showc!==undefined&&(i=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.inner.insert(this.eyeIcon.span,"before"));if(!n){var s=new M.core_availability.DeleteIcon(this),o=this.node.one(".availability-none");o.appendChild(document.createTextNode(" ")),o.appendChild(s.span),o.appendChild(e.Node.create(''+M.util.get_string("invalid","availability")+" "))}var u=e.Node.create(''+M.util.get_string("addrestriction","availability")+" ");u.on("click",function(){this.clickAdd()},this),this.node.one("div.availability-button").appendChild(u);if(t){switch(t.op){case"&":case"|":this.node.one(".availability-neg").set("value","");break;case"!&":case"!|":this.node.one(".availability-neg").set("value","!")}switch(t.op){case"&":case"!&":this.node.one(".availability-op").set("value","&");break;case"|":case"!|":this.node.one(".availability-op").set("value","|")}for(var a=0;a0&&this.inner.one(".availability-children").appendChild(e.Node.create('
')),this.children.push(t),this.inner.one(".availability-children").appendChild(t.node)},M.core_availability.List.prototype.focusAfterAdd=function(){this.inner.one("button").focus()},M.core_availability.List.prototype.isIndividualShowIcons=function(){if(!this.root)throw"Can only call this on root list";var e=this.node.one(".availability-neg").get("value")==="!",t=this.node.one(".availability-op").get("value")==="|";return!e&&!t||e&&t},M.core_availability.List.prototype.renumber=function(e){var t={count:this.children.length},n;e===undefined?(t.number="",n=""):(t.number=e+":",n=e+".");var r=M.util.get_string("setheading","availability",t);this.node.one("> h3").set("innerHTML",r);for(var i=0;i0?(this.inner.one("> .availability-children").removeAttribute("aria-hidden"),this.inner.one("> .availability-none").setAttribute("aria-hidden","true"),this.inner.one("> .availability-header").removeAttribute("aria-hidden"),this.children.length>1?(this.inner.one(".availability-single").setAttribute("aria-hidden","true"),this.inner.one(".availability-multi").removeAttribute("aria-hidden")):(this.inner.one(".availability-single").removeAttribute("aria-hidden"),this.inner.one(".availability-multi").setAttribute("aria-hidden","true"))):(this.inner.one("> .availability-children").setAttribute("aria-hidden","true"),this.inner.one("> .availability-none").removeAttribute("aria-hidden"),this.inner.one("> .availability-header").setAttribute("aria-hidden","true"));if(this.root){var e=this.isIndividualShowIcons();for(var t=0;t .availability-children > .availability-connector span.label").each(function(e){e.set("innerHTML",r)})},M.core_availability.List.prototype.deleteDescendant=function(e){for(var t=0;t0&&(r.previous(".availability-connector")?r.previous(".availability-connector").remove():r.next(".availability-connector").remove()),this.inner.one("> .availability-children").removeChild(r),M.core_availability.form.update(),this.updateHtml(),this.inner.one("> .availability-button").one("button").focus(),!0}if(n instanceof M.core_availability.List){var i=n.deleteDescendant(e);if(i)return!0}}return!1},M.core_availability.List.prototype.clickAdd=function(){var t=e.Node.create(''+M.util.get_string("cancel","moodle")+"
"),n=t.one("button"),r={dialog:null},i=t.one("ul"),s,o,u,a;for(var f in M.core_availability.form.plugins){if(!M.core_availability.form.plugins[f].allowAdd)continue;s=e.Node.create(' '),o="availability_addrestriction_"+f,u=e.Node.create(''+M.util.get_string("title","availability_"+f)+" "),u.on("click",this.getAddHandler(f,r),this),s.appendChild(u),a=e.Node.create(''+M.util.get_string("description","availability_"+f)+" "),s.appendChild(a),i.appendChild(s)}s=e.Node.create(' '),o="availability_addrestriction_list_",u=e.Node.create(''+M.util.get_string("condition_group","availability")+" "),u.on("click",this.getAddHandler(null,r),this),s.appendChild(u),a=e.Node.create(''+M.util.get_string("condition_group_info","availability")+" "),s.appendChild(a),i.appendChild(s);var l={headerContent:M.util.get_string("addrestriction","availability"),bodyContent:t,additionalBaseClass:"availability-dialogue",draggable:!0,modal:!0,closeButton:!1,width:"450px"};r.dialog=new M.core.dialogue(l),r.dialog.show(),n.on("click",function(){r.dialog.destroy(),this.inner.one("> .availability-button").one("button").focus()},this)},M.core_availability.List.prototype.getAddHandler=function(e,t){return function(){var n;e?n=new M.core_availability.Item({type:e,creating:!0},this.root):n=new M.core_availability.List({c:[],showc:!0},!1,this.root),this.addChild(n),M.core_availability.form.update(),M.core_availability.form.rootList.renumber(),this.updateHtml(),t.dialog.destroy(),n.focusAfterAdd()}},M.core_availability.List.prototype.getValue=function(){var e={};e.op=this.node.one(".availability-neg").get("value")+this.node.one(".availability-op").get("value"),e.c=[];var t;for(t=0;t'+M.util.get_string("missingplugin","availability")+"")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('
');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(' '))},M.core_availability.Item.prototype.getValue=function(){var e={type:this.pluginType};return this.plugin&&this.plugin.fillValue(e,this.pluginNode),e},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create('');var r=e.Node.create(" ");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create(' ');var n=e.Node.create(' ');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","panel","moodle-core-notification-dialogue","json"]});
+.List.prototype.inner=null,M.core_availability.Item=function(t,n){this.pluginType=t.type,M.core_availability.form.plugins[t.type]===undefined?(this.plugin=null,this.pluginNode=e.Node.create(''+M.util.get_string("missingplugin","availability")+"
")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('
');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(' '))},M.core_availability.Item.prototype.getValue=function(){var e={type:this.pluginType};return this.plugin&&this.plugin.fillValue(e,this.pluginNode),e},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create(' ');var r=e.Node.create(" ");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create(' ');var n=e.Node.create(' ');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","event-delegate","panel","moodle-core-notification-dialogue","json"]});
diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js
index c75e14aa9d5..40b36ad0e46 100644
--- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js
+++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js
@@ -1154,4 +1154,14 @@ M.core_availability.DeleteIcon = function(toDelete) {
M.core_availability.DeleteIcon.prototype.span = null;
-}, '@VERSION@', {"requires": ["base", "node", "event", "panel", "moodle-core-notification-dialogue", "json"]});
+}, '@VERSION@', {
+ "requires": [
+ "base",
+ "node",
+ "event",
+ "event-delegate",
+ "panel",
+ "moodle-core-notification-dialogue",
+ "json"
+ ]
+});
diff --git a/availability/yui/src/form/meta/form.json b/availability/yui/src/form/meta/form.json
index 7905db3a714..8da9cad7f4c 100644
--- a/availability/yui/src/form/meta/form.json
+++ b/availability/yui/src/form/meta/form.json
@@ -4,6 +4,7 @@
"base",
"node",
"event",
+ "event-delegate",
"panel",
"moodle-core-notification-dialogue",
"json"
diff --git a/badges/tests/behat/award_badge.feature b/badges/tests/behat/award_badge.feature
index 508fd420c1e..206ac426cbd 100644
--- a/badges/tests/behat/award_badge.feature
+++ b/badges/tests/behat/award_badge.feature
@@ -31,7 +31,7 @@ Feature: Award badges
And I press "Enable access"
And I press "Continue"
And I click on "Admin User" "link"
- And I follow "Profile" in the open menu
+ And I choose "Profile" in the open action menu
And I follow "Edit profile"
And I expand all fieldsets
And I set the field "Phone" to "123456789"
@@ -204,7 +204,7 @@ Feature: Award badges
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Course completion"
- And I set the field with xpath "//fieldset/input[1]" to "0"
+ And I set the field with xpath ".//*[contains(., 'Minimum grade required')]/ancestor::*[contains(concat(' ', @class, ' '), ' fitem ')]//input[1]" to "0"
And I press "Save"
And I press "Enable access"
When I press "Continue"
diff --git a/blocks/comments/tests/behat/behat_block_comments.php b/blocks/comments/tests/behat/behat_block_comments.php
index ff5b2664a43..210a163535f 100644
--- a/blocks/comments/tests/behat/behat_block_comments.php
+++ b/blocks/comments/tests/behat/behat_block_comments.php
@@ -94,7 +94,7 @@ class behat_block_comments extends behat_base {
// Using xpath liternal to avoid possible problems with comments containing quotes.
$commentliteral = behat_context_helper::escape($comment);
- $commentxpath = "//div[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" .
+ $commentxpath = "//*[contains(concat(' ', normalize-space(@class), ' '), ' block_comments ')]" .
"/descendant::div[@class='comment-message'][contains(., $commentliteral)]";
$commentnode = $this->find('xpath', $commentxpath, $exception);
diff --git a/blocks/course_summary/tests/behat/block_course_summary_course.feature b/blocks/course_summary/tests/behat/block_course_summary_course.feature
index 65e7d9a2456..a33f66ec9c4 100644
--- a/blocks/course_summary/tests/behat/block_course_summary_course.feature
+++ b/blocks/course_summary/tests/behat/block_course_summary_course.feature
@@ -35,7 +35,7 @@ Feature: Course summary block used in a course
And I turn editing mode on
Then I should see "Proved the course summary block works!" in the "Course summary" "block"
And I should see "Course summary" in the "Course summary" "block"
- And I click on "Edit" "link" in the "Course summary" "block"
+ And I click on ".editbutton a" "css_element" in the "Course summary" "block"
Then I should see "Edit course settings" in the "h2" "css_element"
Scenario: Teacher can not see edit icon when edit mode is off
diff --git a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature
index 0655dc397d3..e8980b0ad5c 100644
--- a/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature
+++ b/blocks/course_summary/tests/behat/block_course_summary_frontpage.feature
@@ -26,7 +26,7 @@ Feature: Course summary block used on the frontpage
And I follow "Turn editing on"
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
And I should not see "Course summary" in the "Course/site summary" "block"
- And I click on "Edit" "link" in the "Course/site summary" "block"
+ And I click on ".editbutton a" "css_element" in the "Course/site summary" "block"
Then I should see "Front page settings" in the "h2" "css_element"
Scenario: Admin can not see edit icon when edit mode is off
diff --git a/blocks/recent_activity/tests/behat/structural_changes.feature b/blocks/recent_activity/tests/behat/structural_changes.feature
index 9f6d8da8109..380ea1e9c78 100644
--- a/blocks/recent_activity/tests/behat/structural_changes.feature
+++ b/blocks/recent_activity/tests/behat/structural_changes.feature
@@ -151,6 +151,7 @@ Feature: View structural changes in recent activity block
Then I should see "Added Forum" in the "Recent activity" "block"
And I should see "ForumNew" in the "Recent activity" "block"
And I log out
+ And I wait "1" seconds
And I log in as "student1"
And I follow "Course 1"
And I should see "Added Forum" in the "Recent activity" "block"
@@ -158,6 +159,7 @@ Feature: View structural changes in recent activity block
And I log out
# Update forum as a teacher after a second to ensure we have a new timestamp for recent activity.
And I wait "1" seconds
+ # Update forum as a teacher
And I log in as "teacher1"
And I follow "Course 1"
And I follow "ForumNew"
@@ -166,6 +168,7 @@ Feature: View structural changes in recent activity block
| name | ForumUpdated |
And I press "Save and return to course"
And I log out
+ And I wait "1" seconds
# Student 1 already saw that forum was created, now he can see that forum was updated
And I log in as "student1"
And I follow "Course 1"
@@ -174,6 +177,7 @@ Feature: View structural changes in recent activity block
And I should see "Updated Forum" in the "Recent activity" "block"
And I should see "ForumUpdated" in the "Recent activity" "block"
And I log out
+ And I wait "1" seconds
# Student 2 has bigger interval and he can see one entry that forum was created but with the new name
And I log in as "student2"
And I follow "Course 1"
@@ -182,12 +186,14 @@ Feature: View structural changes in recent activity block
And I should not see "Updated Forum" in the "Recent activity" "block"
And I should see "ForumUpdated" in the "Recent activity" "block"
And I log out
+ And I wait "1" seconds
# Delete forum as a teacher
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I delete "ForumUpdated" activity
And I log out
+ And I wait "1" seconds
# Students 1 and 2 see that forum was deleted
And I log in as "student1"
And I follow "Course 1"
@@ -197,6 +203,7 @@ Feature: View structural changes in recent activity block
And I should not see "ForumUpdated" in the "Recent activity" "block"
And I should see "Deleted Forum" in the "Recent activity" "block"
And I log out
+ And I wait "1" seconds
# Student 3 never knew that forum was created, so he does not see anything
And I log in as "student3"
And I follow "Course 1"
diff --git a/blocks/site_main_menu/tests/behat/edit_activities.feature b/blocks/site_main_menu/tests/behat/edit_activities.feature
index 1569419d25a..dc73b9d1f7b 100644
--- a/blocks/site_main_menu/tests/behat/edit_activities.feature
+++ b/blocks/site_main_menu/tests/behat/edit_activities.feature
@@ -11,7 +11,7 @@ Feature: Edit activities in main menu block
And I navigate to "Turn editing on" node in "Front page settings"
When I add a "Forum" to section "0" and I fill the form with:
| Forum name | My forum name |
- And I click on "Edit title" "link" in the "//div[contains(@class,'block_site_main_menu')]//li[contains(.,'My forum name')]" "xpath_element"
+ And I click on "Edit title" "link" in the "//*[contains(@class,'block_site_main_menu')]//li[contains(.,'My forum name')]" "xpath_element"
And I set the field "New name for activity My forum name" to "New forum name"
And I press key "13" in the field "New name for activity My forum name"
Then I should not see "My forum name"
diff --git a/blocks/social_activities/tests/behat/edit_activities.feature b/blocks/social_activities/tests/behat/edit_activities.feature
index 9433996cac5..07b58e391e0 100644
--- a/blocks/social_activities/tests/behat/edit_activities.feature
+++ b/blocks/social_activities/tests/behat/edit_activities.feature
@@ -21,7 +21,7 @@ Feature: Edit activities in social activities block
And I set the field "Add an activity to section 'section 0'" to "Forum"
And I set the field "Forum name" to "My forum name"
And I press "Save and return to course"
- And I click on "Edit title" "link" in the "//div[contains(@class,'block_social_activities')]//li[contains(.,'My forum name')]" "xpath_element"
+ And I click on "Edit title" "link" in the "//*[contains(@class,'block_social_activities')]//li[contains(.,'My forum name')]" "xpath_element"
And I set the field "New name for activity My forum name" to "New forum name"
And I press key "13" in the field "New name for activity My forum name"
Then I should not see "My forum name" in the "Social activities" "block"
diff --git a/blocks/tests/behat/configure_block_throughout_site.feature b/blocks/tests/behat/configure_block_throughout_site.feature
index bf2e8b03df0..950fc3853d8 100644
--- a/blocks/tests/behat/configure_block_throughout_site.feature
+++ b/blocks/tests/behat/configure_block_throughout_site.feature
@@ -46,7 +46,7 @@ Feature: Add and configure blocks throughout the site
And I press "Save changes"
And I follow "Course 1"
# The first block matching the pattern should be top-left block
- And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element"
+ And I should see "Comments" in the "//*[@id='region-pre' or @id='block-region-side-pre']/descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' block ')]" "xpath_element"
Scenario: Blocks on the dashboard page can have roles assigned to them
Given I log in as "manager1"
diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature
index 908825ae146..8cca1cf1b9a 100644
--- a/blocks/tests/behat/manage_blocks.feature
+++ b/blocks/tests/behat/manage_blocks.feature
@@ -52,7 +52,7 @@ Feature: Block appearances
And I follow "Test survey name"
And I should not see "Comments"
- Scenario: Block settings can be modified so that a block can be hidden or moved
+ Scenario: Block settings can be modified so that a block can be hidden
When I follow "Test book name"
And I configure the "Comments" block
And I set the following fields to these values:
@@ -61,11 +61,3 @@ Feature: Block appearances
And I follow "Turn editing off"
And I follow "Test book name"
Then I should not see "Comments"
- And I expand "Course administration" node
- And I follow "Turn editing on"
- And I configure the "Comments" block
- And I set the following fields to these values:
- | Visible | Yes |
- | Region | Right |
- And I press "Save changes"
- And I should see "Comments" in the "//*[@id='region-post' or @id='block-region-side-post']" "xpath_element"
diff --git a/blocks/tests/behat/move_blocks.feature b/blocks/tests/behat/move_blocks.feature
new file mode 100644
index 00000000000..8771a9fc787
--- /dev/null
+++ b/blocks/tests/behat/move_blocks.feature
@@ -0,0 +1,49 @@
+@core @core_block
+Feature: Block region moving
+ In order to configure blocks appearance
+ As a teacher
+ I need to modify block region for the page
+
+ Background:
+ Given the following "courses" exist:
+ | fullname | shortname | category |
+ | Course 1 | C1 | 0 |
+ And the following "users" exist:
+ | username | firstname | lastname | email |
+ | teacher1 | teacher | 1 | teacher1@example.com |
+ And the following "course enrolments" exist:
+ | user | course | role |
+ | teacher1 | C1 | editingteacher |
+ And I log in as "admin"
+ And I am on site homepage
+ And I follow "Course 1"
+ And I follow "Turn editing on"
+ And I add a "Survey" to section "1" and I fill the form with:
+ | Name | Test survey name |
+ | Survey type | ATTLS (20 item version) |
+ | Description | Test survey description |
+ And I add a "Book" to section "1" and I fill the form with:
+ | Name | Test book name |
+ | Description | Test book description |
+ And I follow "Test book name"
+ And I set the following fields to these values:
+ | Chapter title | Book title |
+ | Content | Book content test test |
+ And I press "Save changes"
+ And I log out
+ And I log in as "teacher1"
+ And I follow "Course 1"
+ And I follow "Turn editing on"
+ And I add the "Comments" block
+ And I configure the "Comments" block
+ And I set the following fields to these values:
+ | Display on page types | Any page |
+ And I press "Save changes"
+
+ Scenario: Block settings can be modified so that a block can be moved
+ When I follow "Test book name"
+ And I configure the "Comments" block
+ And I set the following fields to these values:
+ | Region | Right |
+ And I press "Save changes"
+ And I should see "Comments" in the "//*[@id='region-post' or @id='block-region-side-post']" "xpath_element"
diff --git a/course/classes/management_renderer.php b/course/classes/management_renderer.php
index ed28b0322c7..9f0afc4debb 100644
--- a/course/classes/management_renderer.php
+++ b/course/classes/management_renderer.php
@@ -369,6 +369,12 @@ class core_course_management_renderer extends plugin_renderer_base {
return $this->render($menu);
}
+ public function render_action_menu($menu) {
+ global $OUTPUT;
+
+ return $OUTPUT->render($menu);
+ }
+
/**
* Renders bulk actions for categories.
*
diff --git a/course/tests/behat/course_controls.feature b/course/tests/behat/course_controls.feature
index 8ce44783111..7dfb1c78b63 100644
--- a/course/tests/behat/course_controls.feature
+++ b/course/tests/behat/course_controls.feature
@@ -39,7 +39,7 @@ Feature: Course activity controls works as expected
And I should see "Turn editing on"
And "Turn editing on" "button" should exist
And I turn editing mode on
- And I click on "Actions" "link" in the "Recent activity" "block"
+ And I open the action menu in "Recent activity" "block"
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And "section" exist
@@ -119,7 +119,7 @@ Feature: Course activity controls works as expected
And I should see "Turn editing on"
And "Turn editing on" "button" should exist
And I turn editing mode on
- And I click on "Actions" "link" in the "Recent activity" "block"
+ And I open the action menu in "Recent activity" "block"
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And "section" exist
diff --git a/course/tests/behat/course_resort.feature b/course/tests/behat/course_resort.feature
index f117146cad0..e8f9eb15bfd 100644
--- a/course/tests/behat/course_resort.feature
+++ b/course/tests/behat/course_resort.feature
@@ -172,4 +172,4 @@ Feature: Test we can resort course in the management interface.
And I click to move course "C3" up one
And a new page should not have loaded since I started watching
And I should see course listing "Course 2" before "Course 3"
- And I should see course listing "Course 3" before "Course 1"
\ No newline at end of file
+ And I should see course listing "Course 3" before "Course 1"
diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js
index 8aff8f7b101..b47c80f465f 100644
--- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js
+++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js
@@ -113,8 +113,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
moveup.next('br').remove();
}
- if (moveup.ancestor('.section_action_menu')) {
- moveup.ancestor('li').remove();
+ if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') {
+ moveup.ancestor().remove();
} else {
moveup.remove();
}
@@ -126,8 +126,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
movedown.next('br').remove();
}
- if (movedown.ancestor('.section_action_menu')) {
- movedown.ancestor('li').remove();
+ var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase();
+ if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') {
+ movedown.ancestor().remove();
} else {
movedown.remove();
}
diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js
index ba2426d363a..65266a54c03 100644
--- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js
+++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-min.js
@@ -1,2 +1,2 @@
-YUI.add("moodle-course-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"course-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"section",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"};M.course=M.course||{};var r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass=M.course.format.get_sectionwrapperclass(),this.parentnodeclass=M.course.format.get_containerclass();if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector=M.course.format.get_section_wrapper(e);if(this.sectionlistselector){this.sectionlistselector="."+n.COURSECONTENT+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector);var t=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:"."+n.SECTIONDRAGGABLE,target:!0,handles:["."+n.LEFT],dragConfig:{groups:this.groups}});t.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),t.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT,stickY:!0}),t.dd.plug(e.Plugin.DDWinScroll)}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=e.Moodle.core_course.util.section.getId(t);if(r>0){var i=t.one("."+n.RIGHT+" a."+n.MOVEDOWN),s=t.one("."+n.RIGHT+" a."+n.MOVEUP),o=M.util.get_string("movesection","moodle",r),u=t.one("."+n.LEFT);(i||s)&&u&&(u.setStyle("cursor","move"),u.appendChild(this.get_drag_handle(o,n.SECTIONHANDLE,"icon",!0)),s&&(s.previous("br")?s.previous("br").remove():s.next("br")&&s.next("br").remove(),s.ancestor(".section_action_menu")?s.ancestor("li").remove():s.remove()),i&&(i.previous("br")?i.previous("br").remove():i.next("br")&&i.next("br").remove(),i.ancestor(".section_action_menu")?i.ancestor("li").remove():i.remove()),t.addClass(n.SECTIONDRAGGABLE))}},this)},drag_start:function(t){var r=t.target,i=e.Node.create("<"+M.course.format.get_containernode()+">"+M.course.format.get_containernode()+">");i.addClass(M.course.format.get_containerclass());var s=e.Node.create("<"+M.course.format.get_sectionwrappernode()+">"+M.course.format.get_sectionwrappernode()+">");s.addClass(M.course.format.get_sectionwrapperclass()),s.setStyle("margin",0),s.setContent(r.get("node").get("innerHTML")),i.appendChild(s),r.get("dragNode").setContent(i),r.get("dragNode").addClass(n.COURSECONTENT)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(t){var r="."+n.COURSECONTENT+" "+M.course.format.get_section_selector(e),i=e.all(r),s=i.indexOf(t),o=i.indexOf(e.one("#section-0"));return s-o},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=e.Moodle.core_course.util.section.getId(i),o=s,u=this.get_section_index(i),a=u;if(s===u)return;o>a&&(o=u,a=s),r.get("dragNode").removeClass(n.COURSECONTENT);var f=e.Node.all(this.sectionlistselector),l=M.util.add_lightbox(e,i),c={},h=this.get("config").pageparams,p;for(p in h){if(!h.hasOwnProperty(p))continue;c[p]=h[p]}c.sesskey=M.cfg.sesskey,c.courseId=this.get("courseid"),c["class"]="section",c.field="move",c.id=s,c.value=u;var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:c,on:{start:function(){l.show()},success:function(t,n){try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r),M.course.format.process_sections(e,f,r,o,a)}catch(i){}var s,u=!1;do{u=!1;for(s=o;s<=a;s++)if(e.Moodle.core_course.util.section.getId(f.item(s-1))>e.Moodle.core_course.util.section.getId(f.item(s))){var c=f.item(s-1).get("id");f.item(s-1).set("id",f.item(s).get("id")),f.item(s).set("id",c),M.course.format.swap_sections(e,s-1,s),u=!0}a-=1}while(u);window.setTimeout(function(){l.hide()},250)},failure:function(e,t){this.ajax_failure(t),l.hide()}},context:this})}},{NAME:"course-dragdrop-section",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_section_dragdrop=function(e){new r(e)};var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.resourcedraghandle=this.get_drag_handle(M.util.get_string("movecoursemodule","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0),this.samenodelabel={identifier:"afterresource",component:"moodle"},this.parentnodelabel={identifier:"totopofsection",component:"moodle"};var t=M.course.format.get_section_selector(e);if(t){t="."+n.COURSECONTENT+" "+t,this.setup_for_section(t);var r=t.slice(n.COURSECONTENT.length+2)+" li."+n.ACTIVITY,i=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:r,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});i.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),i.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT}),i.dd.plug(e.Plugin.DDWinScroll),M.course.coursebase.register_module(this),M.course.dragres=this}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=t.one("."+n.CONTENT+" ul."+n.SECTION);r||(r=e.Node.create(""),r.addClass(n.SECTION),t.one("."+n.CONTENT+" div."+n.SUMMARY).insert(r,"after")),r.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:r,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("#"+t.get("id")+" li."+n.ACTIVITY)},this)},setup_for_resource:function(t){e.Node.all(t).each(function(t){var r=t.getData("draggroups");r||(t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}));var i=t.one("a."+n.EDITINGMOVE);i&&i.replace(this.resourcedraghandle.cloneNode(!0))},this)},drag_start:function(e){var t=e.target;t.get("dragNode").setContent(t.get("node").get("innerHTML")),t.get("dragNode").all("img.iconsmall").setStyle("vertical-align","baseline"
-)},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=t.drop.get("node"),o=i.one(n.ACTIONAREA),u=M.util.add_spinner(e,o),a={},f=this.get("config").pageparams,l;for(l in f)a[l]=f[l];a.sesskey=M.cfg.sesskey,a.courseId=this.get("courseid"),a["class"]="resource",a.field="move",a.id=Number(e.Moodle.core_course.util.cm.getId(i)),a.sectionId=e.Moodle.core_course.util.section.getId(s.ancestor(M.course.format.get_section_wrapper(e),!0)),i.next()&&(a.beforeId=Number(e.Moodle.core_course.util.cm.getId(i.next())));var c=M.cfg.wwwroot+this.get("ajaxurl");e.io(c,{method:"POST",data:a,on:{start:function(){this.lock_drag_handle(r,n.EDITINGMOVE),u.show()},success:function(t,s){var o=e.JSON.parse(s.responseText),a={element:i,visible:o.visible};M.course.coursebase.invoke_function("set_visibility_resource_ui",a),this.unlock_drag_handle(r,n.EDITINGMOVE),window.setTimeout(function(){u.hide()},250)},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(r,n.SECTIONHANDLE),u.hide()}},context:this})}},{NAME:"course-dragdrop-resource",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_resource_dragdrop=function(e){new i(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-course-coursebase","moodle-course-util"]});
+YUI.add("moodle-course-dragdrop",function(e,t){var n={ACTIONAREA:".actions",ACTIVITY:"activity",ACTIVITYINSTANCE:"activityinstance",CONTENT:"content",COURSECONTENT:"course-content",EDITINGMOVE:"editing_move",ICONCLASS:"iconsmall",JUMPMENU:"jumpmenu",LEFT:"left",LIGHTBOX:"lightbox",MOVEDOWN:"movedown",MOVEUP:"moveup",PAGECONTENT:"page-content",RIGHT:"right",SECTION:"section",SECTIONADDMENUS:"section_add_menus",SECTIONHANDLE:"section-handle",SUMMARY:"summary",SECTIONDRAGGABLE:"sectiondraggable"};M.course=M.course||{};var r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,M.core.dragdrop,{sectionlistselector:null,initializer:function(){this.groups=[n.SECTIONDRAGGABLE],this.samenodeclass=M.course.format.get_sectionwrapperclass(),this.parentnodeclass=M.course.format.get_containerclass();if(e.Node.one("."+n.JUMPMENU))return!1;this.sectionlistselector=M.course.format.get_section_wrapper(e);if(this.sectionlistselector){this.sectionlistselector="."+n.COURSECONTENT+" "+this.sectionlistselector,this.setup_for_section(this.sectionlistselector);var t=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:"."+n.SECTIONDRAGGABLE,target:!0,handles:["."+n.LEFT],dragConfig:{groups:this.groups}});t.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),t.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT,stickY:!0}),t.dd.plug(e.Plugin.DDWinScroll)}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=e.Moodle.core_course.util.section.getId(t);if(r>0){var i=t.one("."+n.RIGHT+" a."+n.MOVEDOWN),s=t.one("."+n.RIGHT+" a."+n.MOVEUP),o=M.util.get_string("movesection","moodle",r),u=t.one("."+n.LEFT);if((i||s)&&u){u.setStyle("cursor","move"),u.appendChild(this.get_drag_handle(o,n.SECTIONHANDLE,"icon",!0)),s&&(s.previous("br")?s.previous("br").remove():s.next("br")&&s.next("br").remove(),s.ancestor(".section_action_menu")&&s.ancestor().get("nodeName").toLowerCase()=="li"?s.ancestor().remove():s.remove());if(i){i.previous("br")?i.previous("br").remove():i.next("br")&&i.next("br").remove();var a=i.ancestor().get("nodeName").toLowerCase();i.ancestor(".section_action_menu")&&a=="li"?i.ancestor().remove():i.remove()}t.addClass(n.SECTIONDRAGGABLE)}}},this)},drag_start:function(t){var r=t.target,i=e.Node.create("<"+M.course.format.get_containernode()+">"+M.course.format.get_containernode()+">");i.addClass(M.course.format.get_containerclass());var s=e.Node.create("<"+M.course.format.get_sectionwrappernode()+">"+M.course.format.get_sectionwrappernode()+">");s.addClass(M.course.format.get_sectionwrapperclass()),s.setStyle("margin",0),s.setContent(r.get("node").get("innerHTML")),i.appendChild(s),r.get("dragNode").setContent(i),r.get("dragNode").addClass(n.COURSECONTENT)},drag_dropmiss:function(e){this.drop_hit(e)},get_section_index:function(t){var r="."+n.COURSECONTENT+" "+M.course.format.get_section_selector(e),i=e.all(r),s=i.indexOf(t),o=i.indexOf(e.one("#section-0"));return s-o},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=e.Moodle.core_course.util.section.getId(i),o=s,u=this.get_section_index(i),a=u;if(s===u)return;o>a&&(o=u,a=s),r.get("dragNode").removeClass(n.COURSECONTENT);var f=e.Node.all(this.sectionlistselector),l=M.util.add_lightbox(e,i),c={},h=this.get("config").pageparams,p;for(p in h){if(!h.hasOwnProperty(p))continue;c[p]=h[p]}c.sesskey=M.cfg.sesskey,c.courseId=this.get("courseid"),c["class"]="section",c.field="move",c.id=s,c.value=u;var d=M.cfg.wwwroot+this.get("ajaxurl");e.io(d,{method:"POST",data:c,on:{start:function(){l.show()},success:function(t,n){try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r),M.course.format.process_sections(e,f,r,o,a)}catch(i){}var s,u=!1;do{u=!1;for(s=o;s<=a;s++)if(e.Moodle.core_course.util.section.getId(f.item(s-1))>e.Moodle.core_course.util.section.getId(f.item(s))){var c=f.item(s-1).get("id");f.item(s-1).set("id",f.item(s).get("id")),f.item(s).set("id",c),M.course.format.swap_sections(e,s-1,s),u=!0}a-=1}while(u);window.setTimeout(function(){l.hide()},250)},failure:function(e,t){this.ajax_failure(t),l.hide()}},context:this})}},{NAME:"course-dragdrop-section",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_section_dragdrop=function(e){new r(e)};var i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.dragdrop,{initializer:function(){this.groups=["resource"],this.samenodeclass=n.ACTIVITY,this.parentnodeclass=n.SECTION,this.resourcedraghandle=this.get_drag_handle(M.util.get_string("movecoursemodule","moodle"),n.EDITINGMOVE,n.ICONCLASS,!0),this.samenodelabel={identifier:"afterresource",component:"moodle"},this.parentnodelabel={identifier:"totopofsection",component:"moodle"};var t=M.course.format.get_section_selector(e);if(t){t="."+n.COURSECONTENT+" "+t,this.setup_for_section(t);var r=t.slice(n.COURSECONTENT.length+2)+" li."+n.ACTIVITY,i=new e.DD.Delegate({container:"."+n.COURSECONTENT,nodes:r,target:!0,handles:["."+n.EDITINGMOVE],dragConfig:{groups:this.groups}});i.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1,cloneNode:!0}),i.dd.plug(e.Plugin.DDConstrained,{constrain:"#"+n.PAGECONTENT}),i.dd.plug(e.Plugin.DDWinScroll),M.course.coursebase.register_module(this),M.course.dragres=this}},setup_for_section:function(t){e.Node.all(t).each(function(t){var r=t.one("."+n.CONTENT+" ul."+n.SECTION);r||(r=e.Node.create(""),r.addClass(n.SECTION),t.one("."+n.CONTENT+" div."+n.SUMMARY).insert(r,"after")),r.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:r,groups:this.groups,padding:"20 0 20 0"}),this.setup_for_resource("#"+t.get("id")+" li."+n.ACTIVITY)},this)},setup_for_resource:function(t){e.Node.all(t).each(function(t){var r=t.getData("draggroups");r||(t.setAttribute("data-draggroups",this.groups.join(" ")),new e.DD.Drop({node:t,groups:this.groups,padding:"20 0 20 0"}));var i=t.one("a."+n.EDITINGMOVE);i&&i.replace(this.resourcedraghandle.cloneNode(!0))},this)},drag_start:function(e){var t=e.target;t.get("dragNode").setContent(
+t.get("node").get("innerHTML")),t.get("dragNode").all("img.iconsmall").setStyle("vertical-align","baseline")},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var r=t.drag,i=r.get("node"),s=t.drop.get("node"),o=i.one(n.ACTIONAREA),u=M.util.add_spinner(e,o),a={},f=this.get("config").pageparams,l;for(l in f)a[l]=f[l];a.sesskey=M.cfg.sesskey,a.courseId=this.get("courseid"),a["class"]="resource",a.field="move",a.id=Number(e.Moodle.core_course.util.cm.getId(i)),a.sectionId=e.Moodle.core_course.util.section.getId(s.ancestor(M.course.format.get_section_wrapper(e),!0)),i.next()&&(a.beforeId=Number(e.Moodle.core_course.util.cm.getId(i.next())));var c=M.cfg.wwwroot+this.get("ajaxurl");e.io(c,{method:"POST",data:a,on:{start:function(){this.lock_drag_handle(r,n.EDITINGMOVE),u.show()},success:function(t,s){var o=e.JSON.parse(s.responseText),a={element:i,visible:o.visible};M.course.coursebase.invoke_function("set_visibility_resource_ui",a),this.unlock_drag_handle(r,n.EDITINGMOVE),window.setTimeout(function(){u.hide()},250)},failure:function(e,t){this.ajax_failure(t),this.unlock_drag_handle(r,n.SECTIONHANDLE),u.hide()}},context:this})}},{NAME:"course-dragdrop-resource",ATTRS:{courseid:{value:null},ajaxurl:{value:0},config:{value:0}}}),M.course=M.course||{},M.course.init_resource_dragdrop=function(e){new i(e)}},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification","moodle-course-coursebase","moodle-course-util"]});
diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js
index 956f3e337e3..bd057c87b34 100644
--- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js
+++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js
@@ -113,8 +113,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
moveup.next('br').remove();
}
- if (moveup.ancestor('.section_action_menu')) {
- moveup.ancestor('li').remove();
+ if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') {
+ moveup.ancestor().remove();
} else {
moveup.remove();
}
@@ -126,8 +126,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
movedown.next('br').remove();
}
- if (movedown.ancestor('.section_action_menu')) {
- movedown.ancestor('li').remove();
+ var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase();
+ if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') {
+ movedown.ancestor().remove();
} else {
movedown.remove();
}
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
index 84040908216..f530680b8c0 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
@@ -10,7 +10,7 @@ var CSS = {
PAGECONTENT: 'body',
SECTION: null,
SECTIONMODCHOOSER: 'span.section-modchooser-link',
- SITEMENU: 'div.block_site_main_menu',
+ SITEMENU: '.block_site_main_menu',
SITETOPIC: 'div.sitetopic'
};
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
index a690c8a44c7..703d3381254 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
@@ -1 +1 @@
-YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:"div.block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create(" ");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e)},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"§ion="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase"]});
+YUI.add("moodle-course-modchooser",function(e,t){var n={PAGECONTENT:"body",SECTION:null,SECTIONMODCHOOSER:"span.section-modchooser-link",SITEMENU:".block_site_main_menu",SITETOPIC:"div.sitetopic"},r="course-modchooser",i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,M.core.chooserdialogue,{sectionid:null,initializer:function(){var t=M.course.format.get_sectionwrapperclass();t&&(n.SECTION="."+t);var r=e.one(".chooserdialoguebody"),i=e.one(".choosertitle"),s={};this.setup_chooser_dialogue(r,i,s),this.setup_for_section(),M.course.coursebase.register_module(this)},setup_for_section:function(t){t||(t=n.PAGECONTENT),e.one(t).all(n.SITETOPIC).each(function(e){this._setup_for_section(e)},this),n.SECTION&&e.one(t).all(n.SECTION).each(function(e){this._setup_for_section(e)},this),e.one(t).all(n.SITEMENU).each(function(e){this._setup_for_section(e)},this)},_setup_for_section:function(t){var r=t.one(n.SECTIONMODCHOOSER);if(!r)return;var i=e.Node.create(" ");r.get("children").each(function(e){i.appendChild(e)}),r.insertBefore(i),i.on("click",this.display_mod_chooser,this)},display_mod_chooser:function(e){if(e.target.ancestor(n.SITETOPIC))this.sectionid=1;else if(e.target.ancestor(n.SECTION)){var t=e.target.ancestor(n.SECTION);this.sectionid=t.get("id").replace("section-","")}else e.target.ancestor(n.SITEMENU)&&(this.sectionid=0);this.display_chooser(e)},option_selected:function(e){this.hiddenRadioValue.setAttrs({name:"jump",value:e.get("value")+"§ion="+this.sectionid})}},{NAME:r,ATTRS:{maxheight:{value:800}}}),M.course=M.course||{},M.course.init_chooser=function(e){return new i(e)}},"@VERSION@",{requires:["moodle-core-chooserdialogue","moodle-course-coursebase"]});
diff --git a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
index 84040908216..f530680b8c0 100644
--- a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
+++ b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
@@ -10,7 +10,7 @@ var CSS = {
PAGECONTENT: 'body',
SECTION: null,
SECTIONMODCHOOSER: 'span.section-modchooser-link',
- SITEMENU: 'div.block_site_main_menu',
+ SITEMENU: '.block_site_main_menu',
SITETOPIC: 'div.sitetopic'
};
diff --git a/course/yui/src/dragdrop/js/section.js b/course/yui/src/dragdrop/js/section.js
index 452e410c94c..efbb73e48f2 100644
--- a/course/yui/src/dragdrop/js/section.js
+++ b/course/yui/src/dragdrop/js/section.js
@@ -81,8 +81,8 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
moveup.next('br').remove();
}
- if (moveup.ancestor('.section_action_menu')) {
- moveup.ancestor('li').remove();
+ if (moveup.ancestor('.section_action_menu') && moveup.ancestor().get('nodeName').toLowerCase() == 'li') {
+ moveup.ancestor().remove();
} else {
moveup.remove();
}
@@ -94,8 +94,9 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
movedown.next('br').remove();
}
- if (movedown.ancestor('.section_action_menu')) {
- movedown.ancestor('li').remove();
+ var movedownParentType = movedown.ancestor().get('nodeName').toLowerCase();
+ if (movedown.ancestor('.section_action_menu') && movedownParentType == 'li') {
+ movedown.ancestor().remove();
} else {
movedown.remove();
}
diff --git a/course/yui/src/modchooser/js/modchooser.js b/course/yui/src/modchooser/js/modchooser.js
index 4ea2619a019..6c75c604149 100644
--- a/course/yui/src/modchooser/js/modchooser.js
+++ b/course/yui/src/modchooser/js/modchooser.js
@@ -8,7 +8,7 @@ var CSS = {
PAGECONTENT: 'body',
SECTION: null,
SECTIONMODCHOOSER: 'span.section-modchooser-link',
- SITEMENU: 'div.block_site_main_menu',
+ SITEMENU: '.block_site_main_menu',
SITETOPIC: 'div.sitetopic'
};
diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php
index a7b7d064b75..f1b78f00658 100644
--- a/grade/edit/tree/lib.php
+++ b/grade/edit/tree/lib.php
@@ -128,7 +128,6 @@ class grade_edit_tree {
$moveaction = '';
$actionsmenu = new action_menu();
- $actionsmenu->initialise_js($PAGE);
$actionsmenu->set_menu_trigger(get_string('edit'));
$actionsmenu->set_owner_selector('grade-item-' . $eid);
$actionsmenu->set_alignment(action_menu::TL, action_menu::BL);
diff --git a/grade/report/singleview/tests/behat/bulk_insert_grades.feature b/grade/report/singleview/tests/behat/bulk_insert_grades.feature
index ce9905d498a..9b40f473022 100644
--- a/grade/report/singleview/tests/behat/bulk_insert_grades.feature
+++ b/grade/report/singleview/tests/behat/bulk_insert_grades.feature
@@ -82,8 +82,8 @@ Feature: We can bulk insert grades for students in a course
And I press "Ok"
And I follow "Edit settings"
And I follow "View gradebook"
- And I click on "input[title='Dock Navigation block']" "css_element"
- And I click on "input[title='Dock Administration block']" "css_element"
+ # And I click on "input[title='Dock Navigation block']" "css_element"
+ # And I click on "input[title='Dock Administration block']" "css_element"
And I follow "Single view for Test assignment two"
And I select "Student 1" from the "Select user..." singleselect
Then the field "Grade for Test assignment two" matches value "50.00"
diff --git a/grade/tests/behat/grade_calculated_grade_items.feature b/grade/tests/behat/grade_calculated_grade_items.feature
index aa07eab4f5f..3eb9dfe6133 100644
--- a/grade/tests/behat/grade_calculated_grade_items.feature
+++ b/grade/tests/behat/grade_calculated_grade_items.feature
@@ -162,4 +162,4 @@ Feature: Calculated grade items can be used in the gradebook
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 71.43 % | 65.00 | 0–100 | 65.00 % | 46.43 % |
| calc item | 28.57 % | 32.50 | 0–40 | 81.25 % | 23.21 % |
- | Course total | - | 97.50 | 0–140 | 69.64 % | - |
\ No newline at end of file
+ | Course total | - | 97.50 | 0–140 | 69.64 % | - |
diff --git a/grade/tests/behat/grade_calculated_grade_items_20150627.feature b/grade/tests/behat/grade_calculated_grade_items_20150627.feature
index 87eeb8f8bc4..1199365a985 100644
--- a/grade/tests/behat/grade_calculated_grade_items_20150627.feature
+++ b/grade/tests/behat/grade_calculated_grade_items_20150627.feature
@@ -163,4 +163,4 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 50.00 % | 65.00 | 0–100 | 65.00 % | 32.50 % |
| calc item | 50.00 % | 32.50 | 0–100 | 32.50 % | 16.25 % |
- | Course total | - | 97.50 | 0–200 | 48.75 % | - |
\ No newline at end of file
+ | Course total | - | 97.50 | 0–200 | 48.75 % | - |
diff --git a/grade/tests/behat/grade_category_validation.feature b/grade/tests/behat/grade_category_validation.feature
index 0388b883763..9f2e0f13261 100644
--- a/grade/tests/behat/grade_category_validation.feature
+++ b/grade/tests/behat/grade_category_validation.feature
@@ -77,7 +77,7 @@ Feature: Editing a grade item
And I click on "Edit" "link" in the "Cat 1" "table_row"
When I click on "Edit settings" "link" in the "Cat 1" "table_row"
Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
- And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'Value')]" "xpath_element" should exist
+ And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist
Scenario: Attempting to change a category item's scale when overridden grades already exist
Given I click on "Edit" "link" in the "Cat 1" "table_row"
@@ -93,7 +93,7 @@ Feature: Editing a grade item
And I click on "Edit" "link" in the "Cat 1" "table_row"
When I click on "Edit settings" "link" in the "Cat 1" "table_row"
Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type and scale cannot be changed."
- And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
+ And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
Scenario: Attempting to change a category item's maximum grade when no rescaling option has been chosen
Given I navigate to "Grader report" node in "Grade administration"
diff --git a/grade/tests/behat/grade_item_validation.feature b/grade/tests/behat/grade_item_validation.feature
index 541922f507c..d9b19c9fcc9 100644
--- a/grade/tests/behat/grade_item_validation.feature
+++ b/grade/tests/behat/grade_item_validation.feature
@@ -62,7 +62,7 @@ Feature: Editing a grade item
And I click on "Edit" "link" in the "MI 1" "table_row"
When I click on "Edit settings" "link" in the "MI 1" "table_row"
Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
- And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'Value')]" "xpath_element" should exist
+ And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's scale when grades already exist
Given I click on "Edit" "link" in the "MI 1" "table_row"
@@ -78,7 +78,7 @@ Feature: Editing a grade item
And I click on "Edit" "link" in the "MI 1" "table_row"
When I click on "Edit settings" "link" in the "MI 1" "table_row"
Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed."
- And "//div[contains(concat(' ', normalize-space(@class), ' '), 'fstatic') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
+ And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's maximum grade when no rescaling option has been chosen
Given I navigate to "Grader report" node in "Grade administration"
diff --git a/grade/tests/behat/grade_letter_boundary.feature b/grade/tests/behat/grade_letter_boundary.feature
index 210732ae9a8..73c04f1e225 100644
--- a/grade/tests/behat/grade_letter_boundary.feature
+++ b/grade/tests/behat/grade_letter_boundary.feature
@@ -40,4 +40,4 @@ Feature: We can customise the letter boundary of a course.
And I press "Turn editing off"
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- |
- | Student 1 | D | D |
\ No newline at end of file
+ | Student 1 | D | D |
diff --git a/grade/tests/behat/grade_letter_boundary_20160518.feature b/grade/tests/behat/grade_letter_boundary_20160518.feature
index 47fcb565231..e451824f76e 100644
--- a/grade/tests/behat/grade_letter_boundary_20160518.feature
+++ b/grade/tests/behat/grade_letter_boundary_20160518.feature
@@ -41,4 +41,4 @@ Feature: We can customise the letter boundary of a course.
And I press "Turn editing off"
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- |
- | Student 1 | F | F |
\ No newline at end of file
+ | Student 1 | F | F |
diff --git a/grade/tests/behat/grade_to_pass.feature b/grade/tests/behat/grade_to_pass.feature
index 7125b6232b2..55ec7b4d799 100644
--- a/grade/tests/behat/grade_to_pass.feature
+++ b/grade/tests/behat/grade_to_pass.feature
@@ -134,8 +134,8 @@ Feature: We can set the grade to pass value
| Submission grade to pass | 90 |
| gradinggrade | 20 |
| Assessment grade to pass | 30 |
- Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "#fitem_id_submissiongradepass .error" "css_element"
- Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "#fitem_id_gradinggradepass .error" "css_element"
+ Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "Submission grade to pass" "form_row"
+ Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "Assessment grade to pass" "form_row"
Scenario: Set a valid grade to pass for quiz activity
When I turn editing mode on
diff --git a/lib/amd/build/tag.min.js b/lib/amd/build/tag.min.js
index 947356017ea..b87b6ecfd25 100644
--- a/lib/amd/build/tag.min.js
+++ b/lib/amd/build/tag.min.js
@@ -1 +1 @@
-define(["jquery","core/ajax","core/templates","core/notification","core/str"],function(a,b,c,d,e){return{initTagindexPage:function(){a("body").delegate(".tagarea[data-ta] a[data-quickload=1]","click",function(d){d.preventDefault();var e=a(this),f=e[0].search.replace(/^\?/,""),g=e.closest(".tagarea[data-ta]"),h=f.split("&").reduce(function(a,b){var c=b.split("=");return a[c[0]]=decodeURIComponent(c[1]),a},{}),i=b.call([{methodname:"core_tag_get_tagindex",args:{tagindex:h}}],!0);a.when.apply(a,i).done(function(a){c.render("core_tag/index",a).done(function(a){g.replaceWith(a)})})})},initManagePage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){if(e.get_string("now").done(function(c){a(b.target).closest("tr").find("td.col-timemodified").html(c)}),"tagflag"===b.ajaxreturn.itemtype){var c=a(b.target).closest("tr");"0"===b.ajaxreturn.value?c.removeClass("flagged-tag"):c.addClass("flagged-tag")}}),a(".tag-management-table").delegate("a.tagdelete","click",function(b){b.preventDefault();var c=a(this).attr("href");e.get_strings([{key:"delete"},{key:"confirmdeletetag",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})}),a("#tag-management-delete").click(function(b){var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked").length;if(f){var g=a(" ").attr("name",this.name);b.preventDefault(),e.get_strings([{key:"delete"},{key:"confirmdeletetags",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){g.appendTo(c),c.submit()})})}}),a("#tag-management-combine").click(function(b){b.preventDefault();var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked");if(f.length<=1)return void e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmultipletags",component:"tag"},{key:"ok"}]).done(function(a){d.alert(a[0],a[1],a[2])});var g=a(" ").attr("name",this.name);e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmaintag",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var d=a('');d.find(".description").html(b[1]),d.find("#combinetags_submit").attr("value",b[2]),d.find("#combinetags_cancel").attr("value",b[3]);var e=d.find(".options");f.each(function(){var b=a(this).val(),c=a(".inplaceeditable[data-itemtype=tagname][data-itemid="+b+"]").attr("data-value");e.append(a(''+c+" "))});var h=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});h.show(),a("#combinetags_form input[type=radio]").first().focus().prop("checked",!0),a("#combinetags_form #combinetags_cancel").on("click",function(){h.destroy()}),a("#combinetags_form").on("submit",function(){g.appendTo(c);var b=a("input[name=maintag]:checked","#combinetags_form").val();return a(" ").attr("name","maintag").attr("value",b).appendTo(c),c.submit(),!1})})}),a("body").on("updatefailed","[data-inplaceeditable][data-itemtype=tagname]",function(b){var c=b.exception,f=b.newvalue,g=a(b.target).attr("data-itemid");"namesalreadybeeingused"===c.errorcode&&(b.preventDefault(),e.get_strings([{key:"nameuseddocombine",component:"tag"},{key:"yes"},{key:"cancel"}]).done(function(a){d.confirm(b.message,a[0],a[1],a[2],function(){window.location.href=window.location.href+"&newname="+encodeURIComponent(f)+"&tagid="+encodeURIComponent(g)+"&action=renamecombine&sesskey="+M.cfg.sesskey})}))}),a("body").on("click","a[data-action=addstandardtag]",function(b){b.preventDefault(),e.get_strings([{key:"addotags",component:"tag"},{key:"inputstandardtags",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var c=a('');c.find("#addtags_form").attr("action",window.location.href),c.find("#addtags_submit").attr("value",b[2]),c.find("#addtags_cancel").attr("value",b[3]);var d=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:c.html()});d.show(),a("#addtags_form input[type=text]").focus(),a("#addtags_form #addtags_cancel").on("click",function(){d.destroy()})})})},initManageCollectionsPage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){var c,d,e,f=b.ajaxreturn;"core_tag"===f.component&&"tagareaenable"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),e=f.value,"1"===e?(a(this).closest("tr").removeClass("dimmed_text"),d=a(this).closest("tr").find('[data-itemtype="tagareacollection"]').attr("data-value"),a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden")):a(this).closest("tr").addClass("dimmed_text")),"core_tag"===f.component&&"tagareacollection"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").addClass("hidden"),d=a(this).attr("data-value"),e=a(this).closest("tr").find('[data-itemtype="tagareaenable"]').attr("data-value"),"1"===e&&a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").removeClass("hidden"))}),a("body").on("click",".addtagcoll > a",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"addtagcoll",component:"tag"},{key:"name"},{key:"searchable",component:"tag"},{key:"create"},{key:"cancel"}]).done(function(b){var d=a('');d.find('label[for="addtagcoll_name"]').html(b[1]),d.find('label[for="addtagcoll_searchable"]').html(b[2]),d.find("#addtagcoll_submit").attr("value",b[3]),d.find("#addtagcoll_cancel").attr("value",b[4]);var e=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});e.show(),a("#addtagcoll_form #addtagcoll_name").focus(),a("#addtagcoll_form #addtagcoll_cancel").on("click",function(){e.destroy()}),a("#addtagcoll_form").on("submit",function(){var b=a("#addtagcoll_form #addtagcoll_name").val(),d=a("#addtagcoll_form #addtagcoll_searchable").prop("checked")?1:0;return String(b).length>0&&(window.location.href=c+"&name="+encodeURIComponent(b)+"&searchable="+d),!1})})}),a("body").on("click",".tag-collections-table .action_delete",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"delete"},{key:"suredeletecoll",component:"tag",param:a(this).attr("data-collname")},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})})}}});
\ No newline at end of file
+define(["jquery","core/ajax","core/templates","core/notification","core/str"],function(a,b,c,d,e){return{initTagindexPage:function(){a("body").delegate(".tagarea[data-ta] a[data-quickload=1]","click",function(d){d.preventDefault();var e=a(this),f=e[0].search.replace(/^\?/,""),g=e.closest(".tagarea[data-ta]"),h=f.split("&").reduce(function(a,b){var c=b.split("=");return a[c[0]]=decodeURIComponent(c[1]),a},{}),i=b.call([{methodname:"core_tag_get_tagindex",args:{tagindex:h}}],!0);a.when.apply(a,i).done(function(a){c.render("core_tag/index",a).done(function(a){g.replaceWith(a)})})})},initManagePage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){if(e.get_string("now").done(function(c){a(b.target).closest("tr").find("td.col-timemodified").html(c)}),"tagflag"===b.ajaxreturn.itemtype){var c=a(b.target).closest("tr");"0"===b.ajaxreturn.value?c.removeClass("flagged-tag"):c.addClass("flagged-tag")}}),a(".tag-management-table").delegate("a.tagdelete","click",function(b){b.preventDefault();var c=a(this).attr("href");e.get_strings([{key:"delete"},{key:"confirmdeletetag",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})}),a("#tag-management-delete").click(function(b){var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked").length;if(f){var g=a(" ").attr("name",this.name);b.preventDefault(),e.get_strings([{key:"delete"},{key:"confirmdeletetags",component:"tag"},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){g.appendTo(c),c.submit()})})}}),a("#tag-management-combine").click(function(b){b.preventDefault();var c=a(this).closest("form").get(0),f=a(c).find("input[type=checkbox]:checked");if(f.length<=1)return void e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmultipletags",component:"tag"},{key:"ok"}]).done(function(a){d.alert(a[0],a[1],a[2])});var g=a(" ").attr("name",this.name);e.get_strings([{key:"combineselected",component:"tag"},{key:"selectmaintag",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var d=a('');d.find(".description").html(b[1]),d.find("#combinetags_submit").attr("value",b[2]),d.find("#combinetags_cancel").attr("value",b[3]);var e=d.find(".options");f.each(function(){var b=a(this).val(),c=a(".inplaceeditable[data-itemtype=tagname][data-itemid="+b+"]").attr("data-value");e.append(a(''+c+" "))});var h=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});h.show(),a("#combinetags_form input[type=radio]").first().focus().prop("checked",!0),a("#combinetags_form #combinetags_cancel").on("click",function(){h.destroy()}),a("#combinetags_form").on("submit",function(){g.appendTo(c);var b=a("input[name=maintag]:checked","#combinetags_form").val();return a(" ").attr("name","maintag").attr("value",b).appendTo(c),c.submit(),!1})})}),a("body").on("updatefailed","[data-inplaceeditable][data-itemtype=tagname]",function(b){var c=b.exception,f=b.newvalue,g=a(b.target).attr("data-itemid");"namesalreadybeeingused"===c.errorcode&&(b.preventDefault(),e.get_strings([{key:"nameuseddocombine",component:"tag"},{key:"yes"},{key:"cancel"}]).done(function(a){d.confirm(b.message,a[0],a[1],a[2],function(){window.location.href=window.location.href+"&newname="+encodeURIComponent(f)+"&tagid="+encodeURIComponent(g)+"&action=renamecombine&sesskey="+M.cfg.sesskey})}))}),a("body").on("click","a[data-action=addstandardtag]",function(b){b.preventDefault(),e.get_strings([{key:"addotags",component:"tag"},{key:"inputstandardtags",component:"tag"},{key:"continue"},{key:"cancel"}]).done(function(b){var c=a('');c.find("#addtags_form").attr("action",window.location.href),c.find("#addtags_submit").attr("value",b[2]),c.find("#addtags_cancel").attr("value",b[3]);var d=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:c.html()});d.show(),a("#addtags_form input[type=text]").focus(),a("#addtags_form #addtags_cancel").on("click",function(){d.destroy()})})})},initManageCollectionsPage:function(){a("body").on("updated","[data-inplaceeditable]",function(b){var c,d,e,f=b.ajaxreturn;"core_tag"===f.component&&"tagareaenable"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").hide(),e=f.value,"1"===e?(a(this).closest("tr").removeClass("dimmed_text"),d=a(this).closest("tr").find('[data-itemtype="tagareacollection"]').attr("data-value"),a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").show()):a(this).closest("tr").addClass("dimmed_text")),"core_tag"===f.component&&"tagareacollection"===f.itemtype&&(c=a(this).attr("data-itemid"),a(".tag-collections-table ul[data-collectionid] li[data-areaid="+c+"]").hide(),d=a(this).attr("data-value"),e=a(this).closest("tr").find('[data-itemtype="tagareaenable"]').attr("data-value"),"1"===e&&a(".tag-collections-table ul[data-collectionid="+d+"] li[data-areaid="+c+"]").show())}),a("body").on("click",".addtagcoll > a",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"addtagcoll",component:"tag"},{key:"name"},{key:"searchable",component:"tag"},{key:"create"},{key:"cancel"}]).done(function(b){var d=a('');d.find('label[for="addtagcoll_name"]').html(b[1]),d.find('label[for="addtagcoll_searchable"]').html(b[2]),d.find("#addtagcoll_submit").attr("value",b[3]),d.find("#addtagcoll_cancel").attr("value",b[4]);var e=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,headerContent:b[0],bodyContent:d.html()});e.show(),a("#addtagcoll_form #addtagcoll_name").focus(),a("#addtagcoll_form #addtagcoll_cancel").on("click",function(){e.destroy()}),a("#addtagcoll_form").on("submit",function(){var b=a("#addtagcoll_form #addtagcoll_name").val(),d=a("#addtagcoll_form #addtagcoll_searchable").prop("checked")?1:0;return String(b).length>0&&(window.location.href=c+"&name="+encodeURIComponent(b)+"&searchable="+d),!1})})}),a("body").on("click",".tag-collections-table .action_delete",function(b){b.preventDefault();var c=a(this).attr("data-url")+"&sesskey="+M.cfg.sesskey;e.get_strings([{key:"delete"},{key:"suredeletecoll",component:"tag",param:a(this).attr("data-collname")},{key:"yes"},{key:"no"}]).done(function(a){d.confirm(a[0],a[1],a[2],a[3],function(){window.location.href=c})})})}}});
\ No newline at end of file
diff --git a/lib/amd/src/tag.js b/lib/amd/src/tag.js
index 7d0c27bb2d1..68324fc81b1 100644
--- a/lib/amd/src/tag.js
+++ b/lib/amd/src/tag.js
@@ -248,25 +248,23 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
areaid, collid, isenabled;
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareaenable') {
areaid = $(this).attr('data-itemid');
- $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden');
+ $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide();
isenabled = ajaxreturn.value;
if (isenabled === '1') {
$(this).closest('tr').removeClass('dimmed_text');
collid = $(this).closest('tr').find('[data-itemtype="tagareacollection"]').attr("data-value");
- $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]")
- .removeClass('hidden');
+ $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]").show();
} else {
$(this).closest('tr').addClass('dimmed_text');
}
}
if (ajaxreturn.component === 'core_tag' && ajaxreturn.itemtype === 'tagareacollection') {
areaid = $(this).attr('data-itemid');
- $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").addClass('hidden');
+ $(".tag-collections-table ul[data-collectionid] li[data-areaid=" + areaid + "]").hide();
collid = $(this).attr('data-value');
isenabled = $(this).closest('tr').find('[data-itemtype="tagareaenable"]').attr("data-value");
if (isenabled === "1") {
- $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]")
- .removeClass('hidden');
+ $(".tag-collections-table ul[data-collectionid=" + collid + "] li[data-areaid=" + areaid + "]").show();
}
}
});
diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php
index 3fd7d2b6b39..afdd4f618a3 100644
--- a/lib/behat/behat_base.php
+++ b/lib/behat/behat_base.php
@@ -783,6 +783,10 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
// Getting the debugging info and the backtrace.
$errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.alert-error');
+ // If errorinfoboxes is empty, try find alert-danger (bootstrap4) class.
+ if (empty($errorinfoboxes)) {
+ $errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.alert-danger');
+ }
// If errorinfoboxes is empty, try find notifytiny (original) class.
if (empty($errorinfoboxes)) {
$errorinfoboxes = $this->getSession()->getPage()->findAll('css', 'div.notifytiny');
diff --git a/lib/behat/behat_field_manager.php b/lib/behat/behat_field_manager.php
index 1fb764294bb..31701e92d82 100644
--- a/lib/behat/behat_field_manager.php
+++ b/lib/behat/behat_field_manager.php
@@ -204,7 +204,6 @@ class behat_field_manager {
// We already waited when getting the NodeElement and we don't want an exception if it's not part of a moodleform.
$parentformfound = $fieldnode->find('xpath',
- "/ancestor::fieldset" .
"/ancestor::form[contains(concat(' ', normalize-space(@class), ' '), ' mform ')]"
);
@@ -228,11 +227,19 @@ class behat_field_manager {
return 'availability';
}
- // We look for a parent node with 'felement' class or data-fieldtype attribute.
- if ($fieldtype = $fieldnode->getParent()->getAttribute('data-fieldtype')) {
- return $fieldtype;
+ if ($fieldnode->getTagName() == 'html') {
+ return false;
}
+ // If the type is explictly set on the element pointed to by the label - use it.
+ if ($type = $fieldnode->getParent()->getAttribute('data-fieldtype')) {
+ if ($type == 'tags') {
+ return 'autocomplete';
+ }
+ return $type;
+ }
+
+ // We look for a parent node with 'felement' class.
if ($class = $fieldnode->getParent()->getAttribute('class')) {
if (strstr($class, 'felement') != false) {
diff --git a/lib/behat/behat_files.php b/lib/behat/behat_files.php
index 8e1e9a93ef5..43ed54f7ff6 100644
--- a/lib/behat/behat_files.php
+++ b/lib/behat/behat_files.php
@@ -124,9 +124,10 @@ class behat_files extends behat_base {
if ($filemanagerelement) {
$containernode = $this->get_filepicker_node($filemanagerelement);
$exceptionmsg = 'The "'.$filemanagerelement.'" filemanager ' . $exceptionmsg;
- $locatorprefix = "//div[@class='fp-content']";
+ $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]";
} else {
- $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-items ')]//descendant::div[@class='fp-content']";
+ $locatorprefix = "//div[contains(concat(' ', normalize-space(@class), ' '), ' fp-repo-items ')]" .
+ "//descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' fp-content ')]";
}
$exception = new ExpectationException($exceptionmsg, $this->getSession());
diff --git a/lib/behat/classes/behat_selectors.php b/lib/behat/classes/behat_selectors.php
index c29ed085991..5d052001394 100644
--- a/lib/behat/classes/behat_selectors.php
+++ b/lib/behat/classes/behat_selectors.php
@@ -50,6 +50,7 @@ class behat_selectors {
'table' => 'table',
'table_row' => 'table_row',
'xpath_element' => 'xpath_element',
+ 'form_row' => 'form_row'
);
/**
@@ -79,7 +80,8 @@ class behat_selectors {
'table' => 'table',
'table_row' => 'table_row',
'text' => 'text',
- 'xpath_element' => 'xpath_element'
+ 'xpath_element' => 'xpath_element',
+ 'form_row' => 'form_row'
);
/**
@@ -95,10 +97,9 @@ class behat_selectors {
.//li[contains(concat(' ', normalize-space(@class), ' '), ' activity ')][normalize-space(.) = %locator% ]
XPATH
, 'block' => << << << << << <<export_for_template_base($output);
+
+ $context['selectedvalue'] = $this->_values[1];
+ $context['deselectedvalue'] = $this->_values[0];
+
+ return $context;
+ }
+
}
diff --git a/lib/form/autocomplete.php b/lib/form/autocomplete.php
index 876cb5e0964..787db398507 100644
--- a/lib/form/autocomplete.php
+++ b/lib/form/autocomplete.php
@@ -210,11 +210,11 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select {
$this->_generateId();
$context = parent::export_for_template($output);
- $context['tags'] = $this->tags;
+ $context['tags'] = !empty($this->tags);
$context['ajax'] = $this->ajax;
$context['placeholder'] = $this->placeholder;
- $context['casesensitive'] = $this->casesensitive;
- $context['showsuggestions'] = $this->showsuggestions;
+ $context['casesensitive'] = !empty($this->casesensitive);
+ $context['showsuggestions'] = !empty($this->showsuggestions);
$context['noselectionstring'] = $this->noselectionstring;
return $context;
diff --git a/lib/form/cancel.php b/lib/form/cancel.php
index 2a5764f009b..aebf1c0f6fd 100644
--- a/lib/form/cancel.php
+++ b/lib/form/cancel.php
@@ -110,12 +110,4 @@ class MoodleQuickForm_cancel extends MoodleQuickForm_submit
return HTML_QuickForm_submit::getFrozenHtml();
}
- /**
- * Freeze the element so that only its value is returned
- *
- * @return bool
- */
- function freeze(){
- return HTML_QuickForm_submit::freeze();
- }
}
diff --git a/lib/form/editor.php b/lib/form/editor.php
index 0488286fbdf..0d832948eeb 100644
--- a/lib/form/editor.php
+++ b/lib/form/editor.php
@@ -408,8 +408,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab
}
$context['hasformats'] = count($formats) > 1;
$context['formats'] = [];
- foreach ($formats as $value => $text) {
- $context['formats'][] = ['value' => $value, 'text' => $text, 'selected' => ($value == $format)];
+ foreach ($formats as $formatvalue => $formattext) {
+ $context['formats'][] = ['value' => $formatvalue, 'text' => $formattext, 'selected' => ($formatvalue == $format)];
}
$context['id'] = $id;
$context['value'] = $text;
diff --git a/lib/form/form.js b/lib/form/form.js
index 268fba2143c..530132f8545 100644
--- a/lib/form/form.js
+++ b/lib/form/form.js
@@ -277,7 +277,7 @@ if (typeof M.form.dependencyManager === 'undefined') {
isFilePicker: function(el) {
if (!this._fileinputs) {
var fileinputs = {};
- var els = this.get('form').all('.fitem.fitem_ffilepicker input,.fitem.fitem_ffilemanager input');
+ var els = this.get('form').all('.fitem [data-fieldtype="filepicker"] input,.fitem [data-fieldtype="filemanager"] input');
els.each(function(node) {
fileinputs[node.getAttribute('name')] = true;
});
diff --git a/lib/form/group.php b/lib/form/group.php
index b06094878ec..ee0790bc550 100644
--- a/lib/form/group.php
+++ b/lib/form/group.php
@@ -165,9 +165,8 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
include_once('HTML/QuickForm/Renderer/Default.php');
$elements = [];
+ $name = $this->getName();
foreach ($this->_elements as $key => $element) {
- $element->_generateId();
- $name = $this->getName();
$elementname = '';
if ($this->_appendName) {
$elementname = $element->getName();
@@ -177,6 +176,7 @@ class MoodleQuickForm_group extends HTML_QuickForm_group implements templatable
$element->setName($name);
}
}
+ $element->_generateId();
$out = $OUTPUT->mform_element($element, false, false, '', true);
diff --git a/lib/form/select.php b/lib/form/select.php
index 219d4ee0a02..d0a03dc7907 100644
--- a/lib/form/select.php
+++ b/lib/form/select.php
@@ -213,6 +213,10 @@ class MoodleQuickForm_select extends HTML_QuickForm_select implements templatabl
}
$context['options'] = $options;
+ if ($this->getAttribute('multiple')) {
+ $context['name'] = $context['name'] . '[]';
+ }
+
return $context;
}
}
diff --git a/lib/form/tags.php b/lib/form/tags.php
index 7f9bab6b74a..b62eaf97f66 100644
--- a/lib/form/tags.php
+++ b/lib/form/tags.php
@@ -115,7 +115,9 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
$attributes['showsuggestions'] = $this->showstandard;
}
+
parent::__construct($elementName, $elementLabel, $validoptions, $attributes);
+ $this->_type = 'tags';
}
/**
@@ -247,4 +249,15 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
return parent::exportValue($submitValues, $assoc);
}
+
+ public function export_for_template(renderer_base $output) {
+
+ $context = parent::export_for_template($output);
+ if (has_capability('moodle/tag:manage', context_system::instance()) && $this->showstandard) {
+ $url = new moodle_url('/tag/manage.php', array('tc' => $this->get_tag_collection()));
+ $context['managestandardtagsurl'] = $url->out(false);
+ }
+
+ return $context;
+ }
}
diff --git a/lib/form/templatable_form_element.php b/lib/form/templatable_form_element.php
index 2fa96ab6d73..2f27d2b341b 100644
--- a/lib/form/templatable_form_element.php
+++ b/lib/form/templatable_form_element.php
@@ -52,7 +52,7 @@ trait templatable_form_element {
// Not all elements have all of these attributes - but they are common enough to be valid for a few.
$standardattributes = ['id', 'name', 'label', 'multiple', 'checked', 'error', 'size', 'value'];
- $standardproperties = ['frozen', 'helpbutton', 'hiddenLabel'];
+ $standardproperties = ['helpbutton', 'hiddenLabel'];
// Standard attributes.
foreach ($standardattributes as $attrname) {
@@ -65,16 +65,22 @@ trait templatable_form_element {
$classpropname = '_' . $propname;
$context[strtolower($propname)] = isset($this->$classpropname) ? $this->$classpropname : false;
}
+ $extraclasses = $this->getAttribute('class');
+
+ // Special wierd named property.
+ $context['frozen'] = !empty($this->_flagFrozen);
// Other attributes.
$otherattributes = [];
foreach ($this->getAttributes() as $attr => $value) {
- if (!in_array($attr, $standardattributes)) {
+ if (!in_array($attr, $standardattributes) && $attr != 'class') {
$otherattributes[] = $attr . '="' . s($value) . '"';
}
}
+ $context['extraclasses'] = $extraclasses;
+ $context['type'] = $this->getType();
$context['attributes'] = implode(' ', $otherattributes);
return $context;
}
-}
\ No newline at end of file
+}
diff --git a/lib/form/templates/editor_textarea.mustache b/lib/form/templates/editor_textarea.mustache
index fbec7d1a41f..22e8a1ec803 100644
--- a/lib/form/templates/editor_textarea.mustache
+++ b/lib/form/templates/editor_textarea.mustache
@@ -1,6 +1,6 @@
+ onchange="{{onchange}}" {{/changelistener}}>{{value}}
{{^onlyoneformat}}
@@ -13,4 +13,4 @@
{{#onlyoneformat}}
{{/onlyoneformat}}
-
\ No newline at end of file
+
diff --git a/lib/form/textarea.php b/lib/form/textarea.php
index 0a1da1d4c24..e8b7682ce47 100644
--- a/lib/form/textarea.php
+++ b/lib/form/textarea.php
@@ -39,7 +39,9 @@ require_once('templatable_form_element.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class MoodleQuickForm_textarea extends HTML_QuickForm_textarea implements templatable {
- use templatable_form_element;
+ use templatable_form_element {
+ export_for_template as export_for_template_base;
+ }
/** @var string Need to store id of form as we may need it for helpbutton */
var $_formid = '';
@@ -166,4 +168,11 @@ class MoodleQuickForm_textarea extends HTML_QuickForm_textarea implements templa
public function set_force_ltr($value) {
$this->forceltr = (bool) $value;
}
+
+ public function export_for_template(renderer_base $output) {
+ $context = $this->export_for_template_base($output);
+ $context['value'] = $this->getValue();
+
+ return $context;
+ }
}
diff --git a/lib/form/url.php b/lib/form/url.php
index ec6165624e8..925c94a3336 100644
--- a/lib/form/url.php
+++ b/lib/form/url.php
@@ -186,7 +186,7 @@ EOD;
public function export_for_template(renderer_base $output) {
$context = $this->export_for_template_base($output);
- $context['filepickerhtml'] = $this->toHtml();
+ $context['filepickerhtml'] = $this->getFilePickerHTML();
return $context;
}
diff --git a/lib/formslib.php b/lib/formslib.php
index 04252c15fef..3692839ebbe 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -2692,15 +2692,15 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
*/
public function __construct() {
// switch next two lines for ol li containers for form items.
- // $this->_elementTemplates=array('default'=>"\n\t\t".'{label}{help}{req} {error} {element}
');
+ // $this->_elementTemplates=array('default'=>"\n\t\t".'{label}{help}{req} {error} {element}
');
$this->_elementTemplates = array(
- 'default'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element}
',
+ 'default'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element}
',
- 'actionbuttons'=>"\n\t\t".'',
+ 'actionbuttons'=>"\n\t\t".'',
- 'fieldset'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element} ',
+ 'fieldset'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element} ',
- 'static'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element}
',
+ 'static'=>"\n\t\t".'{label}{req}{advancedimg} {help}
{error} {element}
',
'warning'=>"\n\t\t".'{element}
',
@@ -2825,7 +2825,8 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
}
$html = str_replace('{id}', $group->getAttribute('id'), $html);
$html = str_replace('{name}', $group->getName(), $html);
- $html = str_replace('{type}', 'fgroup', $html);
+ $html = str_replace('{typeclass}', 'fgroup', $html);
+ $html = str_replace('{type}', 'group', $html);
$html = str_replace('{class}', $group->getAttribute('class'), $html);
$emptylabel = '';
if ($group->getLabel() == '') {
@@ -2888,7 +2889,8 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
$html = str_replace('{advancedimg}', '', $html);
}
$html = str_replace('{id}', 'fitem_' . $element->getAttribute('id'), $html);
- $html = str_replace('{type}', 'f' . $element->getType(), $html);
+ $html = str_replace('{typeclass}', 'f' . $element->getType(), $html);
+ $html = str_replace('{type}', $element->getType(), $html);
$html = str_replace('{name}', $element->getName(), $html);
$html = str_replace('{class}', $element->getAttribute('class'), $html);
$emptylabel = '';
@@ -2914,7 +2916,11 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
if (!$fromtemplate) {
parent::renderElement($element, $required, $error);
- } else { // CRAZZY!
+ } else {
+ if (in_array($element->getName(), $this->_stopFieldsetElements) && $this->_fieldsetsOpen > 0) {
+ $this->_html .= $this->_closeFieldsetTemplate;
+ $this->_fieldsetsOpen--;
+ }
$this->_html .= $html;
}
}
diff --git a/lib/javascript-static.js b/lib/javascript-static.js
index 4cbbefceee5..e0438e69198 100644
--- a/lib/javascript-static.js
+++ b/lib/javascript-static.js
@@ -283,7 +283,7 @@ M.util.show_confirm_dialog = function(e, args) {
} else if ((targetancestor = target.ancestor('a')) !== null) {
window.location = targetancestor.get('href');
- } else if (target.test('input')) {
+ } else if (target.test('input') || target.test('button')) {
targetform = target.ancestor('form', true);
if (!targetform) {
return;
@@ -299,7 +299,7 @@ M.util.show_confirm_dialog = function(e, args) {
} else {
Y.log("Element of type " + target.get('tagName') +
- " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, or FORM",
+ " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, BUTTON or FORM",
'warn', 'javascript-static');
}
}, this);
diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index 80f614d6691..34eedaf4a6a 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -936,6 +936,7 @@ class single_select implements renderable, templatable {
$data->label = $this->label;
$data->disabled = $this->disabled;
$data->title = $this->tooltip;
+ $data->formid = $this->formid;
$data->id = !empty($attributes['id']) ? $attributes['id'] : html_writer::random_id('single_select');
unset($attributes['id']);
@@ -971,11 +972,30 @@ class single_select implements renderable, templatable {
$data->nothingkey = $hasnothing ? key($nothing) : false;
foreach ($options as $value => $name) {
- $data->options[] = [
- 'value' => $value,
- 'name' => $options[$value],
- 'selected' => $this->selected == $value
- ];
+ if (is_array($options[$value])) {
+ foreach ($options[$value] as $optgroupname => $optgroupvalues) {
+ $sublist = [];
+ foreach ($optgroupvalues as $optvalue => $optname) {
+ $sublist[] = [
+ 'value' => $optvalue,
+ 'name' => $optname,
+ 'selected' => strval($this->selected) === strval($optvalue),
+ ];
+ }
+ $data->options[] = [
+ 'name' => $optgroupname,
+ 'optgroup' => true,
+ 'options' => $sublist
+ ];
+ }
+ } else {
+ $data->options[] = [
+ 'value' => $value,
+ 'name' => $options[$value],
+ 'selected' => strval($this->selected) === strval($value),
+ 'optgroup' => false
+ ];
+ }
}
// Label attributes.
diff --git a/lib/templates/action_link.mustache b/lib/templates/action_link.mustache
index c3a3bb5f6d9..43421a67de1 100644
--- a/lib/templates/action_link.mustache
+++ b/lib/templates/action_link.mustache
@@ -18,7 +18,7 @@
Action link.
}}
{{^disabled}}
- {{#icon}}{{>core/pix_icon}}{{/icon}}{{{text}}}
+ {{#icon}}{{>core/pix_icon}}{{/icon}}{{{text}}}
{{#hasactions}}
{{> core/actions }}
{{/hasactions}}
diff --git a/lib/tests/behat/behat_action_menu.php b/lib/tests/behat/behat_action_menu.php
new file mode 100644
index 00000000000..de892ecf55d
--- /dev/null
+++ b/lib/tests/behat/behat_action_menu.php
@@ -0,0 +1,77 @@
+.
+
+/**
+ * Steps definitions to open and close action menus.
+ *
+ * @package core
+ * @category test
+ * @copyright 2016 Damyon Wiese
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
+
+require_once(__DIR__ . '/../../behat/behat_base.php');
+
+use Behat\Mink\Exception\ExpectationException as ExpectationException;
+use Behat\Mink\Exception\DriverException as DriverException;
+
+/**
+ * Steps definitions to open and close action menus.
+ *
+ * @package core
+ * @category test
+ * @copyright 2016 Damyon Wiese
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class behat_action_menu extends behat_base {
+
+ /**
+ * Open the action menu in
+ *
+ * @Given /^I open the action menu in "(?P(?:[^"]|\\")*)" "(?P[^"]*)"$/
+ * @param string $element
+ * @param string $selector
+ * @return void
+ */
+ public function i_open_the_action_menu_in($element, $selectortype) {
+ if (!$this->running_javascript()) {
+ throw new DriverException('Open the action menu step is not available with Javascript disabled');
+ }
+ // Gets the node based on the requested selector type and locator.
+ $node = $this->get_node_in_container("css_element", "[role=menuitem][aria-haspopup=true]", $selectortype, $element);
+ $this->ensure_node_is_visible($node);
+ $node->click();
+ }
+
+ /**
+ * When an action menu is open, follow one of the items in it.
+ *
+ * @Given /^I choose "(?P(?:[^"]|\\")*)" in the open action menu$/
+ * @param string $linkstring
+ * @return void
+ */
+ public function i_choose_in_the_open_action_menu($linkstring) {
+ if (!$this->running_javascript()) {
+ throw new DriverException('Action menu steps are not available with Javascript disabled');
+ }
+ // Gets the node based on the requested selector type and locator.
+ $node = $this->get_node_in_container("link", $linkstring, "css_element", ".moodle-actionmenu [role=menu][aria-hidden=false]");
+ $this->ensure_node_is_visible($node);
+ $node->click();
+ }
+}
diff --git a/lib/tests/behat/behat_deprecated.php b/lib/tests/behat/behat_deprecated.php
index b257482168c..46493eaf9c3 100644
--- a/lib/tests/behat/behat_deprecated.php
+++ b/lib/tests/behat/behat_deprecated.php
@@ -287,6 +287,16 @@ class behat_deprecated extends behat_base {
$this->execute('behat_forms::i_set_the_field_to_multiline', array($field, $value));
}
+ /**
+ * Click on a given link in the moodle-actionmenu that is currently open.
+ * @Given /^I follow "(?P(?:[^"]|\\")*)" in the open menu$/
+ * @param string $linkstring the text (or id, etc.) of the link to click.
+ */
+ public function i_follow_in_the_open_menu($linkstring) {
+ $alternative = 'I choose "' . $this->escape($linkstring) . '" from the open action menu';
+ $this->deprecated_message($alternative, true);
+ }
+
/**
* Throws an exception if $CFG->behat_usedeprecated is not allowed.
*
diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php
index 5398e0a0aad..6b0b8e8726c 100644
--- a/lib/tests/behat/behat_hooks.php
+++ b/lib/tests/behat/behat_hooks.php
@@ -613,4 +613,4 @@ class behat_hooks extends behat_base {
* @copyright 2016 Rajesh Taneja
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-class behat_stop_exception extends \Exception{}
\ No newline at end of file
+class behat_stop_exception extends \Exception{}
diff --git a/mod/assign/amd/build/grading_panel.min.js b/mod/assign/amd/build/grading_panel.min.js
index 012556a6e1e..3bd700c25ed 100644
--- a/mod/assign/amd/build/grading_panel.min.js
+++ b/mod/assign/amd/build/grading_panel.min.js
@@ -1 +1 @@
-define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events"],function(a,b,c,d,e,f,g,h){var i=function(b){this._regionSelector=b,this._region=a(b),this._userCache=[],this.registerEventListeners()};return i.prototype._regionSelector=null,i.prototype._lastUserId=0,i.prototype._lastAttemptNumber=-1,i.prototype._region=null,i.prototype._niceReplaceNodeContents=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},i.prototype._saveFormState=function(){"undefined"!=typeof window.tinyMCE&&window.tinyMCE.triggerSave();var b=a('[data-region="grading-actions-form"] [name="sendstudentnotifications"]').val();a('.gradeform [name="sendstudentnotifications"]').val(b)},i.prototype._submitForm=function(c,d){var f=a(this._region.find("form.gradeform"));a('[data-region="overlay"]').show(),f.trigger("save-form-state");var g=f.serialize(),h=this._region.attr("data-assignmentid");e.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:h,userid:this._lastUserId,jsonformdata:JSON.stringify(g)},done:this._handleFormSubmissionResponse.bind(this,g,d),fail:b.exception}])},i.prototype._handleFormSubmissionResponse=function(c,d,e){"undefined"==typeof d&&(d=this._lastUserId),e.length?a(document).trigger("reset",[this._lastUserId,c]):(f.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){b.alert(a[0],a[1])}).fail(b.exception),d==this._lastUserId?a(document).trigger("reset",d):a(document).trigger("user-changed",d)),a('[data-region="overlay"]').hide()},i.prototype._resetForm=function(b,c,d){var e=a.Event("custom");"undefined"==typeof c&&(c=this._lastUserId),this._lastUserId=0,this._refreshGradingPanel(e,c,d)},i.prototype._chooseAttempt=function(c){var d=a(c.target),e=d.data("submissions"),g=a(document.getElementById(e)),h=g.clone(),i=h.wrap(a("")).html();f.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],i,c[1],c[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(b.exception)},i.prototype._addPopoutButtons=function(d){var e=a(d);c.render("mod_assign/popout_button",{}).done(function(a){e.find(".fitem_ffilemanager .fitemtitle").append(a),e.find(".fitem_feditor .fitemtitle").append(a),e.find(".fitem_f .fitemtitle").append(a),e.on("click",'[data-region="popout-button"]',this._togglePopout.bind(this))}.bind(this)).fail(b.exception)},i.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");c.hasClass("popout")?a(".popout").removeClass("popout"):(a(".popout").removeClass("popout"),c.addClass("popout"),c.addClass("moodle-has-zindex"))},i.prototype._refreshGradingPanel=function(e,f,h,i){var j=this._region.attr("data-contextid");"undefined"==typeof h&&(h=""),"undefined"==typeof i&&(i=-1),this._lastUserId==f&&this._lastAttemptNumber==i&&""===h||(this._lastUserId=f,this._lastAttemptNumber=i,a(document).trigger("start-loading-user"),window.M.util.js_pending("mod-assign-loading-user"),c.render("mod_assign/loading",{}).done(function(c,e){this._niceReplaceNodeContents(this._region,c,e).done(function(){if(f>0){this._region.show();var c={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(h)};d.loadFragment("mod_assign","gradingpanel",j,c).done(function(c,d){this._niceReplaceNodeContents(this._region,c,d).done(function(){g.saveFormState('[data-region="grade-panel"] .gradeform'),a(document).on("editor-content-restored",function(){g.saveFormState('[data-region="grade-panel"] .gradeform')}),a('[data-region="attempt-chooser"]').on("click",this._chooseAttempt.bind(this)),this._addPopoutButtons('[data-region="grade-panel"] .gradeform'),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)}else{this._region.hide();var e=a('[data-region="review-panel"]');e.length&&this._niceReplaceNodeContents(e,"",""),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(b.exception))},i.prototype.getPanelElement=function(){return a('[data-region="grade-panel"]')},i.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")},i.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")},i.prototype.registerEventListeners=function(){var b=a(document);b.on("user-changed",this._refreshGradingPanel.bind(this)),b.on("save-changes",this._submitForm.bind(this)),b.on("reset",this._resetForm.bind(this)),b.on("save-form-state",this._saveFormState.bind(this)),b.on(h.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this)),b.on(h.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),b.on(h.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))},i});
\ No newline at end of file
+define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events"],function(a,b,c,d,e,f,g,h){var i=function(b){this._regionSelector=b,this._region=a(b),this._userCache=[],this.registerEventListeners()};return i.prototype._regionSelector=null,i.prototype._lastUserId=0,i.prototype._lastAttemptNumber=-1,i.prototype._region=null,i.prototype._niceReplaceNodeContents=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},i.prototype._saveFormState=function(){"undefined"!=typeof window.tinyMCE&&window.tinyMCE.triggerSave();var b=a('[data-region="grading-actions-form"] [name="sendstudentnotifications"]').val();a('.gradeform [name="sendstudentnotifications"]').val(b)},i.prototype._submitForm=function(c,d){var f=a(this._region.find("form.gradeform"));a('[data-region="overlay"]').show(),f.trigger("save-form-state");var g=f.serialize(),h=this._region.attr("data-assignmentid");e.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:h,userid:this._lastUserId,jsonformdata:JSON.stringify(g)},done:this._handleFormSubmissionResponse.bind(this,g,d),fail:b.exception}])},i.prototype._handleFormSubmissionResponse=function(c,d,e){"undefined"==typeof d&&(d=this._lastUserId),e.length?a(document).trigger("reset",[this._lastUserId,c]):(f.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){b.alert(a[0],a[1])}).fail(b.exception),d==this._lastUserId?a(document).trigger("reset",d):a(document).trigger("user-changed",d)),a('[data-region="overlay"]').hide()},i.prototype._resetForm=function(b,c,d){var e=a.Event("custom");"undefined"==typeof c&&(c=this._lastUserId),this._lastUserId=0,this._refreshGradingPanel(e,c,d)},i.prototype._chooseAttempt=function(c){var d=a(c.target),e=d.data("submissions"),g=a(document.getElementById(e)),h=g.clone(),i=h.wrap(a("")).html();f.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],i,c[1],c[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(b.exception)},i.prototype._addPopoutButtons=function(d){var e=a(d);c.render("mod_assign/popout_button",{}).done(function(a){var b=e.find('[data-fieldtype="filemanager"],[data-fieldtype="editor"],[data-fieldtype="grading"]').closest(".fitem");b.addClass("has-popout").find("label").parent().append(a),e.on("click",'[data-region="popout-button"]',this._togglePopout.bind(this))}.bind(this)).fail(b.exception)},i.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");c.hasClass("popout")?a(".popout").removeClass("popout"):(a(".popout").removeClass("popout"),c.addClass("popout"),c.addClass("moodle-has-zindex"))},i.prototype._refreshGradingPanel=function(e,f,h,i){var j=this._region.attr("data-contextid");"undefined"==typeof h&&(h=""),"undefined"==typeof i&&(i=-1),this._lastUserId==f&&this._lastAttemptNumber==i&&""===h||(this._lastUserId=f,this._lastAttemptNumber=i,a(document).trigger("start-loading-user"),window.M.util.js_pending("mod-assign-loading-user"),c.render("mod_assign/loading",{}).done(function(c,e){this._niceReplaceNodeContents(this._region,c,e).done(function(){if(f>0){this._region.show();var c={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(h)};d.loadFragment("mod_assign","gradingpanel",j,c).done(function(c,d){this._niceReplaceNodeContents(this._region,c,d).done(function(){g.saveFormState('[data-region="grade-panel"] .gradeform'),a(document).on("editor-content-restored",function(){g.saveFormState('[data-region="grade-panel"] .gradeform')}),a('[data-region="attempt-chooser"]').on("click",this._chooseAttempt.bind(this)),this._addPopoutButtons('[data-region="grade-panel"] .gradeform'),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)}else{this._region.hide();var e=a('[data-region="review-panel"]');e.length&&this._niceReplaceNodeContents(e,"",""),a(document).trigger("finish-loading-user"),window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(b.exception))},i.prototype.getPanelElement=function(){return a('[data-region="grade-panel"]')},i.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")},i.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")},i.prototype.registerEventListeners=function(){var b=a(document);b.on("user-changed",this._refreshGradingPanel.bind(this)),b.on("save-changes",this._submitForm.bind(this)),b.on("reset",this._resetForm.bind(this)),b.on("save-form-state",this._saveFormState.bind(this)),b.on(h.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this)),b.on(h.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this)),b.on(h.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))},i});
\ No newline at end of file
diff --git a/mod/assign/amd/src/grading_panel.js b/mod/assign/amd/src/grading_panel.js
index 7cb42fb58d6..4f380b814e4 100644
--- a/mod/assign/amd/src/grading_panel.js
+++ b/mod/assign/amd/src/grading_panel.js
@@ -216,9 +216,9 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
var region = $(selector);
templates.render('mod_assign/popout_button', {}).done(function(html) {
- region.find('.fitem_ffilemanager .fitemtitle').append(html);
- region.find('.fitem_feditor .fitemtitle').append(html);
- region.find('.fitem_f .fitemtitle').append(html);
+ var parents = region.find('[data-fieldtype="filemanager"],[data-fieldtype="editor"],[data-fieldtype="grading"]')
+ .closest('.fitem');
+ parents.addClass('has-popout').find('label').parent().append(html);
region.on('click', '[data-region="popout-button"]', this._togglePopout.bind(this));
}.bind(this)).fail(notification.exception);
diff --git a/mod/chat/tests/behat/chat_course_reset.feature b/mod/chat/tests/behat/chat_course_reset.feature
index 89ea3f23439..bbb4a5be90d 100644
--- a/mod/chat/tests/behat/chat_course_reset.feature
+++ b/mod/chat/tests/behat/chat_course_reset.feature
@@ -41,7 +41,7 @@ Feature: Chat reset
And I press "Save and display"
When I navigate to "Reset" node in "Course administration"
And I set the following fields to these values:
- | id_reset_start_date_enabled | 1 |
+ | reset_start_date[enabled] | 1 |
| reset_start_date[day] | 1 |
| reset_start_date[month] | January |
| reset_start_date[year] | 2030 |
@@ -52,4 +52,4 @@ Feature: Chat reset
And I follow "Test chat name"
And I navigate to "Edit settings" node in "Chat administration"
And I expand all fieldsets
- And the "id_chattime_year" select box should contain "2030"
+ And the "chattime[year]" select box should contain "2030"
diff --git a/mod/data/tests/behat/required_entries.feature b/mod/data/tests/behat/required_entries.feature
index 39d34232fec..f10f83dd92c 100644
--- a/mod/data/tests/behat/required_entries.feature
+++ b/mod/data/tests/behat/required_entries.feature
@@ -129,26 +129,26 @@ Feature: Users can be required to specify certain fields when adding entries to
And I add an entry to "Test database name" database with:
| Base Text input | Some input to allow us to submit the otherwise empty form |
And I press "Save and view"
- Then ".alert.alert-error" "css_element" should exist in the "Required Checkbox" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Two-Option Checkbox" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Latlong" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Menu" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Number" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Radio" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Text input" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Text area" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required URL" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Multimenu" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Required Two-Option Multimenu" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Checkbox" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Latlong" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Menu" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Number" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Radio" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Text input" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Text area" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required URL" "table_row"
- And ".alert.alert-error" "css_element" should not exist in the "Not required Multimenu" "table_row"
+ Then ".alert" "css_element" should exist in the "Required Checkbox" "table_row"
+ And ".alert" "css_element" should exist in the "Required Two-Option Checkbox" "table_row"
+ And ".alert" "css_element" should exist in the "Required Latlong" "table_row"
+ And ".alert" "css_element" should exist in the "Required Menu" "table_row"
+ And ".alert" "css_element" should exist in the "Required Number" "table_row"
+ And ".alert" "css_element" should exist in the "Required Radio" "table_row"
+ And ".alert" "css_element" should exist in the "Required Text input" "table_row"
+ And ".alert" "css_element" should exist in the "Required Text area" "table_row"
+ And ".alert" "css_element" should exist in the "Required URL" "table_row"
+ And ".alert" "css_element" should exist in the "Required Multimenu" "table_row"
+ And ".alert" "css_element" should exist in the "Required Two-Option Multimenu" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Checkbox" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Latlong" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Menu" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Number" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Radio" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Text input" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Text area" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required URL" "table_row"
+ And ".alert" "css_element" should not exist in the "Not required Multimenu" "table_row"
And I follow "View list"
And I should see "No entries in database"
@@ -221,8 +221,8 @@ Feature: Users can be required to specify certain fields when adding entries to
| Required Two-Option Multimenu | 1 |
And I set the field with xpath "//div[@title='Not required Latlong']//tr[td/label[normalize-space(.)='Latitude']]/td/input" to "20"
And I press "Save and view"
- Then ".alert.alert-error" "css_element" should exist in the "Required Latlong" "table_row"
- And ".alert.alert-error" "css_element" should exist in the "Not required Latlong" "table_row"
+ Then ".alert" "css_element" should exist in the "Required Latlong" "table_row"
+ And ".alert" "css_element" should exist in the "Not required Latlong" "table_row"
Scenario: A student filling in number and text fields with zero will not see an error.
Given I log in as "student1"
@@ -244,4 +244,4 @@ Feature: Users can be required to specify certain fields when adding entries to
And I press "Save and view"
And I follow "View list"
Then I should not see "No entries in database"
- And I should see "Some input to allow us to submit the otherwise empty form"
\ No newline at end of file
+ And I should see "Some input to allow us to submit the otherwise empty form"
diff --git a/mod/feedback/classes/complete_form.php b/mod/feedback/classes/complete_form.php
index 9573a64f611..48a0b6acd5c 100644
--- a/mod/feedback/classes/complete_form.php
+++ b/mod/feedback/classes/complete_form.php
@@ -446,7 +446,6 @@ class mod_feedback_complete_form extends moodleform {
$menu->set_constraint('.feedback_form');
$menu->set_alignment(action_menu::TR, action_menu::BR);
$menu->set_menu_trigger(get_string('edit'));
- $menu->do_not_enhance();
$menu->prioritise = true;
$itemobj = feedback_get_item_class($item->typ);
diff --git a/mod/feedback/styles.css b/mod/feedback/styles.css
index 1a4e4458bc5..4cb2aef6f57 100644
--- a/mod/feedback/styles.css
+++ b/mod/feedback/styles.css
@@ -33,92 +33,6 @@
.path-mod-feedback #analysis-form label { display: inline; }
-.path-mod-feedback .mform.feedback_form .fitem .fitemtitle {
- display: block;
- margin-top: 4px;
- margin-bottom: 4px;
- text-align: left;
- width: 100%;
-}
-
-.path-mod-feedback .mform.feedback_form .fitem .felement {
- margin-left: 0;
- width: 100%;
- float: left;
- padding-left: 0;
- padding-right: 0;
-}
-
-.path-mod-feedback .mform.feedback_form .fitem .fstatic:empty {
- display: none;
-}
-
-.path-mod-feedback .mform.feedback_form .fitem .fcheckbox > span,
-.path-mod-feedback .mform.feedback_form .fitem .fradio > span,
-.path-mod-feedback .mform.feedback_form .fitem .fgroup > span {
- margin-top: 4px;
-}
-
-body.path-mod-feedback #region-main .mform.feedback_form .femptylabel .fitemtitle {
- display: inline-block;
- width: auto;
- margin-right: 0;
-}
-
-.path-mod-feedback .mform.feedback_form .femptylabel .felement {
- display: inline-block;
- margin-top: 4px;
- padding-top: 5px;
- width: auto;
-}
-
-body.path-mod-feedback #region-main .mform.feedback_form .feedback-item-pagebreak .felement {
- width: 100%;
-}
-
-.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .fitemtitle,
-.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement {
- display: inline-block;
- width: auto;
-}
-
-.path-mod-feedback .mform.feedback_form .fitem_fcheckbox .felement {
- padding: 6px;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_viewresponse_form .fitem.feedback_hasvalue:not(.feedback-item-captcha) .felement {
- background: #FBFBF1;
- min-height: 1em;
- box-sizing: border-box;
- padding: 3px;
- border: 1px solid #ddd
-}
-
-.path-mod-feedback .mform.feedback_form .fitem.feedback_hasvalue .fstatic:empty {
- display: inherit;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem:hover {
- background: #f5f5f5;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle label {
- width: 100%;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle {
- position: relative;
- width: 100%;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemdd,
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemname {
- float: left;
-}
-
-.path-mod-feedback .mform.feedback_form#feedback_edit_form .fitem .fitemtitle .itemtitle .itemactions {
- float: right;
-}
.path-mod-feedback .templateslist td.cell.action,
.path-mod-feedback .templateslist th.header.action {
diff --git a/mod/feedback/tests/behat/coursemapping.feature b/mod/feedback/tests/behat/coursemapping.feature
index 047a35e9b4b..8943c07550b 100644
--- a/mod/feedback/tests/behat/coursemapping.feature
+++ b/mod/feedback/tests/behat/coursemapping.feature
@@ -115,7 +115,7 @@ Feature: Mapping courses in a feedback
And I follow "Course feedback"
And I follow "Analysis"
- And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element"
+ And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
And I show chart data for the "multichoicerated" feedback
And I should see "1 (33.33 %)" in the "option a" "table_row"
And I should see "1 (33.33 %)" in the "option b" "table_row"
@@ -127,7 +127,7 @@ Feature: Mapping courses in a feedback
And I follow "Back"
And I set the field "Filter by course" to "Course 1"
And I press "Filter"
- And I should see "Course 1" in the "#feedback_course_filter .fautocomplete .label" "css_element"
+ And I should see "Course 1" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
And I show chart data for the "multichoicerated" feedback
And I should see "0" in the "option a" "table_row"
And I should see "1 (50.00 %)" in the "option b" "table_row"
@@ -198,7 +198,7 @@ Feature: Mapping courses in a feedback
And I am on site homepage
And I follow "Course feedback"
And I follow "Analysis"
- And I should see "All courses" in the "#feedback_course_filter .fautocomplete .label" "css_element"
+ And I should see "All courses" in the "#feedback_course_filter [data-fieldtype=autocomplete] .form-autocomplete-selection [role=listitem]" "css_element"
And I show chart data for the "multichoicerated" feedback
And I should see "0" in the "option a" "table_row"
And I should see "1 (33.33 %)" in the "option b" "table_row"
@@ -236,7 +236,7 @@ Feature: Mapping courses in a feedback
And I am on site homepage
And I follow "Turn editing on"
And I add the "Feedback" block
- And I click on "Delete" "link" in the "//div[contains(@class,'block_site_main_menu')]//li[contains(.,'Course feedback')]" "xpath_element"
+ And I click on "Delete" "link" in the "//*[contains(@class,'block_site_main_menu')]//li[contains(.,'Course feedback')]" "xpath_element"
And I press "Yes"
And I follow "Turn editing off"
And I am on site homepage
diff --git a/mod/feedback/tests/behat/multichoice.feature b/mod/feedback/tests/behat/multichoice.feature
index 0a672a1af24..dc20d35562d 100644
--- a/mod/feedback/tests/behat/multichoice.feature
+++ b/mod/feedback/tests/behat/multichoice.feature
@@ -86,7 +86,7 @@ Feature: Testing multichoice questions in feedback
And I should not see "this is the third page of the feedback"
And I press "Next page"
# We are still on the second page because the field is required
- And I should see "Required" in the ".error" "css_element"
+ And I should see "Required" in the "form" "css_element"
And I should see "this is the second page of the feedback"
And I set the field "option e" to "1"
And the following fields match these values:
@@ -158,7 +158,8 @@ Feature: Testing multichoice questions in feedback
And I should see "1 (100.00 %)" in the "option i" "table_row"
# Change the settings so we don't analyse empty submits
And I follow "Edit questions"
- And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I choose "Edit question" in the open action menu
And I set the field "Do not analyse empty submits" to "Yes"
And I press "Save changes to question"
And I follow "Analysis"
@@ -228,7 +229,7 @@ Feature: Testing multichoice questions in feedback
And I should not see "this is the third page of the feedback"
And I press "Next page"
# We are still on the second page because the field is required
- And I should see "Required" in the ".error" "css_element"
+ And I should see "Required" in the "form" "css_element"
And I should see "this is the second page of the feedback"
And I set the field "option e" to "1"
And I set the field "option f" to "1"
@@ -301,7 +302,8 @@ Feature: Testing multichoice questions in feedback
And I should see "1 (100.00 %)" in the "option i" "table_row"
# Change the settings so we don't analyse empty submits
And I follow "Edit questions"
- And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I choose "Edit question" in the open action menu
And I set the field "Do not analyse empty submits" to "Yes"
And I press "Save changes to question"
And I follow "Analysis"
@@ -363,7 +365,7 @@ Feature: Testing multichoice questions in feedback
And I should not see "this is the third page of the feedback"
And I press "Next page"
# We are still on the second page because the field is required
- And I should see "Required" in the ".error" "css_element"
+ And I should see "Required" in the "form" "css_element"
And I should see "this is the second page of the feedback"
And I set the field "this is a multiple choice 2" to "option e"
And I press "Next page"
@@ -423,7 +425,8 @@ Feature: Testing multichoice questions in feedback
And I should see "1 (100.00 %)" in the "option i" "table_row"
# Change the settings so we don't analyse empty submits
And I follow "Edit questions"
- And I click on "Edit question" "link" in the "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
+ And I choose "Edit question" in the open action menu
And I set the field "Do not analyse empty submits" to "Yes"
And I press "Save changes to question"
And I follow "Analysis"
diff --git a/mod/feedback/yui/dragdrop/dragdrop.js b/mod/feedback/yui/dragdrop/dragdrop.js
index 7ade1ea9562..532f7729200 100644
--- a/mod/feedback/yui/dragdrop/dragdrop.js
+++ b/mod/feedback/yui/dragdrop/dragdrop.js
@@ -4,8 +4,7 @@ YUI.add('moodle-mod_feedback-dragdrop', function(Y) {
DRAGAREA : '#feedback_dragarea',
DRAGITEMCLASS : 'feedback_itemlist',
DRAGITEM : 'div.feedback_itemlist',
- DRAGLIST : '#feedback_dragarea form > fieldset > div',
- ITEMBOX : '#feedback_item_box_',
+ DRAGLIST : '#feedback_dragarea form',
DRAGHANDLE : 'itemhandle'
};
@@ -29,8 +28,7 @@ YUI.add('moodle-mod_feedback-dragdrop', function(Y) {
basenode = Y.Node.one(CSS.DRAGLIST);
listitems = basenode.all(CSS.DRAGITEM).each(function(v) {
var item_id = this.get_node_id(v.get('id')); //Get the id of the feedback item.
- var item_box = Y.Node.one(CSS.ITEMBOX + item_id); //Get the current item box so we can add the drag handle.
- item_box.append(this.mydraghandle.cloneNode(true)); // Insert the new handle into the item box.
+ v.append(this.mydraghandle.cloneNode(true)); // Insert the new handle into the item box.
}, this);
//We use a delegate to make all items draggable
diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php
index b49e3f655fc..a1eec3bf89e 100644
--- a/mod/lesson/locallib.php
+++ b/mod/lesson/locallib.php
@@ -536,7 +536,7 @@ function lesson_menu_block_contents($cmid, $lesson) {
return null;
}
- $content = ''.get_string('skip', 'lesson')." \n