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.
</td>
</tr>
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')"
rows="REQUEST.get('dtpref_rows', '20')">
<tr>
<td align="left" valign="top">
<div class="form-label">
......@@ -78,8 +80,7 @@ button in order for some changes to take effect.
</div>
</td>
<td align="left" valign="top">
<input type="text" name="dtpref_cols" value="<dtml-var
expr="REQUEST.get('dtpref_cols', '50')" html_quote>" size="6" />
<input type="text" name="dtpref_cols" value="&dtml-cols;" size="6" />
</td>
</tr>
......@@ -90,8 +91,7 @@ button in order for some changes to take effect.
</div>
</td>
<td align="left" valign="top">
<input type="text" name="dtpref_rows" value="<dtml-var
expr="REQUEST.get('dtpref_rows', '20')" html_quote>" size="6" />
<input type="text" name="dtpref_rows" value="&dtml-rows;" size="6" />
</td>
</tr>
</table>
......@@ -100,14 +100,19 @@ button in order for some changes to take effect.
<input type="submit" name="submit" value="Change">
</span>
<p class="form-help">
<textarea name="ignore" rows="<dtml-var
expr="REQUEST.get('dtpref_rows', '20')" html_quote>" cols="<dtml-var
expr="REQUEST.get('dtpref_cols', '50')" html_quote>"
>This is an example text area.</textarea>
<div class="form-help">
<dtml-if expr="cols[-1]=='%'">
<textarea name="data:text" wrap="off" style="width:&dtml-cols;"
rows="&dtml-rows;"
>This is a sample edit textarea.</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>
......
......@@ -12,7 +12,7 @@
##############################################################################
"""DTML Method objects."""
__version__='$Revision: 1.76 $'[11:-2]
__version__='$Revision: 1.77 $'[11:-2]
import History
from Globals import HTML, DTMLFile, MessageDialog
......@@ -221,8 +221,13 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
def _er(self,data,title,SUBMIT,dtpref_cols,dtpref_rows,REQUEST):
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 @@ class DTMLMethod(RestrictedDTML, HTML, Acquisition.Implicit, RoleManager,
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.
......
......@@ -25,11 +25,16 @@ the <em>browse</em> button to select a local file to upload.
<tr>
<td align="left" valign="top" colspan="2">
<dtml-let cols="_.int(REQUEST.get('dtpref_cols',70))"
width="_.min(_.int(_.float(cols)/70.0 * 100.0),100)">
<textarea name="data:text" wrap="off" style="width:&dtml-width;%"
cols="&dtml-cols;" rows="<dtml-var dtpref_rows missing="20">"
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')">
<dtml-if expr="cols[-1]=='%'">
<textarea name="data:text" wrap="off" style="width:&dtml-cols;"
rows="<dtml-var dtpref_rows missing="20">"
><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>
</td>
</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