Skip to content

Commit

Permalink
navigation MDL-22671 Fixed xml strict issues in dock and navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jun 8, 2010
1 parent 2bed95e commit 8c29a17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
22 changes: 17 additions & 5 deletions blocks/dock.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ M.core_dock.init = function(Y) {
dock.setStyle('height', dock.get('winHeight')+'px');
}
// Add a removeall button
var removeall = Y.Node.create('<img src="'+this.cfg.removeallicon+'" alt="'+M.str.block.undockall+'" title="'+M.str.block.undockall+'" />');
// Must set the image src seperatly of we get an error with XML strict headers
var removeall = Y.Node.create('<img alt="'+M.str.block.undockall+'" title="'+M.str.block.undockall+'" />');
removeall.setAttribute('src',this.cfg.removeallicon);
removeall.on('removeall|click', this.remove_all, this);
dock.appendChild(Y.Node.create('<div class="'+css.controls+'"></div>').append(removeall));

Expand Down Expand Up @@ -180,7 +182,9 @@ M.core_dock.init = function(Y) {
// and all items rather than the same number for the dock AND every item individually
Y.delegate('click', this.handleEvent, this.nodes.dock, '.'+this.css.dockedtitle, this, {cssselector:'.'+this.css.dockedtitle, delay:0});
Y.delegate('mouseenter', this.handleEvent, this.nodes.dock, '.'+this.css.dockedtitle, this, {cssselector:'.'+this.css.dockedtitle, delay:0.5, iscontained:true, preventevent:'click', preventdelay:3});
Y.delegate('mouseleave', this.handleEvent, this.nodes.body, '#dock', this, {cssselector:'#dock', delay:0.5, iscontained:false});
//Y.delegate('mouseleave', this.handleEvent, this.nodes.body, '#dock', this, {cssselector:'#dock', delay:0.5, iscontained:false});
this.nodes.dock.on('mouseleave', this.handleEvent, this, {cssselector:'#dock', delay:0.5, iscontained:false});

this.nodes.body.on('click', this.handleEvent, this, {cssselector:'body', delay:0});
this.on('dock:itemschanged', this.resizeBlockSpace, this);
this.on('dock:itemschanged', this.checkDockVisibility, this);
Expand Down Expand Up @@ -657,7 +661,9 @@ M.core_dock.genericblock.prototype = {
}
}

var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" src="'+M.util.image_url('t/block_to_dock', 'moodle')+'" alt="'+M.str.block.addtodock+'" title="'+M.str.block.addtodock+'" />');
// Must set the image src seperatly of we get an error with XML strict headers
var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" alt="'+M.str.block.addtodock+'" title="'+M.str.block.addtodock+'" />');
moveto.setAttribute('src', M.util.image_url('t/block_to_dock', 'moodle'));
moveto.on('movetodock|click', this.move_to_dock, this, commands);

var blockaction = node.one('.block_action');
Expand Down Expand Up @@ -713,7 +719,11 @@ M.core_dock.genericblock.prototype = {
blockcommands = Y.Node.create('<div class="commands"></div>');
this.cachedcontentnode.one('.title').append(blockcommands);
}
var moveto = Y.Node.create('<a class="moveto customcommand requiresjs"></a>').append(Y.Node.create('<img src="'+M.util.image_url('t/dock_to_block', 'moodle')+'" alt="'+M.str.block.undockitem+'" title="'+M.str.block.undockitem+'" />'));

// Must set the image src seperatly of we get an error with XML strict headers
var movetoimg = Y.Node.create('<img alt="'+M.str.block.undockitem+'" title="'+M.str.block.undockitem+'" />');
movetoimg.setAttribute('src', M.util.image_url('t/dock_to_block', 'moodle'));
var moveto = Y.Node.create('<a class="moveto customcommand requiresjs"></a>').append(movetoimg);
if (location.href.match(/\?/)) {
moveto.set('href', location.href+'&dock='+this.id);
} else {
Expand All @@ -736,7 +746,9 @@ M.core_dock.genericblock.prototype = {
dock.remove(this.id)
}, this);
// Add a close icon
var closeicon = Y.Node.create('<span class="hidepanelicon"><img src="'+M.util.image_url('t/dockclose', 'moodle')+'" alt="" style="width:11px;height:11px;cursor:pointer;" /></span>');
// Must set the image src seperatly of we get an error with XML strict headers
var closeicon = Y.Node.create('<span class="hidepanelicon"><img alt="" style="width:11px;height:11px;cursor:pointer;" /></span>');
closeicon.one('img').setAttribute('src', M.util.image_url('t/dockclose', 'moodle'));
closeicon.on('forceclose|click', this.hide, this);
this.commands.append(closeicon);
}, dockitem);
Expand Down
7 changes: 3 additions & 4 deletions blocks/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,9 @@ M.block_navigation.classes.tree.prototype.toggleexpansion = function(e) {
return;
}

if (e.target.get('nodeName').toUpperCase() == 'LI') {
var target = e.target;
} else if (e.target.ancestor('LI')) {
var target = e.target.ancestor('LI');
var target = e.target;
if (!target.test('li')) {
target = target.ancestor('li')
}

if (target && !target.hasClass('depth_1')) {
Expand Down

0 comments on commit 8c29a17

Please sign in to comment.