AllDocs
Modifié par XWikiGuest le 2009/09/05 11:53
Documents on this Wiki
<script type="text/javascript"> //<![CDATA[ var tree; function loadNodeData(node, fnLoadComplete) { var url = "/xwiki/bin/view/XWiki/Treeview?xpage=plain&nodeName="+node.label; var callback = { success: function(oResponse) { var xml = oResponse.responseXML; var results = xml.getElementsByTagName('results')[0].childNodes; for (var i = 0; i < results.length; i++) if (results[i].hasChildNodes()) { var nodeObject = {label: results[i].getAttribute('label'), href: results[i].childNodes[0].nodeValue}; var tempNode = new YAHOO.widget.TextNode(nodeObject, node, false); } oResponse.argument.fnLoadComplete(); }, failure: function(oResponse) { oResponse.argument.fnLoadComplete(); }, argument: { "node": node, "fnLoadComplete": fnLoadComplete }, timeout: 7000 }; YAHOO.util.Connect.asyncRequest('GET', url, callback); } function buildTree() { var tree = new YAHOO.widget.TreeView("treeview"); //turn dynamic loading on for entire tree: tree.setDynamicLoad(loadNodeData, 1); var root = tree.getRoot(); // Add spaces as top level nodes nodeObject = { label: "Blog", href:"/xwiki/bin/view/Blog/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Colab", href:"/xwiki/bin/view/Colab/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "ColabSemantique", href:"/xwiki/bin/view/ColabSemantique/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "ColabVeille", href:"/xwiki/bin/view/ColabVeille/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Main", href:"/xwiki/bin/view/Main/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Photos", href:"/xwiki/bin/view/Photos/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Sandbox", href:"/xwiki/bin/view/Sandbox/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Scheduler", href:"/xwiki/bin/view/Scheduler/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "Stats", href:"/xwiki/bin/view/Stats/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "XAppClasses", href:"/xwiki/bin/view/XAppClasses/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "XAppSheets", href:"/xwiki/bin/view/XAppSheets/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); nodeObject = { label: "XAppTemplates", href:"/xwiki/bin/view/XAppTemplates/" }; var spaceNode = new YAHOO.widget.TextNode(nodeObject, root, false); tree.draw(); } //once the DOM has loaded, we can go ahead and set up our tree: Event.observe(window, "load", buildTree); //]]> </script>