[Mpuls-commits] r157 - in waska/trunk: . waskaweb/controllers waskaweb/lib waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 12 16:53:19 CEST 2008


Author: teichmann
Date: 2008-09-12 16:53:16 +0200 (Fri, 12 Sep 2008)
New Revision: 157

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/case_overview.py
   waska/trunk/waskaweb/lib/csv.py
   waska/trunk/waskaweb/templates/casemanagement/downloadCSV.mako
Log:
Added GUI support for selective CV export. TODO: Support evaluation server, too.



Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-12 10:33:43 UTC (rev 156)
+++ waska/trunk/ChangeLog.txt	2008-09-12 14:53:16 UTC (rev 157)
@@ -1,3 +1,14 @@
+2008-09-12  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
+	Added GUI support for selective CV export. TODO: Support evaluation server, too.
+
+	* waskaweb/lib/csv.py: Fixed bug if not exporting 'unterstuetzungsangebote'
+
+	* waskaweb/controllers/case_overview.py: Add routing thru selection template.
+
+	* waskaweb/templates/casemanagement/downloadCSV.mako: Added link to select
+	  case parts.
+
 2008-09-12	Torsten Irlaender  <torsten.irlaender at intevation.de>
 
 	Added new search option for cases after a current date

Modified: waska/trunk/waskaweb/controllers/case_overview.py
===================================================================
--- waska/trunk/waskaweb/controllers/case_overview.py	2008-09-12 10:33:43 UTC (rev 156)
+++ waska/trunk/waskaweb/controllers/case_overview.py	2008-09-12 14:53:16 UTC (rev 157)
@@ -713,10 +713,37 @@
 
     @checkRole(('cm_ka', 'admin_ka'))
     def downloadCSV(self):
-        c.download_link = h.url_for(action="downloadCSVAction")
-        c.overview_link = h.url_for(action="overview")
+        selection_checker = self.__getSelectionChecker()
+        c.is_all_selected = selection_checker.isAllSelected()
+        c.download_link   = h.url_for(action="downloadCSVAction")
+        c.selection_link  = h.url_for(action="selectCSVParts")
+        c.overview_link   = h.url_for(action="overview")
         return render('casemanagement/downloadCSV.mako')
 
+    @checkRole(('cm_ka', 'admin_ka'))
+    def selectCSVParts(self):
+        selection_checker  = self.__getSelectionChecker()
+        c.selection_question = SELECT_PARTS_FOR_EXPORT
+        c.store_action       = h.url_for(action="storeSelectedCSVParts")
+        c.back_url           = h.url_for(controller='/case_overview', action='exportCSV', confirmed=1)
+        c.back_title         = "CSV Export"
+        page = render('casemanagement/selectParts.mako')
+        return formencode.htmlfill.render(unicode(page, 'utf-8'),defaults=selection_checker.selections)
+
+    @checkRole(('cm_ka', 'admin_ka'))
+    def storeSelectedCSVParts(self):
+        validator = CasePartSelectionForm()
+        selection_checker = self.__getSelectionChecker()
+        try:
+            params = validator.to_python(request.params)
+            for key, value in params.iteritems():
+                selection_checker.setChecked(key, value)
+            session['selected_export_parts'] = selection_checker
+            session.save()
+        except formencode.Invalid, error:
+            return selectCSVParts()
+        return self.exportCSV(1)
+
     def __getSelectionChecker(self):
         selection_checker = session.get('selected_export_parts')
         if not selection_checker:

Modified: waska/trunk/waskaweb/lib/csv.py
===================================================================
--- waska/trunk/waskaweb/lib/csv.py	2008-09-12 10:33:43 UTC (rev 156)
+++ waska/trunk/waskaweb/lib/csv.py	2008-09-12 14:53:16 UTC (rev 157)
@@ -119,8 +119,12 @@
 
             headers, used_indices = None, None
 
-            cur.execute(selector.getSelectStatementByView(view))
+            stmnt = selector.getSelectStatementByView(view)
 
