[Zope-Checkins] CVS: Zope/lib/python/OFS - DTMLMethod.py:1.77

Casey Duncan casey@zope.com
Fri, 12 Apr 2002 16:19:03 -0400


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv32529/OFS

Modified Files:
	DTMLMethod.py 
Log Message:
New wider/narrower implementation. Allows you to alternately use percentages
or absolute column widths. You can set this in the standard prefs. Still only
works for editing DTML right now.


=== Zope/lib/python/OFS/DTMLMethod.py 1.76 => 1.77 ===
         dr,dc = self._size_changes[SUBMIT]
         
-        rows=max(1,int(dtpref_rows)+dr)
-        cols=max(35,int(dtpref_cols)+dc)
+        rows=str(max(1,int(dtpref_rows)+dr))
+        
+        if dtpref_cols[-1]=='%':
+            cols= str(min(100, max(25,int(dtpref_cols[:-1])+dc)))+'%'
+        else:
+            cols=str(max(35,int(dtpref_cols)+dc))
+            
         e=(DateTime('GMT') + 365).rfc822()
         resp=REQUEST['RESPONSE']
         resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
@@ -231,7 +236,7 @@
             self,REQUEST,title=title,__str__=self.quotedHTML(data),
             dtpref_cols=cols,dtpref_rows=rows)
 
-    def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='70',
+    def manage_edit(self,data,title,SUBMIT='Change',dtpref_cols='100%',
                     dtpref_rows='20',REQUEST=None):
         """
         Replaces a Documents contents with Data, Title with Title.