Subversion Repositories Applications.projet

Rev

Rev 264 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or                                        |
// | modify it under the terms of the GNU General Public                                                  |
// | License as published by the Free Software Foundation; either                                         |
// | version 2.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library is distributed in the hope that it will be useful,                                      |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
// | General Public License for more details.                                                             |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public                                            |
// | License along with this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: telechargement.js,v 1.2 2007-06-25 12:15:07 alexandre_tb Exp $
/**
* Application projet
*
* La service de telechargement
*
*@package projet
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2007
*@version       $Revision: 1.2 $
// +------------------------------------------------------------------------------------------------------+
*/
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'];
            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');
        
        // On ouvre le noeud racine
        var rootNode = dojo.widget.manager.getWidgetById('rootNode');
        rootNode.expand();    
}

dojo.addOnLoad(init);