reorder functions

This commit is contained in:
j 2010-08-05 00:33:40 +02:00
parent 8529631bd0
commit 34f9b07d46
2 changed files with 29 additions and 27 deletions

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://oxff/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://oxff/locale/oxff.dtd">
<overlay id="oxff-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

View file

@ -113,24 +113,7 @@ OxFF.prototype = {
//nsIOxFF
version: "bzr",
login: function(user) {
if(this._user==null) {
this._user = user;
return true;
}
return false;
},
logout: function(user) {
var _this = this;
this.api('shutdown', function() {
_this._user = null;
});
return true;
},
update: function() {
this.api('update', function() {});
return true;
},
access: function(request) {
if (typeof(request) == 'undefined') request = false;
var _this = this;
@ -164,10 +147,6 @@ OxFF.prototype = {
}
return this._access;
},
volumes: function(callback) {
return this.api('volumes', callback);
return JSON.stringify(['Test', 'Another']);
},
api: function(action, data, callback) {
if (typeof(data) == 'function') {
callback = data;
@ -216,15 +195,34 @@ OxFF.prototype = {
req.send(formData);
return true;
},
extract: function(oshash, media, callback) {
return this.api('extract', {'oshash': oshash, 'media': media}, callback);
},
files: function(callback) {
return this.api('files', callback.callback);
},
get: function(oshash, media, callback) {
return this.api('get', {'oshash': oshash, 'media': media}, callback.callback);
},
extract: function(oshash, media, callback) {
return this.api('extract', {'oshash': oshash, 'media': media}, callback);
login: function(user) {
if(this._user==null) {
this._user = user;
return true;
}
return false;
},
logout: function(user) {
var _this = this;
this.api('shutdown', function() {
_this._user = null;
});
return true;
},
update: function() {
this.api('update', function() {});
return true;
},
addVolume: function(archive) {
if(!this._access) {
return false;
@ -242,6 +240,12 @@ OxFF.prototype = {
}
return false;
},
volumes: function(callback) {
return this.api('volumes', callback);
},
//private functions
/*
_internal_update: function() {
var new_files = [];
var volumes = this.getVolumes(this._site);
@ -264,8 +268,7 @@ OxFF.prototype = {
}
}
return JSON.stringify(new_files);
},
//private functions
}, */
permitAccess: function() {
this._access = true;
var conn = ox.getDB();