corrade-nucleus-nucleons – Diff between revs 10 and 13
?pathlinks?
Rev 10 | Rev 13 | |||
---|---|---|---|---|
1 | <!DOCTYPE html> |
1 | <!DOCTYPE html> |
|
2 | |
2 | |
|
3 | <html lang="en"> |
3 | <html lang="en"> |
|
4 | <head> |
4 | <head> |
|
5 | <meta charset="utf-8"> |
5 | <meta charset="utf-8"> |
|
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
6 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|
7 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
7 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
|
8 | <meta name="description" content="Corrade Nucleon"> |
8 | <meta name="description" content="Corrade Nucleon"> |
|
9 | <meta name="author" content="Wizardry and Steamworks"> |
9 | <meta name="author" content="Wizardry and Steamworks"> |
|
10 | <link rel="icon" href="favicon.ico"> |
10 | <link rel="icon" href="favicon.ico"> |
|
11 | |
11 | |
|
12 | <title>Corrade Nucleus - Pack Rat Inventory Manager</title> |
12 | <title>Corrade Nucleus - Pack Rat Inventory Manager</title> |
|
13 | |
13 | |
|
14 | <!-- Bootstrap core CSS --> |
14 | <!-- Bootstrap core CSS --> |
|
15 | <link href="/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
15 | <link href="/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css"> |
|
16 | <!-- Corrade Nucleus Fonts --> |
16 | <!-- Corrade Nucleus Fonts --> |
|
17 | <link href="/css/nucleus/fonts.css" rel="stylesheet" type="text/css"> |
17 | <link href="/css/nucleus/fonts.css" rel="stylesheet" type="text/css"> |
|
18 | <!-- Customized bootstrap style. --> |
18 | <!-- Customized bootstrap style. --> |
|
19 | <link href="/css/nucleus/nucleus.css" rel="stylesheet" type="text/css"> |
19 | <link href="/css/nucleus/nucleus.css" rel="stylesheet" type="text/css"> |
|
20 | |
20 | |
|
21 | <!-- jsTree style --> |
21 | <!-- jsTree style --> |
|
22 | <link href="/pack-rat/bower_components/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css"> |
22 | <link href="/pack-rat/bower_components/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css"> |
|
23 | </script> |
23 | </script> |
|
24 | </head> |
24 | </head> |
|
25 | |
25 | |
|
26 | <body> |
26 | <body> |
|
27 | <!-- Bootstrap Modal --> |
27 | <!-- Bootstrap Modal --> |
|
28 | <div id="popup" class="modal fade bs-example-modal-lg" role="dialog"> |
28 | <div id="popup" class="modal fade bs-example-modal-lg" role="dialog"> |
|
29 | <div class="modal-dialog modal-lg"> |
29 | <div class="modal-dialog modal-lg"> |
|
30 | <!-- Modal content--> |
30 | <!-- Modal content--> |
|
31 | |
31 | |
|
32 | <div class="modal-content"> |
32 | <div class="modal-content"> |
|
33 | <div class="modal-header"> |
33 | <div class="modal-header"> |
|
34 | <button type="button" class="close" data-dismiss="modal">×</button> |
34 | <button type="button" class="close" data-dismiss="modal">×</button> |
|
35 | |
35 | |
|
36 | <h1 id="title" class="modal-title"></h1> |
36 | <h1 id="title" class="modal-title"></h1> |
|
37 | </div> |
37 | </div> |
|
38 | |
38 | |
|
39 | <div id="content" class="modal-body"> |
39 | <div id="content" class="modal-body"> |
|
40 | <div class="progress"> |
40 | <div class="progress"> |
|
41 | <div id="progressbar" class="progress-bar" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: 2%;"> |
41 | <div id="progressbar" class="progress-bar" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: 2%;"> |
|
42 | 0% |
42 | 0% |
|
43 | </div> |
43 | </div> |
|
44 | </div> |
44 | </div> |
|
45 | |
45 | |
|
46 | <div class="modal-footer"> |
46 | <div class="modal-footer"> |
|
47 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
47 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
48 | </div> |
48 | </div> |
|
49 | </div> |
49 | </div> |
|
50 | </div> |
50 | </div> |
|
51 | </div> |
51 | </div> |
|
52 | </div> |
52 | </div> |
|
53 | |
53 | |
|
54 | <div class="container"> |
54 | <div class="container"> |
|
55 | <div class="jumbotron"> |
55 | <div class="jumbotron"> |
|
56 | <h1>Corrade Pack Rat</h1> |
56 | <h1>Corrade Pack Rat</h1> |
|
57 | <p class="lead">Pack Rat is an inventory manager for Corrade Nucleus that allows you to sort your inventory and perform other management operations.</p> |
57 | <p class="lead">Pack Rat is an inventory manager for Corrade Nucleus that allows you to sort your inventory and perform other management operations.</p> |
|
58 | <img src="/pack-rat/img/pack-rat.png"></div> |
58 | <img src="/pack-rat/img/pack-rat.png"></div> |
|
59 | |
59 | |
|
60 | <!-- Will hold the inventory tree (completed dynamically). --> |
60 | <!-- Will hold the inventory tree (completed dynamically). --> |
|
61 | <div id="tree"> |
61 | <div id="tree"> |
|
62 | </div> |
62 | </div> |
|
63 | |
63 | |
|
64 | <footer class="footer"> |
64 | <footer class="footer"> |
|
65 | <p>© 2017 Wizardry and Steamworks</p> |
65 | <p>© 2017 Wizardry and Steamworks</p> |
|
66 | </footer> |
66 | </footer> |
|
67 | </div> |
67 | </div> |
|
68 | <!-- jQuery --> |
68 | <!-- jQuery --> |
|
69 | <script src="/bower_components/jquery/dist/jquery.min.js" type="text/javascript"></script> |
69 | <script src="/bower_components/jquery/dist/jquery.min.js" type="text/javascript"></script> |
|
70 | <!-- Wizardry and Steamworks JavaScript Includes --> |
70 | <!-- Wizardry and Steamworks JavaScript Includes --> |
|
71 | <script src="/bower_components/was/dist/was.min.js" type="text/javascript"></script> |
71 | <script src="/bower_components/was/dist/was.min.js" type="text/javascript"></script> |
|
72 | <!-- Bootstrap Javascript --> |
72 | <!-- Bootstrap Javascript --> |
|
73 | <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
73 | <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
|
74 | <!-- Bootstrap Form Validator --> |
74 | <!-- Bootstrap Form Validator --> |
|
75 | <script src="/pack-rat/bower_components/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
75 | <script src="/pack-rat/bower_components/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
|
76 | <!-- XML <-> JSON --> |
76 | <!-- XML <-> JSON --> |
|
77 | <!-- <script src="/bootstrap/bower_components/x2js/xml2json.min.js" type="text/javascript"></script> --> |
77 | <!-- <script src="/bootstrap/bower_components/x2js/xml2json.min.js" type="text/javascript"></script> --> |
|
78 | <!-- CryptoJS --> |
78 | <!-- CryptoJS --> |
|
79 | <script src="/bower_components/cryptojslib/components/core.js" type="text/javascript"></script> |
79 | <script src="/bower_components/cryptojslib/components/core.js" type="text/javascript"></script> |
|
80 | <script src="/bower_components/cryptojslib/rollups/md5.js" type="text/javascript"></script> |
80 | <script src="/bower_components/cryptojslib/rollups/md5.js" type="text/javascript"></script> |
|
81 | <!-- Form To Object --> |
81 | <!-- Form To Object --> |
|
82 | <!-- <script src="/bootstrap/node_modules/form_to_object/dist/formToObject.min.js" type="text/javascript"></script> --> |
82 | <!-- <script src="/bootstrap/node_modules/form_to_object/dist/formToObject.min.js" type="text/javascript"></script> --> |
|
83 | <!-- Load form processor. --> |
83 | <!-- Load form processor. --> |
|
84 | <!-- <script src="/bootstrap/js/corrade-bootstrap-processor.js" type="text/javascript"></script> --> |
84 | <!-- <script src="/bootstrap/js/corrade-bootstrap-processor.js" type="text/javascript"></script> --> |
|
85 | <!-- Moment JS --> |
85 | <!-- Moment JS --> |
|
86 | <script src="/pack-rat/bower_components/moment/min/moment.min.js" type="text/javascript"></script> |
86 | <script src="/pack-rat/bower_components/moment/min/moment.min.js" type="text/javascript"></script> |
|
87 | <!-- JsTree --> |
87 | <!-- JsTree --> |
|
88 | <script src="/pack-rat/bower_components/jstree/dist/jstree.min.js" type="text/javascript"></script> |
88 | <script src="/pack-rat/bower_components/jstree/dist/jstree.min.js" type="text/javascript"></script> |
|
89 | <!-- JSON to Table --> |
89 | <!-- JSON to Table --> |
|
90 | <script src="/pack-rat/bower_components/json-to-table/json-to-table.js" type="text/javascript"></script> |
90 | <script src="/pack-rat/bower_components/json-to-table/json-to-table.js" type="text/javascript"></script> |
|
91 | <!-- Main script --> |
91 | <!-- Main script --> |
|
92 | <script type="text/javascript"> |
92 | <script type="text/javascript"> |
|
93 | $(function() { |
93 | $(function() { |
|
94 | function customMenu(node) { |
94 | function customMenu(node) { |
|
95 | // The default set of menu items for all types |
95 | // The default set of menu items for all types |
|
96 | var items = { |
96 | var items = { |
|
97 | // Grab information about the item. |
97 | // Grab information about the item. |
|
98 | infoItem: { |
98 | infoItem: { |
|
99 | label: "Get Info", |
99 | label: "Get Info", |
|
100 | action: function(obj) { |
100 | action: function(obj) { |
|
101 | $('#popup').dialog({ |
101 | $('#popup').dialog({ |
|
102 | width: 800, |
102 | width: 800, |
|
103 | height: 600, |
103 | height: 600, |
|
104 | modal: true, |
104 | modal: true, |
|
105 | resizable: false, |
105 | resizable: false, |
|
106 | dialogClass: 'no-close texture-dialog' |
106 | dialogClass: 'no-close texture-dialog' |
|
107 | }).on('dialogclose', function(event) { |
107 | }).on('dialogclose', function(event) { |
|
108 | $('#content').html(''); |
108 | $('#content').html(''); |
|
109 | }); |
109 | }); |
|
110 | $.ajax({ |
110 | $.ajax({ |
|
111 | type: 'POST', |
111 | type: 'POST', |
|
112 | url: '/', |
112 | url: '/', |
|
113 | dataType: 'json', |
113 | dataType: 'json', |
|
114 | data: { |
114 | data: { |
|
115 | command: 'getinventorydata', |
115 | command: 'getinventorydata', |
|
116 | item: node.id.split(/[\/]+/).pop(), |
116 | item: node.id.split(/[\/]+/).pop(), |
|
117 | data: [ |
117 | data: [ |
|
118 | 'AssetUUID', |
118 | 'AssetUUID', |
|
119 | 'CreationDate', |
119 | 'CreationDate', |
|
120 | 'Description', |
120 | 'Description', |
|
121 | 'Permissions', |
121 | 'Permissions', |
|
122 | 'UUID' // part of InventoryBase |
122 | 'UUID' // part of InventoryBase |
|
123 | ] |
123 | ] |
|
124 | } |
124 | } |
|
125 | }).done(function(data) { |
125 | }).done(function(data) { |
|
126 | $('#content').html(ConvertJsonToTable(data, null, null, null)); |
126 | $('#content').html(ConvertJsonToTable(data, null, null, null)); |
|
127 | }); |
127 | }); |
|
128 | } |
128 | } |
|
129 | } |
129 | } |
|
130 | }; |
130 | }; |
|
131 | |
131 | |
|
132 | // Give inventory items menu for anything but folders. |
132 | // Give inventory items menu for anything but folders. |
|
133 | // They could be supported too but would require first |
133 | // They could be supported too but would require first |
|
134 | // counting the number of items inside the folder and |
134 | // counting the number of items inside the folder and |
|
135 | // only accepting to send if the number is below max. |
135 | // only accepting to send if the number is below max. |
|
136 | if (node.data.type != "folder") { |
136 | if (node.data.type != "folder") { |
|
137 | $.extend(items, { |
137 | $.extend(items, { |
|
138 | giveItem: { |
138 | giveItem: { |
|
139 | label: "Give", |
139 | label: "Give", |
|
140 | action: function(obj) { |
140 | action: function(obj) { |
|
141 | $("#content").html('<form><fieldset class="ui-helper-reset"><label for="firstname">Firstname</label><input type="text" name="firstname" id="firstname" value="" class="ui-widget-content ui-corner-all"><br/><label for="lastname">Lastname</label><input type="text" name="lastname" id="lastname" value="" class="ui-widget-content ui-corner-all"></fieldset></form>'); |
141 | $("#content").html('<form><fieldset class="ui-helper-reset"><label for="firstname">Firstname</label><input type="text" name="firstname" id="firstname" value="" class="ui-widget-content ui-corner-all"><br/><label for="lastname">Lastname</label><input type="text" name="lastname" id="lastname" value="" class="ui-widget-content ui-corner-all"></fieldset></form>'); |
|
142 | $("#popup").dialog({ |
142 | $("#popup").dialog({ |
|
143 | width: 320, |
143 | width: 320, |
|
144 | height: 180, |
144 | height: 180, |
|
145 | modal: true, |
145 | modal: true, |
|
146 | resizable: false, |
146 | resizable: false, |
|
147 | buttons: { |
147 | buttons: { |
|
148 | Select: function() { |
148 | Select: function() { |
|
149 | if ($.trim($("#firstname").val()) == '' || |
149 | if ($.trim($("#firstname").val()) == '' || |
|
150 | $.trim($("#lastname").val()) == '') |
150 | $.trim($("#lastname").val()) == '') |
|
151 | return; |
151 | return; |
|
152 | var firstName = $("#firstname").val(); |
152 | var firstName = $("#firstname").val(); |
|
153 | var lastName = $("#lastname").val(); |
153 | var lastName = $("#lastname").val(); |
|
154 | $.ajax({ |
154 | $.ajax({ |
|
155 | type: 'POST', |
155 | type: 'POST', |
|
156 | url: "giveInventoryItem.php?t=" + Math.random(), |
156 | url: "giveInventoryItem.php?t=" + Math.random(), |
|
157 | data: { |
157 | data: { |
|
158 | uuid: node.id.split(/[\/]+/).pop(), |
158 | uuid: node.id.split(/[\/]+/).pop(), |
|
159 | firstname: firstName, |
159 | firstname: firstName, |
|
160 | lastname: lastName |
160 | lastname: lastName |
|
161 | } |
161 | } |
|
162 | }).done(function(data) { |
162 | }).done(function(data) { |
|
163 | $("#popup").dialog("close"); |
163 | $("#popup").dialog("close"); |
|
164 | if ($.trim(data) != '') |
164 | if ($.trim(data) != '') |
|
165 | alert(data); |
165 | alert(data); |
|
166 | }); |
166 | }); |
|
167 | }, |
167 | }, |
|
168 | Cancel: function() { |
168 | Cancel: function() { |
|
169 | $("#popup").dialog("close"); |
169 | $("#popup").dialog("close"); |
|
170 | } |
170 | } |
|
171 | } |
171 | } |
|
172 | }).on('dialogclose', function(event) { |
172 | }).on('dialogclose', function(event) { |
|
173 | $('#content').html(''); |
173 | $('#content').html(''); |
|
174 | $('#popup').dialog('option', 'buttons', {}); |
174 | $('#popup').dialog('option', 'buttons', {}); |
|
175 | }); |
175 | }); |
|
176 | } |
176 | } |
|
177 | } |
177 | } |
|
178 | }); |
178 | }); |
|
179 | } |
179 | } |
|
180 | |
180 | |
|
181 | // The "download" menu item for textures. |
181 | // The "download" menu item for textures. |
|
182 | if (node.data.type == "texture" || node.data.type == "snapshot") { |
182 | if (node.data.type == "texture" || node.data.type == "snapshot") { |
|
183 | $.extend(items, { |
183 | $.extend(items, { |
|
184 | downloadItem: { |
184 | downloadItem: { |
|
185 | label: "Download", |
185 | label: "Download", |
|
186 | "action": function(obj) { |
186 | "action": function(obj) { |
|
187 | $('#texture').attr('src', 'images/loader.gif'); |
187 | $('#texture').attr('src', 'images/loader.gif'); |
|
188 | $('#popup').dialog({ |
188 | $('#popup').dialog({ |
|
189 | width: 800, |
189 | width: 800, |
|
190 | height: 600, |
190 | height: 600, |
|
191 | modal: true, |
191 | modal: true, |
|
192 | resizable: false, |
192 | resizable: false, |
|
193 | dialogClass: 'no-close texture-dialog' |
193 | dialogClass: 'no-close texture-dialog' |
|
194 | }).on('dialogclose', function(event) { |
194 | }).on('dialogclose', function(event) { |
|
195 | $('#content').html(''); |
195 | $('#content').html(''); |
|
196 | }); |
196 | }); |
|
197 | $.ajax({ |
197 | $.ajax({ |
|
198 | type: 'POST', |
198 | type: 'POST', |
|
199 | url: "downloadTexture.php?t=" + Math.random(), |
199 | url: "downloadTexture.php?t=" + Math.random(), |
|
200 | data: { |
200 | data: { |
|
201 | uuid: node.id.split(/[\/]+/).pop() |
201 | uuid: node.id.split(/[\/]+/).pop() |
|
202 | } |
202 | } |
|
203 | }).done(function(data) { |
203 | }).done(function(data) { |
|
204 | $('#content').html('<img src="" align="middle" id="texture">'); |
204 | $('#content').html('<img src="" align="middle" id="texture">'); |
|
205 | $('#texture').attr('src', "data:image/png;base64," + data); |
205 | $('#texture').attr('src', "data:image/png;base64," + data); |
|
206 | }); |
206 | }); |
|
207 | } |
207 | } |
|
208 | } |
208 | } |
|
209 | }); |
209 | }); |
|
210 | } |
210 | } |
|
211 | |
211 | |
|
212 | // The "download" menu item for notecards. |
212 | // The "download" menu item for notecards. |
|
213 | if (node.data.type == "notecard") { |
213 | if (node.data.type == "notecard") { |
|
214 | $.extend(items, { |
214 | $.extend(items, { |
|
215 | downloadItem: { |
215 | downloadItem: { |
|
216 | label: "Download", |
216 | label: "Download", |
|
217 | "action": function(obj) { |
217 | "action": function(obj) { |
|
218 | $('#texture').attr('src', 'images/loader.gif'); |
218 | $('#texture').attr('src', 'images/loader.gif'); |
|
219 | $('#popup').dialog({ |
219 | $('#popup').dialog({ |
|
220 | width: 800, |
220 | width: 800, |
|
221 | height: 600, |
221 | height: 600, |
|
222 | modal: true, |
222 | modal: true, |
|
223 | resizable: false, |
223 | resizable: false, |
|
224 | dialogClass: 'no-close texture-dialog' |
224 | dialogClass: 'no-close texture-dialog' |
|
225 | }).on('dialogclose', function(event) { |
225 | }).on('dialogclose', function(event) { |
|
226 | $('#content').html(''); |
226 | $('#content').html(''); |
|
227 | }); |
227 | }); |
|
228 | $.ajax({ |
228 | $.ajax({ |
|
229 | type: 'POST', |
229 | type: 'POST', |
|
230 | url: "downloadNotecard.php?t=" + Math.random(), |
230 | url: "downloadNotecard.php?t=" + Math.random(), |
|
231 | data: { |
231 | data: { |
|
232 | uuid: node.id.split(/[\/]+/).pop() |
232 | uuid: node.id.split(/[\/]+/).pop() |
|
233 | } |
233 | } |
|
234 | }).done(function(data) { |
234 | }).done(function(data) { |
|
235 | $.base64.utf8decode = true; |
235 | $.base64.utf8decode = true; |
|
236 | $('#content').html('<pre>' + $.base64.atob(data) + '</pre>'); |
236 | $('#content').html('<pre>' + $.base64.atob(data) + '</pre>'); |
|
237 | }); |
237 | }); |
|
238 | } |
238 | } |
|
239 | } |
239 | } |
|
240 | }); |
240 | }); |
|
241 | } |
241 | } |
|
242 | |
242 | |
|
243 | // The "download" menu item for sounds. |
243 | // The "download" menu item for sounds. |
|
244 | if (node.data.type == "sound") { |
244 | if (node.data.type == "sound") { |
|
245 | $.extend(items, { |
245 | $.extend(items, { |
|
246 | downloadItem: { |
246 | downloadItem: { |
|
247 | label: "Download", |
247 | label: "Download", |
|
248 | "action": function(obj) { |
248 | "action": function(obj) { |
|
249 | $('#texture').attr('src', 'images/loader.gif'); |
249 | $('#texture').attr('src', 'images/loader.gif'); |
|
250 | $('#popup').dialog({ |
250 | $('#popup').dialog({ |
|
251 | width: 800, |
251 | width: 800, |
|
252 | height: 600, |
252 | height: 600, |
|
253 | modal: true, |
253 | modal: true, |
|
254 | resizable: false, |
254 | resizable: false, |
|
255 | dialogClass: 'no-close texture-dialog' |
255 | dialogClass: 'no-close texture-dialog' |
|
256 | }).on('dialogclose', function(event) { |
256 | }).on('dialogclose', function(event) { |
|
257 | $('#content').html(''); |
257 | $('#content').html(''); |
|
258 | }); |
258 | }); |
|
259 | $.ajax({ |
259 | $.ajax({ |
|
260 | type: 'POST', |
260 | type: 'POST', |
|
261 | url: "downloadSound.php?t=" + Math.random(), |
261 | url: "downloadSound.php?t=" + Math.random(), |
|
262 | data: { |
262 | data: { |
|
263 | uuid: node.id.split(/[\/]+/).pop() |
263 | uuid: node.id.split(/[\/]+/).pop() |
|
264 | } |
264 | } |
|
265 | }).done(function(data) { |
265 | }).done(function(data) { |
|
266 | $('#content').html('<audio controls="controls"><source id="source" src="" type="audio/mp3"></source></audio>'); |
266 | $('#content').html('<audio controls="controls"><source id="source" src="" type="audio/mp3"></source></audio>'); |
|
267 | $('#source').attr('src', "data:audio/mp3;base64," + data); |
267 | $('#source').attr('src', "data:audio/mp3;base64," + data); |
|
268 | }); |
268 | }); |
|
269 | } |
269 | } |
|
270 | } |
270 | } |
|
271 | }); |
271 | }); |
|
272 | } |
272 | } |
|
273 | |
273 | |
|
274 | return items; |
274 | return items; |
|
275 | } |
275 | } |
|
276 | |
276 | |
|
277 | $("#tree").jstree({ |
277 | $("#tree").jstree({ |
|
278 | // - sort will sort items by date |
278 | // - sort will sort items by date |
|
279 | // - state will store the open / closed state of the jstree |
279 | // - state will store the open / closed state of the jstree |
|
280 | 'plugins': ["themes", "json_data", "ui", "contextmenu", "sort", "dnd", "state"], |
280 | 'plugins': ["themes", "json_data", "ui", "contextmenu", "sort", "dnd", "state"], |
|
281 | /*'contextmenu': { |
281 | /*'contextmenu': { |
|
282 | "items": function(node) { |
282 | "items": function(node) { |
|
283 | return customMenu(node); |
283 | return customMenu(node); |
|
284 | } |
284 | } |
|
285 | },*/ |
285 | },*/ |
|
286 | 'dnd': { |
286 | 'dnd': { |
|
287 | // Do not copy items. |
287 | // Do not copy items. |
|
288 | 'copy': false, |
288 | 'copy': false, |
|
289 | // Do not execute the check callback whilst dragging. |
289 | // Do not execute the check callback whilst dragging. |
|
290 | 'check_while_dragging': false |
290 | 'check_while_dragging': false |
|
291 | }, |
291 | }, |
|
292 | 'sort': function(a, b) { |
292 | 'sort': function(a, b) { |
|
293 | return Date.parse(this.get_node(a).data.time) < |
293 | return Date.parse(this.get_node(a).data.time) < |
|
294 | Date.parse(this.get_node(b).data.time) ? 1 : -1; |
294 | Date.parse(this.get_node(b).data.time) ? 1 : -1; |
|
295 | }, |
295 | }, |
|
296 | 'core': { |
296 | 'core': { |
|
297 | /*'check_callback': function(operation, node, parent, position, more) { |
297 | /*'check_callback': function(operation, node, parent, position, more) { |
|
298 | // Do not allow moves above the root node. |
298 | // Do not allow moves above the root node. |
|
299 | if (parent.id == "#") |
299 | if (parent.id == "#") |
|
300 | return false; |
300 | return false; |
|
301 | |
301 | |
|
302 | var moved = false; |
302 | var moved = false; |
|
303 | $.ajax({ |
303 | $.ajax({ |
|
304 | // A synchronous reply is needed so we know what to tell the tree. |
304 | // A synchronous reply is needed so we know what to tell the tree. |
|
305 | async: false, |
305 | async: false, |
|
306 | type: 'POST', |
306 | type: 'POST', |
|
307 | url: "moveInventoryItem.php?t=" + Math.random(), |
307 | url: "moveInventoryItem.php?t=" + Math.random(), |
|
308 | data: { |
308 | data: { |
|
309 | source: node.id, |
309 | source: node.id, |
|
310 | target: parent.id |
310 | target: parent.id |
|
311 | } |
311 | } |
|
312 | }).done(function(data) { |
312 | }).done(function(data) { |
|
313 | if ($.trim(data) != 'success') { |
313 | if ($.trim(data) != 'success') { |
|
314 | if ($.trim(data) != '') |
314 | if ($.trim(data) != '') |
|
315 | alert(data); |
315 | alert(data); |
|
316 | return; |
316 | return; |
|
317 | } |
317 | } |
|
318 | moved = true; |
318 | moved = true; |
|
319 | }); |
319 | }); |
|
320 | return moved; |
320 | return moved; |
|
321 | },*/ |
321 | },*/ |
|
322 | data: function(node, callback) { |
322 | data: function(node, callback) { |
|
323 | if(node.id === '#') { |
323 | if(node.id === '#') { |
|
324 | callback.call(this, [ |
324 | callback.call(this, [ |
|
325 | { |
325 | { |
|
326 | "id" : "/My Inventory", |
326 | "id" : "/My Inventory", |
|
327 | "parent" : "#", |
327 | "parent" : "#", |
|
328 | "text" : "My Inventory", |
328 | "text" : "My Inventory", |
|
329 | "data" : { |
329 | "data" : { |
|
330 | "type" : |
330 | "type" : |
|
331 | "folder" |
331 | "folder" |
|
332 | }, |
332 | }, |
|
333 | "children" : true, |
333 | "children" : true, |
|
334 | "opened" : false |
334 | "opened" : false |
|
335 | }, |
335 | }, |
|
336 | { |
336 | { |
|
337 | "id" : "/Library", |
337 | "id" : "/Library", |
|
338 | "parent" : "#", |
338 | "parent" : "#", |
|
339 | "text" : "Library", |
339 | "text" : "Library", |
|
340 | "data" : { |
340 | "data" : { |
|
341 | "type" : |
341 | "type" : |
|
342 | "folder" |
342 | "folder" |
|
343 | }, |
343 | }, |
|
344 | "children" : true, |
344 | "children" : true, |
|
345 | "opened" : false |
345 | "opened" : false |
|
346 | } |
346 | } |
|
347 | ]); |
347 | ]); |
|
348 | return; |
348 | return; |
|
349 | } |
349 | } |
|
350 | $.ajax({ |
350 | $.ajax({ |
|
351 | //async: false, |
351 | //async: false, |
|
352 | type: 'POST', |
352 | type: 'POST', |
|
353 | url: '/', |
353 | url: '/', |
|
354 | dataType: 'json', |
354 | dataType: 'json', |
|
355 | data: { |
355 | data: { |
|
356 | command: 'inventory', |
356 | command: 'inventory', |
|
357 | action: 'ls', |
357 | action: 'ls', |
|
358 | path: node.id |
358 | path: node.id |
|
359 | } |
359 | } |
|
360 | }).done(function(response) { |
360 | }).done(function(response) { |
|
361 | var data = wasCSVToArray(response.data); |
361 | var data = wasCSVToArray(response.data); |
|
362 | alert(JSON.stringify(data.chunk(10), 4, null)); |
362 | alert(JSON.stringify(data.chunk(10), 4, null)); |
|
363 | /*$.each($.stride(data, 10), function(i, e) { |
363 | $.each(data.chunk(10), function(i, e) { |
|
364 | alert(e); |
364 | alert(wasKeyValueObjectify(e)); |
|
365 | data.push({ |
365 | /*data.push({ |
|
366 | x: time + ++j * updateInterval, |
366 | x: time + ++j * updateInterval, |
|
367 | y: parseInt(e) |
367 | y: parseInt(e) |
|
368 | }); |
368 | });*/ |
|
369 | });*/ |
369 | }); |
|
370 | }); |
370 | }); |
|
371 | } |
371 | } |
|
372 | } |
372 | } |
|
373 | }).bind('move_node.jstree', function(e, data) { |
373 | }).bind('move_node.jstree', function(e, data) { |
|
374 | // Once the node is moved, update the node ID to reflect the path change. |
374 | // Once the node is moved, update the node ID to reflect the path change. |
|
375 | var parentPath = data.parent != '/' ? data.parent : ""; |
375 | var parentPath = data.parent != '/' ? data.parent : ""; |
|
376 | var item = data.node.id.split(/[\/]+/).pop(); |
376 | var item = data.node.id.split(/[\/]+/).pop(); |
|
377 | data.instance.set_id(data.node, parentPath + '/' + item); |
377 | data.instance.set_id(data.node, parentPath + '/' + item); |
|
378 | }); |
378 | }); |
|
379 | }); |
379 | }); |
|
380 | </script> |
380 | </script> |
|
381 | </body> |
381 | </body> |
|
382 | </html> |
382 | </html> |
|
383 | |
383 | |