Merge branch '42806-26' of git://github.com/samhemelryk/moodle

This commit is contained in:
Damyon Wiese
2013-11-12 10:02:09 +08:00
5 changed files with 25 additions and 7 deletions
+9
View File
@@ -46,5 +46,14 @@ class block_mentees extends block_base {
return $this->content;
}
/**
* Returns true if the block can be docked.
* The mentees block can only be docked if it has a non-empty title.
* @return bool
*/
public function instance_can_be_docked() {
return parent::instance_can_be_docked() && isset($this->config->title) && !empty($this->config->title);
}
}
@@ -35,14 +35,17 @@ M.core.dock.ensureMoveToIconExists = function(blocknode) {
var commands,
moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" />'),
blockaction = blocknode.one('.block_action'),
icon = 't/block_to_dock';
icon = 't/block_to_dock',
titleh2 = blocknode.one('.header .title h2');
// Must set the image src separately of we get an error with XML strict headers
if (Y.one(document.body).hasClass('dir-rtl')) {
icon = icon + '_rtl';
}
moveto.setAttribute('alt', M.util.get_string('addtodock', 'block'));
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', blocknode.one('.header .title h2').getHTML())));
if (titleh2) {
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', titleh2.getHTML())));
}
moveto.setAttribute('src', M.util.image_url(icon, 'moodle'));
if (blockaction) {
@@ -1 +1 @@
YUI.add("moodle-core-dock-loader",function(e,t){var n="moodle-core-dock-loader";M.core=M.core||{},M.core.dock=M.core.dock||{},M.core.dock.ensureMoveToIconExists=function(t){if(t.one(".moveto"))return!0;var n,r=e.Node.create('<input type="image" class="moveto customcommand requiresjs" />'),i=t.one(".block_action"),s="t/block_to_dock";return e.one(document.body).hasClass("dir-rtl")&&(s+="_rtl"),r.setAttribute("alt",M.util.get_string("addtodock","block")),r.setAttribute("title",e.Escape.html(M.util.get_string("dockblock","block",t.one(".header .title h2").getHTML()))),r.setAttribute("src",M.util.image_url(s,"moodle")),i?i.prepend(r):(n=t.one(".header .title .commands"),!n&&t.one(".header .title")&&(n=e.Node.create('<div class="commands"></div>'),t.one(".header .title").append(n)),n.append(r)),!0},M.core.dock.loader=M.core.dock.loader||{},M.core.dock.loader.delegationEvents=[],M.core.dock.loader.initLoader=function(){var t=e.all(".block[data-instanceid][data-dockable]"),n=e.one(document.body),r;t.each(function(){var e=parseInt(this.getData("instanceid"),10);M.core.dock.ensureMoveToIconExists(this)}),t.some(function(e){return e.hasClass("dock_on_load")})?e.use("moodle-core-dock",function(){M.core.dock.init()}):(r=function(t){var n,r=this.ancestor(".block[data-instanceid]"),i=r.getData("instanceid");t.halt();for(n in M.core.dock.loader.delegationEvents)(e.Lang.isNumber(n)||e.Lang.isString(n))&&M.core.dock.loader.delegationEvents[n].detach();r.addClass("dock_on_load"),e.use("moodle-core-dock",function(){M.util.set_user_preference("docked_block_instance_"+i,1),M.core.dock.init()})},M.core.dock.loader.delegationEvents.push(n.delegate("click",r,".moveto")),M.core.dock.loader.delegationEvents.push(n.delegate("key",r,".moveto","enter")))}},"@VERSION@",{requires:["escape"]});
YUI.add("moodle-core-dock-loader",function(e,t){var n="moodle-core-dock-loader";M.core=M.core||{},M.core.dock=M.core.dock||{},M.core.dock.ensureMoveToIconExists=function(t){if(t.one(".moveto"))return!0;var n,r=e.Node.create('<input type="image" class="moveto customcommand requiresjs" />'),i=t.one(".block_action"),s="t/block_to_dock",o=t.one(".header .title h2");return e.one(document.body).hasClass("dir-rtl")&&(s+="_rtl"),r.setAttribute("alt",M.util.get_string("addtodock","block")),o&&r.setAttribute("title",e.Escape.html(M.util.get_string("dockblock","block",o.getHTML()))),r.setAttribute("src",M.util.image_url(s,"moodle")),i?i.prepend(r):(n=t.one(".header .title .commands"),!n&&t.one(".header .title")&&(n=e.Node.create('<div class="commands"></div>'),t.one(".header .title").append(n)),n.append(r)),!0},M.core.dock.loader=M.core.dock.loader||{},M.core.dock.loader.delegationEvents=[],M.core.dock.loader.initLoader=function(){var t=e.all(".block[data-instanceid][data-dockable]"),n=e.one(document.body),r;t.each(function(){var e=parseInt(this.getData("instanceid"),10);M.core.dock.ensureMoveToIconExists(this)}),t.some(function(e){return e.hasClass("dock_on_load")})?e.use("moodle-core-dock",function(){M.core.dock.init()}):(r=function(t){var n,r=this.ancestor(".block[data-instanceid]"),i=r.getData("instanceid");t.halt();for(n in M.core.dock.loader.delegationEvents)(e.Lang.isNumber(n)||e.Lang.isString(n))&&M.core.dock.loader.delegationEvents[n].detach();r.addClass("dock_on_load"),e.use("moodle-core-dock",function(){M.util.set_user_preference("docked_block_instance_"+i,1),M.core.dock.init()})},M.core.dock.loader.delegationEvents.push(n.delegate("click",r,".moveto")),M.core.dock.loader.delegationEvents.push(n.delegate("key",r,".moveto","enter")))}},"@VERSION@",{requires:["escape"]});
@@ -35,14 +35,17 @@ M.core.dock.ensureMoveToIconExists = function(blocknode) {
var commands,
moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" />'),
blockaction = blocknode.one('.block_action'),
icon = 't/block_to_dock';
icon = 't/block_to_dock',
titleh2 = blocknode.one('.header .title h2');
// Must set the image src separately of we get an error with XML strict headers
if (Y.one(document.body).hasClass('dir-rtl')) {
icon = icon + '_rtl';
}
moveto.setAttribute('alt', M.util.get_string('addtodock', 'block'));
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', blocknode.one('.header .title h2').getHTML())));
if (titleh2) {
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', titleh2.getHTML())));
}
moveto.setAttribute('src', M.util.image_url(icon, 'moodle'));
if (blockaction) {
+5 -2
View File
@@ -33,14 +33,17 @@ M.core.dock.ensureMoveToIconExists = function(blocknode) {
var commands,
moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" />'),
blockaction = blocknode.one('.block_action'),
icon = 't/block_to_dock';
icon = 't/block_to_dock',
titleh2 = blocknode.one('.header .title h2');
// Must set the image src separately of we get an error with XML strict headers
if (Y.one(document.body).hasClass('dir-rtl')) {
icon = icon + '_rtl';
}
moveto.setAttribute('alt', M.util.get_string('addtodock', 'block'));
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', blocknode.one('.header .title h2').getHTML())));
if (titleh2) {
moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', titleh2.getHTML())));
}
moveto.setAttribute('src', M.util.image_url(icon, 'moodle'));
if (blockaction) {