[Mpuls-commits] r3635 - in base/trunk: . mpulsweb/controllers mpulsweb/lib mpulsweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Sep 14 21:14:15 CEST 2010


Author: bh
Date: 2010-09-14 21:14:07 +0200 (Tue, 14 Sep 2010)
New Revision: 3635

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case_overview.py
   base/trunk/mpulsweb/lib/validators.py
   base/trunk/mpulsweb/templates/casemanagement/overview.mako
Log:
* mpulsweb/controllers/case_overview.py
(CaseOverviewController.overview): Set form default value for
all_ids

* mpulsweb/lib/validators.py (BundleActionForm.all_ids): New
validator for new parameter

* mpulsweb/templates/casemanagement/overview.mako: Add hidden
parameter all_ids for the list of ids of all the cases in the
search result.  This will avoid having to do an extra search when
the user wants to apply an action to all cases in a search result.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-09-14 18:56:29 UTC (rev 3634)
+++ base/trunk/ChangeLog	2010-09-14 19:14:07 UTC (rev 3635)
@@ -1,5 +1,19 @@
 2010-09-14  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/templates/casemanagement/overview.mako: Add hidden
+	parameter all_ids for the list of ids of all the cases in the
+	search result.  This will avoid having to do an extra search when
+	the user wants to apply an action to all cases in a search result.
+
+	* mpulsweb/controllers/case_overview.py
+	(CaseOverviewController.overview): Set form default value for
+	all_ids
+
+	* mpulsweb/lib/validators.py (BundleActionForm.all_ids): New
+	validator for new parameter
+
+2010-09-14  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/validators.py (BundleActionForm.action): Improve
 	formatting.
 

Modified: base/trunk/mpulsweb/controllers/case_overview.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_overview.py	2010-09-14 18:56:29 UTC (rev 3634)
+++ base/trunk/mpulsweb/controllers/case_overview.py	2010-09-14 19:14:07 UTC (rev 3635)
@@ -138,9 +138,10 @@
 
         overview = render('/casemanagement/overview.mako')
 
-        formular_defaults = search_options_copy or request.params.mixed()
-        return formencode.htmlfill.render(overview,
-                                          defaults=formular_defaults,
+        form_defaults = search_options_copy or request.params.mixed()
+        form_defaults["all_ids"] = " ".join(unicode(case.id)
+                                            for case in c.cases.getDatasets())
+        return formencode.htmlfill.render(overview, defaults=form_defaults,
                                           errors=c.form_errors)
 
 

Modified: base/trunk/mpulsweb/lib/validators.py
===================================================================
--- base/trunk/mpulsweb/lib/validators.py	2010-09-14 18:56:29 UTC (rev 3634)
+++ base/trunk/mpulsweb/lib/validators.py	2010-09-14 19:14:07 UTC (rev 3635)
@@ -8,7 +8,7 @@
 from formencode import ForEach, All
 from formencode.validators import Bool, Int, String, FieldsMatch, \
      StringBoolean, DateConverter, TimeConverter, FormValidator, MaxLength, \
-     FileUploadKeeper, OneOf
+     FileUploadKeeper, OneOf, Wrapper
 
 from pylons import app_globals as g
 from mpulsweb.lib.translation import _
@@ -681,6 +681,7 @@
                         'exportXML', 'exportCSV', 'exportXLS',
                         'evaluate']))
     case_id = ForEach(Int(), convert_to_list=True)
+    all_ids = Wrapper(to_python=lambda s: [int(item) for item in s.split()])
 
 
 class ExportSelectorValidator(BaseFormValidator):

Modified: base/trunk/mpulsweb/templates/casemanagement/overview.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/overview.mako	2010-09-14 18:56:29 UTC (rev 3634)
+++ base/trunk/mpulsweb/templates/casemanagement/overview.mako	2010-09-14 19:14:07 UTC (rev 3635)
@@ -24,6 +24,7 @@
   <div class="waska_form_element">
     <input type="checkbox" name="all_cases" id="all_cases" value="1"><label for="all_cases">
     ${ungettext('Select the %s found case.', 'Select all %s found cases', c.count_all) % c.count_all}</label>
+    <input type="hidden" name="all_ids" value="">
   </div>
   <div class="waska_form_element w30">
     <select name="action">



More information about the Mpuls-commits mailing list