[Mpuls-commits] r75 - in waska/trunk: . waskaweb/config waskaweb/controllers waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 18 18:51:41 CEST 2008


Author: teichmann
Date: 2008-08-18 18:51:40 +0200 (Mon, 18 Aug 2008)
New Revision: 75

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/config/routing.py
   waska/trunk/waskaweb/controllers/case.py
   waska/trunk/waskaweb/lib/formular_help.py
   waska/trunk/waskaweb/lib/renderer.py
Log:
Added controller support for required fields. TODO: make icon.



Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-08-18 16:18:19 UTC (rev 74)
+++ waska/trunk/ChangeLog.txt	2008-08-18 16:51:40 UTC (rev 75)
@@ -1,11 +1,18 @@
-2008-08-18 	Torsten Irlaender  <torsten.irlaender at intevation.de>
+2008-08-18  Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
+	Added controller support for required fields. TODO: make icon.
+
+	* waskaweb/config/routing.py: Added route to required fields
+	* waskaweb/controllers/case.py: Added controller.
+	* waskaweb/lib/formular_help.py: Fixed key errror.
+	* waskaweb/lib/renderer.py: Issue (*) on required fields.
+
+2008-08-18  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
 	Added support for form annotations. TODO: add controller and adapt renderer.
 
 	* formed/annotations.xhtml: New. File containing annonations.
-
 	* waskaweb/lib/formular_help.py: Add dictionary for annotations.
-
 	* waskaweb/lib/app_globals.py: Load annotations file.
 
 2008-08-13 	Torsten Irlaender  <torsten.irlaender at intevation.de>

Modified: waska/trunk/waskaweb/config/routing.py
===================================================================
--- waska/trunk/waskaweb/config/routing.py	2008-08-18 16:18:19 UTC (rev 74)
+++ waska/trunk/waskaweb/config/routing.py	2008-08-18 16:51:40 UTC (rev 75)
@@ -63,6 +63,7 @@
     map.connect('rg_aid/:action/:rg_id/:page_id/:form', controller="rg_aid") 
     map.connect('rg_aid/:action/:rg_id/:page_id', controller="rg_aid")
     map.connect('formhelp', 'case/showhelp/:help_id', controller="case", action="showHelp")
+    map.connect('required', 'case/required/:help_id', controller="case", action="showRequired")
     map.connect('digest', 'case/digest/:id', controller="case", action="digest")
     map.connect('case_overview/overview/:reset/:sort_field/:sort_order', controller="case_overview", action="overview", reset=0, sort_field="name_1", sort_order="asc") #for bundles actions in case_overview
     map.connect('case_overview/:action/:confirmed', controller="case_overview") #for bundles actions in case_overview

Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py	2008-08-18 16:18:19 UTC (rev 74)
+++ waska/trunk/waskaweb/controllers/case.py	2008-08-18 16:51:40 UTC (rev 75)
@@ -427,6 +427,13 @@
         c.helpdata  = unicode(help, 'utf-8')
         return render('/casemanagement/help.mako')
 
+    @checkRole(('admin_ka', 'cm_ka', 'pb_ka'))
+    def showRequired(self, help_id):
+        required = g.helpData.getAnnotations(help_id)
+        if not required: raise HTTPNotFound()
+        c.required  = unicode(required, 'utf-8')
+        return render('/casemanagement/required.mako')
+
     @checkRole('cm_ka')
     def save(self):
         case_session = session.get('case')

Modified: waska/trunk/waskaweb/lib/formular_help.py
===================================================================
--- waska/trunk/waskaweb/lib/formular_help.py	2008-08-18 16:18:19 UTC (rev 74)
+++ waska/trunk/waskaweb/lib/formular_help.py	2008-08-18 16:51:40 UTC (rev 75)
@@ -111,7 +111,7 @@
         return self.helps.get(id, default)
 
     def hasAnnotations(self, id, kinds = ("required", )):
-        annotations = self.annotations.get(key)
+        annotations = self.annotations.get(id)
         if not annotations: return False
         for annotation in annotations:
             if annotation.kind in kinds:

Modified: waska/trunk/waskaweb/lib/renderer.py
===================================================================
--- waska/trunk/waskaweb/lib/renderer.py	2008-08-18 16:18:19 UTC (rev 74)
+++ waska/trunk/waskaweb/lib/renderer.py	2008-08-18 16:51:40 UTC (rev 75)
@@ -47,6 +47,9 @@
 <img src="/images/icons/form_help.png" border="0"
 alt="Hilfesymbol"></a></span>'''
 
+REQUIRED = \
+'''<span class="help"> <a href="%s" target="_blank">(*)</a></span>'''
+
 WEIGHTS = (15, 25, 30, 40, 45, 50, 55, 60, 75)
 
 SET_MODIFICATION = ' onchange="setModification();" '
@@ -63,10 +66,18 @@
         return self.getData(dataID) 
 
     def getHelp(self, dataID):
-        if not self.help or not self.help.hasHelp(dataID):
-            return ''
-        return HELP % h.url_for('formhelp', help_id=escape(dataID))
+        if not self.help: return ''
 
+        out = []
+
+        if self.help.hasAnnotations(dataID):
+            out.append(REQUIRED % h.url_for('required', help_id=escape(dataID)))
+
+        if self.help.hasHelp(dataID):
+            out.append(HELP % h.url_for('formhelp', help_id=escape(dataID)))
+
+        return ''.join(out)
+
     def getError(self, dataID):
         return ""
 



More information about the Mpuls-commits mailing list