[Mpuls-commits] r4438 - in base/trunk: . mpulsweb/templates mpulsweb/templates/casemanagement mpulsweb/templates/evaluation

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Dec 28 11:59:46 CET 2010


Author: torsten
Date: 2010-12-28 11:59:44 +0100 (Tue, 28 Dec 2010)
New Revision: 4438

Added:
   base/trunk/mpulsweb/templates/evaluation/agencylist.mako
   base/trunk/mpulsweb/templates/evaluation/overview.mako
   base/trunk/mpulsweb/templates/evaluation/search.mako
Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/templates/casemanagement/search.mako
   base/trunk/mpulsweb/templates/main.mako
Log:
* mpulsweb/templates/casemanagement/search.mako,
mpulsweb/templates/evaluation/search.mako: Inherit from new
searchtemplate and overwrite links to controller actions.
* mpulsweb/templates/evaluation/agencylist.mako,
mpulsweb/templates/evaluation/overview.mako: New evaluations server
specific templates.
* mpulsweb/templates/main.mako: Add section for evaluation server in
template.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/ChangeLog	2010-12-28 10:59:44 UTC (rev 4438)
@@ -1,7 +1,33 @@
 2010-12-28  Torsten Irlaender <torsten at intevation.de>
 
 	Implement evaluation server
-
+	* mpulsweb/model/agency.py (MpulsAgency): New classes for agencys in
+	evaluation server. Class is very common to the MpulsCase class, but is
+	hopfully reduced now to the minimum required functionality.
+	* mpulsweb/controllers/evaluation_overview.py: New controller for
+	agancy overview in evaluation server. Search paramenters are saved in
+	its own session variable. Controller is very common to the
+	CaseOverview-controller.
+	* mpulsweb/lib/config.py: Added new config variable for fields of an
+	agency in evalutons server. On default we will display the FKZ and the
+	number of cases within the agency.
+	* mpulsweb/lib/search.py (AppMixin): New base class for application
+	specific search.
+	* mpulsweb/lib/search.py (EvaluationSearch): New class for search in
+	evaluationserver. Refactored Search and CaseSearch. Moved common
+	functions into base Search class.
+	* mpulsweb/lib/app_globals.py: Setup evaluation search on app startup.
+	* mpulsweb/templates/search/search.mako: New. Because search logic is
+	now used in case search and evaluation search the template was moved
+	into a another location and prepared for later inheritation.
+	* mpulsweb/templates/casemanagement/search.mako,
+	mpulsweb/templates/evaluation/search.mako: Inherit from new
+	searchtemplate and overwrite links to controller actions.
+	* mpulsweb/templates/evaluation/agencylist.mako,
+	mpulsweb/templates/evaluation/overview.mako: New evaluations server
+	specific templates.
+	* mpulsweb/templates/main.mako: Add section for evaluation server in
+	template.
 	* mpulsweb/i18n/mpulsweb.pot,
 	  mpulsweb/i18n/de/LC_MESSAGES/mpulsweb.po: New translations for
 	  evaluation specific strings.

Modified: base/trunk/mpulsweb/templates/casemanagement/search.mako
===================================================================
--- base/trunk/mpulsweb/templates/casemanagement/search.mako	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/mpulsweb/templates/casemanagement/search.mako	2010-12-28 10:59:44 UTC (rev 4438)
@@ -1,162 +1,20 @@
 ## -*- coding: utf-8 -*-
-
-% if g.mpuls_config.is_enabled('case-module', 'search'):
+<%inherit file="/search/search.mako" />
+<%def name="buildFormHeader()">
   <form method="post" name="case_search"
         action="${h.url_for(controller='/case_overview', action='search')}" 
         accept-charset="UTF-8">
