Debian Codegraph @

dojox/data/demos/demo_FileStore_dojotree.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <!--
3 Demo application showing LazyLoading File store.
4 -->
5 <html>
6 <head>
7 <title>Demo: dojox.data.FileStore</title>
8 <style type="text/css">
9 @import "../../../dijit/themes/tundra/tundra.css";
10 @import "../../../dojo/resources/dojo.css";
11 @import "../../../dijit/tests/css/dijitTests.css";
12
13 .fileView {
14 margin: 5px;
15 width: 100%;
16
17 }
18 .fileView .fileViewTitle{
19 color: white;
20 background-color: black;
21 font-size: larger;
22 font-weight: bold;
23
24 }
25
26 .fileView .fileViewTable {
27 border-width: 2px;
28 border-style: solid;
29 width: 100%;
30 }
31
32 .fileView .fileViewTable tr td {
33 border-width: 1px;
34 border-style: solid;
35 border-color: lightgray;
36 width: 50%;
37 vertical-align: top;
38 }
39
40 .fileView .fileName {
41 background-color: lightgray;
42 }
43
44 </style>
45
46 <!--
47 The following script tag instantiates the dojo library and sets some basic properties. In this case, the application
48 is told that debug mode is off, and to parse all dojoType widgets when it has fully loaded.
49 -->
50 <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: false, parseOnLoad: true, useCommentedJson: true"></script>
51 <script>
52 dojo.require("dijit.Tree");
53 dojo.require("dijit.tree.ForestStoreModel");
54 dojo.require("dojox.data.FileStore");
55 dojo.require("dojox.data.demos.widgets.FileView");
56 </script>
57 </head>
58
59 <body class="tundra">
60 <h1>
61 Demo: Lazy Loading File Browsing Store
62 </h1>
63 <p>The tree below uses the dojox.data.FileStore and a PHP implementation for the serverside to browse the dojo tree hierarchy in a lazy-load fashion.</p>
64 <p><i><b>This demo must be run from a web-server with PHP support enabled. Without PHP support, this demo cannot function. The Demo also requires PHP
65 support for json_encode and json_decode. Please be sure to have those packages installed in your PHP environment.</b></i></p>
66 <hr>
67 <i>Clicking on a file in the tree will display the details about that file.</i>
68 <div dojoType="dojox.data.FileStore" url="stores/filestore_dojotree.php" jsId="fileStore" pathAsQueryParam="true"></div>
69 <div dojoType="dijit.tree.ForestStoreModel" jsId="fileModel"
70 store="fileStore" query="{}"
71 rootId="DojoFiles" rootLabel="Dojo Files" childrenAttrs="children"></div>
72
73 <table style="width: 100%;">
74 <tbody>
75 <tr style="width: 100%;">
76 <td style="width: 50%; vertical-align: top;">
77 <span id="tree" dojoType="dijit.Tree" model="fileModel" >
78 <script type="dojo/method" event="onClick" args="item">
79 if (fileStore.isItem(item)){
80 var attachPt = dojo.byId("fileInfo");
81 if (attachPt) {
82 while(attachPt.firstChild) {
83 attachPt.removeChild(attachPt.firstChild);
84 }
85 var newArgs = {};
86 newArgs.name = fileStore.getValue(item, "name");
87 newArgs.path = fileStore.getValue(item, "path");
88 newArgs.size = fileStore.getValue(item, "size");
89 newArgs.directory = fileStore.getValue(item, "directory");
90 newArgs.parentDir = fileStore.getValue(item, "parentDir");
91 var children = fileStore.getValues(item, "children");
92 if (children && children.length > 0) {
93 newArgs.children = [];
94 var i;
95 for (i = 0; i < children.length; i++) {
96 //Note here that even though the store is lazy-loading, the unloaded items for children still
97 //have the 'name' attribute, since it is used as part of the info to load the full item. Generally
98 //you should not access properties of an item that has not been fully inflated yet. It just works
99 //well in this case for this store.
100 newArgs.children.push(fileStore.getValue(children[i], "name"));
101 }
102 }
103 var fInfo = new dojox.data.demos.widgets.FileView(newArgs);
104 attachPt.appendChild(fInfo.domNode);
105 fInfo.startup();
106 }
107 }
108 </script>
109 </span>
110 </td>
111 <td id="fileInfo" STYLE="width: 50%; vertical-align: top;">
112 </td>
113 </tr>
114
115 </tbody>
116 </table>
117 <hr>
118 </body>
119 </html>