*/
armadillo.File.prototype.remove = function() {
var file = this;
- var callback = function(data) {
+ var callback = function(data, status, xhr) {
if (data['error']) {
app.showError(data['message']);
return;
*/
armadillo.File.prototype.move = function(dest) {
var file = this;
- var callback = function(data) {
+ var callback = function(data, status, xhr) {
if (data['error']) {
app.showError(data['message']);
} else {
goog.require('goog.dom');
goog.require('goog.fx.dom.FadeInAndShow');
goog.require('goog.fx.dom.FadeOutAndHide');
-goog.require('goog.net.XhrIo');
goog.require('goog.string.format');
-goog.require('goog.Uri.QueryData');
armadillo.App = function() {
var start_path = '/';
/**
* Starts a new XHR service request from the backend.
* @param {string} action Action to perform.
- * @param {Object} extra_data Extra data to add.
+ * @param {Object} data Extra data to add.
* @param {Function} callback XHR callback.
+ * @return {jqXHR} The jQuery XHR object.
*/
-armadillo.App.prototype.sendRequest = function(action, extra_data, callback) {
- var data = new goog.Uri.QueryData();
- data.set('action', action);
- data.extend(extra_data);
- goog.net.XhrIo.send('service', callback, 'POST', data);
+armadillo.App.prototype.sendRequest = function(action, data, callback) {
+ data.action = action;
+ return $.ajax({
+ url: 'service',
+ type: 'POST',
+ data: data,
+ success: callback
+ });
};
/**
* @param {string} path Path to list; relative to jail.
*/
armadillo.App.prototype.list = function(path) {
- var callback = function(e) {
- var data = e.target.getResponseJson();
+ var callback = function(data, status, xhr) {
if (data['error']) {
app.showError(data['message']);
return; // Error.
var name = prompt('Name the new subdirectory', '');
if (name != null && name != '') {
var path = this.joinPath(this.getCurrentPath(), name);
- this.sendRequest('mkdir', {'path':path}, function(e) {
- var data = e.target.getResponseJson();
+ this.sendRequest('mkdir', {'path':path}, function(data, status, xhr) {
if (data['error']) {
app.showError(data['message']);
} else {
* @param {goog.ui.Menu} The menu to attach items to
*/
armadillo.PathControl.prototype.fetchMenuContents_ = function(path, name, menu) {
- var callback = function(e) {
- var data = e.target.getResponseJson();
+ var callback = function(data, status, xhr) {
if (data['error']) {
app.showError(data['message']);
return;
goog.provide('armadillo.TVRenamer');
goog.require('goog.Disposable');
-goog.require('goog.net.XhrIo');
/**
* Creates a helper to rename a file in a pretty format for TV episodes.
*/
armadillo.TVRenamer.prototype.run = function() {
var file = this.file_;
- var callback = function(xhr) {
- var data = xhr.currentTarget.getResponseJson();
+ var callback = function(data, stauts, xhr) {
if (data['error']) {
app.showError(data['message']);
} else {