-  <div class="widget container">
-    <table>
-      <tr>
-        <td class="label">${_('Search')}</td>
-        <td><input type="text" size="30" name="search_str" maxlength="256"></td>
-      </tr>
-      % if h.hasRole(['admin_ka']) and g.mpuls_config.is_enabled('search', 'option-editor'):
-      <tr>
-        <td class="label">${_('Responsibility')}</td>
-        <td>
-          <select name="editor" id="editor">
-            <option value="-1">${_('All users')}</option>
-          % for user in c.userlist:
-            <option value="${user.id}">${user.last_name}, ${user.first_name}</option>
-          % endfor
-          </select>
-        </td>
-      </tr>
-      % endif
-      % if h.hasRole(['admin_ka']) and g.mpuls_config.is_enabled('search', 'option-agency'):
-      <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') and g.mpuls_config.is_enabled('search', 'option-responsibilty'):
-          <tr>
-            <td class="label">${_('Responsibility')}</td>
-            <td>
-              <input type="checkbox" name="own" id="show_own" value="1" checked="checked">
-              <label for="show_own">
-                <img title="${_('Own cases')}"
-                    alt="${_('Editor')}"
-                    src="${h.url_for('/images/icons/edit_editor.png')}"
-                    width="22"
-                    height="22">${_('Own')} (${c.count_own})
-              </label><br>
-              <input type="checkbox" name="standin" id="show_other" value="1" checked="checked">
-              <label for="show_other">
-                <img title="${_('Standin cases')}"
-                    alt="Vertreter"
-                    src="${h.url_for('/images/icons/edit_editors_22.png')}"
-                    width="22"
-                    height="22">${_('Standin')} (${c.count_standin})
-              </label>
-            </td>
-            <td></td>
-          </tr>
-        % else:
-            <input type="hidden" name="own" id="show_own" value="">
-            <input type="hidden" name="standin" id="show_other" value="">
-        % endif
-      % endif
-      % if g.mpuls_config.is_enabled('search', 'option-responsibilty'):
-        <tr>
-          <td class="label">${_('Status')}</td>
-          <td>
-            <input type="checkbox" name="state" id="show_open" value="1">
-            <label for="show_open">
-              <img title="${_('Editable cases')}" alt="${_('Editable')}" src="${h.url_for('/images/icons/edit_22.png')}" height="22" width="22">${_('Editable cases')}</label><br>
-            <input type="checkbox" name="state" id="show_markdelete" value="3" checked="checked">
-            <label for="show_markdelete">
-              <img title="${_('Almost deleted')}" alt="${_('Almost deleted')}" src="${h.url_for('/images/icons/delete_inactive_22.png')}" height="22" width="22">${_('Almost deleted')} (${c.count_del})
-            </label><br>
-            % if g.mpuls_config.is_enabled('case-module', 'anonymize'):
-              <input type="checkbox" name="state" id="show_markanonymize" value="4" checked="checked">
-              <label for="show_markanonymize">
-                <img title="${_('Almost anonymized')}" alt="${_('Almost anonymized')}" src="${h.url_for('/images/icons/anonymise_inactive_22.png')}" height="22" width="22">${_('Almost anonymized')} (${c.count_markanon})
-              </label><br>
-              <input type="checkbox" name="state" id="show_anonymized" value="5" checked="checked">
-              <label for="show_anonymized">
-                <img title="${_('Anonymized')}" alt="${_('Anonymized')}" src="${h.url_for('/images/icons/anonymise_inactive_22.png')}" height="22" width="22">${_('Anonymized')} (${c.count_anon})
-              </label>
-            % endif
-          </td>
-          <td></td>
-        </tr>
-      % endif
-      % if g.mpuls_config.is_enabled('search', 'option-phase'):
-        <tr style="${not c.extended_search and 'display:none' or ''}">
-          <td class="label">${_('Phase')}</td>
-          <td>
-            % for n,p in enumerate(c.phases):
-              <input type="checkbox" name="phase" id="phase_${n}" value="${p.id}"> 
-                <label for="phase_${n}">
-                  ${p.getDescription()}<br>
-                </label>
-            % endfor
-          </td>
-        </tr>
-      % endif
-      % if g.mpuls_config.is_enabled('search', 'option-date'):
-      <tr style="${not c.extended_search and 'display:none' or ''}">
-        <td class="label">${_('Start date')}</td>
-        <td>
-          <input type="text" name="sdate" value="">
-        </td>
-        <td>
-          <form:error name="sdate">
-        </td>
-      </tr>
-      <tr style="${not c.extended_search and 'display:none' or ''}">
-        <td class="label">${_('End date')}</td>
-        <td>
-          <input type="text" name="edate" value="">
-        </td>
-        <td>
-          <form:error name="edate">
-        </td>
-      </tr>
-      % endif
-      % if g.case_search.supports_option("gender") and g.mpuls_config.is_enabled('search', 'option-gender'):
-        <tr style="${not c.extended_search and 'display:none' or ''}">
-          <td class="label">${_('Gender')}</td>
-          <td>
-            <select name="gender" id="gender">
-              <option value="-2">${_('All')}</option>
-              <option value="0">${_('Female')}</option>
-              <option value="1">${_('Male')}</option>
-              <option value="-1">${_('Unspecified')}</option>
-            </select>
-          </td>
-          <td>
-            <form:error name="gender">
-          </td>
-        </tr>
-      % endif
-        <%include file="/casemanagement/search_extra.mako" />
-      <tr>
-        <td class=""></td>
-        <td></td>
-        <td></td>
-      </tr>
-      <tr>
-        <td class=""></td>
-        <td colspan="2">
-          <input type="submit" value="${_('cm_form_overview_search_submit')}">
-          % if c.extended_search:
-            <a href="${h.url_for(controller='case_overview',
-                                 action='overview_extended')}">${_('Hide extended search')}</a>
-          % else:
-            <a href="${h.url_for(controller='case_overview', 
-                                 action='overview_extended')}">${_('Show extended search')}</a>
-          % endif
-          ${h.getHelp('extended_search')}
-          <a href="${h.url_for(controller='case_overview', action='overview',
-                               reset=1)}">${_('Reset search')}</a>
-        </td>
-      </tr>
-    </table>
-  </div>
-  </form>
-% endif
+</%def>
+<%def name="buildSearchReset()">
+  <a href="${h.url_for(controller='case_overview', action='overview', reset=1)}">${_('Reset search')}</a>
+</%def>
+<%def name="buildSearchExtend()">
+  % if c.extended_search:
+    <a href="${h.url_for(controller='case_overview',
+                         action='overview_extended')}">${_('Hide extended search')}</a>
+  % else:
+    <a href="${h.url_for(controller='case_overview', 
+                         action='overview_extended')}">${_('Show extended search')}</a>
+  % endif
+  ${h.getHelp('extended_search')}
+</%def>

