[Mpuls-commits] r3434 - in base/trunk: . mpulsweb/controllers mpulsweb/lib mpulsweb/templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 17 21:11:29 CEST 2010
Author: bh
Date: 2010-08-17 21:11:25 +0200 (Tue, 17 Aug 2010)
New Revision: 3434
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/case_overview.py
base/trunk/mpulsweb/lib/search.py
base/trunk/mpulsweb/templates/casemanagement/search.mako
Log:
* mpulsweb/controllers/case_overview.py (parseSearchOptions):
Handle branch option
* mpulsweb/lib/search.py (CaseSearch.VALID_OPTIONS): Add "branch"
(CaseSearch.get_branch_clause): New. Handle branch search
criterion.
(CaseSearch.get_where): Add branch search option.
* mpulsweb/templates/casemanagement/search.mako: Add branch search
option
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-08-17 18:57:43 UTC (rev 3433)
+++ base/trunk/ChangeLog 2010-08-17 19:11:25 UTC (rev 3434)
@@ -1,5 +1,18 @@
2010-08-17 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/templates/casemanagement/search.mako: Add branch search
+ option
+
+ * mpulsweb/controllers/case_overview.py (parseSearchOptions):
+ Handle branch option
+
+ * mpulsweb/lib/search.py (CaseSearch.VALID_OPTIONS): Add "branch"
+ (CaseSearch.get_branch_clause): New. Handle branch search
+ criterion.
+ (CaseSearch.get_where): Add branch search option.
+
+2010-08-17 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/lib/validators.py (SearchCaseForm.gender): Added.
2010-08-17 Bernhard Herzog <bh at intevation.de>
Modified: base/trunk/mpulsweb/controllers/case_overview.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_overview.py 2010-08-17 18:57:43 UTC (rev 3433)
+++ base/trunk/mpulsweb/controllers/case_overview.py 2010-08-17 19:11:25 UTC (rev 3434)
@@ -91,6 +91,9 @@
if options.get("gender", -2) != -2:
search_options.append("gender:%s" % options["gender"])
+ # branch office
+ if options.get("branch"):
+ search_options.append("branch:%s" % options["branch"])
return search_options
Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py 2010-08-17 18:57:43 UTC (rev 3433)
+++ base/trunk/mpulsweb/lib/search.py 2010-08-17 19:11:25 UTC (rev 3434)
@@ -97,7 +97,7 @@
class CaseSearch(Search):
VALID_OPTIONS = (Search.VALID_OPTIONS
- + ("own", "standin", "editor", "sdate", "edate",
+ + ("own", "standin", "editor", "branch", "sdate", "edate",
"sort_field", "sort_order"))
@@ -151,6 +151,16 @@
return "m.bearbeiter_id = %s" % options['editor']
return "TRUE"
+ def get_branch_clause(self, search, options):
+ """Return the search condition to select cases based on branch office.
+ Derived classes may override this method if necessary.
+ """
+ print "CaseSearch.get_branch_clause", options
+ branch = options.get('branch')
+ if branch is not None:
+ return "b.filiale = '%s'" % branch
+ return "TRUE"
+
def get_phases_clause(self, search, options):
"""Return the search condition to select cases based on their phase.
The returned clause should select all cases that are current in
@@ -220,14 +230,15 @@
def get_where(self, search, options):
allowed_viewer = self.get_allowed_viewer_clause(search, options)
editor = self.get_editor_clause(search, options)
+ branch = self.get_branch_clause(search, options)
phases = self.get_phases_clause(search, options)
needle_expr = self.get_needle_clause(search, options)
time_interval = self.get_dates_clause(search, options)
status_expr = self.get_status_clause(search, options)
gender = self.get_gender_clause(search, options)
- return " AND ".join((needle_expr, status_expr, allowed_viewer, editor,
- time_interval, phases, gender))
+ return " AND ".join((needle_expr, status_expr, allowed_viewer,
+ editor, branch, time_interval, phases, gender))
def get_order(self, options):
sort_field = options.get('sort_field', "m.id")
Modified: base/trunk/mpulsweb/templates/casemanagement/search.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/search.mako 2010-08-17 18:57:43 UTC (rev 3433)
+++ base/trunk/mpulsweb/templates/casemanagement/search.mako 2010-08-17 19:11:25 UTC (rev 3434)
@@ -22,6 +22,12 @@
</select>
</td>
</tr>
+ <tr style="${not c.extended_search and 'display:none' or ''}">
+ <td class="label"><label for="branch">${_("Branch")}</label></td>
+ <td>
+ <input type="text" name="branch" id="branch" maxlength="64">
+ </td>
+ </tr>
% endif
% if h.hasRole(['cm_ka']):
% if g.mpuls_config.is_enabled('case-module', 'organisation'):
More information about the Mpuls-commits
mailing list