[Mpuls-commits] r552 - in wasko/trunk: . waskaweb/controllers waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 28 11:10:17 CEST 2009


Author: torsten
Date: 2009-07-28 11:10:14 +0200 (Tue, 28 Jul 2009)
New Revision: 552

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case.py
   wasko/trunk/waskaweb/templates/casemanagement/main.mako
Log:
Make printing of the whole case work again


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-07-28 08:54:34 UTC (rev 551)
+++ wasko/trunk/ChangeLog.txt	2009-07-28 09:10:14 UTC (rev 552)
@@ -68,6 +68,12 @@
 	  waskaweb/templates/casemanagement/digest_body.mako: New function in
 	  controller to handle print requests for the digest.
 
+	Make printing of the whole case work again
+
+	* waskaweb/controllers/case.py,
+	  waskaweb/templates/casemanagement/main.mako: Removed link to print
+	  empty cases. Adopted traversal over the case to the new navigation.
+
 2009-07-16	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 
 	Set version to 1.0.5

Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py	2009-07-28 08:54:34 UTC (rev 551)
+++ wasko/trunk/waskaweb/controllers/case.py	2009-07-28 09:10:14 UTC (rev 552)
@@ -70,6 +70,7 @@
 #from waskaweb.model.semantic       import *
 #from waskaweb.model.navigation     import NavigationTree
 from waskaweb.lib.navigation       import get_navigation
+from waskaweb.controllers.formularpage import get_rendered_page
 from waskaweb.lib.security         import checkRole
 from waskaweb.model.document       import listDocuments
 #from waskaweb.model.casedocument   import DataSaveException
@@ -292,29 +293,47 @@
         return self.digest(id)
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
-    def printAll(self, id, empty):
-        id = self._checkInt(id)
-        empty = self._checkBool(empty)
+    def printAll(self, id, empty='0'):
+        out = []
         case = self._loadCase(id)
-        formular = []
+        render_mode = session['render_mode']
+        session['render_mode'] = 'ro'
+        session.save()
+        c.digest = case.getDigest()
+        digest = render('/casemanagement/digest_body.mako')
+        out.append(unicode(digest, 'utf-8'))
+        navigation = session.get('navigation.tree')
+        if navigation:
+            for item in navigation.getAllItems():
+                out.append(unicode(get_rendered_page(item.key), 'utf-8'))
+        c.formular = "".join(out)
         c.print_version = 1
-        # First page is print version of the digest ()
-        c.digest = case.getDigest(empty)
-        digest = render('/casemanagement/digest_body.mako')
-        formular.append(unicode(digest, 'utf-8'))
-        # append pagebreak
-        formular.append('<span style="page-break-after:always"></span>')
-        for ti in self.getNavigation().getAllItems():
-            content, navigation, warnings = self._getRenderdFormElements(ti, id, ro_mode=True, no_data=empty)
-            formular.append(u"".join(
-                [u'<h%d>%s</h%d>' % (min(i+1, 4), escape(s), min(i+1,4)) for i, s in enumerate(ti.pureHeaders())]))
-            if not ti.children: #Only add leaves
-                formular.append(content)
-        c.formular = "<br>".join(formular)
-        c.page_id = None
-        page = render('/casemanagement/formular.mako')
-        return page
+        session['render_mode'] = render_mode 
+        session.save()
+        return render('/formularpage/formular.mako')
 
+        #id = self._checkInt(id)
+        #empty = self._checkBool(empty)
+        #case = self._loadCase(id)
+        #formular = []
+        #c.print_version = 1
+        ## First page is print version of the digest ()
+        #c.digest = case.getDigest(empty)
+        #digest = render('/casemanagement/digest_body.mako')
+        #formular.append(unicode(digest, 'utf-8'))
+        ## append pagebreak
+        #formular.append('<span style="page-break-after:always"></span>')
+        #for ti in self.getNavigation().getAllItems():
+        #    content, navigation, warnings = self._getRenderdFormElements(ti, id, ro_mode=True, no_data=empty)
+        #    formular.append(u"".join(
+        #        [u'<h%d>%s</h%d>' % (min(i+1, 4), escape(s), min(i+1,4)) for i, s in enumerate(ti.pureHeaders())]))
+        #    if not ti.children: #Only add leaves
+        #        formular.append(content)
+        #c.formular = "<br>".join(formular)
+        #c.page_id = None
+        #page = render('/casemanagement/formular.mako')
+        #return page
+
     @checkRole('cm_ka')
     def new(self):
         session_case = SessionCase()

Modified: wasko/trunk/waskaweb/templates/casemanagement/main.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/main.mako	2009-07-28 08:54:34 UTC (rev 551)
+++ wasko/trunk/waskaweb/templates/casemanagement/main.mako	2009-07-28 09:10:14 UTC (rev 552)
@@ -55,8 +55,8 @@
       ${self.buildInfofield()}
       <ul>
         <li><a href="${h.url_for(controller='/case_overview')}" onclick="return checkModification();"> ${_('cm_menu_link_backtooverview')}</a></li>
-        <li><a href="/case/printAll/${session.get('case').id}/0" onclick="return checkModification();"> ${_('cm_menu_link_print')}</a></li>
-        <li><a href="/case/printAll/${session.get('case').id}/1" onclick="return checkModification();"> ${_('cm_menu_link_printempty')}</a></li>
+        <li><a href="/case/printAll/${session.get('case').id}/0" onclick="return checkModification();" target="_blank"> ${_('cm_menu_link_print')}</a></li>
+        ##<li><a href="/case/printAll/${session.get('case').id}/1" onclick="return checkModification();"> ${_('cm_menu_link_printempty')}</a></li>
         % if h.hasRole(['cm_ka']):
           <li><a href="/case/newReminder/${session.get('case').id}" onclick="return checkModification();"> ${_('cm_menu_link_create_reminder')}</a></li>
         % endif



More information about the Mpuls-commits mailing list