[Mpuls-commits] r561 - in wasko/trunk: . waskaweb/controllers waskaweb/lib waskaweb/model waskaweb/templates/casemanagement
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jul 29 09:57:03 CEST 2009
Author: torsten
Date: 2009-07-29 09:56:59 +0200 (Wed, 29 Jul 2009)
New Revision: 561
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/controllers/case.py
wasko/trunk/waskaweb/lib/validators.py
wasko/trunk/waskaweb/model/case.py
wasko/trunk/waskaweb/templates/casemanagement/new.mako
Log:
Make creating cases work with libformed
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-07-28 15:17:16 UTC (rev 560)
+++ wasko/trunk/ChangeLog.txt 2009-07-29 07:56:59 UTC (rev 561)
@@ -1,3 +1,12 @@
+2009-07-29 Torsten Irlaender <torsten.irlaender at intevation.de>
+
+ Make creating cases work with libformed
+
+ * waskaweb/model/case.py,
+ waskaweb/controllers/case.py,
+ waskaweb/lib/validators.py,
+ waskaweb/templates/casemanagement/new.mako:
+
2009-07-28 Sascha L. Teichmann <sascha.teichmann at intevation.de>
* waskaweb/model/case.py: Fixed creation of new cases.
Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py 2009-07-28 15:17:16 UTC (rev 560)
+++ wasko/trunk/waskaweb/controllers/case.py 2009-07-29 07:56:59 UTC (rev 561)
@@ -409,6 +409,7 @@
print "11"
except formencode.Invalid, error:
+ print error
c.form_result = error.value
c.form_errors = error.error_dict or {}
return render('/casemanagement/new.mako')
Modified: wasko/trunk/waskaweb/lib/validators.py
===================================================================
--- wasko/trunk/waskaweb/lib/validators.py 2009-07-28 15:17:16 UTC (rev 560)
+++ wasko/trunk/waskaweb/lib/validators.py 2009-07-29 07:56:59 UTC (rev 561)
@@ -264,13 +264,13 @@
# form_section_17 = formencode.validators.Int(if_missing=0)
class NewCaseForm(BaseFormValidator):
- name_1 = formencode.validators.String()
- vorname_1 = formencode.validators.String()
- strasse = formencode.validators.String()
- strassenr = formencode.validators.String()
- wohnort = formencode.validators.String()
- statement_signed = formencode.validators.Bool(if_missing=False)
- aufnahme_typ = formencode.validators.Int(if_missing=0)
+ name = formencode.validators.String()
+ vorname = formencode.validators.String()
+ addresse_strasse = formencode.validators.String()
+ addresse_strassenr = formencode.validators.String()
+ addresse_ort = formencode.validators.String()
+ statement_signed = formencode.validators.Bool(if_missing=False)
+ aufnahme_typ = formencode.validators.Int(if_missing=0)
class EditSettingsForm(BaseFormValidator):
anon_transfer = formencode.validators.String(if_missing='off')
Modified: wasko/trunk/waskaweb/model/case.py
===================================================================
--- wasko/trunk/waskaweb/model/case.py 2009-07-28 15:17:16 UTC (rev 560)
+++ wasko/trunk/waskaweb/model/case.py 2009-07-29 07:56:59 UTC (rev 561)
@@ -169,7 +169,7 @@
LOAD_CASE_SQL = """SELECT name as name_1, vorname as vorname_1, bearbeiter_id, fn as kundennummer, erstgespraech from master_tbl_view WHERE id = %(id)s"""
DELETE_CASE_SQL = """select delete_master_ds(%(id)s)"""
-CREATE_CASE_SQL = """SELECT create_master_ds(%(uuid)s)"""
+CREATE_CASE_SQL = """SELECT create_master_tbl(%(uuid)s)"""
UPDATE_CASE_ON_CREATE_SQL = """UPDATE master_tbl_view set name = %(name)s, vorname = %(vorname)s, mitarb_vv = %(gvorname)s, mitarb_vn = %(gname)s, einwilligung = %(einwilligung)s, addresse_strassenr_1 = %(strassenr)s, addresse_strasse_1 = %(strasse)s, addresse_plz_1 = %(plz)s, addresse_ort_1 = %(ort)s WHERE id = %(id)s"""
INIT_CASE_SQL= """UPDATE master_tbl_view SET ks = %(ka_name)s, fkz = %(fkz)s, mitarb_zv = %(vorname)s, mitarb_zn = %(nachname)s WHERE id = %(id)s"""
@@ -489,7 +489,17 @@
session.get('uncommited_fields'))
try:
form_result = convert2dic(data)
- instance_tree.setData(form_result)
+
+ data = {}
+ nkey = None
+ for key, value in form_result.iteritems():
+ nkey = get_field_identifier(id, key, instance_tree)
+ if not nkey: continue
+ data[nkey] = value
+
+ print data
+ instance_tree.setData(data)
+
session['uncommitted_fields'] = instance_tree.commit()
session.save()
except SetDataException, err:
Modified: wasko/trunk/waskaweb/templates/casemanagement/new.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/new.mako 2009-07-28 15:17:16 UTC (rev 560)
+++ wasko/trunk/waskaweb/templates/casemanagement/new.mako 2009-07-29 07:56:59 UTC (rev 561)
@@ -10,30 +10,56 @@
<h1>Neue Fallakte anlegen</h1>
<fieldset>
<legend>Basisdaten</legend>
-<div class="waska_form_element w50">
-<label for="vorname_1">Vorname:</label>
-<input class="field" type="text" size="50" maxlength="60" name="vorname_1" id="vorname_1" value="${c.case.first_name or ""}">
-</div>
-<div class="waska_form_element w50">
-<label for="name_1">Name:</label>
-<input class="field" type="text" size="50" maxlength="60" name="name_1" id="name_1" value="${c.case.last_name or ""}">
-</div>
-<div class="waska_form_element w75">
-<label for="strasse">Strasse:</label>
-<input class="field" type="text" size="50" maxlength="60" name="strasse" id="strasse" value="${c.case.street or ""}">
-</div>
-<div class="waska_form_element w25">
-<label for="strassenr">Strasse Nr.:</label>
-<input class="field" type="text" size="50" maxlength="60" name="strassenr" id="strassenr" value="${c.case.streetnr or ""}">
-</div>
-<div class="waska_form_element w25">
-<label for="plz">PLZ:</label>
-<input class="field" type="text" size="50" maxlength="60" name="plz" id="plz" value="${c.case.plz or ""}">
-</div>
-<div class="waska_form_element w75">
-<label for="wohnort">Ort:</label>
-<input class="field" type="text" size="50" maxlength="60" name="wohnort" id="wohnort" value="${c.case.city or ""}">
-</div>
+ <table>
+ <tr>
+ <td class="label">
+ <label for="name">Name:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="name" id="name" value="${c.case.last_name or ""}">
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="vorname">Vorname:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="vorname" id="vorname" value="${c.case.first_name or ""}">
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="addresse_strasse">Strasse:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="addresse_strasse" id="addresse_strasse" value="${c.case.street or ""}">
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="addresse_strassenr">Strasse Nr.:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="addresse_strassenr" id="addresse_strassenr" value="${c.case.streetnr or ""}">
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="addresse_plz">PLZ:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="addresse_plz" id="addresse_plz" value="${c.case.plz or ""}">
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="addresse_org">Ort:</label>
+ </td>
+ <td>
+ <input class="field" type="text" size="50" maxlength="60" name="addresse_ort" id="addresse_ort" value="${c.case.city or ""}">
+ </td>
+ </tr>
+ </table>
</fieldset>
<fieldset>
<legend>Art der Aufnahme</legend>
More information about the Mpuls-commits
mailing list