1322 |
alexandre_ |
1 |
var dojoConfig = {
|
|
|
2 |
isDebug: true
|
|
|
3 |
};
|
|
|
4 |
dojo.require("dojo.lang.*");
|
|
|
5 |
dojo.require("dojo.widget.*");
|
|
|
6 |
dojo.require("dojo.widget.Tree");
|
|
|
7 |
dojo.require("dojo.widget.TreeNode");
|
|
|
8 |
dojo.require("dojo.widget.TreeSelector");
|
|
|
9 |
dojo.require("dojo.widget.TreeLoadingController");
|
|
|
10 |
dojo.require("dojo.event.*");
|
|
|
11 |
dojo.require("dojo.io.*");
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
function treeSelectFired() {
|
|
|
15 |
|
|
|
16 |
// une reference vers treeSelector et vers le noeud selectionne
|
|
|
17 |
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
|
|
|
18 |
var treeNode = treeSelector.selectedNode;
|
|
|
19 |
|
|
|
20 |
// le noeud est il un repertoire
|
|
|
21 |
var isFolder = treeNode['isFolder'];
|
|
|
22 |
|
|
|
23 |
// Si non on dirige vers le document
|
|
|
24 |
if ( !isFolder) {
|
|
|
25 |
var link = treeNode['link'];
|
|
|
26 |
document.location.href= 'client/projet/fichiers/'+link;
|
|
|
27 |
}
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
function init() {
|
|
|
31 |
// une reference vers treeSelector
|
|
|
32 |
var treeSelector = dojo.widget.manager.getWidgetById('treeSelector');
|
|
|
33 |
|
|
|
34 |
// on connecte le select event a la fonction treeSelectFired() -->
|
|
|
35 |
dojo.event.connect(treeSelector,'select','treeSelectFired');
|
|
|
36 |
|
|
|
37 |
//ajout d'un listener à la suppression d'un noeud
|
|
|
38 |
dojo.event.topic.subscribe("nodeRemoved", ioDeplaceFichier) ;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
// envoie une requete asynchrone pour deplacer un fichier
|
|
|
43 |
|
|
|
44 |
function ioDeplaceFichier (message) {
|
|
|
45 |
var url = window.location.href ;
|
|
|
46 |
|
|
|
47 |
var arguments = {
|
|
|
48 |
url : url + "&service=serviceDeplacementFichier&enfant=" + message.child.objectId + "&parent=" + message.newParent.objectId,
|
|
|
49 |
mimetype: "text/json",
|
|
|
50 |
error : function (type, errObj) { alert ('erreur'); },
|
|
|
51 |
load : function (type, data, evt) {}
|
|
|
52 |
};
|
|
|
53 |
//var treeLoadingController = dojo.widget.manager.getWidgetById('treeController');
|
|
|
54 |
dojo.io.bind (arguments) ;
|
|
|
55 |
/*
|
|
|
56 |
alert (message.child.title +" enlevé de "+ message.oldParent.title +
|
|
|
57 |
" dans l'arbre " + message.oldTree.widgetId + " " + arguments.url +
|
|
|
58 |
"\n " + treeLoadingController.getRPCUrl(''));
|
|
|
59 |
*/
|
|
|
60 |
}
|
|
|
61 |
dojo.addOnLoad(init);
|