diff --git a/blocks/community/styles.css b/blocks/community/styles.css index 34f06607458..4a7f1e490a7 100644 --- a/blocks/community/styles.css +++ b/blocks/community/styles.css @@ -213,6 +213,7 @@ background-color:#F6F6F6; border:1px solid #CCCCCC; overflow: auto; + padding: 7px 6px; } #page-blocks-community-communitycourse .moodle-dialogue-base .moodle-dialogue-bd { @@ -222,5 +223,5 @@ #page-blocks-community-communitycourse .moodle-dialogue-base .closebutton { margin-top:4px; - width:30px; + margin-right:4px; } \ No newline at end of file diff --git a/blocks/community/yui/comments/comments.js b/blocks/community/yui/comments/comments.js index 7355b8042b6..296c1156eef 100644 --- a/blocks/community/yui/comments/comments.js +++ b/blocks/community/yui/comments/comments.js @@ -9,8 +9,8 @@ YUI.add('moodle-block_community-comments', function(Y) { Y.extend(COMMENTS, Y.Base, { event:null, - overlayevent:null, - overlays: [], //all the comment boxes + panelevent:null, + panels: [], //all the comment boxes initializer : function(params) { @@ -18,17 +18,18 @@ YUI.add('moodle-block_community-comments', function(Y) { for (var i=0;i') + .append(Y.one('#commentoverlay-'+commentid+' .commenttitle').get('innerHTML')), bodyContent:Y.one('#commentoverlay-'+commentid).get('innerHTML'), visible: false, //by default it is not displayed lightbox : false, zIndex:100 }); - this.overlays[commentid].get('contentBox').one('.commenttitle').remove(); - this.overlays[commentid].render(); - this.overlays[commentid].hide(); + this.panels[commentid].get('contentBox').one('.commenttitle').remove(); + this.panels[commentid].render(); + this.panels[commentid].hide(); Y.one('#comments-'+commentid).on('click', this.show, this, commentid); } @@ -37,34 +38,34 @@ YUI.add('moodle-block_community-comments', function(Y) { show : function (e, commentid) { - //hide all overlays + //hide all panels for (var i=0;i'); objBody.append(this.loadingimage); - /// create the div for overlay + /// create the div for panel var objBody = Y.one(document.body); - var overlaytitle = Y.Node.create('
'); - objBody.append(overlaytitle); - var overlay = Y.Node.create('
'); - objBody.append(overlay); + var paneltitle = Y.Node.create('
'); + objBody.append(paneltitle); + var panel = Y.Node.create('
'); + objBody.append(panel); - /// create the overlay - this.overlay = new M.core.dialogue({ + /// create the panel + this.panel = new M.core.dialogue({ headerContent:Y.one('#imagetitleoverlay').get('innerHTML'), bodyContent:Y.one('#imageoverlay').get('innerHTML'), visible: false, //by default it is not displayed @@ -42,8 +42,8 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { zIndex:100 }); - this.overlay.render(); - this.overlay.hide(); + this.panel.render(); + this.panel.hide(); //attach a show event on the image divs () for (var i=0;i←"; var nextimagelink = "
"; - /// need to load the images in the overlay - var overlay = Y.one('#imageoverlay'); - overlay.setContent(''); + /// need to load the images in the panel + var panel = Y.one('#imageoverlay'); + panel.setContent(''); - overlay.append(Y.Node.create('
')); - this.overlay.destroy(); - this.overlay = new M.core.dialogue({ - headerContent:previousimagelink + '
Image ' - + screennumber + ' / ' + this.imageidnumbers[imageid] + '
' + nextimagelink, + this.panel.destroy(); + this.panel = new M.core.dialogue({ + headerContent:previousimagelink + '

Image ' + + screennumber + ' / ' + this.imageidnumbers[imageid] + '

