mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-71672-master-2' of git://github.com/rezaies/moodle
This commit is contained in:
commit
3a55ff2c55
@ -24,7 +24,9 @@ YUI.add('moodle-atto_emojipicker-button', function (Y, NAME) {
|
||||
/**
|
||||
* @module moodle-atto_emojipicker-button
|
||||
*/
|
||||
var COMPONENTNAME = 'atto_emojipicker';
|
||||
|
||||
var COMPONENTNAME = 'atto_emojipicker',
|
||||
EMOJI_PICKER_SEARCH_INPUT = '[data-region="search-input"]';
|
||||
|
||||
/**
|
||||
* Atto text editor emoji picker plugin.
|
||||
@ -123,6 +125,7 @@ Y.namespace('M.atto_emojipicker').Button = Y.Base.create('button', Y.M.editor_at
|
||||
domNode.innerHTML = html;
|
||||
initialiseEmojiPicker(domNode, this._insertEmoji.bind(this));
|
||||
this.getDialogue().centerDialogue();
|
||||
domNode.querySelector(EMOJI_PICKER_SEARCH_INPUT).focus();
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_emojipicker-button",function(e,t){e.namespace("M.atto_emojipicker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){this.get("disabled")||this.addButton({icon:"e/emoticons",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection(),!1!==this._currentSelection&&this.getDialogue({headerContent:M.util.get_string("emojipicker","atto_emojipicker"),width:"auto",focusAfterHide:!0,additionalBaseClass:"emoji-picker-dialogue"},!0).set("bodyContent",this._getDialogueContent()).show()},_insertEmoji:function(e){var t=this.get("host");this.getDialogue({focusAfterHide:null}).hide(),t.setSelection(this._currentSelection),t.insertContentAtFocusPoint(e),this.markUpdated()},_getDialogueContent:function(){var o=e.Node.create("<div></div>");return require(["core/templates","core/emoji/picker"],function(e,i){e.render("core/emoji/picker",{}).then(function(e){var t=o.getDOMNode();t.innerHTML=e,i(t,this._insertEmoji.bind(this)),this.getDialogue().centerDialogue()}.bind(this))}.bind(this)),o}},{ATTRS:{disabled:{value:!0}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_emojipicker-button",function(e,t){e.namespace("M.atto_emojipicker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){this.get("disabled")||this.addButton({icon:"e/emoticons",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection(),!1!==this._currentSelection&&this.getDialogue({headerContent:M.util.get_string("emojipicker","atto_emojipicker"),width:"auto",focusAfterHide:!0,additionalBaseClass:"emoji-picker-dialogue"},!0).set("bodyContent",this._getDialogueContent()).show()},_insertEmoji:function(e){var t=this.get("host");this.getDialogue({focusAfterHide:null}).hide(),t.setSelection(this._currentSelection),t.insertContentAtFocusPoint(e),this.markUpdated()},_getDialogueContent:function(){var o=e.Node.create("<div></div>");return require(["core/templates","core/emoji/picker"],function(e,i){e.render("core/emoji/picker",{}).then(function(e){var t=o.getDOMNode();t.innerHTML=e,i(t,this._insertEmoji.bind(this)),this.getDialogue().centerDialogue(),t.querySelector('[data-region="search-input"]').focus()}.bind(this))}.bind(this)),o}},{ATTRS:{disabled:{value:!0}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
@ -24,7 +24,9 @@ YUI.add('moodle-atto_emojipicker-button', function (Y, NAME) {
|
||||
/**
|
||||
* @module moodle-atto_emojipicker-button
|
||||
*/
|
||||
var COMPONENTNAME = 'atto_emojipicker';
|
||||
|
||||
var COMPONENTNAME = 'atto_emojipicker',
|
||||
EMOJI_PICKER_SEARCH_INPUT = '[data-region="search-input"]';
|
||||
|
||||
/**
|
||||
* Atto text editor emoji picker plugin.
|
||||
@ -123,6 +125,7 @@ Y.namespace('M.atto_emojipicker').Button = Y.Base.create('button', Y.M.editor_at
|
||||
domNode.innerHTML = html;
|
||||
initialiseEmojiPicker(domNode, this._insertEmoji.bind(this));
|
||||
this.getDialogue().centerDialogue();
|
||||
domNode.querySelector(EMOJI_PICKER_SEARCH_INPUT).focus();
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
/**
|
||||
* @module moodle-atto_emojipicker-button
|
||||
*/
|
||||
var COMPONENTNAME = 'atto_emojipicker';
|
||||
|
||||
var COMPONENTNAME = 'atto_emojipicker',
|
||||
EMOJI_PICKER_SEARCH_INPUT = '[data-region="search-input"]';
|
||||
|
||||
/**
|
||||
* Atto text editor emoji picker plugin.
|
||||
@ -121,6 +123,7 @@ Y.namespace('M.atto_emojipicker').Button = Y.Base.create('button', Y.M.editor_at
|
||||
domNode.innerHTML = html;
|
||||
initialiseEmojiPicker(domNode, this._insertEmoji.bind(this));
|
||||
this.getDialogue().centerDialogue();
|
||||
domNode.querySelector(EMOJI_PICKER_SEARCH_INPUT).focus();
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
|
@ -68,6 +68,7 @@ function atto_equation_params_for_js($elementid, $options, $fpoptions) {
|
||||
'group1' => array(
|
||||
'groupname' => 'librarygroup1',
|
||||
'elements' => get_config('atto_equation', 'librarygroup1'),
|
||||
'active' => true,
|
||||
),
|
||||
'group2' => array(
|
||||
'groupname' => 'librarygroup2',
|
||||
|
@ -75,7 +75,10 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
|
||||
'{{#each library}}' +
|
||||
'<li class="nav-item">' +
|
||||
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
'<a class="nav-link{{#active}} active{{/active}}" ' +
|
||||
'{{#active}}aria-selected="true"{{/active}}' +
|
||||
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
|
||||
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
|
||||
' role="tab" data-toggle="tab">' +
|
||||
'{{get_string groupname ../component}}' +
|
||||
@ -85,7 +88,7 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'</ul>' +
|
||||
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
|
||||
'{{#each library}}' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
|
||||
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
|
||||
'<div role="toolbar">' +
|
||||
'{{#split "\n" elements}}' +
|
||||
@ -222,14 +225,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||
focusAfterHide: true,
|
||||
width: 600,
|
||||
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
|
||||
});
|
||||
|
||||
var content = this._getDialogueContent();
|
||||
dialogue.set('bodyContent', content);
|
||||
|
||||
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
|
||||
|
||||
dialogue.show();
|
||||
// Notify the filters about the modified nodes.
|
||||
require(['core/event'], function(event) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -75,7 +75,10 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
|
||||
'{{#each library}}' +
|
||||
'<li class="nav-item">' +
|
||||
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
'<a class="nav-link{{#active}} active{{/active}}" ' +
|
||||
'{{#active}}aria-selected="true"{{/active}}' +
|
||||
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
|
||||
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
|
||||
' role="tab" data-toggle="tab">' +
|
||||
'{{get_string groupname ../component}}' +
|
||||
@ -85,7 +88,7 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'</ul>' +
|
||||
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
|
||||
'{{#each library}}' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
|
||||
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
|
||||
'<div role="toolbar">' +
|
||||
'{{#split "\n" elements}}' +
|
||||
@ -222,14 +225,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||
focusAfterHide: true,
|
||||
width: 600,
|
||||
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
|
||||
});
|
||||
|
||||
var content = this._getDialogueContent();
|
||||
dialogue.set('bodyContent', content);
|
||||
|
||||
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
|
||||
|
||||
dialogue.show();
|
||||
// Notify the filters about the modified nodes.
|
||||
require(['core/event'], function(event) {
|
||||
|
@ -73,7 +73,10 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'<ul class="root nav nav-tabs mb-1" role="tablist">' +
|
||||
'{{#each library}}' +
|
||||
'<li class="nav-item">' +
|
||||
'<a class="nav-link" href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
'<a class="nav-link{{#active}} active{{/active}}" ' +
|
||||
'{{#active}}aria-selected="true"{{/active}}' +
|
||||
'{{^active}}aria-selected="false" tabindex="-1"{{/active}}' +
|
||||
' href="#{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}" ' +
|
||||
' data-target="#{{../elementidescaped}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}"' +
|
||||
' role="tab" data-toggle="tab">' +
|
||||
'{{get_string groupname ../component}}' +
|
||||
@ -83,7 +86,7 @@ var COMPONENTNAME = 'atto_equation',
|
||||
'</ul>' +
|
||||
'<div class="tab-content mb-1 {{CSS.LIBRARY_GROUPS}}">' +
|
||||
'{{#each library}}' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane" ' +
|
||||
'<div data-medium-type="{{CSS.LINK}}" class="tab-pane{{#active}} active{{/active}}" ' +
|
||||
'id="{{../elementid}}_{{../CSS.LIBRARY_GROUP_PREFIX}}_{{@key}}">' +
|
||||
'<div role="toolbar">' +
|
||||
'{{#split "\n" elements}}' +
|
||||
@ -220,14 +223,12 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto.
|
||||
headerContent: M.util.get_string('pluginname', COMPONENTNAME),
|
||||
focusAfterHide: true,
|
||||
width: 600,
|
||||
focusOnShowSelector: SELECTORS.EQUATION_TEXT
|
||||
focusOnShowSelector: SELECTORS.LIBRARY_BUTTON
|
||||
});
|
||||
|
||||
var content = this._getDialogueContent();
|
||||
dialogue.set('bodyContent', content);
|
||||
|
||||
content.one('.nav-item:first-child .nav-link').getDOMNode().click();
|
||||
|
||||
dialogue.show();
|
||||
// Notify the filters about the modified nodes.
|
||||
require(['core/event'], function(event) {
|
||||
|
@ -33,7 +33,9 @@ YUI.add('moodle-atto_managefiles-button', function (Y, NAME) {
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
var LOGNAME = 'atto_managefiles';
|
||||
var LOGNAME = 'atto_managefiles',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
|
||||
FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
|
||||
|
||||
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
|
||||
@ -96,6 +98,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
|
||||
});
|
||||
iframe.setAttribute('src', this._getIframeURL());
|
||||
|
||||
// Focus on the first focusable element of the file manager after it is fully loaded.
|
||||
iframe.on('load', function(e, frame) {
|
||||
var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
|
||||
// The file manager component is loaded asynchronously after the page is loaded.
|
||||
// We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
|
||||
var intervalId = setInterval(function() {
|
||||
if (fileManager.querySelector('.fm-loaded')) {
|
||||
var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
if (firstFocusableElement) {
|
||||
firstFocusableElement.focus();
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
}, 200);
|
||||
}, this, iframe);
|
||||
|
||||
dialogue.set('bodyContent', iframe)
|
||||
.show();
|
||||
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_managefiles-button",function(a,e){a.namespace("M.atto_managefiles").Button=a.Base.create("button",a.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){if(!this.get("disabled")){var e=this.get("host"),t=this.get("area"),i=e.get("filepickeroptions");i.image&&i.image.itemid&&(t.itemid=i.image.itemid,this.set("area",t),this.addButton({icon:"e/manage_files",callback:this._displayDialogue}))}},_displayDialogue:function(e){var t,i;e.preventDefault(),t=this.getDialogue({headerContent:M.util.get_string("managefiles","atto_managefiles"),width:"800px",focusAfterHide:!0}),(i=a.Node.create("<iframe></iframe>")).setStyles({height:"700px",border:"none",width:"100%"}),i.setAttribute("src",this._getIframeURL()),t.set("bodyContent",i).show(),this.markUpdated()},_getIframeURL:function(){var e=a.mix({elementid:this.get("host").get("elementid")},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/managefiles/manage.php?"+a.QueryString.stringify(e)}},{ATTRS:{disabled:{value:!0},area:{value:{}}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
||||
YUI.add("moodle-atto_managefiles-button",function(a,e){a.namespace("M.atto_managefiles").Button=a.Base.create("button",a.M.editor_atto.EditorPlugin,[],{_currentSelection:null,initializer:function(){if(!this.get("disabled")){var e=this.get("host"),t=this.get("area"),i=e.get("filepickeroptions");i.image&&i.image.itemid&&(t.itemid=i.image.itemid,this.set("area",t),this.addButton({icon:"e/manage_files",callback:this._displayDialogue}))}},_displayDialogue:function(e){var t,i;e.preventDefault(),t=this.getDialogue({headerContent:M.util.get_string("managefiles","atto_managefiles"),width:"800px",focusAfterHide:!0}),(i=a.Node.create("<iframe></iframe>")).setStyles({height:"700px",border:"none",width:"100%"}),i.setAttribute("src",this._getIframeURL()),i.on("load",function(e,t){var i=t.getDOMNode().contentDocument.querySelector("#fitem_id_files_filemanager"),a=setInterval(function(){if(i.querySelector(".fm-loaded")){var e=i.querySelector(".fp-navbar a:not([disabled])");e&&e.focus(),clearInterval(a)}},200)},this,i),t.set("bodyContent",i).show(),this.markUpdated()},_getIframeURL:function(){var e=a.mix({elementid:this.get("host").get("elementid")},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/managefiles/manage.php?"+a.QueryString.stringify(e)}},{ATTRS:{disabled:{value:!0},area:{value:{}}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]});
|
@ -33,7 +33,9 @@ YUI.add('moodle-atto_managefiles-button', function (Y, NAME) {
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
var LOGNAME = 'atto_managefiles';
|
||||
var LOGNAME = 'atto_managefiles',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
|
||||
FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
|
||||
|
||||
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
|
||||
@ -94,6 +96,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
|
||||
});
|
||||
iframe.setAttribute('src', this._getIframeURL());
|
||||
|
||||
// Focus on the first focusable element of the file manager after it is fully loaded.
|
||||
iframe.on('load', function(e, frame) {
|
||||
var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
|
||||
// The file manager component is loaded asynchronously after the page is loaded.
|
||||
// We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
|
||||
var intervalId = setInterval(function() {
|
||||
if (fileManager.querySelector('.fm-loaded')) {
|
||||
var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
if (firstFocusableElement) {
|
||||
firstFocusableElement.focus();
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
}, 200);
|
||||
}, this, iframe);
|
||||
|
||||
dialogue.set('bodyContent', iframe)
|
||||
.show();
|
||||
|
||||
|
@ -31,7 +31,9 @@
|
||||
* @extends M.editor_atto.EditorPlugin
|
||||
*/
|
||||
|
||||
var LOGNAME = 'atto_managefiles';
|
||||
var LOGNAME = 'atto_managefiles',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = '.fp-navbar a:not([disabled])',
|
||||
FILE_MANAGER_SELECTOR = '#fitem_id_files_filemanager';
|
||||
|
||||
Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
|
||||
|
||||
@ -94,6 +96,22 @@ Y.namespace('M.atto_managefiles').Button = Y.Base.create('button', Y.M.editor_at
|
||||
});
|
||||
iframe.setAttribute('src', this._getIframeURL());
|
||||
|
||||
// Focus on the first focusable element of the file manager after it is fully loaded.
|
||||
iframe.on('load', function(e, frame) {
|
||||
var fileManager = frame.getDOMNode().contentDocument.querySelector(FILE_MANAGER_SELECTOR);
|
||||
// The file manager component is loaded asynchronously after the page is loaded.
|
||||
// We check for the presence of .fm-loaded every 200 ms to determine if the file manager is loaded yet.
|
||||
var intervalId = setInterval(function() {
|
||||
if (fileManager.querySelector('.fm-loaded')) {
|
||||
var firstFocusableElement = fileManager.querySelector(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
if (firstFocusableElement) {
|
||||
firstFocusableElement.focus();
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
}, 200);
|
||||
}, this, iframe);
|
||||
|
||||
dialogue.set('bodyContent', iframe)
|
||||
.show();
|
||||
|
||||
|
@ -184,7 +184,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -201,7 +203,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -249,7 +253,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -262,7 +268,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue();t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",a="btn btn-lg btn-outline-danger btn-block",d=s.Handlebars.compile('<div class="{{PLUGINNAME}} container-fluid"><div class="{{bs_row}} hide"><div class="{{bs_col}}12"><div id="alert-danger" class="alert {{bs_al_dang}}"><strong>{{insecurealert_title}}</strong> {{insecurealert}}</div></div></div><div class="{{bs_row}} hide">{{#if isAudio}}<div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><audio id="player"></audio></div><div class="{{bs_col}}1"></div>{{else}}<div class="{{bs_col}}12"><video id="player"></video></div>{{/if}}</div><div class="{{bs_row}}"><div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><button id="start-stop" class="{{bs_ss_btn}}">{{startrecording}}</button></div><div class="{{bs_col}}1"></div></div><div class="{{bs_row}} hide"><div class="{{bs_col}}3"></div><div class="{{bs_col}}6"><button id="upload" class="btn btn-primary btn-block">{{attachrecording}}</button></div><div class="{{bs_col}}3"></div></div></div>')({PLUGINNAME:n,isAudio:e,bs_row:i,bs_col:o,bs_al_dang:r,bs_ss_btn:a,insecurealert_title:M.util.get_string("insecurealert_title","atto_recordrtc"),insecurealert:M.util.get_string("insecurealert","atto_recordrtc"),startrecording:M.util.get_string("startrecording","atto_recordrtc"),attachrecording:M.util.get_string("attachrecording","atto_recordrtc")});return d},closeDialogue:function(t){t.getDialogue().hide(),t.editor.focus()},setLink:function(t,e){t.getDialogue().hide(),t.editor.focus(),t.get("host").insertContentAtFocusPoint(e),t.markUpdated()}},{ATTRS:{contextid:{value:null},sesskey:{value:null},allowedtypes:{value:null},audiobitrate:{value:null},videobitrate:{value:null},timelimit:{value:null},audiortcicon:{value:null},videortcicon:{value:null},maxrecsize:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-atto_recordrtc-recording"]});
|
||||
YUI.add("moodle-atto_recordrtc-button",function(s,t){var n="atto_recordrtc";s.namespace("M.atto_recordrtc").Button=s.Base.create("button",s.M.editor_atto.EditorPlugin,[],{_lang:"en",initializer:function(){var t,e,i;if(this.get("host").canShowFilepicker("media")){if(e=!1,"both"!==(t=this.get("allowedtypes"))&&"audio"!==t||(this._addButton("audio",this._audio),e=!0),"both"!==t&&"video"!==t||(this._addButton("video",this._video),e=!0),!e)return;(i=this.getDialogue({width:1e3,focusAfterHide:null})).after("visibleChange",function(){var t=!i.get("visible"),e=M.atto_recordrtc.commonmodule;t&&(window.clearInterval(e.countdownTicker),e.mediaRecorder&&"inactive"!==e.mediaRecorder.state&&e.mediaRecorder.stop(),e.stream&&e.stream.getTracks().forEach(function(t){"ended"!==t.readyState&&t.stop()}),this.getDialogue().set("bodyContent",""))},this),i.on("click",function(){this.centered()}),window.require(["core/adapter"],function(t){window.adapter=t})}},_addButton:function(t,e){this.addButton({buttonName:t,icon:this.get(t+"rtcicon"),iconComponent:n,callback:e,title:t+"rtc",tags:t+"rtc",tagMatchRequiresAll:!1})},_audio:function(){var t=this.getDialogue({focusAfterHide:"audio"});t.set("headerContent",M.util.get_string("audiortc","atto_recordrtc")),t.set("bodyContent",this._createContent("audio")),t.show(),M.atto_recordrtc.audiomodule.init(this)},_video:function(){var t=this.getDialogue({focusAfterHide:"video"});t.set("headerContent",M.util.get_string("videortc","atto_recordrtc")),t.set("bodyContent",this._createContent("video")),t.show(),M.atto_recordrtc.videomodule.init(this)},_createContent:function(t){var e="audio"===t,i="row",o="col-",r="alert-danger",d="btn btn-lg btn-outline-danger btn-block",a=s.Handlebars.compile('<div class="{{PLUGINNAME}} container-fluid"><div class="{{bs_row}} hide"><div class="{{bs_col}}12"><div id="alert-danger" class="alert {{bs_al_dang}}"><strong>{{insecurealert_title}}</strong> {{insecurealert}}</div></div></div><div class="{{bs_row}} hide">{{#if isAudio}}<div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><audio id="player"></audio></div><div class="{{bs_col}}1"></div>{{else}}<div class="{{bs_col}}12"><video id="player"></video></div>{{/if}}</div><div class="{{bs_row}}"><div class="{{bs_col}}1"></div><div class="{{bs_col}}10"><button id="start-stop" class="{{bs_ss_btn}}">{{startrecording}}</button></div><div class="{{bs_col}}1"></div></div><div class="{{bs_row}} hide"><div class="{{bs_col}}3"></div><div class="{{bs_col}}6"><button id="upload" class="btn btn-primary btn-block">{{attachrecording}}</button></div><div class="{{bs_col}}3"></div></div></div>')({PLUGINNAME:n,isAudio:e,bs_row:i,bs_col:o,bs_al_dang:r,bs_ss_btn:d,insecurealert_title:M.util.get_string("insecurealert_title","atto_recordrtc"),insecurealert:M.util.get_string("insecurealert","atto_recordrtc"),startrecording:M.util.get_string("startrecording","atto_recordrtc"),attachrecording:M.util.get_string("attachrecording","atto_recordrtc")});return a},closeDialogue:function(t){t.getDialogue().hide({focusAfterHide:null}),t.editor.focus()},setLink:function(t,e){t.getDialogue().hide({focusAfterHide:null}),t.editor.focus(),t.get("host").insertContentAtFocusPoint(e),t.markUpdated()}},{ATTRS:{contextid:{value:null},sesskey:{value:null},allowedtypes:{value:null},audiobitrate:{value:null},videobitrate:{value:null},timelimit:{value:null},audiortcicon:{value:null},videortcicon:{value:null},maxrecsize:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-atto_recordrtc-recording"]});
|
@ -184,7 +184,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -201,7 +203,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -249,7 +253,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -262,7 +268,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
@ -182,7 +182,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_audio: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'audio'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('audiortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('audio'));
|
||||
@ -199,7 +201,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @private
|
||||
*/
|
||||
_video: function() {
|
||||
var dialogue = this.getDialogue();
|
||||
var dialogue = this.getDialogue({
|
||||
focusAfterHide: 'video'
|
||||
});
|
||||
|
||||
dialogue.set('headerContent', M.util.get_string('videortc', 'atto_recordrtc'));
|
||||
dialogue.set('bodyContent', this._createContent('video'));
|
||||
@ -247,7 +251,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {Object} scope The "this" context of the editor.
|
||||
*/
|
||||
closeDialogue: function(scope) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
},
|
||||
@ -260,7 +266,9 @@ Y.namespace('M.atto_recordrtc').Button = Y.Base.create('button', Y.M.editor_atto
|
||||
* @param {string} annotation The HTML link to the recording.
|
||||
*/
|
||||
setLink: function(scope, annotation) {
|
||||
scope.getDialogue().hide();
|
||||
scope.getDialogue().hide({
|
||||
focusAfterHide: null
|
||||
});
|
||||
|
||||
scope.editor.focus();
|
||||
scope.get('host').insertContentAtFocusPoint(annotation);
|
||||
|
@ -61,8 +61,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-core-notification-ajaxexception",function(d,e){var t,i;M.core=M.core||{},t="Moodle AJAX exception",i=function(e){e.name=e.name||M.util.get_string("error","moodle"),e.closeButton=!0,i.superclass.constructor.apply(this,[e])},d.extend(i,M.core.notification.info,{_keypress:null,initializer:function(e){var t,i=this,o=this.get("hideTimeoutDelay"),a=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(d.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+d.Escape.html(e.name)+"</h1>",d.WidgetStdMod.REPLACE),t=d.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>').append(d.Node.create('<div class="moodle-exception-message">'+d.Escape.html(this.get("error"))+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>'+M.util.get_string("url","moodle")+a+"</label> "+this.get("reproductionlink")+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>'+M.util.get_string("debuginfo","debug")+a+"</label> "+d.Escape.html(this.get("debuginfo"))+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>'+M.util.get_string("stacktrace","debug")+a+"</label> <pre>"+d.Escape.html(this.get("stacktrace"))+"</pre></div>")),M.cfg.developerdebug&&t.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(d.WidgetStdMod.BODY,t,d.WidgetStdMod.REPLACE),o&&(this._hideTimeout=setTimeout(function(){i.hide()},o)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=d.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){var t=this;this._keypress.detach(),setTimeout(function(){t.destroy()},1e3)}}},{NAME:t,CSS_PREFIX:"moodle-dialogue",ATTRS:{error:{validator:d.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(e){return null!==e&&(e='<a href="'+(e=d.Escape.html(e))+'">'+e.replace(M.cfg.wwwroot,"")+"</a>"),e},value:null},hideTimeoutDelay:{validator:d.Lang.isNumber,value:null}}}),M.core.ajaxException=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
||||
YUI.add("moodle-core-notification-ajaxexception",function(d,e){var t,i;M.core=M.core||{},t="Moodle AJAX exception",i=function(e){e.name=e.name||M.util.get_string("error","moodle"),e.closeButton=!0,i.superclass.constructor.apply(this,[e])},d.extend(i,M.core.notification.info,{_keypress:null,initializer:function(e){var t,i=this,o=this.get("hideTimeoutDelay"),a=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(d.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+d.Escape.html(e.name)+"</h5>",d.WidgetStdMod.REPLACE),t=d.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>').append(d.Node.create('<div class="moodle-exception-message">'+d.Escape.html(this.get("error"))+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>'+M.util.get_string("url","moodle")+a+"</label> "+this.get("reproductionlink")+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>'+M.util.get_string("debuginfo","debug")+a+"</label> "+d.Escape.html(this.get("debuginfo"))+"</div>")).append(d.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>'+M.util.get_string("stacktrace","debug")+a+"</label> <pre>"+d.Escape.html(this.get("stacktrace"))+"</pre></div>")),M.cfg.developerdebug&&t.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(d.WidgetStdMod.BODY,t,d.WidgetStdMod.REPLACE),o&&(this._hideTimeout=setTimeout(function(){i.hide()},o)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=d.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){var t=this;this._keypress.detach(),setTimeout(function(){t.destroy()},1e3)}}},{NAME:t,CSS_PREFIX:"moodle-dialogue",ATTRS:{error:{validator:d.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(e){return null!==e&&(e='<a href="'+(e=d.Escape.html(e))+'">'+e.replace(M.cfg.wwwroot,"")+"</a>"),e},value:null},hideTimeoutDelay:{validator:d.Lang.isNumber,value:null}}}),M.core.ajaxException=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
@ -61,8 +61,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
|
||||
|
@ -71,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-core-notification-alert",function(o,t){var e,i;M.core=M.core||{},e="Moodle alert",i=function(t){t.closeButton=!1,i.superclass.constructor.apply(this,[t])},o.extend(i,M.core.notification.info,{_closeEvents:null,initializer:function(){var t,e,i;this._closeEvents=[],this.publish("complete"),t=o.Node.create('<input type="button" class="btn btn-primary" id="id_yuialertconfirm-'+this.get("COUNT")+'"value="'+this.get("yesLabel")+'" />'),e=o.Node.create('<div class="confirmation-dialogue"></div>').append(o.Node.create('<div class="confirmation-message">'+this.get("message")+"</div>")).append(o.Node.create('<div class="confirmation-buttons text-xs-right"></div>').append(t)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(o.WidgetStdMod.BODY,e,o.WidgetStdMod.REPLACE),this.setStdModContent(o.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+this.get("title")+"</h1>",o.WidgetStdMod.REPLACE),this._closeEvents.push(o.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this)),(i=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(i.on("click",this.submit,this))},submit:function(){new o.EventHandle(this._closeEvents).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{title:{validator:o.Lang.isString,value:"Alert"},message:{validator:o.Lang.isString,value:"Confirm"},yesLabel:{validator:o.Lang.isString,setter:function(t){return t=t||"OK"},value:"OK"}}}),M.core.alert=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
||||
YUI.add("moodle-core-notification-alert",function(o,t){var e,i;M.core=M.core||{},e="Moodle alert",i=function(t){t.closeButton=!1,i.superclass.constructor.apply(this,[t])},o.extend(i,M.core.notification.info,{_closeEvents:null,initializer:function(){var t,e,i;this._closeEvents=[],this.publish("complete"),t=o.Node.create('<input type="button" class="btn btn-primary" id="id_yuialertconfirm-'+this.get("COUNT")+'"value="'+this.get("yesLabel")+'" />'),e=o.Node.create('<div class="confirmation-dialogue"></div>').append(o.Node.create('<div class="confirmation-message">'+this.get("message")+"</div>")).append(o.Node.create('<div class="confirmation-buttons text-xs-right"></div>').append(t)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(o.WidgetStdMod.BODY,e,o.WidgetStdMod.REPLACE),this.setStdModContent(o.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+this.get("title")+"</h5>",o.WidgetStdMod.REPLACE),this._closeEvents.push(o.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this)),(i=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(i.on("click",this.submit,this))},submit:function(){new o.EventHandle(this._closeEvents).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{title:{validator:o.Lang.isString,value:"Alert"},message:{validator:o.Lang.isString,value:"Confirm"},yesLabel:{validator:o.Lang.isString,setter:function(t){return t=t||"OK"},value:"OK"}}}),M.core.alert=i},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
@ -71,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
@ -104,7 +104,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-core-notification-confirm",function(i,t){var e,o;M.core=M.core||{},e="Moodle confirmation dialogue",o=function(t){o.superclass.constructor.apply(this,[t])},i.extend(o,M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){var t,e;this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=i.Node.create('<input type="button" class="btn btn-primary" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get("yesLabel")+'" />'),this._noButton=i.Node.create('<input type="button" class="btn btn-secondary" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get("noLabel")+'" />'),this._question=i.Node.create('<div class="confirmation-message">'+this.get("question")+"</div>"),t=i.Node.create('<div class="confirmation-dialogue"></div>').append(this._question).append(i.Node.create('<div class="confirmation-buttons form-inline justify-content-around"></div>').append(this._yesButton).append(this._noButton)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(i.WidgetStdMod.BODY,t,i.WidgetStdMod.REPLACE),this.setStdModContent(i.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+this.get("title")+"</h1>",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1)),(e=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(e.on("click",this.submit,this))},submit:function(t,e){new i.EventHandle(this._closeEvents).detach(),this.fire("complete",e),e?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{yesLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(t){return this._yesButton&&this._yesButton.set("value",t),t}},noLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(t){return this._noButton&&this._noButton.set("value",t),t}},title:{validator:i.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(t){return this._question&&this._question.set("value",t),t}}}}),i.augment(o,i.EventTarget),M.core.confirm=o},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
||||
YUI.add("moodle-core-notification-confirm",function(i,t){var e,o;M.core=M.core||{},e="Moodle confirmation dialogue",o=function(t){o.superclass.constructor.apply(this,[t])},i.extend(o,M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){var t,e;this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=i.Node.create('<input type="button" class="btn btn-primary" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get("yesLabel")+'" />'),this._noButton=i.Node.create('<input type="button" class="btn btn-secondary" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get("noLabel")+'" />'),this._question=i.Node.create('<div class="confirmation-message">'+this.get("question")+"</div>"),t=i.Node.create('<div class="confirmation-dialogue"></div>').append(this._question).append(i.Node.create('<div class="confirmation-buttons form-inline justify-content-around"></div>').append(this._yesButton).append(this._noButton)),this.get("notificationBase").addClass("moodle-dialogue-confirm"),this.setStdModContent(i.WidgetStdMod.BODY,t,i.WidgetStdMod.REPLACE),this.setStdModContent(i.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+this.get("title")+"</h5>",i.WidgetStdMod.REPLACE),this._closeEvents.push(i.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1)),(e=this.get("boundingBox").one(".closebutton"))&&this._closeEvents.push(e.on("click",this.submit,this))},submit:function(t,e){new i.EventHandle(this._closeEvents).detach(),this.fire("complete",e),e?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:e,CSS_PREFIX:"moodle-dialogue",ATTRS:{yesLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(t){return this._yesButton&&this._yesButton.set("value",t),t}},noLabel:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(t){return this._noButton&&this._noButton.set("value",t),t}},title:{validator:i.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:i.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(t){return this._question&&this._question.set("value",t),t}}}}),i.augment(o,i.EventTarget),M.core.confirm=o},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
@ -104,7 +104,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
@ -43,7 +43,12 @@ var DIALOGUE_NAME = 'Moodle dialogue',
|
||||
MENUBAR_SELECTOR = '[role=menubar]',
|
||||
DOT = '.',
|
||||
HAS_ZINDEX = 'moodle-has-zindex',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]):not([disabled]):not([tabindex^="-"]),' +
|
||||
'a[href]:not([disabled]):not([tabindex^="-"]),' +
|
||||
'button:not([disabled]):not([tabindex^="-"]),' +
|
||||
'textarea:not([disabled]):not([tabindex^="-"]),' +
|
||||
'select:not([disabled]):not([tabindex^="-"]),' +
|
||||
'[tabindex]:not([disabled]):not([tabindex^="-"])',
|
||||
FORM_SELECTOR = 'form';
|
||||
|
||||
/**
|
||||
@ -68,7 +73,7 @@ DIALOGUE = function(config) {
|
||||
'<div id="' + id + '" role="dialog" ' +
|
||||
'aria-labelledby="' + id + '-header-text" class="' + CSS_CLASSES.WRAP + '" aria-live="polite"></div>'
|
||||
)
|
||||
.append(Y.Node.create('<div id="' + id + '-header-text" class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.BODY + ' yui3-widget-bd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.FOOTER + ' yui3-widget-ft"></div>')));
|
||||
Y.one(document.body).append(config.notificationBase);
|
||||
@ -133,6 +138,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
this.get('buttons').header[0].setAttribute('aria-label', title);
|
||||
}
|
||||
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h5 id="' + this.get('id') + '-wrap-header-text">' + this.get('headerContent') + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
// Initialise the element cache.
|
||||
this._hiddenSiblings = [];
|
||||
|
||||
@ -316,10 +325,6 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Y.one(titlebar).setStyle('cursor', 'move');
|
||||
}
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
}.bind(this));
|
||||
|
||||
// Only do accessibility hiding for modals because the ARIA spec
|
||||
// says that all ARIA dialogues should be modal.
|
||||
@ -410,9 +415,12 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
|
||||
},
|
||||
|
||||
_focus: function() {
|
||||
this.focus();
|
||||
},
|
||||
|
||||
show: function() {
|
||||
var result = null,
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode,
|
||||
focusSelector = this.get('focusOnShowSelector'),
|
||||
focusNode = null;
|
||||
@ -429,16 +437,18 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
focusNode = this.get('boundingBox').one(focusSelector);
|
||||
}
|
||||
if (!focusNode) {
|
||||
// Fall back to the header or the content if no focus node was found yet.
|
||||
if (header && header !== '') {
|
||||
focusNode = header;
|
||||
} else if (content && content !== '') {
|
||||
focusNode = content;
|
||||
// Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
|
||||
if (content && content !== '') {
|
||||
focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
}
|
||||
}
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
}.bind(this));
|
||||
return result;
|
||||
},
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -43,7 +43,12 @@ var DIALOGUE_NAME = 'Moodle dialogue',
|
||||
MENUBAR_SELECTOR = '[role=menubar]',
|
||||
DOT = '.',
|
||||
HAS_ZINDEX = 'moodle-has-zindex',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]):not([disabled]):not([tabindex^="-"]),' +
|
||||
'a[href]:not([disabled]):not([tabindex^="-"]),' +
|
||||
'button:not([disabled]):not([tabindex^="-"]),' +
|
||||
'textarea:not([disabled]):not([tabindex^="-"]),' +
|
||||
'select:not([disabled]):not([tabindex^="-"]),' +
|
||||
'[tabindex]:not([disabled]):not([tabindex^="-"])',
|
||||
FORM_SELECTOR = 'form';
|
||||
|
||||
/**
|
||||
@ -68,7 +73,7 @@ DIALOGUE = function(config) {
|
||||
'<div id="' + id + '" role="dialog" ' +
|
||||
'aria-labelledby="' + id + '-header-text" class="' + CSS_CLASSES.WRAP + '" aria-live="polite"></div>'
|
||||
)
|
||||
.append(Y.Node.create('<div id="' + id + '-header-text" class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.BODY + ' yui3-widget-bd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.FOOTER + ' yui3-widget-ft"></div>')));
|
||||
Y.one(document.body).append(config.notificationBase);
|
||||
@ -133,6 +138,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
this.get('buttons').header[0].setAttribute('aria-label', title);
|
||||
}
|
||||
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h5 id="' + this.get('id') + '-wrap-header-text">' + this.get('headerContent') + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
// Initialise the element cache.
|
||||
this._hiddenSiblings = [];
|
||||
|
||||
@ -316,10 +325,6 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Y.one(titlebar).setStyle('cursor', 'move');
|
||||
}
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
}.bind(this));
|
||||
|
||||
// Only do accessibility hiding for modals because the ARIA spec
|
||||
// says that all ARIA dialogues should be modal.
|
||||
@ -410,9 +415,12 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
|
||||
},
|
||||
|
||||
_focus: function() {
|
||||
this.focus();
|
||||
},
|
||||
|
||||
show: function() {
|
||||
var result = null,
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode,
|
||||
focusSelector = this.get('focusOnShowSelector'),
|
||||
focusNode = null;
|
||||
@ -429,16 +437,18 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
focusNode = this.get('boundingBox').one(focusSelector);
|
||||
}
|
||||
if (!focusNode) {
|
||||
// Fall back to the header or the content if no focus node was found yet.
|
||||
if (header && header !== '') {
|
||||
focusNode = header;
|
||||
} else if (content && content !== '') {
|
||||
focusNode = content;
|
||||
// Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
|
||||
if (content && content !== '') {
|
||||
focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
}
|
||||
}
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
}.bind(this));
|
||||
return result;
|
||||
},
|
||||
|
||||
|
@ -77,7 +77,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + config.COUNT + '-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('message')) + '</div>'))
|
||||
|
@ -1 +1 @@
|
||||
YUI.add("moodle-core-notification-exception",function(l,e){var i,a;M.core=M.core||{},i="Moodle exception",a=function(i){var e,t=l.mix({},i);t.width=t.width||M.cfg.developerdebug?Math.floor(l.one(document.body).get("winWidth")/3)+"px":null,t.closeButton=!0,e=["message","name","fileName","lineNumber","stack"],l.Array.each(e,function(e){t[e]=i[e]}),a.superclass.constructor.apply(this,[t])},l.extend(a,M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(e){var i,t=this,a=this.get("hideTimeoutDelay"),o=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(l.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+e.COUNT+'-header-text">'+l.Escape.html(e.name)+"</h1>",l.WidgetStdMod.REPLACE),i=l.Node.create('<div class="moodle-exception" data-rel="fatalerror"></div>').append(l.Node.create('<div class="moodle-exception-message">'+l.Escape.html(this.get("message"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-filename"><label>'+M.util.get_string("file","moodle")+o+"</label> "+l.Escape.html(this.get("fileName"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>'+M.util.get_string("line","debug")+o+"</label> "+l.Escape.html(this.get("lineNumber"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>'+M.util.get_string("stacktrace","debug")+o+"</label> <pre>"+this.get("stack")+"</pre></div>")),M.cfg.developerdebug&&i.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(l.WidgetStdMod.BODY,i,l.WidgetStdMod.REPLACE),a&&(this._hideTimeout=setTimeout(function(){t.hide()},a)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=l.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){this._keypress&&this._keypress.detach();var i=this;setTimeout(function(){i.destroy()},1e3)}}},{NAME:i,CSS_PREFIX:"moodle-dialogue",ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(e){var i,t=l.Escape.html(e).split("\n"),a=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$");for(i in t)t[i]=t[i].replace(a,"<div class='stacktrace-line'>ln: $4</div><div class='stacktrace-file'>$3</div><div class='stacktrace-call'>$1</div>");return t.join("\n")},value:""},hideTimeoutDelay:{validator:l.Lang.isNumber,value:null}}}),M.core.exception=a},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
||||
YUI.add("moodle-core-notification-exception",function(l,e){var i,a;M.core=M.core||{},i="Moodle exception",a=function(i){var e,t=l.mix({},i);t.width=t.width||M.cfg.developerdebug?Math.floor(l.one(document.body).get("winWidth")/3)+"px":null,t.closeButton=!0,e=["message","name","fileName","lineNumber","stack"],l.Array.each(e,function(e){t[e]=i[e]}),a.superclass.constructor.apply(this,[t])},l.extend(a,M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(e){var i,t=this,a=this.get("hideTimeoutDelay"),o=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(l.WidgetStdMod.HEADER,'<h5 id="moodle-dialogue-'+this.get("COUNT")+'-wrap-header-text">'+l.Escape.html(e.name)+"</h5>",l.WidgetStdMod.REPLACE),i=l.Node.create('<div class="moodle-exception" data-rel="fatalerror"></div>').append(l.Node.create('<div class="moodle-exception-message">'+l.Escape.html(this.get("message"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-filename"><label>'+M.util.get_string("file","moodle")+o+"</label> "+l.Escape.html(this.get("fileName"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>'+M.util.get_string("line","debug")+o+"</label> "+l.Escape.html(this.get("lineNumber"))+"</div>")).append(l.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>'+M.util.get_string("stacktrace","debug")+o+"</label> <pre>"+this.get("stack")+"</pre></div>")),M.cfg.developerdebug&&i.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(l.WidgetStdMod.BODY,i,l.WidgetStdMod.REPLACE),a&&(this._hideTimeout=setTimeout(function(){t.hide()},a)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=l.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},visibilityChanged:function(e){if("visible"===e.attrName&&e.prevVal&&!e.newVal){this._keypress&&this._keypress.detach();var i=this;setTimeout(function(){i.destroy()},1e3)}}},{NAME:i,CSS_PREFIX:"moodle-dialogue",ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(e){var i,t=l.Escape.html(e).split("\n"),a=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$");for(i in t)t[i]=t[i].replace(a,"<div class='stacktrace-line'>ln: $4</div><div class='stacktrace-file'>$3</div><div class='stacktrace-call'>$1</div>");return t.join("\n")},value:""},hideTimeoutDelay:{validator:l.Lang.isNumber,value:null}}}),M.core.exception=a},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
|
@ -77,7 +77,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + config.COUNT + '-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('message')) + '</div>'))
|
||||
|
4
lib/yui/src/notification/js/ajaxexception.js
vendored
4
lib/yui/src/notification/js/ajaxexception.js
vendored
@ -31,8 +31,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">'
|
||||
+ Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('error')) + '</div>'))
|
||||
|
2
lib/yui/src/notification/js/alert.js
vendored
2
lib/yui/src/notification/js/alert.js
vendored
@ -41,7 +41,7 @@ Y.extend(ALERT, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
2
lib/yui/src/notification/js/confirm.js
vendored
2
lib/yui/src/notification/js/confirm.js
vendored
@ -74,7 +74,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
|
||||
this.get(BASE).addClass('moodle-dialogue-confirm');
|
||||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + this.get('COUNT') + '-header-text">' + this.get(TITLE) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + this.get(TITLE) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
this._closeEvents.push(
|
||||
|
40
lib/yui/src/notification/js/dialogue.js
vendored
40
lib/yui/src/notification/js/dialogue.js
vendored
@ -13,7 +13,12 @@ var DIALOGUE_NAME = 'Moodle dialogue',
|
||||
MENUBAR_SELECTOR = '[role=menubar]',
|
||||
DOT = '.',
|
||||
HAS_ZINDEX = 'moodle-has-zindex',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',
|
||||
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]):not([disabled]):not([tabindex^="-"]),' +
|
||||
'a[href]:not([disabled]):not([tabindex^="-"]),' +
|
||||
'button:not([disabled]):not([tabindex^="-"]),' +
|
||||
'textarea:not([disabled]):not([tabindex^="-"]),' +
|
||||
'select:not([disabled]):not([tabindex^="-"]),' +
|
||||
'[tabindex]:not([disabled]):not([tabindex^="-"])',
|
||||
FORM_SELECTOR = 'form';
|
||||
|
||||
/**
|
||||
@ -38,7 +43,7 @@ DIALOGUE = function(config) {
|
||||
'<div id="' + id + '" role="dialog" ' +
|
||||
'aria-labelledby="' + id + '-header-text" class="' + CSS_CLASSES.WRAP + '" aria-live="polite"></div>'
|
||||
)
|
||||
.append(Y.Node.create('<div id="' + id + '-header-text" class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.HEADER + ' yui3-widget-hd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.BODY + ' yui3-widget-bd"></div>'))
|
||||
.append(Y.Node.create('<div class="' + CSS_CLASSES.FOOTER + ' yui3-widget-ft"></div>')));
|
||||
Y.one(document.body).append(config.notificationBase);
|
||||
@ -103,6 +108,10 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
this.get('buttons').header[0].setAttribute('aria-label', title);
|
||||
}
|
||||
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h5 id="' + this.get('id') + '-wrap-header-text">' + this.get('headerContent') + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
|
||||
// Initialise the element cache.
|
||||
this._hiddenSiblings = [];
|
||||
|
||||
@ -286,10 +295,6 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Y.one(titlebar).setStyle('cursor', 'move');
|
||||
}
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
}.bind(this));
|
||||
|
||||
// Only do accessibility hiding for modals because the ARIA spec
|
||||
// says that all ARIA dialogues should be modal.
|
||||
@ -380,9 +385,12 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
Math.floor(Y.one(document.body).get('winWidth')) < this.get('responsiveWidth');
|
||||
},
|
||||
|
||||
_focus: function() {
|
||||
this.focus();
|
||||
},
|
||||
|
||||
show: function() {
|
||||
var result = null,
|
||||
header = this.headerNode,
|
||||
content = this.bodyNode,
|
||||
focusSelector = this.get('focusOnShowSelector'),
|
||||
focusNode = null;
|
||||
@ -399,16 +407,18 @@ Y.extend(DIALOGUE, Y.Panel, {
|
||||
focusNode = this.get('boundingBox').one(focusSelector);
|
||||
}
|
||||
if (!focusNode) {
|
||||
// Fall back to the header or the content if no focus node was found yet.
|
||||
if (header && header !== '') {
|
||||
focusNode = header;
|
||||
} else if (content && content !== '') {
|
||||
focusNode = content;
|
||||
// Fall back to the first focusable element in the body of the dialogue if no focus node was found yet.
|
||||
if (content && content !== '') {
|
||||
focusNode = content.one(CAN_RECEIVE_FOCUS_SELECTOR);
|
||||
}
|
||||
}
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
require(['core/local/aria/focuslock'], function(FocusLockManager) {
|
||||
// Trap focus to the current bounding box.
|
||||
FocusLockManager.trapFocus(this.get('boundingBox').getDOMNode());
|
||||
if (focusNode) {
|
||||
focusNode.focus();
|
||||
}
|
||||
}.bind(this));
|
||||
return result;
|
||||
},
|
||||
|
||||
|
2
lib/yui/src/notification/js/exception.js
vendored
2
lib/yui/src/notification/js/exception.js
vendored
@ -47,7 +47,7 @@ Y.extend(EXCEPTION, M.core.notification.info, {
|
||||
labelsep = M.util.get_string('labelsep', 'langconfig');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-' + config.COUNT + '-header-text">' + Y.Escape.html(config.name) + '</h1>',
|
||||
'<h5 id="moodle-dialogue-' + this.get('COUNT') + '-wrap-header-text">' + Y.Escape.html(config.name) + '</h5>',
|
||||
Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception" data-rel="fatalerror"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">' + Y.Escape.html(this.get('message')) + '</div>'))
|
||||
|
@ -1284,8 +1284,11 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h1 {
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h5 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: $font-weight-base;
|
||||
margin-bottom: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd .yui3-widget-buttons {
|
||||
|
@ -10731,8 +10731,11 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
|
||||
font-size: 1.5rem;
|
||||
line-height: 1.5; }
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h1 {
|
||||
font-size: 1.5rem; }
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h5 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 400;
|
||||
margin-bottom: 0;
|
||||
line-height: 1.5; }
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd .yui3-widget-buttons {
|
||||
/*rtl:raw:
|
||||
|
@ -10943,8 +10943,11 @@ body#page-lib-editor-tinymce-plugins-moodlemedia-preview {
|
||||
font-size: 1.5rem;
|
||||
line-height: 1.5; }
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h1 {
|
||||
font-size: 1.5rem; }
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h5 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 400;
|
||||
margin-bottom: 0;
|
||||
line-height: 1.5; }
|
||||
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd .yui3-widget-buttons {
|
||||
/*rtl:raw:
|
||||
|
Loading…
x
Reference in New Issue
Block a user