From: vyshane Date: Thu, 12 Oct 2006 07:35:55 +0000 (+0000) Subject: Merged from 1.7 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e1c15ef7c9d751976d5b68e04e98f807e8a1b783;p=moodle.git Merged from 1.7 --- diff --git a/lib/ajax/section_classes.js b/lib/ajax/section_classes.js index 42e5f047af..1616a00ad3 100755 --- a/lib/ajax/section_classes.js +++ b/lib/ajax/section_classes.js @@ -1,34 +1,42 @@ -/* - * library for ajaxcourse formats, the classes and related functions for sections and resources - * this library requires a 'main' object created in calling document +/** + * library for ajaxcourse formats, the classes and related functions for + * sections and resources. * - * $Id$ + * This library requires a 'main' object created in calling document. * + * $Id$ */ -function section_class(id,group,config,isDraggable) { - this.init_section(id,group,config,isDraggable); +/** + * section_class + */ +function section_class(id, group, config, isDraggable) { + this.init_section(id, group, config, isDraggable); } + YAHOO.extend(section_class, YAHOO.util.DDProxy); section_class.prototype.debug = true; -section_class.prototype.init_section = function(id, group,config,isDraggable) { - if (!id) { return; } // id would be the html id attribute. +section_class.prototype.init_section = function(id, group, config, isDraggable) { + + if (!id) { + return; + } this.is = 'section'; this.sectionId = null; // Section number. This is NOT the section id from // the database. if (!isDraggable) { - this.initTarget(id,group,config); + this.initTarget(id, group, config); this.removeFromGroup('sections'); - } else { - this.init(id,group,config); - this.handle = null; + } else { + this.init(id, group, config); + this.handle = null; } this.createFrame(); @@ -50,14 +58,15 @@ section_class.prototype.init_section = function(id, group,config,isDraggable) { this.showOnlyButton = null; this.init_buttons(); - if (isDraggable)this.add_handle(); - - if (this.debug)YAHOO.log("init_section "+id+" draggable="+isDraggable); - - - if (YAHOO.util.Dom.hasClass(this.getEl(),'hidden')) + if (isDraggable) { + this.add_handle(); + } + if (this.debug) { + YAHOO.log("init_section "+id+" draggable="+isDraggable); + } + if (YAHOO.util.Dom.hasClass(this.getEl(),'hidden')) { this.toggle_hide(null,null,true); - + } } section_class.prototype.init_buttons = function() { @@ -65,26 +74,25 @@ section_class.prototype.init_buttons = function() { //clear all but show only button var commandContainerCount = commandContainer.childNodes.length; - for (var i=(commandContainerCount-1);i>0;i--) { + for (var i=(commandContainerCount-1); i>0; i--) { commandContainer.removeChild(commandContainer.childNodes[i]) } if (!this.isWeekFormat) { - var highlightbutton = main.mk_button('div','/pix/i/marker.gif'); - YAHOO.util.Event.addListener(highlightbutton,'click',this.mk_marker,this,true); + var highlightbutton = main.mk_button('div', '/pix/i/marker.gif'); + YAHOO.util.Event.addListener(highlightbutton, 'click', this.mk_marker, this, true); commandContainer.appendChild(highlightbutton); this.highlightButton = highlightbutton; } - var viewbutton = main.mk_button('div','/pix/i/hide.gif'); - YAHOO.util.Event.addListener(viewbutton,'click',this.toggle_hide,this,true); + var viewbutton = main.mk_button('div', '/pix/i/hide.gif'); + YAHOO.util.Event.addListener(viewbutton, 'click', this.toggle_hide, this,true); commandContainer.appendChild(viewbutton); this.viewButton = viewbutton; } - section_class.prototype.add_handle = function() { - var handleRef = main.mk_button('div','/pix/i/move_2d.gif',[['style','cursor:move']]); - YAHOO.util.Dom.generateId(handleRef,'sectionHandle'); + var handleRef = main.mk_button('a', '/pix/i/move_2d.gif', [['style','cursor:move']]); + YAHOO.util.Dom.generateId(handleRef, 'sectionHandle'); this.handle = handleRef; @@ -92,7 +100,6 @@ section_class.prototype.add_handle = function() { this.setHandleElId(this.handle.id); } - section_class.prototype.process_section = function() { this.content_td = this.getEl().childNodes[1]; @@ -119,22 +126,22 @@ section_class.prototype.process_section = function() { if (this.resources_ul == null) { this.resources_ul = document.createElement('ul'); this.resources_ul.className='section'; - this.content_td.insertBefore(this.resources_ul, this.content_td.childNodes[2]); + this.content_td.insertBefore(this.resources_ul, this.content_td.childNodes[1]); } var resource_count = this.resources_ul.getElementsByTagName('li').length; for (var i=0;i 2) + if (this.currentGroup > 2) { this.currentGroup = 0; - + } this.groupButton.getElementsByTagName('img')[0].src = main.portal.wwwroot + this.groupImages[this.currentGroup]; main.connect('post','class=resource&field=groupmode',null,'value='+this.currentGroup+'&id='+this.id);