[Zope-Checkins] CVS: Zope/lib/python/Shared/DC/ZRDB - DA.py:1.110.12.1

Andreas Jung andreas@andreas-jung.com
Sun, 6 Jul 2003 06:47:55 -0400


Update of /cvs-repository/Zope/lib/python/Shared/DC/ZRDB
In directory cvs.zope.org:/tmp/cvs-serv8776/lib/python/Shared/DC/ZRDB

Modified Files:
      Tag: Zope-2_7-branch
	DA.py 
Log Message:
     - Collector #628: Applied patch to fix several textarea resize
       problems.


=== Zope/lib/python/Shared/DC/ZRDB/DA.py 1.110 => 1.110.12.1 ===
--- Zope/lib/python/Shared/DC/ZRDB/DA.py:1.110	Thu Feb 27 03:45:44 2003
+++ Zope/lib/python/Shared/DC/ZRDB/DA.py	Sun Jul  6 06:47:51 2003
@@ -124,25 +124,25 @@
         }
 
     def _er(self,title,connection_id,arguments,template,
-            SUBMIT,sql_pref__cols,sql_pref__rows,REQUEST):
+            SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
         dr,dc = self._size_changes[SUBMIT]
-
-        rows=max(1,atoi(sql_pref__rows)+dr)
-        cols=max(40,atoi(sql_pref__cols)+dc)
-        e=(DateTime('GMT') + 365).rfc822()
-        resp=REQUEST['RESPONSE']
-        resp.setCookie('sql_pref__rows',str(rows),path='/',expires=e)
-        resp.setCookie('sql_pref__cols',str(cols),path='/',expires=e)
-        return self.manage_main(
-            self,REQUEST,
-            title=title,
-            arguments_src=arguments,
-            connection_id=connection_id,
-            src=template,
-            sql_pref__cols=cols,sql_pref__rows=rows)
+        rows = str(max(1, int(dtpref_rows) + dr))
+        cols = str(dtpref_cols)
+        if cols.endswith('%'):
+           cols = str(min(100, max(25, int(cols[:-1]) + dc))) + '%'
+        else:
+           cols = str(max(35, int(cols) + dc))
+        e = (DateTime("GMT") + 365).rfc822()
+        setCookie = REQUEST["RESPONSE"].setCookie
+        setCookie("dtpref_rows", rows, path='/', expires=e)
+        setCookie("dtpref_cols", cols, path='/', expires=e)
+        REQUEST.other.update({"dtpref_cols":cols, "dtpref_rows":rows})
+        return self.manage_main(self, REQUEST, title=title,
+                                arguments_src=arguments,
+                                connection_id=connection_id, src=template)
 
     def manage_edit(self,title,connection_id,arguments,template,
-                    SUBMIT='Change',sql_pref__cols='50', sql_pref__rows='20',
+                    SUBMIT='Change', dtpref_cols='100%', dtpref_rows='20',
                     REQUEST=None):
         """Change database method  properties
 
@@ -159,7 +159,7 @@
 
         if self._size_changes.has_key(SUBMIT):
             return self._er(title,connection_id,arguments,template,
-                            SUBMIT,sql_pref__cols,sql_pref__rows,REQUEST)
+                            SUBMIT,dtpref_cols,dtpref_rows,REQUEST)
 
         if self.wl_isLocked():
             raise ResourceLockedError, 'SQL Method is locked via WebDAV'