[Mpuls-commits] r82 - in waska/trunk: . waskaweb/config waskaweb/controllers waskaweb/model waskaweb/templates/logbook
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Aug 21 10:48:37 CEST 2008
Author: torsten
Date: 2008-08-21 10:48:36 +0200 (Thu, 21 Aug 2008)
New Revision: 82
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/config/routing.py
waska/trunk/waskaweb/controllers/case.py
waska/trunk/waskaweb/model/logbook.py
waska/trunk/waskaweb/model/repeatgroup.py
waska/trunk/waskaweb/templates/logbook/overview.mako
Log:
Added dynamic sorting
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/ChangeLog.txt 2008-08-21 08:48:36 UTC (rev 82)
@@ -5,6 +5,14 @@
* waskaweb/model/logbook.py: Prepared model for dynanmic sorting.
+ Added dynamic sorting of logbook
+
+ * waskaweb/model/logbook.py,
+ waskaweb/model/repeatgroup.py,
+ waskaweb/config/routing.py,
+ waskaweb/controllers/case.py,
+ waskaweb/templates/logbook/overview.mako: Added dynamic sorting
+
2008-08-18 Sascha L. Teichmann <sascha.teichmann at intevation.de>
* waskaweb/public/images/icons/required_12x12.png,
Modified: waska/trunk/waskaweb/config/routing.py
===================================================================
--- waska/trunk/waskaweb/config/routing.py 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/waskaweb/config/routing.py 2008-08-21 08:48:36 UTC (rev 82)
@@ -40,6 +40,7 @@
map.connect('error/:action/:id', controller='error')
# CUSTOM ROUTES HERE
+ # TAKE CARE OF ORDER HERE!!! FIRST RULE THAT MATCH WILL BE USED!
map.connect('', controller='waska', action='index')
map.connect('document/caseDelete/:id/:case/:confirmed', action="caseDelete", controller="document")
map.connect('rg_aid/delete/:rg_id/:ds_type/:confirmed', action="delete", controller="rg_aid")
@@ -57,6 +58,7 @@
map.connect('case/anonymize/:id/:confirmed', controller="case", action="anonymize")
map.connect('case/markForAnonymize/:id/:confirmed', controller="case", action="markForAnonymize")
map.connect('case/markForAnonymizeFromOverview/:id/:confirmed', controller="case", action="markForAnonymizeFromOverview")
+ map.connect('case/logbook/:id/:sort_field/:sort_order', controller="case", action="logbook") #sorting of logbookentries
map.connect('case/:action/:ds_id/:page_id/:form', controller="case")
map.connect('case/:action/:ds_id/:page_id', controller="case")
map.connect('navigation/:action/:ds_id/:page_id', controller="navigation")
@@ -65,6 +67,7 @@
map.connect('formhelp', 'case/showhelp/:help_id', controller="case", action="showHelp")
map.connect('required', 'case/required/:help_id', controller="case", action="showRequired")
map.connect('digest', 'case/digest/:id', controller="case", action="digest")
+ map.connect('case/logbook/:id/:sort_field/:sort_order', controller="case", action="logbook", sort_field='datum', sort_order='desc') #sorting of logbookentries
map.connect('case_overview/overview/:reset/:sort_field/:sort_order', controller="case_overview", action="overview", reset=0, sort_field="name_1", sort_order="asc") #for bundles actions in case_overview
map.connect('case_overview/:action/:confirmed', controller="case_overview") #for bundles actions in case_overview
map.connect('agency_overview/overview/:reset/:sort_field/:sort_order', controller="agency_overview", action="overview", reset=0, sort_field="fkz", sort_order="asc") #for bundles actions in agency_overview
Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/waskaweb/controllers/case.py 2008-08-21 08:48:36 UTC (rev 82)
@@ -644,13 +644,13 @@
return render('/casemanagement/appointments.mako')
@checkRole(('admin_ka', 'cm_ka'))
- def logbook(self, id):
+ def logbook(self, id, sort_field='datum', sort_order='desc'):
id = self._checkInt(id)
case = self._loadCase(id)
c.ds_id = id
c.form_navigation = self._getFormNavigation()
logbook = Logbook()
- logbook.loadById(id)
+ logbook.loadById(id, sort_field, sort_order)
c.logbook = logbook
# Evaluation
Modified: waska/trunk/waskaweb/model/logbook.py
===================================================================
--- waska/trunk/waskaweb/model/logbook.py 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/waskaweb/model/logbook.py 2008-08-21 08:48:36 UTC (rev 82)
@@ -65,6 +65,7 @@
'avg_cat4': u'Keine Angabe',
'avg_all': u'Gesamt' }
+ALLOWED_SORTING = ['nachname', 'vorname', 'art', 'dauer', 'datum', 'asc', 'desc']
LOAD_LOGBOOK = """
SELECT l.id AS id, datum, b.vorname AS vorname, b.nachname AS nachname, art, kurz_notiz, notiz, dauer
FROM ka_logbuch_tbl_view l LEFT JOIN ka_benutzer_tbl_view b
@@ -253,7 +254,7 @@
finally:
db.recycleConnection(conn, cur)
- def loadById(self, mid, sort_field = 'datum', sort_order='desc'):
+ def loadById(self, mid, sort_field = 'datum', sort_order = 'desc'):
self.mid = mid
self.sort_field = sort_field
self.sort_order = sort_order
@@ -264,6 +265,9 @@
try:
# Removed prepared statement as quoting does not work for sorting e.g
# cur.execute(LOAD_LOGBOOK, {'mid': mid, 'field': sort_field, 'order': sort_order})
+ if sort_field not in ALLOWED_SORTING or sort_order not in ALLOWED_SORTING:
+ sort_field = 'datum'
+ sort_order = 'desc'
cur.execute(LOAD_LOGBOOK % (mid, sort_field, sort_order))
except:
print cur.query
Modified: waska/trunk/waskaweb/model/repeatgroup.py
===================================================================
--- waska/trunk/waskaweb/model/repeatgroup.py 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/waskaweb/model/repeatgroup.py 2008-08-21 08:48:36 UTC (rev 82)
@@ -26,13 +26,13 @@
DELETE_RG_QUALI_DS = """select delete_rg_quali_ds(%(id)s)"""
DELETE_RG_BERUF_DS = """select delete_rg_beruf_ds(%(id)s)"""
-LOAD_RG_BILDEN_DS = """SELECT id, angebotsform as form, art_der_unterstuetzung as type, durchfuehrende_institution as institute, unterstuetzung_start as start, unterstuetzung_ende as end, zielsetzung FROM rg_angebote_bildenden_bereich_tbl_view WHERE id = %s"""
+LOAD_RG_BILDEN_DS = """SELECT id, angebotsform as form, art_der_unterstuetzung as type, durchfuehrende_institution as institute, unterstuetzung_start as start, unterstuetzung_ende as end, zielsetzungangebot FROM rg_angebote_bildenden_bereich_tbl_view WHERE id = %s"""
-LOAD_RG_BERUF_DS = """SELECT r.id, r.angebotsform_1 as form, t.value as type, r.durchfuehrende_institution_1 as institute, r.unterstuetzung_start_1 as start, r.unterstuetzung_ende_1 as end, zielsetzung FROM rg_angebote_berufsvorbereitung_tbl_view r JOIN art_der_unterstuetzung_1_tbl t ON r.art_der_unterstuetzung_1 = t.id WHERE r.id = %s"""
+LOAD_RG_BERUF_DS = """SELECT r.id, r.angebotsform_1 as form, t.value as type, r.durchfuehrende_institution_1 as institute, r.unterstuetzung_start_1 as start, r.unterstuetzung_ende_1 as end, zielsetzungangebot FROM rg_angebote_berufsvorbereitung_tbl_view r JOIN art_der_unterstuetzung_1_tbl t ON r.art_der_unterstuetzung_1 = t.id WHERE r.id = %s"""
-LOAD_RG_QUALI_DS = """SELECT r.id, angebotsform_2 as form, t.value as type, durchfuehrende_institution_2 as institute, unterstuetzung_start_2 as start, unterstuetzung_ende_2 as end, zielsetzung FROM rg_angebote_berufliche_qualifizierung_tbl_view r JOIN angebote_im_bereich_tbl t on r.angebote_im_bereich = t.id WHERE r.id = %s"""
+LOAD_RG_QUALI_DS = """SELECT r.id, angebotsform_2 as form, t.value as type, durchfuehrende_institution_2 as institute, unterstuetzung_start_2 as start, unterstuetzung_ende_2 as end, zielsetzungangebot FROM rg_angebote_berufliche_qualifizierung_tbl_view r JOIN angebote_im_bereich_tbl t on r.angebote_im_bereich = t.id WHERE r.id = %s"""
-LOAD_RG_LEBEN_DS = """SELECT r.id, angebotsform_3 as form, t.value as type, durchfuehrende_institution_3 as institute, unterstuetzung_start_3 as start, unterstuetzung_ende_3 as end, zielsetzung FROM rg_angebote_lebensbewaeltigung_tbl_view r JOIN art_der_unterstuetzung_2_tbl t ON r.art_der_unterstuetzung_2 = t.id WHERE r.id = %s"""
+LOAD_RG_LEBEN_DS = """SELECT r.id, angebotsform_3 as form, t.value as type, durchfuehrende_institution_3 as institute, unterstuetzung_start_3 as start, unterstuetzung_ende_3 as end, zielsetzungangebot FROM rg_angebote_lebensbewaeltigung_tbl_view r JOIN art_der_unterstuetzung_2_tbl t ON r.art_der_unterstuetzung_2 = t.id WHERE r.id = %s"""
RG_BILDEN_DB_TBL = "rg_angebote_bildenden_bereich_tbl_view"
RG_BERUF_DB_TBL = "rg_angebote_berufsvorbereitung_tbl_view"
Modified: waska/trunk/waskaweb/templates/logbook/overview.mako
===================================================================
--- waska/trunk/waskaweb/templates/logbook/overview.mako 2008-08-21 06:21:27 UTC (rev 81)
+++ waska/trunk/waskaweb/templates/logbook/overview.mako 2008-08-21 08:48:36 UTC (rev 82)
@@ -23,10 +23,22 @@
</div>
<table class="appointment">
<tr>
- <th class="date table_header_h">Datum/Uhrzeit</th>
- <th class="title table_header_h">Bearbeiter</th>
- <th class="title table_header_h">Art</th>
- <th class="title table_header_h">Dauer in Minuten</th>
+ <th class="date table_header_h">Datum
+ <a href="/case/logbook/${session.get('case').id}/datum/asc"><img class="sorticon" src="/images/icons/sort_asc.png"></a>
+ <a href="/case/logbook/${session.get('case').id}/datum/desc"><img class="sorticon" src="/images/icons/sort_desc.png"></a>
+ </th>
+ <th class="title table_header_h">Bearbeiter
+ <a href="/case/logbook/${session.get('case').id}/nachname/asc"><img class="sorticon" src="/images/icons/sort_asc.png"></a>
+ <a href="/case/logbook/${session.get('case').id}/nachname/desc"><img class="sorticon" src="/images/icons/sort_desc.png"></a>
+ </th>
+ <th class="title table_header_h">Art
+ <a href="/case/logbook/${session.get('case').id}/art/asc"><img class="sorticon" src="/images/icons/sort_asc.png"></a>
+ <a href="/case/logbook/${session.get('case').id}/art/desc"><img class="sorticon" src="/images/icons/sort_desc.png"></a>
+ </th>
+ <th class="title table_header_h">Dauer (min)
+ <a href="/case/logbook/${session.get('case').id}/dauer/asc"><img class="sorticon" src="/images/icons/sort_asc.png"></a>
+ <a href="/case/logbook/${session.get('case').id}/dauer/desc"><img class="sorticon" src="/images/icons/sort_desc.png"></a>
+ </th>
<th class="action table_header_h">${_('app_overview_tbl_header_actions')}</th>
</tr>
% if c.logbook.hasEntries():
More information about the Mpuls-commits
mailing list