[Mpuls-commits] r564 - in wasko/trunk: . waskaweb/lib waskaweb/public/styles

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 29 15:21:40 CEST 2009


Author: torsten
Date: 2009-07-29 15:21:38 +0200 (Wed, 29 Jul 2009)
New Revision: 564

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/lib/renderer_new.py
   wasko/trunk/waskaweb/public/styles/all.css
Log:
Ported back rg digests.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-07-29 08:47:31 UTC (rev 563)
+++ wasko/trunk/ChangeLog.txt	2009-07-29 13:21:38 UTC (rev 564)
@@ -15,7 +15,13 @@
 
 	* waskaweb/lib/renderer_new.py: Fixed select link
 
+	Ported back rendering of rg digests in rg overviews
 
+	* waskaweb/lib/renderer_new.py,
+	  waskaweb/public/styles/all.css: Copied styles and function to render
+	  rg digests.
+
+
 2009-07-28	Sascha L. Teichmann	<sascha.teichmann at intevation.de>
 
 	* waskaweb/model/case.py: Fixed creation of new cases.

Modified: wasko/trunk/waskaweb/lib/renderer_new.py
===================================================================
--- wasko/trunk/waskaweb/lib/renderer_new.py	2009-07-29 08:47:31 UTC (rev 563)
+++ wasko/trunk/waskaweb/lib/renderer_new.py	2009-07-29 13:21:38 UTC (rev 564)
@@ -31,10 +31,13 @@
 import logging
 from formed.meta.nodecomponents import Node
 from formed.instance.tree import RepeatInstanceContainerNode, RepeatInstanceNode 
+from formed.instance.backends.postgres import DBFactory as InstanceFactory
+from waskaweb.lib.db import PostgresDBInterface 
 from waskaweb.lib.filters import NA
 from waskaweb.lib.helpers import dd_mm_YYYY as format_date 
 import formed.meta.data as data
 from pylons.i18n import _
+from pylons import g
 
 from cgi import escape
 from xml.sax.saxutils import quoteattr
@@ -636,6 +639,41 @@
 
 class RepeatGroupRenderer(ViewRenderer):
 
+    def render_digest(self, rg):
+        out     = []
+        fields  = []
+        case_id = rg.getIdentifier().split(':')[-1]
+        factory = InstanceFactory(g.formedTree, PostgresDBInterface())
+        it      = factory.loadInstanceTreeByIdentifier(case_id) 
+        digests = rgdigests = {'rg_unterstuetzung': ['hilfm_art', 'hilfm_inst', 'hilfm_einr', 'hilfm_start', 'hilfm_ende'], 'rg_kompetenz': ['datum_kf', 'kf_anbiet']}
+
+        if digests:
+            fields  = digests.get(rg.getMeta().getName(), []) 
+
+        out.append('<table class="rgdigest">')
+        if len(fields) < 1:
+            out.append('<tr><td>%s</td></tr>' % rg.getIdentifier())
+        else:
+            for num, field in enumerate(fields):
+                item = it.getItem('%s:%s:%s' % (field, rg.getInternalIdentifier(), case_id))
+                out.append('<tr>')
+                out.append('<td class="label">')
+                out.append('<a href="/navigation/select_branch/%s">' % rg.getChildren()[0].getIdentifier())
+                out.append(item.getMeta().getDescription())
+                out.append('</a>')
+                out.append('</td>')
+                out.append('<td>')
+                out.append('<a href="/navigation/select_branch/%s">' % rg.getChildren()[0].getIdentifier())
+                value = item.getValue()
+                if isinstance(item.getMeta(), data.DateLeaf):
+                    if value: value = format_date(value) 
+                out.append('%s' % NA(value))
+                out.append('</a>')
+                out.append('</td>')
+                out.append('</tr>')
+        out.append('</table>')
+        return "".join(out)
+
     def render(self, showNext=False):
         out = []
         out.append('<div class="widget">')
@@ -644,7 +682,7 @@
         for num, rg in enumerate(self.page.getChildren()):
             out.append('<tr>')
             out.append('<td>')
-            out.append(rg.getIdentifier())
+            out.append(self.render_digest(rg))
             out.append('</td>')
             out.append('<td class="actions">')
             out.append('<a href="/navigation/select_branch/%s"><img src="/images/icons/view_red.gif" border="0" alt="%s" title="%s"></a>' % (rg.getChildren()[0].getIdentifier(), _('view'), _('view')))

Modified: wasko/trunk/waskaweb/public/styles/all.css
===================================================================
--- wasko/trunk/waskaweb/public/styles/all.css	2009-07-29 08:47:31 UTC (rev 563)
+++ wasko/trunk/waskaweb/public/styles/all.css	2009-07-29 13:21:38 UTC (rev 564)
@@ -140,7 +140,36 @@
 	width: 30em;
 }
 
+table.rgdigest td.label {
+	font-weight: bold;
+	width: 15em;
+}
 
+table.rgdigest td {
+	border-bottom: 1pt dotted #cdd6de;
+	font-size: 0.8em;
+}
+
+table.rgdigest tr {
+	background-color: transparent !important; 
+}
+
+table.list tr:hover {
+	background-color: #cdd6de;
+}
+
+table.list a {
+	text-decoration: None;
+}
+
+table.list tr td, th {
+	vertical-align: middle;
+}
+
+tr.hl, td.hl, th.hl {
+	background-color: #ebebeb;
+}
+
 /*----------------------*/
 /* 2. Evaluation Formats*/
 /*----------------------*/



More information about the Mpuls-commits mailing list