+            if not stmnt: continue
+
+            cur.execute(stmnt)
+
             while True:
                 row = cur.fetchone()
                 if not row: break

Modified: waska/trunk/waskaweb/templates/casemanagement/downloadCSV.mako
===================================================================
--- waska/trunk/waskaweb/templates/casemanagement/downloadCSV.mako	2008-09-12 10:33:43 UTC (rev 156)
+++ waska/trunk/waskaweb/templates/casemanagement/downloadCSV.mako	2008-09-12 14:53:16 UTC (rev 157)
@@ -18,31 +18,54 @@
 </div>
 
 %if not c.isEvaluationServer:
-<div class="import_p">
+
+
+<p class="import_p">
 Bitte beachten Sie, dass Sie ggf. personenbezogene Daten exportieren,
 wenn Sie diese nicht mit dem Haken 'Daten anoymisiert exportieren' exportieren.
 Ihnen obliegt somit die Einhaltung der jeweiligen Datenschutzbestimmungen.
-</div>
+</p>
 
 <div class="import_box_dialog">
 
+    <p class="import_p">
+        <strong class="import_number">1.</strong> Aktenbereiche ausw&auml;hlen:<br>
+    <span class="note">
+    % if c.is_all_selected:
+        Zur Zeit sind alle Bereiche ausgewählt.
+    % else:
+        Zur Zeit sind nur Teilbereiche ausgewählt.
+    % endif
+    </span>
+    <a class="button import" href="${c.selection_link}">Ausw&auml;hlen</a></p>
+
     <form method="GET" action="${c.download_link}" accept-charset="UTF-8">
-        <p class="export_p"><label for="anonymize"><strong class="import_number">1.</strong> <input id="anonymize" name="anonymize" type="checkbox" value="1" checked>
+        <p><label for="anonymize"><strong class="import_number">2.</strong> <input id="anonymize" name="anonymize" type="checkbox" value="1" checked>
         Daten anonymisiert exportieren.</label></p>
-        <p class="export_p"><strong class="import_number">2. </strong> CSV-Datei herunterladen:
+        <p class="import_p"><strong class="import_number">3. </strong> CSV-Datei herunterladen:
         <input type="submit" id="button" value="Herunterladen"></p>
     </form>
-
-    <p class="export_p"><strong class="import_number">3.</strong> Zur Übersicht zurückkehren:
-    <a class="button export" href="${c.overview_link}">Übersicht</a></p>
+    <p class="import_p"><strong class="export_number">4.</strong> Zur Übersicht zurückkehren:
+    <a class="button import" href="${c.overview_link}">Übersicht</a></p>
 </div>
 %else:
 <div class="import_box_dialog">
 
-    <p class="export_p"><strong class="import_number">1. </strong> CSV-Datei herunterladen:
-    <a class="button export" href="${c.download_link}">Herunterladen</a></p>
+    <p class="import_p">
+        <strong class="import_number">1.</strong> Aktenbereiche ausw&auml;hlen:<br>
+    <span class="note">
+    % if c.is_all_selected:
+        Zur Zeit sind alle Bereiche ausgewählt.
+    % else:
+        Zur Zeit sind nur Teilbereiche ausgewählt.
+    % endif
+    </span>
+    <a class="button import" href="${c.selection_link}">Ausw&auml;hlen</a></p>
 
-    <p class="export_p"><strong class="import_number">2.</strong> Zur Übersicht zurückkehren:
-    <a class="button export" href="${c.overview_link}">Übersicht</a></p>
+    <p class="import_p"><strong class="import_number">2. </strong> CSV-Datei herunterladen:
+    <a class="button import" href="${c.download_link}">Herunterladen</a></p>
+
+    <p class="import_p"><strong class="import_number">3.</strong> Zur Übersicht zurückkehren:
+    <a class="button import" href="${c.overview_link}">Übersicht</a></p>
 </div>
 %endif



More information about the Mpuls-commits mailing list