Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1322 alexandre_ 1
var dojoConfig = {
2
isDebug: true
3
};
4
 
5
dojo.require("dojo.widget.Tree");
6
dojo.require("dojo.widget.TreeNode");
7
dojo.require("dojo.widget.TreeSelector");
8
dojo.require("dojo.widget.TreeLoadingController");
9
dojo.require("dojo.event.*");
10
 
11
 
12
function treeSelectFired() {
13
 
14
    // une reference vers treeSelector et vers le noeud selectionne
15
   	var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
16
   	var treeNode = treeSelector.selectedNode;
17
 
18
	// le noeud est il un repertoire
19
	var isFolder = treeNode['isFolder'];
20
 
21
	// Si non on dirige vers le document
22
	if ( !isFolder) {
23
		var link = treeNode['link'];
24
	    document.location.href= 'client/projet/fichiers/'+link;
25
	} else {
26
		var repertoire = dojo.widget.manager.getWidgetById('treeController');
27
		repertoire.expand(treeNode);
28
	}
29
}
30
 
31
function init() {
32
    // une reference vers treeSelector
33
    var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
34
 
35
    // on connecte le select event a la fonction treeSelectFired() -->
36
    dojo.event.connect(treeSelector,'select','treeSelectFired');
37
	var rootNode = dojo.widget.manager.getWidgetById('rootNode');
38
 
39
	// On ouvre le noeud racine
40
	rootNode.expand();
41
}
42
 
43
dojo.addOnLoad(init);