[Mpuls-commits] r285 - in wasko/trunk: . waskaweb/controllers waskaweb/lib waskaweb/model waskaweb/public/styles waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 23 14:56:27 CET 2009


Author: torsten
Date: 2009-02-23 14:56:23 +0100 (Mon, 23 Feb 2009)
New Revision: 285

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/CaseBase.py
   wasko/trunk/waskaweb/lib/helpers.py
   wasko/trunk/waskaweb/model/navigation.py
   wasko/trunk/waskaweb/public/styles/all.css
   wasko/trunk/waskaweb/public/styles/color3.css
   wasko/trunk/waskaweb/templates/casemanagement/formular.mako
Log:
Fixed rendering of warnings


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/ChangeLog.txt	2009-02-23 13:56:23 UTC (rev 285)
@@ -1,5 +1,4 @@
-2009-02-23	Torsten Irlaender  <torsten.irlaender at intevation.de>
-
+2009-02-23	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 	Fixed issue36 (WASKO-Online)
 
 	* waskaweb/model/logbook.py,
@@ -8,6 +7,17 @@
 	  waskaweb/templates/casemanagement/evaluation/evaluation_effort.mako:
 	  Added new logbookentries. Adopted evaluation.
 
+	Fixed Warningsrendering
+
+	* waskaweb/model/navigation.py,
+	  waskaweb/controllers/CaseBase.py,
+	  waskaweb/lib/helpers.py,
+	  waskaweb/public/styles/all.css,
+	  waskaweb/public/styles/color3.css,
+	  waskaweb/templates/casemanagement/formular.mako: Markers for
+	  warnings are now rendered in the formular. Warning and error list at
+	  top of the page is rendered correctly too.
+
 2009-02-23	Sascha L. Teichmann <teichmann at intevation.de>
 
 	Added the beloved JavaScript modified field checks to renderer

Modified: wasko/trunk/waskaweb/controllers/CaseBase.py
===================================================================
--- wasko/trunk/waskaweb/controllers/CaseBase.py	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/controllers/CaseBase.py	2009-02-23 13:56:23 UTC (rev 285)
@@ -36,6 +36,7 @@
 from waskaweb.lib.renderer      import FormDataImpl, ViewRenderer
 from waskaweb.lib.filecache     import FileCache 
 from waskaweb.model.case        import CaseFactory, LoadCaseNotExistsError 
+from waskaweb.model.data        import PageNode
 from waskaweb.model.repeatgroup import AidList 
 from waskaweb.lib.security      import checkRole
 
@@ -65,13 +66,13 @@
     def _getRenderdFormElements(self, ti, ds_id, page_id=None, ro_mode=False, no_data=False):
         navigation        = self._getFormNavigation(selected_key=ti.key)
         real_id           = ds_id
-        formdata          = self._getFormdata(ti, real_id, no_data)
+        formdata, warnings  = self._getFormdata(ti, real_id, no_data)
         vr                = ViewRenderer(formdata, ro_mode)
         content           = vr.renderView(
             str(ti.key), 
             ds_id,
             showNext = not ti.nextKey() is None)
-        return (content, navigation)
+        return (content, navigation, warnings)
 
     def _getFormNavigation(self,selected_key=None):
         case = session.get('case')
@@ -93,16 +94,19 @@
             redirect_to(controller="/case_overview")
         doc  = g.formedTree
         help = g.helpData
-        page = doc.getPageStore(treeItem.name, ds_id, no_data=no_data)
+        pagestore = doc.getPageStore(treeItem.name, ds_id, no_data=no_data)
+        page     = doc.findByClassAndName(PageNode, treeItem.name)
+        warnings = doc.warningsOnPage(page, ds_id)
 
         form_errors = case.getFormErrors()
         formdata = FormDataImpl(
             FileCache(),
             help=help, 
-            page=page, 
-            errors=form_errors, 
-            nc=[page.getWidget()])
-        return formdata
+            page=pagestore, 
+            errors=form_errors,
+            warnings=warnings,
+            nc=[page])
+        return (formdata, warnings)
 
     def _setState(self, id, state):
         id      = self._checkInt(id)
@@ -138,10 +142,11 @@
 
         c.page_id = page_id
         c.print_form = "show" # Which page to open in popup on printing?
