corrade-nucleus-nucleons – Diff between revs 18 and 20
?pathlinks?
Rev 18 | Rev 20 | |||
---|---|---|---|---|
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="/node_modules/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/node_modules/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css"> |
|
23 | <!-- Bootstrap table --> |
23 | <!-- Bootstrap table --> |
|
24 | <link href="/pack-rat/bower_components/bootstrap-table/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css"> |
24 | <link href="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css"> |
|
25 | </script> |
25 | </script> |
|
26 | </head> |
26 | </head> |
|
27 | |
27 | |
|
28 | <body> |
28 | <body> |
|
29 | <!-- Bootstrap Modal --> |
29 | <!-- Bootstrap Modal --> |
|
30 | <div id="item-info-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
30 | <div id="item-info-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
|
31 | <div class="modal-dialog modal-lg"> |
31 | <div class="modal-dialog modal-lg"> |
|
32 | <!-- Modal content--> |
32 | <!-- Modal content--> |
|
33 | |
33 | |
|
34 | <div class="modal-content"> |
34 | <div class="modal-content"> |
|
35 | <div class="modal-header"> |
35 | <div class="modal-header"> |
|
36 | <button type="button" class="close" data-dismiss="modal">×</button> |
36 | <button type="button" class="close" data-dismiss="modal">×</button> |
|
37 | |
37 | |
|
38 | <h1 id="title" class="modal-title"></h1> |
38 | <h1 id="title" class="modal-title"></h1> |
|
39 | </div> |
39 | </div> |
|
40 | |
40 | |
|
41 | <div id="content" class="modal-body"> |
41 | <div id="content" class="modal-body"> |
|
42 | <table id="info" data-height="460"> |
42 | <table id="info" data-height="460"> |
|
43 | <thead> |
43 | <thead> |
|
44 | <tr> |
44 | <tr> |
|
45 | <th data-field="AssetUUID">Asset UUID</th> |
45 | <th data-field="AssetUUID">Asset UUID</th> |
|
46 | <th data-field="CreationDate">Creation Date</th> |
46 | <th data-field="CreationDate">Creation Date</th> |
|
47 | <th data-field="Description">Description</th> |
47 | <th data-field="Description">Description</th> |
|
48 | <th data-field="Permissions">Permissions</th> |
48 | <th data-field="Permissions">Permissions</th> |
|
49 | <th data-field="UUID">Inventory UUID</th> |
49 | <th data-field="UUID">Inventory UUID</th> |
|
50 | </tr> |
50 | </tr> |
|
51 | </thead> |
51 | </thead> |
|
52 | </table> |
52 | </table> |
|
53 | </div> |
53 | </div> |
|
54 | <div class="modal-footer"> |
54 | <div class="modal-footer"> |
|
55 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
55 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
56 | </div> |
56 | </div> |
|
57 | </div> |
57 | </div> |
|
58 | </div> |
58 | </div> |
|
59 | </div> |
59 | </div> |
|
60 | |
60 | |
|
61 | <!-- Give Inventory Item Destination Dialog --> |
61 | <!-- Give Inventory Item Destination Dialog --> |
|
62 | <div id="avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
62 | <div id="avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
|
63 | <div class="modal-dialog modal-lg"> |
63 | <div class="modal-dialog modal-lg"> |
|
64 | <!-- Modal content--> |
64 | <!-- Modal content--> |
|
65 | |
65 | |
|
66 | <div class="modal-content"> |
66 | <div class="modal-content"> |
|
67 | <div class="modal-header"> |
67 | <div class="modal-header"> |
|
68 | <button type="button" class="close" data-dismiss="modal">×</button> |
68 | <button type="button" class="close" data-dismiss="modal">×</button> |
|
69 | |
69 | |
|
70 | <h1 id="title" class="modal-title">Avatar Selection</h1> |
70 | <h1 id="title" class="modal-title">Avatar Selection</h1> |
|
71 | </div> |
71 | </div> |
|
72 | |
72 | |
|
73 | <form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
73 | <form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
|
74 | <div id="content" class="modal-body"> |
74 | <div id="content" class="modal-body"> |
|
75 | <p>Please enter the avatar firstname and lastname to send the script to.</p> |
75 | <p>Please enter the avatar firstname and lastname to send the script to.</p> |
|
76 | <div class="form-group has-feedback"> |
76 | <div class="form-group has-feedback"> |
|
77 | <label for="avatar-firstname">First Name</label> |
77 | <label for="avatar-firstname">First Name</label> |
|
78 | <input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
78 | <input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
|
79 | <label for="avatar-lastname">Last Name</label> |
79 | <label for="avatar-lastname">Last Name</label> |
|
80 | <input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
80 | <input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required> |
|
81 | </div> |
81 | </div> |
|
82 | </div> |
82 | </div> |
|
83 | <div class="modal-footer"> |
83 | <div class="modal-footer"> |
|
84 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
84 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
85 | <button id="send-script" type="submit" class="btn btn-primary">Confirm</button> |
85 | <button id="send-script" type="submit" class="btn btn-primary">Confirm</button> |
|
86 | </div> |
86 | </div> |
|
87 | </form> |
87 | </form> |
|
88 | </div> |
88 | </div> |
|
89 | </div> |
89 | </div> |
|
90 | </div> |
90 | </div> |
|
91 | |
91 | |
|
92 | <!-- Texture Download Dialog --> |
92 | <!-- Texture Download Dialog --> |
|
93 | <div id="texture-download-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
93 | <div id="texture-download-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
|
94 | <div class="modal-dialog modal-lg"> |
94 | <div class="modal-dialog modal-lg"> |
|
95 | <!-- Modal content--> |
95 | <!-- Modal content--> |
|
96 | |
96 | |
|
97 | <div class="modal-content"> |
97 | <div class="modal-content"> |
|
98 | <div class="modal-header"> |
98 | <div class="modal-header"> |
|
99 | <button type="button" class="close" data-dismiss="modal">×</button> |
99 | <button type="button" class="close" data-dismiss="modal">×</button> |
|
100 | |
100 | |
|
101 | <h1 id="title" class="modal-title">Avatar Selection</h1> |
101 | <h1 id="title" class="modal-title">Avatar Selection</h1> |
|
102 | </div> |
102 | </div> |
|
103 | |
103 | |
|
104 | <div id="content" class="modal-body"> |
104 | <div id="content" class="modal-body"> |
|
105 | <img src="" align="middle" id="texture"> |
105 | <img src="" align="middle" id="texture"> |
|
106 | </div> |
106 | </div> |
|
107 | |
107 | |
|
108 | <div class="modal-footer"> |
108 | <div class="modal-footer"> |
|
109 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
109 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
|
110 | </div> |
110 | </div> |
|
111 | </div> |
111 | </div> |
|
112 | </div> |
112 | </div> |
|
113 | </div> |
113 | </div> |
|
114 | |
114 | |
|
115 | <div class="container"> |
115 | <div class="container"> |
|
116 | <div class="jumbotron"> |
116 | <div class="jumbotron"> |
|
117 | <h1>Corrade Pack Rat</h1> |
117 | <h1>Corrade Pack Rat</h1> |
|
118 | <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> |
118 | <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> |
|
119 | <img src="/pack-rat/img/pack-rat.png"></div> |
119 | <img src="/pack-rat/img/pack-rat.png"></div> |
|
120 | |
120 | |
|
121 | <!-- Will hold the inventory tree (completed dynamically). --> |
121 | <!-- Will hold the inventory tree (completed dynamically). --> |
|
122 | <div id="tree"> |
122 | <div id="tree"> |
|
123 | </div> |
123 | </div> |
|
124 | |
124 | |
|
125 | <footer class="footer"> |
125 | <footer class="footer"> |
|
126 | <p>© 2017 Wizardry and Steamworks</p> |
126 | <p>© 2017 Wizardry and Steamworks</p> |
|
127 | </footer> |
127 | </footer> |
|
128 | </div> |
128 | </div> |
|
129 | <!-- jQuery --> |
129 | <!-- jQuery --> |
|
130 | <script src="/bower_components/jquery/dist/jquery.min.js" type="text/javascript"></script> |
130 | <script src="/node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script> |
|
131 | <!-- Wizardry and Steamworks JavaScript Includes --> |
131 | <!-- Wizardry and Steamworks JavaScript Includes --> |
|
132 | <script src="/bower_components/was/dist/was.min.js" type="text/javascript"></script> |
132 | <script src="/node_modules/was/dist/was.min.js" type="text/javascript"></script> |
|
133 | <!-- Bootstrap Javascript --> |
133 | <!-- Bootstrap Javascript --> |
|
134 | <script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
134 | <script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script> |
|
135 | <script type="text/javascript" src="/pack-rat/bower_components/bootstrap-table/dist/bootstrap-table.min.js"></script> |
135 | <script src="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.js" type="text/javascript"></script> |
|
136 | <!-- Bootstrap Form Validator --> |
136 | <!-- Bootstrap Form Validator --> |
|
137 | <script src="/pack-rat/bower_components/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
137 | <script src="/node_modules/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script> |
|
138 | <!-- XML <-> JSON --> |
- | ||
139 | <!-- <script src="/bootstrap/bower_components/x2js/xml2json.min.js" type="text/javascript"></script> --> |
- | ||
140 | <!-- CryptoJS --> |
138 | <!-- CryptoJS --> |
|
141 | <script src="/bower_components/cryptojslib/components/core.js" type="text/javascript"></script> |
139 | <script src="/node_modules/cryptojslib/lib/Crypto.js" type="text/javascript"></script> |
|
142 | <script src="/bower_components/cryptojslib/rollups/md5.js" type="text/javascript"></script> |
140 | <script src="/node_modules/cryptojslib/lib/MD5.js" type="text/javascript"></script> |
|
143 | <!-- Form To Object --> |
- | ||
144 | <!-- <script src="/bootstrap/node_modules/form_to_object/dist/formToObject.min.js" type="text/javascript"></script> --> |
- | ||
145 | <!-- Load form processor. --> |
- | ||
146 | <!-- <script src="/bootstrap/js/corrade-bootstrap-processor.js" type="text/javascript"></script> --> |
- | ||
147 | <!-- Moment JS --> |
141 | <!-- Moment JS --> |
|
148 | <script src="/pack-rat/bower_components/moment/min/moment.min.js" type="text/javascript"></script> |
142 | <script src="/pack-rat/node_modules/moment/min/moment.min.js" type="text/javascript"></script> |
|
149 | <!-- JsTree --> |
143 | <!-- JsTree --> |
|
150 | <script src="/pack-rat/bower_components/jstree/dist/jstree.min.js" type="text/javascript"></script> |
144 | <script src="/pack-rat/node_modules/jstree/dist/jstree.min.js" type="text/javascript"></script> |
|
151 | <!-- JSON to Table --> |
145 | <!-- JSON to Table --> |
|
152 | <script src="/pack-rat/bower_components/json-to-table/json-to-table.js" type="text/javascript"></script> |
146 | <script src="/pack-rat/node_modules/json-to-table/json-to-table.js" type="text/javascript"></script> |
|
153 | <!-- Main script --> |
147 | <!-- Main script --> |
|
154 | <script type="text/javascript"> |
148 | <script type="text/javascript"> |
|
155 | $(function() { |
149 | $(function() { |
|
156 | function customMenu(node) { |
150 | function customMenu(node) { |
|
157 | // The default set of menu items for all types |
151 | // The default set of menu items for all types |
|
158 | var items = { |
152 | var items = { |
|
159 | // Grab information about the item. |
153 | // Grab information about the item. |
|
160 | infoItem: { |
154 | infoItem: { |
|
161 | label: "Get Info", |
155 | label: "Get Info", |
|
162 | action: function(obj) { |
156 | action: function(obj) { |
|
163 | $.ajax({ |
157 | $.ajax({ |
|
164 | //async: false, |
158 | //async: false, |
|
165 | type: 'POST', |
159 | type: 'POST', |
|
166 | url: '/', |
160 | url: '/', |
|
167 | dataType: 'json', |
161 | dataType: 'json', |
|
168 | data: { |
162 | data: { |
|
169 | command: 'getinventorydata', |
163 | command: 'getinventorydata', |
|
170 | item: node.id, |
164 | item: node.id, |
|
171 | data: wasArrayToCSV([ |
165 | data: wasArrayToCSV([ |
|
172 | 'AssetUUID', |
166 | 'AssetUUID', |
|
173 | 'CreationDate', |
167 | 'CreationDate', |
|
174 | 'Description', |
168 | 'Description', |
|
175 | 'Permissions', |
169 | 'Permissions', |
|
176 | 'UUID' // part of InventoryBase |
170 | 'UUID' // part of InventoryBase |
|
177 | ]) |
171 | ]) |
|
178 | } |
172 | } |
|
179 | }).done(function(response) { |
173 | }).done(function(response) { |
|
180 | if(response.success !== 'True') { |
174 | if(response.success !== 'True') { |
|
181 | alert('Error moving item: ' + response.error); |
175 | alert('Error moving item: ' + response.error); |
|
182 | return; |
176 | return; |
|
183 | } |
177 | } |
|
184 | $('#info').bootstrapTable({ |
178 | $('#info').bootstrapTable({ |
|
185 | data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ] |
179 | data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ] |
|
186 | }); |
180 | }); |
|
187 | $('#item-info-modal').modal('show'); |
181 | $('#item-info-modal').modal('show'); |
|
188 | }); |
182 | }); |
|
189 | } |
183 | } |
|
190 | } |
184 | } |
|
191 | }; |
185 | }; |
|
192 | |
186 | |
|
193 | // Give inventory items menu for anything but folders. |
187 | // Give inventory items menu for anything but folders. |
|
194 | // They could be supported too but would require first |
188 | // They could be supported too but would require first |
|
195 | // counting the number of items inside the folder and |
189 | // counting the number of items inside the folder and |
|
196 | // only accepting to send if the number is below max. |
190 | // only accepting to send if the number is below max. |
|
197 | if (node.data.type != "folder") { |
191 | if (node.data.type != "folder") { |
|
198 | $.extend(items, { |
192 | $.extend(items, { |
|
199 | giveItem: { |
193 | giveItem: { |
|
200 | label: "Give", |
194 | label: "Give", |
|
201 | action: function(obj) { |
195 | action: function(obj) { |
|
202 | $('#avatar-select-modal') |
196 | $('#avatar-select-modal') |
|
203 | .modal('show') |
197 | .modal('show') |
|
204 | .on('click', '#send-script', function(e) { |
198 | .on('click', '#send-script', function(e) { |
|
205 | $('#avatar-select-modal').modal('hide'); |
199 | $('#avatar-select-modal').modal('hide'); |
|
206 | $.ajax({ |
200 | $.ajax({ |
|
207 | type: 'POST', |
201 | type: 'POST', |
|
208 | url: '/', |
202 | url: '/', |
|
209 | data: { |
203 | data: { |
|
210 | command: 'give', |
204 | command: 'give', |
|
211 | entity: 'avatar', |
205 | entity: 'avatar', |
|
212 | item: node.id, |
206 | item: node.id, |
|
213 | firstname: $('#avatar-firstname').val(), |
207 | firstname: $('#avatar-firstname').val(), |
|
214 | lastname: $('#avatar-lastname').val() |
208 | lastname: $('#avatar-lastname').val() |
|
215 | }, |
209 | }, |
|
216 | dataType: 'json' |
210 | dataType: 'json' |
|
217 | }).done(function(response) { |
211 | }).done(function(response) { |
|
218 | if(response.success !== 'True') { |
212 | if(response.success !== 'True') { |
|
219 | alert('Error sending item: ' + response.error); |
213 | alert('Error sending item: ' + response.error); |
|
220 | return; |
214 | return; |
|
221 | } |
215 | } |
|
222 | }); |
216 | }); |
|
223 | }); |
217 | }); |
|
224 | } |
218 | } |
|
225 | } |
219 | } |
|
226 | }); |
220 | }); |
|
227 | } |
221 | } |
|
228 | |
222 | |
|
229 | // The "download" menu item for textures. |
223 | // The "download" menu item for textures. |
|
230 | if (node.data.type == "texture" || node.data.type == "snapshot") { |
224 | if (node.data.type == "texture" || node.data.type == "snapshot") { |
|
231 | $.extend(items, { |
225 | $.extend(items, { |
|
232 | downloadItem: { |
226 | downloadItem: { |
|
233 | label: "Download", |
227 | label: "Download", |
|
234 | "action": function(obj) { |
228 | "action": function(obj) { |
|
235 | $('#texture').attr('src', '/pack-rat/img/loader.gif'); |
229 | $('#texture').attr('src', '/pack-rat/img/loader.gif'); |
|
236 | $('#texture-download-modal').modal('show'); |
230 | $('#texture-download-modal').modal('show'); |
|
237 | $.ajax({ |
231 | $.ajax({ |
|
238 | type: 'POST', |
232 | type: 'POST', |
|
239 | url: '/', |
233 | url: '/', |
|
240 | data: { |
234 | data: { |
|
241 | command: 'download', |
235 | command: 'download', |
|
242 | item: node.id, |
236 | item: node.id, |
|
243 | format: 'Png', |
237 | format: 'Png', |
|
244 | type: 'Texture' |
238 | type: 'Texture' |
|
245 | }, |
239 | }, |
|
246 | dataType: 'json' |
240 | dataType: 'json' |
|
247 | }).done(function(response) { |
241 | }).done(function(response) { |
|
248 | $('#texture').attr('src', "data:image/png;base64," + response.data); |
242 | $('#texture').attr('src', "data:image/png;base64," + response.data); |
|
249 | }); |
243 | }); |
|
250 | } |
244 | } |
|
251 | } |
245 | } |
|
252 | }); |
246 | }); |
|
253 | } |
247 | } |
|
254 | |
248 | |
|
255 | // The "download" menu item for notecards. |
249 | // The "download" menu item for notecards. |
|
256 | if (node.data.type == "notecard") { |
250 | if (node.data.type == "notecard") { |
|
257 | $.extend(items, { |
251 | $.extend(items, { |
|
258 | downloadItem: { |
252 | downloadItem: { |
|
259 | label: "Download", |
253 | label: "Download", |
|
260 | "action": function(obj) { |
254 | "action": function(obj) { |
|
261 | $('#texture').attr('src', 'images/loader.gif'); |
255 | $('#texture').attr('src', 'images/loader.gif'); |
|
262 | $('#popup').dialog({ |
256 | $('#popup').dialog({ |
|
263 | width: 800, |
257 | width: 800, |
|
264 | height: 600, |
258 | height: 600, |
|
265 | modal: true, |
259 | modal: true, |
|
266 | resizable: false, |
260 | resizable: false, |
|
267 | dialogClass: 'no-close texture-dialog' |
261 | dialogClass: 'no-close texture-dialog' |
|
268 | }).on('dialogclose', function(event) { |
262 | }).on('dialogclose', function(event) { |
|
269 | $('#content').html(''); |
263 | $('#content').html(''); |
|
270 | }); |
264 | }); |
|
271 | $.ajax({ |
265 | $.ajax({ |
|
272 | type: 'POST', |
266 | type: 'POST', |
|
273 | url: "downloadNotecard.php?t=" + Math.random(), |
267 | url: "downloadNotecard.php?t=" + Math.random(), |
|
274 | data: { |
268 | data: { |
|
275 | uuid: node.id.split(/[\/]+/).pop() |
269 | uuid: node.id.split(/[\/]+/).pop() |
|
276 | } |
270 | } |
|
277 | }).done(function(data) { |
271 | }).done(function(data) { |
|
278 | $.base64.utf8decode = true; |
272 | $.base64.utf8decode = true; |
|
279 | $('#content').html('<pre>' + $.base64.atob(data) + '</pre>'); |
273 | $('#content').html('<pre>' + $.base64.atob(data) + '</pre>'); |
|
280 | }); |
274 | }); |
|
281 | } |
275 | } |
|
282 | } |
276 | } |
|
283 | }); |
277 | }); |
|
284 | } |
278 | } |
|
285 | |
279 | |
|
286 | // The "download" menu item for sounds. |
280 | // The "download" menu item for sounds. |
|
287 | if (node.data.type == "sound") { |
281 | if (node.data.type == "sound") { |
|
288 | $.extend(items, { |
282 | $.extend(items, { |
|
289 | downloadItem: { |
283 | downloadItem: { |
|
290 | label: "Download", |
284 | label: "Download", |
|
291 | "action": function(obj) { |
285 | "action": function(obj) { |
|
292 | $('#texture').attr('src', 'images/loader.gif'); |
286 | $('#texture').attr('src', 'images/loader.gif'); |
|
293 | $('#popup').dialog({ |
287 | $('#popup').dialog({ |
|
294 | width: 800, |
288 | width: 800, |
|
295 | height: 600, |
289 | height: 600, |
|
296 | modal: true, |
290 | modal: true, |
|
297 | resizable: false, |
291 | resizable: false, |
|
298 | dialogClass: 'no-close texture-dialog' |
292 | dialogClass: 'no-close texture-dialog' |
|
299 | }).on('dialogclose', function(event) { |
293 | }).on('dialogclose', function(event) { |
|
300 | $('#content').html(''); |
294 | $('#content').html(''); |
|
301 | }); |
295 | }); |
|
302 | $.ajax({ |
296 | $.ajax({ |
|
303 | type: 'POST', |
297 | type: 'POST', |
|
304 | url: "downloadSound.php?t=" + Math.random(), |
298 | url: "downloadSound.php?t=" + Math.random(), |
|
305 | data: { |
299 | data: { |
|
306 | uuid: node.id.split(/[\/]+/).pop() |
300 | uuid: node.id.split(/[\/]+/).pop() |
|
307 | } |
301 | } |
|
308 | }).done(function(data) { |
302 | }).done(function(data) { |
|
309 | $('#content').html('<audio controls="controls"><source id="source" src="" type="audio/mp3"></source></audio>'); |
303 | $('#content').html('<audio controls="controls"><source id="source" src="" type="audio/mp3"></source></audio>'); |
|
310 | $('#source').attr('src', "data:audio/mp3;base64," + data); |
304 | $('#source').attr('src', "data:audio/mp3;base64," + data); |
|
311 | }); |
305 | }); |
|
312 | } |
306 | } |
|
313 | } |
307 | } |
|
314 | }); |
308 | }); |
|
315 | } |
309 | } |
|
316 | |
310 | |
|
317 | return items; |
311 | return items; |
|
318 | } |
312 | } |
|
319 | |
313 | |
|
320 | $("#tree").jstree({ |
314 | $("#tree").jstree({ |
|
321 | // - sort will sort items by date |
315 | // - sort will sort items by date |
|
322 | // - state will store the open / closed state of the jstree |
316 | // - state will store the open / closed state of the jstree |
|
323 | 'plugins': ["themes", "json_data", "ui", "contextmenu", "sort", "dnd", "state"], |
317 | 'plugins': ["themes", "json_data", "ui", "contextmenu", "sort", "dnd", "state"], |
|
324 | 'contextmenu': { |
318 | 'contextmenu': { |
|
325 | "items": function(node) { |
319 | "items": function(node) { |
|
326 | return customMenu(node); |
320 | return customMenu(node); |
|
327 | } |
321 | } |
|
328 | }, |
322 | }, |
|
329 | 'dnd': { |
323 | 'dnd': { |
|
330 | // Do not copy items. |
324 | // Do not copy items. |
|
331 | 'copy': false, |
325 | 'copy': false, |
|
332 | // Do not execute the check callback whilst dragging. |
326 | // Do not execute the check callback whilst dragging. |
|
333 | 'check_while_dragging': true |
327 | 'check_while_dragging': true |
|
334 | }, |
328 | }, |
|
335 | 'sort': function(a, b) { |
329 | 'sort': function(a, b) { |
|
336 | return this.get_node(a).data.time < this.get_node(b).data.time ? 1 : -1; |
330 | return this.get_node(a).data.time < this.get_node(b).data.time ? 1 : -1; |
|
337 | }, |
331 | }, |
|
338 | 'core': { |
332 | 'core': { |
|
339 | 'check_callback': function(operation, node, parent, position, more) { |
333 | 'check_callback': function(operation, node, parent, position, more) { |
|
340 | // Only allow move operations |
334 | // Only allow move operations |
|
341 | if (operation !== 'move_node' || |
335 | if (operation !== 'move_node' || |
|
342 | // Do not move system folders. |
336 | // Do not move system folders. |
|
343 | node.data.system !== false || |
337 | node.data.system !== false || |
|
344 | // Do not allow moves above the root node. |
338 | // Do not allow moves above the root node. |
|
345 | parent.id === "#" || |
339 | parent.id === "#" || |
|
346 | // Do not allow moving an item over another item. |
340 | // Do not allow moving an item over another item. |
|
347 | (node.data.type !== 'folder' && parent.data.type !== 'folder')) |
341 | (node.data.type !== 'folder' && parent.data.type !== 'folder')) |
|
348 | return false; |
342 | return false; |
|
349 | |
343 | |
|
350 | var source = node.id; |
344 | var source = node.id; |
|
351 | var target = parent.id; |
345 | var target = parent.id; |
|
352 | |
346 | |
|
353 | // Normalize source and target. |
347 | // Normalize source and target. |
|
354 | if(source === '#') |
348 | if(source === '#') |
|
355 | source = '/'; |
349 | source = '/'; |
|
356 | |
350 | |
|
357 | if(target === '#') |
351 | if(target === '#') |
|
358 | target = '/'; |
352 | target = '/'; |
|
359 | |
353 | |
|
360 | if(source == '/' && target == '/') |
354 | if(source == '/' && target == '/') |
|
361 | return false; |
355 | return false; |
|
362 | |
356 | |
|
363 | // Check if source path is sane. |
357 | // Check if source path is sane. |
|
364 | if(source.split('/').some( |
358 | if(source.split('/').some( |
|
365 | function(part) { |
359 | function(part) { |
|
366 | return /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/.test(part); |
360 | return /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/.test(part); |
|
367 | })) { |
361 | })) { |
|
368 | return false; |
362 | return false; |
|
369 | } |
363 | } |
|
370 | |
364 | |
|
371 | // Check if target path is sane. |
365 | // Check if target path is sane. |
|
372 | if(target.split('/').some( |
366 | if(target.split('/').some( |
|
373 | function(part) { |
367 | function(part) { |
|
374 | return /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/.test(part); |
368 | return /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/.test(part); |
|
375 | })) { |
369 | })) { |
|
376 | return false; |
370 | return false; |
|
377 | } |
371 | } |
|
378 | |
372 | |
|
379 | return true; |
373 | return true; |
|
380 | }, |
374 | }, |
|
381 | data: function(node, callback) { |
375 | data: function(node, callback) { |
|
382 | if(node.id === '#') { |
376 | if(node.id === '#') { |
|
383 | callback.call(this, [ |
377 | callback.call(this, [ |
|
384 | { |
378 | { |
|
385 | "id" : "/My Inventory", |
379 | "id" : "/My Inventory", |
|
386 | "parent" : "#", |
380 | "parent" : "#", |
|
387 | "text" : "My Inventory", |
381 | "text" : "My Inventory", |
|
388 | "data" : { |
382 | "data" : { |
|
389 | "type" : "folder", |
383 | "type" : "folder", |
|
390 | 'time' : Date.now(), |
384 | 'time' : Date.now(), |
|
391 | 'system' : true |
385 | 'system' : true |
|
392 | }, |
386 | }, |
|
393 | "children" : true, |
387 | "children" : true, |
|
394 | "opened" : false |
388 | "opened" : false |
|
395 | }, |
389 | }, |
|
396 | { |
390 | { |
|
397 | "id" : "/Library", |
391 | "id" : "/Library", |
|
398 | "parent" : "#", |
392 | "parent" : "#", |
|
399 | "text" : "Library", |
393 | "text" : "Library", |
|
400 | "data" : { |
394 | "data" : { |
|
401 | "type" : "folder", |
395 | "type" : "folder", |
|
402 | 'time' : Date.now(), |
396 | 'time' : Date.now(), |
|
403 | 'system' : true |
397 | 'system' : true |
|
404 | }, |
398 | }, |
|
405 | "children" : true, |
399 | "children" : true, |
|
406 | "opened" : false |
400 | "opened" : false |
|
407 | } |
401 | } |
|
408 | ]); |
402 | ]); |
|
409 | return; |
403 | return; |
|
410 | } |
404 | } |
|
411 | $.ajax({ |
405 | $.ajax({ |
|
412 | //async: false, |
406 | //async: false, |
|
413 | type: 'POST', |
407 | type: 'POST', |
|
414 | url: '/', |
408 | url: '/', |
|
415 | dataType: 'json', |
409 | dataType: 'json', |
|
416 | data: { |
410 | data: { |
|
417 | command: 'inventory', |
411 | command: 'inventory', |
|
418 | action: 'ls', |
412 | action: 'ls', |
|
419 | path: node.id |
413 | path: node.id |
|
420 | } |
414 | } |
|
421 | }).done(function(response) { |
415 | }).done(function(response) { |
|
422 | var list = []; |
416 | var list = []; |
|
423 | $.each(wasCSVToArray(response.data) |
417 | $.each(wasCSVToArray(response.data) |
|
424 | .chunk(10), |
418 | .chunk(10), |
|
425 | function(i, e) { |
419 | function(i, e) { |
|
426 | e = wasKeyValueObjectify(e); |
420 | e = wasKeyValueObjectify(e); |
|
427 | //alert(node.id + " to " + JSON.stringify(e, 4, null)); |
421 | //alert(node.id + " to " + JSON.stringify(e, 4, null)); |
|
428 | list.push({ |
422 | list.push({ |
|
429 | 'id' : node.id === '/' ? '/' + e['item'] : node.id + '/' + e['item'], |
423 | 'id' : node.id === '/' ? '/' + e['item'] : node.id + '/' + e['item'], |
|
430 | 'parent' : node.id, |
424 | 'parent' : node.id, |
|
431 | 'data' : { |
425 | 'data' : { |
|
432 | 'type' : e['type'], |
426 | 'type' : e['type'], |
|
433 | 'time' : Date.parse(e['time']), |
427 | 'time' : Date.parse(e['time']), |
|
434 | // Check if this folder is a system folder. |
428 | // Check if this folder is a system folder. |
|
435 | 'system' : node.id === '/My Inventory' && ( |
429 | 'system' : node.id === '/My Inventory' && ( |
|
436 | e['name'] === 'Trash' || |
430 | e['name'] === 'Trash' || |
|
437 | e['name'] === 'Notecards' || |
431 | e['name'] === 'Notecards' || |
|
438 | e['name'] === 'Scripts' || |
432 | e['name'] === 'Scripts' || |
|
439 | e['name'] === 'Lost And Found' || |
433 | e['name'] === 'Lost And Found' || |
|
440 | e['name'] === 'Landmarks' || |
434 | e['name'] === 'Landmarks' || |
|
441 | e['name'] === 'Current Outfit' || |
435 | e['name'] === 'Current Outfit' || |
|
442 | e['name'] === 'Calling Cards' || |
436 | e['name'] === 'Calling Cards' || |
|
443 | e['name'] === 'Textures' || |
437 | e['name'] === 'Textures' || |
|
444 | e['name'] === 'Objects' || |
438 | e['name'] === 'Objects' || |
|
445 | e['name'] === 'My Outfits' || |
439 | e['name'] === 'My Outfits' || |
|
446 | e['name'] === 'Clothing' || |
440 | e['name'] === 'Clothing' || |
|
447 | e['name'] === 'Body Parts' || |
441 | e['name'] === 'Body Parts' || |
|
448 | e['name'] === 'Photo Album' || |
442 | e['name'] === 'Photo Album' || |
|
449 | e['name'] === 'Favorites' || |
443 | e['name'] === 'Favorites' || |
|
450 | e['name'] === 'Gestures' || |
444 | e['name'] === 'Gestures' || |
|
451 | e['name'] === 'Animations' |
445 | e['name'] === 'Animations' |
|
452 | ) |
446 | ) |
|
453 | }, |
447 | }, |
|
454 | 'text' : e['name'], |
448 | 'text' : e['name'], |
|
455 | 'children' : e['type'] === 'folder', |
449 | 'children' : e['type'] === 'folder', |
|
456 | 'icon' : '/pack-rat/img/icons/' + e['type'] + '.gif', |
450 | 'icon' : '/pack-rat/img/icons/' + e['type'] + '.gif', |
|
457 | 'opened' : 'false' |
451 | 'opened' : 'false' |
|
458 | }); |
452 | }); |
|
459 | }); |
453 | }); |
|
460 | callback.call(this, list); |
454 | callback.call(this, list); |
|
461 | }); |
455 | }); |
|
462 | } |
456 | } |
|
463 | } |
457 | } |
|
464 | }).bind('move_node.jstree', function(e, data) { |
458 | }).bind('move_node.jstree', function(e, data) { |
|
465 | $.ajax({ |
459 | $.ajax({ |
|
466 | //async: false, |
460 | //async: false, |
|
467 | type: 'POST', |
461 | type: 'POST', |
|
468 | url: '/', |
462 | url: '/', |
|
469 | dataType: 'json', |
463 | dataType: 'json', |
|
470 | data: { |
464 | data: { |
|
471 | command: 'inventory', |
465 | command: 'inventory', |
|
472 | action: 'mv', |
466 | action: 'mv', |
|
473 | source: data.node.id, |
467 | source: data.node.id, |
|
474 | target: data.parent |
468 | target: data.parent |
|
475 | } |
469 | } |
|
476 | }).done(function(response) { |
470 | }).done(function(response) { |
|
477 | if(response.success !== 'True') { |
471 | if(response.success !== 'True') { |
|
478 | alert('Error moving item: ' + response.error); |
472 | alert('Error moving item: ' + response.error); |
|
479 | } |
473 | } |
|
480 | }); |
474 | }); |
|
481 | // Once the node is moved, update the node ID to reflect the path change. |
475 | // Once the node is moved, update the node ID to reflect the path change. |
|
482 | var parentPath = data.parent != '/' ? data.parent : ""; |
476 | var parentPath = data.parent != '/' ? data.parent : ""; |
|
483 | var item = data.node.id.split(/[\/]+/).pop(); |
477 | var item = data.node.id.split(/[\/]+/).pop(); |
|
484 | data.instance.set_id(data.node, parentPath + '/' + item); |
478 | data.instance.set_id(data.node, parentPath + '/' + item); |
|
485 | }); |
479 | }); |
|
486 | }); |
480 | }); |
|
487 | </script> |
481 | </script> |
|
488 | </body> |
482 | </body> |
|
489 | </html> |
483 | </html> |
|
490 | |
484 | |