[Mpuls-commits] r830 - in wasko/branches/2.0: . waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 22 12:52:36 CET 2010


Author: bh
Date: 2010-01-22 12:52:32 +0100 (Fri, 22 Jan 2010)
New Revision: 830

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako
Log:
* waskaweb/templates/casemanagement/caselist.mako: Move status
icons and per-case actions into their own functions.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-01-22 11:26:26 UTC (rev 829)
+++ wasko/branches/2.0/ChangeLog	2010-01-22 11:52:32 UTC (rev 830)
@@ -1,5 +1,10 @@
 2010-01-22  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/templates/casemanagement/caselist.mako: Move status
+	icons and per-case actions into their own functions.
+
+2010-01-22  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/templates/casemanagement/caselist.mako: Better way to
 	handle alternating table row styles.  Reduces code duplication.
 

Modified: wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako
===================================================================
--- wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako	2010-01-22 11:26:26 UTC (rev 829)
+++ wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako	2010-01-22 11:52:32 UTC (rev 830)
@@ -1,5 +1,6 @@
 ## -*- coding: utf-8 -*-
 <%! import waskaweb.lib.filters as F %>
+
 <%def name="build_list_headers()">
   <th class="table_header_h table_checkbox">&nbsp;</th>
   <th class="table_id table_header_h">${_('cm_overview_tbl_header_id')}
@@ -29,6 +30,75 @@
   <th class="table_action table_header_h">${_('cm_overview_tbl_header_actions')}</th>
 </%def>
 
+<%def name="get_state_icon(case)">
+  % if h.hasRole(['cm_ka']):
+    % if str(case.getEditor().id) == str(session.get('USER_AUTHORIZED').id):
+      <img src="/images/icons/editor_grey.gif" border="0"
+           alt="${_('cm_overview_img_editor')}" 
+           title="${_('cm_overview_img_editor')}">
+    % else:
+      <img src="/images/icons/stand-in_grey.gif" border="0"
+           alt="${_('cm_overview_img_standin')}" 
+           title="${_('cm_overview_img_standin')}">
+    % endif
+  % endif
+  % if case.getState().getState() in (1,2):
+    <img src="/images/icons/work_in_progress_grey.gif" border="0" 
+         alt="${_('case_state_label_open')}" 
+         title="${_('case_state_label_open')}">
+  % elif case.getState().getState() == 3:
+    <img src="/images/icons/delete_grey.gif" border="0"
+         alt="${_('case_state_label_delete')}" 
+         title="${_('case_state_label_delete')}">
+  % elif case.getState().getState() == 4:
+    <img src="/images/icons/anonym.gif" border="0"
+         alt="${_('case_state_label_markanonym')}" 
+         title="${_('case_state_label_markanonym')}">
+  % elif case.getState().getState() == 5:
+    <img src="/images/icons/anonym.gif" border="0"
+         alt="${_('case_state_label_anonym')}" 
+         title="${_('case_state_label_anonym')}">
+  % endif
+</%def>
+
+<%def name="get_actions(case)">
+  % if case.getState().getState() != 5:
+    <a href="/case/select/${case.id}/0/">
+      <img src="/images/icons/view_red.gif" border="0"
+           alt="${_('cm_overview_a_show')}" 
+           title="${_('cm_overview_a_show')}"></a>
+  % endif
+  % if h.hasRole(['admin_ka']):
+    % if case.getState().getState() in (3, 5):
+      <a href="/case/delete/${case.id}/0/">
+        <img src="/images/icons/delete_red.gif" border="0"
+             alt="${_('cm_overview_a_delete')}" 
+             title="${_('cm_overview_a_delete')}"></a>
+    % endif
+    % if case.getState().getState() == 4:
+      <a href="/case/anonymize/${case.id}/0/">
+        <img src="/images/icons/anonym_red.gif" border="0"
+             alt="${_('cm_overview_a_anonymize')}" 
+             title="${_('cm_overview_a_anonymize')}"></a>
+    % endif
+    % if case.getState().getState() in (3, 4):
+      <a href="/case/restore/${case.id}/0/">
+        <img src="/images/icons/recover_red.gif" border="0"
+             alt="${_('cm_overview_a_restore')}" 
+             title="${_('cm_overview_a_restore')}"></a>
+    % endif
+  % elif h.hasRole(['cm_ka']) and case.getState().getState() in (1, 2):
+    <a href="/case/markForAnonymizeFromOverview/${case.id}/0/">
+      <img src="/images/icons/anonym_red.gif" border="0"
+           alt="${_('cm_overview_a_anonymize')}" 
+           title="${_('cm_overview_a_anonymize')}"></a> 
+    <a href="/case/markForDelete/${case.id}/0/">
+      <img src="/images/icons/delete_red.gif" border="0" 
+           alt="${_('cm_overview_a_delete')}" 
+           title="${_('cm_overview_a_delete')}"></a>
+  % endif
+</%def>
+
 <table>
   <tr>
     ${build_list_headers()}
