aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dijit/_tree
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dijit/_tree')
-rw-r--r--includes/js/dijit/_tree/Node.html12
-rw-r--r--includes/js/dijit/_tree/Tree.html3
-rw-r--r--includes/js/dijit/_tree/dndContainer.js150
-rw-r--r--includes/js/dijit/_tree/dndSelector.js171
-rw-r--r--includes/js/dijit/_tree/dndSource.js373
-rw-r--r--includes/js/dijit/_tree/model.js84
6 files changed, 793 insertions, 0 deletions
diff --git a/includes/js/dijit/_tree/Node.html b/includes/js/dijit/_tree/Node.html
new file mode 100644
index 0000000..00e49a5
--- /dev/null
+++ b/includes/js/dijit/_tree/Node.html
@@ -0,0 +1,12 @@
+<div class="dijitTreeNode" waiRole="presentation"
+ ><div dojoAttachPoint="rowNode" waiRole="presentation"
+ ><span dojoAttachPoint="expandoNode" class="dijitTreeExpando" waiRole="presentation"
+ ></span
+ ><span dojoAttachPoint="expandoNodeText" class="dijitExpandoText" waiRole="presentation"
+ ></span
+ ><div dojoAttachPoint="contentNode" class="dijitTreeContent" waiRole="presentation">
+ <div dojoAttachPoint="iconNode" class="dijitInline dijitTreeIcon" waiRole="presentation"></div>
+ <span dojoAttachPoint="labelNode" class="dijitTreeLabel" wairole="treeitem" tabindex="-1" waiState="selected-false" dojoAttachEvent="onfocus:_onNodeFocus"></span>
+ </div
+ ></div>
+</div>
diff --git a/includes/js/dijit/_tree/Tree.html b/includes/js/dijit/_tree/Tree.html
new file mode 100644
index 0000000..9b90f4e
--- /dev/null
+++ b/includes/js/dijit/_tree/Tree.html
@@ -0,0 +1,3 @@
+<div class="dijitTreeContainer" waiRole="tree"
+ dojoAttachEvent="onclick:_onClick,onkeypress:_onKeyPress">
+</div>
diff --git a/includes/js/dijit/_tree/dndContainer.js b/includes/js/dijit/_tree/dndContainer.js
new file mode 100644
index 0000000..308e5ea
--- /dev/null
+++ b/includes/js/dijit/_tree/dndContainer.js
@@ -0,0 +1,150 @@
+if(!dojo._hasResource["dijit._tree.dndContainer"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._tree.dndContainer"] = true;
+dojo.provide("dijit._tree.dndContainer");
+dojo.require("dojo.dnd.common");
+dojo.require("dojo.dnd.Container");
+
+dojo.declare("dijit._tree.dndContainer",
+ null,
+ {
+ constructor: function(tree, params){
+ // summary: a constructor of the Container
+ // tree: Node: node or node's id to build the container on
+ // params: Object: a dict of parameters, which gets mixed into the object
+ this.tree = tree;
+ this.node = tree.domNode; // TODO: rename; it's not a TreeNode but the whole Tree
+ dojo.mixin(this, params);
+
+ // class-specific variables
+ this.map = {};
+ this.current = null; // current TreeNode
+
+ // states
+ this.containerState = "";
+ dojo.addClass(this.node, "dojoDndContainer");
+
+ // mark up children
+ if(!(params && params._skipStartup)){
+ this.startup();
+ }
+
+ // set up events
+ this.events = [
+ dojo.connect(this.node, "onmouseover", this, "onMouseOver"),
+ dojo.connect(this.node, "onmouseout", this, "onMouseOut"),
+
+ // cancel text selection and text dragging
+ dojo.connect(this.node, "ondragstart", dojo, "stopEvent"),
+ dojo.connect(this.node, "onselectstart", dojo, "stopEvent")
+ ];
+ },
+
+
+ // abstract access to the map
+ getItem: function(/*String*/ key){
+ // summary: returns a data item by its key (id)
+ //console.log("Container getItem()", arguments,this.map, this.map[key], this.selection[key]);
+ return this.selection[key];
+ //return this.map[key]; // Object
+ },
+
+ // mouse events
+ onMouseOver: function(e){
+ // summary: event processor for onmouseover
+ // e: Event: mouse event
+
+ // handle when mouse has just moved over the Tree itself (not a TreeNode, but the Tree)
+ var rt = e.relatedTarget; // the previous location
+ while(rt){
+ if(rt == this.node){ break; }
+ try{
+ rt = rt.parentNode;
+ }catch(x){
+ rt = null;
+ }
+ }
+ if(!rt){
+ this._changeState("Container", "Over");
+ this.onOverEvent();
+ }
+
+ // code below is for handling depending on which TreeNode we are over
+ var n = this._getChildByEvent(e); // the TreeNode
+ if(this.current == n){ return; }
+ if(this.current){ this._removeItemClass(this.current, "Over"); }
+ if(n){ this._addItemClass(n, "Over"); }
+ this.current = n;
+ },
+
+ onMouseOut: function(e){
+ // summary: event processor for onmouseout
+ // e: Event: mouse event
+ for(var n = e.relatedTarget; n;){
+ if(n == this.node){ return; }
+ try{
+ n = n.parentNode;
+ }catch(x){
+ n = null;
+ }
+ }
+ if(this.current){
+ this._removeItemClass(this.current, "Over");
+ this.current = null;
+ }
+ this._changeState("Container", "");
+ this.onOutEvent();
+ },
+
+ _changeState: function(type, newState){
+ // summary: changes a named state to new state value
+ // type: String: a name of the state to change
+ // newState: String: new state
+ var prefix = "dojoDnd" + type;
+ var state = type.toLowerCase() + "State";
+ //dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
+ dojo.removeClass(this.node, prefix + this[state]);
+ dojo.addClass(this.node, prefix + newState);
+ this[state] = newState;
+ },
+
+ _getChildByEvent: function(e){
+ // summary: gets a child, which is under the mouse at the moment, or null
+ // e: Event: a mouse event
+ var node = e.target;
+ if(node){
+ for(var parent = node.parentNode; parent; node = parent, parent = node.parentNode){
+ if(dojo.hasClass(node, "dijitTreeContent")){ return node; }
+ }
+ }
+ return null;
+ },
+
+ markupFactory: function(tree, params){
+ params._skipStartup = true;
+ return new dijit._tree.dndContainer(tree, params);
+ },
+
+ _addItemClass: function(node, type){
+ // summary: adds a class with prefix "dojoDndItem"
+ // node: Node: a node
+ // type: String: a variable suffix for a class name
+ dojo.addClass(node, "dojoDndItem" + type);
+ },
+
+ _removeItemClass: function(node, type){
+ // summary: removes a class with prefix "dojoDndItem"
+ // node: Node: a node
+ // type: String: a variable suffix for a class name
+ dojo.removeClass(node, "dojoDndItem" + type);
+ },
+
+ onOverEvent: function(){
+ // summary: this function is called once, when mouse is over our container
+ },
+
+ onOutEvent: function(){
+ // summary: this function is called once, when mouse is out of our container
+ }
+});
+
+}
diff --git a/includes/js/dijit/_tree/dndSelector.js b/includes/js/dijit/_tree/dndSelector.js
new file mode 100644
index 0000000..b19210f
--- /dev/null
+++ b/includes/js/dijit/_tree/dndSelector.js
@@ -0,0 +1,171 @@
+if(!dojo._hasResource["dijit._tree.dndSelector"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._tree.dndSelector"] = true;
+dojo.provide("dijit._tree.dndSelector");
+dojo.require("dojo.dnd.common");
+dojo.require("dijit._tree.dndContainer");
+
+dojo.declare("dijit._tree.dndSelector",
+ dijit._tree.dndContainer,
+ {
+ constructor: function(tree, params){
+ this.selection={};
+ this.anchor = null;
+ this.simpleSelection=false;
+
+ this.events.push(
+ dojo.connect(this.tree.domNode, "onmousedown", this,"onMouseDown"),
+ dojo.connect(this.tree.domNode, "onmouseup", this,"onMouseUp")
+ );
+ },
+
+ // object attributes (for markup)
+ singular: false, // is singular property
+
+ // methods
+ getSelectedItems: function(){
+ var selectedItems = []
+ for (var i in this.selection){
+ selectedItems.push(dijit.getEnclosingWidget(this.selection[i]).item);
+ }
+ return selectedItems;
+ },
+
+ getSelectedNodes: function(){
+ return this.selection;
+ },
+
+ selectNone: function(){
+ // summary: unselects all items
+ return this._removeSelection()._removeAnchor(); // self
+ },
+
+ insertItems: function(item, parent){
+ // summary: inserts new data items (see Container's insertNodes method for details)
+
+ //we actually need to add things to the store here instead of adding noes to the tree directly
+ },
+
+ destroy: function(){
+ // summary: prepares the object to be garbage-collected
+ dojo.dnd.Selector.superclass.destroy.call(this);
+ this.selection = this.anchor = null;
+ },
+
+ // mouse events
+ onMouseDown: function(e){
+ // summary: event processor for onmousedown
+ // e: Event: mouse event
+ if(!this.current){ return; }
+
+ var item = dijit.getEnclosingWidget(this.current).item
+ var id = this.tree.model.getIdentity(item);
+
+ if (!this.current.id) {
+ this.current.id=id;
+ }
+
+ if (!this.current.type) {
+ this.current.type="data";
+ }
+
+ if(!this.singular && !dojo.dnd.getCopyKeyState(e) && !e.shiftKey && (this.current.id in this.selection)){
+ this.simpleSelection = true;
+ dojo.stopEvent(e);
+ return;
+ }
+
+ if(this.singular){
+ if(this.anchor == this.current){
+ if(dojo.dnd.getCopyKeyState(e)){
+ this.selectNone();
+ }
+ }else{
+ this.selectNone();
+ this.anchor = this.current;
+ this._addItemClass(this.anchor, "Anchor");
+
+ this.selection[this.current.id] = this.current;
+ }
+ }else{
+ if(!this.singular && e.shiftKey){
+ if (dojo.dnd.getCopyKeyState(e)){
+ //TODO add range to selection
+ }else{
+ //TODO select new range from anchor
+ }
+ }else{
+ if(dojo.dnd.getCopyKeyState(e)){
+ if(this.anchor == this.current){
+ delete this.selection[this.anchor.id];
+ this._removeAnchor();
+ }else{
+ if(this.current.id in this.selection){
+ this._removeItemClass(this.current, "Selected");
+ delete this.selection[this.current.id];
+ }else{
+ if(this.anchor){
+ this._removeItemClass(this.anchor, "Anchor");
+ this._addItemClass(this.anchor, "Selected");
+ }
+ this.anchor = this.current;
+ this._addItemClass(this.current, "Anchor");
+ this.selection[this.current.id] = this.current;
+ }
+ }
+ }else{
+ var item = dijit.getEnclosingWidget(this.current).item
+ var id = this.tree.model.getIdentity(item);
+ if(!(id in this.selection)){
+ this.selectNone();
+ this.anchor = this.current;
+ this._addItemClass(this.current, "Anchor");
+ this.selection[id] = this.current;
+ }
+ }
+ }
+ }
+
+ dojo.stopEvent(e);
+ },
+
+ onMouseMove: function() {
+
+ },
+
+ onOverEvent: function() {
+ this.onmousemoveEvent = dojo.connect(this.node, "onmousemove", this, "onMouseMove");
+ },
+
+ onMouseUp: function(e){
+ // summary: event processor for onmouseup
+ // e: Event: mouse event
+ if(!this.simpleSelection){ return; }
+ this.simpleSelection = false;
+ this.selectNone();
+ if(this.current){
+ this.anchor = this.current;
+ this._addItemClass(this.anchor, "Anchor");
+ this.selection[this.current.id] = this.current;
+ }
+ },
+ _removeSelection: function(){
+ // summary: unselects all items
+ var e = dojo.dnd._empty;
+ for(var i in this.selection){
+ if(i in e){ continue; }
+ var node = dojo.byId(i);
+ if(node){ this._removeItemClass(node, "Selected"); }
+ }
+ this.selection = {};
+ return this; // self
+ },
+ _removeAnchor: function(){
+ if(this.anchor){
+ this._removeItemClass(this.anchor, "Anchor");
+ this.anchor = null;
+ }
+ return this; // self
+ }
+});
+
+}
diff --git a/includes/js/dijit/_tree/dndSource.js b/includes/js/dijit/_tree/dndSource.js
new file mode 100644
index 0000000..ccb91ad
--- /dev/null
+++ b/includes/js/dijit/_tree/dndSource.js
@@ -0,0 +1,373 @@
+if(!dojo._hasResource["dijit._tree.dndSource"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit._tree.dndSource"] = true;
+dojo.provide("dijit._tree.dndSource");
+
+dojo.require("dijit._tree.dndSelector");
+dojo.require("dojo.dnd.Manager");
+
+dojo.declare("dijit._tree.dndSource", dijit._tree.dndSelector, {
+ // summary: a Source object, which can be used as a DnD source, or a DnD target
+
+ // object attributes (for markup)
+ isSource: true,
+ copyOnly: false,
+ skipForm: false,
+ accept: ["text"],
+
+ constructor: function(tree, params){
+ // summary: a constructor of the Source
+ // tree: dijit.Tree: the tree widget to build the source on
+ // params: Object: a dict of parameters, recognized parameters are:
+ // isSource: Boolean: can be used as a DnD source, if true; assumed to be "true" if omitted
+ // accept: Array: list of accepted types (text strings) for a target; assumed to be ["text"] if omitted
+ // horizontal: Boolean: a horizontal container, if true, vertical otherwise or when omitted
+ // copyOnly: Boolean: always copy items, if true, use a state of Ctrl key otherwise
+ // skipForm: Boolean: don't start the drag operation, if clicked on form elements
+ // the rest of parameters are passed to the selector
+ if(!params){ params = {}; }
+ dojo.mixin(this, params);
+ this.isSource = typeof params.isSource == "undefined" ? true : params.isSource;
+ var type = params.accept instanceof Array ? params.accept : ["text"];
+ this.accept = null;
+ if(type.length){
+ this.accept = {};
+ for(var i = 0; i < type.length; ++i){
+ this.accept[type[i]] = 1;
+ }
+ }
+
+ // class-specific variables
+ this.isDragging = false;
+ this.mouseDown = false;
+ this.targetAnchor = null;
+ this.targetBox = null;
+ this.before = true;
+
+ // states
+ this.sourceState = "";
+ if(this.isSource){
+ dojo.addClass(this.node, "dojoDndSource");
+ }
+ this.targetState = "";
+ if(this.accept){
+ dojo.addClass(this.node, "dojoDndTarget");
+ }
+ if(this.horizontal){
+ dojo.addClass(this.node, "dojoDndHorizontal");
+ }
+ // set up events
+ this.topics = [
+ dojo.subscribe("/dnd/source/over", this, "onDndSourceOver"),
+ dojo.subscribe("/dnd/start", this, "onDndStart"),
+ dojo.subscribe("/dnd/drop", this, "onDndDrop"),
+ dojo.subscribe("/dnd/cancel", this, "onDndCancel")
+ ];
+ },
+
+ startup: function(){
+ },
+
+ // methods
+ checkAcceptance: function(source, nodes){
+ // summary: checks, if the target can accept nodes from this source
+ // source: Object: the source which provides items
+ // nodes: Array: the list of transferred items
+ return true; // Boolean
+ },
+ copyState: function(keyPressed){
+ // summary: Returns true, if we need to copy items, false to move.
+ // It is separated to be overwritten dynamically, if needed.
+ // keyPressed: Boolean: the "copy" was pressed
+ return this.copyOnly || keyPressed; // Boolean
+ },
+ destroy: function(){
+ // summary: prepares the object to be garbage-collected
+ this.inherited("destroy",arguments);
+ dojo.forEach(this.topics, dojo.unsubscribe);
+ this.targetAnchor = null;
+ },
+
+ // markup methods
+ markupFactory: function(params, node){
+ params._skipStartup = true;
+ return new dijit._tree.dndSource(node, params);
+ },
+
+ // mouse event processors
+ onMouseMove: function(e){
+ // summary: event processor for onmousemove
+ // e: Event: mouse event
+ if(this.isDragging && this.targetState == "Disabled"){ return; }
+ this.inherited("onMouseMove", arguments);
+ var m = dojo.dnd.manager();
+ if(this.isDragging){
+ // calculate before/after
+
+ if (this.allowBetween){ // not implemented yet for tree since it has no concept of order
+ var before = false;
+ if(this.current){
+ if(!this.targetBox || this.targetAnchor != this.current){
+ this.targetBox = {
+ xy: dojo.coords(this.current, true),
+ w: this.current.offsetWidth,
+ h: this.current.offsetHeight
+ };
+ }
+ if(this.horizontal){
+ before = (e.pageX - this.targetBox.xy.x) < (this.targetBox.w / 2);
+ }else{
+ before = (e.pageY - this.targetBox.xy.y) < (this.targetBox.h / 2);
+ }
+ }
+ if(this.current != this.targetAnchor || before != this.before){
+ this._markTargetAnchor(before);
+ m.canDrop(!this.current || m.source != this || !(this.current.id in this.selection));
+ }
+ }
+ }else{
+ if(this.mouseDown && this.isSource){
+ var n = this.getSelectedNodes();
+ var nodes=[];
+ for (var i in n){
+ nodes.push(n[i]);
+ }
+ if(nodes.length){
+ m.startDrag(this, nodes, this.copyState(dojo.dnd.getCopyKeyState(e)));
+ }
+ }
+ }
+ },
+
+ onMouseDown: function(e){
+ // summary: event processor for onmousedown
+ // e: Event: mouse event
+ this.mouseDown = true;
+ this.mouseButton = e.button;
+ this.inherited("onMouseDown",arguments);
+ },
+
+ onMouseUp: function(e){
+ // summary: event processor for onmouseup
+ // e: Event: mouse event
+ if(this.mouseDown){
+ this.mouseDown = false;
+ this.inherited("onMouseUp",arguments);
+ }
+ },
+
+ onMouseOver: function(e){
+ // summary: event processor for onmouseover
+ // e: Event: mouse event
+
+ // handle when mouse has just moved over the Tree itself (not a TreeNode, but the Tree)
+ var rt = e.relatedTarget; // the previous location
+ while(rt){
+ if(rt == this.node){ break; }
+ try{
+ rt = rt.parentNode;
+ }catch(x){
+ rt = null;
+ }
+ }
+ if(!rt){
+ this._changeState("Container", "Over");
+ this.onOverEvent();
+ }
+
+ // code below is for handling depending on which TreeNode we are over
+ var n = this._getChildByEvent(e); // the TreeNode
+ if(this.current == n){ return; }
+ if(this.current){ this._removeItemClass(this.current, "Over"); }
+ var m = dojo.dnd.manager();
+ if(n){
+ this._addItemClass(n, "Over");
+ if(this.isDragging){
+ if(this.checkItemAcceptance(n,m.source)){
+ m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(n in this.selection)));
+ }else{
+ m.canDrop(false);
+ }
+ }
+ }else{
+ if(this.isDragging){
+ if (m.source && this.checkAcceptance(m.source,m.source.getSelectedNodes())){
+ m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(this.current.id in this.selection)));
+ }else{
+ m.canDrop(false);
+ }
+ }
+ }
+ this.current = n;
+ },
+
+ checkItemAcceptance: function(node, source){
+ // summary: stub funciton to be overridden if one wants to check for the ability to drop at the node/item level
+ return true;
+ },
+
+ // topic event processors
+ onDndSourceOver: function(source){
+ // summary: topic event processor for /dnd/source/over, called when detected a current source
+ // source: Object: the source which has the mouse over it
+ if(this != source){
+ this.mouseDown = false;
+ if(this.targetAnchor){
+ this._unmarkTargetAnchor();
+ }
+ }else if(this.isDragging){
+ var m = dojo.dnd.manager();
+ m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(this.current.id in this.selection)));
+ }
+ },
+ onDndStart: function(source, nodes, copy){
+ // summary: topic event processor for /dnd/start, called to initiate the DnD operation
+ // source: Object: the source which provides items
+ // nodes: Array: the list of transferred items
+ // copy: Boolean: copy items, if true, move items otherwise
+
+ if(this.isSource){
+ this._changeState("Source", this == source ? (copy ? "Copied" : "Moved") : "");
+ }
+ var accepted = this.checkAcceptance(source, nodes);
+
+ this._changeState("Target", accepted ? "" : "Disabled");
+
+ if(accepted){
+ dojo.dnd.manager().overSource(this);
+ }
+
+ this.isDragging = true;
+ },
+
+ itemCreator: function(nodes){
+ return dojo.map(nodes, function(node){
+ return {
+ "id": node.id,
+ "name": node.textContent || node.innerText || ""
+ };
+ });
+ },
+
+ onDndDrop: function(source, nodes, copy){
+ // summary:
+ // Topic event processor for /dnd/drop, called to finish the DnD operation..
+ // Updates data store items according to where node was dragged from and dropped
+ // to. The tree will then respond to those data store updates and redraw itself.
+ // source: Object: the source which provides items
+ // nodes: Array: the list of transferred items
+ // copy: Boolean: copy items, if true, move items otherwise
+
+ if(this.containerState == "Over"){
+ var tree = this.tree,
+ model = tree.model,
+ target = this.current,
+ requeryRoot = false; // set to true iff top level items change
+
+ this.isDragging = false;
+
+ // Compute the new parent item
+ var targetWidget = dijit.getEnclosingWidget(target),
+ newParentItem = (targetWidget && targetWidget.item) || tree.item;
+
+ // If we are dragging from another source (or at least, another source
+ // that points to a different data store), then we need to make new data
+ // store items for each element in nodes[]. This call get the parameters
+ // to pass to store.newItem()
+ var newItemsParams;
+ if(source != this){
+ newItemsParams = this.itemCreator(nodes, target);
+ }
+
+ dojo.forEach(nodes, function(node, idx){
+ if(source == this){
+ // This is a node from my own tree, and we are moving it, not copying.
+ // Remove item from old parent's children attribute.
+ // TODO: dijit._tree.dndSelector should implement deleteSelectedNodes()
+ // and this code should go there.
+ var childTreeNode = dijit.getEnclosingWidget(node),
+ childItem = childTreeNode.item,
+ oldParentItem = childTreeNode.getParent().item;
+
+ model.pasteItem(childItem, oldParentItem, newParentItem, copy);
+ }else{
+ model.newItem(newItemsParams[idx], newParentItem);
+ }
+ }, this);
+
+ // Expand the target node (if it's currently collapsed) so the user can see
+ // where their node was dropped. In particular since that node is still selected.
+ this.tree._expandNode(targetWidget);
+ }
+ this.onDndCancel();
+ },
+ onDndCancel: function(){
+ // summary: topic event processor for /dnd/cancel, called to cancel the DnD operation
+ if(this.targetAnchor){
+ this._unmarkTargetAnchor();
+ this.targetAnchor = null;
+ }
+ this.before = true;
+ this.isDragging = false;
+ this.mouseDown = false;
+ delete this.mouseButton;
+ this._changeState("Source", "");
+ this._changeState("Target", "");
+ },
+
+ // utilities
+
+ onOverEvent: function(){
+ // summary: this function is called once, when mouse is over our container
+ this.inherited("onOverEvent",arguments);
+ dojo.dnd.manager().overSource(this);
+ },
+ onOutEvent: function(){
+ // summary: this function is called once, when mouse is out of our container
+ this.inherited("onOutEvent",arguments);
+ dojo.dnd.manager().outSource(this);
+ },
+ _markTargetAnchor: function(before){
+ // summary: assigns a class to the current target anchor based on "before" status
+ // before: Boolean: insert before, if true, after otherwise
+ if(this.current == this.targetAnchor && this.before == before){ return; }
+ if(this.targetAnchor){
+ this._removeItemClass(this.targetAnchor, this.before ? "Before" : "After");
+ }
+ this.targetAnchor = this.current;
+ this.targetBox = null;
+ this.before = before;
+ if(this.targetAnchor){
+ this._addItemClass(this.targetAnchor, this.before ? "Before" : "After");
+ }
+ },
+ _unmarkTargetAnchor: function(){
+ // summary: removes a class of the current target anchor based on "before" status
+ if(!this.targetAnchor){ return; }
+ this._removeItemClass(this.targetAnchor, this.before ? "Before" : "After");
+ this.targetAnchor = null;
+ this.targetBox = null;
+ this.before = true;
+ },
+ _markDndStatus: function(copy){
+ // summary: changes source's state based on "copy" status
+ this._changeState("Source", copy ? "Copied" : "Moved");
+ }
+});
+
+dojo.declare("dijit._tree.dndTarget", dijit._tree.dndSource, {
+ // summary: a Target object, which can be used as a DnD target
+
+ constructor: function(node, params){
+ // summary: a constructor of the Target --- see the Source constructor for details
+ this.isSource = false;
+ dojo.removeClass(this.node, "dojoDndSource");
+ },
+
+ // markup methods
+ markupFactory: function(params, node){
+ params._skipStartup = true;
+ return new dijit._tree.dndTarget(node, params);
+ }
+});
+
+}
diff --git a/includes/js/dijit/_tree/model.js b/includes/js/dijit/_tree/model.js
new file mode 100644
index 0000000..5ef4ac1
--- /dev/null
+++ b/includes/js/dijit/_tree/model.js
@@ -0,0 +1,84 @@
+
+dojo.declare(
+ "dijit.tree.model",
+ null,
+{
+ // summary
+ // Contract for any data provider object for the tree. Tree
+ // passes in values to the constructor to specify the callbacks.
+ // "item" is typically a dojo.data.Item but it's just a black box so
+ // it could be anything.
+ //
+ // This (like dojo.data.api.Read) is just documentation, and not meant to be used.
+
+ destroy: function(){
+ // summary: destroys this object, releasing connections to the store
+ },
+
+ // =======================================================================
+ // Methods for traversing hierarchy
+
+ getRoot: function(onItem){
+ // summary:
+ // Calls onItem with the root item for the tree, possibly a fabricated item.
+ // Throws exception on error.
+ },
+
+ mayHaveChildren: function(/*dojo.data.Item*/ item){
+ // summary
+ // Tells if an item has or may have children. Implementing logic here
+ // avoids showing +/- expando icon for nodes that we know don't have children.
+ // (For efficiency reasons we may not want to check if an element actually
+ // has children until user clicks the expando node)
+ },
+
+ getChildren: function(/*dojo.data.Item*/ parentItem, /*function(items)*/ onComplete){
+ // summary
+ // Calls onComplete() with array of child items of given parent item, all loaded.
+ // Throws exception on error.
+ },
+
+ // =======================================================================
+ // Inspecting items
+
+ getIdentity: function(/* item */ item){
+ // summary: returns identity for an item
+ },
+
+ getLabel: function(/*dojo.data.Item*/ item){
+ // summary: get the label for an item
+ },
+
+ // =======================================================================
+ // Write interface
+
+ newItem: function(/* Object? */ args, /*Item?*/ parent){
+ // summary
+ // Creates a new item. See dojo.data.api.Write for details on args.
+ },
+
+ pasteItem: function(/*Item*/ childItem, /*Item*/ oldParentItem, /*Item*/ newParentItem, /*Boolean*/ bCopy){
+ // summary
+ // Move or copy an item from one parent item to another.
+ // Used in drag & drop.
+ // If oldParentItem is specified and bCopy is false, childItem is removed from oldParentItem.
+ // If newParentItem is specified, childItem is attached to newParentItem.
+ },
+
+ // =======================================================================
+ // Callbacks
+
+ onChange: function(/*dojo.data.Item*/ item){
+ // summary
+ // Callback whenever an item has changed, so that Tree
+ // can update the label, icon, etc. Note that changes
+ // to an item's children or parent(s) will trigger an
+ // onChildrenChange() so you can ignore those changes here.
+ },
+
+ onChildrenChange: function(/*dojo.data.Item*/ parent, /*dojo.data.Item[]*/ newChildrenList){
+ // summary
+ // Callback to do notifications about new, updated, or deleted items.
+ }
+});
+