[Mpuls-commits] r1670 - in waska/trunk: . waskaweb/controllers waskaweb/lib waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Feb 19 15:20:54 CET 2010
Author: roland
Date: 2010-02-19 15:20:52 +0100 (Fri, 19 Feb 2010)
New Revision: 1670
Modified:
waska/trunk/ChangeLog
waska/trunk/waskaweb/controllers/case.py
waska/trunk/waskaweb/lib/renderer.py
waska/trunk/waskaweb/model/agencysettings.py
Log:
prototype of evaluation logic
Modified: waska/trunk/ChangeLog
===================================================================
--- waska/trunk/ChangeLog 2010-02-19 13:53:52 UTC (rev 1669)
+++ waska/trunk/ChangeLog 2010-02-19 14:20:52 UTC (rev 1670)
@@ -1,3 +1,13 @@
+2010-02-19 Roland Geider <roland.geider at intevation.de>
+
+ First prototype of extension 2010-01 (Evaluations).
+
+ * waskaweb/controllers/case.py (save): Added field logic for
+ evaluation and evaluation number
+ * waskaweb/model/agencysettings.py (getEvaluationId): Added getter
+ for the evaluationID field
+
+
2010-02-18 Frank Koormann <frank.koormann at intevation.de>
Display "Teilnahme Evaluation" as radio group instead of choice list.
Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py 2010-02-19 13:53:52 UTC (rev 1669)
+++ waska/trunk/waskaweb/controllers/case.py 2010-02-19 14:20:52 UTC (rev 1670)
@@ -531,13 +531,34 @@
session.save()
except KeyError:
print >> sys.stderr, "Error! Could not update Infofield"
+
+
+ # Special logic for field "teilnahme_evaluation"
+ request_data = request.params.dict_of_lists()
+
+ # If the young adult does not take part in the evaluation, the evaluation number
+ # is (re)set to null
+ if request.params.getone('teilnahme_evaluation') in [u'-1', u'3', u'4', u'5']:
+ request_data['evaluation_nummer'] = ['']
+ # Generate the ID (we do not check for uniqueness)
+ # ID is created from the agency name, the evaluation abbreviation and a number
+ elif request.params.getone('evaluation_nummer') == '':
+ # TODO: @roland from roland: remove the random part
+ import random
+ evaluation_nr = random.randint(1,1000)
+ agency = Agency()
+ evaluation_id = agency.getEvaluationId()
+ evaluation_agency = agency.getName()
+ request_data['evaluation_nummer'] = ["%s/%s-%d" % (evaluation_agency, evaluation_id, evaluation_nr)]
+
+ #print >> sys.stderr, request_data
# Get old formerrors, save data and store new formdata
old_errors = case_session.getFormErrors()
ds_id = request.params["ds"]
new_errors, page = self.__save(
ti.page,
- request.params.dict_of_lists(),
+ request_data,
old_errors,
ti.realId(ds_id))
Modified: waska/trunk/waskaweb/lib/renderer.py
===================================================================
--- waska/trunk/waskaweb/lib/renderer.py 2010-02-19 13:53:52 UTC (rev 1669)
+++ waska/trunk/waskaweb/lib/renderer.py 2010-02-19 14:20:52 UTC (rev 1670)
@@ -44,6 +44,8 @@
DIALOG_SCHUELER1 = u'''<div class="form_errors"> <h1>Wichtiger Hinweis</h1><p>Schülerinnen/Schüler dürfen nur dann ins Case Managagement aufgenommen werden, wenn sie sich im letzten Schulbesuchsjahr befinden und eine Übergangsprognose vorliegt.</p></div>'''
+DIALOG_EVALUATIONNR1 = u'''<div class="form_errors"> <h1>Wichtiger Hinweis</h1><p>Das Feld "Evaluationsnummer" ist ein Pflichtfeld, wenn die Teilnahmeoption "ist bereit an der Befragung teilzunehmen..." ausgewählt ist.</p></div>'''
+
HELP = \
'''<span class="help"> <a href="%s" target="_blank">
<img src="/images/icons/form_help.png" border="0"
@@ -385,6 +387,13 @@
v3 = self.formdata.getData('zugang_kompetenzagentur')
if v3 == '23' and (v1 == '0' or (v1 == '1' and v2 == '0')):
out.append(DIALOG_SCHUELER1)
+
+ # Special logic for field "teilnahme_evaluation"
+ #v1 = self.formdata.getData('teilnahme_evaluation')
+ #v2 = self.formdata.getData('evaluation_nummer')
+ #if v1 == '2' and v2 == '':
+ # out.append(DIALOG_EVALUATIONNR1)
+
if not self.ro_mode:
out.append('<form id="waska_form" action="')
if action: out.append(escape(action, True))
Modified: waska/trunk/waskaweb/model/agencysettings.py
===================================================================
--- waska/trunk/waskaweb/model/agencysettings.py 2010-02-19 13:53:52 UTC (rev 1669)
+++ waska/trunk/waskaweb/model/agencysettings.py 2010-02-19 14:20:52 UTC (rev 1670)
@@ -86,6 +86,9 @@
def getName(self):
return unicode(str(self.conf.get('ka_name', '')), 'utf-8')
+
+ def getEvaluationId(self):
+ return unicode(str(self.conf.get('evaluation_id', '')), 'utf-8')
def getMaxSavetime(self):
return unicode(str(self.conf.get('max_speicherdauer', '')), 'utf-8')
More information about the Mpuls-commits
mailing list