@@ -55,41 +125,10 @@
           <td>${case.state.getAccessTime('%d.%m.%Y') | F.NA, h}</td>
         % endif
         <td>
-          % if h.hasRole(['cm_ka']):
-            % if str(case.getEditor().id) == str(session.get('USER_AUTHORIZED').id):
-              <img src="/images/icons/editor_grey.gif" border="0" alt="${_('cm_overview_img_editor')}" title="${_('cm_overview_img_editor')}">
-            % else:
-              <img src="/images/icons/stand-in_grey.gif" border="0" alt="${_('cm_overview_img_standin')}" title="${_('cm_overview_img_standin')}">
-            % endif
-          % endif 
-          % if case.getState().getState() in (1,2):
-            <img src="/images/icons/work_in_progress_grey.gif" border="0" alt="${_('case_state_label_open')}" title="${_('case_state_label_open')}">
-          % elif case.getState().getState() == 3:
-            <img src="/images/icons/delete_grey.gif" border="0" alt="${_('case_state_label_delete')}" title="${_('case_state_label_delete')}">
-          % elif case.getState().getState() == 4:
-            <img src="/images/icons/anonym.gif" border="0" alt="${_('case_state_label_markanonym')}" title="${_('case_state_label_markanonym')}">
-          % elif case.getState().getState() == 5:
-            <img src="/images/icons/anonym.gif" border="0" alt="${_('case_state_label_anonym')}" title="${_('case_state_label_anonym')}">
-          % endif
+          ${get_state_icon(case)}
         </td>
         <td>
-          % if case.getState().getState() != 5:
-            <a href="/case/select/${case.id}/0/"><img src="/images/icons/view_red.gif" border="0" alt="${_('cm_overview_a_show')}" title="${_('cm_overview_a_show')}"></a>
-          % endif
-          % if h.hasRole(['admin_ka']):
-            % if case.getState().getState() in (3,5):
-              <a href="/case/delete/${case.id}/0/"><img src="/images/icons/delete_red.gif" border="0" alt="${_('cm_overview_a_delete')}" title="${_('cm_overview_a_delete')}"></a>
-            % endif
-            % if case.getState().getState() == 4:
-              <a href="/case/anonymize/${case.id}/0/"><img src="/images/icons/anonym_red.gif" border="0" alt="${_('cm_overview_a_anonymize')}" title="${_('cm_overview_a_anonymize')}"></a>
-            % endif
-            % if case.getState().getState() in (3,4):
-              <a href="/case/restore/${case.id}/0/"><img src="/images/icons/recover_red.gif" border="0" alt="${_('cm_overview_a_restore')}" title="${_('cm_overview_a_restore')}"></a>
-            % endif
-          % elif h.hasRole(['cm_ka']) and case.getState().getState() in (1,2):
-            <a href="/case/markForAnonymizeFromOverview/${case.id}/0/"><img src="/images/icons/anonym_red.gif" border="0" alt="${_('cm_overview_a_anonymize')}" title="${_('cm_overview_a_anonymize')}"></a> 
-            <a href="/case/markForDelete/${case.id}/0/"><img src="/images/icons/delete_red.gif" border="0" alt="${_('cm_overview_a_delete')}" title="${_('cm_overview_a_delete')}"></a> 
-          % endif
+          ${get_actions(case)}
         </td>
       </tr>
   % endfor



More information about the Mpuls-commits mailing list