Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ced97df9
Commit
ced97df9
authored
Aug 14, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop dtpref_* cookie values to influence size of ZMI edit boxes.
parent
34e6f304
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
133 deletions
+36
-133
src/OFS/DTMLDocument.py
src/OFS/DTMLDocument.py
+10
-6
src/OFS/DTMLMethod.py
src/OFS/DTMLMethod.py
+13
-47
src/OFS/Image.py
src/OFS/Image.py
+6
-4
src/OFS/dtml/documentEdit.dtml
src/OFS/dtml/documentEdit.dtml
+2
-14
src/OFS/dtml/fileEdit.dtml
src/OFS/dtml/fileEdit.dtml
+2
-9
src/Products/PageTemplates/ZopePageTemplate.py
src/Products/PageTemplates/ZopePageTemplate.py
+0
-24
src/Products/PageTemplates/www/ptEdit.zpt
src/Products/PageTemplates/www/ptEdit.zpt
+1
-15
src/Products/SiteAccess/www/manage_edit.dtml
src/Products/SiteAccess/www/manage_edit.dtml
+2
-14
No files found.
src/OFS/DTMLDocument.py
View file @
ced97df9
...
...
@@ -128,14 +128,18 @@ class DTMLDocument(PropertyManager, DTMLMethod):
InitializeClass
(
DTMLDocument
)
default_dd_html
=
"""<html>
<head><title><dtml-var title_or_id></title>
default_dd_html
=
"""
\
<!DOCTYPE html>
<html>
<head>
<title><dtml-var title_or_id></title>
<meta charset="utf-8" />
</head>
<body
bgcolor="#FFFFFF"
>
<body>
<h2><dtml-var title_or_id></h2>
<p>
This is the <dtml-var id> Document.
</p>
<p>
This is the <dtml-var id> Document.
</p>
</body>
</html>"""
...
...
src/OFS/DTMLMethod.py
View file @
ced97df9
...
...
@@ -233,49 +233,11 @@ class DTMLMethod(RestrictedDTML,
security
.
declareProtected
(
change_proxy_roles
,
'manage_proxyForm'
)
manage_proxyForm
=
DTMLFile
(
'dtml/documentProxy'
,
globals
())
_size_changes
=
{
'Bigger'
:
(
5
,
5
),
'Smaller'
:
(
-
5
,
-
5
),
'Narrower'
:
(
0
,
-
5
),
'Wider'
:
(
0
,
5
),
'Taller'
:
(
5
,
0
),
'Shorter'
:
(
-
5
,
0
),
}
def
_er
(
self
,
data
,
title
,
SUBMIT
,
dtpref_cols
,
dtpref_rows
,
REQUEST
):
dr
,
dc
=
self
.
_size_changes
[
SUBMIT
]
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
,
__str__
=
self
.
quotedHTML
(
data
))
security
.
declareProtected
(
change_dtml_methods
,
'manage_edit'
)
def
manage_edit
(
self
,
data
,
title
,
SUBMIT
=
'Change'
,
dtpref_cols
=
'100%'
,
dtpref_rows
=
'20'
,
REQUEST
=
None
):
def
manage_edit
(
self
,
data
,
title
,
SUBMIT
=
'Change'
,
REQUEST
=
None
):
""" Replace contents with 'data', title with 'title'.
The SUBMIT parameter is also used to change the size of the editing
area on the default Document edit screen. If the value is "Smaller",
the rows and columns decrease by 5. If the value is "Bigger", the
rows and columns increase by 5. If any other or no value is supplied,
the data gets checked for DTML errors and is saved.
"""
self
.
_validateProxy
(
REQUEST
)
if
SUBMIT
in
self
.
_size_changes
:
return
self
.
_er
(
data
,
title
,
SUBMIT
,
dtpref_cols
,
dtpref_rows
,
REQUEST
)
if
self
.
wl_isLocked
():
raise
ResourceLockedError
(
'This item is locked.'
)
...
...
@@ -421,15 +383,19 @@ def decapitate(html, RESPONSE=None):
return html[spos + eolen:]
default_dm_html = """<html>
<head><title><dtml-var title_or_id></title>
default_dm_html = """
\
<!DOCTYPE html>
<html>
<head>
<title><dtml-var title_or_id></title>
<meta charset="
utf
-
8
" />
</head>
<body
bgcolor="
#FFFFFF"
>
<
h2
><
dtml
-
var
title_or_id
>
<
dtml
-
var
document_title
></
h2
>
<
p
>
This
is
the
<
dtml
-
var
document_id
>
Document
in
the
<
dtml
-
var
title_and_id
>
Folder
.
</
p
>
<body>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<p>
This is the <dtml-var document_id> Document
in the <dtml-var title_and_id> Folder.
</p>
</body>
</html>"""
...
...
src/OFS/Image.py
View file @
ced97df9
...
...
@@ -792,13 +792,15 @@ class Image(File):
# FIXME: Redundant, already in base class
security
.
declareProtected
(
change_images_and_files
,
'manage_edit'
)
security
.
declareProtected
(
change_images_and_files
,
'manage_upload'
)
security
.
declareProtected
(
change_images_and_files
,
'PUT'
)
security
.
declareProtected
(
View
,
'index_html'
)
security
.
declareProtected
(
View
,
'get_size'
)
security
.
declareProtected
(
View
,
'getContentType'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPstat'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPlist'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPget'
)
if
bbb
.
HAS_ZSERVER
:
security
.
declareProtected
(
change_images_and_files
,
'PUT'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPstat'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPlist'
)
security
.
declareProtected
(
ftp_access
,
'manage_FTPget'
)
_properties
=
(
{
'id'
:
'title'
,
'type'
:
'string'
},
...
...
src/OFS/dtml/documentEdit.dtml
View file @
ced97df9
...
...
@@ -25,15 +25,8 @@ the <em>browse</em> button to select a local file to upload.
<tr>
<td align="left" valign="top" colspan="2">
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')"
rows="REQUEST.get('dtpref_rows', '20')">
<dtml-if expr="cols[-1]=='%'">
<textarea name="data:text" wrap="off" style="width: &dtml-cols;;"
<dtml-else>
<textarea name="data:text" wrap="off" cols="&dtml-cols;"
</dtml-if>
rows="&dtml-rows;"><dtml-var __str__></textarea>
</dtml-let>
<textarea name="data:text" wrap="off" style="width: 100%;"
rows="20"><dtml-var __str__></textarea>
</td>
</tr>
</dtml-with>
...
...
@@ -46,11 +39,6 @@ the <em>browse</em> button to select a local file to upload.
<dtml-else>
<input class="form-element" type="submit" name="SUBMIT" value="Save Changes">
</dtml-if>
<input class="form-element" type="submit" name="SUBMIT" value="Taller">
<input class="form-element" type="submit" name="SUBMIT" value="Shorter">
<input class="form-element" type="submit" name="SUBMIT" value="Wider">
<input class="form-element" type="submit" name="SUBMIT" value="Narrower">
</div>
</td>
</tr>
...
...
src/OFS/dtml/fileEdit.dtml
View file @
ced97df9
...
...
@@ -54,15 +54,8 @@ text type and small enough to be edited in a text area.
<tr>
<td align="left" valign="top" colspan="2">
<div style="width: 100%;">
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')"
rows="REQUEST.get('dtpref_rows', '20')">
<dtml-if "cols[-1]=='%'">
<textarea name="filedata:text" wrap="off" style="width: &dtml-cols;;"
<dtml-else>
<textarea name="filedata:text" wrap="off" cols="&dtml-cols;"
</dtml-if>
rows="&dtml-rows;"><dtml-var __str__ html_quote></textarea>
</dtml-let>
<textarea name="filedata:text" wrap="off" style="width: 100%;"
rows="20"><dtml-var __str__ html_quote></textarea>
</div>
</td>
</tr>
...
...
src/Products/PageTemplates/ZopePageTemplate.py
View file @
ced97df9
...
...
@@ -235,30 +235,6 @@ class ZopePageTemplate(Script, PageTemplate, Cacheable,
self
.
pt_edit
(
text
,
content_type
)
return
self
.
pt_editForm
(
manage_tabs_message
=
'Saved changes'
)
security
.
declareProtected
(
change_page_templates
,
'pt_changePrefs'
)
def
pt_changePrefs
(
self
,
REQUEST
,
height
=
None
,
width
=
None
,
dtpref_cols
=
"100%"
,
dtpref_rows
=
"20"
):
"""Change editing preferences."""
dr
=
{
"Taller"
:
5
,
"Shorter"
:
-
5
}.
get
(
height
,
0
)
dc
=
{
"Wider"
:
5
,
"Narrower"
:
-
5
}.
get
(
width
,
0
)
if
isinstance
(
height
,
int
):
dtpref_rows
=
height
if
isinstance
(
width
,
int
)
or
\
isinstance
(
width
,
str
)
and
width
.
endswith
(
'%'
):
dtpref_cols
=
width
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
.
pt_editForm
()
def
ZScriptHTML_tryParams
(
self
):
"""Parameters to test the script with."""
return
[]
...
...
src/Products/PageTemplates/www/ptEdit.zpt
View file @
ced97df9
...
...
@@ -5,7 +5,6 @@
<tal:block define="global body request/other/text | request/form/text
| context/read" />
<form action="" method="post" tal:attributes="action request/URL1">
<input type="hidden" name=":default_method" value="pt_changePrefs" />
<input type="hidden" name="encoding" value="utf-8" />
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
...
...
@@ -46,17 +45,8 @@
</td>
</tr>
<tr>
<td align="left" valign="top" colspan="4"
tal:define="width request/dtpref_cols | string:100%;
relative_width python:str(width).endswith('%')">
<td align="left" valign="top" colspan="4">
<textarea name="text:text" wrap="off" style="width: 100%;" rows="20"
tal:condition="relative_width"
tal:attributes="style string:width: $width;;;
rows request/dtpref_rows | default"
tal:content="body">Template Body</textarea>
<textarea name="text:text" wrap="off" rows="20" cols="50"
tal:condition="not:relative_width"
tal:attributes="cols width; rows request/dtpref_rows | default"
tal:content="body">Template Body</textarea>
</td>
</tr>
...
...
@@ -69,10 +59,6 @@
class="form-element" type="submit"
name="pt_editAction:method" value="Save Changes"/>
<input class="form-element" type="submit" name="height" value="Taller" />
<input class="form-element" type="submit" name="height" value="Shorter" />
<input class="form-element" type="submit" name="width" value="Wider" />
<input class="form-element" type="submit" name="width" value="Narrower" />
</div>
</td>
</tr>
...
...
src/Products/SiteAccess/www/manage_edit.dtml
View file @
ced97df9
...
...
@@ -21,16 +21,9 @@ probably need to manage Zope using its raw IP address to fix things.
(<strong>host/path</strong>),
or a set of hosts (<strong>*.host/path</strong>).
<div style="width: 100%;">
<dtml-let cols="REQUEST.get('dtpref_cols', '100%')"
rows="REQUEST.get('dtpref_rows', '20')">
<dtml-if "cols[-1]=='%'">
<textarea name="map_text:text" wrap="off" style="width: &dtml-cols;;"
<dtml-else>
<textarea name="map_text:text" wrap="off" cols="&dtml-cols;"
</dtml-if>
rows="&dtml-rows;"><dtml-in lines>&dtml-sequence-item;
<textarea name="map_text:text" wrap="off" style="width: 100%;"
rows="20"><dtml-in lines>&dtml-sequence-item;
</dtml-in></textarea>
</dtml-let>
</div>
</td>
</tr>
...
...
@@ -44,11 +37,6 @@ probably need to manage Zope using its raw IP address to fix things.
<dtml-else>
<input class="form-element" type="submit" name="SUBMIT" value="Save Changes">
</dtml-if>
<input class="form-element" type="submit" name="SUBMIT" value="Taller">
<input class="form-element" type="submit" name="SUBMIT" value="Shorter">
<input class="form-element" type="submit" name="SUBMIT" value="Wider">
<input class="form-element" type="submit" name="SUBMIT" value="Narrower">
</div>
</td>
</tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment