Commit f5405e57 authored by Casey Duncan's avatar Casey Duncan

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.
parent 36d28b31
...@@ -71,6 +71,8 @@ button in order for some changes to take effect. ...@@ -71,6 +71,8 @@ button in order for some changes to take effect.
</td> </td>
</tr> </tr>
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')"
rows="REQUEST.get('dtpref_rows', '20')">
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="form-label"> <div class="form-label">
...@@ -78,8 +80,7 @@ button in order for some changes to take effect. ...@@ -78,8 +80,7 @@ button in order for some changes to take effect.
</div> </div>
</td> </td>
<td align="left" valign="top"> <td align="left" valign="top">
<input type="text" name="dtpref_cols" value="<dtml-var <input type="text" name="dtpref_cols" value="&dtml-cols;" size="6" />
expr="REQUEST.get('dtpref_cols', '50')" html_quote>" size="6" />
</td> </td>
</tr> </tr>
...@@ -90,8 +91,7 @@ button in order for some changes to take effect. ...@@ -90,8 +91,7 @@ button in order for some changes to take effect.
</div> </div>
</td> </td>
<td align="left" valign="top"> <td align="left" valign="top">
<input type="text" name="dtpref_rows" value="<dtml-var <input type="text" name="dtpref_rows" value="&dtml-rows;" size="6" />
expr="REQUEST.get('dtpref_rows', '20')" html_quote>" size="6" />
</td> </td>
</tr> </tr>
</table> </table>
...@@ -100,14 +100,19 @@ button in order for some changes to take effect. ...@@ -100,14 +100,19 @@ button in order for some changes to take effect.
<input type="submit" name="submit" value="Change"> <input type="submit" name="submit" value="Change">
</span> </span>
<p class="form-help"> <div class="form-help">
<dtml-if expr="cols[-1]=='%'">
<textarea name="ignore" rows="<dtml-var <textarea name="data:text" wrap="off" style="width:&dtml-cols;"
expr="REQUEST.get('dtpref_rows', '20')" html_quote>" cols="<dtml-var rows="&dtml-rows;"
expr="REQUEST.get('dtpref_cols', '50')" html_quote>" >This is a sample edit textarea.</textarea>
>This is an example text area.</textarea> <dtml-else>
<textarea name="data:text" wrap="off" cols="&dtml-cols;"
rows="&dtml-rows;"
>This is a sample edit textarea.</textarea>
</dtml-if>
</div>
</p> </dtml-let>
</form> </form>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
"""DTML Method objects.""" """DTML Method objects."""
__version__='$Revision: 1.76 $'[11:-2] __version__='$Revision: 1.77 $'[11:-2]
import History import History
from Globals import HTML, DTMLFile, MessageDialog from Globals import HTML, DTMLFile, MessageDialog
...@@ -221,8 +221,13 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager, ...@@ -221,8 +221,13 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST): def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
dr,dc = self._size_changes[SUBMIT] dr,dc = self._size_changes[SUBMIT]
rows=max(1,int(dtpref_rows)+dr) rows=str(max(1,int(dtpref_rows)+dr))
cols=max(35,int(dtpref_cols)+dc)
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() e=(DateTime('GMT') + 365).rfc822()
resp=REQUEST['RESPONSE'] resp=REQUEST['RESPONSE']
resp.setCookie('dtpref_rows',str(rows),path='/',expires=e) resp.setCookie('dtpref_rows',str(rows),path='/',expires=e)
...@@ -231,7 +236,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager, ...@@ -231,7 +236,7 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
self,REQUEST,title=title,__str__=self.quotedHTML(data), self,REQUEST,title=title,__str__=self.quotedHTML(data),
dtpref_cols=cols,dtpref_rows=rows) 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): dtpref_rows='20',REQUEST=None):
""" """
Replaces a Documents contents with Data, Title with Title. Replaces a Documents contents with Data, Title with Title.
......
...@@ -25,11 +25,16 @@ the <em>browse</em> button to select a local file to upload. ...@@ -25,11 +25,16 @@ the <em>browse</em> button to select a local file to upload.
<tr> <tr>
<td align="left" valign="top" colspan="2"> <td align="left" valign="top" colspan="2">
<dtml-let cols="_.int(REQUEST.get('dtpref_cols',70))" <dtml-let cols="REQUEST.get('dtpref_cols', '100%')">
width="_.min(_.int(_.float(cols)/70.0 * 100.0),100)"> <dtml-if expr="cols[-1]=='%'">
<textarea name="data:text" wrap="off" style="width:&dtml-width;%" <textarea name="data:text" wrap="off" style="width:&dtml-cols;"
cols="&dtml-cols;" rows="<dtml-var dtpref_rows missing="20">" rows="<dtml-var dtpref_rows missing="20">"
><dtml-var __str__></textarea> ><dtml-var __str__></textarea>
<dtml-else>
<textarea name="data:text" wrap="off" cols="&dtml-cols;"
rows="<dtml-var dtpref_rows missing="20">"
><dtml-var __str__></textarea>
</dtml-if>
</dtml-let> </dtml-let>
</td> </td>
</tr> </tr>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment