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
117f6767
Commit
117f6767
authored
Oct 30, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add back property management templates.
parent
9f53addc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
577 additions
and
4 deletions
+577
-4
src/OFS/Folder.py
src/OFS/Folder.py
+1
-0
src/OFS/Image.py
src/OFS/Image.py
+1
-0
src/OFS/PropertyManager.py
src/OFS/PropertyManager.py
+42
-2
src/OFS/PropertySheets.py
src/OFS/PropertySheets.py
+24
-1
src/OFS/interfaces.py
src/OFS/interfaces.py
+19
-0
src/Products/PageTemplates/ZopePageTemplate.py
src/Products/PageTemplates/ZopePageTemplate.py
+3
-1
src/ofs/dtml/properties.dtml
src/ofs/dtml/properties.dtml
+303
-0
src/ofs/dtml/propertyType.dtml
src/ofs/dtml/propertyType.dtml
+135
-0
src/ofs/dtml/propertysheets.dtml
src/ofs/dtml/propertysheets.dtml
+49
-0
No files found.
src/OFS/Folder.py
View file @
117f6767
...
...
@@ -73,6 +73,7 @@ class Folder(
manage_options
=
(
ObjectManager
.
manage_options
+
PropertyManager
.
manage_options
+
RoleManager
.
manage_options
+
Item
.
manage_options
+
FindSupport
.
manage_options
...
...
src/OFS/Image.py
View file @
117f6767
...
...
@@ -111,6 +111,7 @@ class File(Persistent, Implicit, PropertyManager,
manage_options
=
(
({
'label'
:
'Edit'
,
'action'
:
'manage_main'
},
)
+
PropertyManager
.
manage_options
+
RoleManager
.
manage_options
+
Item_w__name__
.
manage_options
+
Cacheable
.
manage_options
...
...
src/OFS/PropertyManager.py
View file @
117f6767
...
...
@@ -25,6 +25,7 @@ from zExceptions import BadRequest
from
zope.interface
import
implementer
from
ZPublisher.Converters
import
type_converters
from
App.special_dtml
import
DTMLFile
from
OFS.interfaces
import
IPropertyManager
from
OFS.PropertySheets
import
DefaultPropertySheets
from
OFS.PropertySheets
import
vps
...
...
@@ -76,6 +77,22 @@ class PropertyManager(Base):
Entries in the _properties structure which do not have a 'mode' key
are assumed to have the mode 'wd' (writeable and deleteable).
To fully support property management, including the system-provided
tabs and user interfaces for working with properties, an object which
inherits from PropertyManager should include the following entry in
its manage_options structure::
{'label':'Properties', 'action':'manage_propertiesForm',}
to ensure that a 'Properties' tab is displayed in its management
interface. Objects that inherit from PropertyManager should also
include the following entry in its __ac_permissions__ structure::
('Manage properties', ('manage_addProperty',
'manage_editProperties',
'manage_delProperties',
'manage_changeProperties',)),
"""
security
=
ClassSecurityInfo
()
...
...
@@ -83,7 +100,15 @@ class PropertyManager(Base):
security
.
setPermissionDefault
(
access_contents_information
,
(
'Anonymous'
,
'Manager'
))
manage_options
=
()
manage_options
=
(
{
'label'
:
'Properties'
,
'action'
:
'manage_propertiesForm'
},
)
security
.
declareProtected
(
manage_properties
,
'manage_propertiesForm'
)
manage_propertiesForm
=
DTMLFile
(
'dtml/properties'
,
globals
(),
property_extensible_schema__
=
1
)
security
.
declareProtected
(
manage_properties
,
'manage_propertyTypeForm'
)
manage_propertyTypeForm
=
DTMLFile
(
'dtml/propertyType'
,
globals
())
title
=
''
_properties
=
(
...
...
@@ -253,6 +278,8 @@ class PropertyManager(Base):
if
type
in
type_converters
:
value
=
type_converters
[
type
](
value
)
self
.
_setProperty
(
id
.
strip
(),
value
,
type
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
security
.
declareProtected
(
manage_properties
,
'manage_editProperties'
)
def
manage_editProperties
(
self
,
REQUEST
):
...
...
@@ -271,6 +298,10 @@ class PropertyManager(Base):
else
:
value
=
REQUEST
.
form
.
get
(
name
,
''
)
self
.
_updateProperty
(
name
,
value
)
if
REQUEST
:
message
=
"Saved changes."
return
self
.
manage_propertiesForm
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
security
.
declareProtected
(
manage_properties
,
'manage_changeProperties'
)
def
manage_changeProperties
(
self
,
REQUEST
=
None
,
**
kw
):
...
...
@@ -294,6 +325,10 @@ class PropertyManager(Base):
if
'w'
not
in
propdict
[
name
].
get
(
'mode'
,
'wd'
):
raise
BadRequest
(
'%s cannot be changed'
%
escape
(
name
))
self
.
_updateProperty
(
name
,
value
)
if
REQUEST
:
message
=
"Saved changes."
return
self
.
manage_propertiesForm
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
security
.
declareProtected
(
manage_properties
,
'manage_changePropertyTypes'
)
def
manage_changePropertyTypes
(
self
,
old_ids
,
props
,
REQUEST
=
None
):
...
...
@@ -311,6 +346,8 @@ class PropertyManager(Base):
return
for
prop
in
props
:
self
.
_setProperty
(
prop
.
new_id
,
prop
.
new_value
,
prop
.
new_type
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
security
.
declareProtected
(
manage_properties
,
'manage_delProperties'
)
def
manage_delProperties
(
self
,
ids
=
None
,
REQUEST
=
None
):
...
...
@@ -321,7 +358,7 @@ class PropertyManager(Base):
ids
=
None
ids
=
REQUEST
.
get
(
'_ids'
,
ids
)
if
ids
is
None
:
raise
BadRequest
(
'No propery specified.'
)
raise
BadRequest
(
'No proper
t
y specified.'
)
propdict
=
self
.
propdict
()
nd
=
self
.
_reserved_names
for
id
in
ids
:
...
...
@@ -332,4 +369,7 @@ class PropertyManager(Base):
raise
BadRequest
(
'Cannot delete %s'
%
id
)
self
.
_delProperty
(
id
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
InitializeClass
(
PropertyManager
)
src/OFS/PropertySheets.py
View file @
117f6767
...
...
@@ -19,6 +19,7 @@ import sys
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.Permissions
import
access_contents_information
from
AccessControl.Permissions
import
manage_properties
from
AccessControl.Permissions
import
view_management_screens
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
Acquisition
import
aq_base
from
Acquisition
import
aq_parent
...
...
@@ -29,6 +30,7 @@ from zExceptions import BadRequest
from
zExceptions
import
Redirect
from
App.Management
import
Tabs
from
App.special_dtml
import
DTMLFile
from
OFS
import
bbb
from
OFS.Traversable
import
Traversable
from
ZPublisher.Converters
import
type_converters
...
...
@@ -317,6 +319,13 @@ class PropertySheet(Traversable, Persistent, Implicit, DAVPropertySheetMixin):
dict
[
p
[
'id'
]]
=
p
return
dict
manage
=
DTMLFile
(
'dtml/properties'
,
globals
())
security
.
declareProtected
(
manage_properties
,
'manage_propertiesForm'
)
def
manage_propertiesForm
(
self
,
URL1
):
" "
raise
Redirect
(
URL1
+
'/manage'
)
security
.
declareProtected
(
manage_properties
,
'manage_addProperty'
)
def
manage_addProperty
(
self
,
id
,
value
,
type
,
REQUEST
=
None
):
"""Add a new property via the web. Sets a new property with
...
...
@@ -324,6 +333,8 @@ class PropertySheet(Traversable, Persistent, Implicit, DAVPropertySheetMixin):
if
type
in
type_converters
:
value
=
type_converters
[
type
](
value
)
self
.
_setProperty
(
id
,
value
,
type
)
if
REQUEST
is
not
None
:
return
self
.
manage
(
self
,
REQUEST
)
security
.
declareProtected
(
manage_properties
,
'manage_editProperties'
)
def
manage_editProperties
(
self
,
REQUEST
):
...
...
@@ -333,6 +344,8 @@ class PropertySheet(Traversable, Persistent, Implicit, DAVPropertySheetMixin):
if
'w'
in
prop
.
get
(
'mode'
,
'wd'
):
value
=
REQUEST
.
get
(
name
,
''
)
self
.
_updateProperty
(
name
,
value
)
message
=
'Your changes have been saved.'
return
self
.
manage
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
security
.
declareProtected
(
manage_properties
,
'manage_changeProperties'
)
def
manage_changeProperties
(
self
,
REQUEST
=
None
,
**
kw
):
...
...
@@ -354,6 +367,8 @@ class PropertySheet(Traversable, Persistent, Implicit, DAVPropertySheetMixin):
if
'w'
not
in
propdict
[
name
].
get
(
'mode'
,
'wd'
):
raise
BadRequest
(
'%s cannot be changed'
%
escape
(
name
))
self
.
_updateProperty
(
name
,
value
)
message
=
'Your changes have been saved.'
return
self
.
manage
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
security
.
declareProtected
(
manage_properties
,
'manage_delProperties'
)
def
manage_delProperties
(
self
,
ids
=
None
,
REQUEST
=
None
):
...
...
@@ -364,9 +379,11 @@ class PropertySheet(Traversable, Persistent, Implicit, DAVPropertySheetMixin):
ids
=
None
ids
=
REQUEST
.
get
(
'_ids'
,
ids
)
if
ids
is
None
:
raise
BadRequest
(
'No property specified
.
'
)
raise
BadRequest
(
'No property specified'
)
for
id
in
ids
:
self
.
_delProperty
(
id
)
if
REQUEST
is
not
None
:
return
self
.
manage
(
self
,
REQUEST
)
InitializeClass
(
PropertySheet
)
...
...
@@ -457,6 +474,7 @@ class PropertySheets(Traversable, Implicit, Tabs):
if
REQUEST
is
None
:
return
ps
ps
=
self
.
get
(
id
)
REQUEST
.
RESPONSE
.
redirect
(
'%s/manage'
%
ps
.
absolute_url
())
security
.
declareProtected
(
manage_properties
,
'addPropertySheet'
)
def
addPropertySheet
(
self
,
propset
):
...
...
@@ -490,6 +508,8 @@ class PropertySheets(Traversable, Implicit, Tabs):
raise
BadRequest
(
'attempt to delete undeletable property sheet: '
+
id
)
self
.
delPropertySheet
(
id
)
if
REQUEST
is
not
None
:
REQUEST
.
RESPONSE
.
redirect
(
'%s/manage'
%
self
.
absolute_url
())
def
__len__
(
self
):
return
len
(
self
.
__propsets__
())
...
...
@@ -497,6 +517,9 @@ class PropertySheets(Traversable, Implicit, Tabs):
def
getId
(
self
):
return
self
.
id
security
.
declareProtected
(
view_management_screens
,
'manage'
)
manage
=
DTMLFile
(
'dtml/propertysheets'
,
globals
())
def
manage_options
(
self
):
"""Return a manage option data structure for me instance
"""
...
...
src/OFS/interfaces.py
View file @
117f6767
...
...
@@ -810,8 +810,27 @@ class IPropertyManager(Interface):
Entries in the _properties structure which do not have a 'mode' key
are assumed to have the mode 'wd' (writeable and deleteable).
To fully support property management, including the system-provided
tabs and user interfaces for working with properties, an object which
inherits from PropertyManager should include the following entry in
its manage_options structure::
{'label':'Properties', 'action':'manage_propertiesForm',}
to ensure that a 'Properties' tab is displayed in its management
interface. Objects that inherit from PropertyManager should also
include the following entry in its __ac_permissions__ structure::
('Manage properties', ('manage_addProperty',
'manage_editProperties',
'manage_delProperties',
'manage_changeProperties',)),
"""
manage_propertiesForm
=
Attribute
(
""" """
)
manage_propertyTypeForm
=
Attribute
(
""" """
)
title
=
BytesLine
(
title
=
u"Title"
)
_properties
=
Tuple
(
title
=
u"Properties"
)
...
...
src/Products/PageTemplates/ZopePageTemplate.py
View file @
117f6767
...
...
@@ -88,7 +88,9 @@ class ZopePageTemplate(Script, PageTemplate, Cacheable,
manage_options
=
(
{
'label'
:
'Edit'
,
'action'
:
'pt_editForm'
},
)
+
SimpleItem
.
manage_options
+
Cacheable
.
manage_options
)
+
PropertyManager
.
manage_options
+
\
SimpleItem
.
manage_options
+
\
Cacheable
.
manage_options
_properties
=
(
{
'id'
:
'title'
,
'type'
:
'ustring'
,
'mode'
:
'w'
},
...
...
src/ofs/dtml/properties.dtml
0 → 100644
View file @
117f6767
<dtml-if management_page_charset>
<dtml-comment>
A site-global encoding specification in a property.
Note that this feature only works if there are no unicode objects
around. This means that this feature is not likely to be supported
in all future versions of zope.
</dtml-comment>
<dtml-call "REQUEST.set('management_page_charset',
_['management_page_charset'])">
<dtml-call "REQUEST.set('management_page_charset_tag','')">
<dtml-else>
<dtml-comment>
Thankfully no site-global encoding specification in a property.
We can set UTF-8, and unicode properties will work.
</dtml-comment>
<dtml-call "REQUEST.set('management_page_charset','UTF-8')">
<dtml-call "REQUEST.set('management_page_charset_tag','UTF-8:')">
</dtml-if>
<dtml-if "REQUEST.get('management_page_charset',None)=='UTF-8'">
<dtml-var "u' '">
</dtml-if>
<dtml-var manage_page_header>
<dtml-with "_(management_view='Properties')">
<dtml-var manage_tabs>
</dtml-with>
<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
<dtml-if propertyMap>
<p class="form-help">
Properties allow you to assign simple values to Zope objects. To change
property values, edit the values and click "Save Changes".
</p>
<table cellspacing="0" cellpadding="2" border="0">
<tr class="list-header">
<td align="left" valign="top" width="16">
</td>
<td align="left" valign="top">
<div class="form-label">
Name
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
Value
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
Type
</div>
</td>
</tr>
<dtml-in propertyMap mapping>
<dtml-let type="not _.has_key('type') and 'string' or type"
pdesc="propertyDescription(id)"
charset_tag="REQUEST['management_page_charset_tag']">
<tr title="&dtml-pdesc;">
<td align="left" valign="top" width="16">
<dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
<input type="checkbox" name="_ids:&dtml-charset_tag;string:list"
value="&dtml-id;" id="cb-&dtml-id;" />
<dtml-else>
</dtml-if>
</td>
<td align="left" valign="top">
<div class="form-label">
<dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
<label for="cb-&dtml-id;">
<dtml-else>
<label>
</dtml-if>
<dtml-var "propertyLabel(id)" html_quote></label>
</div>
</td>
<td align="left" valign="top">
<dtml-if "'w' in _['sequence-item'].get('mode', 'awd')">
<dtml-if "type == 'int'">
<input type="text" name="&dtml-id;:&dtml-type;"
size="35" value="<dtml-if "hasProperty(id)"><dtml-var
"'%s' % getProperty(id)" html_quote></dtml-if>" />
<dtml-elif "type == 'long'">
<input type="text" name="&dtml-id;:&dtml-type;" size="35"
value="<dtml-if "hasProperty(id)"><dtml-var
"('%s' % getProperty(id))" html_quote></dtml-if>" />
<dtml-elif "type == 'date' and not _.same_type(getProperty(id), '')
and getProperty(id).timezoneNaive()">
<input type="text" name="&dtml-id;:&dtml-charset_tag;&dtml-type;" size="35"
value="<dtml-var "str(getProperty(id)).rsplit(' ', 1)[0]" html_quote>" />
<dtml-elif "type in ['date', 'float', 'string', 'ustring']">
<input type="text" name="&dtml-id;:&dtml-charset_tag;&dtml-type;" size="35"
value="<dtml-var "getProperty(id)" html_quote>" />
<dtml-elif "type=='boolean'">
<input type="checkbox" name="&dtml-id;:&dtml-type;" size="35"
<dtml-if "getProperty(id)">checked="checked"</dtml-if> />
<dtml-elif "type in ['tokens','utokens']">
<input type="text" name="&dtml-id;:&dtml-charset_tag;&dtml-type;" size="35"
value="<dtml-in "getProperty(id)">&dtml-sequence-item; </dtml-in>" />
<dtml-elif "type in ['text','utext']">
<textarea class="form-element" name="&dtml-id;:&dtml-charset_tag;&dtml-type;"
rows="6" cols="35"><dtml-var "getProperty(id)" html_quote></textarea>
<dtml-elif "type in ['lines','ulines']">
<textarea class="form-element" name="&dtml-id;:&dtml-charset_tag;&dtml-type;"
rows="6" cols="35"><dtml-in "getProperty(id)">&dtml-sequence-item;<dtml-if
sequence-end><dtml-else><dtml-var "'\n'"></dtml-if></dtml-in></textarea>
<dtml-elif "type=='selection'">
<dtml-if "hasProperty(select_variable)">
<div class="form-element">
<select name="&dtml-id;:&dtml-charset_tag;text">
<dtml-in "getProperty(select_variable)">
<option
<dtml-if "_['sequence-item']==getProperty(id)">selected="selected"</dtml-if>
>&dtml-sequence-item;</option>
</dtml-in>
</select>
</div>
<dtml-elif "_.has_key(select_variable)">
<div class="form-element">
<select name="&dtml-id;:&dtml-charset_tag;text">
<dtml-in "_[select_variable]">
<option
<dtml-if "_['sequence-item']==getProperty(id)">selected="selected"</dtml-if>
>&dtml-sequence-item;</option>
</dtml-in>
</select>
</div>
<dtml-else>
<div class="form-text">
No value for &dtml-select_variable;.
</div>
</dtml-if>
<dtml-elif "type=='multiple selection'">
<dtml-if "hasProperty(select_variable)">
<div class="form-element">
<select name="&dtml-id;:&dtml-charset_tag;list:string" multiple="multiple"
size="<dtml-var "_.min(7, _.len(getProperty(select_variable)))">">
<dtml-in "getProperty(select_variable)">
<option<dtml-if
"getProperty(id) and (_['sequence-item'] in getProperty(id))"
> selected="selected"</dtml-if
>>&dtml-sequence-item;</option>
</dtml-in>
</select>
</div>
<dtml-elif "_.has_key(select_variable)">
<div class="form-element">
<select name="&dtml-id;:&dtml-charset_tag;list:string" multiple="multiple"
size="<dtml-var "_.min(7, _.len(_[select_variable]))">">
<dtml-in "_[select_variable]">
<option<dtml-if
"getProperty(id) and (_['sequence-item'] in getProperty(id))"
> selected="selected"</dtml-if
>>&dtml-sequence-item;</option>
</dtml-in>
</select>
</div>
<dtml-else>
<div class="form-text">
No value for &dtml-select_variable;.
</div>
</dtml-if>
<dtml-else>
<em>Unknown property type</em>
</dtml-if>
<dtml-else>
<table border="1">
<tr><td><dtml-var "getProperty(id)" html_quote></td></tr>
</table>
</dtml-if>
</td>
<td align="left" valign="top">
<div class="list-item">
&dtml-type;
</div>
</td>
<dtml-if "id=='title' and 'd' in _['sequence-item'].get('mode', 'awd')">
<td align="center" valign="top">
<div class="list-item"><b>Warning:</b> be aware that removing 'title'
without re-adding it might be dangerous.</div>
</td>
</dtml-if>
</tr>
</dtml-let>
</dtml-in>
<tr>
<td colspan="2"> </td>
<td align="left" valign="top">
<div class="form-element">
<input name="manage_editProperties:method" type="submit"
class="form-element" value="Save Changes" />
<dtml-if property_extensible_schema__>
<input name="manage_delProperties:method" type="submit"
class="form-element" value="Delete" />
</div>
</td>
<td>
<dtml-comment>
This needs some community review before exposing it officially.
<input type="submit" name="manage_propertyTypeForm:method"
class="form-element" value="Change Names/Types" />
</dtml-comment>
</td>
<dtml-else>
</div>
</td>
<td> </td>
</dtml-if>
</tr>
</table>
<dtml-else>
<p class="form-help">
Properties allow you to assign simple values to Zope objects. There are
currently no properties defined for this item. <dtml-if
property_extensible_schema__>To add a property, enter a name, type
and value and click the "Add" button.
</dtml-if>
</p>
</dtml-if>
</form>
<dtml-if property_extensible_schema__>
<form action="<dtml-var "REQUEST.URL1" html_quote>/manage_addProperty"
method="post">
<p class="form-help">
To add a new property, enter a name, type and value for the new
property and click the "Add" button.
</p>
<table>
<tr>
<td align="left" valign="top">
<div class="form-label">
Name
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id:<dtml-var
"REQUEST['management_page_charset_tag']">string"
size="30" value="" />
</td>
<td align="left" valign="top" class="form-label">
Type
</td>
<td align="left" valign="top">
<div class="form-element">
<select name="type">
<option>boolean</option>
<option>date</option>
<option>float</option>
<option>int</option>
<option>lines</option>
<option>long</option>
<option selected="selected">string</option>
<option>text</option>
<option>tokens</option>
<dtml-if "REQUEST['management_page_charset'] == 'UTF-8'">
<option>ulines</option>
<option>ustring</option>
<option>utext</option>
<option>utokens</option>
</dtml-if>
<option>selection</option>
<option>multiple selection</option>
</select>
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Value
</div>
</td>
<td colspan="2" align="left" valign="top">
<dtml-if "REQUEST['management_page_charset'] == 'UTF-8'">
<input type="text" name="value:UTF-8:ustring" size="30" />
<dtml-else>
<input type="text" name="value:string" size="30" />
</dtml-if>
</td>
<td align="right" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit" value=" Add " />
</div>
</td>
</tr>
</table>
</form>
</dtml-if>
<dtml-var manage_page_footer>
src/ofs/dtml/propertyType.dtml
0 → 100644
View file @
117f6767
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html
lang=
"en"
>
<head>
<title>
Change Property Types
</title>
</head>
<body
bgcolor=
"#FFFFFF"
link=
"#000099"
vlink=
"#555555"
>
<dtml-var
manage_tabs
>
<dtml-unless
props
>
<dtml-if
ids
>
<dtml-call
expr=
"REQUEST.set('props', [])"
>
<dtml-call
expr=
"REQUEST.set('old_ids', ids)"
>
<dtml-in
propertyMap
mapping
>
<dtml-if
expr=
"id in ids"
>
<dtml-call
expr=
"props.append({'new_id': propertyLabel(id),
'new_type': type, 'new_value': getProperty(id),
'was_seq': type in ('tokens', 'lines', 'multiple selection')})"
>
</dtml-if>
</dtml-in>
</dtml-if>
</dtml-unless>
<form
action=
"<dtml-var "
REQUEST
.
URL1
"
html_quote
>
" method="POST">
<dtml-if
old_ids
>
<p>
To change property names and values, edit them and click
"
Save Changes
"
. To edit properties using their new type,
select the new types and click
"
Edit with new Types
"
</p>
<table
border=
"0"
cellspacing=
"0"
cellpadding=
"2"
>
<tr>
<td><b>
Property Name
</b></td>
<td><b>
Value
</b></td>
<td><b>
New Type
</b></td>
</tr>
<dtml-in
old_ids
>
<input
type=
"hidden"
name=
"old_ids:list"
value=
"&dtml-sequence-item;"
>
</dtml-in>
<dtml-in
props
mapping
>
<dtml-if
expr=
"new_type in ('tokens', 'lines', 'multiple selection')"
>
<input
type=
"hidden"
name=
"props.was_seq:records"
value=
"1"
>
<dtml-else>
<input
type=
"hidden"
name=
"props.was_seq:records"
value=
""
>
</dtml-if>
<dtml-let
value_name=
"'props.new_value:' + {'multiple selection': 'list',
'selection': 'string'}.get(new_type, new_type) + ':records'"
>
<tr>
<td
align=
"left"
valign=
"top"
>
<input
type=
"text"
name=
"props.new_id:records"
value=
"&dtml-new_id;"
>
</td>
<td
align=
"left"
valign=
"top"
>
<dtml-if
expr=
"new_type in ('int', 'long', 'float', 'date', 'string', 'tokens')"
>
<input
type=
"text"
name=
"&dtml-value_name;"
size=
"35"
<
dtml-if
was_seq
>
value="
<dtml-in
new_value
>
&dtml-sequence-item;
</dtml-in>
"
<dtml-elif
expr=
"new_type=='long'"
>
value="
<dtml-var
expr=
"_.str(getProperty(id))[:-1]"
html_quote
>
"
<dtml-else>
value="
&dtml-new_value;
"
</dtml-if>
>
<dtml-elif
"
new_type=
='boolean'"
>
<input
type=
"checkbox"
name=
"&dtml-value_name;"
size=
"35"
<
dtml-if
new_value
>
CHECKED
</dtml-if>
>
<dtml-elif
"
new_type
in
('
text
',
'
lines
')"
>
<textarea
name=
"&dtml-value_name;"
rows=
"6"
cols=
"35"
><dtml-if
was_seq
><dtml-in
new_value
>
&dtml-sequence-item;
<dtml-unless
sequence-end
><dtml-var
expr=
"'\n'"
></dtml-unless></dtml-in><dtml-else>
&dtml-new_value;
</dtml-if></textarea>
<dtml-elif
"
new_type=
='selection'"
>
<dtml-if
"
_
.
has_key
(
select_variable
)"
>
<select
name=
"&dtml-value_name;"
>
<dtml-in
"
_
[
select_variable
]"
>
<option
<
dtml-if
"
_
['
sequence-item
'
]=
=new_value"
>
SELECTED
</dtml-if>
>
&dtml-sequence-item;
</option>
</dtml-in>
</select>
<dtml-else>
No value for
&dtml-select_variable;
.
</dtml-if>
<dtml-elif
"
new_type=
='multiple
selection
'"
>
<dtml-if
"
_
.
has_key
(
select_variable
)"
>
<select
name=
"&dtml-value_name;"
multiple
size=
"<dtml-var "
_
.
min
(
7
,
_
.
len
(
_
[
select_variable
]))"
>
">
<dtml-in
"
_
[
select_variable
]"
>
<option
<
dtml-if
"
_
['
sequence-item
']
in
new_value
"
>
SELECTED
</dtml-if
>
>
&dtml-sequence-item;
</option>
</dtml-in>
</select>
<dtml-else>
No value for
&dtml-select_variable;
.
</dtml-if>
<dtml-else>
<em>
Unknown property type
</em>
</dtml-if>
</td>
<td>
<select
name=
"props.new_type:records"
>
<dtml-in
expr=
"('boolean', 'date', 'float', 'int', 'lines', 'long', 'string'
, 'text', 'tokens', 'selection', 'multiple selection')"
>
<dtml-let
SELECTED=
"('', 'SELECTED')[new_type==_['sequence-item']]"
>
<option
&
dtml-SELECTED
;
>
&dtml-sequence-item;
</option>
</dtml-let>
</dtml-in>
</select>
</dtml-let>
</td>
</tr>
</dtml-in>
<tr>
<td
align=
"left"
valign=
"top"
width=
"16"
>
</td>
<td
align=
"left"
valign=
"top"
colspan=
"2"
>
<input
type=
"submit"
name=
"manage_changePropertyTypes:method"
value=
"Save Changes"
>
<input
type=
"submit"
name=
"manage_propertyTypeForm:method"
value=
"Edit with new Types"
>
</td>
</tr>
</table>
<dtml-else>
<p>
No properties were selected for this item.
</p>
</dtml-if>
</form>
</body>
</html>
src/ofs/dtml/propertysheets.dtml
0 → 100644
View file @
117f6767
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<form action="<dtml-var "REQUEST.URL1" html_quote>" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<dtml-in items sort>
<dtml-with "_(REQUEST=REQUEST, item=_['sequence-item'].aq_base, isDeletable=isDeletable)" only>
<dtml-with item>
<dtml-if id>
<tr>
<td align="left" valign="top">
<dtml-if expr="isDeletable(id)"><input type=checkbox name="ids:list" value="&dtml-id;"></dtml-if>
</td>
<td align="left" valign="top">
<a href="&dtml-id;/manage">&dtml-id; <dtml-if xml_namespace>(<dtml-var xml_namespace>)</dtml-if></a>
<dtml-if locked_in_session>
<dtml-if modified_in_session>
This item has been modified in this session
<dtml-else>
This item has been modified in another session
</dtml-if>
</dtml-if>
</td>
</tr>
</dtml-if>
</dtml-with>
</dtml-with>
</dtml-in>
<tr>
<td colspan=2>
<input type="submit" name="manage_delPropertySheets:method"
class="form-element" value="Delete">
</td>
</tr>
</table>
<table cellpadding=5>
<tr>
<td><span class="form-label">Name:</span> <input name="id"></td>
<td><span class="form-label">Namespace:</span> <input name="ns"></td>
<td>
<input type="submit" name="manage_addPropertySheet:method"
class="form-element" value="Add">
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
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