corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 27  →  ?path2? @ 28
/pack-rat/003_pack_rat/pack-rat/index.html
@@ -1,35 +1,6 @@
<!DOCTYPE html>
 
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Corrade Nucleon">
<meta name="author" content="Wizardry and Steamworks">
<link rel="icon" href="favicon.ico">
 
<title>Corrade Nucleus - Pack Rat Inventory Manager</title>
 
<!-- Bootstrap core CSS -->
<link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<!-- Corrade Nucleus Fonts -->
<link href="/css/nucleus/fonts.css" rel="stylesheet" type="text/css">
<!-- Customized bootstrap style. -->
<link href="/css/nucleus/nucleus.css" rel="stylesheet" type="text/css">
<!-- Manager for Windows. -->
<link href="/css/wm/wm.css" rel="stylesheet" type="text/css">
 
<!-- jsTree style -->
<link href="/pack-rat/node_modules/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css">
<!-- Bootstrap table -->
<link href="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css">
</script>
</head>
 
<body>
<div id="pack-rat">
<!-- Bootstrap Modal -->
<div id="item-info-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div id="pack-rat-item-info-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
 
@@ -40,8 +11,8 @@
<h1 class="modal-title">Item Information</h1>
</div>
 
<div id="item-info-content" class="modal-body">
<table id="info" data-height="460">
<div class="modal-body">
<table id="pack-rat-item-info" data-height="460">
<thead>
<tr>
<th data-field="AssetUUID">Asset UUID</th>
@@ -59,9 +30,9 @@
</div>
</div>
</div>
 
<!-- Give Inventory Item Destination Dialog -->
<div id="avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div id="pack-rat-avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
 
@@ -72,27 +43,27 @@
<h1 class="modal-title">Avatar Selection</h1>
</div>
 
<form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();">
<div id="avatar-select-content" class="modal-body">
<form class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();">
<div class="modal-body">
<p>Please enter the avatar firstname and lastname to send the script to.</p>
<div class="form-group has-feedback">
<label for="avatar-firstname">First Name</label>
<input id="avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required>
<label for="avatar-lastname">Last Name</label>
<input id="avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required>
<label for="pack-rat-avatar-firstname">First Name</label>
<input id="pack-rat-avatar-firstname" type="text" class="form-control" aria-describedby="basic-addon1" required>
<label for="pack-rat-avatar-lastname">Last Name</label>
<input id="pack-rat-avatar-lastname" type="text" class="form-control" aria-describedby="basic-addon1" required>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button id="send-item" type="button" class="btn btn-primary">Confirm</button>
<button id="pack-rat-send-item" type="button" class="btn btn-primary">Confirm</button>
</div>
</form>
</div>
</div>
</div>
 
<!-- Inventory Item Download Dialog -->
<div id="item-download-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div id="pack-rat-item-download-modal" class="modal fade bs-example-modal-lg" role="dialog">
<div class="modal-dialog modal-lg">
<!-- Modal content-->
 
@@ -102,11 +73,10 @@
 
<h1 class="modal-title">Download</h1>
</div>
<div id="item-download-content" class="modal-body">
<!-- <img width="100%" height="100%" src="" align="middle" id="texture"> -->
<div id="pack-rat-item-download-content" class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
@@ -114,426 +84,400 @@
</div>
</div>
 
<div class="container">
<div class="jumbotron">
<h1>Corrade Pack Rat</h1>
<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>
<img src="/pack-rat/img/pack-rat.png"></div>
<!-- Main nucleon panel. -->
<div class="panel panel-default draggable movable">
<!-- jsTree style -->
<link href="/pack-rat/node_modules/jstree/dist/themes/default/style.min.css" rel="stylesheet" type="text/css">
<!-- Bootstrap table -->
<link href="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css">
<div class="panel-heading">
Pack-Rat
<button type="button" class="close" data-target="#pack-rat" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="panel-body">
<!-- Will hold the inventory tree (completed dynamically). -->
<div id="pack-rat-tree">
</div>
</div>
<!-- Bootstrap Javascript -->
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.js" type="text/javascript"></script>
<!-- Bootstrap Form Validator -->
<script src="/node_modules/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script>
<!-- Forge -->
<script src="/node_modules/node-forge/dist/forge.all.min.js" type="text/javascript"></script>
<!-- Moment JS -->
<script src="/pack-rat/node_modules/moment/min/moment.min.js" type="text/javascript"></script>
<!-- JsTree -->
<script src="/pack-rat/node_modules/jstree/dist/jstree.min.js" type="text/javascript"></script>
<!-- JSON to Table -->
<script src="/pack-rat/node_modules/json-to-table/json-to-table.js" type="text/javascript"></script>
<!-- Main script -->
<script type="text/javascript">
$(function() {
function customMenu(node) {
// The default set of menu items for all types
var items = {
// Grab information about the item.
infoItem: {
label: "Get Info",
action: function(obj) {
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'getinventorydata',
item: node.id,
data: wasArrayToCSV([
'AssetUUID',
'CreationDate',
'Description',
'Permissions',
'UUID' // part of InventoryBase
])
}
}).done(function(response) {
if(response.success !== 'True') {
alert('Error moving item: ' + response.error);
return;
}
$('#pack-rat-item-info').bootstrapTable({
data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ]
});
$('#pack-rat-item-info-modal').modal('show');
});
}
}
};
 
<div class="panel panel-default draggable movable">
<div class="panel-heading">
<h3 class="panel-title">Pack-Rat</h3>
</div>
<div class="panel-body">
<!-- Will hold the inventory tree (completed dynamically). -->
<div id="tree">
</div>
</div>
</div>
<!-- Nucleons -->
<div class="panel panel-default draggable movable">
<div class="panel-heading">
<h3 class="panel-title">Nucleons</h3>
</div>
<div class="panel-body">
<div id="nucleons" class="row"></div>
</div>
</div>
// Give inventory items menu for anything but folders.
// They could be supported too but would require first
// counting the number of items inside the folder and
// only accepting to send if the number is below max.
if (node.data.type != "folder") {
$.extend(items, {
giveItem: {
label: "Give",
action: function(obj) {
$('#pack-rat-avatar-select-modal')
.modal('show')
.on('click', '#pack-rat-send-item', function(e) {
$('#pack-rat-avatar-select-modal').modal('hide').unbind('click');
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'give',
entity: 'avatar',
item: node.id,
firstname: $('#pack-rat-avatar-firstname').val(),
lastname: $('#pack-rat-avatar-lastname').val()
},
dataType: 'json'
}).done(function(response) {
if(response.success !== 'True') {
alert('Error sending item: ' + response.error);
return;
}
});
});
}
}
});
}
 
<footer class="footer">
<p>&copy; 2017 Wizardry and Steamworks</p>
</footer>
</div>
<!-- jQuery -->
<script src="/node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
<!-- Wizardry and Steamworks JavaScript Includes -->
<script src="/node_modules/was/dist/was.min.js" type="text/javascript"></script>
<!-- Bootstrap Javascript -->
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/pack-rat/node_modules/bootstrap-table/dist/bootstrap-table.min.js" type="text/javascript"></script>
<!-- Bootstrap Form Validator -->
<script src="/node_modules/bootstrap-validator/dist/validator.min.js" type="text/javascript"></script>
<!-- Forge -->
<script src="/node_modules/node-forge/dist/forge.all.min.js" type="text/javascript"></script>
<!-- Moment JS -->
<script src="/pack-rat/node_modules/moment/min/moment.min.js" type="text/javascript"></script>
<!-- JsTree -->
<script src="/pack-rat/node_modules/jstree/dist/jstree.min.js" type="text/javascript"></script>
<!-- JSON to Table -->
<script src="/pack-rat/node_modules/json-to-table/json-to-table.js" type="text/javascript"></script>
<!-- Interact JS -->
<script src="/node_modules/interactjs/dist/interact.min.js" type="text/javascript"></script>
<!-- Manager for Windows. -->
<script src="/js/wm/wm.js" type="text/javascript"></script>
<!-- Nucleons Loader -->
<script src="/js/nucleus/load-nucleons.js" type="text/javascript"></script>
<!-- Main script -->
<script type="text/javascript">
$(function() {
function customMenu(node) {
// The default set of menu items for all types
var items = {
// Grab information about the item.
infoItem: {
label: "Get Info",
action: function(obj) {
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'getinventorydata',
item: node.id,
data: wasArrayToCSV([
'AssetUUID',
'CreationDate',
'Description',
'Permissions',
'UUID' // part of InventoryBase
])
}
}).done(function(response) {
if(response.success !== 'True') {
alert('Error moving item: ' + response.error);
return;
}
$('#info').bootstrapTable({
data: [ wasKeyValueObjectify(wasCSVToArray(response.data)) ]
});
$('#item-info-modal').modal('show');
});
}
}
};
// The "download" menu item for textures.
if (node.data.type == "texture" || node.data.type == "snapshot") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='pack-rat-item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#pack-rat-item-download-content');
$('#pack-rat-item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#pack-rat-item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
format: 'Png',
type: 'Texture'
},
dataType: 'json'
}).done(function(response) {
// Create the image tag and set the content.
$("#pack-rat-item-download-texture")
.attr('src', "data:image/png;base64," + response.data);
});
}
}
});
}
 
// Give inventory items menu for anything but folders.
// They could be supported too but would require first
// counting the number of items inside the folder and
// only accepting to send if the number is below max.
if (node.data.type != "folder") {
$.extend(items, {
giveItem: {
label: "Give",
action: function(obj) {
$('#avatar-select-modal')
.modal('show')
.on('click', '#send-item', function(e) {
$('#avatar-select-modal').modal('hide').unbind('click');
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'give',
entity: 'avatar',
item: node.id,
firstname: $('#avatar-firstname').val(),
lastname: $('#avatar-lastname').val()
},
dataType: 'json'
}).done(function(response) {
if(response.success !== 'True') {
alert('Error sending item: ' + response.error);
return;
}
});
});
}
}
});
}
// The "download" menu item for notecards.
if (node.data.type == "notecard") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='pack-rat-item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#pack-rat-item-download-content');
$('#pack-rat-item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#pack-rat-item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
type: 'Notecard'
},
dataType: 'json'
}).done(function(response) {
$('#pack-rat-item-download-content')
.html('');
// Decode notecard and display it.
$('#pack-rat-item-download-content').html(
'<pre>' +
forge.util.decodeUtf8(
forge.util.decode64(response.data)
) +
'</pre>'
);
});
}
}
});
}
 
// The "download" menu item for textures.
if (node.data.type == "texture" || node.data.type == "snapshot") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#item-download-content');
$('#item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
format: 'Png',
type: 'Texture'
},
dataType: 'json'
}).done(function(response) {
// Create the image tag and set the content.
$("#item-download-texture")
.attr('src', "data:image/png;base64," + response.data);
});
}
}
});
}
// The "download" menu item for sounds.
if (node.data.type == "sound") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='pack-rat-item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#pack-rat-item-download-content');
$('#pack-rat-item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#pack-rat-item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
type: 'Sound',
format: 'wav'
},
dataType: 'json'
}).done(function(response) {
$('#pack-rat-item-download-content')
.html('');
// Create HTML5 audio tags and load the data.
$('#pack-rat-item-download-content')
.html("<audio controls='' preload='auto'><source src='" + 'data:audio/x-wav;base64,' + response.data + "' type='audio/x-wav'></audio>");
});
}
}
});
}
 
// The "download" menu item for notecards.
if (node.data.type == "notecard") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#item-download-content');
$('#item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
type: 'Notecard'
},
dataType: 'json'
}).done(function(response) {
$('#item-download-content')
.html('');
// Decode notecard and display it.
$('#item-download-content').html(
'<pre>' +
forge.util.decodeUtf8(
forge.util.decode64(response.data)
) +
'</pre>'
);
});
}
}
});
}
return items;
}
 
