]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9742 Converting tabs to spaces
authorpoltawski <poltawski>
Wed, 9 May 2007 01:11:45 +0000 (01:11 +0000)
committerpoltawski <poltawski>
Wed, 9 May 2007 01:11:45 +0000 (01:11 +0000)
lib/ajax/ajaxcourse.js
lib/ajax/ajaxlib.php
lib/ajax/block_classes.js
lib/ajax/section_classes.js

index 0ac21766728e3de5d4eff8144aed1821b61ccad6..0dfd6de522787376c812b6d4162bdbe8e7a4c7fc 100644 (file)
@@ -18,17 +18,17 @@ function onload_class() {
 
 onload_class.prototype.add = function(script) {
     if (this.debug) {
-               YAHOO.log("onloadobj.add - adding "+script, "junk");
-       }
+        YAHOO.log("onloadobj.add - adding "+script, "junk");
+    }
     this.scripts[this.scripts.length] = script;
 }
 
 
 onload_class.prototype.load = function() {
     var scriptcount = this.scripts.length;
-       if (this.debug) {
-               YAHOO.log("onloadobj.load - loading "+scriptcount+" scripts", "info");
-       }
+    if (this.debug) {
+        YAHOO.log("onloadobj.load - loading "+scriptcount+" scripts", "info");
+    }
     for (i=0; i<scriptcount; i++) {
         eval(this.scripts[i]);
     }
@@ -40,7 +40,7 @@ var onloadobj = new onload_class();
 
 //main page object
 function main_class() {
-       this.debug = true;
+    this.debug = true;
     this.portal = new php_portal_class();
 
     this.blocks = new Array();
@@ -64,7 +64,7 @@ function main_class() {
 
 main_class.prototype.process_blocks = function() {
     //remove unneeded icons (old school position icons and delete/hide
-       //although they will be read)
+    //although they will be read)
     var rmIconClasses = ['icon up', 'icon down', 'icon right', 'icon left', 'icon delete', 'icon hide'];
     for (var c=0; c<rmIconClasses.length; c++) {
         els = YAHOO.util.Dom.getElementsByClassName(rmIconClasses[c]);
@@ -111,8 +111,8 @@ main_class.prototype.process_document = function() {
         ct++;
     }
     if (this.debug) {
-               YAHOO.log("Processed "+ct+" sections");
-       }
+        YAHOO.log("Processed "+ct+" sections");
+    }
 
     this.adminBlock = YAHOO.util.Dom.getElementsByClassName('block_adminblock')[0]; 
     YAHOO.log("admin - "+this.adminBlock.className);
@@ -164,15 +164,15 @@ main_class.prototype.mk_button = function(tag, imgSrc, attributes, imgAttributes
             image.setAttribute(imgAttributes[c][0], imgAttributes[c][1]);                
         }
     }
-       image.setAttribute('hspace', '3');
+    image.setAttribute('hspace', '3');
     return container;
 }
 
 
 main_class.prototype.connect = function(method, urlStub, callback, body) {
     if (this.debug) {
-               YAHOO.log("Making "+method+" connection to /course/rest.php?courseId="+main.portal.id+"&"+urlStub);
-       }
+        YAHOO.log("Making "+method+" connection to /course/rest.php?courseId="+main.portal.id+"&"+urlStub);
+    }
     if (callback == null) {
         callback = {}
     }
@@ -199,14 +199,14 @@ main_class.prototype.connectQueue_fireNext = function() {
         return;
     }
     var callback = {
-               success: function(){
-            main.connectQueue_fireNext();
+    success: function(){
+             main.connectQueue_fireNext();
         }
     }
     main.connectQueueConnection = main.connect(main.connectQueue[head]['method'],
-                                                                                          main.connectQueue[head]['urlStub'],
-                                                                                          callback,
-                                                                                          main.connectQueue[head]['body']);
+            main.connectQueue[head]['urlStub'],
+            callback,
+            main.connectQueue[head]['body']);
     main.connectQueueHead++;
 }
 
@@ -223,9 +223,9 @@ main_class.prototype.update_marker = function(newMarker) {
 
 
 main_class.prototype.getString = function(title, variable) {
-       if (this.portal.strings[title]) {
-       return this.portal.strings[title].replace(/_var_/, variable);
-       }
+    if (this.portal.strings[title]) {
+        return this.portal.strings[title].replace(/_var_/, variable);
+    }
 }
 
 
@@ -235,7 +235,7 @@ var main = new main_class();
 function php_portal_class() {
     //portal to php data
     this.id = null;
-       this.debug = null;
+    this.debug = null;
 
     //array of id's of blocks set at end of page load by php    
     this.blocks = new Array();
index e1691269095c61413273b695df821d2f187cfe37..f7303582013d43ec038039d2bd99745a860c01d4 100644 (file)
@@ -76,21 +76,21 @@ function ajax_get_lib($libname) {
 
     $translatelist = array(
             'yui_yahoo' => '/lib/yui/yahoo/yahoo-min.js',
-                       'yui_animation' => '/lib/yui/animation/animation-min.js',
-                       'yui_autocomplete' => '/lib/yui/autocomplete/autocomplete-min.js',
-                       'yui_calendar' => '/lib/yui/calendar/calendar-min.js',
-                       'yui_connection' => '/lib/yui/connection/connection-min.js',
-                       'yui_container' => '/lib/yui/container/container-min.js',
+            'yui_animation' => '/lib/yui/animation/animation-min.js',
+            'yui_autocomplete' => '/lib/yui/autocomplete/autocomplete-min.js',
+            'yui_calendar' => '/lib/yui/calendar/calendar-min.js',
+            'yui_connection' => '/lib/yui/connection/connection-min.js',
+            'yui_container' => '/lib/yui/container/container-min.js',
             'yui_dom' => '/lib/yui/dom/dom-min.js',
-                       'yui_dom-event' => '/lib/yui/yahoo-dom-event/yahoo-dom-event.js',
-                       'yui_dragdrop' => '/lib/yui/dragdrop/dragdrop-min.js',
+            'yui_dom-event' => '/lib/yui/yahoo-dom-event/yahoo-dom-event.js',
+            'yui_dragdrop' => '/lib/yui/dragdrop/dragdrop-min.js',
             'yui_event' => '/lib/yui/event/event-min.js',
             'yui_logger' => '/lib/yui/logger/logger-min.js',
-                       'yui_menu' => '/lib/yui/menu/menu-min.js',
-                       'yui_tabview' => '/lib/yui/tabview/tabview-min.js',
-                       'yui_treeview' => '/lib/yui/treeview/treeview-min.js',
-                       'yui_slider' => '/lib/yui/slider/slider-min.js',
-                       'yui_utilities' => '/lib/yui/utilities/utilities.js',
+            'yui_menu' => '/lib/yui/menu/menu-min.js',
+            'yui_tabview' => '/lib/yui/tabview/tabview-min.js',
+            'yui_treeview' => '/lib/yui/treeview/treeview-min.js',
+            'yui_slider' => '/lib/yui/slider/slider-min.js',
+            'yui_utilities' => '/lib/yui/utilities/utilities.js',
             'ajaxcourse_blocks' => '/lib/ajax/block_classes.js',
             'ajaxcourse_sections' => '/lib/ajax/section_classes.js',
             'ajaxcourse' => '/lib/ajax/ajaxcourse.js'
@@ -191,7 +191,7 @@ class jsportal {
             }
         }
         $output .= "<script type=\"text/javascript\">\n";
-        $output .= "   main.portal.id = ".$courseid.";\n";
+        $output .= "    main.portal.id = ".$courseid.";\n";
         $output .= "    main.portal.blocks = new Array(".$blocksoutput.");\n";
         $output .= "    main.portal.strings['wwwroot']='".$CFG->wwwroot."';\n";
         $output .= "    main.portal.strings['pixpath']='".$CFG->pixpath."';\n";
index 69fb703d4ff477ecc4d7b87a1bca57c4c64efcc9..51a0479beeaae26bd0740e4d74eaa930aee732ef 100644 (file)
@@ -24,9 +24,9 @@ block_class.prototype.debug = false;
 
 block_class.prototype.init_block = function(id, sGroup, config) {
 
-       if (!id) {
-               return;
-       }
+    if (!id) {
+        return;
+    }
 
     //Drag and Drop
     this.init(id, sGroup, config);
@@ -36,8 +36,8 @@ block_class.prototype.init_block = function(id, sGroup, config) {
     this.is = 'block';
     this.instanceId = this.getEl().id.replace(/inst/i, '');
 
-       // Add the drag class (move handle) only to blocks that need it.
-       YAHOO.util.Dom.addClass(this.getEl(), 'drag');
+    // Add the drag class (move handle) only to blocks that need it.
+    YAHOO.util.Dom.addClass(this.getEl(), 'drag');
 
     this.addInvalidHandleType('a');
 
@@ -113,8 +113,8 @@ block_class.prototype.onDragDrop = function(e, id) {
 
     var el = this.getEl();
     
-       if (this.debug) {
-               YAHOO.log("id="+id+" el="+e+" x="+YAHOO.util.Dom.getXY(this.getDragEl()));
+    if (this.debug) {
+        YAHOO.log("id="+id+" el="+e+" x="+YAHOO.util.Dom.getXY(this.getDragEl()));
     }
     //var collisions = this.find_collisions(e,id);
 
@@ -194,15 +194,15 @@ block_class.prototype.move_block = function(columnid){
 
 
 block_class.prototype.reset_regions = function() {
-       var blockcount = main.blocks.length;
+    var blockcount = main.blocks.length;
     for (i=0; i<blockcount; i++) {
-               main.blocks[i].region = YAHOO.util.Region.getRegion(main.blocks[i].getEl());
-       }
+        main.blocks[i].region = YAHOO.util.Region.getRegion(main.blocks[i].getEl());
+    }
 }
 
 
 block_class.prototype.init_buttons = function() {
-       var viewbutton = main.mk_button('a', '/t/hide.gif', [['class', 'icon hide']]);
+    var viewbutton = main.mk_button('a', '/t/hide.gif', [['class', 'icon hide']]);
     YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this, true);
 
     var deletebutton = main.mk_button('a', '/t/delete.gif', [['class', 'icon delete']]);
@@ -212,67 +212,67 @@ block_class.prototype.init_buttons = function() {
 
     buttonCont = YAHOO.util.Dom.getElementsByClassName('commands', 'div', this.getEl())[0];
 
-       if (buttonCont) {
-       buttonCont.appendChild(viewbutton);
-       buttonCont.appendChild(deletebutton);
-       }
+    if (buttonCont) {
+        buttonCont.appendChild(viewbutton);
+        buttonCont.appendChild(deletebutton);
+    }
 }
 
 
 block_class.prototype.toggle_hide = function(e, target, isCosmetic) {
 
     if (YAHOO.util.Dom.hasClass(this.getEl(), 'hidden')) {
-       this.getEl().className = this.originalClass;
+        this.getEl().className = this.originalClass;
         this.viewbutton.childNodes[0].src = this.viewbutton.childNodes[0].src.replace(/show.gif/i, 'hide.gif');
 
         if (!isCosmetic) {
-                       main.connect('POST', 'class=block&field=visible', null,
-                                                'value=1&instanceId='+this.instanceId);
-               }
+            main.connect('POST', 'class=block&field=visible', null,
+                    'value=1&instanceId='+this.instanceId);
+        }
     } else {
         this.originalClass = this.getEl().className;
         this.getEl().className = "hidden sideblock";
         this.viewbutton.childNodes[0].src = this.viewbutton.childNodes[0].src.replace(/hide.gif/i,'show.gif');
 
         if (!isCosmetic) {
-                       main.connect('POST', 'class=block&field=visible', null,
-                                                'value=0&instanceId='+this.instanceId);
+            main.connect('POST', 'class=block&field=visible', null,
+                    'value=0&instanceId='+this.instanceId);
         }
     }
 }
 
 
 block_class.prototype.delete_button = function() {
-       // Remove from local model.
+    // Remove from local model.
     if (main.rightcolumn.has_block(this)) {
-       main.rightcolumn.remove_block(this);
+        main.rightcolumn.remove_block(this);
     } else if (main.leftcolumn.has_block(this)) {
         main.leftcolumn.remove_block(this);
-       }
-       // Remove block from the drag and drop group in YUI.
-       this.removeFromGroup('blocks');
+    }
+    // Remove block from the drag and drop group in YUI.
+    this.removeFromGroup('blocks');
 
     // Remove from remote model.
     main.connect('DELETE', 'class=block&instanceId='+this.instanceId);
         
     // Remove from view
-       main.blocks.splice(main.get_block_index(this), 1);
+    main.blocks.splice(main.get_block_index(this), 1);
     this.getEl().parentNode.removeChild(this.getEl());
 
-       if (this.debug) {
-               YAHOO.log("Deleting "+this.getEl().id);
-       }
+    if (this.debug) {
+        YAHOO.log("Deleting "+this.getEl().id);
+    }
 }
 
 
 block_class.prototype.updatePosition = function(index, columnId) {
-       //update the db for the position
+    //update the db for the position
     main.connectQueue_add('POST', 'class=block&field=position', null,
-                       'value='+index+'&column='+columnId+'&instanceId='+this.instanceId);
+            'value='+index+'&column='+columnId+'&instanceId='+this.instanceId);
 
     if (this.debug) {
-               YAHOO.log("Updating position of "+this.getEl().id+" to index "+index+" on column "+columnId);
-       }
+        YAHOO.log("Updating position of "+this.getEl().id+" to index "+index+" on column "+columnId);
+    }
 }
 
 
index c4483f5f7015a9bb5878f562644ea197ac4f3a42..64b2f107968cf3f0126fb80b210c739e7ed0be10 100755 (executable)
@@ -31,12 +31,12 @@ section_class.prototype.debug = false;
 
 section_class.prototype.init_section = function(id, group, config, isDraggable) {
 
-       if (!id) {
-               return;
-       }
+    if (!id) {
+        return;
+    }
 
     this.is = 'section';
-    this.sectionId = null;     // Section number. This is NOT the section id from
+    this.sectionId = null; // Section number. This is NOT the section id from
                             // the database.
 
     if (!isDraggable) {
@@ -51,7 +51,7 @@ section_class.prototype.init_section = function(id, group, config, isDraggable)
     this.isTarget = true;
 
     this.resources = [];
-    this.numberDisplay = null; // Used to display the section number on the top left
+    this.numberDisplay = null; // Used to display the section number on the top left
                                 // of the section. Not used in all course formats.
     this.summary = null;
     this.content_td = null;
@@ -67,14 +67,14 @@ section_class.prototype.init_section = function(id, group, config, isDraggable)
     this.init_buttons();
 
     if (isDraggable) {
-               this.add_handle();
-       }
+        this.add_handle();
+    }
     if (this.debug) {
-               YAHOO.log("init_section "+id+" draggable="+isDraggable);
-       }
+        YAHOO.log("init_section "+id+" draggable="+isDraggable);
+    }
     if (YAHOO.util.Dom.hasClass(this.getEl(),'hidden')) {
         this.toggle_hide(null,null,true);
-       }
+    }
 }
 
 
@@ -103,9 +103,9 @@ section_class.prototype.init_buttons = function() {
 
 section_class.prototype.add_handle = function() {
     var handleRef = main.mk_button('a', '/i/move_2d.gif',
-                       [['style','cursor:move'], ['title', main.portal.strings['move']]]);
+            [['style','cursor:move'], ['title', main.portal.strings['move']]]);
 
-       YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
+    YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
 
     this.handle = handleRef;
 
@@ -129,25 +129,25 @@ section_class.prototype.process_section = function() {
     this.getEl().childNodes[0].innerHTML = '';
     this.getEl().childNodes[0].appendChild(this.numberDisplay);  
 
-       this.sectionId = this.id.replace(/section-/i, '');      // Okay, we will have to change this if we
-                                                           // ever change the id attributes format
-                                                                                                               // for the sections.
+    this.sectionId = this.id.replace(/section-/i, ''); // Okay, we will have to change this if we
+    // ever change the id attributes format
+    // for the sections.
     if (this.debug) {
-               YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
-       }
-       
+        YAHOO.log("Creating section "+this.getEl().id+" in position "+this.sectionId);
+    }
+
     // Find/edit resources
     this.resources_ul = this.content_td.getElementsByTagName('ul')[0];
     if (!this.resources_ul) {
         this.resources_ul = document.createElement('ul');
         this.resources_ul.className='section';
-               this.content_td.insertBefore(this.resources_ul, this.content_td.lastChild);
+        this.content_td.insertBefore(this.resources_ul, this.content_td.lastChild);
     }
     var resource_count = this.resources_ul.getElementsByTagName('li').length;
 
     for (var i=0;i<resource_count;i++) {
         var resource = this.resources_ul.getElementsByTagName('li')[i];
-               this.resources[this.resources.length] = new resource_class(resource.id, 'resources', null, this);
+        this.resources[this.resources.length] = new resource_class(resource.id, 'resources', null, this);
     }
     this.summary = YAHOO.util.Dom.getElementsByClassName('summary', null, this.getEl())[0].firstChild.data || '';
 }
@@ -165,9 +165,9 @@ section_class.prototype.startDrag = function(x, y) {
 
     var targets = YAHOO.util.DDM.getRelated(this, true);
 
-       if (this.debug) {
-               YAHOO.log(this.id + " startDrag, "+targets.length + " targets");
-       }
+    if (this.debug) {
+        YAHOO.log(this.id + " startDrag, "+targets.length + " targets");
+    }
 }
 
 
@@ -176,9 +176,9 @@ section_class.prototype.onDragDrop = function(e, id) {
     var target = YAHOO.util.DDM.getDDById(id);
 
     if (this.debug) {
-               YAHOO.log("Section dropped on id="+id+" (I am "+this.getEl().id+") x="
-                                  +YAHOO.util.Dom.getXY(this.getDragEl()));
-       }
+        YAHOO.log("Section dropped on id="+id+" (I am "+this.getEl().id+") x="
+                +YAHOO.util.Dom.getXY(this.getDragEl()));
+    }
     this.move_to_section(target);
 
     //add back to resources group
@@ -205,8 +205,8 @@ section_class.prototype.move_to_section = function(target) {
     var tIndex = main.get_section_index(target);
 
     if (this.debug) {
-               YAHOO.log("original is at: "+oIndex+" target is at:"+tIndex+" of "+(sectionCount-1));
-       }
+        YAHOO.log("original is at: "+oIndex+" target is at:"+tIndex+" of "+(sectionCount-1));
+    }
     if (oIndex < tIndex) {
         var loopCondition = 'i<sectionCount';
         var loopStart = 1;
@@ -221,7 +221,7 @@ section_class.prototype.move_to_section = function(target) {
 
     //move on backend
     main.connect('POST','class=section&field=move',null,'id='+this.sectionId+'&value='
-                                       +(target.sectionId - this.sectionId));
+            +(target.sectionId - this.sectionId));
 
     //move on front end
     for (var i=loopStart; eval(loopCondition); eval(loopInc)) {
@@ -229,16 +229,16 @@ section_class.prototype.move_to_section = function(target) {
         if ((main.sections[i] == this) && !found) {
             //enounter with original node
             if (this.debug) {
-                               YAHOO.log("Found Original "+main.sections[i].getEl().id);
-                       }
+                YAHOO.log("Found Original "+main.sections[i].getEl().id);
+            }
             if (main.sections[i] == this) {
                 found = true;
             }
         } else if (main.sections[i] == target) {
             //encounter with target node
             if (this.debug) {
-                               YAHOO.log("Found target "+main.sections[i].getEl().id);
-                       }
+                YAHOO.log("Found target "+main.sections[i].getEl().id);
+            }
             main.sections[i].swap_with_section(main.sections[eval(loopmodifier)]);
             found = false;
             break;
@@ -262,22 +262,22 @@ section_class.prototype.swap_with_section = function(sectionIn) {
     sectionIn.changeId(thisIndex);
 
     if (this.debug) {
-               YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
-       }
-       // Swap the sections.
+        YAHOO.log("Swapping "+this.getEl().id+" with "+sectionIn.getEl().id);
+    }
+    // Swap the sections.
     YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl());
 
-       // Sections contain forms to add new resources/activities. These forms
-       // have not been updated to reflect the new positions of the sections that
-       // we have swapped. Let's swap the two sections' forms around.
-       if (this.getEl().getElementsByTagName('form')[0].parentNode
-                       && sectionIn.getEl().getElementsByTagName('form')[0].parentNode) {
-
-               YAHOO.util.DDM.swapNode(this.getEl().getElementsByTagName('form')[0].parentNode,
-                                               sectionIn.getEl().getElementsByTagName('form')[0].parentNode);
-       } else {
-               YAHOO.log("Swapping sections: form not present in one or both sections", "warn");
-       }
+    // Sections contain forms to add new resources/activities. These forms
+    // have not been updated to reflect the new positions of the sections that
+    // we have swapped. Let's swap the two sections' forms around.
+    if (this.getEl().getElementsByTagName('form')[0].parentNode
+            && sectionIn.getEl().getElementsByTagName('form')[0].parentNode) {
+
+        YAHOO.util.DDM.swapNode(this.getEl().getElementsByTagName('form')[0].parentNode,
+                sectionIn.getEl().getElementsByTagName('form')[0].parentNode);
+    } else {
+        YAHOO.log("Swapping sections: form not present in one or both sections", "warn");
+    }
 }
 
 
@@ -326,7 +326,7 @@ section_class.prototype.mk_marker = function() {
     if (main.marker != this) {
         main.update_marker(this);
     } else {
-               // If currently the marker
+        // If currently the marker
         main.marker = null;
 
         main.connect('POST', 'class=course&field=marker', null, 'value=0');
@@ -351,8 +351,8 @@ section_class.prototype.get_resource_index = function(el) {
     for (var x=0; x<this.resources.length; x++) {
         if (this.resources[x] == el) {
             return x;
-               }
-       }
+        }
+    }
     YAHOO.log("Could not find resource to remove "+el.getEl().id, "error");
     return -1;
 }
@@ -371,7 +371,7 @@ section_class.prototype.remove_resource = function(el) {
     if (resourceCount == 1) {
         if (this.resources[0] == el) {
             this.resources = new Array();
-               }
+        }
     } else {
         var found = false;
         for (var i=0; i<resourceCount; i++) {
@@ -390,13 +390,13 @@ section_class.prototype.remove_resource = function(el) {
     // Remove any extra text nodes to keep DOM clean.
     var kids = parentEl.childNodes;
 
-       for (var i=0; i<kids.length; i++) {
-           if (kids[i].nodeType == 3) {
-               YAHOO.log('Removed extra text node.');
-               parentEl.removeChild(kids[i]);
-           }
-       }
-       parentEl.removeChild(resourceEl);
+    for (var i=0; i<kids.length; i++) {
+        if (kids[i].nodeType == 3) {
+            YAHOO.log('Removed extra text node.');
+            parentEl.removeChild(kids[i]);
+        }
+    }
+    parentEl.removeChild(resourceEl);
 
     this.write_sequence_list();
     return true;
@@ -409,15 +409,15 @@ section_class.prototype.insert_resource = function(el, targetel) {
     var tempStore = nextStore = null;
 
     //update in backend
-       var targetId = '';
-       if (targetel) {
-               targetId = targetel.id;
-       }
-       if (this.debug) {
-               YAHOO.log('id='+el.id+', beforeId='+targetId+', sectionId='+this.sectionId);
-       }
-       main.connect('POST', 'class=resource&field=move', null,
-                       'id='+el.id+'&beforeId='+targetId+'&sectionId='+this.sectionId);
+    var targetId = '';
+    if (targetel) {
+        targetId = targetel.id;
+    }
+    if (this.debug) {
+        YAHOO.log('id='+el.id+', beforeId='+targetId+', sectionId='+this.sectionId);
+    }
+    main.connect('POST', 'class=resource&field=move', null,
+            'id='+el.id+'&beforeId='+targetId+'&sectionId='+this.sectionId);
 
     //if inserting into a hidden resource hide
     if (this.hidden) {
@@ -438,7 +438,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
                 tempStore = this.resources[i];
                 this.resources[i] = nextStore;
                 nextStore = tempStore;
-                               
+
                 if (nextStore != null)     
                     nextStore.update_index(i+1); 
 
@@ -452,7 +452,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
                 nextStore.update_index(i + 1); 
             }                              
         }
-       }
+    }
     //update on frontend
     if (targetel) {
         this.resources_ul.insertBefore(el.getEl(), targetel.getEl());
@@ -472,11 +472,11 @@ section_class.prototype.write_sequence_list = function(toReturn) {
         listOutput += this.resources[i].id;
         if (i != (this.resources.length-1)) {
             listOutput += ',';
-               }
+        }
     }
     if (toReturn) {
         return listOutput;
-       }
+    }
 }
 
 
@@ -501,10 +501,10 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
         return; 
     }
 
