[svn r1577] Various change to the new interface.
--- a/ChangeLog Tue Oct 07 00:06:23 2003 -0400
+++ b/ChangeLog Tue Oct 07 00:07:32 2003 -0400
@@ -1,3 +1,11 @@
+xbelweb (0.1-0) unstable; urgency=low
+
+ * Redone keywords selection with a select input box.
+ * Push keywords edition into a separate page.
+ * Add webutils.py for various form manipulation functions.
+
+ -- Fabien Ninoles <fabien@tzone.org> Mon, 7 Oct 2003 00:03:17 -0400
+
xbelweb (0.0-5) unstable; urgency=low
* Add delete bookmarks function.
--- a/add_confirm.py Tue Oct 07 00:06:23 2003 -0400
+++ b/add_confirm.py Tue Oct 07 00:07:32 2003 -0400
@@ -82,7 +82,7 @@
kw = get_unique_keywords(form, db)
else:
bk = db.get_bookmarks([id])[0]
- (ids, kw) = apply(zip,db.get_keywords(id))
+ (ids, kw) = apply(zip,db.get_keywords([id]))
kw = kw[1:]
main(action, bk, kw)
--- a/add_result.py Tue Oct 07 00:06:23 2003 -0400
+++ b/add_result.py Tue Oct 07 00:07:32 2003 -0400
@@ -61,5 +61,5 @@
db.update_bookmark(bk)
id = bk.id
db.update_keywords(id, kw)
- kw = map(lambda e: { 'keyword': e[1] }, db.get_keywords(id)[1:])
+ kw = map(lambda e: { 'keyword': e[1] }, db.get_keywords([id])[1:])
main(bk, kw)
--- a/edit.py Tue Oct 07 00:06:23 2003 -0400
+++ b/edit.py Tue Oct 07 00:07:32 2003 -0400
@@ -35,7 +35,7 @@
bk = db.get_bookmarks([id])[0]
kw = db.get_all_keywords()[1:]
kw.sort(lambda l,r: cmp(l[1],r[1]))
- (ids, kws) = apply(zip,db.get_keywords(id))
+ (ids, kws) = apply(zip,db.get_keywords([id]))
kw = map(lambda elem: {
'id' : elem[0],
'keyword' : elem[1],
--- a/index.tmpl Tue Oct 07 00:06:23 2003 -0400
+++ b/index.tmpl Tue Oct 07 00:07:32 2003 -0400
@@ -8,12 +8,18 @@
<fieldset class="keywords">
<legend>Keywords:</legend>
<p>
+ <label>Include: <select multiple name="sel" onchange="submit()">
<TMPL_LOOP Keywords>
- <input type="checkbox" name="kw" onclick="submit()"
- <TMPL_IF checked>checked</TMPL_IF>
- value="<TMPL_VAR id>"
- /><a href="edit_kw.py?id=<TMPL_VAR id>"><TMPL_VAR keyword></a>(<TMPL_VAR count>);
- </TMPL_LOOP>
+ <option value="<TMPL_VAR id>"
+ <TMPL_IF selected>selected</TMPL_IF>
+ ><TMPL_VAR keyword> (<TMPL_VAR count>)</option>
+ </TMPL_LOOP></select>
+ <label>Exclude: <select multiple name="exc" onchange="submit()">
+ <TMPL_LOOP Keywords>
+ <option value="<TMPL_VAR id>"
+ <TMPL_IF excluded>selected</TMPL_IF>
+ ><TMPL_VAR keyword> (<TMPL_VAR count>)</option>
+ </TMPL_LOOP></select>
</p>
<button>Lookup</button>
</fieldset>
@@ -29,7 +35,8 @@
</ul>
<hr/>
<p><a href="add.py">Add new bookmark</a>.<br/>
- <a href="import.py">Import a XBEL file</a>.</p>
+ <a href="import.py">Import a XBEL file</a>.<br/>
+ <a href="edit_kw.py">Edit keywords</a>.</p>
<p>Here the <a
href="javascript:bk1='<TMPL_VAR curl>?curl='+escape(location.href)+'&ctitle='+escape(document.title);bkwin=window.open(bk1,'bkqm','width=620,height=500,scrollbars=1,resizable=1');bkwin.focus();">Quick
Mark Link</a>. Put it on your bookmarks (using <tt><Right-Mouse
--- a/lib/my_db.py Tue Oct 07 00:06:23 2003 -0400
+++ b/lib/my_db.py Tue Oct 07 00:07:32 2003 -0400
@@ -131,16 +131,21 @@
WHERE userid = %d AND id = %d;
""" % (self.userid, id))
return self.crs.fetchone()[0]
- def get_keywords(self, bk_id):
- self.crs.execute("""
- SELECT k.id, k.name
+ def get_keywords(self, bk_ids):
+ if len(bk_ids) == 0:
+ return []
+ qry = """
+ SELECT DISTINCT k.id, k.name
FROM keywords k, bookmarks_keywords bk
WHERE bk.userid = %d
AND k.userid = %d
- AND bk.bookmark = %d
AND k.id = bk.keyword
- ORDER BY k.id;
- """ % (self.userid, self.userid, bk_id))
+ AND (
+ """ % (self.userid, self.userid)
+ for id in bk_ids:
+ qry = qry + "bk.bookmark = %d OR " % (id,)
+ qry = qry[:-3] + ") ORDER BY k.id;"
+ self.crs.execute(qry)
return self.crs.fetchall()
def update_keyword(self, id, name):
self.crs.execute("""
--- a/lib/utils.py Tue Oct 07 00:06:23 2003 -0400
+++ b/lib/utils.py Tue Oct 07 00:07:32 2003 -0400
@@ -68,3 +68,4 @@
u.append(x)
return u
+