From: vyshane Date: Fri, 17 Nov 2006 09:09:25 +0000 (+0000) Subject: Merged from 1.7. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a66ddf195f9c091fbb6e1878d1658e947f744ebb;p=moodle.git Merged from 1.7. --- diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index f4b64df504..13b5c9a16e 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -77,6 +77,7 @@ section_class.prototype.init_section = function(id, group, config, isDraggable) } } + section_class.prototype.init_buttons = function() { var commandContainer = this.getEl().childNodes[2]; @@ -98,6 +99,7 @@ section_class.prototype.init_buttons = function() { this.viewButton = viewbutton; } + section_class.prototype.add_handle = function() { var handleRef = main.mk_button('a', '/i/move_2d.gif', [['style','cursor:move']]); YAHOO.util.Dom.generateId(handleRef, 'sectionHandle'); @@ -108,6 +110,7 @@ section_class.prototype.add_handle = function() { this.setHandleElId(this.handle.id); } + section_class.prototype.process_section = function() { this.content_td = this.getEl().childNodes[1]; @@ -116,7 +119,7 @@ section_class.prototype.process_section = function() { main.marker = this; } - //create holder for display number for access later + // Create holder for display number for access later this.numberDisplay = document.createElement('div'); this.numberDisplay.innerHTML = this.getEl().childNodes[0].innerHTML; @@ -126,10 +129,11 @@ section_class.prototype.process_section = function() { 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); - //find/edit resources - + if (this.debug) { + 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'); @@ -152,6 +156,7 @@ section_class.prototype.process_section = function() { this.summary = YAHOO.util.Dom.getElementsByClassName('summary', null, this.getEl())[0].firstChild.data || ''; } + section_class.prototype.startDrag = function(x, y) { //operates in point mode YAHOO.util.DDM.mode = YAHOO.util.DDM.POINT; @@ -163,21 +168,28 @@ section_class.prototype.startDrag = function(x, y) { this.getDragEl().innerHTML = ''; 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"); + } } + section_class.prototype.onDragDrop = function(e, id) { // get the drag and drop object that was targeted 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 this.addToGroup('resources'); -} +} + + section_class.prototype.endDrag = function() { //nessicary to defeat default action @@ -185,6 +197,7 @@ section_class.prototype.endDrag = function() { this.addToGroup('resources'); } + section_class.prototype.move_to_section = function(target) { var tempTd = document.createElement('td'); var tempStore = null; @@ -240,6 +253,7 @@ section_class.prototype.move_to_section = function(target) { } } + section_class.prototype.swap_with_section = function(sectionIn) { var tmpStore = null; @@ -257,6 +271,7 @@ section_class.prototype.swap_with_section = function(sectionIn) { YAHOO.util.DDM.swapNode(this.getEl(), sectionIn.getEl()); } + section_class.prototype.toggle_hide = function(e,target,superficial) { if (this.hidden) { YAHOO.util.Dom.removeClass(this.getEl(), 'hidden'); @@ -286,6 +301,7 @@ section_class.prototype.toggle_hide = function(e,target,superficial) { } } + section_class.prototype.toggle_highlight = function() { if (this.highlighted) { YAHOO.util.Dom.removeClass(this.getEl(), 'current'); @@ -296,6 +312,7 @@ section_class.prototype.toggle_highlight = function() { } } + section_class.prototype.mk_marker = function() { if (main.marker != this) { main.update_marker(this); @@ -308,6 +325,7 @@ section_class.prototype.mk_marker = function() { } } + section_class.prototype.changeId = function(newId) { this.sectionId = newId; this.numberDisplay.firstChild.data = newId; @@ -319,6 +337,7 @@ section_class.prototype.changeId = function(newId) { } } + section_class.prototype.get_resource_index = function(el) { for (var x=0; x 2) {