Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merged from 1.7.

  • Loading branch information...
commit a66ddf195f9c091fbb6e1878d1658e947f744ebb 1 parent d42c64b
vyshane authored
Showing with 47 additions and 14 deletions.
  1. +47 −14 lib/ajax/section_classes.js
View
61 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<this.resources.length; x++) {
if (this.resources[x] == el) {
@@ -329,6 +348,7 @@ section_class.prototype.get_resource_index = function(el) {
return -1;
}
+
section_class.prototype.remove_resource = function(el) {
var resourceCount = this.resources.length;
@@ -369,6 +389,7 @@ section_class.prototype.remove_resource = function(el) {
this.write_sequence_list();
}
+
section_class.prototype.insert_resource = function(el, targetel) {
var resourcecount = this.resources.length;
var found = false;
@@ -430,6 +451,7 @@ section_class.prototype.insert_resource = function(el, targetel) {
el.parentObj = this;
}
+
section_class.prototype.write_sequence_list = function(toReturn) {
var listOutput = '';
@@ -492,6 +514,7 @@ 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];
if (commandContainer == null) {
@@ -510,8 +533,9 @@ resource_class.prototype.init_buttons = function() {
}
}
- if (updateButton == null)
+ if (updateButton == null) {
YAHOO.log('Cannot find updateButton for '+this.getEl().id, 'error');
+ }
commandContainer.innerHTML = '';
@@ -543,6 +567,7 @@ resource_class.prototype.init_buttons = function() {
this.viewButton = button;
}
+
resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
if (force != null) {
if (this.debug) {
@@ -570,6 +595,7 @@ resource_class.prototype.toggle_hide = function(target, e, superficial, force) {
}
}
+
resource_class.prototype.delete_button = function() {
if (this.debug) {
YAHOO.log("Deleting "+this.getEl().id+" from parent "+this.parentObj.getEl().id);
@@ -583,12 +609,14 @@ resource_class.prototype.delete_button = function() {
main.connect('DELETE', 'class=resource&id='+this.id);
}
+
resource_class.prototype.update_index = function(index) {
if (this.debug) {
YAHOO.log("Updating Index for resource "+this.getEl().id+" to "+index);
}
}
+
resource_class.prototype.startDrag = function(x, y) {
YAHOO.util.DDM.mode = YAHOO.util.DDM.INTERSECT;
@@ -598,14 +626,10 @@ resource_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");
- /*
- for (var i=0; i<targets.length; i++) {
- YAHOO.log('target '+(i+1)+': '+targets[i].id);
- }
- */
}
}
+
resource_class.prototype.clear_move_markers = function(target) {
if (target.is == 'section') {
resources = target.resources;
@@ -617,6 +641,7 @@ resource_class.prototype.clear_move_markers = function(target) {
}
}
+
resource_class.prototype.onDragOver = function(e, ids) {
var target = YAHOO.util.DDM.getBestMatch(ids);
@@ -633,6 +658,7 @@ resource_class.prototype.onDragOver = function(e, ids) {
}
}
+
resource_class.prototype.onDragOut = function(e, ids) {
var target = YAHOO.util.DDM.getBestMatch(ids);
if (target) {
@@ -640,6 +666,7 @@ resource_class.prototype.onDragOut = function(e, ids) {
}
}
+
resource_class.prototype.onDragDrop = function(e, ids) {YAHOO.log('onDragDrop');
var target = YAHOO.util.DDM.getBestMatch(ids);
if (!target) {
@@ -662,11 +689,13 @@ resource_class.prototype.onDragDrop = function(e, ids) {YAHOO.log('onDragDrop');
return;
}
+
resource_class.prototype.endDrag = function() {
// Eliminates default action
}
+
/**
* activity_class extends resource class
*/
@@ -693,8 +722,10 @@ activity_class.prototype.init_activity = function(id, group, config, parentObj)
}
}
+
activity_class.prototype.groupImages = ['/t/groupn.gif', '/t/groups.gif', '/t/groupv.gif'];
+
activity_class.prototype.init_activity_button = function() {
var button = main.mk_button('a', this.groupImages[this.currentGroup]);
YAHOO.util.Event.addListener(button,'click',this.toggle_group,this,true);
@@ -702,6 +733,7 @@ activity_class.prototype.init_activity_button = function() {
this.groupButton = button;
}
+
activity_class.prototype.get_current_group = function(id) {
if (document.getElementById(id) == null) {
return;
@@ -717,6 +749,7 @@ activity_class.prototype.get_current_group = function(id) {
return 0;
}
+
activity_class.prototype.toggle_group = function() {
this.currentGroup++;
if (this.currentGroup > 2) {
Please sign in to comment.
Something went wrong with that request. Please try again.