-       // Some constants.
-       this.NOGROUPS = 0;
-       this.SEPARATEGROUPS = 1;
-       this.VISIBLEGROUPS = 2;
+    // Some constants.
+    this.NOGROUPS = 0;
+    this.SEPARATEGROUPS = 1;
+    this.VISIBLEGROUPS = 2;
 
     this.is = 'resource';  
     this.init(id, group, config);
@@ -516,26 +516,26 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
     this.hidden = false;
     if (YAHOO.util.Dom.hasClass(this.getEl().getElementsByTagName('a')[0], 'dimmed')) {
         this.hidden = true;
-       }
+    }
     this.hiddenStored = null;
 
-       this.groupmode = null;          // Can be null (i.e. does not apply), 0, 1 or 2.
+    this.groupmode = null;  // Can be null (i.e. does not apply), 0, 1 or 2.
 
     this.linkContainer = this.getEl().getElementsByTagName('a')[0];
 
     this.commandContainer = null;
-       this.indentLeftButton = null;
-       this.indentRightButton = null;
+    this.indentLeftButton = null;
+    this.indentRightButton = null;
     this.viewButton = null;
-       this.groupButton = null;
+    this.groupButton = null;
     this.handle = null;
     this.init_buttons();
 
     this.parentObj = parentObj;
 
     if (this.debug) {
-               YAHOO.log("init_resource "+id+" parent = "+parentObj.getEl().id);
-       }
+        YAHOO.log("init_resource "+id+" parent = "+parentObj.getEl().id);
+    }
 }
 
 
