From d14d739d24c811cc4da9214b1802522d84e4a8c9 Mon Sep 17 00:00:00 2001 From: vyshane Date: Thu, 23 Nov 2006 08:36:22 +0000 Subject: [PATCH] Merged from 1.7. --- lib/ajax/section_classes.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index fcbea37e0c..10aa4bb6b0 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -507,6 +507,8 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj) this.linkContainer = this.getEl().getElementsByTagName('a')[0]; this.commandContainer = null; + this.indentLeftButton = null; + this.indentRightButton = null; this.viewButton = null; this.groupButton = null; this.handle = null; @@ -600,12 +602,14 @@ resource_class.prototype.init_buttons = function() { ['class', 'editing_moveleft']]); YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true); commandContainer.appendChild(button); + this.indentLeftButton = button; } if (moveRight) { var button = main.mk_button('a', '/t/right.gif', [['title', main.portal.strings['moveright']], ['class', 'editing_moveright']]); YAHOO.util.Event.addListener(button, 'click', this.indent_right, this, true); commandContainer.appendChild(button); + this.indentRightButton = button; } // Add edit button back in. @@ -659,11 +663,9 @@ resource_class.prototype.indent_left = function() { // Remove the indent left button as well. var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands', 'span', this.getEl())[0]; - - var indentLeftBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveleft', - 'a', commandContainer)[0]; - commandContainer.removeChild(indentLeftBtn); + commandContainer.removeChild(this.indentLeftButton); + this.indentLeftButton = null; } main.connect('POST', 'class=resource&field=indentleft', null, 'id='+this.id); return true; @@ -691,17 +693,12 @@ resource_class.prototype.indent_right = function() { var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands', 'span', this.getEl())[0]; - var indentLeftBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveleft', - 'a', commandContainer)[0]; - - var indentRightBtn = YAHOO.util.Dom.getElementsByClassName('editing_moveright', - 'a', commandContainer)[0]; - - if (!indentLeftBtn) { + if (!this.indentLeftButton) { var button = main.mk_button('a', '/t/left.gif', [['title', main.portal.strings['moveleft']], ['class', 'editing_moveleft']]); YAHOO.util.Event.addListener(button, 'click', this.indent_left, this, true); - commandContainer.insertBefore(button, indentRightBtn); + commandContainer.insertBefore(button, this.indentRightButton); + this.indentLeftButton = button; } main.connect('POST', 'class=resource&field=indentright', null, 'id='+this.id); return true; -- 2.39.5