author | fabien@tzone.org |
Wed, 31 Dec 2008 16:26:22 -0500 | |
changeset 75 | 4f6b7b48322f |
parent 74 | 6784c4350b41 |
permissions | -rw-r--r-- |
47
2781ac85b807
[svn r1604] Implement default_view preferences, which move things around a lot.
fabien
parents:
diff
changeset
|
1 |
from templates import Template |
74
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
2 |
from folders import do_folders |
47
2781ac85b807
[svn r1604] Implement default_view preferences, which move things around a lot.
fabien
parents:
diff
changeset
|
3 |
|
74
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
4 |
def add_folder(db, form): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
5 |
keyword = int(form['selection'].value) |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
6 |
parent = 0 |
75
4f6b7b48322f
A lot of fix again, for folder view, bookmark editing and removal
fabien@tzone.org
parents:
74
diff
changeset
|
7 |
if form.has_key('folder'): |
74
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
8 |
parent = int(form['folder'].value) |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
9 |
db.add_folder(keyword, parent) |
47
2781ac85b807
[svn r1604] Implement default_view preferences, which move things around a lot.
fabien
parents:
diff
changeset
|
10 |
|
74
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
11 |
def remove_folder(db, form): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
12 |
keyword = int(form['selection'].value) |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
13 |
db.remove_folders(keyword) |
53 | 14 |
|
74
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
15 |
def do_it(action, db, prefs, form): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
16 |
status = 'result' |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
17 |
status_msg = 'Unknown action' |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
18 |
if form.has_key('step'): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
19 |
step = form['step'].value |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
20 |
if (step == 'add'): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
21 |
add_folder(db, form) |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
22 |
status_msg = "Folder successfully added." |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
23 |
elif (step == 'delete'): |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
24 |
remove_folder(db, form) |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
25 |
status_msg = "Folder successfully removed." |
6784c4350b41
Cleanup of old code, fixes some errors with folders view and make it a
fabien@tzone.org
parents:
58
diff
changeset
|
26 |
do_folders(db, prefs, form, status, status_msg) |