' + nextimagelink, bodyContent:Y.one('#imageoverlay').get('innerHTML'), visible: false, //by default it is not displayed lightbox : false, zIndex:100 }); - this.overlay.render(); - this.overlay.hide(); //show the overlay - this.overlay.set("centered", true); + this.panel.render(); + this.panel.hide(); //show the panel + this.panel.set("centered", true); - e.halt(); // we are going to attach a new 'hide overlay' event to the body, + e.halt(); // we are going to attach a new 'hide panel' event to the body, // because javascript always propagate event to parent tag, // we need to tell Yahoo to stop to call the event on parent tag // otherwise the hide event will be call right away. @@ -123,14 +123,14 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { var screenshot = new Image(); screenshot.src = url; - var overlaywidth = windowwidth - 100; - if(overlaywidth > screenshot.width) { - overlaywidth = screenshot.width; + var panelwidth = windowwidth - 100; + if(panelwidth > screenshot.width) { + panelwidth = screenshot.width; } - this.overlay.set('width', overlaywidth); - this.overlay.set("centered", true); - this.overlay.show(); + this.panel.set('width', panelwidth); + this.panel.set("centered", true); + this.panel.show(); }, this, url); @@ -147,12 +147,12 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { Y.one('#nextarrow').on('click', this.show, this, imageid, nextnumber); Y.one('#imagenumber').on('click', this.show, this, imageid, nextnumber); - //we add a new event on the body in order to hide the overlay for the next click + //we add a new event on the body in order to hide the panel for the next click this.event = Y.one(document.body).on('click', this.hide, this); - //we add a new event on the overlay in order to hide the overlay for the next click (touch device) - this.overlayevent = Y.one("#imageoverlay").on('click', this.hide, this); + //we add a new event on the panel in order to hide the panel for the next click (touch device) + this.panelevent = Y.one("#imageoverlay").on('click', this.hide, this); - this.overlay.on('visibleChange',function(e){ + this.panel.on('visibleChange',function(e){ if(e.newVal == 0){ this.get('maskNode').remove() } @@ -167,14 +167,14 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { //hide the loading image Y.one('#hubloadingimage').setStyle('display', 'none'); - this.overlay.hide(); //hide the overlay + this.panel.hide(); //hide the panel if (this.event != null) { this.event.detach(); //we need to detach the body hide event //Note: it would work without but create js warning everytime //we click on the body } - if (this.overlayevent != null) { - this.overlayevent.detach(); //we need to detach the overlay hide event + if (this.panelevent != null) { + this.panelevent.detach(); //we need to detach the panel hide event //Note: it would work without but create js warning everytime //we click on the body } @@ -195,5 +195,5 @@ YUI.add('moodle-block_community-imagegallery', function(Y) { } }, '@VERSION@', { - requires:['base','node','overlay', 'moodle-enrol-notification'] + requires:['base','node', 'moodle-enrol-notification'] }); diff --git a/enrol/yui/notification/assets/skins/sam/notification.css b/enrol/yui/notification/assets/skins/sam/notification.css index 66cdddae409..68c66d0c711 100644 --- a/enrol/yui/notification/assets/skins/sam/notification.css +++ b/enrol/yui/notification/assets/skins/sam/notification.css @@ -1,11 +1,14 @@ .moodle-dialogue-base .hidden, .moodle-dialogue-base .moodle-dialogue-hidden {display:none;} -.moodle-dialogue-base .moodle-dialogue-lightbox {background-color:#AAA;position:absolute;top:0;left:0;width:100%;height:100%;} +.moodle-dialogue-base .moodle-dialogue-lightbox {background-color:#AAA;} .moodle-dialogue-base .moodle-dialogue {background-color:#666;border:0 solid #666;border-right-width:3px;border-bottom-width:3px;} .moodle-dialogue-base .moodle-dialogue-wrap {background-color:#FFF;margin-top:-3px;margin-left:-3px;border:1px solid #555;height:auto;} -.moodle-dialogue-base .moodle-dialogue-hd {font-size:110%;color:inherit;font-weight:bold;text-align:left;padding:5px 6px;margin:0;border-bottom:1px solid #ccc;background-color:#f6f6f6;} -.moodle-dialogue-base .closebutton {background-image:url(sprite.png);width:25px;height:15px;background-repeat:no-repeat;float:right;vertical-align:middle;display:inline-block;cursor:pointer;} +.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd {font-size:110%;color:inherit;font-weight:bold;text-align:left;padding:5px 6px;margin:0;border-bottom:1px solid #ccc;background:#f6f6f6;} +.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h1{font-size:100%;font-weight:bold;margin:0;padding:0;display:inline;} +.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd .yui3-widget-buttons {padding: 5px;} +.moodle-dialogue-base .closebutton {background-image:url(sprite.png);width:25px;height:15px;background-repeat:no-repeat;float:right;vertical-align:middle;display:inline-block;cursor:pointer;padding:0px;border-style:none;} .moodle-dialogue-base .moodle-dialogue-bd {padding:5px; overflow: auto;} +.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-content {background:#FFF;padding:0px;} .moodle-dialogue-base .moodle-dialogue-ft {} .moodle-dialogue-confirm .confirmation-dialogue {text-align:center;} diff --git a/enrol/yui/notification/notification.js b/enrol/yui/notification/notification.js index ec41d6f66a1..0093b680d4b 100644 --- a/enrol/yui/notification/notification.js +++ b/enrol/yui/notification/notification.js @@ -8,8 +8,6 @@ var DIALOGUE_NAME = 'Moodle dialogue', ALERT_NAME = 'Moodle alert', C = Y.Node.create, BASE = 'notificationBase', - LIGHTBOX = 'lightbox', - NODELIGHTBOX = 'nodeLightbox', COUNT = 0, CONFIRMYES = 'yesLabel', CONFIRMNO = 'noLabel', @@ -31,7 +29,6 @@ var DIALOGUE = function(config) { var id = 'moodle-dialogue-'+COUNT; config.notificationBase = C('
') - .append(C('
')) .append(C('
') .append(C('
')) .append(C('
')) @@ -42,34 +39,41 @@ var DIALOGUE = function(config) { config.visible = config.visible || false; config.center = config.centered || true; config.centered = false; + + // lightbox param to keep the stable versions API + if (config.lightbox === true) { + config.modal = true; + } + delete config.lightbox; + + // closeButton param to keep the stable versions API + if (config.closeButton === false) { + config.buttons = null; + } else { + config.buttons = [ + { + section: Y.WidgetStdMod.HEADER, + value : '', + classNames: 'closebutton', + action: function (e) { + e.preventDefault(); + this.hide(); + } + } + ]; + } DIALOGUE.superclass.constructor.apply(this, [config]); }; -Y.extend(DIALOGUE, Y.Overlay, { +Y.extend(DIALOGUE, Y.Panel, { initializer : function(config) { - this.set(NODELIGHTBOX, this.get(BASE).one('.'+CSS.LIGHTBOX).setStyle('opacity', 0.5)); this.after('visibleChange', this.visibilityChanged, this); - this.after('headerContentChange', function(e){ - var h = (this.get('closeButton'))?this.get(BASE).one('.'+CSS.HEADER):false; - if (h && !h.one('.closebutton')) { - var c = C('
'); - c.on('click', this.hide, this); - h.append(c); - } - }, this); this.render(); this.show(); }, visibilityChanged : function(e) { switch (e.attrName) { case 'visible': - if (this.get(LIGHTBOX)) { - var l = this.get(NODELIGHTBOX); - if (!e.prevVal && e.newVal) { - l.setStyle('height',l.get('docHeight')+'px').removeClass(CSS.HIDDEN); - } else if (e.prevVal && !e.newVal) { - l.addClass(CSS.HIDDEN); - } - } + this.get('maskNode').addClass(CSS.LIGHTBOX); if (this.get('center') && !e.prevVal && e.newVal) { this.centerDialogue(); } @@ -95,9 +99,6 @@ Y.extend(DIALOGUE, Y.Overlay, { ATTRS : { notificationBase : { - }, - nodeLightbox : { - value : null }, lightbox : { validator : Y.Lang.isBoolean, @@ -116,6 +117,9 @@ Y.extend(DIALOGUE, Y.Overlay, { var ALERT = function(config) { config.closeButton = false; + if (config.lightbox !== false) { + config.lightbox = true; + } ALERT.superclass.constructor.apply(this, [config]); }; Y.extend(ALERT, DIALOGUE, { @@ -129,7 +133,7 @@ Y.extend(ALERT, DIALOGUE, { .append(yes)); this.get(BASE).addClass('moodle-dialogue-confirm'); this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); - this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE); + this.setStdModContent(Y.WidgetStdMod.HEADER, '

