Permalink
Browse files

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

…MOODLE_23_STABLE
  • Loading branch information...
2 parents 2e791b9 + 1a4bfac commit 8d8158ea9c93de5922a8eb27a280ba1c0b4f0406 @danpoltawski danpoltawski committed Dec 18, 2012
@@ -322,6 +322,7 @@ public function display() {
$config->question = get_string('confirmcancelquestion', 'backup');
$config->yesLabel = get_string('confirmcancelyes', 'backup');
$config->noLabel = get_string('confirmcancelno', 'backup');
+ $config->closeButtonTitle = get_string('close', 'editor');
$PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
$PAGE->requires->yui_module('moodle-backup-backupselectall', 'M.core_backup.select_all_init',
@@ -228,10 +228,10 @@
}
}
$PAGE->requires->yui_module('moodle-block_community-comments', 'M.blocks_community.init_comments',
- array(array('commentids' => $commentedcourseids)));
+ array(array('commentids' => $commentedcourseids, 'closeButtonTitle' => get_string('close', 'editor'))));
$PAGE->requires->yui_module('moodle-block_community-imagegallery', 'M.blocks_community.init_imagegallery',
array(array('imageids' => $courseids, 'imagenumbers' => $courseimagenumbers,
- 'huburl' => $huburl)));
+ 'huburl' => $huburl, 'closeButtonTitle' => get_string('close', 'editor'))));
echo highlight($search, $renderer->course_list($courses, $huburl, $courseid));
@@ -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;
+}
@@ -9,26 +9,28 @@ 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
+ zIndex:100,
+ closeButtonTitle: this.get('closeButtonTitle')
});
- 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 +39,37 @@ 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);
+
+ // Focus on the close button
+ this.panels[commentid].get('buttons').header[0].focus();
},
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
}
@@ -74,7 +79,11 @@ YUI.add('moodle-block_community-comments', function(Y) {
}, {
NAME : COMMENTSNAME,
ATTRS : {
- commentids: {}
+ commentids: {},
+ closeButtonTitle : {
+ validator : Y.Lang.isString,
+ value : 'Close'
+ }
}
});
@@ -84,5 +93,5 @@ YUI.add('moodle-block_community-comments', function(Y) {
}
}, '@VERSION@', {
- requires:['base','overlay', 'moodle-enrol-notification']
+ requires:['base', 'moodle-enrol-notification']
});
@@ -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
+ zIndex:100,
+ closeButtonTitle: this.get('closeButtonTitle')
});
- 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,17 @@ 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();
+
+ // Focus on the close button
+ this.panel.get('buttons').header[0].focus();
}, this, url);
@@ -147,12 +150,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 +170,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
}
@@ -185,7 +188,11 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
ATTRS : {
imageids: {},
imagenumbers: {},
- huburl: {}
+ huburl: {},
+ closeButtonTitle : {
+ validator : Y.Lang.isString,
+ value : 'Close'
+ }
}
});
@@ -195,5 +202,5 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
}
}, '@VERSION@', {
- requires:['base','node','overlay', 'moodle-enrol-notification']
+ requires:['base','node', 'moodle-enrol-notification']
});
View
@@ -4599,7 +4599,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
// Add the module chooser
$PAGE->requires->yui_module('moodle-course-modchooser',
'M.course.init_chooser',
- array(array('courseid' => $course->id))
+ array(array('courseid' => $course->id, 'closeButtonTitle' => get_string('close', 'editor')))
);
$PAGE->requires->strings_for_js(array(
'addresourceoractivity',
@@ -20,6 +20,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
AJAXURL = 'ajaxurl',
MANUALENROLMENT = 'manualEnrolment',
CSS = {
+ CLOSEBTN : 'close-button',
COHORT : 'qce-cohort',
COHORTS : 'qce-cohorts',
COHORTBUTTON : 'qce-cohort-button',
@@ -52,13 +53,16 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
this.publish('cohortsloaded');
this.publish('defaultcohortroleloaded', {fireOnce:true});
+ var finishbutton = Y.Node.create('<div class="'+CSS.CLOSEBTN+'"></div>')
+ .append(Y.Node.create('<input type="button" value="'+M.str.enrol.finishenrollingusers+'" />'));
var base = Y.Node.create('<div class="'+CSS.PANELCONTENT+'"></div>')
.append(Y.Node.create('<div class="'+CSS.PANELROLES+'"></div>'))
.append(Y.Node.create('<div class="'+CSS.PANELCOHORTS+'"></div>'))
.append(Y.Node.create('<div class="'+CSS.FOOTER+'"></div>')
- .append(Y.Node.create('<div class="'+CSS.SEARCH+'"><label>'+M.str.enrol_cohort.cohortsearch+':</label></div>')
+ .append(Y.Node.create('<div class="'+CSS.SEARCH+'"><label for="enrolcohortsearch">'+M.str.enrol_cohort.cohortsearch+':</label></div>')
.append(Y.Node.create('<input type="text" id="enrolcohortsearch" value="" />'))
)
+ .append(finishbutton)
)
.append(Y.Node.create('<div class="'+CSS.LIGHTBOX+' '+CSS.HIDDEN+'"></div>')
.append(Y.Node.create('<img alt="loading" class="'+CSS.LOADINGICON+'" />')
@@ -99,6 +103,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
this.on('defaultcohortroleloaded', this.updateContent, this, panel);
Y.on('key', this.hide, document.body, 'down:27', this);
close.on('click', this.hide, this);
+ finishbutton.on('click', this.hide, this);
Y.all('.enrol_cohort_plugin input').each(function(node){
if (node.getAttribute('type', 'submit')) {
@@ -117,6 +122,11 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
this.getCohorts(e, false);
this.getAssignableRoles();
this.fire('show');
+
+ var rolesselect = Y.one('#id_enrol_cohort_assignable_roles');
+ if (rolesselect) {
+ rolesselect.focus();
+ }
},
updateContent : function(e, panel) {
var content, i, roles, cohorts, count=0, supportmanual = this.get(MANUALENROLMENT), defaultrole;
@@ -154,13 +164,14 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
break;
case 'assignablerolesloaded':
roles = this.get(ASSIGNABLEROLES);
- content = Y.Node.create('<select></select>');
+ content = Y.Node.create('<select id="id_enrol_cohort_assignable_roles"></select>');
for (i in roles) {
content.append(Y.Node.create('<option value="'+i+'">'+roles[i]+'</option>'));
}
- panel.get('contentBox').one('.'+CSS.PANELROLES).setContent(Y.Node.create('<div><label>'+M.str.role.assignroles+':</label></div>').append(content));
+ panel.get('contentBox').one('.'+CSS.PANELROLES).setContent(Y.Node.create('<div><label for="id_enrol_cohort_assignable_roles">'+M.str.role.assignroles+':</label></div>').append(content));
this.getDefaultCohortRole();
+ Y.one('#id_enrol_cohort_assignable_roles').focus();
break;
case 'defaultcohortroleloaded':
defaultrole = this.get(DEFAULTCOHORTROLE);
@@ -280,7 +291,8 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
new M.core.ajaxException(result);
} else {
if (result.response && result.response.message) {
- new M.core.alert(result.response);
+ var alertpanel = new M.core.alert(result.response);
+ Y.Node.one('#id_yuialertconfirm-' + alertpanel.COUNT).focus();
}
var enrolled = Y.Node.create('<div class="'+CSS.COHORTBUTTON+' alreadyenrolled">'+M.str.enrol.synced+'</div>');
node.one('.'+CSS.COHORT+' #cohortid_'+cohort.get(COHORTID)).replace(enrolled);
Oops, something went wrong.

0 comments on commit 8d8158e

Please sign in to comment.