[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_content -
file_edit_control.py:1.1 file_edit_form.py:1.1
file_edit_template.pt:1.1 folder_edit_control.py:1.1
folder_edit_form.py:1.1 folder_edit_template.pt:1.1
full_metadata_edit_form.py:1.1
full_metadata_edit_template.pt:1.1 image_edit_control.py:1.1
image_edit_form.py:1.1 image_edit_template.pt:1.1
link_edit_control.py:1.1 link_edit_form.py:1.1
link_edit_template.pt:1.1 metadata_edit_control.py:1.1
metadata_edit_form.py:1.1 metadata_edit_template.pt:1.1
file_edit_form.pt:NONE folder_edit_form.pt:NONE
full_metadata_edit_form.pt:NONE image_edit_form.pt:NONE
link_edit_form.pt:NONE metadata_edit_form.pt:NONE
Yvo Schubbe
y.2004_ at wcm-solutions.de
Tue Jul 6 12:13:12 EDT 2004
Update of /cvs-repository/Products/CMFDefault/skins/zpt_content
In directory cvs.zope.org:/tmp/cvs-serv4875/CMFDefault/skins/zpt_content
Added Files:
file_edit_control.py file_edit_form.py file_edit_template.pt
folder_edit_control.py folder_edit_form.py
folder_edit_template.pt full_metadata_edit_form.py
full_metadata_edit_template.pt image_edit_control.py
image_edit_form.py image_edit_template.pt link_edit_control.py
link_edit_form.py link_edit_template.pt
metadata_edit_control.py metadata_edit_form.py
metadata_edit_template.pt
Removed Files:
file_edit_form.pt folder_edit_form.pt
full_metadata_edit_form.pt image_edit_form.pt
link_edit_form.pt metadata_edit_form.pt
Log Message:
- refactored edit methods, using the same pattern as for document_edit and newsitem_edit
- removed dependency on controller scripts in skins/content
=== Added File Products/CMFDefault/skins/zpt_content/file_edit_control.py ===
##parameters=file, **kw
##
from Products.CMFDefault.exceptions import ResourceLockedError
try:
context.edit(file=file)
return context.setStatus(True, 'File changed.')
except ResourceLockedError, errmsg:
return context.setStatus(False, errmsg)
=== Added File Products/CMFDefault/skins/zpt_content/file_edit_form.py ===
##parameters=change='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.file_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.file_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/edit')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.file_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/file_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Edit: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="file_edit_form" method="post" enctype="multipart/form-data"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td tal:content="context/Title">Title</td>
</tr>
<tr>
<th i18n:translate="">Description</th>
<td tal:content="context/Description">Description</td>
</tr>
<tr>
<th i18n:translate="">Content type</th>
<td tal:content="context/Format">text/html</td>
</tr>
<tr>
<th i18n:translate="">Upload file</th>
<td><input type="file" name="file" size="25" /></td>
</tr>
<tr>
<td> </td>
<td>
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Added File Products/CMFDefault/skins/zpt_content/folder_edit_control.py ===
##parameters=title, description, **kw
##
if title!=context.title or description != context.description:
context.edit(title=title, description=description)
return context.setStatus(True, 'Folder changed.')
else:
return context.setStatus(False, 'Nothing to change.')
=== Added File Products/CMFDefault/skins/zpt_content/folder_edit_form.py ===
##parameters=change='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.folder_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.folder_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/edit')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.folder_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/folder_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Edit: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="folder_edit_form" method="post"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td>
<input type="text"
name="title"
value=""
tal:attributes="value context/Title"
size="65" />
</td>
</tr>
<tr>
<th i18n:translate="">Description</th>
<td>
<textarea name="description:text" rows="5"
cols="65" wrap="soft"
tal:content="context/Description">
</textarea>
</td>
</tr>
<tr>
<td> </td>
<td>
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Added File Products/CMFDefault/skins/zpt_content/full_metadata_edit_form.py ===
##parameters=change='', change_and_edit='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/metadata'):
return
elif change_and_edit and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/metadata')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_edit', 'value': 'Change and Edit'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.full_metadata_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/full_metadata_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Resource Metadata: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="metadata_edit_form" method="post"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Enable Discussion?</th>
<td colspan="3">
<select name="allowDiscussion"
tal:define="val context/isDiscussable">
<option value="None"
tal:attributes="selected python: val == None"
i18n:translate="">Default</option>
<option value="0"
tal:attributes="selected python: val == 0"
i18n:translate="">Off</option>
<option value="1"
tal:attributes="selected python: val == 1"
i18n:translate="">On</option>
</select>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Identifier</th>
<td colspan="3"> <span tal:replace="context/Identifier"></span>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Title</th>
<td colspan="3">
<input type="text"
name="title"
value=""
size="65"
tal:attributes="value context/Title" />
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Description</th>
<td colspan="3">
<textarea name="description:text" rows="5"
cols="65" wrap="soft"
tal:content="context/Description"></textarea>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Subject</th>
<td tal:define="subj_lines python: modules['string'].join(
context.subjectsList(), '\n' )">
<textarea name="subject:lines" rows="3" cols="20"
tal:content="subj_lines"></textarea>
<br />
<select name="subject:list" multiple>
<option value=""
tal:define="
mtool context/portal_metadata;
items python: mtool.listAllowedSubjects(context);
subjects context/Subject"
tal:repeat="item items"
tal:attributes="value item; selected python: item in subjects"
tal:content="item">
</option>
</select>
</td>
<th align="right" i18n:translate="">Contributors</th>
<td tal:define="contrib_lines python: '\n'.join( context.Contributors() )">
<textarea name="contributors:lines" rows="5" cols="30"
tal:content="contrib_lines"></textarea>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Creation Date</th>
<td> <span tal:replace="context/CreationDate"></span>
</td>
<th align="right" i18n:translate="">Last Modified Date</th>
<td> <span tal:replace="context/ModificationDate"></span>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Effective Date</th>
<td>
<input type="text" name="effective_date" value=""
tal:attributes="value context/EffectiveDate" />
</td>
<th align="right" i18n:translate="">Expiration Date</th>
<td>
<input type="text" name="expiration_date" value=""
tal:attributes="value context/ExpirationDate" />
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Format</th>
<td> <input type="text" name="format" value=""
tal:attributes="value context/Format" />
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Language</th>
<td> <input type="text" name="language" value=""
tal:attributes="value context/Language" />
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Rights</th>
<td> <input type="text" name="rights" value=""
tal:attributes="value context/Rights" />
</td>
</tr>
<tr>
<td> </td>
<td colspan="3">
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Added File Products/CMFDefault/skins/zpt_content/image_edit_control.py ===
##parameters=file, **kw
##
from Products.CMFDefault.exceptions import ResourceLockedError
try:
context.edit(file=file)
return context.setStatus(True, 'Image changed.')
except ResourceLockedError, errmsg:
return context.setStatus(False, errmsg)
=== Added File Products/CMFDefault/skins/zpt_content/image_edit_form.py ===
##parameters=change='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.image_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.image_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/edit')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.image_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/image_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Edit: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="image_edit_form" method="post" enctype="multipart/form-data"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td tal:content="context/Title">Title</td>
</tr>
<tr>
<th i18n:translate="">Description</th>
<td tal:content="context/Description">Description</td>
</tr>
<tr>
<th i18n:translate="">Content type</th>
<td tal:content="context/Format">text/html</td>
</tr>
<tr>
<th i18n:translate="">Upload image</th>
<td><input type="file" name="file" size="25" /></td>
</tr>
<tr>
<td> </td>
<td>
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Added File Products/CMFDefault/skins/zpt_content/link_edit_control.py ===
##parameters=remote_url, **kw
##
from Products.CMFDefault.exceptions import ResourceLockedError
if remote_url != context.remote_url:
try:
context.edit(remote_url=remote_url)
return context.setStatus(True, 'Link changed.')
except ResourceLockedError, errmsg:
return context.setStatus(False, errmsg)
else:
return context.setStatus(False, 'Nothing to change.')
=== Added File Products/CMFDefault/skins/zpt_content/link_edit_form.py ===
##parameters=change='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.link_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.link_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/edit')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.link_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/link_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Edit: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="link_edit_form" method="post"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Title</th>
<td tal:content="context/Title">Title</td>
</tr>
<tr>
<th i18n:translate="">URL</th>
<td>
<input type="text" name="remote_url" value=""
tal:attributes="value context/remote_url" />
</td>
</tr>
<tr>
<td> </td>
<td>
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Added File Products/CMFDefault/skins/zpt_content/metadata_edit_control.py ===
##parameters=allowDiscussion=None, title=None, subject=None, description=None, contributors=None, effective_date=None, expiration_date=None, format=None, language=None, rights=None, **kw
##
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.exceptions import ResourceLockedError
dtool = getToolByName(script, 'portal_discussion')
def tuplify( value ):
if not same_type( value, () ):
value = tuple( value )
temp = filter( None, value )
return tuple( temp )
if title is None:
title = context.Title()
if subject is None:
subject = context.Subject()
else:
subject = tuplify( subject )
if description is None:
description = context.Description()
if contributors is None:
contributors = context.Contributors()
else:
contributors = tuplify( contributors )
if effective_date is None:
effective_date = context.EffectiveDate()
if expiration_date is None:
expiration_date = context.expires()
if format is None:
format = context.Format()
if language is None:
language = context.Language()
if rights is None:
rights = context.Rights()
dtool.overrideDiscussionFor(context, allowDiscussion)
try:
context.editMetadata( title=title
, description=description
, subject=subject
, contributors=contributors
, effective_date=effective_date
, expiration_date=expiration_date
, format=format
, language=language
, rights=rights
)
return context.setStatus(True, 'Metadata changed.')
except ResourceLockedError, errmsg:
return context.setStatus(False, errmsg)
=== Added File Products/CMFDefault/skins/zpt_content/metadata_edit_form.py ===
##parameters=change='', change_and_edit='', change_and_view=''
##
form = context.REQUEST.form
if change and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/metadata'):
return
elif change_and_edit and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/edit'):
return
elif change_and_view and \
context.metadata_edit_control(**form) and \
context.setRedirect(context, 'object/view'):
return
options = {}
buttons = []
target = context.getActionInfo('object/metadata')['url']
buttons.append( {'name': 'change', 'value': 'Change'} )
buttons.append( {'name': 'change_and_edit', 'value': 'Change and Edit'} )
buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
options['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return context.metadata_edit_template(**options)
=== Added File Products/CMFDefault/skins/zpt_content/metadata_edit_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>
<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Standard Resource Metadata: <tal:span
tal:content="context/Title" i18n:name="obj_title">Title</tal:span></h1>
</metal:slot>
<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="form options/form">
<div class="Desktop">
<form action="metadata_edit_form" method="post"
tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Enable Discussion?</th>
<td>
<select name="allowDiscussion"
tal:define="val context/isDiscussable">
<option value="None"
tal:attributes="selected python: val == None"
i18n:translate="">Default</option>
<option value="0"
tal:attributes="selected python: val == 0"
i18n:translate="">Off</option>
<option value="1"
tal:attributes="selected python: val == 1"
i18n:translate="">On</option>
</select>
</td>
<td colspan="2" align="right">
<a href="full_metadata_edit_form"
tal:attributes="href string:${context/absolute_url}/full_metadata_edit_form"
i18n:translate=""
>Edit all metadata</a>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Identifier</th>
<td colspan="3"> <span tal:replace="context/Identifier"></span>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Title</th>
<td colspan="3">
<input type="text"
name="title"
value=""
size="65"
tal:attributes="value context/Title" />
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Description</th>
<td colspan="3">
<textarea name="description:text" rows="5"
cols="65" wrap="soft"
tal:content="context/Description"></textarea>
</td>
</tr>
<tr valign="top">
<th align="right" i18n:translate="">Subject</th>
<td tal:define="subj_lines python: modules['string'].join(
context.subjectsList(), '\n' )">
<textarea name="subject:lines" rows="3" cols="20"
tal:content="subj_lines"></textarea>
<br />
<select name="subject:list" multiple>
<option value=""
tal:define="
mtool context/portal_metadata;
items python: mtool.listAllowedSubjects(context);
subjects context/Subject"
tal:repeat="item items"
tal:attributes="value item; selected python: item in subjects"
tal:content="item">
</option>
</select>
</td>
<th align="right" i18n:translate="">Format</th>
<td>
<input type="text" name="format" value=""
tal:attributes="value context/Format" />
</td>
</tr>
<tr>
<td> </td>
<td colspan="3">
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</td>
</tr>
</table>
</form>
</div>
</metal:slot>
</body>
</html>
=== Removed File Products/CMFDefault/skins/zpt_content/file_edit_form.pt ===
=== Removed File Products/CMFDefault/skins/zpt_content/folder_edit_form.pt ===
=== Removed File Products/CMFDefault/skins/zpt_content/full_metadata_edit_form.pt ===
=== Removed File Products/CMFDefault/skins/zpt_content/image_edit_form.pt ===
=== Removed File Products/CMFDefault/skins/zpt_content/link_edit_form.pt ===
=== Removed File Products/CMFDefault/skins/zpt_content/metadata_edit_form.pt ===
More information about the CMF-checkins
mailing list