Browse files

Merge branch 'MDL-30899_22' of git://github.com/dmonllao/moodle into …

…MOODLE_22_STABLE
  • Loading branch information...
2 parents e1263ce + a84f961 commit 07a01b746cfcb491e2d1d9ec48e89886cc3227f4 @danpoltawski danpoltawski committed Dec 18, 2012
View
3 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;
}
View
35 blocks/community/yui/comments/comments.js
@@ -9,26 +9,27 @@ 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) {
//attach a show event on the div with id = comments
for (var i=0;i<this.get('commentids').length;i++)
{
var commentid = this.get('commentids')[i];
- this.overlays[commentid] = new M.core.dialogue({
- headerContent:Y.one('#commentoverlay-'+commentid+' .commenttitle').get('innerHTML'),
+ this.panels[commentid] = new M.core.dialogue({
+ headerContent:Y.Node.create('<h1>')
+ .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<this.get('commentids').length;i++)
{
this.hide(e, this.get('commentids')[i]);
}
- this.overlays[commentid].show(); //show the overlay
+ this.panels[commentid].show(); //show the panel
- 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.
- //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, commentid);
- //we add a new event on the overlay in order to hide the overlay for the next click (touch device)
- this.overlayevent = Y.one("#commentoverlay-"+commentid).on('click', this.hide, this, commentid);
+ //we add a new event on the panel in order to hide the panel for the next click (touch device)
+ this.panelevent = Y.one("#commentoverlay-"+commentid).on('click', this.hide, this, commentid);
},
hide : function (e, commentid) {
- this.overlays[commentid].hide(); //hide the overlay
+ this.panels[commentid].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
}
@@ -84,5 +85,5 @@ YUI.add('moodle-block_community-comments', function(Y) {
}
}, '@VERSION@', {
- requires:['base','overlay', 'moodle-enrol-notification']
+ requires:['base', 'moodle-enrol-notification']
});
View
76 blocks/community/yui/imagegallery/imagegallery.js
@@ -11,8 +11,8 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
event:null,
previousevent:null,
nextevent:null,
- overlayevent:null,
- overlay:null, //all the comment boxes
+ panelevent:null,
+ panel:null, //all the images boxes
imageidnumbers: [],
imageloadingevent: null,
loadingimage: null,
@@ -26,24 +26,24 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
+'</div>');
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('<div id="imagetitleoverlay" class="hiddenoverlay"></div>');
- objBody.append(overlaytitle);
- var overlay = Y.Node.create('<div id="imageoverlay" class="hiddenoverlay"></div>');
- objBody.append(overlay);
+ var paneltitle = Y.Node.create('<div id="imagetitleoverlay" class="hiddenoverlay"></div>');
+ objBody.append(paneltitle);
+ var panel = Y.Node.create('<div id="imageoverlay" class="hiddenoverlay"></div>');
+ 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
lightbox : false,
zIndex:100
});
- this.overlay.render();
- this.overlay.hide();
+ this.panel.render();
+ this.panel.hide();
//attach a show event on the image divs (<tag id='image-X'>)
for (var i=0;i<this.get('imageids').length;i++)
@@ -85,31 +85,31 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
var maxheight = windowheight - 150;
//load the title + link to next image
- var overlaytitle = Y.one('#imagetitleoverlay');
+ var paneltitle = Y.one('#imagetitleoverlay');
var previousimagelink = "<div id=\"previousarrow\" class=\"imagearrow\">←</div>";
var nextimagelink = "<div id=\"nextarrow\" class=\"imagearrow\">→</div>";
- /// 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('<div style="text-align:center"><img id=\"imagetodisplay\" src="' + url
+ panel.append(Y.Node.create('<div style="text-align:center"><img id=\"imagetodisplay\" src="' + url
+ '" style="max-height:' + maxheight + 'px;"></div>'));
- this.overlay.destroy();
- this.overlay = new M.core.dialogue({
- headerContent:previousimagelink + '<div id=\"imagenumber\" class=\"imagetitle\"> Image '
- + screennumber + ' / ' + this.imageidnumbers[imageid] + ' </div>' + nextimagelink,
+ this.panel.destroy();
+ this.panel = new M.core.dialogue({
+ headerContent:previousimagelink + '<div id=\"imagenumber\" class=\"imagetitle\"><h1> Image '
+ + screennumber + ' / ' + this.imageidnumbers[imageid] + ' </h1></div>' + 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']
});
View
9 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;}
View
65 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('<div class="'+CSS.BASE+'">')
- .append(C('<div class="'+CSS.LIGHTBOX+' '+CSS.HIDDEN+'"></div>'))
.append(C('<div id="'+id+'" class="'+CSS.WRAP+'"></div>')
.append(C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
.append(C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
@@ -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('<div class="closebutton"></div>');
- 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();
}
@@ -96,9 +100,6 @@ Y.extend(DIALOGUE, Y.Overlay, {
notificationBase : {
},
- nodeLightbox : {
- value : null
- },
lightbox : {
validator : Y.Lang.isBoolean,
value : true
@@ -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, '<h1>' + this.get(TITLE) + '</h1>', 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, '<h1>' + this.get(TITLE) + '</h1>', 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, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
var content = C('<div class="moodle-exception"></div>')
.append(C('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
.append(C('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
@@ -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, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
var content = C('<div class="moodle-ajaxexception"></div>')
.append(C('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
.append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))
@@ -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']});

0 comments on commit 07a01b7

Please sign in to comment.