corrade-nucleus-nucleons – Diff between revs 14 and 15

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 14 Rev 15
Line 276... Line 276...
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.
Line 292... Line 292...
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
-   302 var source = node.id;
-   303 var target = parent.id;
-   304
-   305 // Normalize source and target.
-   306 if(source === '#')
-   307 source = '/';
-   308
-   309 if(target === '#')
-   310 target = '/';
-   311
-   312 if(source == '/' && target == '/')
-   313 return;
-   314
-   315 // Check if source path is sane.
-   316 if(source.split('/').some(
-   317 function(part) {
-   318 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);
-   319 })) {
-   320 return;
-   321 }
-   322
-   323 // Check if target path is sane.
-   324 if(target.split('/').some(
-   325 function(part) {
-   326 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);
-   327 })) {
-   328 return;
-   329 }
-   330
-   331 // Check that the source and target items are not system folders.
-   332 var data = {};
-   333 [ { type: 'source', value: source },
-   334 { type: 'target', value: target }].forEach(function(e) {
-   335 $.ajax({
-   336 //async: false,
-   337 type: 'POST',
-   338 url: '/',
-   339 dataType: 'json',
-   340 async: false,
-   341 data: {
-   342 command: 'getinventorydata',
-   343 item: e.value,
-   344 data: wasArrayToCSV([
-   345 'InventoryType',
-   346 'PreferredType'
-   347 ])
-   348 }
-   349 }).done(function(response) {
-   350 if(response.success !== 'True') {
-   351 return;
-   352 }
-   353 data[e.type] = wasKeyValueObjectify(
-   354 wasCSVToArray(
-   355 response.data
-   356 )
-   357 );
-   358 });
-   359 });
-   360
-   361 // Do not move the item if:
-   362 // ... the retrieved data is empty.
-   363 if($.isEmptyObject(data) ||
-   364 // ... we are trying to move a system folder.
-   365 ('PreferredType' in data['source'] && data['source'].PreferredType !== 'Unknown') ||
-   366 // ... we are trying to move an inventory item over an inventory item.
-   367 ('InventoryType' in data['source'] && 'InventoryType' in data['target']))
-   368 return false;
301   369
-   370 // Move the inventory item.
302 var moved = false; 371 var moved = false;
303 $.ajax({ 372 $.ajax({
304 // A synchronous reply is needed so we know what to tell the tree. 373 //async: false,
305 async: false, 374 type: 'POST',
306 type: 'POST', 375 url: '/',
307 url: "moveInventoryItem.php?t=" + Math.random(), 376 dataType: 'json',
-   377 async: false,
308 data: { 378 data: {
309 source: node.id, 379 command: 'inventory',
310 target: parent.id 380 action: 'mv',
311 } 381 source: source,
312 }).done(function(data) { 382 target: target
313 if ($.trim(data) != 'success') { 383 }
314 if ($.trim(data) != '') 384 }).done(function(response) {
315 alert(data); 385 if(response.success !== 'True') {
316 return; 386 return;
317 } 387 }
318 moved = true; 388 moved = true;
319 }); 389 });
-   390
320 return moved; 391 return moved;
321 },*/ 392 },
322 data: function(node, callback) { 393 data: function(node, callback) {
323 if(node.id === '#') { 394 if(node.id === '#') {
324 callback.call(this, [ 395 callback.call(this, [
325 { 396 {
326 "id" : "/My Inventory", 397 "id" : "/My Inventory",