mirror of
https://github.com/moodle/moodle.git
synced 2025-03-13 20:26:32 +01:00
Merge branch 'MDL-68378-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
cb8ad9c76e
@ -1,2 +1,2 @@
|
||||
define ("core/custom_interaction_events",["jquery","core/key_codes"],function(a,b){var c={activate:"cie:activate",keyboardActivate:"cie:keyboardactivate",escape:"cie:escape",down:"cie:down",up:"cie:up",home:"cie:home",end:"cie:end",next:"cie:next",previous:"cie:previous",asterix:"cie:asterix",scrollLock:"cie:scrollLock",scrollTop:"cie:scrollTop",scrollBottom:"cie:scrollBottom",ctrlPageUp:"cie:ctrlPageUp",ctrlPageDown:"cie:ctrlPageDown",enter:"cie:enter"},d={},e=function(a,b){b=b||[];if(b.length&&-1!==b.indexOf(a)){return!0}return!1},f=function(a){return a.shiftKey||a.metaKey||a.altKey||a.ctrlKey},g=function(b,c){var e="";if(!c.hasOwnProperty("originalEvent")){e=""+b+c.type+c.timeStamp;if(!d.hasOwnProperty(e)){d[e]=!0;a(c.target).trigger(b,[{originalEvent:c}])}return}e="triggeredCustom_"+b;if(!c.originalEvent.hasOwnProperty(e)){c.originalEvent[e]=!0;a(c.target).trigger(b,[{originalEvent:c}])}},h=function(a,b,c){a.off("keydown."+b).on("keydown."+b,function(a){if(!f(a)){if(a.keyCode==c){g(b,a)}}})},i=function(a){a.off("click.cie.activate").on("click.cie.activate",function(a){g(c.activate,a)});a.off("keydown.cie.activate").on("keydown.cie.activate",function(a){if(!f(a)){if(a.keyCode==b.enter||a.keyCode==b.space){g(c.activate,a)}}})},j=function(a){a.off("keydown.cie.keyboardactivate").on("keydown.cie.keyboardactivate",function(a){if(!f(a)){if(a.keyCode==b.enter||a.keyCode==b.space){g(c.keyboardActivate,a)}}})},k=function(a){h(a,c.escape,b.escape)},l=function(a){h(a,c.down,b.arrowDown)},m=function(a){h(a,c.up,b.arrowUp)},n=function(a){h(a,c.home,b.home)},o=function(a){h(a,c.end,b.end)},p=function(d){var e="rtl"==a("html").attr("dir")?b.arrowLeft:b.arrowRight;h(d,c.next,e)},q=function(d){var e="rtl"==a("html").attr("dir")?b.arrowRight:b.arrowLeft;h(d,c.previous,e)},r=function(a){h(a,c.asterix,b.asterix)},s=function(a){a.off("scroll.cie.scrollTop").on("scroll.cie.scrollTop",function(b){var d=a.scrollTop();if(0===d){g(c.scrollTop,b)}})},t=function(a){a.off("scroll.cie.scrollBottom").on("scroll.cie.scrollBottom",function(b){var d=a.scrollTop(),e=a.innerHeight(),f=a[0].scrollHeight;if(d+e>=f){g(c.scrollBottom,b)}})},u=function(a){a.off("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock").on("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock",function(b){var d=a.scrollTop(),e=a[0].scrollHeight,f=a.height(),h="DOMMouseScroll"==b.type?-40*b.originalEvent.detail:b.originalEvent.wheelDelta,i=0<h;if(!i&&-h>e-f-d){a.scrollTop(e);b.stopPropagation();b.preventDefault();b.returnValue=!1;g(c.scrollLock,b);return!1}else if(i&&h>d){a.scrollTop(0);b.stopPropagation();b.preventDefault();b.returnValue=!1;g(c.scrollLock,b);return!1}return!0})},v=function(a){a.off("keydown.cie.ctrlpageup").on("keydown.cie.ctrlpageup",function(a){if(a.ctrlKey){if(a.keyCode==b.pageUp){g(c.ctrlPageUp,a)}}})},w=function(a){a.off("keydown.cie.ctrlpagedown").on("keydown.cie.ctrlpagedown",function(a){if(a.ctrlKey){if(a.keyCode==b.pageDown){g(c.ctrlPageDown,a)}}})},x=function(a){h(a,c.enter,b.enter)},y=function(){var a={};a[c.activate]=i;a[c.keyboardActivate]=j;a[c.escape]=k;a[c.down]=l;a[c.up]=m;a[c.home]=n;a[c.end]=o;a[c.next]=p;a[c.previous]=q;a[c.asterix]=r;a[c.scrollLock]=u;a[c.scrollTop]=s;a[c.scrollBottom]=t;a[c.ctrlPageUp]=v;a[c.ctrlPageDown]=w;a[c.enter]=x;return a};return{define:function define(b,c){b=a(b);c=c||[];if(!b.length||!c.length){return}a.each(y(),function(a,d){if(e(a,c)){d(b)}})},events:c}});
|
||||
define ("core/custom_interaction_events",["jquery","core/key_codes"],function(a,b){var c={activate:"cie:activate",keyboardActivate:"cie:keyboardactivate",escape:"cie:escape",down:"cie:down",up:"cie:up",home:"cie:home",end:"cie:end",next:"cie:next",previous:"cie:previous",asterix:"cie:asterix",scrollLock:"cie:scrollLock",scrollTop:"cie:scrollTop",scrollBottom:"cie:scrollBottom",ctrlPageUp:"cie:ctrlPageUp",ctrlPageDown:"cie:ctrlPageDown",enter:"cie:enter",accessibleChange:"cie:accessibleChange"},d={},e=function(a,b){b=b||[];if(b.length&&-1!==b.indexOf(a)){return!0}return!1},f=function(a){return a.shiftKey||a.metaKey||a.altKey||a.ctrlKey},g=function(b,c){var e="";if(!c.hasOwnProperty("originalEvent")){e=""+b+c.type+c.timeStamp;if(!d.hasOwnProperty(e)){d[e]=!0;a(c.target).trigger(b,[{originalEvent:c}])}return}e="triggeredCustom_"+b;if(!c.originalEvent.hasOwnProperty(e)){c.originalEvent[e]=!0;a(c.target).trigger(b,[{originalEvent:c}])}},h=function(a,b,c){a.off("keydown."+b).on("keydown."+b,function(a){if(!f(a)){if(a.keyCode==c){g(b,a)}}})},i=function(a){a.off("click.cie.activate").on("click.cie.activate",function(a){g(c.activate,a)});a.off("keydown.cie.activate").on("keydown.cie.activate",function(a){if(!f(a)){if(a.keyCode==b.enter||a.keyCode==b.space){g(c.activate,a)}}})},j=function(a){a.off("keydown.cie.keyboardactivate").on("keydown.cie.keyboardactivate",function(a){if(!f(a)){if(a.keyCode==b.enter||a.keyCode==b.space){g(c.keyboardActivate,a)}}})},k=function(a){h(a,c.escape,b.escape)},l=function(a){h(a,c.down,b.arrowDown)},m=function(a){h(a,c.up,b.arrowUp)},n=function(a){h(a,c.home,b.home)},o=function(a){h(a,c.end,b.end)},p=function(d){var e="rtl"==a("html").attr("dir")?b.arrowLeft:b.arrowRight;h(d,c.next,e)},q=function(d){var e="rtl"==a("html").attr("dir")?b.arrowRight:b.arrowLeft;h(d,c.previous,e)},r=function(a){h(a,c.asterix,b.asterix)},s=function(a){a.off("scroll.cie.scrollTop").on("scroll.cie.scrollTop",function(b){var d=a.scrollTop();if(0===d){g(c.scrollTop,b)}})},t=function(a){a.off("scroll.cie.scrollBottom").on("scroll.cie.scrollBottom",function(b){var d=a.scrollTop(),e=a.innerHeight(),f=a[0].scrollHeight;if(d+e>=f){g(c.scrollBottom,b)}})},u=function(a){a.off("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock").on("DOMMouseScroll.cie.DOMMouseScrollLock mousewheel.cie.mousewheelLock",function(b){var d=a.scrollTop(),e=a[0].scrollHeight,f=a.height(),h="DOMMouseScroll"==b.type?-40*b.originalEvent.detail:b.originalEvent.wheelDelta,i=0<h;if(!i&&-h>e-f-d){a.scrollTop(e);b.stopPropagation();b.preventDefault();b.returnValue=!1;g(c.scrollLock,b);return!1}else if(i&&h>d){a.scrollTop(0);b.stopPropagation();b.preventDefault();b.returnValue=!1;g(c.scrollLock,b);return!1}return!0})},v=function(a){a.off("keydown.cie.ctrlpageup").on("keydown.cie.ctrlpageup",function(a){if(a.ctrlKey){if(a.keyCode==b.pageUp){g(c.ctrlPageUp,a)}}})},w=function(a){a.off("keydown.cie.ctrlpagedown").on("keydown.cie.ctrlpagedown",function(a){if(a.ctrlKey){if(a.keyCode==b.pageDown){g(c.ctrlPageDown,a)}}})},x=function(a){h(a,c.enter,b.enter)},y=function(d){var e=-1!==navigator.userAgent.indexOf("Macintosh"),f="ontouchstart"in window||"msMaxTouchPoints"in navigator&&0<navigator.msMaxTouchPoints;if(e||f){d.on("change",function(a){g(c.accessibleChange,a)})}else{d.on("focus",function(){a(this).data("initValue",this.value)});d.on("blur",function(b){var d=a(this).data("initValue");a(this).removeData("initValue");if(this.value!==d){g(c.accessibleChange,b)}});d.on("keydown",function(d){if(d.which===b.enter&&this.value!==a(this).data("initValue")){g(c.accessibleChange,d)}else if(d.which===b.escape){this.value=a(this).data("initValue")}});d.on("click",function(b){var d=a(this).data("initValue");if("undefined"!=typeof d&&d!=this.value){g(c.accessibleChange,b)}})}},z=function(){var a={};a[c.activate]=i;a[c.keyboardActivate]=j;a[c.escape]=k;a[c.down]=l;a[c.up]=m;a[c.home]=n;a[c.end]=o;a[c.next]=p;a[c.previous]=q;a[c.asterix]=r;a[c.scrollLock]=u;a[c.scrollTop]=s;a[c.scrollBottom]=t;a[c.ctrlPageUp]=v;a[c.ctrlPageDown]=w;a[c.enter]=x;a[c.accessibleChange]=y;return a};return{define:function define(b,c){b=a(b);c=c||[];if(!b.length||!c.length){return}a.each(z(),function(a,d){if(e(a,c)){d(b)}})},events:c}});
|
||||
//# sourceMappingURL=custom_interaction_events.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -43,6 +43,7 @@ define(['jquery', 'core/key_codes'], function($, keyCodes) {
|
||||
ctrlPageUp: 'cie:ctrlPageUp',
|
||||
ctrlPageDown: 'cie:ctrlPageDown',
|
||||
enter: 'cie:enter',
|
||||
accessibleChange: 'cie:accessibleChange',
|
||||
};
|
||||
// Static cache of jQuery events that have been handled. This should
|
||||
// only be populated by JavaScript generated events (which will keep it
|
||||
@ -415,6 +416,48 @@ define(['jquery', 'core/key_codes'], function($, keyCodes) {
|
||||
addKeyboardEvent(element, events.enter, keyCodes.enter);
|
||||
};
|
||||
|
||||
/**
|
||||
* Trigger the AccessibleChange event on the given element if the value of the element is changed.
|
||||
*
|
||||
* @method addAccessibleChangeListener
|
||||
* @private
|
||||
* @param {object} element jQuery object to add event listeners to
|
||||
*/
|
||||
var addAccessibleChangeListener = function(element) {
|
||||
var onMac = navigator.userAgent.indexOf('Macintosh') !== -1;
|
||||
var touchEnabled = ('ontouchstart' in window) || (('msMaxTouchPoints' in navigator) && (navigator.msMaxTouchPoints > 0));
|
||||
if (onMac || touchEnabled) {
|
||||
element.on('change', function(e) {
|
||||
triggerEvent(events.accessibleChange, e);
|
||||
});
|
||||
} else {
|
||||
element.on('focus', function() {
|
||||
$(this).data('initValue', this.value);
|
||||
});
|
||||
element.on('blur', function(e) {
|
||||
var initValue = $(this).data('initValue');
|
||||
$(this).removeData('initValue');
|
||||
if (this.value !== initValue) {
|
||||
triggerEvent(events.accessibleChange, e);
|
||||
}
|
||||
});
|
||||
element.on('keydown', function(e) {
|
||||
if ((e.which === keyCodes.enter) && this.value !== $(this).data('initValue')) {
|
||||
triggerEvent(events.accessibleChange, e);
|
||||
} else if (e.which === keyCodes.escape) {
|
||||
this.value = $(this).data('initValue');
|
||||
}
|
||||
});
|
||||
element.on('click', function(e) {
|
||||
var initValue = $(this).data('initValue');
|
||||
// Some browsers trigger onclick before onblur, therefore it is possible that initValue is undefined.
|
||||
if (typeof initValue !== 'undefined' && initValue != this.value) {
|
||||
triggerEvent(events.accessibleChange, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the list of events and their handlers.
|
||||
*
|
||||
@ -441,6 +484,7 @@ define(['jquery', 'core/key_codes'], function($, keyCodes) {
|
||||
handlers[events.ctrlPageUp] = addCtrlPageUpListener;
|
||||
handlers[events.ctrlPageDown] = addCtrlPageDownListener;
|
||||
handlers[events.enter] = addEnterListener;
|
||||
handlers[events.accessibleChange] = addAccessibleChangeListener;
|
||||
|
||||
return handlers;
|
||||
};
|
||||
|
@ -116,8 +116,9 @@
|
||||
</form>
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['jquery'], function($) {
|
||||
$('#{{id}}').change(function() {
|
||||
require(['jquery', 'core/custom_interaction_events'], function($, CustomEvents) {
|
||||
CustomEvents.define('#{{id}}', [CustomEvents.events.accessibleChange]);
|
||||
$('#{{id}}').on(CustomEvents.events.accessibleChange, function() {
|
||||
var ignore = $(this).find(':selected').attr('data-ignore');
|
||||
if (typeof ignore === typeof undefined) {
|
||||
$('#{{formid}}').submit();
|
||||
|
@ -75,8 +75,9 @@
|
||||
</div>
|
||||
{{^showbutton}}
|
||||
{{#js}}
|
||||
require(['jquery'], function($) {
|
||||
$('#{{id}}').change(function() {
|
||||
require(['jquery', 'core/custom_interaction_events'], function($, CustomEvents) {
|
||||
CustomEvents.define('#{{id}}', [CustomEvents.events.accessibleChange]);
|
||||
$('#{{id}}').on(CustomEvents.events.accessibleChange, function() {
|
||||
if (!$(this).val()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -87,8 +87,9 @@
|
||||
</div>
|
||||
|
||||
{{#js}}
|
||||
require(['jquery', 'core_message/message_send_bulk'], function($, BulkSender) {
|
||||
$('#{{id}}').on('change', function(e) {
|
||||
require(['jquery', 'core_message/message_send_bulk', 'core/custom_interaction_events'], function($, BulkSender, CustomEvents) {
|
||||
CustomEvents.define('#{{id}}', [CustomEvents.events.accessibleChange]);
|
||||
$('#{{id}}').on(CustomEvents.events.accessibleChange, function(e) {
|
||||
var action = $(e.target).val();
|
||||
if (action.indexOf('#') !== -1) {
|
||||
e.preventDefault();
|
||||
|
2
user/amd/build/participants.min.js
vendored
2
user/amd/build/participants.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("core_user/participants",["jquery","core/str","core/modal_factory","core/modal_events","core/templates","core/notification","core/ajax"],function(a,b,c,d,e,f,g){var h={BULKACTIONSELECT:"#formactionid",BULKUSERCHECKBOXES:"input.usercheckbox",BULKUSERNOSCHECKBOXES:"input.usercheckbox[value='0']",BULKUSERSELECTEDCHECKBOXES:"input.usercheckbox:checked",BULKACTIONFORM:"#participantsform",CHECKALLBUTTON:"#checkall",CHECKALLNOSBUTTON:"#checkallnos"},i=function(a){this.courseId=a.courseid;this.noteStateNames=a.noteStateNames;this.stateHelpIcon=a.stateHelpIcon;this.attachEventListeners()};i.prototype.modal=null;i.prototype.courseId=-1;i.prototype.noteStateNames={};i.prototype.stateHelpIcon="";i.prototype.attachEventListeners=function(){a(h.BULKACTIONSELECT).on("change",function(b){var c=a(b.target).val();if(-1!==c.indexOf("#")){b.preventDefault();var d=[];a(h.BULKUSERSELECTEDCHECKBOXES).each(function(b,c){var e=a(c).attr("name"),f=e.replace("user","");d.push(f)});if("#messageselect"==c){this.showSendMessage(d).fail(f.exception)}else if("#addgroupnote"==c){this.showAddNote(d).fail(f.exception)}a(h.BULKACTIONSELECT+" option[value=\"\"]").prop("selected","selected")}else if(""!==c){if(0<a(h.BULKUSERSELECTEDCHECKBOXES).length){a(h.BULKACTIONFORM).submit()}else{a(h.BULKACTIONSELECT+" option[value=\"\"]").prop("selected","selected")}}}.bind(this));a(h.CHECKALLBUTTON).on("click",function(){var b=a(this).data("showallink");if(b){window.location=b}});a(h.CHECKALLNOSBUTTON).on("click",function(){a(h.BULKUSERNOSCHECKBOXES).prop("checked",!0)})};i.prototype.showAddNote=function(f){if(0==f.length){return a.Deferred().resolve().promise()}var g=[];for(var i in this.noteStateNames){switch(i){case"draft":g.push({value:"personal",label:this.noteStateNames[i]});break;case"public":g.push({value:"course",label:this.noteStateNames[i],selected:1});break;case"site":g.push({value:i,label:this.noteStateNames[i]});break;}}var j={stateNames:g,stateHelpIcon:this.stateHelpIcon},k=null;if(1==f.length){k=b.get_string("addbulknotesingle","core_notes")}else{k=b.get_string("addbulknote","core_notes",f.length)}return a.when(c.create({type:c.types.SAVE_CANCEL,body:e.render("core_user/add_bulk_note",j)}),k).then(function(b,c){this.modal=b;this.modal.setTitle(c);this.modal.setSaveButtonText(c);this.modal.getRoot().on(d.hidden,function(){var b=a("#user-notifications [role=alert]");if(b.length){b.focus()}else{a(h.BULKACTIONSELECT).focus()}this.modal.getRoot().remove()}.bind(this));this.modal.getRoot().on(d.save,this.submitAddNote.bind(this,f));this.modal.show();return this.modal}.bind(this))};i.prototype.submitAddNote=function(a){var c=this.modal.getRoot().find("form textarea").val(),d=this.modal.getRoot().find("form select").val(),e=[],h=0;for(h=0;h<a.length;h++){e.push({userid:a[h],text:c,courseid:this.courseId,publishstate:d})}return g.call([{methodname:"core_notes_create_notes",args:{notes:e}}])[0].then(function(a){if(1==a.length){return b.get_string("addbulknotedonesingle","core_notes")}else{return b.get_string("addbulknotedone","core_notes",a.length)}}).then(function(a){f.addNotification({message:a,type:"success"});return!0}).catch(f.exception)};i.prototype.showSendMessage=function(f){if(0==f.length){return a.Deferred().resolve().promise()}var g=null;if(1==f.length){g=b.get_string("sendbulkmessagesingle","core_message")}else{g=b.get_string("sendbulkmessage","core_message",f.length)}return a.when(c.create({type:c.types.SAVE_CANCEL,body:e.render("core_user/send_bulk_message",{})}),g).then(function(b,c){this.modal=b;this.modal.setTitle(c);this.modal.setSaveButtonText(c);this.modal.getRoot().on(d.hidden,function(){a(h.BULKACTIONSELECT).focus();this.modal.getRoot().remove()}.bind(this));this.modal.getRoot().on(d.save,this.submitSendMessage.bind(this,f));this.modal.show();return this.modal}.bind(this))};i.prototype.submitSendMessage=function(a){var c=this.modal.getRoot().find("form textarea").val(),d=[],e=0;for(e=0;e<a.length;e++){d.push({touserid:a[e],text:c})}return g.call([{methodname:"core_message_send_instant_messages",args:{messages:d}}])[0].then(function(a){if(1==a.length){return b.get_string("sendbulkmessagesentsingle","core_message")}else{return b.get_string("sendbulkmessagesent","core_message",a.length)}}).then(function(a){f.addNotification({message:a,type:"success"});return!0}).catch(f.exception)};return{init:function init(a){return new i(a)}}});
|
||||
define ("core_user/participants",["jquery","core/str","core/modal_factory","core/modal_events","core/templates","core/notification","core/ajax","core/custom_interaction_events"],function(a,b,c,d,e,f,g,h){var i={BULKACTIONSELECT:"#formactionid",BULKUSERCHECKBOXES:"input.usercheckbox",BULKUSERNOSCHECKBOXES:"input.usercheckbox[value='0']",BULKUSERSELECTEDCHECKBOXES:"input.usercheckbox:checked",BULKACTIONFORM:"#participantsform",CHECKALLBUTTON:"#checkall",CHECKALLNOSBUTTON:"#checkallnos"},j=function(a){this.courseId=a.courseid;this.noteStateNames=a.noteStateNames;this.stateHelpIcon=a.stateHelpIcon;this.attachEventListeners()};j.prototype.modal=null;j.prototype.courseId=-1;j.prototype.noteStateNames={};j.prototype.stateHelpIcon="";j.prototype.attachEventListeners=function(){h.define(i.BULKACTIONSELECT,[h.events.accessibleChange]);a(i.BULKACTIONSELECT).on(h.events.accessibleChange,function(b){var c=a(b.target).val();if(-1!==c.indexOf("#")){b.preventDefault();var d=[];a(i.BULKUSERSELECTEDCHECKBOXES).each(function(b,c){var e=a(c).attr("name"),f=e.replace("user","");d.push(f)});if("#messageselect"==c){this.showSendMessage(d).fail(f.exception)}else if("#addgroupnote"==c){this.showAddNote(d).fail(f.exception)}a(i.BULKACTIONSELECT+" option[value=\"\"]").prop("selected","selected")}else if(""!==c){if(0<a(i.BULKUSERSELECTEDCHECKBOXES).length){a(i.BULKACTIONFORM).submit()}else{a(i.BULKACTIONSELECT+" option[value=\"\"]").prop("selected","selected")}}}.bind(this));a(i.CHECKALLBUTTON).on("click",function(){var b=a(this).data("showallink");if(b){window.location=b}});a(i.CHECKALLNOSBUTTON).on("click",function(){a(i.BULKUSERNOSCHECKBOXES).prop("checked",!0)})};j.prototype.showAddNote=function(f){if(0==f.length){return a.Deferred().resolve().promise()}var g=[];for(var h in this.noteStateNames){switch(h){case"draft":g.push({value:"personal",label:this.noteStateNames[h]});break;case"public":g.push({value:"course",label:this.noteStateNames[h],selected:1});break;case"site":g.push({value:h,label:this.noteStateNames[h]});break;}}var j={stateNames:g,stateHelpIcon:this.stateHelpIcon},k=null;if(1==f.length){k=b.get_string("addbulknotesingle","core_notes")}else{k=b.get_string("addbulknote","core_notes",f.length)}return a.when(c.create({type:c.types.SAVE_CANCEL,body:e.render("core_user/add_bulk_note",j)}),k).then(function(b,c){this.modal=b;this.modal.setTitle(c);this.modal.setSaveButtonText(c);this.modal.getRoot().on(d.hidden,function(){var b=a("#user-notifications [role=alert]");if(b.length){b.focus()}else{a(i.BULKACTIONSELECT).focus()}this.modal.getRoot().remove()}.bind(this));this.modal.getRoot().on(d.save,this.submitAddNote.bind(this,f));this.modal.show();return this.modal}.bind(this))};j.prototype.submitAddNote=function(a){var c=this.modal.getRoot().find("form textarea").val(),d=this.modal.getRoot().find("form select").val(),e=[],h=0;for(h=0;h<a.length;h++){e.push({userid:a[h],text:c,courseid:this.courseId,publishstate:d})}return g.call([{methodname:"core_notes_create_notes",args:{notes:e}}])[0].then(function(a){if(1==a.length){return b.get_string("addbulknotedonesingle","core_notes")}else{return b.get_string("addbulknotedone","core_notes",a.length)}}).then(function(a){f.addNotification({message:a,type:"success"});return!0}).catch(f.exception)};j.prototype.showSendMessage=function(f){if(0==f.length){return a.Deferred().resolve().promise()}var g=null;if(1==f.length){g=b.get_string("sendbulkmessagesingle","core_message")}else{g=b.get_string("sendbulkmessage","core_message",f.length)}return a.when(c.create({type:c.types.SAVE_CANCEL,body:e.render("core_user/send_bulk_message",{})}),g).then(function(b,c){this.modal=b;this.modal.setTitle(c);this.modal.setSaveButtonText(c);this.modal.getRoot().on(d.hidden,function(){a(i.BULKACTIONSELECT).focus();this.modal.getRoot().remove()}.bind(this));this.modal.getRoot().on(d.save,this.submitSendMessage.bind(this,f));this.modal.show();return this.modal}.bind(this))};j.prototype.submitSendMessage=function(a){var c=this.modal.getRoot().find("form textarea").val(),d=[],e=0;for(e=0;e<a.length;e++){d.push({touserid:a[e],text:c})}return g.call([{methodname:"core_message_send_instant_messages",args:{messages:d}}])[0].then(function(a){if(1==a.length){return b.get_string("sendbulkmessagesentsingle","core_message")}else{return b.get_string("sendbulkmessagesent","core_message",a.length)}}).then(function(a){f.addNotification({message:a,type:"success"});return!0}).catch(f.exception)};return{init:function init(a){return new j(a)}}});
|
||||
//# sourceMappingURL=participants.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -22,8 +22,9 @@
|
||||
* @copyright 2017 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/templates', 'core/notification', 'core/ajax'],
|
||||
function($, Str, ModalFactory, ModalEvents, Templates, Notification, Ajax) {
|
||||
define(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/templates', 'core/notification', 'core/ajax',
|
||||
'core/custom_interaction_events'],
|
||||
function($, Str, ModalFactory, ModalEvents, Templates, Notification, Ajax, CustomEvents) {
|
||||
|
||||
var SELECTORS = {
|
||||
BULKACTIONSELECT: "#formactionid",
|
||||
@ -82,7 +83,8 @@ define(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/t
|
||||
* @private
|
||||
*/
|
||||
Participants.prototype.attachEventListeners = function() {
|
||||
$(SELECTORS.BULKACTIONSELECT).on('change', function(e) {
|
||||
CustomEvents.define(SELECTORS.BULKACTIONSELECT, [CustomEvents.events.accessibleChange]);
|
||||
$(SELECTORS.BULKACTIONSELECT).on(CustomEvents.events.accessibleChange, function(e) {
|
||||
var action = $(e.target).val();
|
||||
if (action.indexOf('#') !== -1) {
|
||||
e.preventDefault();
|
||||
|
Loading…
x
Reference in New Issue
Block a user