corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 14  →  ?path2? @ 15
/pack-rat/003_pack_rat/pack-rat/index.html
@@ -278,11 +278,11 @@
// - sort will sort items by date
// - state will store the open / closed state of the jstree
'plugins': ["themes", "json_data", "ui", "contextmenu", "sort", "dnd", "state"],
/*'contextmenu': {
'contextmenu': {
"items": function(node) {
return customMenu(node);
}
},*/
},
'dnd': {
// Do not copy items.
'copy': false,
@@ -294,31 +294,102 @@
Date.parse(this.get_node(b).data.time) ? 1 : -1;
},
'core': {
/*'check_callback': function(operation, node, parent, position, more) {
'check_callback': function(operation, node, parent, position, more) {
// Do not allow moves above the root node.
if (parent.id == "#")
if (parent.id === "#")
return false;
 
var source = node.id;
var target = parent.id;
// Normalize source and target.
if(source === '#')
source = '/';
if(target === '#')
target = '/';
if(source == '/' && target == '/')
return;
// Check if source path is sane.
if(source.split('/').some(
function(part) {
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);
})) {
return;
}
// Check if target path is sane.
if(target.split('/').some(
function(part) {
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);
})) {
return;
}
// Check that the source and target items are not system folders.
var data = {};
[ { type: 'source', value: source },
{ type: 'target', value: target }].forEach(function(e) {
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
async: false,
data: {
command: 'getinventorydata',
item: e.value,
data: wasArrayToCSV([
'InventoryType',
'PreferredType'
])
}
}).done(function(response) {
if(response.success !== 'True') {
return;
}
data[e.type] = wasKeyValueObjectify(
wasCSVToArray(
response.data
)
);
});
});
// Do not move the item if:
// ... the retrieved data is empty.
if($.isEmptyObject(data) ||
// ... we are trying to move a system folder.
('PreferredType' in data['source'] && data['source'].PreferredType !== 'Unknown') ||
// ... we are trying to move an inventory item over an inventory item.
('InventoryType' in data['source'] && 'InventoryType' in data['target']))
return false;
// Move the inventory item.
var moved = false;
$.ajax({
// A synchronous reply is needed so we know what to tell the tree.
async: false,
type: 'POST',
url: "moveInventoryItem.php?t=" + Math.random(),
data: {
source: node.id,
target: parent.id
}
}).done(function(data) {
if ($.trim(data) != 'success') {
if ($.trim(data) != '')
alert(data);
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
async: false,
data: {
command: 'inventory',
action: 'mv',
source: source,
target: target
}
}).done(function(response) {
if(response.success !== 'True') {
return;
}
moved = true;
});
return moved;
},*/
},
data: function(node, callback) {
if(node.id === '#') {
callback.call(this, [