[Mpuls-commits] r556 - in wasko/trunk: . waskaweb/controllers waskaweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jul 28 16:05:52 CEST 2009
Author: torsten
Date: 2009-07-28 16:05:50 +0200 (Tue, 28 Jul 2009)
New Revision: 556
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/controllers/formularpage.py
wasko/trunk/waskaweb/controllers/navigation.py
wasko/trunk/waskaweb/lib/navigation.py
Log:
Fixed navigation
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-07-28 13:32:12 UTC (rev 555)
+++ wasko/trunk/ChangeLog.txt 2009-07-28 14:05:50 UTC (rev 556)
@@ -84,6 +84,13 @@
telephonenumbers, as they may not be present. Did not implement such
logic to check wheter there is a second telephonenumer or not.
+
+ Fixed navigation
+
+ * waskaweb/controllers/navigation.py,
+ waskaweb/controllers/formularpage.py,
+ waskaweb/lib/navigation.py: Unfold folders on save an proceed.
+
2009-07-16 Torsten Irlaender <torsten.irlaender at intevation.de>
Set version to 1.0.5
Modified: wasko/trunk/waskaweb/controllers/formularpage.py
===================================================================
--- wasko/trunk/waskaweb/controllers/formularpage.py 2009-07-28 13:32:12 UTC (rev 555)
+++ wasko/trunk/waskaweb/controllers/formularpage.py 2009-07-28 14:05:50 UTC (rev 556)
@@ -10,6 +10,7 @@
from waskaweb.lib.base import BaseController, render
from waskaweb.lib.db import PostgresDBInterface
+from waskaweb.lib.navigation import mark_folderopen
from waskaweb.lib.renderer_new import ViewRenderer, RepeatGroupRenderer, ErrorRenderer
from formed.instance.backends.postgres import DBFactory as InstanceFactory
@@ -42,6 +43,7 @@
#log.debug('select: errorrenderer ok: %s' % errorrenderer)
#c.formularerrors = errorrenderer.render(page)
try:
+ mark_folderopen(session['navigation.tree'].getTreeItem(id))
if session['navigation.tree'].getTreeItem(id).nextKey():
c.formular = renderer.render(showNext=True)
else:
Modified: wasko/trunk/waskaweb/controllers/navigation.py
===================================================================
--- wasko/trunk/waskaweb/controllers/navigation.py 2009-07-28 13:32:12 UTC (rev 555)
+++ wasko/trunk/waskaweb/controllers/navigation.py 2009-07-28 14:05:50 UTC (rev 556)
@@ -37,6 +37,7 @@
from waskaweb.model.repeatgroup import AidList
from waskaweb.lib.security import checkRole
from waskaweb.lib.base import *
+from waskaweb.lib.navigation import mark_folderopen, mark_folderclose
from waskaweb.controllers.formularpage import FormularpageController
log = logging.getLogger(__name__)
@@ -52,17 +53,6 @@
def index(self):
raise HTTPNotFound()
- def _mark_folderopen(self, ti):
- session['navigation.openfolders'].append(ti.key)
- session.save()
-
- def _mark_folderclose(self, ti):
- try:
- session['navigation.openfolders'].remove(ti.key)
- session.save()
- except:
- log.error('Tried to remove %s from %s' % (ti.key, session['navigation.openfolders']))
-
def open_branch(self, id):
print id
self.navigation = session['navigation.tree']
@@ -70,7 +60,7 @@
if not tree_item: raise HTTPNotFound()
opened_folders = tree_item.unfold()
for ti in opened_folders:
- self._mark_folderopen(ti)
+ mark_folderopen(ti)
tree_item = tree_item.deepest_item()
page_id = tree_item.key
return FormularpageController().select(session.get('navigation.selectedpage', page_id))
@@ -80,7 +70,7 @@
tree_item = self.navigation.getTreeItem(id)
if not tree_item: raise HTTPNotFound()
tree_item.set_open(False)
- self._mark_folderclose(tree_item)
+ mark_folderclose(tree_item)
page_id = tree_item.key
return FormularpageController().select(session.get('navigation.selectedpage', page_id))
@@ -91,8 +81,8 @@
tree_item = tree_item.deepest_item()
opened_folders = tree_item.unfold()
for ti in opened_folders:
- self._mark_folderopen(ti)
- self._mark_folderopen(tree_item)
+ self.mark_folderopen(ti)
+ mark_folderopen(tree_item)
page_id = tree_item.key
session['navigation.selectedpage'] = page_id
session.save()
Modified: wasko/trunk/waskaweb/lib/navigation.py
===================================================================
--- wasko/trunk/waskaweb/lib/navigation.py 2009-07-28 13:32:12 UTC (rev 555)
+++ wasko/trunk/waskaweb/lib/navigation.py 2009-07-28 14:05:50 UTC (rev 556)
@@ -63,7 +63,19 @@
print "n3"
return navigation
+def mark_folderopen(ti):
+ if ti.key not in session.get('navigation.openfolders'):
+ session['navigation.openfolders'].append(ti.key)
+ ti.unfold()
+ session.save()
+def mark_folderclose(ti):
+ try:
+ session['navigation.openfolders'].remove(ti.key)
+ session.save()
+ except:
+ log.error('Tried to remove %s from %s' % (ti.key, session['navigation.openfolders']))
+
class TreeItem:
def __init__(self, name, description, children = None, parent = None):
More information about the Mpuls-commits
mailing list