]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from 1.7.
authorvyshane <vyshane>
Thu, 23 Nov 2006 08:36:22 +0000 (08:36 +0000)
committervyshane <vyshane>
Thu, 23 Nov 2006 08:36:22 +0000 (08:36 +0000)
lib/ajax/section_classes.js

index fcbea37e0c875dfee95f6e7cc58bf6d61de1b4dd..10aa4bb6b032bb5ff3b87106a7813ad9b7871397 100755 (executable)
@@ -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;