Skip to content

Commit

Permalink
MDL-42407 Filepicker: generate a smarter zIndex for the filepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnfwlr committed Oct 29, 2013
1 parent 68291f2 commit 1389bcd
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions lib/editor/tinymce/readme_moodle.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Upgrade procedure:
4/ update ./thirdpartylibs.xml
5/ execute cli/update_lang_files.php and review changes in lang/en/editor_tinymce.php
6/ use search/replace to fix oversized zIndexes
7/ add moodle-has-zindex to the class definition in createColorSplitButton() in tiny_mce_src.js and tiny_mce.js


Changes:
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/tinymce/tiny_mce/3.5.8/tiny_mce.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/editor/tinymce/tiny_mce/3.5.8/tiny_mce_src.js
Original file line number Diff line number Diff line change
Expand Up @@ -16188,7 +16188,7 @@ tinymce.ForceBlocks = function(editor) {

s = extend({
title : s.title,
'class' : 'mce_' + id,
'class' : 'moodle-has-zindex mce_' + id,
'menu_class' : ed.getParam('skin') + 'Skin',
scope : s.scope,
more_colors_title : ed.getLang('more_colors')
Expand Down
2 changes: 2 additions & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ information provided here is intended especially for developers.
of 'fopen' to read gzip-compressed files if required.
* update_internal_user_password() and setnew_password_and_mail() now trigger user_updated event.
* Add thirdpartylibs.xml file to plugins that bundle any 3rd party libraries.
* New class introduced to help auto generate zIndex values for modals - "moodle-has-zindex" can be given as a
class for any element that needs it's zIndex to be considered when creating a modal dialogue.

DEPRECATIONS:
Various previously deprecated functions have now been altered to throw DEBUG_DEVELOPER debugging notices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
DIALOGUE_HIDDEN_CLASS = DIALOGUE_PREFIX + '-hidden',
DIALOGUE_SELECTOR =' [role=dialog]',
MENUBAR_SELECTOR = '[role=menubar]',
HAS_ZINDEX = '.moodle-has-zindex',
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]';

/**
Expand Down Expand Up @@ -110,7 +111,7 @@ Y.extend(DIALOGUE, Y.Panel, {
_resizeevent : null,
// Orientation change event listener.
_orientationevent : null,

_calculatedzindex : false,
/**
* Initialise the dialogue.
*
Expand Down Expand Up @@ -138,6 +139,8 @@ Y.extend(DIALOGUE, Y.Panel, {
if (config.visible) {
this.applyZIndex();
}
// Recalculate the zIndex every time the modal is altered.
this.on('maskShow', this.applyZIndex);
// We must show - after the dialogue has been positioned,
// either by centerDialogue or makeResonsive. This is because the show() will trigger
// a focus on the dialogue, which will scroll the page. If the dialogue has not
Expand All @@ -156,24 +159,28 @@ Y.extend(DIALOGUE, Y.Panel, {
* @return void
*/
applyZIndex : function() {
var highestzindex = 0,
var highestzindex = 1,
zindexvalue = 1,
bb = this.get('boundingBox'),
ol = this.get('maskNode'),
zindex = this.get('zIndex');
if (zindex) {
if (zindex !== 0 && !this._calculatedzindex) {
// The zindex was specified so we should use that.
bb.setStyle('zIndex', zindex);
} else {
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR).each(function (node) {
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR+', '+HAS_ZINDEX).each(function (node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
if (highestzindex > 0) {
bb.setStyle('zIndex', (highestzindex + 1).toString());
}
zindexvalue = (highestzindex + 1).toString();
bb.setStyle('zIndex', zindexvalue);
ol.setStyle('zIndex', zindexvalue);
this.set('zIndex', zindexvalue);
this._calculatedzindex = true;
}
},

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
DIALOGUE_HIDDEN_CLASS = DIALOGUE_PREFIX + '-hidden',
DIALOGUE_SELECTOR =' [role=dialog]',
MENUBAR_SELECTOR = '[role=menubar]',
HAS_ZINDEX = '.moodle-has-zindex',
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]';

/**
Expand Down Expand Up @@ -110,7 +111,7 @@ Y.extend(DIALOGUE, Y.Panel, {
_resizeevent : null,
// Orientation change event listener.
_orientationevent : null,

_calculatedzindex : false,
/**
* Initialise the dialogue.
*
Expand Down Expand Up @@ -138,6 +139,8 @@ Y.extend(DIALOGUE, Y.Panel, {
if (config.visible) {
this.applyZIndex();
}
// Recalculate the zIndex every time the modal is altered.
this.on('maskShow', this.applyZIndex);
// We must show - after the dialogue has been positioned,
// either by centerDialogue or makeResonsive. This is because the show() will trigger
// a focus on the dialogue, which will scroll the page. If the dialogue has not
Expand All @@ -156,24 +159,28 @@ Y.extend(DIALOGUE, Y.Panel, {
* @return void
*/
applyZIndex : function() {
var highestzindex = 0,
var highestzindex = 1,
zindexvalue = 1,
bb = this.get('boundingBox'),
ol = this.get('maskNode'),
zindex = this.get('zIndex');
if (zindex) {
if (zindex !== 0 && !this._calculatedzindex) {
// The zindex was specified so we should use that.
bb.setStyle('zIndex', zindex);
} else {
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR).each(function (node) {
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR+', '+HAS_ZINDEX).each(function (node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
if (highestzindex > 0) {
bb.setStyle('zIndex', (highestzindex + 1).toString());
}
zindexvalue = (highestzindex + 1).toString();
bb.setStyle('zIndex', zindexvalue);
ol.setStyle('zIndex', zindexvalue);
this.set('zIndex', zindexvalue);
this._calculatedzindex = true;
}
},

Expand Down
21 changes: 14 additions & 7 deletions lib/yui/src/notification/js/dialogue.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var DIALOGUE_NAME = 'Moodle dialogue',
DIALOGUE_HIDDEN_CLASS = DIALOGUE_PREFIX + '-hidden',
DIALOGUE_SELECTOR =' [role=dialog]',
MENUBAR_SELECTOR = '[role=menubar]',
HAS_ZINDEX = '.moodle-has-zindex',
CAN_RECEIVE_FOCUS_SELECTOR = 'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]';

/**
Expand Down Expand Up @@ -79,7 +80,7 @@ Y.extend(DIALOGUE, Y.Panel, {
_resizeevent : null,
// Orientation change event listener.
_orientationevent : null,

_calculatedzindex : false,
/**
* Initialise the dialogue.
*
Expand Down Expand Up @@ -107,6 +108,8 @@ Y.extend(DIALOGUE, Y.Panel, {
if (config.visible) {
this.applyZIndex();
}
// Recalculate the zIndex every time the modal is altered.
this.on('maskShow', this.applyZIndex);
// We must show - after the dialogue has been positioned,
// either by centerDialogue or makeResonsive. This is because the show() will trigger
// a focus on the dialogue, which will scroll the page. If the dialogue has not
Expand All @@ -125,24 +128,28 @@ Y.extend(DIALOGUE, Y.Panel, {
* @return void
*/
applyZIndex : function() {
var highestzindex = 0,
var highestzindex = 1,
zindexvalue = 1,
bb = this.get('boundingBox'),
ol = this.get('maskNode'),
zindex = this.get('zIndex');
if (zindex) {
if (zindex !== 0 && !this._calculatedzindex) {
// The zindex was specified so we should use that.
bb.setStyle('zIndex', zindex);
} else {
// Determine the correct zindex by looking at all existing dialogs and menubars in the page.
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR).each(function (node) {
Y.all(DIALOGUE_SELECTOR+', '+MENUBAR_SELECTOR+', '+HAS_ZINDEX).each(function (node) {
var zindex = this.findZIndex(node);
if (zindex > highestzindex) {
highestzindex = zindex;
}
}, this);
// Only set the zindex if we found a wrapper.
if (highestzindex > 0) {
bb.setStyle('zIndex', (highestzindex + 1).toString());
}
zindexvalue = (highestzindex + 1).toString();
bb.setStyle('zIndex', zindexvalue);
ol.setStyle('zIndex', zindexvalue);
this.set('zIndex', zindexvalue);
this._calculatedzindex = true;
}
},

Expand Down

0 comments on commit 1389bcd

Please sign in to comment.