Added: base/trunk/mpulsweb/templates/evaluation/agencylist.mako
===================================================================
--- base/trunk/mpulsweb/templates/evaluation/agencylist.mako	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/mpulsweb/templates/evaluation/agencylist.mako	2010-12-28 10:59:44 UTC (rev 4438)
@@ -0,0 +1,98 @@
+## -*- coding: utf-8 -*-
+<%!
+
+from pylons import app_globals as g
+import mpulsweb.lib.helper.filters as F
+import mpulsweb.lib.helpers as h
+from mpulsweb.lib.translation import _
+
+all_roles = ['admin', 'cm']
+
+## Fields to show in the case list.  Each entry is a tuple of the form
+##     (TITLE, FIELDNAME, STYLE, ROLES, FORMATTER)
+## Here, TITLE is the title of the field, FIELDNAME is the field name
+## used in the search URL that's built for each column, STYLE is a CSS
+## class name to use in the style attribute of the HTML TH-element,
+## ROLES is a list with the names of the roles for which the field
+## should be shown.  Finally, FORMATTER is a python callable that is
+## called with the case object as argument and which should return the
+## formatted value for the column.
+
+fields = []
+for d in g.agency.get_overview_fields():
+  f = d.name
+  fn = d.overview_label
+  fs = d.overview_style
+  field = (fn,f,fs, all_roles,
+           lambda case, d=d: h.shorten(h.format_object(case.get_value(d.name)), d.overview_length))
+  fields.append(field)
+%>
+
+<%def name="build_list_headers()">
+  % if g.mpuls_config.is_enabled('case-module', 'casebundle'):
+    <th class="table_header_h table_checkbox">&nbsp;</th>
+  % endif
+  % for title, urlpart, style, roles, get_value in fields:
+    % if h.hasRole(roles):
+      <th class="${style} table_header_h">${title}
+        <a href="${h.url_for(controller='evaluation_overview', action='overview',
+                             sort_field=urlpart, sort_order='asc')}">
+            <img class   = "sorticon"
+            %if c.sort_field == urlpart and c.sort_order == 'asc':
+                src    = "${h.url_for('/images/icons/sort_asc_active.png')}"
+                alt    = "${_("Sorted by %s in ascending order") % title}"
+                title  = "${_("Sorted by %s in ascending order") % title}"
+            %else:
+                src    = "${h.url_for('/images/icons/sort_asc.png')}"
+                alt    = "${_("Sort in ascending order")}"
+                title  = "${_("Sort in ascending order")}"
+            %endif
+                width  = "10"
+                height = "9"></a>
+        <a href="${h.url_for(controller='evaluation_overview', action='overview',
+                             sort_field=urlpart, sort_order='desc')}">
+            <img class   = "sorticon"
+            %if c.sort_field == urlpart and c.sort_order == 'desc':
+                src    = "${h.url_for('/images/icons/sort_desc_active.png')}"
+                alt    = "${_("Sorted by %s in descending order") % title}"
+                title  = "${_("Sorted by %s in descending order") % title}"
+            %else:
+                src    = "${h.url_for('/images/icons/sort_desc.png')}"
+                alt    = "${_("Sort in descending order")}"
+                title  = "${_("Sort in descending order")}"
+            %endif
+                width  = "10"
+                height = "9"></a>
+      </th>
+    % endif
+  % endfor
+</%def>
+
+<%def name="build_list_row(case)">
+  % if g.mpuls_config.is_enabled('case-module', 'casebundle'):
+    <td><input type="checkbox" name="case_id" value="${case.id}"></td>
+  % endif
+  % for title, urlpart, style, roles, get_value in fields:
+    % if h.hasRole(roles):
+      <td>${get_value(case) | F.NA}</td>
+    % endif
+  % endfor
+</%def>
+
+<table id="table_caseoverview" class="hovertable">
+  <tr>
+    ${build_list_headers()}
+  </tr>
+  % for num, case in enumerate(c.cases.getDatasets()):
+      <tr class="${num % 2 and 'table_row_h' or ''}">
+        ${build_list_row(case)}
+      </tr>
+  % endfor
+  % if len(c.cases.getDatasets()) <= 0:
+  <tr>
+    <td colspan="6">
+      ${_('cm_overview_tbl_no_data_found')}
+    </td>
+  </tr>
+  % endif
+</table>

Added: base/trunk/mpulsweb/templates/evaluation/overview.mako
===================================================================
--- base/trunk/mpulsweb/templates/evaluation/overview.mako	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/mpulsweb/templates/evaluation/overview.mako	2010-12-28 10:59:44 UTC (rev 4438)
@@ -0,0 +1,73 @@
+## -*- coding: utf-8 -*-
+<%inherit file="../main.mako" />
+<%!  import mpulsweb.lib.helper.filters as F %>
+<%def name="buildNavipath()">
+  ${parent.buildNavipath()}
+  <li><a href="${h.url_for(controller='/case_overview')}">${_('Agency overview')}</a></li>
+</%def>
+<h1>${_('Agency overview')}</h1>
+% if h.hasRole(['admin_ka']):
+ <!-- <p>${_('cm_overview_con_list_dossiers_admin')}</p>-->
+% endif
+
+% if h.hasRole(['cm_ka']):
+ <!-- <p>${_('cm_overview_con_list_dossiers_cm')}</p>-->
+%endif
+<%include file="/evaluation/search.mako" />
+${ungettext('%s agency was found.', '%s agencys where found.', c.count_all) % c.count_all}
+<div class="waska_form">
+  <form action="${h.url_for(controller='/evaluation_overview', action='bundleAction')}"
+        method="POST">
+  <%include file="./agencylist.mako" />
+  % if g.mpuls_config.is_enabled('case-module', 'casebundle'):
+  <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 agency.', 'Select all %s found agencys', c.count_all) % c.count_all}</label>
+    <input type="hidden" name="all_ids" value="">
+  </div>
+  <div class="waska_form_element w30">
+    <select name="action">
+      <option value="no_action">Keine Aktion</option>
+      % if h.hasRole(['admin']):
+        <option value="delete">Löschen</option>
+        % if g.mpuls_config.is_enabled('case-module', 'anonymize'):
+          <option value="anonymize">Anonymisieren</option>
+        % endif
+        <option value="restore">Wiederherstellen</option>
+        % if g.mpuls_config.is_enabled('case-module', 'organisation'):
+          <option value="transfer">Bearbeitung übertragen</option>
+        % endif
+      % endif
+      % if h.hasRole(['cm']):
+        <option value="markdelete">Löschen</option>
+        % if g.mpuls_config.is_enabled('case-module', 'anonymize'):
+          <option value="markanonymize">Anonymisieren</option>
+        % endif
+      % endif
+      % if h.hasRole(['admin', 'cm']):
+        % if g.mpuls_config.is_enabled('case-module', 'organisation'):
+          <option value="standin">Vertretung zuweisen</option>
+        % endif
+      % endif
+      % if g.mpuls_config.is_enabled('case-module', 'exportXLS'):
+        <option value="exportXLS">Als Excel-Tabellen exportieren</option>
+      % endif
+      % if g.mpuls_config.is_enabled('case-module', 'exportXML'):
+        <option value="exportXML">Als XML-Datei exportieren</option>
+      % endif
+      % if g.mpuls_config.is_enabled('case-module', 'exportCSV'):
+        <option value="exportCSV">Als CSV-Datei exportieren</option>
+      % endif
+      % if g.mpuls_config.is_enabled('module', 'evaluation') and not c.hide_evaluation:
+        <option value="evaluate">Auswerten</option>
+      % endif
+    </select>
+  </div>
+  <div class="waska_form_eevaluationlement w50">
+    <input type="submit" value="Aktion für Auswahl ausführen">
+  </div>
+  % endif
+  </form>
+  <br class="newline">
+</div>
+

