[Mpuls-commits] r5642 - in wasko/trunk/waskoweb: controllers templates/settings

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 22 15:15:23 CET 2011


Author: ludwig
Date: 2011-11-22 15:15:22 +0100 (Tue, 22 Nov 2011)
New Revision: 5642

Modified:
   wasko/trunk/waskoweb/controllers/settings.py
   wasko/trunk/waskoweb/templates/settings/edit.mako
   wasko/trunk/waskoweb/templates/settings/show.mako
Log:
Update the settings pages to use htmlfill and display meta configurations
if meta-server is set.


Modified: wasko/trunk/waskoweb/controllers/settings.py
===================================================================
--- wasko/trunk/waskoweb/controllers/settings.py	2011-11-22 13:46:44 UTC (rev 5641)
+++ wasko/trunk/waskoweb/controllers/settings.py	2011-11-22 14:15:22 UTC (rev 5642)
@@ -32,9 +32,14 @@
     @checkRole('admin')
     def edit(self):
         c.form_errors = {}
-        c.form_result = {}
         c.agency = Agency()
-        return render('/settings/edit.mako')
+        c.form_result = c.agency.conf
+        form = render('/settings/edit.mako')
+        return formencode.htmlfill.render(form,
+                                          defaults=c.form_result,
+                                          auto_insert_errors=False,
+                                          errors=c.form_errors)
+       
     
     @checkRole('admin')
     def editAction(self):
@@ -45,7 +50,11 @@
         except formencode.Invalid, error:
             c.form_result = error.value
             c.form_errors = error.error_dict or {}
-            return render('/settings/edit.mako')
+            form = render('/settings/edit.mako')
+            return formencode.htmlfill.render(form,
+                                              defaults=c.form_result,
+                                              auto_insert_errors=False,
+                                              errors=c.form_errors)
 
         c.agency.store(c.form_result)
         c.dialog_title = _('Configurations saved!')

Modified: wasko/trunk/waskoweb/templates/settings/edit.mako
===================================================================
--- wasko/trunk/waskoweb/templates/settings/edit.mako	2011-11-22 13:46:44 UTC (rev 5641)
+++ wasko/trunk/waskoweb/templates/settings/edit.mako	2011-11-22 14:15:22 UTC (rev 5642)
@@ -46,48 +46,24 @@
         <legend>${_('Specification for agency')}</legend>
         <div class="waska_form_element w30">
           <label for="ka_name">${_('Name of the institution')}</label>
-          % if c.form_errors.get('ka_name'):
-            <input type="text" class="field error_box" id="ka_name"
-                   value="${c.form_result.get('ka_name', c.agency.getName())}"
-                   name="ka_name" maxlength="60">
-          % else:
-            <input type="text" class="field" id="ka_name" name="ka_name"
-                   value="${c.form_result.get('ka_name', c.agency.getName())}"
-                   maxlength="60">
-          % endif
+          <input type="text" class="field" id="ka_name" name="ka_name" value="" maxlength="60">  
         </div>
         <div class="waska_form_element w30">
           <label for="ka_adresse">${_('Address of the institution')}</label>
-          % if c.form_errors.get('ka_adresse'):
-            <input type="text" class="field error_box" id="ka_adresse"
-                   value="${c.form_result.get('ka_adresse', c.agency.getAddress())}"
-                   name="ka_adresse" maxlength="120">
-          % else:
-            <input type="text" class="field" id="ka_adresse" name="ka_adresse"
-                   value="${c.form_result.get('ka_adresse', c.agency.getAddress())}"
-                   maxlength="120">
-          % endif
+          <input type="text" class="field" id="ka_adresse" name="ka_adresse" value="" maxlength="120">
         </div>
         <div class="waska_form_element w30">
           <label for="fkz">${_('Formular number of the institution')}</label>
-          % if c.form_errors.get('fkz'):
-            <input type="text" class="error_box" id="fkz" name="fkz"
-                   value="${c.form_result.get('fkz', c.agency.getFKZ())}"
-                   maxlength="60">
-          % else:
-            <input type="text" id="fkz" name="fkz"
-                   value="${c.form_result.get('fkz', c.agency.getFKZ())}"
-                   maxlength="60">
-          % endif
+          <input type="text" id="fkz" name="fkz" value="" maxlength="60">
         </div>
         <div class="waska_form_element w30">