@@ -558,76 +558,77 @@ resource_class.prototype.init_resource = function(id, group, config, parentObj)
  */
 resource_class.prototype.init_buttons = function() {
 
-       var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
-                                                       'span', this.getEl())[0];
+    var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
+            'span', this.getEl())[0];
 
     if (commandContainer == null) {
         YAHOO.log('Cannot find command container for '+this.getEl().id, 'error');
         return;
     }
 
-       // Language strings.
-       var strgroupsnone = main.portal.strings['groupsnone']+' ('+main.portal.strings['clicktochange']+')';
-       var strgroupsseparate = main.portal.strings['groupsseparate']+' ('+main.portal.strings['clicktochange']+')';
-       var strgroupsvisible = main.portal.strings['groupsvisible']+' ('+main.portal.strings['clicktochange']+')';
+    // Language strings.
+    var strgroupsnone = main.portal.strings['groupsnone']+' ('+main.portal.strings['clicktochange']+')';
+    var strgroupsseparate = main.portal.strings['groupsseparate']+' ('+main.portal.strings['clicktochange']+')';
+    var strgroupsvisible = main.portal.strings['groupsvisible']+' ('+main.portal.strings['clicktochange']+')';
 
     this.commandContainer = commandContainer;
-       var buttons = commandContainer.getElementsByTagName('a');
+    var buttons = commandContainer.getElementsByTagName('a');
 
     // Buttons that we might need to add back in.
