Merge branch 'MDL-56190-master' of git://github.com/damyon/moodle

This commit is contained in:
Dan Poltawski 2016-11-10 13:43:35 +00:00
commit 158ab03e12
32 changed files with 201 additions and 258 deletions

View File

@ -25,9 +25,10 @@ M.availability_completion.form.initInner = function(cms) {
M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
' <span class="availability-group form-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
@ -36,13 +37,14 @@ M.availability_completion.form.getNode = function(json) {
}
html += '</select></label> <label><span class="accesshide">' +
M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
' </span><select class="custom-select" ' +
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values.
if (json.cm !== undefined &&

View File

@ -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")+' <span class="availability-group"><label>'+'<span class="accesshide">'+M.util.get_string("label_cm","availability_completion")+" </span>"+'<select name="cm" title="'+M.util.get_string("label_cm","availability_completion")+'">'+'<option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.cms.length;r++){var i=this.cms[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_completion","availability_completion")+' </span><select name="e" title="'+M.util.get_string("label_completion","availability_completion")+'">'+'<option value="1">'+M.util.get_string("option_complete","availability_completion")+"</option>"+'<option value="0">'+M.util.get_string("option_incomplete","availability_completion")+"</option>"+'<option value="2">'+M.util.get_string("option_pass","availability_completion")+"</option>"+'<option value="3">'+M.util.get_string("option_fail","availability_completion")+"</option>"+"</select></label></span>";var s=e.Node.create("<span>"+n+"</span>");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"]});
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='<span class="col-form-label p-r-1"> '+M.util.get_string("title","availability_completion")+"</span>"+' <span class="availability-group form-group"><label>'+'<span class="accesshide">'+M.util.get_string("label_cm","availability_completion")+" </span>"+'<select class="custom-select" name="cm" title="'+M.util.get_string("label_cm","availability_completion")+'">'+'<option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.cms.length;r++){var i=this.cms[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_completion","availability_completion")+' </span><select class="custom-select" '+'name="e" title="'+M.util.get_string("label_completion","availability_completion")+'">'+'<option value="1">'+M.util.get_string("option_complete","availability_completion")+"</option>"+'<option value="0">'+M.util.get_string("option_incomplete","availability_completion")+"</option>"+'<option value="2">'+M.util.get_string("option_pass","availability_completion")+"</option>"+'<option value="3">'+M.util.get_string("option_fail","availability_completion")+"</option>"+"</select></label></span>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");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"]});

View File

@ -25,9 +25,10 @@ M.availability_completion.form.initInner = function(cms) {
M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
' <span class="availability-group form-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
@ -36,13 +37,14 @@ M.availability_completion.form.getNode = function(json) {
}
html += '</select></label> <label><span class="accesshide">' +
M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
' </span><select class="custom-select" ' +
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values.
if (json.cm !== undefined &&

View File

@ -23,9 +23,10 @@ M.availability_completion.form.initInner = function(cms) {
M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
' <span class="availability-group form-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
@ -34,13 +35,14 @@ M.availability_completion.form.getNode = function(json) {
}
html += '</select></label> <label><span class="accesshide">' +
M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
' </span><select class="custom-select" ' +
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values.
if (json.cm !== undefined &&

View File

@ -151,7 +151,7 @@ class frontend extends \core_availability\frontend {
// NOTE: The fields need to have these weird names in order that they
// match the standard Moodle form control, otherwise the date selector
// won't find them.
$html .= \html_writer::start_tag('select', array('name' => 'x[' . $field . ']'));
$html .= \html_writer::start_tag('select', array('name' => 'x[' . $field . ']', 'class' => 'custom-select'));
foreach ($options as $key => $value) {
$params = array('value' => $key);
if ($current[$field] == $key) {

View File

@ -29,9 +29,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
};
M.availability_date.form.getNode = function(json) {
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
var html = '<span class="col-form-label p-r-1">' +
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
'<select name="direction">' +
'<select name="direction" class="custom-select">' +
'<option value="&gt;=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
'<option value="&lt;">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
'</select></label></span> ' + this.html;

View File

@ -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")+' <span class="availability-group">'+'<label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+" </span>"+'<select name="direction">'+'<option value="&gt;=">'+M.util.get_string("direction_from","availability_date")+"</option>"+'<option value="&lt;">'+M.util.get_string("direction_until","availability_date")+"</option>"+"</select></label></span> "+this.html,r=e.Node.create("<span>"+n+"</span>");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"]});
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='<span class="col-form-label p-r-1">'+M.util.get_string("direction_before","availability_date")+'</span> <span class="availability-group">'+'<label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+" </span>"+'<select name="direction" class="custom-select">'+'<option value="&gt;=">'+M.util.get_string("direction_from","availability_date")+"</option>"+'<option value="&lt;">'+M.util.get_string("direction_until","availability_date")+"</option>"+"</select></label></span> "+this.html,r=e.Node.create("<span>"+n+"</span>");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"]});

View File

@ -29,9 +29,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
};
M.availability_date.form.getNode = function(json) {
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
var html = '<span class="col-form-label p-r-1">' +
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
'<select name="direction">' +
'<select name="direction" class="custom-select">' +
'<option value="&gt;=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
'<option value="&lt;">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
'</select></label></span> ' + this.html;

View File

@ -27,9 +27,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
};
M.availability_date.form.getNode = function(json) {
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
var html = '<span class="col-form-label p-r-1">' +
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
'<select name="direction">' +
'<select name="direction" class="custom-select">' +
'<option value="&gt;=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
'<option value="&lt;">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
'</select></label></span> ' + this.html;

View File

@ -37,24 +37,27 @@ M.availability_grade.form.getNode = function(json) {
this.nodesSoFar++;
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.grades.length; i++) {
var grade = this.grades[i];
// String has already been escaped using format_string.
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
}
html += '</select></span></label> <span class="availability-group">' +
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
html += '</select></span></label> <br><span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
M.util.get_string('option_min', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
'</span><input type="text" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
'<span class="availability-group">' +
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
'<span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
M.util.get_string('option_max', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
'</span><input type="text" name="maxval" title="' +
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
// Set initial values.
if (json.id !== undefined &&

View File

@ -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="<label>"+M.util.get_string("title","availability_grade")+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.grades.length;r++){var i=this.grades[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+M.util.get_string("option_min","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_min","availability_grade")+'</span><input type="text" name="minval" title="'+M.util.get_string("label_min","availability_grade")+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+M.util.get_string("option_max","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_max","availability_grade")+'</span><input type="text" name="maxval" title="'+M.util.get_string("label_max","availability_grade")+'"/></label>%</span>';var s=e.Node.create("<span>"+n+"</span>");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"]});
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='<label class="form-group"><span class="p-r-1">'+M.util.get_string("title","availability_grade")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select"><option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.grades.length;r++){var i=this.grades[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></span></label> <br><span class="availability-group form-group"><label><input type="checkbox" class="form-check-input m-x-1" name="min"/>'+M.util.get_string("option_min","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_min","availability_grade")+'</span><input type="text" class="form-control m-x-1" name="minval" title="'+M.util.get_string("label_min","availability_grade")+'"/></label>%</span><br>'+'<span class="availability-group form-group">'+'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>'+M.util.get_string("option_max","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_max","availability_grade")+'</span><input type="text" class="form-control m-x-1" name="maxval" title="'+M.util.get_string("label_max","availability_grade")+'"/></label>%</span>';var s=e.Node.create('<div class="d-inline-block form-inline">'+n+"</div>");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"]});

View File

@ -37,24 +37,27 @@ M.availability_grade.form.getNode = function(json) {
this.nodesSoFar++;
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.grades.length; i++) {
var grade = this.grades[i];
// String has already been escaped using format_string.
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
}
html += '</select></span></label> <span class="availability-group">' +
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
html += '</select></span></label> <br><span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
M.util.get_string('option_min', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
'</span><input type="text" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
'<span class="availability-group">' +
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
'<span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
M.util.get_string('option_max', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
'</span><input type="text" name="maxval" title="' +
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
// Set initial values.
if (json.id !== undefined &&

View File

@ -35,24 +35,27 @@ M.availability_grade.form.getNode = function(json) {
this.nodesSoFar++;
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.grades.length; i++) {
var grade = this.grades[i];
// String has already been escaped using format_string.
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
}
html += '</select></span></label> <span class="availability-group">' +
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
html += '</select></span></label> <br><span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
M.util.get_string('option_min', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
'</span><input type="text" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
'<span class="availability-group">' +
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
'<span class="availability-group form-group">' +
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
M.util.get_string('option_max', 'availability_grade') +
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
'</span><input type="text" name="maxval" title="' +
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
// Set initial values.
if (json.id !== undefined &&

View File

@ -33,8 +33,9 @@ M.availability_group.form.initInner = function(groups) {
M.availability_group.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
for (var i = 0; i < this.groups.length; i++) {
@ -43,7 +44,7 @@ M.availability_group.form.getNode = function(json) {
html += '<option value="' + group.id + '">' + group.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values (leave default 'choose' if creating afresh).
if (json.creating === undefined) {

View File

@ -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="<label>"+M.util.get_string("title","availability_group")+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>"+'<option value="any">'+M.util.get_string("anygroup","availability_group")+"</option>";for(var r=0;r<this.groups.length;r++){var i=this.groups[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create("<span>"+n+"</span>");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"]});
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='<label><span class="p-r-1">'+M.util.get_string("title","availability_group")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>"+'<option value="any">'+M.util.get_string("anygroup","availability_group")+"</option>";for(var r=0;r<this.groups.length;r++){var i=this.groups[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");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"]});

View File

@ -33,8 +33,9 @@ M.availability_group.form.initInner = function(groups) {
M.availability_group.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
for (var i = 0; i < this.groups.length; i++) {
@ -43,7 +44,7 @@ M.availability_group.form.getNode = function(json) {
html += '<option value="' + group.id + '">' + group.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values (leave default 'choose' if creating afresh).
if (json.creating === undefined) {

View File

@ -31,8 +31,9 @@ M.availability_group.form.initInner = function(groups) {
M.availability_group.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
for (var i = 0; i < this.groups.length; i++) {
@ -41,7 +42,7 @@ M.availability_group.form.getNode = function(json) {
html += '<option value="' + group.id + '">' + group.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values (leave default 'choose' if creating afresh).
if (json.creating === undefined) {

View File

@ -33,8 +33,9 @@ M.availability_grouping.form.initInner = function(groupings) {
M.availability_grouping.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.groupings.length; i++) {
var grouping = this.groupings[i];
@ -42,7 +43,7 @@ M.availability_grouping.form.getNode = function(json) {
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial value if specified.
if (json.id !== undefined &&

View File

@ -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="<label>"+M.util.get_string("title","availability_grouping")+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.groupings.length;r++){var i=this.groupings[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create("<span>"+n+"</span>");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"]});
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='<label><span class="p-r-1">'+M.util.get_string("title","availability_grouping")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.groupings.length;r++){var i=this.groupings[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");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"]});

View File

@ -33,8 +33,9 @@ M.availability_grouping.form.initInner = function(groupings) {
M.availability_grouping.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.groupings.length; i++) {
var grouping = this.groupings[i];
@ -42,7 +43,7 @@ M.availability_grouping.form.getNode = function(json) {
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial value if specified.
if (json.id !== undefined &&

View File

@ -31,8 +31,9 @@ M.availability_grouping.form.initInner = function(groupings) {
M.availability_grouping.form.getNode = function(json) {
// Create HTML structure.
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
'<select name="id">' +
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
'<span class="availability-group">' +
'<select name="id" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.groupings.length; i++) {
var grouping = this.groupings[i];
@ -40,7 +41,7 @@ M.availability_grouping.form.getNode = function(json) {
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
}
html += '</select></span></label>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial value if specified.
if (json.id !== undefined &&

View File

@ -35,8 +35,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
M.availability_profile.form.getNode = function(json) {
// Create HTML structure.
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
'<select name="field">' +
var html = '<span class="availability-group"><label><span class="p-r-1">' +
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
'<select name="field" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var fieldInfo;
for (var i = 0; i < this.standardFields.length; i++) {
@ -50,7 +51,8 @@ M.availability_profile.form.getNode = function(json) {
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
' class="custom-select">';
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
'isempty', 'isnotempty'];
for (i = 0; i < operators.length; i++) {
@ -58,9 +60,9 @@ M.availability_profile.form.getNode = function(json) {
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
'</span><input name="value" type="text" style="width: 10em" title="' +
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values if specified.
if (json.sf !== undefined &&

View File

@ -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='<span class="availability-group"><label>'+M.util.get_string("conditiontitle","availability_profile")+" "+'<select name="field">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>",r;for(var i=0;i<this.standardFields.length;i++)r=this.standardFields[i],n+='<option value="sf_'+r.field+'">'+r.display+"</option>";for(i=0;i<this.customFields.length;i++)r=this.customFields[i],n+='<option value="cf_'+r.field+'">'+r.display+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_operator","availability_profile")+' </span><select name="op" title="'+M.util.get_string("label_operator","availability_profile")+'">';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i<s.length;i++)n+='<option value="'+s[i]+'">'+M.util.get_string("op_"+s[i],"availability_profile")+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_value","availability_profile")+'</span><input name="value" type="text" style="width: 10em" title="'+M.util.get_string("label_value","availability_profile")+'"/></label></span>';var o=e.Node.create("<span>"+n+"</span>");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"]});
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='<span class="availability-group"><label><span class="p-r-1">'+M.util.get_string("conditiontitle","availability_profile")+"</span> "+'<select name="field" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>",r;for(var i=0;i<this.standardFields.length;i++)r=this.standardFields[i],n+='<option value="sf_'+r.field+'">'+r.display+"</option>";for(i=0;i<this.customFields.length;i++)r=this.customFields[i],n+='<option value="cf_'+r.field+'">'+r.display+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_operator","availability_profile")+' </span><select name="op" title="'+M.util.get_string("label_operator","availability_profile")+'"'+' class="custom-select">';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i<s.length;i++)n+='<option value="'+s[i]+'">'+M.util.get_string("op_"+s[i],"availability_profile")+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_value","availability_profile")+'</span><input name="value" type="text" class="form-control" style="width: 10em" title="'+M.util.get_string("label_value","availability_profile")+'"/></label></span>';var o=e.Node.create('<span class="form-inline">'+n+"</span>");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"]});

View File

@ -35,8 +35,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
M.availability_profile.form.getNode = function(json) {
// Create HTML structure.
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
'<select name="field">' +
var html = '<span class="availability-group"><label><span class="p-r-1">' +
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
'<select name="field" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var fieldInfo;
for (var i = 0; i < this.standardFields.length; i++) {
@ -50,7 +51,8 @@ M.availability_profile.form.getNode = function(json) {
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
' class="custom-select">';
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
'isempty', 'isnotempty'];
for (i = 0; i < operators.length; i++) {
@ -58,9 +60,9 @@ M.availability_profile.form.getNode = function(json) {
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
'</span><input name="value" type="text" style="width: 10em" title="' +
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values if specified.
if (json.sf !== undefined &&

View File

@ -33,8 +33,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
M.availability_profile.form.getNode = function(json) {
// Create HTML structure.
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
'<select name="field">' +
var html = '<span class="availability-group"><label><span class="p-r-1">' +
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
'<select name="field" class="custom-select">' +
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
var fieldInfo;
for (var i = 0; i < this.standardFields.length; i++) {
@ -48,7 +49,8 @@ M.availability_profile.form.getNode = function(json) {
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
' class="custom-select">';
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
'isempty', 'isnotempty'];
for (i = 0; i < operators.length; i++) {
@ -56,9 +58,9 @@ M.availability_profile.form.getNode = function(json) {
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
'</span><input name="value" type="text" style="width: 10em" title="' +
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
// Set initial values if specified.
if (json.sf !== undefined &&

View File

@ -358,21 +358,25 @@ M.core_availability.List = function(json, root, parentRoot) {
// Create DIV structure (without kids).
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
'<div class="availability-inner">' +
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
'<div class="availability-header"><span class="p-l-1">' +
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
' </span><select class="availability-neg custom-select m-x-1"' +
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
'<select class="availability-op custom-select m-x-1"' +
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
'<div class="availability-children"></div>' +
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
'<div class="availability-button"></div></div></div>');
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
'<div class="clearfix m-t-1"></div>' +
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
if (!root) {
this.node.addClass('availability-childlist');
}
@ -406,12 +410,12 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
// Create the button and add it.
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
M.util.get_string('addrestriction', 'availability') + '</button>');
button.on("click", function() {
this.clickAdd();
@ -667,7 +671,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
*/
M.core_availability.List.prototype.clickAdd = function() {
var content = Y.Node.create('<div>' +
'<ul class="list-unstyled"></ul>' +
'<ul class="list-unstyled container-fluid"></ul>' +
'<div class="availability-buttons mdl-align">' +
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
'</button></div></div>');
@ -683,25 +687,25 @@ M.core_availability.List.prototype.clickAdd = function() {
continue;
}
// Add entry for plugin.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_' + type;
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
button.on('click', this.getAddHandler(type, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('description', 'availability_' + type) + '</label>');
li.appendChild(label);
ul.appendChild(li);
}
// Extra entry for lists.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_list_';
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
button.on('click', this.getAddHandler(null, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('condition_group_info', 'availability') + '</label>');
li.appendChild(label);
ul.appendChild(li);
@ -897,7 +901,7 @@ M.core_availability.Item = function(json, root) {
this.pluginNode.addClass('availability_' + json.type);
}
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
// Add eye icon if required. This icon is added for root items, but may be
// hidden depending on the selected list operator.
@ -920,7 +924,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
};
/**
@ -1048,7 +1052,7 @@ M.core_availability.Item.prototype.pluginNode = null;
*/
M.core_availability.EyeIcon = function(individual, shown) {
this.individual = individual;
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
var icon = Y.Node.create('<img />');
this.span.appendChild(icon);
@ -1128,7 +1132,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
*/
M.core_availability.DeleteIcon = function(toDelete) {
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
M.util.get_string('delete', 'moodle') + '" role="button">');
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');

File diff suppressed because one or more lines are too long

View File

@ -358,21 +358,25 @@ M.core_availability.List = function(json, root, parentRoot) {
// Create DIV structure (without kids).
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
'<div class="availability-inner">' +
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
'<div class="availability-header"><span class="p-l-1">' +
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
' </span><select class="availability-neg custom-select m-x-1"' +
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
'<select class="availability-op custom-select m-x-1"' +
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
'<div class="availability-children"></div>' +
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
'<div class="availability-button"></div></div></div>');
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
'<div class="clearfix m-t-1"></div>' +
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
if (!root) {
this.node.addClass('availability-childlist');
}
@ -406,12 +410,12 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
// Create the button and add it.
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
M.util.get_string('addrestriction', 'availability') + '</button>');
button.on("click", function() {
this.clickAdd();
@ -667,7 +671,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
*/
M.core_availability.List.prototype.clickAdd = function() {
var content = Y.Node.create('<div>' +
'<ul class="list-unstyled"></ul>' +
'<ul class="list-unstyled container-fluid"></ul>' +
'<div class="availability-buttons mdl-align">' +
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
'</button></div></div>');
@ -683,25 +687,25 @@ M.core_availability.List.prototype.clickAdd = function() {
continue;
}
// Add entry for plugin.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_' + type;
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
button.on('click', this.getAddHandler(type, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('description', 'availability_' + type) + '</label>');
li.appendChild(label);
ul.appendChild(li);
}
// Extra entry for lists.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_list_';
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
button.on('click', this.getAddHandler(null, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('condition_group_info', 'availability') + '</label>');
li.appendChild(label);
ul.appendChild(li);
@ -897,7 +901,7 @@ M.core_availability.Item = function(json, root) {
this.pluginNode.addClass('availability_' + json.type);
}
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
// Add eye icon if required. This icon is added for root items, but may be
// hidden depending on the selected list operator.
@ -920,7 +924,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
};
/**
@ -1048,7 +1052,7 @@ M.core_availability.Item.prototype.pluginNode = null;
*/
M.core_availability.EyeIcon = function(individual, shown) {
this.individual = individual;
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
var icon = Y.Node.create('<img />');
this.span.appendChild(icon);
@ -1128,7 +1132,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
*/
M.core_availability.DeleteIcon = function(toDelete) {
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
M.util.get_string('delete', 'moodle') + '" role="button">');
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');

View File

@ -356,21 +356,25 @@ M.core_availability.List = function(json, root, parentRoot) {
// Create DIV structure (without kids).
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
'<div class="availability-inner">' +
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
'<div class="availability-header"><span class="p-l-1">' +
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
' </span><select class="availability-neg custom-select m-x-1"' +
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
'<select class="availability-op custom-select m-x-1"' +
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
'<div class="availability-children"></div>' +
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
'<div class="availability-button"></div></div></div>');
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
'<div class="clearfix m-t-1"></div>' +
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
if (!root) {
this.node.addClass('availability-childlist');
}
@ -404,12 +408,12 @@ M.core_availability.List = function(json, root, parentRoot) {
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
// Create the button and add it.
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
M.util.get_string('addrestriction', 'availability') + '</button>');
button.on("click", function() {
this.clickAdd();
@ -665,7 +669,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
*/
M.core_availability.List.prototype.clickAdd = function() {
var content = Y.Node.create('<div>' +
'<ul class="list-unstyled"></ul>' +
'<ul class="list-unstyled container-fluid"></ul>' +
'<div class="availability-buttons mdl-align">' +
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
'</button></div></div>');
@ -681,25 +685,25 @@ M.core_availability.List.prototype.clickAdd = function() {
continue;
}
// Add entry for plugin.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_' + type;
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
button.on('click', this.getAddHandler(type, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('description', 'availability_' + type) + '</label>');
li.appendChild(label);
ul.appendChild(li);
}
// Extra entry for lists.
li = Y.Node.create('<li class="clearfix"></li>');
li = Y.Node.create('<li class="clearfix row"></li>');
id = 'availability_addrestriction_list_';
button = Y.Node.create('<button type="button" class="btn btn-default"' +
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
button.on('click', this.getAddHandler(null, dialogRef), this);
li.appendChild(button);
label = Y.Node.create('<label for="' + id + '">' +
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
M.util.get_string('condition_group_info', 'availability') + '</label>');
li.appendChild(label);
ul.appendChild(li);
@ -895,7 +899,7 @@ M.core_availability.Item = function(json, root) {
this.pluginNode.addClass('availability_' + json.type);
}
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
// Add eye icon if required. This icon is added for root items, but may be
// hidden depending on the selected list operator.
@ -918,7 +922,7 @@ M.core_availability.Item = function(json, root) {
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
};
/**
@ -1046,7 +1050,7 @@ M.core_availability.Item.prototype.pluginNode = null;
*/
M.core_availability.EyeIcon = function(individual, shown) {
this.individual = individual;
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
var icon = Y.Node.create('<img />');
this.span.appendChild(icon);
@ -1126,7 +1130,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
*/
M.core_availability.DeleteIcon = function(toDelete) {
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
M.util.get_string('delete', 'moodle') + '" role="button">');
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');

View File

@ -221,121 +221,20 @@ fieldset.coursesearchbox label {
display: none;
}
.availability-field {
select,
input[type=text] {
position: relative;
top: 4px;
}
label {
display: inline;
}
.availability-group {
margin-right: 8px;
}
.availability-item {
margin-bottom: 6px;
}
.availability-none {
margin-left: 20px;
margin-bottom: 4px;
}
.availability-plugincontrols {
padding: 2px 0 0 4px;
border: 1px solid $gray-lighter;
border-radius: 4px;
display: inline-block;
margin-right: 8px;
}
/* Eye icon in front of an item and delete icon after it. */
.availability-eye,
.availability-delete {
margin-right: 8px;
}
/* Hidden eye icon still takes up space. */
.availability-eye[aria-hidden=true] {
display: inline;
visibility: hidden;
}
/* Eye icons in front of child lists are aligned specially. */
.availability-list > .availability-eye img {
vertical-align: top;
margin-top: 12px;
}
/* Add button lines up with child elements. */
.availability-button {
margin-left: 15px;
}
/* Nested section is grey. */
.availability-childlist > .availability-inner {
display: inline-block;
border: 1px solid $gray-lighter;
border-radius: 4px;
padding: 6px;
margin-bottom: 6px;
}
/* Second (and more) levels of nested sections are white. */
.availability-childlist .availability-childlist > .availability-inner {
background: white;
}
/* Connecting text needs to be indented. */
.availability-connector {
margin-left: 20px;
margin-bottom: 6px;
}
.availability-eye {
clear: left;
float: left;
}
/* Default form styling colours all text red. With availability conditions
this looks excessive as we show 'Invalid' markers in specific places. */
.mform .error .availability-field {
color: $body-color;
.availability-inner,
.availability-plugincontrols {
float: left;
@include border-radius($card-border-radius);
border: $card-border-width solid $card-border-color;
padding: $card-spacer-x / 2;
margin-left: $card-spacer-x / 2;
}
/* This dialogue is used to add an availability condition. */
.availability-dialogue {
.moodle-dialogue .moodle-dialogue-bd {
padding-left: 0;
padding-right: 0;
padding-bottom: 2px;
}
ul {
display: block;
margin: 0;
}
li {
display: block;
list-style-type: none;
padding: 0 0 4px;
clear: both;
border-bottom: 1px solid $gray-lighter;
margin-bottom: 4px;
}
ul button {
float: left;
margin-left: 1em;
min-width: 140px;
margin-top: 4px;
}
label {
margin-left: 170px;
margin-right: 1em;
margin-bottom: 0;
}
.availability-buttons button {
margin-left: 1em;
margin-right: 1em;
margin-top: 4px;
}
.availability-field .availability-plugincontrols .availability-group select {
max-width: 12rem;
}
/* Custom styles for autocomplete form element */

View File

@ -366,6 +366,7 @@ fieldset.coursesearchbox label {
margin-bottom: 4px;
}
.availability-plugincontrols {
min-height: 40px;
padding: 2px 0 0 4px;
background: none repeat scroll 0% 0% @wellBackground;
border: 1px solid @grayLighter;

View File

@ -14217,6 +14217,7 @@ fieldset.coursesearchbox label {
margin-bottom: 4px;
}
#fitem_id_availabilityconditionsjson .availability-plugincontrols {
min-height: 40px;
padding: 2px 0 0 4px;
background: none repeat scroll 0% 0% #f5f5f5;
border: 1px solid #eee;