' + this.get(TITLE) + '

', Y.WidgetStdMod.REPLACE); this.after('destroyedChange', function(){this.get(BASE).remove();}, this); this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this); yes.on('click', this.submit, this); @@ -166,6 +170,9 @@ Y.extend(ALERT, DIALOGUE, { }); var CONFIRM = function(config) { + if (config.lightbox !== false) { + config.lightbox = true; + } CONFIRM.superclass.constructor.apply(this, [config]); }; Y.extend(CONFIRM, DIALOGUE, { @@ -184,7 +191,7 @@ Y.extend(CONFIRM, DIALOGUE, { .append(no)); this.get(BASE).addClass('moodle-dialogue-confirm'); this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE); - this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE); + this.setStdModContent(Y.WidgetStdMod.HEADER, '

' + this.get(TITLE) + '

', Y.WidgetStdMod.REPLACE); this.after('destroyedChange', function(){this.get(BASE).remove();}, this); this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true); this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false); @@ -237,7 +244,7 @@ Y.extend(EXCEPTION, DIALOGUE, { _keypress : null, initializer : function(config) { this.get(BASE).addClass('moodle-dialogue-exception'); - this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE); + this.setStdModContent(Y.WidgetStdMod.HEADER, '

' + config.name + '

', Y.WidgetStdMod.REPLACE); var content = C('
') .append(C('
'+this.get('message')+'
')) .append(C('')) @@ -308,7 +315,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, { _keypress : null, initializer : function(config) { this.get(BASE).addClass('moodle-dialogue-exception'); - this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE); + this.setStdModContent(Y.WidgetStdMod.HEADER, '

' + config.name + '

', Y.WidgetStdMod.REPLACE); var content = C('
') .append(C('
'+this.get('error')+'
')) .append(C('')) @@ -372,4 +379,4 @@ M.core.confirm = CONFIRM; M.core.exception = EXCEPTION; M.core.ajaxException = AJAXEXCEPTION; -}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-enrol-notification-skin']}); +}, '@VERSION@', {requires:['base','node','panel','event-key', 'moodle-enrol-notification-skin']});