Rev 1372 | Blame | Last modification | View Log | RSS feed
var dojoConfig = {
isDebug: true
};
dojo.require("dojo.widget.Tree");
dojo.require("dojo.widget.TreeNode");
dojo.require("dojo.widget.TreeSelector");
dojo.require("dojo.widget.TreeLoadingController");
dojo.require("dojo.event.*");
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'];
var url = window.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');
// On ouvre le noeud racine
rootNode.expand();
}
dojo.addOnLoad(init);