Merge branch 'MDL-30899_24' of git://github.com/dmonllao/moodle into MOODLE_24_STABLE
This commit is contained in:
@@ -322,6 +322,7 @@ abstract class base_moodleform extends moodleform {
|
||||
$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 @@ if (!empty($courses)) {
|
||||
}
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
+28
-19
@@ -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,19 @@ YUI.add('moodle-block_community-comments', function(Y) {
|
||||
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-core-notification']
|
||||
requires:['base', 'moodle-core-notification']
|
||||
});
|
||||
|
||||
+48
-41
@@ -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,15 +26,15 @@ 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
|
||||
@@ -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 (<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-core-notification']
|
||||
requires:['base','node', 'moodle-core-notification']
|
||||
});
|
||||
|
||||
+1
-1
@@ -4550,7 +4550,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',
|
||||
|
||||
+16
-4
@@ -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);
|
||||
|
||||
+7
-2
@@ -91,8 +91,8 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
|
||||
.append(create('<h2>'+M.str.enrol.enrolusers+'</h2>')))
|
||||
.append(create('<div class="'+CSS.CONTENT+'"></div>')
|
||||
.append(create('<div class="'+CSS.SEARCHCONTROLS+'"></div>')
|
||||
.append(create('<div class="'+CSS.ENROLMENTOPTION+' '+CSS.ROLE+'">'+M.str.role.assignroles+'</div>')
|
||||
.append(create('<select><option value="">'+M.str.enrol.none+'</option></select>'))
|
||||
.append(create('<div class="'+CSS.ENROLMENTOPTION+' '+CSS.ROLE+'"><label for="id_enrol_manual_assignable_roles">'+M.str.role.assignroles+'</label></div>')
|
||||
.append(create('<select id="id_enrol_manual_assignable_roles"><option value="">'+M.str.enrol.none+'</option></select>'))
|
||||
)
|
||||
.append(create('<div class="'+CSS.SEARCHOPTIONS+'"></div>')
|
||||
.append(create('<div class="'+CSS.COLLAPSIBLEHEADING+'"><img alt="" />'+M.str.enrol.enrolmentoptions+'</div>'))
|
||||
@@ -185,6 +185,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
|
||||
s.append(option);
|
||||
}
|
||||
s.set('selectedIndex', index);
|
||||
Y.one('#id_enrol_manual_assignable_roles').focus();
|
||||
}, this);
|
||||
this.getAssignableRoles();
|
||||
},
|
||||
@@ -276,6 +277,10 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
|
||||
}
|
||||
|
||||
this._escCloseEvent = Y.on('key', this.hide, document.body, 'down:27', this);
|
||||
var rolesselect = Y.one('#id_enrol_manual_assignable_roles');
|
||||
if (rolesselect) {
|
||||
rolesselect.focus();
|
||||
}
|
||||
},
|
||||
hide : function(e) {
|
||||
if (this._escCloseEvent) {
|
||||
|
||||
+2
-1
@@ -70,7 +70,8 @@ YUI.add('moodle-filter_glossary-autolinker', function(Y) {
|
||||
|
||||
for (key in data.entries) {
|
||||
definition = data.entries[key].definition + data.entries[key].attachments
|
||||
new M.core.alert({title:data.entries[key].concept, message:definition, lightbox:false});
|
||||
var alertpanel = new M.core.alert({title:data.entries[key].concept, message:definition, lightbox:false});
|
||||
Y.Node.one('#id_yuialertconfirm-' + alertpanel.COUNT).focus();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+25
-17
@@ -5,8 +5,8 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
}
|
||||
|
||||
Y.extend(CHOOSERDIALOGUE, Y.Base, {
|
||||
// The overlay widget
|
||||
overlay: null,
|
||||
// The panel widget
|
||||
panel: null,
|
||||
|
||||
// The submit button - we disable this until an element is set
|
||||
submitbutton : null,
|
||||
@@ -43,7 +43,9 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
draggable : true,
|
||||
visible : false, // Hide by default
|
||||
zindex : 100, // Display in front of other items
|
||||
lightbox : true // This dialogue should be modal
|
||||
lightbox : true, // This dialogue should be modal
|
||||
shim : true,
|
||||
closeButtonTitle : this.get('closeButtonTitle')
|
||||
};
|
||||
|
||||
// Override with additional options
|
||||
@@ -51,23 +53,23 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
params[paramkey] = this.instanceconfig[paramkey];
|
||||
}
|
||||
|
||||
// Create the overlay
|
||||
this.overlay = new M.core.dialogue(params);
|
||||
// Create the panel
|
||||
this.panel = new M.core.dialogue(params);
|
||||
|
||||
// Remove the template for the chooser
|
||||
this.bodycontent.remove();
|
||||
this.headercontent.remove();
|
||||
|
||||
// Hide and then render the overlay
|
||||
this.overlay.hide();
|
||||
this.overlay.render();
|
||||
// Hide and then render the panel
|
||||
this.panel.hide();
|
||||
this.panel.render();
|
||||
|
||||
// Set useful links
|
||||
this.container = this.overlay.get('boundingBox').one('.choosercontainer');
|
||||
this.container = this.panel.get('boundingBox').one('.choosercontainer');
|
||||
this.options = this.container.all('.option input[type=radio]');
|
||||
|
||||
// Add the chooserdialogue class to the container for styling
|
||||
this.overlay.get('boundingBox').addClass('chooserdialogue');
|
||||
this.panel.get('boundingBox').addClass('chooserdialogue');
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -82,7 +84,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
// Stop the default event actions before we proceed
|
||||
e.preventDefault();
|
||||
|
||||
var bb = this.overlay.get('boundingBox');
|
||||
var bb = this.panel.get('boundingBox');
|
||||
var dialogue = this.container.one('.alloptions');
|
||||
|
||||
// Get the overflow setting when the chooser was opened - we
|
||||
@@ -136,7 +138,9 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
// Hook onto the cancel button to hide the form
|
||||
thisevent = this.container.one('.addcancel').on('click', this.cancel_popup, this);
|
||||
this.listenevents.push(thisevent);
|
||||
thisevent = bb.one('div.closebutton').on('click', this.cancel_popup, this);
|
||||
|
||||
// Hide will be managed by cancel_popup after restoring the body overflow
|
||||
thisevent = bb.one('button.closebutton').on('click', this.cancel_popup, this);
|
||||
this.listenevents.push(thisevent);
|
||||
|
||||
// Grab global keyup events and handle them
|
||||
@@ -153,8 +157,8 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
// Ensure that the options are shown
|
||||
this.options.removeAttribute('disabled');
|
||||
|
||||
// Display the overlay
|
||||
this.overlay.show();
|
||||
// Display the panel
|
||||
this.panel.show();
|
||||
|
||||
// Re-centre the dialogue after we've shown it.
|
||||
this.center_dialogue(dialogue);
|
||||
@@ -192,7 +196,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
* @return void
|
||||
*/
|
||||
center_dialogue : function(dialogue) {
|
||||
var bb = this.overlay.get('boundingBox');
|
||||
var bb = this.panel.get('boundingBox');
|
||||
|
||||
var winheight = bb.get('winHeight');
|
||||
var winwidth = bb.get('winWidth');
|
||||
@@ -276,7 +280,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
}
|
||||
|
||||
this.container.detachAll();
|
||||
this.overlay.hide();
|
||||
this.panel.hide();
|
||||
},
|
||||
|
||||
check_options : function(e) {
|
||||
@@ -312,6 +316,10 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
},
|
||||
maxheight : {
|
||||
value : 660
|
||||
},
|
||||
closeButtonTitle : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Close'
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -319,6 +327,6 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
|
||||
M.core.chooserdialogue = CHOOSERDIALOGUE;
|
||||
},
|
||||
'@VERSION@', {
|
||||
requires:['base', 'overlay', 'moodle-core-notification']
|
||||
requires:['base', 'panel', 'moodle-core-notification']
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
.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-ft {}
|
||||
.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-content {background:#FFF;padding:0px;}
|
||||
.moodle-dialogue-base .moodle-dialogue .moodle-dialogue-content .moodle-dialogue-ft {padding:0px;}
|
||||
|
||||
.moodle-dialogue-confirm .confirmation-dialogue {text-align:center;}
|
||||
.moodle-dialogue-confirm .confirmation-message {margin:0.5em 1em;}
|
||||
|
||||
Vendored
+44
-37
@@ -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,8 +29,7 @@ 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 id="'+id+'" role="dialog" aria-labelledby="'+id+'-header-text" class="'+CSS.WRAP+'"></div>')
|
||||
.append(C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
|
||||
.append(C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
|
||||
.append(C('<div class="'+CSS.FOOTER+' yui3-widget-ft"></div>')));
|
||||
@@ -42,41 +39,50 @@ var DIALOGUE = function(config) {
|
||||
config.visible = config.visible || false;
|
||||
config.center = config.centered || true;
|
||||
config.centered = false;
|
||||
DIALOGUE.superclass.constructor.apply(this, [config]);
|
||||
};
|
||||
Y.extend(DIALOGUE, Y.Overlay, {
|
||||
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);
|
||||
|
||||
// lightbox param to keep the stable versions API.
|
||||
if (config.lightbox !== false) {
|
||||
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,
|
||||
classNames: 'closebutton',
|
||||
action: function (e) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
];
|
||||
}
|
||||
DIALOGUE.superclass.constructor.apply(this, [config]);
|
||||
|
||||
if (config.closeButton !== false) {
|
||||
// The buttons constructor does not allow custom attributes
|
||||
this.get('buttons').header[0].setAttribute('title', this.get('closeButtonTitle'));
|
||||
}
|
||||
};
|
||||
Y.extend(DIALOGUE, Y.Panel, {
|
||||
initializer : function(config) {
|
||||
this.after('visibleChange', this.visibilityChanged, 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();
|
||||
}
|
||||
if (this.get('draggable')) {
|
||||
var titlebar = '#' + this.get('id') + ' .' + CSS.HEADER;
|
||||
this.plug(Y.Plugin.Drag, {handles : [titlebar]});
|
||||
this.dd.addInvalid('div.closebutton');
|
||||
Y.one(titlebar).setStyle('cursor', 'move');
|
||||
}
|
||||
break;
|
||||
@@ -101,9 +107,6 @@ Y.extend(DIALOGUE, Y.Overlay, {
|
||||
ATTRS : {
|
||||
notificationBase : {
|
||||
|
||||
},
|
||||
nodeLightbox : {
|
||||
value : null
|
||||
},
|
||||
lightbox : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
@@ -113,6 +116,10 @@ Y.extend(DIALOGUE, Y.Overlay, {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
},
|
||||
closeButtonTitle : {
|
||||
validator : Y.Lang.isString,
|
||||
value : 'Close'
|
||||
},
|
||||
center : {
|
||||
validator : Y.Lang.isBoolean,
|
||||
value : true
|
||||
@@ -132,14 +139,14 @@ Y.extend(ALERT, DIALOGUE, {
|
||||
_enterKeypress : null,
|
||||
initializer : function(config) {
|
||||
this.publish('complete');
|
||||
var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
var yes = C('<input type="button" id="id_yuialertconfirm-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
content = C('<div class="confirmation-dialogue"></div>')
|
||||
.append(C('<div class="confirmation-message">'+this.get('message')+'</div>'))
|
||||
.append(C('<div class="confirmation-buttons"></div>')
|
||||
.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 id="moodle-dialogue-'+COUNT+'-header-text">' + 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);
|
||||
@@ -185,8 +192,8 @@ Y.extend(CONFIRM, DIALOGUE, {
|
||||
this.publish('complete');
|
||||
this.publish('complete-yes');
|
||||
this.publish('complete-no');
|
||||
var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
no = C('<input type="button" value="'+this.get(CONFIRMNO)+'" />'),
|
||||
var yes = C('<input type="button" id="id_yuiconfirmyes-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
no = C('<input type="button" id="id_yuiconfirmno-' + this.COUNT + '" value="'+this.get(CONFIRMNO)+'" />'),
|
||||
content = C('<div class="confirmation-dialogue"></div>')
|
||||
.append(C('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
|
||||
.append(C('<div class="confirmation-buttons"></div>')
|
||||
@@ -194,7 +201,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 id="moodle-dialogue-'+COUNT+'-header-text">' + 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);
|
||||
@@ -247,7 +254,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 id="moodle-dialogue-'+COUNT+'-header-text">' + 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>'))
|
||||
@@ -318,7 +325,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 id="moodle-dialogue-'+COUNT+'-header-text">' + 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>'))
|
||||
@@ -382,4 +389,4 @@ M.core.confirm = CONFIRM;
|
||||
M.core.exception = EXCEPTION;
|
||||
M.core.ajaxException = AJAXEXCEPTION;
|
||||
|
||||
}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-core-notification-skin', 'dd-plugin']});
|
||||
}, '@VERSION@', {requires:['base','node','panel','event-key', 'moodle-core-notification-skin', 'dd-plugin']});
|
||||
|
||||
@@ -892,7 +892,7 @@ sup {vertical-align: super;}
|
||||
-moz-box-shadow: 5px 5px 20px 0px #666666;
|
||||
}
|
||||
|
||||
.chooserdialogue .moodle-dialogue-hd {
|
||||
.chooserdialogue .moodle-dialogue-wrap .moodle-dialogue-hd {
|
||||
font-size:12px!important;
|
||||
font-weight: normal!important;
|
||||
letter-spacing: 1px;
|
||||
@@ -913,7 +913,7 @@ sup {vertical-align: super;}
|
||||
/* Question Bank - Question Chooser "Close" button */
|
||||
#page-question-edit.dir-rtl a.container-close {right:auto;left:6px;}
|
||||
|
||||
.chooserdialogue .moodle-dialogue-bd {
|
||||
.chooserdialogue .moodle-dialogue-wrap .moodle-dialogue-bd {
|
||||
font-size: 12px;
|
||||
color: #555555;
|
||||
overflow: auto;
|
||||
|
||||
Reference in New Issue
Block a user