mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
MDL-27171 messages: add default message outputs management interface
This introduces the new page where admin may change the permissions and defaults for particular combination of message processors and providers. Signed-off-by: Ruslan Kabalin <ruslan.kabalin@luns.net.uk>
This commit is contained in:
parent
e710658d89
commit
1d72e9d441
8 changed files with 326 additions and 23 deletions
|
@ -42,4 +42,49 @@ M.core_message.init_notification = function(Y, title, content, url) {
|
|||
return false;
|
||||
}, o);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
M.core_message.init_defaultoutputs = function(Y) {
|
||||
var defaultoutputs = {
|
||||
|
||||
init : function() {
|
||||
Y.all('#defaultmessageoutputs select').each(function(node) {
|
||||
// attach event listener
|
||||
node.on('change', defaultoutputs.changeState);
|
||||
// set initial layout
|
||||
node.simulate("change");
|
||||
}, this);
|
||||
},
|
||||
|
||||
changeState : function(e) {
|
||||
var value = e.target._node.options[e.target.get('selectedIndex')].value;
|
||||
var parentnode = e.target.ancestor('td');
|
||||
switch (value) {
|
||||
case 'forced':
|
||||
defaultoutputs.updateCheckboxes(parentnode, 1, 1);
|
||||
break;
|
||||
case 'disallowed':
|
||||
defaultoutputs.updateCheckboxes(parentnode, 1, 0);
|
||||
break;
|
||||
case 'permitted':
|
||||
defaultoutputs.updateCheckboxes(parentnode, 0, 0);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
updateCheckboxes : function(blocknode, disabled, checked) {
|
||||
blocknode.all('input[type=checkbox]').each(function(node) {
|
||||
node.removeAttribute('disabled');
|
||||
if (disabled) {
|
||||
node.setAttribute('disabled', 1)
|
||||
node.removeAttribute('checked');
|
||||
}
|
||||
if (checked) {
|
||||
node.setAttribute('checked', 1)
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
||||
defaultoutputs.init();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue