[Mpuls-commits] r3157 - in base/trunk: . mpulsweb/controllers mpulsweb/lib mpulsweb/public/styles

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 8 16:23:31 CEST 2010


Author: roland
Date: 2010-07-08 16:23:29 +0200 (Thu, 08 Jul 2010)
New Revision: 3157

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/formularpage.py
   base/trunk/mpulsweb/controllers/repeatgroup.py
   base/trunk/mpulsweb/lib/renderer.py
   base/trunk/mpulsweb/public/styles/all.css
Log:
fixed mpuls issue #815: could not create RGs with internet explorer

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-07-08 13:07:29 UTC (rev 3156)
+++ base/trunk/ChangeLog	2010-07-08 14:23:29 UTC (rev 3157)
@@ -1,3 +1,17 @@
+2010-07-08  Roland Geider  <roland.geider at intevation.de>
+
+	* mpulsweb/controllers/repeatgroup.py,
+	  mpulsweb/controllers/formularpage.py,
+	  mpulsweb/lib/renderer.py,
+	  mpulsweb/public/styles/all.css: Fixed issue815 from
+	  support.intevation.de/mpuls/: Repeat groups could not be created or
+	  deleted because the internet explorer does not send the 'value'
+	  of inputs of type="image", only the x and y coordinates. <buttons>
+	  could also not be used because IE sends all the HTML it finds
+	  between its tags (and IE 6 sends the values of all <buttons> on the
+	  page). Now we use regular buttons, misused their names and put CSS
+	  cosmetics to make them look like icons.
+
 2010-07-08  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* mpulsweb/lib/validators.py (KeineAngabe): Added new validator the

Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2010-07-08 13:07:29 UTC (rev 3156)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2010-07-08 14:23:29 UTC (rev 3157)
@@ -42,15 +42,7 @@
     result = {}
     for i in params:
         # libformed
-        if i not in ['save', 
-                     'savenext', 
-                     'page', 
-                     'add_rg', 
-                     'add_rg.y', 
-                     'add_rg.x',
-                     'del_rg',
-                     'del_rg.y',
-                     'del_rg.x']:
+        if i not in ['save', 'savenext', 'page'] and not i.startswith(('add_rg', 'del_rg')):
             result[i] = params[i]
     return result
 
@@ -200,14 +192,23 @@
             instance_tree.setData(form_result)
             session['uncommited_fields'] = instance_tree.commit()
             session.save()
+            
             # How to proceed after saving the data?
-            if request.params.has_key('add_rg'):
-                redirect_to(controller='/repeatgroup', action="new",
+            for param in request.params:
+                if param.startswith('add_rg') and not param.endswith(('x', 'y')):
+                    print param
+                    print request.params.get('add_rg')
+                    if param == 'add_rg':
+                        redirect_to(controller='/repeatgroup', action="new",
                             id=request.params.get('add_rg'))
-            elif request.params.has_key('del_rg'):
-                redirect_to(controller='/repeatgroup', action="delete",
-                            id=request.params.get('del_rg'))
-            elif request.params.has_key('savenext'):
+                    else:
+                        redirect_to(controller='/repeatgroup', action="new",
+                                id=param.split('|')[1])
+                elif param.startswith('del_rg') and not param.endswith(('x', 'y')):
+                    redirect_to(controller='/repeatgroup', action="delete",
+                            id=param.split('|')[1])
+            
+            if request.params.has_key('savenext'):
                 page_id = session['navigation.tree'].getTreeItem(page_id).nextKey().key
 
             # Check consistence of case and retag

Modified: base/trunk/mpulsweb/controllers/repeatgroup.py
===================================================================
--- base/trunk/mpulsweb/controllers/repeatgroup.py	2010-07-08 13:07:29 UTC (rev 3156)
+++ base/trunk/mpulsweb/controllers/repeatgroup.py	2010-07-08 14:23:29 UTC (rev 3157)
@@ -36,6 +36,7 @@
 
     def delete(self, id, confirmed='0'):
         """Delete rg"""
+        log.debug("deleting repeat group %s" % id)
         if confirmed == '1':
             factory = InstanceFactory(g.formedTree, PostgresDBInterface())
             instance_tree = factory.loadInstanceTreeByIdentifier(
@@ -72,6 +73,7 @@
 
     def new(self, id):
         """New rg"""
+        log.debug("creating new repeat group %s" % id)
         factory = InstanceFactory(g.formedTree, PostgresDBInterface())
         instance_tree = factory.loadInstanceTreeByIdentifier(
             session['case'].id,

Modified: base/trunk/mpulsweb/lib/renderer.py
===================================================================
--- base/trunk/mpulsweb/lib/renderer.py	2010-07-08 13:07:29 UTC (rev 3156)
+++ base/trunk/mpulsweb/lib/renderer.py	2010-07-08 14:23:29 UTC (rev 3157)
@@ -385,12 +385,14 @@
             out.append('<td class="container">')
             out.append(self._renderRecursive(child))
             out.append('</td>')
-            out.append('<td class="vcontrol" width="15">')
+            out.append('<td class="vcontrol" width="17">')
             if not self.ro_mode:
-                out.append(tag("input", name="del_rg", type="image",
-                               src=icon("delete_active_16.png"),
-                               value=child.getIdentifier(),
-                               alt=_('Delete RG'), title=_('Delete RG')))
+                out.append(tag("input",
+                                name   = "del_rg|%s" % child.getIdentifier(),
+                                type   = "submit",
+                                class_ = "pseudo_imagebutton del_rg",
+                                title  = _('Delete RG')))
+                
             out.append('</td>')
             out.append('</tr>')
         if self.ro_mode:
@@ -400,9 +402,11 @@
             out.append('<tr>')
             out.append('<td class="hcontrol" style="text-align: right;"'
                        ' colspan="2">')
-            out.append(tag("input", name="add_rg", type="image",
-                           src=icon("new_16.png"), value=node.getIdentifier(),
-                           alt=_('Add new RG'), title=_('Add new RG')))
+            out.append(tag("input",
+                        name   = "add_rg|%s" % node.getIdentifier(),
+                        type   = "submit",
+                        class_ = "pseudo_imagebutton add_rg",
+                        title  = _('Add new RG')))
             out.append("</td>")
             out.append("</tr>")
         return out

Modified: base/trunk/mpulsweb/public/styles/all.css
===================================================================
--- base/trunk/mpulsweb/public/styles/all.css	2010-07-08 13:07:29 UTC (rev 3156)
+++ base/trunk/mpulsweb/public/styles/all.css	2010-07-08 14:23:29 UTC (rev 3157)
@@ -244,6 +244,22 @@
 	width: auto;
 }
 
+.formularpage input[type="submit"].pseudo_imagebutton {
+    background-color:   transparent;
+    background-repeat:  no-repeat;
+    border-width:       0;
+    height:             16px;
+    width:              16px;
+}
+
+.formularpage .del_rg {
+    background-image:   url("/images/icons/delete_active_16.png");
+}
+
+.formularpage .add_rg {
+    background-image:   url("/images/icons/new_16.png");
+}
+
 .formularpage input[type="submit"] {
 	width:  auto;
         border: 1px solid #555753;



More information about the Mpuls-commits mailing list