/pack-rat/003_pack_rat/pack-rat/index.html/index.html |
@@ -27,7 +27,7 @@ |
|
<body> |
<!-- Bootstrap Modal --> |
<div id="popup" class="modal fade bs-example-modal-lg" role="dialog"> |
<div id="item-info-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
<div class="modal-dialog modal-lg"> |
<!-- Modal content--> |
|
@@ -57,7 +57,61 @@ |
</div> |
</div> |
</div> |
|
<!-- Give Inventory Item Destination Dialog --> |
<div id="avatar-select-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
<div class="modal-dialog modal-lg"> |
<!-- Modal content--> |
|
<div class="modal-content"> |
<div class="modal-header"> |
<button type="button" class="close" data-dismiss="modal">×</button> |
|
<h1 id="title" class="modal-title">Avatar Selection</h1> |
</div> |
|
<form id="avatar-select-form" class="form-inline" data-toggle="validator" onSubmit="event.preventDefault();"> |
<div id="content" 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> |
</div> |
</div> |
<div class="modal-footer"> |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
<button id="send-script" type="submit" class="btn btn-primary">Confirm</button> |
</div> |
</form> |
</div> |
</div> |
</div> |
|
<!-- Texture Download Dialog --> |
<div id="texture-download-modal" class="modal fade bs-example-modal-lg" role="dialog"> |
<div class="modal-dialog modal-lg"> |
<!-- Modal content--> |
|
<div class="modal-content"> |
<div class="modal-header"> |
<button type="button" class="close" data-dismiss="modal">×</button> |
|
<h1 id="title" class="modal-title">Avatar Selection</h1> |
</div> |
|
<div id="content" class="modal-body"> |
<img src="" align="middle" id="texture"> |
</div> |
|
<div class="modal-footer"> |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> |
</div> |
</div> |
</div> |
</div> |
|
<div class="container"> |
<div class="jumbotron"> |
<h1>Corrade Pack Rat</h1> |
@@ -122,10 +176,15 @@ |
'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)) ] |
}); |
$('#popup').modal('show'); |
$('#item-info-modal').modal('show'); |
}); |
} |
} |
@@ -140,41 +199,28 @@ |
giveItem: { |
label: "Give", |
action: function(obj) { |
$("#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>'); |
$("#popup").dialog({ |
width: 320, |
height: 180, |
modal: true, |
resizable: false, |
buttons: { |
Select: function() { |
if ($.trim($("#firstname").val()) == '' || |
$.trim($("#lastname").val()) == '') |
$('#avatar-select-modal') |
.modal('show') |
.on('click', '#send-script', function(e) { |
$('#avatar-select-modal').modal('hide'); |
$.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; |
var firstName = $("#firstname").val(); |
var lastName = $("#lastname").val(); |
$.ajax({ |
type: 'POST', |
url: "giveInventoryItem.php?t=" + Math.random(), |
data: { |
uuid: node.id.split(/[\/]+/).pop(), |
firstname: firstName, |
lastname: lastName |
} |
}).done(function(data) { |
$("#popup").dialog("close"); |
if ($.trim(data) != '') |
alert(data); |
}); |
}, |
Cancel: function() { |
$("#popup").dialog("close"); |
} |
} |
}).on('dialogclose', function(event) { |
$('#content').html(''); |
$('#popup').dialog('option', 'buttons', {}); |
}); |
} |
}); |
}); |
} |
} |
}); |
@@ -186,25 +232,20 @@ |
downloadItem: { |
label: "Download", |
"action": function(obj) { |
$('#texture').attr('src', 'images/loader.gif'); |
$('#popup').dialog({ |
width: 800, |
height: 600, |
modal: true, |
resizable: false, |
dialogClass: 'no-close texture-dialog' |
}).on('dialogclose', function(event) { |
$('#content').html(''); |
}); |
$('#texture').attr('src', '/pack-rat/img/loader.gif'); |
$('#texture-download-modal').modal('show'); |
$.ajax({ |
type: 'POST', |
url: "downloadTexture.php?t=" + Math.random(), |
url: '/', |
data: { |
uuid: node.id.split(/[\/]+/).pop() |
} |
}).done(function(data) { |
$('#content').html('<img src="" align="middle" id="texture">'); |
$('#texture').attr('src', "data:image/png;base64," + data); |
command: 'download', |
item: node.id, |
format: 'Png', |
type: 'Texture' |
}, |
dataType: 'json' |
}).done(function(response) { |
$('#texture').attr('src', "data:image/png;base64," + response.data); |
}); |
} |
} |