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

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


Author: bh
Date: 2010-01-22 12:26:26 +0100 (Fri, 22 Jan 2010)
New Revision: 829

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako
Log:
* waskaweb/templates/casemanagement/caselist.mako: Better way to
handle alternating table row styles.  Reduces code duplication.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-01-22 11:18:42 UTC (rev 828)
+++ wasko/branches/2.0/ChangeLog	2010-01-22 11:26:26 UTC (rev 829)
@@ -1,5 +1,10 @@
 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.
+
+2010-01-22  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/templates/casemanagement/caselist.mako: Move the code
 	for the table headers into a separate function.
 

Modified: wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako
===================================================================
--- wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako	2010-01-22 11:18:42 UTC (rev 828)
+++ wasko/branches/2.0/waskaweb/templates/casemanagement/caselist.mako	2010-01-22 11:26:26 UTC (rev 829)
@@ -33,10 +33,8 @@
   <tr>
     ${build_list_headers()}
   </tr>
-  <% idset = True %>
-  % for case in c.cases.getDatasets():
-    % if idset:
-      <tr>
+  % for num, case in enumerate(c.cases.getDatasets()):
+      <tr class="${num % 2 and 'table_row_h' or ''}">
         <td><input type="checkbox" name="case_id" value="${case.id}"></td>
         ## If the case is marked for anonymisation do not show the
         ## first and lastname and the customer number.
@@ -94,67 +92,6 @@
           % endif
         </td>
       </tr>
-    % else:
-      <tr>
-        <td class="table_row_h"><input type="checkbox" name="case_id" value="${case.id}"></td>
-        ## If the case is marked for anonymisation do not show the
-        ## first and lastname and the customer number.
-        % if case.getState().getState() == 4 and h.hasRole(['cm_ka']):
-          <td class="table_row_h">${h.getCaseShort('', 15) | F.NA, h}</td>
-          <td class="table_row_h">${h.getCaseShort('', 15) | F.NA, h}</td>
-          <td class="table_row_h">${h.getCaseShort('', 15) | F.NA, h}</td>
-        % else:
-          <td class="table_row_h">${case.knr       | F.NA, h}</td>
-          <td class="table_row_h">${h.getCaseShort(case.last_name, 15) | F.NA, h}</td>
-          <td class="table_row_h">${h.getCaseShort(case.first_name, 15) | F.NA, h}</td>
-        % endif
-        % if h.hasRole(['admin_ka']):
-          <td class="table_row_h">
-            ${case.getEditor().last_name | F.NA, h}, ${case.getEditor().first_name[0] | F.NA, h}.
-          </td>
-        % else:
-          <td class="table_row_h">${case.state.getAccessTime('%d.%m.%Y') | F.NA, h}</td>
-        % endif
-        <td class="table_row_h">
-          % 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
-        </td>
-        <td class="table_row_h">
-          % 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
-        </td>
-      </tr>
-    % endif
-    <% idset = not idset %>
   % endfor
   % if len(c.cases.getDatasets()) <= 0:
   <tr>



More information about the Mpuls-commits mailing list