wagn 1.12.10 → 1.12.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +14 -12
- data/VERSION +1 -1
- data/app/assets/javascripts/wagn.js.coffee +25 -22
- data/app/assets/javascripts/wagn_mod.js.coffee +0 -44
- data/app/controllers/card_controller.rb +0 -1
- data/app/controllers/wagn_controller.rb +1 -2
- data/config/routes.rb +0 -1
- data/features/hello_wagn.feature +7 -5
- data/lib/card/exceptions.rb +7 -2
- data/lib/card/format.rb +8 -3
- data/lib/card/query/card_spec.rb +2 -1
- data/lib/card/set.rb +1 -0
- data/lib/wagn/all.rb +4 -4
- data/mods/core/formats/html_format.rb +296 -284
- data/mods/core/formats/text_format.rb +5 -2
- data/mods/core/sets/all/phases.rb +13 -0
- data/mods/standard/formats/css_format.rb +4 -1
- data/mods/standard/formats/csv_format.rb +4 -1
- data/mods/standard/formats/js_format.rb +6 -0
- data/mods/standard/formats/json_format.rb +4 -1
- data/mods/standard/formats/kml_format.rb +4 -1
- data/mods/standard/formats/rss_format.rb +7 -4
- data/mods/standard/formats/xml_format.rb +4 -1
- data/mods/standard/lib/stylesheets/functional.scss +2 -1
- data/mods/standard/sets/all/account.rb +1 -1
- data/mods/standard/sets/all/all_css.rb +5 -1
- data/mods/standard/sets/all/json.rb +17 -21
- data/mods/standard/sets/all/rich_html.rb +4 -3
- data/mods/standard/sets/self/head.rb +6 -0
- data/mods/standard/sets/type/cardtype.rb +1 -1
- data/mods/standard/sets/type/pointer.rb +23 -11
- data/mods/standard/sets/type/scss.rb +1 -0
- data/mods/standard/sets/type/search_type.rb +0 -2
- data/mods/standard/sets/type/user.rb +1 -2
- data/public/assets/application-7cda003cf1291a165b1eac69ea3027aa.js +107 -0
- data/public/assets/application-7cda003cf1291a165b1eac69ea3027aa.js.gz +0 -0
- data/public/assets/application.js +42 -38
- data/public/assets/application.js.gz +0 -0
- data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js.gz +0 -0
- data/public/assets/html5shiv-printshiv.js.gz +0 -0
- data/public/assets/jquery.min-8b58c0fbf303b938d8e749262f7e50dd.map +1 -0
- data/public/assets/jquery.min.map +1 -0
- data/public/assets/manifest.yml +4 -2
- data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js.gz +0 -0
- data/public/assets/tinymce.js.gz +0 -0
- data/spec/lib/card/query_spec.rb +3 -2
- data/spec/mods/standard/sets/all/all_css_spec.rb +1 -1
- data/spec/mods/standard/sets/type/pointer_spec.rb +2 -2
- data/wagn.gemspec +5 -4
- metadata +10 -80
- data/public/assets/application-af2bc486eb3db1c02c4dcd0e23ca25fc.js +0 -103
- data/public/assets/application-af2bc486eb3db1c02c4dcd0e23ca25fc.js.gz +0 -0
- data/public/assets2bpacked/jstree/README.txt +0 -10
- data/public/assets2bpacked/jstree/_demo/_dump.sql +0 -20
- data/public/assets2bpacked/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/assets2bpacked/jstree/_demo/_inc/class._database.php +0 -146
- data/public/assets2bpacked/jstree/_demo/_inc/class._database_i.php +0 -152
- data/public/assets2bpacked/jstree/_demo/_inc/class.tree.php +0 -602
- data/public/assets2bpacked/jstree/_demo/_install.txt +0 -6
- data/public/assets2bpacked/jstree/_demo/config.php +0 -14
- data/public/assets2bpacked/jstree/_demo/file.png +0 -0
- data/public/assets2bpacked/jstree/_demo/folder.png +0 -0
- data/public/assets2bpacked/jstree/_demo/index.html +0 -461
- data/public/assets2bpacked/jstree/_demo/root.png +0 -0
- data/public/assets2bpacked/jstree/_demo/server.php +0 -69
- data/public/assets2bpacked/jstree/_docs/!style.css +0 -48
- data/public/assets2bpacked/jstree/_docs/_drive.png +0 -0
- data/public/assets2bpacked/jstree/_docs/_html_data.html +0 -2
- data/public/assets2bpacked/jstree/_docs/_json_data.json +0 -4
- data/public/assets2bpacked/jstree/_docs/_search_data.json +0 -6
- data/public/assets2bpacked/jstree/_docs/_search_result.json +0 -1
- data/public/assets2bpacked/jstree/_docs/_xml_flat.xml +0 -12
- data/public/assets2bpacked/jstree/_docs/_xml_nest.xml +0 -18
- data/public/assets2bpacked/jstree/_docs/checkbox.html +0 -171
- data/public/assets2bpacked/jstree/_docs/contextmenu.html +0 -121
- data/public/assets2bpacked/jstree/_docs/cookies.html +0 -97
- data/public/assets2bpacked/jstree/_docs/core.html +0 -689
- data/public/assets2bpacked/jstree/_docs/crrm.html +0 -316
- data/public/assets2bpacked/jstree/_docs/dnd.html +0 -199
- data/public/assets2bpacked/jstree/_docs/hotkeys.html +0 -82
- data/public/assets2bpacked/jstree/_docs/html_data.html +0 -175
- data/public/assets2bpacked/jstree/_docs/index.html +0 -86
- data/public/assets2bpacked/jstree/_docs/json_data.html +0 -249
- data/public/assets2bpacked/jstree/_docs/languages.html +0 -152
- data/public/assets2bpacked/jstree/_docs/logo.png +0 -0
- data/public/assets2bpacked/jstree/_docs/search.html +0 -153
- data/public/assets2bpacked/jstree/_docs/sort.html +0 -85
- data/public/assets2bpacked/jstree/_docs/syntax/!script.js +0 -2232
- data/public/assets2bpacked/jstree/_docs/syntax/!style.css +0 -511
- data/public/assets2bpacked/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/help.png +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/printer.png +0 -0
- data/public/assets2bpacked/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/assets2bpacked/jstree/_docs/themeroller.html +0 -107
- data/public/assets2bpacked/jstree/_docs/themes.html +0 -127
- data/public/assets2bpacked/jstree/_docs/types.html +0 -178
- data/public/assets2bpacked/jstree/_docs/ui.html +0 -197
- data/public/assets2bpacked/jstree/_docs/unique.html +0 -85
- data/public/assets2bpacked/jstree/_docs/xml_data.html +0 -218
- data/public/assets2bpacked/jstree/_lib/jquery.cookie.js +0 -96
- data/public/assets2bpacked/jstree/_lib/jquery.hotkeys.js +0 -99
- data/public/assets2bpacked/jstree/_lib/jquery.js +0 -5
- data/public/assets2bpacked/jstree/jquery.jstree.js +0 -4564
- data/public/assets2bpacked/jstree/themes/apple/bg.jpg +0 -0
- data/public/assets2bpacked/jstree/themes/apple/d.png +0 -0
- data/public/assets2bpacked/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/assets2bpacked/jstree/themes/apple/style.css +0 -61
- data/public/assets2bpacked/jstree/themes/apple/throbber.gif +0 -0
- data/public/assets2bpacked/jstree/themes/classic/d.gif +0 -0
- data/public/assets2bpacked/jstree/themes/classic/d.png +0 -0
- data/public/assets2bpacked/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/assets2bpacked/jstree/themes/classic/style.css +0 -77
- data/public/assets2bpacked/jstree/themes/classic/throbber.gif +0 -0
- data/public/assets2bpacked/jstree/themes/default-rtl/d.gif +0 -0
- data/public/assets2bpacked/jstree/themes/default-rtl/d.png +0 -0
- data/public/assets2bpacked/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/assets2bpacked/jstree/themes/default-rtl/style.css +0 -84
- data/public/assets2bpacked/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/assets2bpacked/jstree/themes/default/d.gif +0 -0
- data/public/assets2bpacked/jstree/themes/default/d.png +0 -0
- data/public/assets2bpacked/jstree/themes/default/style.css +0 -74
- data/public/assets2bpacked/jstree/themes/default/throbber.gif +0 -0
@@ -1,6 +0,0 @@
|
|
1
|
-
1) Create a database and a user with all privileges for this database.
|
2
|
-
2) Edit the config.php file and update the configuration for the database at the top of the file
|
3
|
-
3) Import the _dump.sql in your newly created database
|
4
|
-
4) You are ready to go
|
5
|
-
|
6
|
-
*) PLEASE NOTE THAT THE PHP TREE CLASS HAS NOT BEEN THOROUGHLY TESTED
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
// Database config & class
|
3
|
-
$db_config = array(
|
4
|
-
"servername"=> "localhost",
|
5
|
-
"username" => "root",
|
6
|
-
"password" => "",
|
7
|
-
"database" => ""
|
8
|
-
);
|
9
|
-
if(extension_loaded("mysqli")) require_once("_inc/class._database_i.php");
|
10
|
-
else require_once("_inc/class._database.php");
|
11
|
-
|
12
|
-
// Tree class
|
13
|
-
require_once("_inc/class.tree.php");
|
14
|
-
?>
|
Binary file
|
Binary file
|
@@ -1,461 +0,0 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>jsTree v.1.0 - Demo</title>
|
8
|
-
<script type="text/javascript" src="../_lib/jquery.js"></script>
|
9
|
-
<script type="text/javascript" src="../_lib/jquery.cookie.js"></script>
|
10
|
-
<script type="text/javascript" src="../_lib/jquery.hotkeys.js"></script>
|
11
|
-
<script type="text/javascript" src="../jquery.jstree.js"></script>
|
12
|
-
<link type="text/css" rel="stylesheet" href="../_docs/syntax/!style.css"/>
|
13
|
-
<link type="text/css" rel="stylesheet" href="../_docs/!style.css"/>
|
14
|
-
<script type="text/javascript" src="../_docs/syntax/!script.js"></script>
|
15
|
-
</head>
|
16
|
-
<body id="demo_body">
|
17
|
-
<div id="container">
|
18
|
-
|
19
|
-
<h1 id="dhead">jsTree v.1.0</h1>
|
20
|
-
<h1>DEMO</h1>
|
21
|
-
<h2>Creating a tree, binding events, using the instance</h2>
|
22
|
-
<div id="description">
|
23
|
-
<p>Here is how you create an instance, bind an event and then get the instance.</p>
|
24
|
-
<div id="demo1" class="demo" style="height:100px;">
|
25
|
-
<ul>
|
26
|
-
<li id="phtml_1">
|
27
|
-
<a href="#">Root node 1</a>
|
28
|
-
<ul>
|
29
|
-
<li id="phtml_2">
|
30
|
-
<a href="#">Child node 1</a>
|
31
|
-
</li>
|
32
|
-
<li id="phtml_3">
|
33
|
-
<a href="#">Child node 2</a>
|
34
|
-
</li>
|
35
|
-
</ul>
|
36
|
-
</li>
|
37
|
-
<li id="phtml_4">
|
38
|
-
<a href="#">Root node 2</a>
|
39
|
-
</li>
|
40
|
-
</ul>
|
41
|
-
</div>
|
42
|
-
<script type="text/javascript" class="source below">
|
43
|
-
$(function () {
|
44
|
-
// TO CREATE AN INSTANCE
|
45
|
-
// select the tree container using jQuery
|
46
|
-
$("#demo1")
|
47
|
-
// call `.jstree` with the options object
|
48
|
-
.jstree({
|
49
|
-
// the `plugins` array allows you to configure the active plugins on this instance
|
50
|
-
"plugins" : ["themes","html_data","ui","crrm","hotkeys"],
|
51
|
-
// each plugin you have included can have its own config object
|
52
|
-
"core" : { "initially_open" : [ "phtml_1" ] }
|
53
|
-
// it makes sense to configure a plugin only if overriding the defaults
|
54
|
-
})
|
55
|
-
// EVENTS
|
56
|
-
// each instance triggers its own events - to process those listen on the container
|
57
|
-
// all events are in the `.jstree` namespace
|
58
|
-
// so listen for `function_name`.`jstree` - you can function names from the docs
|
59
|
-
.bind("loaded.jstree", function (event, data) {
|
60
|
-
// you get two params - event & data - check the core docs for a detailed description
|
61
|
-
});
|
62
|
-
// INSTANCES
|
63
|
-
// 1) you can call most functions just by selecting the container and calling `.jstree("func",`
|
64
|
-
setTimeout(function () { $("#demo1").jstree("set_focus"); }, 500);
|
65
|
-
// with the methods below you can call even private functions (prefixed with `_`)
|
66
|
-
// 2) you can get the focused instance using `$.jstree._focused()`.
|
67
|
-
setTimeout(function () { $.jstree._focused().select_node("#phtml_1"); }, 1000);
|
68
|
-
// 3) you can use $.jstree._reference - just pass the container, a node inside it, or a selector
|
69
|
-
setTimeout(function () { $.jstree._reference("#phtml_1").close_node("#phtml_1"); }, 1500);
|
70
|
-
// 4) when you are working with an event you can use a shortcut
|
71
|
-
$("#demo1").bind("open_node.jstree", function (e, data) {
|
72
|
-
// data.inst is the instance which triggered this event
|
73
|
-
data.inst.select_node("#phtml_2", true);
|
74
|
-
});
|
75
|
-
setTimeout(function () { $.jstree._reference("#phtml_1").open_node("#phtml_1"); }, 2500);
|
76
|
-
});
|
77
|
-
</script>
|
78
|
-
</div>
|
79
|
-
|
80
|
-
<h2>Doing something when the tree is loaded</h2>
|
81
|
-
<div id="description">
|
82
|
-
<p>You can use a few events to do that.</p>
|
83
|
-
<div id="demo2" class="demo" style="height:100px;">
|
84
|
-
<ul>
|
85
|
-
<li id="rhtml_1" class="jstree-open">
|
86
|
-
<a href="#">Root node 1</a>
|
87
|
-
<ul>
|
88
|
-
<li id="rhtml_2">
|
89
|
-
<a href="#">Child node 1</a>
|
90
|
-
</li>
|
91
|
-
<li id="rhtml_3">
|
92
|
-
<a href="#">Child node 2</a>
|
93
|
-
</li>
|
94
|
-
</ul>
|
95
|
-
</li>
|
96
|
-
<li id="rhtml_4">
|
97
|
-
<a href="#">Root node 2</a>
|
98
|
-
</li>
|
99
|
-
</ul>
|
100
|
-
</div>
|
101
|
-
<script type="text/javascript" class="source below">
|
102
|
-
// Note method 2) and 3) use `one`, this is because if `refresh` is called those events are triggered
|
103
|
-
$(function () {
|
104
|
-
$("#demo2")
|
105
|
-
.jstree({ "plugins" : ["themes","html_data","ui"] })
|
106
|
-
// 1) the loaded event fires as soon as data is parsed and inserted
|
107
|
-
.bind("loaded.jstree", function (event, data) { })
|
108
|
-
// 2) but if you are using the cookie plugin or the core `initially_open` option:
|
109
|
-
.one("reopen.jstree", function (event, data) { })
|
110
|
-
// 3) but if you are using the cookie plugin or the UI `initially_select` option:
|
111
|
-
.one("reselect.jstree", function (event, data) { });
|
112
|
-
});
|
113
|
-
</script>
|
114
|
-
</div>
|
115
|
-
|
116
|
-
<h2>Doing something when a node is clicked</h2>
|
117
|
-
<div id="description">
|
118
|
-
<div id="demo3" class="demo" style="height:100px;">
|
119
|
-
<ul>
|
120
|
-
<li id="shtml_1" class="jstree-open">
|
121
|
-
<a href="#">Root node 1</a>
|
122
|
-
<ul>
|
123
|
-
<li id="shtml_2">
|
124
|
-
<a href="#">Child node 1</a>
|
125
|
-
</li>
|
126
|
-
<li id="shtml_3">
|
127
|
-
<a href="#">Child node 2</a>
|
128
|
-
</li>
|
129
|
-
</ul>
|
130
|
-
</li>
|
131
|
-
<li id="shtml_4">
|
132
|
-
<a href="#">Root node 2</a>
|
133
|
-
</li>
|
134
|
-
</ul>
|
135
|
-
</div>
|
136
|
-
<script type="text/javascript" class="source below">
|
137
|
-
$(function () {
|
138
|
-
$("#demo3")
|
139
|
-
.jstree({ "plugins" : ["themes","html_data","ui"] })
|
140
|
-
// 1) if using the UI plugin bind to select_node
|
141
|
-
.bind("select_node.jstree", function (event, data) {
|
142
|
-
// `data.rslt.obj` is the jquery extended node that was clicked
|
143
|
-
alert(data.rslt.obj.attr("id"));
|
144
|
-
})
|
145
|
-
// 2) if not using the UI plugin - the Anchor tags work as expected
|
146
|
-
// so if the anchor has a HREF attirbute - the page will be changed
|
147
|
-
// you can actually prevent the default, etc (normal jquery usage)
|
148
|
-
.delegate("a", "click", function (event, data) { event.preventDefault(); })
|
149
|
-
});
|
150
|
-
</script>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
<h2>Using CSS to make nodes wrap</h2>
|
154
|
-
<div id="description">
|
155
|
-
<div id="demo4" class="demo" style="height:120px;">
|
156
|
-
<ul>
|
157
|
-
<li class="jstree-open">
|
158
|
-
<a href="#">Root node 1</a>
|
159
|
-
<ul>
|
160
|
-
<li>
|
161
|
-
<a href="#">Child node 1 with a long text which would normally just cause a scrollbar, but with this line of CSS it will actually wrap, this is not really throughly tested but it works</a>
|
162
|
-
</li>
|
163
|
-
<li>
|
164
|
-
<a href="#">Child node 2</a>
|
165
|
-
</li>
|
166
|
-
</ul>
|
167
|
-
</li>
|
168
|
-
<li>
|
169
|
-
<a href="#">Root node 2</a>
|
170
|
-
</li>
|
171
|
-
</ul>
|
172
|
-
</div>
|
173
|
-
<style type="text/css" class="source below">
|
174
|
-
#demo4 a { white-space:normal !important; height: auto; padding:1px 2px; }
|
175
|
-
#demo4 li > ins { vertical-align:top; }
|
176
|
-
#demo4 .jstree-hovered, #demo4 .jstree-clicked { border:0; }
|
177
|
-
</style>
|
178
|
-
<script type="text/javascript">
|
179
|
-
$(function () {
|
180
|
-
$("#demo4")
|
181
|
-
.jstree({ "plugins" : ["themes","html_data","ui"] });
|
182
|
-
});
|
183
|
-
</script>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<h2>Using CSS to make the nodes bigger</h2>
|
187
|
-
<div id="description">
|
188
|
-
<div id="demo5" class="demo" style="height:120px;">
|
189
|
-
<ul>
|
190
|
-
<li class="jstree-open">
|
191
|
-
<a href="#">Root node 1</a>
|
192
|
-
<ul>
|
193
|
-
<li>
|
194
|
-
<a href="#">Child node 1 with a long text which would normally just cause a scrollbar, but with this line of CSS it will actually wrap, this is not really throughly tested but it works</a>
|
195
|
-
</li>
|
196
|
-
<li>
|
197
|
-
<a href="#">Child node 2</a>
|
198
|
-
</li>
|
199
|
-
</ul>
|
200
|
-
</li>
|
201
|
-
<li>
|
202
|
-
<a href="#">Root node 2</a>
|
203
|
-
</li>
|
204
|
-
</ul>
|
205
|
-
</div>
|
206
|
-
<style type="text/css" class="source below">
|
207
|
-
#demo5 li { min-height:22px; line-height:22px; }
|
208
|
-
#demo5 a { line-height:20px; height:20px; font-size:10px; }
|
209
|
-
#demo5 a ins { height:20px; width:20px; background-position:-56px -17px; }
|
210
|
-
</style>
|
211
|
-
<script type="text/javascript">
|
212
|
-
$(function () {
|
213
|
-
$("#demo5")
|
214
|
-
.jstree({ "plugins" : ["themes","html_data","ui"] });
|
215
|
-
});
|
216
|
-
</script>
|
217
|
-
</div>
|
218
|
-
|
219
|
-
<h2>PHP & mySQL demo + event order</h2>
|
220
|
-
<div id="description">
|
221
|
-
<p>Here is a PHP & mySQL enabled demo. You can use the classes/DB structure included, but those are not thoroughly tested and not officially a part of jstree. In the log window you can also see all function calls as they happen on the instance.</p>
|
222
|
-
<div id="mmenu" style="height:30px; overflow:auto;">
|
223
|
-
<input type="button" id="add_folder" value="add folder" style="display:block; float:left;"/>
|
224
|
-
<input type="button" id="add_default" value="add file" style="display:block; float:left;"/>
|
225
|
-
<input type="button" id="rename" value="rename" style="display:block; float:left;"/>
|
226
|
-
<input type="button" id="remove" value="remove" style="display:block; float:left;"/>
|
227
|
-
<input type="button" id="cut" value="cut" style="display:block; float:left;"/>
|
228
|
-
<input type="button" id="copy" value="copy" style="display:block; float:left;"/>
|
229
|
-
<input type="button" id="paste" value="paste" style="display:block; float:left;"/>
|
230
|
-
<input type="button" id="clear_search" value="clear" style="display:block; float:right;"/>
|
231
|
-
<input type="button" id="search" value="search" style="display:block; float:right;"/>
|
232
|
-
<input type="text" id="text" value="" style="display:block; float:right;" />
|
233
|
-
</div>
|
234
|
-
|
235
|
-
<!-- the tree container (notice NOT an UL node) -->
|
236
|
-
<div id="demo" class="demo" style="height:200px;"></div>
|
237
|
-
<div style="height:30px; text-align:center;">
|
238
|
-
<input type="button" style='width:170px; height:24px; margin:5px auto;' value="reconstruct" onclick="$.get('./server.php?reconstruct', function () { $('#demo').jstree('refresh',-1); });" />
|
239
|
-
<input type="button" style='width:170px; height:24px; margin:5px auto;' id="analyze" value="analyze" onclick="$('#alog').load('./server.php?analyze');" />
|
240
|
-
<input type="button" style='width:170px; height:24px; margin:5px auto;' value="refresh" onclick="$('#demo').jstree('refresh',-1);" />
|
241
|
-
</div>
|
242
|
-
<div id='alog' style="border:1px solid gray; padding:5px; height:100px; margin-top:15px; overflow:auto; font-family:Monospace;"></div>
|
243
|
-
<!-- JavaScript neccessary for the tree -->
|
244
|
-
<script type="text/javascript" class="source below">
|
245
|
-
$(function () {
|
246
|
-
|
247
|
-
$("#demo")
|
248
|
-
.bind("before.jstree", function (e, data) {
|
249
|
-
$("#alog").append(data.func + "<br />");
|
250
|
-
})
|
251
|
-
.jstree({
|
252
|
-
// List of active plugins
|
253
|
-
"plugins" : [
|
254
|
-
"themes","json_data","ui","crrm","cookies","dnd","search","types","hotkeys","contextmenu"
|
255
|
-
],
|
256
|
-
|
257
|
-
// I usually configure the plugin that handles the data first
|
258
|
-
// This example uses JSON as it is most common
|
259
|
-
"json_data" : {
|
260
|
-
// This tree is ajax enabled - as this is most common, and maybe a bit more complex
|
261
|
-
// All the options are almost the same as jQuery's AJAX (read the docs)
|
262
|
-
"ajax" : {
|
263
|
-
// the URL to fetch the data
|
264
|
-
"url" : "./server.php",
|
265
|
-
// the `data` function is executed in the instance's scope
|
266
|
-
// the parameter is the node being loaded
|
267
|
-
// (may be -1, 0, or undefined when loading the root nodes)
|
268
|
-
"data" : function (n) {
|
269
|
-
// the result is fed to the AJAX request `data` option
|
270
|
-
return {
|
271
|
-
"operation" : "get_children",
|
272
|
-
"id" : n.attr ? n.attr("id").replace("node_","") : 1
|
273
|
-
};
|
274
|
-
}
|
275
|
-
}
|
276
|
-
},
|
277
|
-
// Configuring the search plugin
|
278
|
-
"search" : {
|
279
|
-
// As this has been a common question - async search
|
280
|
-
// Same as above - the `ajax` config option is actually jQuery's AJAX object
|
281
|
-
"ajax" : {
|
282
|
-
"url" : "./server.php",
|
283
|
-
// You get the search string as a parameter
|
284
|
-
"data" : function (str) {
|
285
|
-
return {
|
286
|
-
"operation" : "search",
|
287
|
-
"search_str" : str
|
288
|
-
};
|
289
|
-
}
|
290
|
-
}
|
291
|
-
},
|
292
|
-
// Using types - most of the time this is an overkill
|
293
|
-
// read the docs carefully to decide whether you need types
|
294
|
-
"types" : {
|
295
|
-
// I set both options to -2, as I do not need depth and children count checking
|
296
|
-
// Those two checks may slow jstree a lot, so use only when needed
|
297
|
-
"max_depth" : -2,
|
298
|
-
"max_children" : -2,
|
299
|
-
// I want only `drive` nodes to be root nodes
|
300
|
-
// This will prevent moving or creating any other type as a root node
|
301
|
-
"valid_children" : [ "drive" ],
|
302
|
-
"types" : {
|
303
|
-
// The default type
|
304
|
-
"default" : {
|
305
|
-
// I want this type to have no children (so only leaf nodes)
|
306
|
-
// In my case - those are files
|
307
|
-
"valid_children" : "none",
|
308
|
-
// If we specify an icon for the default type it WILL OVERRIDE the theme icons
|
309
|
-
"icon" : {
|
310
|
-
"image" : "./file.png"
|
311
|
-
}
|
312
|
-
},
|
313
|
-
// The `folder` type
|
314
|
-
"folder" : {
|
315
|
-
// can have files and other folders inside of it, but NOT `drive` nodes
|
316
|
-
"valid_children" : [ "default", "folder" ],
|
317
|
-
"icon" : {
|
318
|
-
"image" : "./folder.png"
|
319
|
-
}
|
320
|
-
},
|
321
|
-
// The `drive` nodes
|
322
|
-
"drive" : {
|
323
|
-
// can have files and folders inside, but NOT other `drive` nodes
|
324
|
-
"valid_children" : [ "default", "folder" ],
|
325
|
-
"icon" : {
|
326
|
-
"image" : "./root.png"
|
327
|
-
},
|
328
|
-
// those prevent the functions with the same name to be used on `drive` nodes
|
329
|
-
// internally the `before` event is used
|
330
|
-
"start_drag" : false,
|
331
|
-
"move_node" : false,
|
332
|
-
"delete_node" : false,
|
333
|
-
"remove" : false
|
334
|
-
}
|
335
|
-
}
|
336
|
-
},
|
337
|
-
// UI & core - the nodes to initially select and open will be overwritten by the cookie plugin
|
338
|
-
|
339
|
-
// the UI plugin - it handles selecting/deselecting/hovering nodes
|
340
|
-
"ui" : {
|
341
|
-
// this makes the node with ID node_4 selected onload
|
342
|
-
"initially_select" : [ "node_4" ]
|
343
|
-
},
|
344
|
-
// the core plugin - not many options here
|
345
|
-
"core" : {
|
346
|
-
// just open those two nodes up
|
347
|
-
// as this is an AJAX enabled tree, both will be downloaded from the server
|
348
|
-
"initially_open" : [ "node_2" , "node_3" ]
|
349
|
-
}
|
350
|
-
})
|
351
|
-
.bind("create.jstree", function (e, data) {
|
352
|
-
$.post(
|
353
|
-
"./server.php",
|
354
|
-
{
|
355
|
-
"operation" : "create_node",
|
356
|
-
"id" : data.rslt.parent.attr("id").replace("node_",""),
|
357
|
-
"position" : data.rslt.position,
|
358
|
-
"title" : data.rslt.name,
|
359
|
-
"type" : data.rslt.obj.attr("rel")
|
360
|
-
},
|
361
|
-
function (r) {
|
362
|
-
if(r.status) {
|
363
|
-
$(data.rslt.obj).attr("id", "node_" + r.id);
|
364
|
-
}
|
365
|
-
else {
|
366
|
-
$.jstree.rollback(data.rlbk);
|
367
|
-
}
|
368
|
-
}
|
369
|
-
);
|
370
|
-
})
|
371
|
-
.bind("remove.jstree", function (e, data) {
|
372
|
-
data.rslt.obj.each(function () {
|
373
|
-
$.ajax({
|
374
|
-
async : false,
|
375
|
-
type: 'POST',
|
376
|
-
url: "./server.php",
|
377
|
-
data : {
|
378
|
-
"operation" : "remove_node",
|
379
|
-
"id" : this.id.replace("node_","")
|
380
|
-
},
|
381
|
-
success : function (r) {
|
382
|
-
if(!r.status) {
|
383
|
-
data.inst.refresh();
|
384
|
-
}
|
385
|
-
}
|
386
|
-
});
|
387
|
-
});
|
388
|
-
})
|
389
|
-
.bind("rename.jstree", function (e, data) {
|
390
|
-
$.post(
|
391
|
-
"./server.php",
|
392
|
-
{
|
393
|
-
"operation" : "rename_node",
|
394
|
-
"id" : data.rslt.obj.attr("id").replace("node_",""),
|
395
|
-
"title" : data.rslt.new_name
|
396
|
-
},
|
397
|
-
function (r) {
|
398
|
-
if(!r.status) {
|
399
|
-
$.jstree.rollback(data.rlbk);
|
400
|
-
}
|
401
|
-
}
|
402
|
-
);
|
403
|
-
})
|
404
|
-
.bind("move_node.jstree", function (e, data) {
|
405
|
-
data.rslt.o.each(function (i) {
|
406
|
-
$.ajax({
|
407
|
-
async : false,
|
408
|
-
type: 'POST',
|
409
|
-
url: "./server.php",
|
410
|
-
data : {
|
411
|
-
"operation" : "move_node",
|
412
|
-
"id" : $(this).attr("id").replace("node_",""),
|
413
|
-
"ref" : data.rslt.cr === -1 ? 1 : data.rslt.np.attr("id").replace("node_",""),
|
414
|
-
"position" : data.rslt.cp + i,
|
415
|
-
"title" : data.rslt.name,
|
416
|
-
"copy" : data.rslt.cy ? 1 : 0
|
417
|
-
},
|
418
|
-
success : function (r) {
|
419
|
-
if(!r.status) {
|
420
|
-
$.jstree.rollback(data.rlbk);
|
421
|
-
}
|
422
|
-
else {
|
423
|
-
$(data.rslt.oc).attr("id", "node_" + r.id);
|
424
|
-
if(data.rslt.cy && $(data.rslt.oc).children("UL").length) {
|
425
|
-
data.inst.refresh(data.inst._get_parent(data.rslt.oc));
|
426
|
-
}
|
427
|
-
}
|
428
|
-
$("#analyze").click();
|
429
|
-
}
|
430
|
-
});
|
431
|
-
});
|
432
|
-
});
|
433
|
-
|
434
|
-
});
|
435
|
-
</script>
|
436
|
-
<script type="text/javascript" class="source below">
|
437
|
-
// Code for the menu buttons
|
438
|
-
$(function () {
|
439
|
-
$("#mmenu input").click(function () {
|
440
|
-
switch(this.id) {
|
441
|
-
case "add_default":
|
442
|
-
case "add_folder":
|
443
|
-
$("#demo").jstree("create", null, "last", { "attr" : { "rel" : this.id.toString().replace("add_", "") } });
|
444
|
-
break;
|
445
|
-
case "search":
|
446
|
-
$("#demo").jstree("search", document.getElementById("text").value);
|
447
|
-
break;
|
448
|
-
case "text": break;
|
449
|
-
default:
|
450
|
-
$("#demo").jstree(this.id);
|
451
|
-
break;
|
452
|
-
}
|
453
|
-
});
|
454
|
-
});
|
455
|
-
</script>
|
456
|
-
</div>
|
457
|
-
|
458
|
-
</div>
|
459
|
-
|
460
|
-
</body>
|
461
|
-
</html>
|