-       var moveLeft = false;
-       var moveRight = false;
+    var moveLeft = false;
+    var moveRight = false;
     var updateButton = null;
 
     for (var x=0; x<buttons.length; x++) {
-               if (buttons[x].className == 'editing_moveleft') {
+        if (buttons[x].className == 'editing_moveleft') {
             moveLeft = true;
         } else if (buttons[x].className == 'editing_moveright') {
             moveRight = true;
         } else if (buttons[x].className == 'editing_update') {
             updateButton = buttons[x].cloneNode(true);
         } else if (buttons[x].className == 'editing_groupsnone') {
-                       this.groupmode = this.NOGROUPS;
-               } else if (buttons[x].className == 'editing_groupsseparate') {
-                       this.groupmode = this.SEPARATEGROUPS;
-               } else if (buttons[x].className == 'editing_groupsvisible') {
-                       this.groupmode = this.VISIBLEGROUPS;
-               }
+            this.groupmode = this.NOGROUPS;
+        } else if (buttons[x].className == 'editing_groupsseparate') {
+            this.groupmode = this.SEPARATEGROUPS;
+        } else if (buttons[x].className == 'editing_groupsvisible') {
+            this.groupmode = this.VISIBLEGROUPS;
+        }
     }
 
     if (updateButton == null) {
-               // Update button must always be present.
+        // Update button must always be present.
         YAHOO.log('Cannot find updateButton for '+this.getEl().id, 'error');
-       }
+    }
 