Added: base/trunk/mpulsweb/templates/evaluation/search.mako
===================================================================
--- base/trunk/mpulsweb/templates/evaluation/search.mako	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/mpulsweb/templates/evaluation/search.mako	2010-12-28 10:59:44 UTC (rev 4438)
@@ -0,0 +1,23 @@
+## -*- coding: utf-8 -*-
+<%inherit file="/search/search.mako" />
+<%def name="buildFormHeader()">
+  <form method="post" name="case_search"
+        action="${h.url_for(controller='/evaluation_overview', action='search')}" 
+        accept-charset="UTF-8">
+</%def>
+<%def name="buildSearchReset()">
+  <a href="${h.url_for(controller='evaluation_overview', action='overview', reset=1)}">${_('Reset search')}</a>
+</%def>
+<%def name="buildSearchExtend()">
+  <a href="${h.url_for(controller='evaluation_overview', action='overview', reset=1)}">${_('Reset search')}</a>
+</%def>
+<%def name="buildSearchExtend()">
+  % if c.extended_search:
+    <a href="${h.url_for(controller='evaluation_overview',
+                         action='overview_extended')}">${_('Hide extended search')}</a>
+  % else:
+    <a href="${h.url_for(controller='evaluation_overview', 
+                         action='overview_extended')}">${_('Show extended search')}</a>
+  % endif
+  ${h.getHelp('extended_search')}
+</%def>

Modified: base/trunk/mpulsweb/templates/main.mako
===================================================================
--- base/trunk/mpulsweb/templates/main.mako	2010-12-28 10:33:11 UTC (rev 4437)
+++ base/trunk/mpulsweb/templates/main.mako	2010-12-28 10:59:44 UTC (rev 4438)
@@ -135,6 +135,18 @@
     % if g.mpuls_config.is_enabled('module', 'evaluation'):
       <div class="menu">
         <div class="actions">
+          <h1>${_('Overview')}</h1>
+            <ul>
+              <li>
+                <a href="${h.url_for(controller='/case', action='importCase')}">
+                  ${_('menu_cm_link_import')}
+                </a>
+              </li>
+            </ul>
+        </div>
+      </div>
+      <div class="menu">
+        <div class="actions">
           <h1>${_('Evaluations')}</h1>
           ${self.buildEvaluations()}
         </div>



More information about the Mpuls-commits mailing list