fix db import, test toggle, add Firefogg requires

This commit is contained in:
j 2010-08-16 23:57:13 +02:00
parent dd86adb0c2
commit 6faa4d81ba
3 changed files with 14 additions and 6 deletions

View file

@ -1,7 +1,7 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// vi:si:et:sw=2:sts=4:ts=2 // vi:si:et:sw=2:sts=4:ts=2
Components.utils.import("resource://ox/utils.jsm"); Components.utils.import("resource://ox/oxff.jsm");
function Site(site, access) { function Site(site, access) {
this.site = site; this.site = site;
@ -11,13 +11,13 @@ function Site(site, access) {
Site.prototype = { Site.prototype = {
delete: function() { delete: function() {
var conn = ox.getDB(); var conn = oxff.getDB();
var q = conn.createStatement("DELETE FROM site WHERE site = :site"); var q = conn.createStatement("DELETE FROM site WHERE site = :site");
q.params.site = this.site; q.params.site = this.site;
q.executeStep(); q.executeStep();
}, },
toggle: function() { toggle: function() {
var conn = ox.getDB(); var conn = oxff.getDB();
if(this.access==1) this.access=0; if(this.access==1) this.access=0;
else this.access = 1; else this.access = 1;
var q = conn.createStatement("UPDATE site SET access = :access WHERE site = :site"); var q = conn.createStatement("UPDATE site SET access = :access WHERE site = :site");
@ -60,7 +60,7 @@ var OxFFManager = {
this._sites = []; this._sites = [];
// load permissions into a table // load permissions into a table
var conn = ox.getDB(); var conn = oxff.getDB();
var q = conn.createStatement("SELECT site, access FROM site"); var q = conn.createStatement("SELECT site, access FROM site");
while(q.executeStep()) { while(q.executeStep()) {
var p = new Site(q.row.site, q.row.access); var p = new Site(q.row.site, q.row.access);

View file

@ -15,6 +15,14 @@
</Description> </Description>
</em:targetApplication> </em:targetApplication>
<em:requires>
<Description>
<em:id>firefogg@firefogg.org</em:id>
<em:minVersion>1.2.10</em:minVersion>
<em:maxVersion>1.2.*</em:maxVersion>
</Description>
</em:requires>
<!-- Front End MetaData --> <!-- Front End MetaData -->
<em:name>pan.do/ra Firefox extension</em:name> <em:name>pan.do/ra Firefox extension</em:name>
<em:description>integrate local files with pan.do/ra databases</em:description> <em:description>integrate local files with pan.do/ra databases</em:description>

View file

@ -209,13 +209,13 @@ function update() {
var $folder = $('#'+folderId); var $folder = $('#'+folderId);
if($folder.length==0) { if($folder.length==0) {
$folder = $('<div>').attr('id', folderId).html('<h3>'+folder+'</h3>'); $folder = $('<div>').attr('id', folderId).html('<h3>'+folder+'</h3>');
$folder.find('h3').click(function() { $(this).parent().find('div').toggle();}); $folder.find('h3').click(function() { $(this).parent().find('.file').toggle();});
$volume.append($folder); $volume.append($folder);
} }
var fileId = file.oshash; var fileId = file.oshash;
var $file = $('#'+fileId); var $file = $('#'+fileId);
if($file.length==0) { if($file.length==0) {
$file = $('<div>').attr('id', fileId).html(file.path).hide(); $file = $('<div>').attr('id', fileId).addClass('file').html(file.path).hide();
$folder.append($file); $folder.append($file);
} }
}); });