MDL-44070 Conditional availability enhancements (10): autogenerated
Includes all the autogenerated files (to make it easier/less worrying when reviewing and rebasing).
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
YUI.add('moodle-availability_completion-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing completion conditions.
|
||||
*
|
||||
* @module moodle-availability_completion-form
|
||||
*/
|
||||
M.availability_completion = M.availability_completion || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_completion.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_completion.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} cms Array of objects containing cmid => name
|
||||
*/
|
||||
M.availability_completion.form.initInner = function(cms) {
|
||||
this.cms = cms;
|
||||
};
|
||||
|
||||
M.availability_completion.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_completion;
|
||||
var html = strings.title + ' <span class="availability-group"><label>' +
|
||||
'<span class="accesshide">' + strings.label_cm + ' </span>' +
|
||||
'<select name="cm" title="' + strings.label_cm + '">' +
|
||||
'<option value="0">' + M.str.moodle.choosedots + '</option>';
|
||||
for (var i = 0; i < this.cms.length; i++) {
|
||||
var cm = this.cms[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + cm.id + '">' + cm.name + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_completion +
|
||||
' </span><select name="e" title="' + strings.label_completion + '">' +
|
||||
'<option value="1">' + strings.option_complete + '</option>' +
|
||||
'<option value="0">' + strings.option_incomplete + '</option>' +
|
||||
'<option value="2">' + strings.option_pass + '</option>' +
|
||||
'<option value="3">' + strings.option_fail + '</option>' +
|
||||
'</select></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
node.one('select[name=cm] > option[value=' + json.cm + ']')) {
|
||||
node.one('select[name=cm]').set('value', json.cm);
|
||||
}
|
||||
if (json.e !== undefined) {
|
||||
node.one('select[name=e]').set('value', json.e);
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Whichever dropdown changed, just update the form.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_completion select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_completion.form.fillValue = function(value, node) {
|
||||
value.cm = parseInt(node.one('select[name=cm]').get('value'), 10);
|
||||
value.e = parseInt(node.one('select[name=e]').get('value'), 10);
|
||||
};
|
||||
|
||||
M.availability_completion.form.fillErrors = function(errors, node) {
|
||||
var cmid = parseInt(node.one('select[name=cm]').get('value'), 10);
|
||||
if (cmid === 0) {
|
||||
errors.push('availability_completion:error_selectcmid');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_completion,r=n.title+' <span class="availability-group"><label>'+'<span class="accesshide">'+n.label_cm+" </span>"+'<select name="cm" title="'+n.label_cm+'">'+'<option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.cms.length;i++){var s=this.cms[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></label> <label><span class="accesshide">'+n.label_completion+' </span><select name="e" title="'+n.label_completion+'">'+'<option value="1">'+n.option_complete+"</option>"+'<option value="0">'+n.option_incomplete+"</option>"+'<option value="2">'+n.option_pass+"</option>"+'<option value="3">'+n.option_fail+"</option>"+"</select></label></span>";var o=e.Node.create("<span>"+r+"</span>");t.cm!==undefined&&o.one("select[name=cm] > option[value="+t.cm+"]")&&o.one("select[name=cm]").set("value",t.cm),t.e!==undefined&&o.one("select[name=e]").set("value",t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return o},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"]});
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
YUI.add('moodle-availability_completion-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing completion conditions.
|
||||
*
|
||||
* @module moodle-availability_completion-form
|
||||
*/
|
||||
M.availability_completion = M.availability_completion || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_completion.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_completion.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} cms Array of objects containing cmid => name
|
||||
*/
|
||||
M.availability_completion.form.initInner = function(cms) {
|
||||
this.cms = cms;
|
||||
};
|
||||
|
||||
M.availability_completion.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_completion;
|
||||
var html = strings.title + ' <span class="availability-group"><label>' +
|
||||
'<span class="accesshide">' + strings.label_cm + ' </span>' +
|
||||
'<select name="cm" title="' + strings.label_cm + '">' +
|
||||
'<option value="0">' + M.str.moodle.choosedots + '</option>';
|
||||
for (var i = 0; i < this.cms.length; i++) {
|
||||
var cm = this.cms[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + cm.id + '">' + cm.name + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_completion +
|
||||
' </span><select name="e" title="' + strings.label_completion + '">' +
|
||||
'<option value="1">' + strings.option_complete + '</option>' +
|
||||
'<option value="0">' + strings.option_incomplete + '</option>' +
|
||||
'<option value="2">' + strings.option_pass + '</option>' +
|
||||
'<option value="3">' + strings.option_fail + '</option>' +
|
||||
'</select></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
node.one('select[name=cm] > option[value=' + json.cm + ']')) {
|
||||
node.one('select[name=cm]').set('value', json.cm);
|
||||
}
|
||||
if (json.e !== undefined) {
|
||||
node.one('select[name=e]').set('value', json.e);
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Whichever dropdown changed, just update the form.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_completion select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_completion.form.fillValue = function(value, node) {
|
||||
value.cm = parseInt(node.one('select[name=cm]').get('value'), 10);
|
||||
value.e = parseInt(node.one('select[name=e]').get('value'), 10);
|
||||
};
|
||||
|
||||
M.availability_completion.form.fillErrors = function(errors, node) {
|
||||
var cmid = parseInt(node.one('select[name=cm]').get('value'), 10);
|
||||
if (cmid === 0) {
|
||||
errors.push('availability_completion:error_selectcmid');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
YUI.add('moodle-availability_date-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing date conditions.
|
||||
*
|
||||
* @module moodle-availability_date-form
|
||||
*/
|
||||
M.availability_date = M.availability_date || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_date.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_date.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* Because the date fields are complex depending on Moodle calendar settings,
|
||||
* we create the HTML for these fields in PHP and pass it to this method.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {String} html HTML to use for date fields
|
||||
* @param {Number} defaultTime Time value that corresponds to initial fields
|
||||
*/
|
||||
M.availability_date.form.initInner = function(html, defaultTime) {
|
||||
this.html = html;
|
||||
this.defaultTime = defaultTime;
|
||||
};
|
||||
|
||||
M.availability_date.form.getNode = function(json) {
|
||||
var strings = M.str.availability_date;
|
||||
var html = strings.direction_before + ' <span class="availability-group">' +
|
||||
'<label><span class="accesshide">' + strings.direction_label + ' </span>' +
|
||||
'<select name="direction">' +
|
||||
'<option value=">=">' + strings.direction_from + '</option>' +
|
||||
'<option value="<">' + strings.direction_until + '</option>' +
|
||||
'</select></label></span> ' + this.html;
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial value if non-default.
|
||||
if (json.t !== undefined) {
|
||||
node.setData('time', json.t);
|
||||
// Disable everything.
|
||||
node.all('select:not([name=direction])').each(function(select) {
|
||||
select.set('disabled', true);
|
||||
});
|
||||
|
||||
var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=fromtime' +
|
||||
'&time=' + json.t;
|
||||
Y.io(url, { on : {
|
||||
success : function(id, response) {
|
||||
var fields = Y.JSON.parse(response.responseText);
|
||||
for (var field in fields) {
|
||||
var select = node.one('select[name=x\\[' + field + '\\]]');
|
||||
select.set('value', fields[field]);
|
||||
select.set('disabled', false);
|
||||
}
|
||||
},
|
||||
failure : function() {
|
||||
window.alert(M.str.availability_date.ajaxerror);
|
||||
}
|
||||
}});
|
||||
} else {
|
||||
// Set default time that corresponds to the HTML selectors.
|
||||
node.setData('time', this.defaultTime);
|
||||
}
|
||||
if (json.d !== undefined) {
|
||||
node.one('select[name=direction]').set('value', json.d);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_date.form.addedEvents) {
|
||||
M.availability_date.form.addedEvents = true;
|
||||
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
// For the direction, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_date select[name=direction]');
|
||||
|
||||
root.delegate('change', function() {
|
||||
// Update time using AJAX call from root node.
|
||||
M.availability_date.form.updateTime(this.ancestor('span.availability_date'));
|
||||
}, '.availability_date select:not([name=direction])');
|
||||
}
|
||||
|
||||
if (node.one('a[href=#]')) {
|
||||
// Add the date selector magic.
|
||||
M.form.dateselector.init_single_date_selector(node);
|
||||
|
||||
// This special handler detects when the date selector changes the year.
|
||||
var yearSelect = node.one('select[name=x\\[year\\]]');
|
||||
var oldSet = yearSelect.set;
|
||||
yearSelect.set = function(name, value) {
|
||||
oldSet.call(yearSelect, name, value);
|
||||
if (name === 'selectedIndex') {
|
||||
// Do this after timeout or the other fields haven't been set yet.
|
||||
setTimeout(function() {
|
||||
M.availability_date.form.updateTime(node);
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates time from AJAX. Whenever the field values change, we recompute the
|
||||
* actual time via an AJAX request to Moodle.
|
||||
*
|
||||
* This will set the 'time' data on the node and then update the form, once it
|
||||
* gets an AJAX response.
|
||||
*
|
||||
* @method updateTime
|
||||
* @param {Y.Node} component Node for plugin controls
|
||||
*/
|
||||
M.availability_date.form.updateTime = function(node) {
|
||||
// After a change to the date/time we need to recompute the
|
||||
// actual time using AJAX because it depends on the user's
|
||||
// time zone and calendar options.
|
||||
var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=totime' +
|
||||
'&year=' + node.one('select[name=x\\[year\\]]').get('value') +
|
||||
'&month=' + node.one('select[name=x\\[month\\]]').get('value') +
|
||||
'&day=' + node.one('select[name=x\\[day\\]]').get('value') +
|
||||
'&hour=' + node.one('select[name=x\\[hour\\]]').get('value') +
|
||||
'&minute=' + node.one('select[name=x\\[minute\\]]').get('value');
|
||||
Y.io(url, { on : {
|
||||
success : function(id, response) {
|
||||
node.setData('time', response.responseText);
|
||||
M.core_availability.form.update();
|
||||
},
|
||||
failure : function() {
|
||||
window.alert(M.str.availability_date.ajaxerror);
|
||||
}
|
||||
}});
|
||||
};
|
||||
|
||||
M.availability_date.form.fillValue = function(value, node) {
|
||||
value.d = node.one('select[name=direction]').get('value');
|
||||
value.t = parseInt(node.getData('time'), 10);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "io", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_date,r=n.direction_before+' <span class="availability-group">'+'<label><span class="accesshide">'+n.direction_label+" </span>"+'<select name="direction">'+'<option value=">=">'+n.direction_from+"</option>"+'<option value="<">'+n.direction_until+"</option>"+"</select></label></span> "+this.html,i=e.Node.create("<span>"+r+"</span>");if(t.t!==undefined){i.setData("time",t.t),i.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var s=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(s,{on:{success:function(t,n){var r=e.JSON.parse(n.responseText);for(var s in r){var o=i.one("select[name=x\\["+s+"\\]]");o.set("value",r[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.str.availability_date.ajaxerror)}}})}else i.setData("time",this.defaultTime);t.d!==undefined&&i.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var o=e.one("#fitem_id_availabilityconditionsjson");o.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),o.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(i.one("a[href=#]")){M.form.dateselector.init_single_date_selector(i);var u=i.one("select[name=x\\[year\\]]"),a=u.set;u.set=function(e,t){a.call(u,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(i)},0)}}return i},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.str.availability_date.ajaxerror)}}})},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"]});
|
||||
availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
Vendored
+146
@@ -0,0 +1,146 @@
|
||||
YUI.add('moodle-availability_date-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing date conditions.
|
||||
*
|
||||
* @module moodle-availability_date-form
|
||||
*/
|
||||
M.availability_date = M.availability_date || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_date.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_date.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* Because the date fields are complex depending on Moodle calendar settings,
|
||||
* we create the HTML for these fields in PHP and pass it to this method.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {String} html HTML to use for date fields
|
||||
* @param {Number} defaultTime Time value that corresponds to initial fields
|
||||
*/
|
||||
M.availability_date.form.initInner = function(html, defaultTime) {
|
||||
this.html = html;
|
||||
this.defaultTime = defaultTime;
|
||||
};
|
||||
|
||||
M.availability_date.form.getNode = function(json) {
|
||||
var strings = M.str.availability_date;
|
||||
var html = strings.direction_before + ' <span class="availability-group">' +
|
||||
'<label><span class="accesshide">' + strings.direction_label + ' </span>' +
|
||||
'<select name="direction">' +
|
||||
'<option value=">=">' + strings.direction_from + '</option>' +
|
||||
'<option value="<">' + strings.direction_until + '</option>' +
|
||||
'</select></label></span> ' + this.html;
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial value if non-default.
|
||||
if (json.t !== undefined) {
|
||||
node.setData('time', json.t);
|
||||
// Disable everything.
|
||||
node.all('select:not([name=direction])').each(function(select) {
|
||||
select.set('disabled', true);
|
||||
});
|
||||
|
||||
var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=fromtime' +
|
||||
'&time=' + json.t;
|
||||
Y.io(url, { on : {
|
||||
success : function(id, response) {
|
||||
var fields = Y.JSON.parse(response.responseText);
|
||||
for (var field in fields) {
|
||||
var select = node.one('select[name=x\\[' + field + '\\]]');
|
||||
select.set('value', fields[field]);
|
||||
select.set('disabled', false);
|
||||
}
|
||||
},
|
||||
failure : function() {
|
||||
window.alert(M.str.availability_date.ajaxerror);
|
||||
}
|
||||
}});
|
||||
} else {
|
||||
// Set default time that corresponds to the HTML selectors.
|
||||
node.setData('time', this.defaultTime);
|
||||
}
|
||||
if (json.d !== undefined) {
|
||||
node.one('select[name=direction]').set('value', json.d);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_date.form.addedEvents) {
|
||||
M.availability_date.form.addedEvents = true;
|
||||
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
// For the direction, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_date select[name=direction]');
|
||||
|
||||
root.delegate('change', function() {
|
||||
// Update time using AJAX call from root node.
|
||||
M.availability_date.form.updateTime(this.ancestor('span.availability_date'));
|
||||
}, '.availability_date select:not([name=direction])');
|
||||
}
|
||||
|
||||
if (node.one('a[href=#]')) {
|
||||
// Add the date selector magic.
|
||||
M.form.dateselector.init_single_date_selector(node);
|
||||
|
||||
// This special handler detects when the date selector changes the year.
|
||||
var yearSelect = node.one('select[name=x\\[year\\]]');
|
||||
var oldSet = yearSelect.set;
|
||||
yearSelect.set = function(name, value) {
|
||||
oldSet.call(yearSelect, name, value);
|
||||
if (name === 'selectedIndex') {
|
||||
// Do this after timeout or the other fields haven't been set yet.
|
||||
setTimeout(function() {
|
||||
M.availability_date.form.updateTime(node);
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates time from AJAX. Whenever the field values change, we recompute the
|
||||
* actual time via an AJAX request to Moodle.
|
||||
*
|
||||
* This will set the 'time' data on the node and then update the form, once it
|
||||
* gets an AJAX response.
|
||||
*
|
||||
* @method updateTime
|
||||
* @param {Y.Node} component Node for plugin controls
|
||||
*/
|
||||
M.availability_date.form.updateTime = function(node) {
|
||||
// After a change to the date/time we need to recompute the
|
||||
// actual time using AJAX because it depends on the user's
|
||||
// time zone and calendar options.
|
||||
var url = M.cfg.wwwroot + '/availability/condition/date/ajax.php?action=totime' +
|
||||
'&year=' + node.one('select[name=x\\[year\\]]').get('value') +
|
||||
'&month=' + node.one('select[name=x\\[month\\]]').get('value') +
|
||||
'&day=' + node.one('select[name=x\\[day\\]]').get('value') +
|
||||
'&hour=' + node.one('select[name=x\\[hour\\]]').get('value') +
|
||||
'&minute=' + node.one('select[name=x\\[minute\\]]').get('value');
|
||||
Y.io(url, { on : {
|
||||
success : function(id, response) {
|
||||
node.setData('time', response.responseText);
|
||||
M.core_availability.form.update();
|
||||
},
|
||||
failure : function() {
|
||||
window.alert(M.str.availability_date.ajaxerror);
|
||||
}
|
||||
}});
|
||||
};
|
||||
|
||||
M.availability_date.form.fillValue = function(value, node) {
|
||||
value.d = node.one('select[name=direction]').get('value');
|
||||
value.t = parseInt(node.getData('time'), 10);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "io", "moodle-core_availability-form"]});
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
YUI.add('moodle-availability_grade-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing grade conditions.
|
||||
*
|
||||
* @module moodle-availability_grade-form
|
||||
*/
|
||||
M.availability_grade = M.availability_grade || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_grade.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_grade.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Grade items available for selection.
|
||||
*
|
||||
* @property grades
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_grade.form.grades = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} grades Array of objects containing gradeid => name
|
||||
*/
|
||||
M.availability_grade.form.initInner = function(grades) {
|
||||
this.grades = grades;
|
||||
this.nodesSoFar = 0;
|
||||
};
|
||||
|
||||
M.availability_grade.form.getNode = function(json) {
|
||||
// Increment number used for unique ids.
|
||||
this.nodesSoFar++;
|
||||
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_grade;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id"><option value="0">' + M.str.moodle.choosedots + '</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"/>' + strings.option_min +
|
||||
'</label> <label><span class="accesshide">' + strings.label_min +
|
||||
'</span><input type="text" name="minval" title="' +
|
||||
strings.label_min + '"/></label>%</span>' +
|
||||
'<span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="max"/>' + strings.option_max +
|
||||
'</label> <label><span class="accesshide">' + strings.label_max +
|
||||
'</span><input type="text" name="maxval" title="' +
|
||||
strings.label_max + '"/></label>%</span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
}
|
||||
if (json.min !== undefined) {
|
||||
node.one('input[name=min]').set('checked', true);
|
||||
node.one('input[name=minval]').set('value', json.min);
|
||||
}
|
||||
if (json.max !== undefined) {
|
||||
node.one('input[name=max]').set('checked', true);
|
||||
node.one('input[name=maxval]').set('value', json.max);
|
||||
}
|
||||
|
||||
// Disables/enables text input fields depending on checkbox.
|
||||
var updateCheckbox = function(check, focus) {
|
||||
var input = check.ancestor('label').next('label').one('input');
|
||||
var checked = check.get('checked');
|
||||
input.set('disabled', !checked);
|
||||
if (focus && checked) {
|
||||
input.focus();
|
||||
}
|
||||
return checked;
|
||||
};
|
||||
node.all('input[type=checkbox]').each(updateCheckbox);
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_grade.form.addedEvents) {
|
||||
M.availability_grade.form.addedEvents = true;
|
||||
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
// For the grade item, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade select[name=id]');
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
// For grade values, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=text]');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_grade.form.fillValue = function(value, node) {
|
||||
value.id = parseInt(node.one('select[name=id]').get('value'), 10);
|
||||
if (node.one('input[name=min]').get('checked')) {
|
||||
value.min = this.getValue('minval', node);
|
||||
}
|
||||
if (node.one('input[name=max]').get('checked')) {
|
||||
value.max = this.getValue('maxval', node);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the numeric value of an input field. Supports decimal points (using
|
||||
* dot or comma).
|
||||
*
|
||||
* @method getValue
|
||||
* @return {Number|String} Value of field as number or string if not valid
|
||||
*/
|
||||
M.availability_grade.form.getValue = function(field, node) {
|
||||
// Get field value.
|
||||
var value = node.one('input[name=' + field + ']').get('value');
|
||||
|
||||
// If it is not a valid positive number, return false.
|
||||
if (!(/^[0-9]+([.,][0-9]+)?$/.test(value))) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Replace comma with dot and parse as floating-point.
|
||||
var result = parseFloat(value.replace(',', '.'));
|
||||
if (result < 0 || result > 100) {
|
||||
return value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_grade.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check grade item id.
|
||||
if (value.id === 0) {
|
||||
errors.push('availability_grade:error_selectgradeid');
|
||||
}
|
||||
|
||||
// Check numeric values.
|
||||
if ((value.min !== undefined && typeof(value.min) === 'string') ||
|
||||
(value.max !== undefined && typeof(value.max) === 'string')) {
|
||||
errors.push('availability_grade:error_invalidnumber');
|
||||
} else if (value.min !== undefined && value.max !== undefined &&
|
||||
value.min >= value.max) {
|
||||
errors.push('availability_grade:error_backwardrange');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_grade,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.grades.length;i++){var s=this.grades[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+n.option_min+'</label> <label><span class="accesshide">'+n.label_min+'</span><input type="text" name="minval" title="'+n.label_min+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+n.option_max+'</label> <label><span class="accesshide">'+n.label_max+'</span><input type="text" name="maxval" title="'+n.label_max+'"/></label>%</span>';var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",t.id),t.min!==undefined&&(o.one("input[name=min]").set("checked",!0),o.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(o.one("input[name=max]").set("checked",!0),o.one("input[name=maxval]").set("value",t.max));var u=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};o.all("input[type=checkbox]").each(u);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var a=e.one("#fitem_id_availabilityconditionsjson");a.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),a.delegate("click",function(){u(this,!0)},".availability_grade input[type=checkbox]"),a.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return o},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"]});
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
YUI.add('moodle-availability_grade-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing grade conditions.
|
||||
*
|
||||
* @module moodle-availability_grade-form
|
||||
*/
|
||||
M.availability_grade = M.availability_grade || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_grade.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_grade.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Grade items available for selection.
|
||||
*
|
||||
* @property grades
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_grade.form.grades = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} grades Array of objects containing gradeid => name
|
||||
*/
|
||||
M.availability_grade.form.initInner = function(grades) {
|
||||
this.grades = grades;
|
||||
this.nodesSoFar = 0;
|
||||
};
|
||||
|
||||
M.availability_grade.form.getNode = function(json) {
|
||||
// Increment number used for unique ids.
|
||||
this.nodesSoFar++;
|
||||
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_grade;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id"><option value="0">' + M.str.moodle.choosedots + '</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"/>' + strings.option_min +
|
||||
'</label> <label><span class="accesshide">' + strings.label_min +
|
||||
'</span><input type="text" name="minval" title="' +
|
||||
strings.label_min + '"/></label>%</span>' +
|
||||
'<span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="max"/>' + strings.option_max +
|
||||
'</label> <label><span class="accesshide">' + strings.label_max +
|
||||
'</span><input type="text" name="maxval" title="' +
|
||||
strings.label_max + '"/></label>%</span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
}
|
||||
if (json.min !== undefined) {
|
||||
node.one('input[name=min]').set('checked', true);
|
||||
node.one('input[name=minval]').set('value', json.min);
|
||||
}
|
||||
if (json.max !== undefined) {
|
||||
node.one('input[name=max]').set('checked', true);
|
||||
node.one('input[name=maxval]').set('value', json.max);
|
||||
}
|
||||
|
||||
// Disables/enables text input fields depending on checkbox.
|
||||
var updateCheckbox = function(check, focus) {
|
||||
var input = check.ancestor('label').next('label').one('input');
|
||||
var checked = check.get('checked');
|
||||
input.set('disabled', !checked);
|
||||
if (focus && checked) {
|
||||
input.focus();
|
||||
}
|
||||
return checked;
|
||||
};
|
||||
node.all('input[type=checkbox]').each(updateCheckbox);
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_grade.form.addedEvents) {
|
||||
M.availability_grade.form.addedEvents = true;
|
||||
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
// For the grade item, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade select[name=id]');
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
// For grade values, just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=text]');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_grade.form.fillValue = function(value, node) {
|
||||
value.id = parseInt(node.one('select[name=id]').get('value'), 10);
|
||||
if (node.one('input[name=min]').get('checked')) {
|
||||
value.min = this.getValue('minval', node);
|
||||
}
|
||||
if (node.one('input[name=max]').get('checked')) {
|
||||
value.max = this.getValue('maxval', node);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the numeric value of an input field. Supports decimal points (using
|
||||
* dot or comma).
|
||||
*
|
||||
* @method getValue
|
||||
* @return {Number|String} Value of field as number or string if not valid
|
||||
*/
|
||||
M.availability_grade.form.getValue = function(field, node) {
|
||||
// Get field value.
|
||||
var value = node.one('input[name=' + field + ']').get('value');
|
||||
|
||||
// If it is not a valid positive number, return false.
|
||||
if (!(/^[0-9]+([.,][0-9]+)?$/.test(value))) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Replace comma with dot and parse as floating-point.
|
||||
var result = parseFloat(value.replace(',', '.'));
|
||||
if (result < 0 || result > 100) {
|
||||
return value;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_grade.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check grade item id.
|
||||
if (value.id === 0) {
|
||||
errors.push('availability_grade:error_selectgradeid');
|
||||
}
|
||||
|
||||
// Check numeric values.
|
||||
if ((value.min !== undefined && typeof(value.min) === 'string') ||
|
||||
(value.max !== undefined && typeof(value.max) === 'string')) {
|
||||
errors.push('availability_grade:error_invalidnumber');
|
||||
} else if (value.min !== undefined && value.max !== undefined &&
|
||||
value.min >= value.max) {
|
||||
errors.push('availability_grade:error_backwardrange');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
YUI.add('moodle-availability_group-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing group conditions.
|
||||
*
|
||||
* @module moodle-availability_group-form
|
||||
*/
|
||||
M.availability_group = M.availability_group || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_group.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_group.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groups available for selection (alphabetical order).
|
||||
*
|
||||
* @property groups
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_group.form.groups = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} groups Array of objects containing groupid => name
|
||||
*/
|
||||
M.availability_group.form.initInner = function(groups) {
|
||||
this.groups = groups;
|
||||
};
|
||||
|
||||
M.availability_group.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_group;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>' +
|
||||
'<option value="any">' + strings.anygroup + '</option>';
|
||||
for (var i = 0; i < this.groups.length; i++) {
|
||||
var group = this.groups[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + group.id + '">' + group.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values (leave default 'choose' if creating afresh).
|
||||
if (json.creating === undefined) {
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
} else if (json.id === undefined) {
|
||||
node.one('select[name=id]').set('value', 'any');
|
||||
}
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_group select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_group.form.fillValue = function(value, node) {
|
||||
var selected = node.one('select[name=id]').get('value');
|
||||
if (selected === 'choose') {
|
||||
value.id = 'choose';
|
||||
} else if (selected !== 'any') {
|
||||
value.id = parseInt(selected, 10);
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_group.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check group item id.
|
||||
if (value.id && value.id === 'choose') {
|
||||
errors.push('availability_group:error_selectgroup');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_group,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.str.moodle.choosedots+"</option>"+'<option value="any">'+n.anygroup+"</option>";for(var i=0;i<this.groups.length;i++){var s=this.groups[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+="</select></span></label>";var o=e.Node.create("<span>"+r+"</span>");t.creating===undefined&&(t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")?o.one("select[name=id]").set("value",t.id):t.id===undefined&&o.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return o},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"]});
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
YUI.add('moodle-availability_group-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing group conditions.
|
||||
*
|
||||
* @module moodle-availability_group-form
|
||||
*/
|
||||
M.availability_group = M.availability_group || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_group.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_group.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groups available for selection (alphabetical order).
|
||||
*
|
||||
* @property groups
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_group.form.groups = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} groups Array of objects containing groupid => name
|
||||
*/
|
||||
M.availability_group.form.initInner = function(groups) {
|
||||
this.groups = groups;
|
||||
};
|
||||
|
||||
M.availability_group.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_group;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>' +
|
||||
'<option value="any">' + strings.anygroup + '</option>';
|
||||
for (var i = 0; i < this.groups.length; i++) {
|
||||
var group = this.groups[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + group.id + '">' + group.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values (leave default 'choose' if creating afresh).
|
||||
if (json.creating === undefined) {
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
} else if (json.id === undefined) {
|
||||
node.one('select[name=id]').set('value', 'any');
|
||||
}
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_group select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_group.form.fillValue = function(value, node) {
|
||||
var selected = node.one('select[name=id]').get('value');
|
||||
if (selected === 'choose') {
|
||||
value.id = 'choose';
|
||||
} else if (selected !== 'any') {
|
||||
value.id = parseInt(selected, 10);
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_group.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check group item id.
|
||||
if (value.id && value.id === 'choose') {
|
||||
errors.push('availability_group:error_selectgroup');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
YUI.add('moodle-availability_grouping-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing grouping conditions.
|
||||
*
|
||||
* @module moodle-availability_grouping-form
|
||||
*/
|
||||
M.availability_grouping = M.availability_grouping || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_grouping.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_grouping.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groupings available for selection (alphabetical order).
|
||||
*
|
||||
* @property groupings
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_grouping.form.groupings = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} groupings Array of objects containing groupingid => name
|
||||
*/
|
||||
M.availability_grouping.form.initInner = function(groupings) {
|
||||
this.groupings = groupings;
|
||||
};
|
||||
|
||||
M.availability_grouping.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_grouping;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>';
|
||||
for (var i = 0; i < this.groupings.length; i++) {
|
||||
var grouping = this.groupings[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grouping select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_grouping.form.fillValue = function(value, node) {
|
||||
var selected = node.one('select[name=id]').get('value');
|
||||
if (selected === 'choose') {
|
||||
value.id = 'choose';
|
||||
} else {
|
||||
value.id = parseInt(selected, 10);
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_grouping.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check grouping item id.
|
||||
if (value.id === 'choose') {
|
||||
errors.push('availability_grouping:error_selectgrouping');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_grouping,r="<label>"+n.title+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.str.moodle.choosedots+"</option>";for(var i=0;i<this.groupings.length;i++){var s=this.groupings[i];r+='<option value="'+s.id+'">'+s.name+"</option>"}r+="</select></span></label>";var o=e.Node.create("<span>"+r+"</span>");t.id!==undefined&&o.one("select[name=id] > option[value="+t.id+"]")&&o.one("select[name=id]").set("value",t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var u=e.one("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return o},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"]});
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
YUI.add('moodle-availability_grouping-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing grouping conditions.
|
||||
*
|
||||
* @module moodle-availability_grouping-form
|
||||
*/
|
||||
M.availability_grouping = M.availability_grouping || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_grouping.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_grouping.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groupings available for selection (alphabetical order).
|
||||
*
|
||||
* @property groupings
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_grouping.form.groupings = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} groupings Array of objects containing groupingid => name
|
||||
*/
|
||||
M.availability_grouping.form.initInner = function(groupings) {
|
||||
this.groupings = groupings;
|
||||
};
|
||||
|
||||
M.availability_grouping.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_grouping;
|
||||
var html = '<label>' + strings.title + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>';
|
||||
for (var i = 0; i < this.groupings.length; i++) {
|
||||
var grouping = this.groupings[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
node.one('select[name=id] > option[value=' + json.id + ']')) {
|
||||
node.one('select[name=id]').set('value', json.id);
|
||||
}
|
||||
|
||||
// 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');
|
||||
root.delegate('change', function() {
|
||||
// Just update the form fields.
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grouping select');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_grouping.form.fillValue = function(value, node) {
|
||||
var selected = node.one('select[name=id]').get('value');
|
||||
if (selected === 'choose') {
|
||||
value.id = 'choose';
|
||||
} else {
|
||||
value.id = parseInt(selected, 10);
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_grouping.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check grouping item id.
|
||||
if (value.id === 'choose') {
|
||||
errors.push('availability_grouping:error_selectgrouping');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
YUI.add('moodle-availability_profile-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing profile conditions.
|
||||
*
|
||||
* @module moodle-availability_profile-form
|
||||
*/
|
||||
M.availability_profile = M.availability_profile || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_profile.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_profile.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groupings available for selection (alphabetical order).
|
||||
*
|
||||
* @property profiles
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_profile.form.profiles = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} standardFields Array of objects with .field, .display
|
||||
* @param {Array} customFields Array of objects with .field, .display
|
||||
*/
|
||||
M.availability_profile.form.initInner = function(standardFields, customFields) {
|
||||
this.standardFields = standardFields;
|
||||
this.customFields = customFields;
|
||||
};
|
||||
|
||||
M.availability_profile.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_profile;
|
||||
var html = '<span class="availability-group"><label>' + strings.conditiontitle + ' ' +
|
||||
'<select name="field">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>';
|
||||
var fieldInfo;
|
||||
for (var i = 0; i < this.standardFields.length; i++) {
|
||||
fieldInfo = this.standardFields[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="sf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
for (i = 0; i < this.customFields.length; i++) {
|
||||
fieldInfo = this.customFields[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_operator +
|
||||
' </span><select name="op" title="' + strings.label_operator + '">';
|
||||
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
|
||||
'isempty', 'isnotempty'];
|
||||
for (i = 0; i < operators.length; i++) {
|
||||
html += '<option value="' + operators[i] + '">' +
|
||||
strings['op_' + operators[i]] + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_value +
|
||||
'</span><input name="value" type="text" style="width: 10em" title="' +
|
||||
strings.label_value + '"/></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values if specified.
|
||||
if (json.sf !== undefined &&
|
||||
node.one('select[name=field] > option[value=sf_' + json.sf + ']')) {
|
||||
node.one('select[name=field]').set('value', 'sf_' + json.sf);
|
||||
} else if (json.cf !== undefined &&
|
||||
node.one('select[name=field] > option[value=cf_' + json.sf + ']')) {
|
||||
node.one('select[name=field]').set('value', 'cf_' + json.cf);
|
||||
}
|
||||
if (json.op !== undefined &&
|
||||
node.one('select[name=op] > option[value=' + json.op + ']')) {
|
||||
node.one('select[name=op]').set('value', json.op);
|
||||
}
|
||||
if (json.v !== undefined) {
|
||||
node.one('input').set('value', json.v);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_profile.form.addedEvents) {
|
||||
M.availability_profile.form.addedEvents = true;
|
||||
var updateForm = function(input) {
|
||||
var ancestorNode = input.ancestor('span.availability_profile');
|
||||
var op = ancestorNode.one('select[name=op]');
|
||||
var novalue = (op.get('value') === 'isempty' || op.get('value') === 'isnotempty');
|
||||
ancestorNode.one('input[name=value]').set('disabled', novalue);
|
||||
M.core_availability.form.update();
|
||||
};
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
updateForm(this);
|
||||
}, '.availability_profile select');
|
||||
root.delegate('change', function() {
|
||||
updateForm(this);
|
||||
}, '.availability_profile input[name=value]');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_profile.form.fillValue = function(value, node) {
|
||||
// Set field.
|
||||
var field = node.one('select[name=field]').get('value');
|
||||
if (field.substr(0, 3) === 'sf_') {
|
||||
value.sf = field.substr(3);
|
||||
} else if (field.substr(0, 3) === 'cf_') {
|
||||
value.cf = field.substr(3);
|
||||
}
|
||||
|
||||
// Operator and value
|
||||
value.op = node.one('select[name=op]').get('value');
|
||||
var valueNode = node.one('input[name=value]');
|
||||
if (!valueNode.get('disabled')) {
|
||||
value.v = valueNode.get('value');
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_profile.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check profile item id.
|
||||
if (value.sf === undefined && value.cf === undefined) {
|
||||
errors.push('availability_profile:error_selectfield');
|
||||
}
|
||||
if (value.v !== undefined && /^\s*$/.test(value.v)) {
|
||||
errors.push('availability_profile:error_setvalue');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
+1
@@ -0,0 +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.str.availability_profile,r='<span class="availability-group"><label>'+n.conditiontitle+" "+'<select name="field">'+'<option value="choose">'+M.str.moodle.choosedots+"</option>",i;for(var s=0;s<this.standardFields.length;s++)i=this.standardFields[s],r+='<option value="sf_'+i.field+'">'+i.display+"</option>";for(s=0;s<this.customFields.length;s++)i=this.customFields[s],r+='<option value="cf_'+i.field+'">'+i.display+"</option>";r+='</select></label> <label><span class="accesshide">'+n.label_operator+' </span><select name="op" title="'+n.label_operator+'">';var o=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(s=0;s<o.length;s++)r+='<option value="'+o[s]+'">'+n["op_"+o[s]]+"</option>";r+='</select></label> <label><span class="accesshide">'+n.label_value+'</span><input name="value" type="text" style="width: 10em" title="'+n.label_value+'"/></label></span>';var u=e.Node.create("<span>"+r+"</span>");t.sf!==undefined&&u.one("select[name=field] > option[value=sf_"+t.sf+"]")?u.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&u.one("select[name=field] > option[value=cf_"+t.sf+"]")&&u.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&u.one("select[name=op] > option[value="+t.op+"]")&&u.one("select[name=op]").set("value",t.op),t.v!==undefined&&u.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var a=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()},f=e.one("#fitem_id_availabilityconditionsjson");f.delegate("change",function(){a(this)},".availability_profile select"),f.delegate("change",function(){a(this)},".availability_profile input[name=value]")}return u},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"]});
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
YUI.add('moodle-availability_profile-form', function (Y, NAME) {
|
||||
|
||||
/**
|
||||
* JavaScript for form editing profile conditions.
|
||||
*
|
||||
* @module moodle-availability_profile-form
|
||||
*/
|
||||
M.availability_profile = M.availability_profile || {};
|
||||
|
||||
/**
|
||||
* @class M.availability_profile.form
|
||||
* @extends M.core_availability.plugin
|
||||
*/
|
||||
M.availability_profile.form = Y.Object(M.core_availability.plugin);
|
||||
|
||||
/**
|
||||
* Groupings available for selection (alphabetical order).
|
||||
*
|
||||
* @property profiles
|
||||
* @type Array
|
||||
*/
|
||||
M.availability_profile.form.profiles = null;
|
||||
|
||||
/**
|
||||
* Initialises this plugin.
|
||||
*
|
||||
* @method initInner
|
||||
* @param {Array} standardFields Array of objects with .field, .display
|
||||
* @param {Array} customFields Array of objects with .field, .display
|
||||
*/
|
||||
M.availability_profile.form.initInner = function(standardFields, customFields) {
|
||||
this.standardFields = standardFields;
|
||||
this.customFields = customFields;
|
||||
};
|
||||
|
||||
M.availability_profile.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var strings = M.str.availability_profile;
|
||||
var html = '<span class="availability-group"><label>' + strings.conditiontitle + ' ' +
|
||||
'<select name="field">' +
|
||||
'<option value="choose">' + M.str.moodle.choosedots + '</option>';
|
||||
var fieldInfo;
|
||||
for (var i = 0; i < this.standardFields.length; i++) {
|
||||
fieldInfo = this.standardFields[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="sf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
for (i = 0; i < this.customFields.length; i++) {
|
||||
fieldInfo = this.customFields[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_operator +
|
||||
' </span><select name="op" title="' + strings.label_operator + '">';
|
||||
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
|
||||
'isempty', 'isnotempty'];
|
||||
for (i = 0; i < operators.length; i++) {
|
||||
html += '<option value="' + operators[i] + '">' +
|
||||
strings['op_' + operators[i]] + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + strings.label_value +
|
||||
'</span><input name="value" type="text" style="width: 10em" title="' +
|
||||
strings.label_value + '"/></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
|
||||
// Set initial values if specified.
|
||||
if (json.sf !== undefined &&
|
||||
node.one('select[name=field] > option[value=sf_' + json.sf + ']')) {
|
||||
node.one('select[name=field]').set('value', 'sf_' + json.sf);
|
||||
} else if (json.cf !== undefined &&
|
||||
node.one('select[name=field] > option[value=cf_' + json.sf + ']')) {
|
||||
node.one('select[name=field]').set('value', 'cf_' + json.cf);
|
||||
}
|
||||
if (json.op !== undefined &&
|
||||
node.one('select[name=op] > option[value=' + json.op + ']')) {
|
||||
node.one('select[name=op]').set('value', json.op);
|
||||
}
|
||||
if (json.v !== undefined) {
|
||||
node.one('input').set('value', json.v);
|
||||
}
|
||||
|
||||
// Add event handlers (first time only).
|
||||
if (!M.availability_profile.form.addedEvents) {
|
||||
M.availability_profile.form.addedEvents = true;
|
||||
var updateForm = function(input) {
|
||||
var ancestorNode = input.ancestor('span.availability_profile');
|
||||
var op = ancestorNode.one('select[name=op]');
|
||||
var novalue = (op.get('value') === 'isempty' || op.get('value') === 'isnotempty');
|
||||
ancestorNode.one('input[name=value]').set('disabled', novalue);
|
||||
M.core_availability.form.update();
|
||||
};
|
||||
var root = Y.one('#fitem_id_availabilityconditionsjson');
|
||||
root.delegate('change', function() {
|
||||
updateForm(this);
|
||||
}, '.availability_profile select');
|
||||
root.delegate('change', function() {
|
||||
updateForm(this);
|
||||
}, '.availability_profile input[name=value]');
|
||||
}
|
||||
|
||||
return node;
|
||||
};
|
||||
|
||||
M.availability_profile.form.fillValue = function(value, node) {
|
||||
// Set field.
|
||||
var field = node.one('select[name=field]').get('value');
|
||||
if (field.substr(0, 3) === 'sf_') {
|
||||
value.sf = field.substr(3);
|
||||
} else if (field.substr(0, 3) === 'cf_') {
|
||||
value.cf = field.substr(3);
|
||||
}
|
||||
|
||||
// Operator and value
|
||||
value.op = node.one('select[name=op]').get('value');
|
||||
var valueNode = node.one('input[name=value]');
|
||||
if (!valueNode.get('disabled')) {
|
||||
value.v = valueNode.get('value');
|
||||
}
|
||||
};
|
||||
|
||||
M.availability_profile.form.fillErrors = function(errors, node) {
|
||||
var value = {};
|
||||
this.fillValue(value, node);
|
||||
|
||||
// Check profile item id.
|
||||
if (value.sf === undefined && value.cf === undefined) {
|
||||
errors.push('availability_profile:error_selectfield');
|
||||
}
|
||||
if (value.v !== undefined && /^\s*$/.test(value.v)) {
|
||||
errors.push('availability_profile:error_setvalue');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "event", "moodle-core_availability-form"]});
|
||||
Vendored
+1025
File diff suppressed because it is too large
Load Diff
+3
File diff suppressed because one or more lines are too long
+1025
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user