// The "download" menu item for sounds.
if (node.data.type == "sound") {
$.extend(items, {
downloadItem: {
label: "Download",
"action": function(obj) {
$("<img id='item-download-texture' width='100%' height='100%'>")
.attr('src', '/pack-rat/img/loader.svg')
.appendTo('#item-download-content');
$('#item-download-modal')
.modal('show')
.on('hidden.bs.modal', function (e) {
$('#item-download-content')
.html('');
});
$.ajax({
type: 'POST',
url: '/',
data: {
command: 'download',
item: node.id,
type: 'Sound',
format: 'wav'
},
dataType: 'json'
}).done(function(response) {
$('#item-download-content')
.html('');
// Create HTML5 audio tags and load the data.
$('#item-download-content')
.html("<audio controls='' preload='auto'><source src='" + 'data:audio/x-wav;base64,' + response.data + "' type='audio/x-wav'></audio>");
});
}
}
});
}
 
return items;
}
 
$("#tree").jstree({
// - 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': {
"items": function(node) {
return customMenu(node);
}
},
'dnd': {
// Do not copy items.
'copy': false,
// Do not execute the check callback whilst dragging.
'check_while_dragging': true
},
'sort': function(a, b) {
return this.get_node(a).data.time < this.get_node(b).data.time ? 1 : -1;
},
'core': {
'check_callback': function(operation, node, parent, position, more) {
// Only allow move operations
if (operation !== 'move_node' ||
// Do not move system folders.
node.data.system !== false ||
// Do not allow moves above the root node.
parent.id === "#" ||
// Do not allow moving an item over another item.
(node.data.type !== 'folder' && parent.data.type !== 'folder'))
return false;
var source = node.id;
var target = parent.id;
// Normalize source and target.
if(source === '#')
source = '/';
if(target === '#')
target = '/';
if(source == '/' && target == '/')
return false;
// 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 false;
}
// 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 false;
}
return true;
},
data: function(node, callback) {
if(node.id === '#') {
callback.call(this, [
{
"id" : "/My Inventory",
"parent" : "#",
"text" : "My Inventory",
"data" : {
"type" : "folder",
'time' : Date.now(),
'system' : true
},
"children" : true,
"opened" : false
},
{
"id" : "/Library",
"parent" : "#",
"text" : "Library",
"data" : {
"type" : "folder",
'time' : Date.now(),
'system' : true
},
"children" : true,
"opened" : false
}
]);
return;
}
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'inventory',
action: 'ls',
path: node.id
}
}).done(function(response) {
var list = [];
$.each(wasCSVToArray(response.data)
.chunk(10),
function(i, e) {
e = wasKeyValueObjectify(e);
//alert(node.id + " to " + JSON.stringify(e, 4, null));
list.push({
'id' : node.id === '/' ? '/' + e['item'] : node.id + '/' + e['item'],
'parent' : node.id,
'data' : {
'type' : e['type'],
'time' : Date.parse(e['time']),
// Check if this folder is a system folder.
'system' : node.id === '/My Inventory' && (
e['name'] === 'Trash' ||
e['name'] === 'Notecards' ||
e['name'] === 'Scripts' ||
e['name'] === 'Lost And Found' ||
e['name'] === 'Landmarks' ||
e['name'] === 'Current Outfit' ||
e['name'] === 'Calling Cards' ||
e['name'] === 'Textures' ||
e['name'] === 'Objects' ||
e['name'] === 'My Outfits' ||
e['name'] === 'Clothing' ||
e['name'] === 'Body Parts' ||
e['name'] === 'Photo Album' ||
e['name'] === 'Favorites' ||
e['name'] === 'Gestures' ||
e['name'] === 'Animations'
)
},
'text' : e['name'],
'children' : e['type'] === 'folder',
'icon' : '/pack-rat/img/icons/' + e['type'] + '.gif',
'opened' : 'false'
});
});
callback.call(this, list);
});
}
}
}).bind('move_node.jstree', function(e, data) {
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'inventory',
action: 'mv',
source: data.node.id,
target: data.parent
}
}).done(function(response) {
if(response.success !== 'True') {
alert('Error moving item: ' + response.error);
}
});
// Once the node is moved, update the node ID to reflect the path change.
var parentPath = data.parent != '/' ? data.parent : "";
var item = data.node.id.split(/[\/]+/).pop();
data.instance.set_id(data.node, parentPath + '/' + item);
});
// Move context menu to top-most.
$('#tree').on('contextmenu', '.jstree-anchor', function (e) {
$('.vakata-context').css('z-index', getTopWindowIndex() + 1);
});
});
</script>
</body>
</html>
$("#pack-rat-tree").jstree({
// - 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': {
"items": function(node) {
return customMenu(node);
}
},
'dnd': {
// Do not copy items.
'copy': false,
// Do not execute the check callback whilst dragging.
'check_while_dragging': true
},
'sort': function(a, b) {
return this.get_node(a).data.time < this.get_node(b).data.time ? 1 : -1;
},
'core': {
'check_callback': function(operation, node, parent, position, more) {
// Only allow move operations
if (operation !== 'move_node' ||
// Do not move system folders.
node.data.system !== false ||
// Do not allow moves above the root node.
parent.id === "#" ||
// Do not allow moving an item over another item.
(node.data.type !== 'folder' && parent.data.type !== 'folder'))
return false;
var source = node.id;
var target = parent.id;
// Normalize source and target.
if(source === '#')
source = '/';
if(target === '#')
target = '/';
if(source == '/' && target == '/')
return false;
// 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 false;
}
// 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 false;
}
return true;
},
data: function(node, callback) {
if(node.id === '#') {
callback.call(this, [
{
"id" : "/My Inventory",
"parent" : "#",
"text" : "My Inventory",
"data" : {
"type" : "folder",
'time' : Date.now(),
'system' : true
},
"children" : true,
"opened" : false
},
{
"id" : "/Library",
"parent" : "#",
"text" : "Library",
"data" : {
"type" : "folder",
'time' : Date.now(),
'system' : true
},
"children" : true,
"opened" : false
}
]);
return;
}
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'inventory',
action: 'ls',
path: node.id
}
}).done(function(response) {
var list = [];
$.each(wasCSVToArray(response.data)
.chunk(10),
function(i, e) {
e = wasKeyValueObjectify(e);
//alert(node.id + " to " + JSON.stringify(e, 4, null));
list.push({
'id' : node.id === '/' ? '/' + e['item'] : node.id + '/' + e['item'],
'parent' : node.id,
'data' : {
'type' : e['type'],
'time' : Date.parse(e['time']),
// Check if this folder is a system folder.
'system' : node.id === '/My Inventory' && (
e['name'] === 'Trash' ||
e['name'] === 'Notecards' ||
e['name'] === 'Scripts' ||
e['name'] === 'Lost And Found' ||
e['name'] === 'Landmarks' ||
e['name'] === 'Current Outfit' ||
e['name'] === 'Calling Cards' ||
e['name'] === 'Textures' ||
e['name'] === 'Objects' ||
e['name'] === 'My Outfits' ||
e['name'] === 'Clothing' ||
e['name'] === 'Body Parts' ||
e['name'] === 'Photo Album' ||
e['name'] === 'Favorites' ||
e['name'] === 'Gestures' ||
e['name'] === 'Animations'
)
},
'text' : e['name'],
'children' : e['type'] === 'folder',
'icon' : '/pack-rat/img/icons/' + e['type'] + '.gif',
'opened' : 'false'
});
});
callback.call(this, list);
});
}
}
}).bind('move_node.jstree', function(e, data) {
$.ajax({
//async: false,
type: 'POST',
url: '/',
dataType: 'json',
data: {
command: 'inventory',
action: 'mv',
source: data.node.id,
target: data.parent
}
}).done(function(response) {
if(response.success !== 'True') {
alert('Error moving item: ' + response.error);
}
});
// Once the node is moved, update the node ID to reflect the path change.
var parentPath = data.parent != '/' ? data.parent : "";
var item = data.node.id.split(/[\/]+/).pop();
data.instance.set_id(data.node, parentPath + '/' + item);
});
// Move context menu to top-most.
$('#pack-rat-tree').on('contextmenu', '.jstree-anchor', function (e) {
$('.vakata-context').css('z-index', getTopWindowIndex() + 1);
});
});
</script>
</div>
</div>