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 version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://oxff/skin/overlay.css" type="text/css"?> <?xml-stylesheet href="chrome://oxff/skin/overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://oxff/locale/oxff.dtd">
<overlay id="oxff-overlay" <overlay id="oxff-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

View file

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