-	      <label for="evaluation_id">${_('Evaluation ID')}</label>
-              <input type="text"
-                     id="evaluation_id"
-                     name="evaluation_id"
-                     value="${c.form_result.get('evaluation_id', c.agency.getEvaluationId())| h}"
-                     maxlength="60">
-            </div>
+           <label for="evaluation_id">${_('Evaluation ID')}</label>
+           <input type="text"
+                  id="evaluation_id"
+                  name="evaluation_id"
+                  value="${c.form_result.get('evaluation_id', c.agency.getEvaluationId())| h}"
+                  maxlength="60">
+        </div>
       </fieldset>
       <fieldset>
         <legend>${_('Data of the cases')}</legend>
@@ -95,18 +71,7 @@
           <label for="max_speicherdauer">
             ${_('Automatic review after days')}
           </label>
-          % if c.form_errors.get('max_speicherdauer'):
-            <input type="text" class="error_box" id="max_speicherdauer"
-                   name="max_speicherdauer"
-                   value="${c.form_result.get('max_speicherdauer',
-                                              c.agency.getMaxSavetime())}"
-                   maxlength="4">
-          % else:
-            <input type="text" id="max_speicherdauer" name="max_speicherdauer"
-                   value="${c.form_result.get('max_speicherdauer',
-                                              c.agency.getMaxSavetime())}"
-                   maxlength="4">
-          % endif
+          <input type="text" id="max_speicherdauer" name="max_speicherdauer" value="" maxlength="4">
           <p class="info">
            ${_('Automatically generated reminders help to find case files, that are not handled for the definied period of time. Beside this there could be some more terms of conditions to genereate a automatic reminders:')} ${g.mpuls_config.get('case', 'reminderconditiondesc')}
           </p>
@@ -117,12 +82,7 @@
               <img class="smallicon" alt="" src="${h.url_for('/images/icons/info/failure_22.png')}">
             </a>
           % endif
-          % if c.agency.isAnonTransfer():
-            <input id="anon_transfer" name="anon_transfer" type="checkbox"
-                   checked />
-          % else:
-            <input id="anon_transfer" name="anon_transfer" type="checkbox"/>
-          % endif
+          <input id="anon_transfer" name="anon_transfer" type="checkbox"/>
           <label for="anon_transfer">
             ${_('Assign case document')}
           </label>
@@ -131,6 +91,23 @@
           </p>
         </div>
       </fieldset>
+      % if g.mpuls_config.is_enabled('case-module', 'meta-server'):
+      <fieldset>
+        <legend>${_('Edit meta user settings')}</legend>
+        <div class="waska_form_element w30">
+          <label for="meta_user_name">
+            ${_('Meta user name')}
+          </label>
+          <input type="text" id="meta_user_name" name="meta_user_name" value="" maxlength="120"/>
+        </div>
+        <div class="waska_form_element w30">
+          <label for="meta_user_password">
+            ${_('Meta user password')}
+          </label>
+          <input type="text" id="meta_user_password" name="meta_user_password" value="" maxlength="120"/>
+        </div>
+      </fieldset>
+      % endif
       <div id="admin_edit_settings_submit" class="waska_form_element w100">
         <input type="submit" value="${_('Save settings')}">
       </div>

Modified: wasko/trunk/waskoweb/templates/settings/show.mako
===================================================================
--- wasko/trunk/waskoweb/templates/settings/show.mako	2011-11-22 13:46:44 UTC (rev 5641)
+++ wasko/trunk/waskoweb/templates/settings/show.mako	2011-11-22 14:15:22 UTC (rev 5642)
@@ -71,3 +71,23 @@
     </td>
   </tr>
 </table>
+
+% if g.mpuls_config.is_enabled('case-module', 'meta-server'):
+<p>${_('Here you can see meta user settings')}</p>
+<table>
+  <tr>
+    <td class="label table_header_v table_width_name">
+      ${_('Name of the meta user')}
+    </td>
+    <td class="table_description">${c.agency.getMetaUserName()}
+    </td>
+  </tr>
+  <tr>
+    <td class="label table_width_name">
+      ${_('Password of the meta user')}
+    </td>
+    <td class="table_description">${c.agency.getMetaUserPassword()}
+    </td>
+  </tr>
+</table>
+% endif



More information about the Mpuls-commits mailing list