[Mpuls-commits] r589 - in waska/trunk: . waskaweb/controllers waskaweb/templates/casemanagement waskaweb/templates/dialogs

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 4 11:05:17 CEST 2009


Author: frank
Date: 2009-09-04 11:05:16 +0200 (Fri, 04 Sep 2009)
New Revision: 589

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/case.py
   waska/trunk/waskaweb/controllers/case_overview.py
   waska/trunk/waskaweb/templates/casemanagement/caselist.mako
   waska/trunk/waskaweb/templates/casemanagement/main.mako
   waska/trunk/waskaweb/templates/dialogs/failed.mako
Log:
Introduce stronger constraints for pending anonymiziation cases: 
Only consistent cases with finished phase can be anonymized.


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/ChangeLog.txt	2009-09-04 09:05:16 UTC (rev 589)
@@ -1,5 +1,28 @@
 2009-08-26	Frank Koormann <frank.koormann at intevation.de>
+	
+	Introduce stronger constraints for pending anonymiziation cases:
+	Only consistent cases with finished phase can be anonymized.
 
+	* waskaweb/controllers/case_overview.py 
+	(CaseOverviewController.bundleAction): Check inconsistancies before 
+	anonymizing.
+	
+	* waskaweb/controllers/case.py (CaseController.anonymize):
+	Added full consistancy check before asking for confirmation.
+
+	* waskaweb/templates/dialogs/failed.mako: Removed call of "h", since it
+	caused encoding corruption of messages.
+
+	Further improvements:
+
+	* waskaweb/templates/casemanagement/main.mako:
+	Limit logbook link to cm_ka.
+
+	* waskaweb/templates/casemanagement/caselist.mako:
+	Enable "show" for pending anonymization cases.
+
+2009-08-26	Frank Koormann <frank.koormann at intevation.de>
+
 	Release 1.5.4
 
 	* waskaweb/i18n/de/LC_MESSAGES/waskaweb.po: Changed Version string

Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/waskaweb/controllers/case.py	2009-09-04 09:05:16 UTC (rev 589)
@@ -1320,8 +1320,20 @@
         confirmed = self._checkBool(confirmed)
         c.ds_id   = id
         #c.form_navigation = self._getFormNavigation()
+        # Check if the case is in a consistent state (all required fields
+        # are filled)
+        case = self._loadCase(id)
+        if (not case.getState().phasesAreConsistent() or not case.getState().phasesAreCompleted()) and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
+            c.failed_for  = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED 
+            if case.getState().getPhase() in (CLEAR_START, CLEAR_ENDE):
+                c.failed_text = \
+                            MARKANONYMIZE_CLEARING_PHASE_FAILED_TEXT
+            else:    
+                c.failed_text = \
+                            MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
+            c.url_ok            = "/case/digest/%s" % id
+            return render('/casemanagement/dialogs/failed_anonymize.mako')
         if confirmed == 1:
-            case = self._loadCase(id)
             if case.anonymize():
                 c.success_for   =  ANONYMIZE_SUCCESS
                 c.success_text  =  ANONYMIZE_SUCCESS_TEXT

Modified: waska/trunk/waskaweb/controllers/case_overview.py
===================================================================
--- waska/trunk/waskaweb/controllers/case_overview.py	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/waskaweb/controllers/case_overview.py	2009-09-04 09:05:16 UTC (rev 589)
@@ -374,7 +374,7 @@
 
             if action == 'anonymize':
                 # Filter out cases which aren't marked for anonymization (4)
-                case_bundle = self._filterBundle(case_bundle, [4])
+                case_bundle = self._filterBundle(case_bundle, [4], filter_inconsistent=True)
                 if case_bundle.isEmpty(): return self._emptyListError()
                 session['casebundle'] = case_bundle
                 session.save()
@@ -469,7 +469,7 @@
         return self.overview()
 
     def _filterBundle(self, case_bundle, allowedstates, filtered_cases=None, filter_inconsistent=False):
-        '''Returns a filtered CaseBundle. kiltering can be done on states and on inconsistent cases (not all required fields are filled for current phase)'''
+        '''Returns a filtered CaseBundle. Filtering can be done on states and on inconsistent cases (not all required fields are filled for current phase)'''
         filtered = []
         for case in case_bundle.getCases(filtered_cases):
             state = case.getState()

Modified: waska/trunk/waskaweb/templates/casemanagement/caselist.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/caselist.mako	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/waskaweb/templates/casemanagement/caselist.mako	2009-09-04 09:05:16 UTC (rev 589)
@@ -71,7 +71,7 @@
           % endif
         </td>
         <td>
-          % if case.getState().getState() not in (4,5):
+          % 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']):
@@ -130,7 +130,7 @@
           % endif
         </td>
         <td class="table_row_h">
-          % if case.getState().getState() not in (4,5):
+          % 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']):

Modified: waska/trunk/waskaweb/templates/casemanagement/main.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/main.mako	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/waskaweb/templates/casemanagement/main.mako	2009-09-04 09:05:16 UTC (rev 589)
@@ -73,7 +73,9 @@
         <li><a href="/case/phase/${session.get('case').id}" onclick="return checkModification();"> ${_('case_cm_phase')}</a></li>
         <li><a href="/case/organisation/${session.get('case').id}" onclick="return checkModification();"> ${_('cm_menu_link_organisation')}</a></li>
         <li><a href="/case/appointments/${session.get('case').id}" onclick="return checkModification();"> ${_('cm_menu_link_appointment')}</a></li>
-        <li><a href="/case/logbook/${session.get('case').id}" onclick="return checkModification();"> Tagebuch</a></li>
+        % if  h.hasRole(['cm_ka']):
+            <li><a href="/case/logbook/${session.get('case').id}" onclick="return checkModification();"> Tagebuch</a></li>
+        % endif
         <li><a href="/case/documents/${session.get('case').id}" onclick="return checkModification();"> ${_('cm_menu_link_documents')}</a></li>
         % endif
       </ul>

Modified: waska/trunk/waskaweb/templates/dialogs/failed.mako
===================================================================
--- waska/trunk/waskaweb/templates/dialogs/failed.mako	2009-08-26 16:05:45 UTC (rev 588)
+++ waska/trunk/waskaweb/templates/dialogs/failed.mako	2009-09-04 09:05:16 UTC (rev 589)
@@ -1,7 +1,7 @@
 ## -*- coding: utf-8 -*-
 <%!  import waskaweb.lib.filters as F %>
 <div class="dialog" />
-<h1><img src="/images/failure.png" alt="Erledigt"/>${c.failed_for | F.NA, h}</h1>
-<p>${c.failed_text | F.NA, h}</p>
+<h1><img src="/images/failure.png" alt="Fehler"/>${c.failed_for | F.NA, h}</h1>
+<p>${c.failed_text | F.NA}</p>
 <a class="button" href="${c.url_ok}">${_('dialog_header_confirm_option_ok')}</a>
 </div>



More information about the Mpuls-commits mailing list