Rev 1444 | Blame | Compare with Previous | Last modification | View Log | RSS feed
var dojoConfig = {
isDebug: true
};
dojo.require("dojo.lang.*");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Tree");
dojo.require("dojo.widget.TreeNode");
dojo.require("dojo.widget.TreeSelector");
dojo.require("dojo.widget.TreeLoadingController");
dojo.require("dojo.event.*");
dojo.require("dojo.io.*");
function treeSelectFired() {
// une reference vers treeSelector et vers le noeud selectionne
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
var treeNode = treeSelector.selectedNode;
// le noeud est il un repertoire
var isFolder = treeNode['isFolder'];
// Si non on dirige vers le document
if ( !isFolder) {
var link = treeNode['link'];
document.location.href= link;
} else {
var repertoire = dojo.widget.manager.getWidgetById('treeController');
repertoire.expand(treeNode);
}
}
function init() {
// une reference vers treeSelector
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
// on connecte le select event a la fonction treeSelectFired()
dojo.event.connect(treeSelector,'select','treeSelectFired');
var rootNode = dojo.widget.manager.getWidgetById('rootNode');
var loadingController = dojo.widget.manager.getWidgetById('treeController');
// L appel ci-dessous permet de charger les donnees du noeud racine
loadingController.loadRemote(rootNode);
// On ouvre le noeud racine
rootNode.expand();
//ajout d'un listener a la suppression d'un noeud
dojo.event.topic.subscribe("nodeRemoved", ioDeplaceFichier) ;
}
// envoie une requete asynchrone pour deplacer un fichier
function ioDeplaceFichier (message) {
var url = window.location.href ;
var arguments = {
url : url + "&service=serviceDeplacementFichier&enfant=" + message.child.objectId + "&parent=" + message.newParent.objectId,
mimetype: "text/json",
error : function (type, errObj) { alert ('erreur'); },
load : function (type, data, evt) {}
};
//var treeLoadingController = dojo.widget.manager.getWidgetById('treeController');
dojo.io.bind (arguments) ;
}
dojo.addOnLoad(init);