-        content, navigation = self._getRenderdFormElements(
+        content, navigation, warnings = self._getRenderdFormElements(
             ti, ds_id, page_id, ro_mode=False)
         c.formular = content
         c.form_navigation = navigation 
+        c.warnings = warnings 
         return render('/casemanagement/formular.mako')
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
@@ -172,9 +177,10 @@
         case_session.setPageId(page_id)
         case_session.setMode("show")
         session.save()
-        content, navigation = self._getRenderdFormElements(ti, ds_id, page_id, ro_mode=True)
+        content, navigation, warnings = self._getRenderdFormElements(ti, ds_id, page_id, ro_mode=True)
         c.formular = content
         c.form_navigation = navigation 
+        c.warnings = warnings 
         return render('/casemanagement/formular.mako')
 
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: wasko/trunk/waskaweb/lib/helpers.py
===================================================================
--- wasko/trunk/waskaweb/lib/helpers.py	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/lib/helpers.py	2009-02-23 13:56:23 UTC (rev 285)
@@ -217,7 +217,7 @@
     except:
         pass
 
-def getErrorsAndWarningsOnPage(page_id):
+def getErrorsAndWarningsOnPage(page_id, warnings=None):
     #if type(page_id) != IntType: return u""
     case = session.get('case')
     if not case: return ""
@@ -232,7 +232,8 @@
     formed   = g.formedTree
     page     = formed.findByClassAndName(PageNode, page_name)
     if not page: return ""
-    warnings = formed.warningsOnPage(page, case_id)
+    if warnings is None:
+        warnings = formed.warningsOnPage(page, case_id)
     renderer = ErrorRenderer(errors, warnings, FileCache())
     out = renderer.render(page)
     return out

Modified: wasko/trunk/waskaweb/model/navigation.py
===================================================================
--- wasko/trunk/waskaweb/model/navigation.py	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/model/navigation.py	2009-02-23 13:56:23 UTC (rev 285)
@@ -172,7 +172,7 @@
     def renderHeader(self, form_data):
         descriptions = self.get_description_chain(form_data)
         if not descriptions: return u""
-        out = [u'<div class="content_ueberschrift"><ul>']
+        out = [u'<div id="content_ueberschrift"><ul>']
         for depth, desc in enumerate(descriptions):
             depth = min(depth + 1, 4)
             out.append(u'<li><h%d>%s</h%d></li>' % (depth, desc, depth))

Modified: wasko/trunk/waskaweb/public/styles/all.css
===================================================================
--- wasko/trunk/waskaweb/public/styles/all.css	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/public/styles/all.css	2009-02-23 13:56:23 UTC (rev 285)
@@ -182,14 +182,14 @@
 /*3. Formular Elements */
 /*---------------------*/
 
-div.form_errors {
+div.form_errors, div.form_warnings {
 	border: 0.5pt;
 	padding: 0.5em;
 	border-style: solid;
 	margin-bottom:1em;
 }
 
-div.form_error img {
+div.form_error img, div.form_warning img {
 	border: 0;
 	text-align: middle;
 }

Modified: wasko/trunk/waskaweb/public/styles/color3.css
===================================================================
--- wasko/trunk/waskaweb/public/styles/color3.css	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/public/styles/color3.css	2009-02-23 13:56:23 UTC (rev 285)
@@ -74,6 +74,7 @@
 }
 
 div.navigation .error { color: #a5103b; }
+div.navigation .warning { color: #a5103b; }
 
 div.menu h1 {
 	background-color: #2a2156;
@@ -166,18 +167,23 @@
 /* 6. Evaluation    */
 /*------------------*/
 
-div.form_errors {
+div.form_errors, div.form_warnings {
 	background-color: #fff;
 	border-color: #000;
 }
 
-div.form_errors a, div.form_errors h1 { color: #a5103b; }
+div.form_errors a, div.form_warnings a, div.form_errors h1 { 
+	background-color: #fff;
+	color: #a5103b; 
+}
 
 div.odd-row {
 	border-color: #000;
 	background-color: #E6E6E6;
 }
 
+
+
 /*------------------*/
 /* 7. Login	    */
 /*------------------*/
@@ -216,10 +222,18 @@
 	/*border-width:3px;*/
 }
 
+.warning_box {
+	border-color:#a5103b;
+}
+
 .error_font, .error_font a {
 	color:#a5103b;
 }
 
+.warning_font, .warning_font a {
+	color:#a5103b;
+}
+
 .print_menu_header {
 	background:#efefef;
 }

Modified: wasko/trunk/waskaweb/templates/casemanagement/formular.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/formular.mako	2009-02-23 10:28:15 UTC (rev 284)
+++ wasko/trunk/waskaweb/templates/casemanagement/formular.mako	2009-02-23 13:56:23 UTC (rev 285)
@@ -36,7 +36,7 @@
 </%def>
 
 <%def name="buildFormErrors()">
-    ${h.getErrorsAndWarningsOnPage(c.page_id)}
+    ${h.getErrorsAndWarningsOnPage(c.page_id, c.warnings)}
 </%def>
 
 <%def name="buildContentHeader()">



More information about the Mpuls-commits mailing list