-       // Clear all the buttons.
+    // Clear all the buttons.
     commandContainer.innerHTML = '';
 
     // Add move-handle for drag and drop.
     var handleRef = main.mk_button('a', '/i/move_2d.gif',
-                       [['style', 'cursor:move'], ['title', main.portal.strings['move']]],
-                       [['height', '11'], ['width', '11'], ['style', 'margin-right:3px; border:0;']]);
+            [['style', 'cursor:move'], ['title', main.portal.strings['move']]],
+            [['height', '11'], ['width', '11'], ['style', 'margin-right:3px; border:0;']]);
 
     YAHOO.util.Dom.generateId(handleRef, 'sectionHandle');
     this.handle = handleRef;
     commandContainer.appendChild(handleRef);
     this.setHandleElId(this.handle.id);
 
-       // Add indentation buttons if needed (move left, move right).
-       if (moveLeft) {
-               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.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 indentation buttons if needed (move left, move right).
+    if (moveLeft) {
+        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.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.
     commandContainer.appendChild(updateButton);
@@ -637,99 +638,99 @@ resource_class.prototype.init_buttons = function() {
     YAHOO.util.Event.addListener(button, 'click', this.delete_button, this, true);
     commandContainer.appendChild(button);
 
-       // Add the hide or show button.
+    // Add the hide or show button.
     if (this.hidden) {
         var button = main.mk_button('a', '/t/show.gif');
-       } else {
+    } else {
         var button = main.mk_button('a', '/t/hide.gif');
-       }
+    }
     YAHOO.util.Event.addListener(button, 'click', this.toggle_hide, this, true);
     commandContainer.appendChild(button);
     this.viewButton = button;
 
-       // Add the groupmode button if needed.
-       if (this.groupmode != null) {
-               if (this.groupmode == this.NOGROUPS) {
-                       var button = main.mk_button('a', '/t/groupn.gif', [['title', strgroupsnone]]);
-               } else if (this.groupmode == this.SEPARATEGROUPS) {
-                       var button = main.mk_button('a', '/t/groups.gif', [['title', strgroupsseparate]]);
-               } else {
-                       var button = main.mk_button('a', '/t/groupv.gif', [['title', strgroupsvisible]]);
-               }
-           YAHOO.util.Event.addListener(button, 'click', this.toggle_groupmode, this, true);
-           commandContainer.appendChild(button);
-               this.groupButton = button;
-       }
+    // Add the groupmode button if needed.
+    if (this.groupmode != null) {
+        if (this.groupmode == this.NOGROUPS) {
+            var button = main.mk_button('a', '/t/groupn.gif', [['title', strgroupsnone]]);
+        } else if (this.groupmode == this.SEPARATEGROUPS) {
+            var button = main.mk_button('a', '/t/groups.gif', [['title', strgroupsseparate]]);
+        } else {
+            var button = main.mk_button('a', '/t/groupv.gif', [['title', strgroupsvisible]]);
+        }
+        YAHOO.util.Event.addListener(button, 'click', this.toggle_groupmode, this, true);
+        commandContainer.appendChild(button);
+        this.groupButton = button;
+    }
 }    
 
 
 resource_class.prototype.indent_left = function() {
 
-       var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
-                                       'img', this.getEl())[0];
-       if (!spacer) {
-           if (this.debug) {
-               YAHOO.log('Could not indent left: spacer image does not exist', 'error');
-           }
-               return false;
-       }
-       if (spacer.width > 20) {
-               spacer.width -= 20;
-       } else {
-               // Remove the spacer.
-               resource = this.getEl();
-               resource.removeChild(spacer);
-               
-               // Remove the indent left button as well.
-               var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
-                                                               'span', this.getEl())[0];
-
-               commandContainer.removeChild(this.indentLeftButton);
-               this.indentLeftButton = null;
-       }
-       main.connect('POST', 'class=resource&field=indentleft', null, 'id='+this.id);
-       return true;
+    var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
+            'img', this.getEl())[0];
+    if (!spacer) {
+        if (this.debug) {
+            YAHOO.log('Could not indent left: spacer image does not exist', 'error');
+        }
+        return false;
+    }
+    if (spacer.width > 20) {
+        spacer.width -= 20;
+    } else {
+        // Remove the spacer.
+        resource = this.getEl();
+        resource.removeChild(spacer);
+
+        // Remove the indent left button as well.
+        var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
+                'span', this.getEl())[0];
+
+        commandContainer.removeChild(this.indentLeftButton);
+        this.indentLeftButton = null;
+    }
+    main.connect('POST', 'class=resource&field=indentleft', null, 'id='+this.id);
+    return true;
 }
 
 
 resource_class.prototype.indent_right = function() {
 
-       var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
-                                       'img', this.getEl())[0];
-       if (!spacer) {
-               var spacer = document.createElement('img');
-
-               spacer.setAttribute('src', main.portal.strings['pixpath']+'/spacer.gif');
-               spacer.className = 'spacer';
-               spacer.setAttribute('width', '20');
-               spacer.setAttribute('height', '12');
-               
-               var resource = this.getEl();
-               resource.insertBefore(spacer, resource.childNodes[0]);
-       } else {
-               spacer.width += 20;
-       }
-       // Add a indent left button if none is present.
-       var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
-                                                       'span', this.getEl())[0];
-
-       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, this.indentRightButton);
-               this.indentLeftButton = button;
-       }
-       main.connect('POST', 'class=resource&field=indentright', null, 'id='+this.id);
-       return true;
+    var spacer = YAHOO.util.Dom.getElementsByClassName('spacer',
+            'img', this.getEl())[0];
+    if (!spacer) {
+        var spacer = document.createElement('img');
+
+        spacer.setAttribute('src', main.portal.strings['pixpath']+'/spacer.gif');
+        spacer.className = 'spacer';
+        spacer.setAttribute('width', '20');
+        spacer.setAttribute('height', '12');
+
+        var resource = this.getEl();
+        resource.insertBefore(spacer, resource.childNodes[0]);
+    } else {
+        spacer.width += 20;
+    }
+    // Add a indent left button if none is present.
+    var commandContainer = YAHOO.util.Dom.getElementsByClassName('commands',
+            'span', this.getEl())[0];
+
+    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, this.indentRightButton);
+        this.indentLeftButton = button;
+    }
+    main.connect('POST', 'class=resource&field=indentright', null, 'id='+this.id);
+    return true;
 }
 
 
 resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
     if (force != null) {
         if (this.debug) {
-                       YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
-               }
+            YAHOO.log("Resource "+this.getEl().id+" forced to "+force);
+        }
         this.hidden = !force;           
     }
     if (this.hidden) {
@@ -759,8 +760,8 @@ resource_class.prototype.toggle_groupmode = function() {
     this.groupmode++;
     if (this.groupmode > 2) {
         this.groupmode = 0;
-       }
-    
+    }
+
     var newtitle = this.groupButton.getElementsByTagName('img')[0].title;
 
     switch (this.groupmode) {
@@ -784,8 +785,8 @@ resource_class.prototype.toggle_groupmode = function() {
 
 resource_class.prototype.delete_button = function() {
     if (this.debug) {
-               YAHOO.log("Deleting "+this.getEl().id+" from parent "+this.parentObj.getEl().id);
-       }
+    YAHOO.log("Deleting "+this.getEl().id+" from parent "+this.parentObj.getEl().id);
+    }
     if (!confirm(main.getString('deletecheck', main.getString(this.is)+" "+this.id))) {
         return false;
     }
@@ -796,8 +797,8 @@ resource_class.prototype.delete_button = function() {
 
 resource_class.prototype.update_index = function(index) {
     if (this.debug) {
-               YAHOO.log("Updating Index for resource "+this.getEl().id+" to "+index);
-       }
+        YAHOO.log("Updating Index for resource "+this.getEl().id+" to "+index);
+    }
 }
 
 
@@ -805,71 +806,71 @@ resource_class.prototype.startDrag = function(x, y) {
     YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
 
     //reinitialize dd element
-       this.getDragEl().innerHTML = '';
+    this.getDragEl().innerHTML = '';
 
     var targets = YAHOO.util.DDM.getRelated(this, true);
     if (this.debug) {
-               YAHOO.log(this.id + " startDrag "+targets.length + " targets");
-       }
+        YAHOO.log(this.id + " startDrag "+targets.length + " targets");
+    }
 }
 
 
 resource_class.prototype.clear_move_markers = function(target) {
-       if (target.is == 'section') {
-               resources = target.resources;
-       } else {
-               resources = target.parentObj.resources;
-       }
-       for (var i=0; i<resources.length; i++) {
-               YAHOO.util.Dom.setStyle(resources[i].getEl().id, 'border', 'none');
-       }
+    if (target.is == 'section') {
+        resources = target.resources;
+    } else {
+        resources = target.parentObj.resources;
+    }
+    for (var i=0; i<resources.length; i++) {
+        YAHOO.util.Dom.setStyle(resources[i].getEl().id, 'border', 'none');
+    }
 }
 
 
 resource_class.prototype.onDragOver = function(e, ids) {
-       var target = YAHOO.util.DDM.getBestMatch(ids);
-       
-       this.clear_move_markers(target);
-       
-       if (target != this && (target.is == 'resource' || target.is == 'activity')) {
-               // Add a top border to show where the drop will place the resource.
-               YAHOO.util.Dom.setStyle(target.getEl().id, 'border-top', '1px solid #BBB');
-       } else if (target.is == 'section' && target.resources.length > 0) {
-               // We need to have a border at the bottom of the last activity in
-               // that section.
-               YAHOO.util.Dom.setStyle(target.resources[target.resources.length - 1].getEl().id,
-                                                               'border-bottom', '1px solid #BBB');
-       }
+    var target = YAHOO.util.DDM.getBestMatch(ids);
+
+    this.clear_move_markers(target);
+
+    if (target != this && (target.is == 'resource' || target.is == 'activity')) {
+        // Add a top border to show where the drop will place the resource.
+        YAHOO.util.Dom.setStyle(target.getEl().id, 'border-top', '1px solid #BBB');
+    } else if (target.is == 'section' && target.resources.length > 0) {
+        // We need to have a border at the bottom of the last activity in
+        // that section.
+        YAHOO.util.Dom.setStyle(target.resources[target.resources.length - 1].getEl().id,
+                'border-bottom', '1px solid #BBB');
+    }
 }
 
 
 resource_class.prototype.onDragOut = function(e, ids) {
-       var target = YAHOO.util.DDM.getBestMatch(ids);
-       if (target) {
-               this.clear_move_markers(target);
-       }
+    var target = YAHOO.util.DDM.getBestMatch(ids);
+    if (target) {
+        this.clear_move_markers(target);
+    }
 }
 
 
 resource_class.prototype.onDragDrop = function(e, ids) {
-       var target = YAHOO.util.DDM.getBestMatch(ids);
-       if (!target) {
-               YAHOO.log('onDragDrop: Target is not valid!', 'error');
-       }
+    var target = YAHOO.util.DDM.getBestMatch(ids);
+    if (!target) {
+        YAHOO.log('onDragDrop: Target is not valid!', 'error');
+    }
 
     if (this.debug) {
-               YAHOO.log("Dropped on section id="+target.sectionId
-                                               +", el="+this.getEl().id
-                                               +", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
-       }
+        YAHOO.log("Dropped on section id="+target.sectionId
+                +", el="+this.getEl().id
+                +", x="+YAHOO.util.Dom.getXY( this.getDragEl() ));
+    }
     this.parentObj.remove_resource(this);
 
     if (target.is == 'resource' || target.is == 'activity') {
         target.parentObj.insert_resource(this, target);
     } else if (target.is == 'section') {
-               target.insert_resource(this);
+        target.insert_resource(this);
     }
-       this.clear_move_markers(target);
+    this.clear_move_markers(target);
     return;
 }