[Zope3-checkins] CVS: Zope3/src/zope/app/dublincore/browser -
__init__.py:1.1 box.pt:1.1 configure.zcml:1.1 edit.pt:1.1
metadataedit.py:1.1
Philipp von Weitershausen
philikon at philikon.de
Mon Mar 1 08:26:56 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/dublincore/browser
In directory cvs.zope.org:/tmp/cvs-serv16590/dublincore/browser
Added Files:
__init__.py box.pt configure.zcml edit.pt metadataedit.py
Log Message:
Move dublincore browser views to zope.app.dublincore.browser.
=== Added File Zope3/src/zope/app/dublincore/browser/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/dublincore/browser/box.pt ===
<tal:block define="data view/edit" condition="data">
<div tal:condition="data/dctitle">
<span class="label">Title:</span>
<span tal:replace="data/dctitle" />
</div>
<div tal:condition="data/dcdescription">
<span class="label">Description:</span>
<span tal:replace="data/dcdescription" />
</div>
<div tal:condition="data/created">
<span class="label">Created:</span>
<span tal:replace="data/created">2000-01-01 01:01:01</span>
</div>
<div tal:condition="data/modified">
<span class="label">Modified:</span>
<span tal:replace="data/modified">2000-01-01 01:01:01</span>
</div>
</tal:block>
=== Added File Zope3/src/zope/app/dublincore/browser/configure.zcml ===
<zope:configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns="http://namespaces.zope.org/browser">
<pages
for="zope.app.interfaces.annotation.IAnnotatable"
permission="zope.ManageContent"
class=".metadataedit.MetaDataEdit">
<page name="EditMetaData.html" template="edit.pt"
menu="zmi_views" title="Metadata" />
<page name="MetaDataBox" template="box.pt" />
</pages>
</zope:configure>
=== Added File Zope3/src/zope/app/dublincore/browser/edit.pt ===
<html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body">
<form action="request/URL"
tal:attributes="action request/URL"
tal:define="data view/edit">
<p tal:condition="data/message"
tal:content="data/message"
i18n:translate="">Message here</p>
<div class="row">
<div class="label" i18n:translate="">Title</div>
<div class="field">
<input name="dctitle" size="50" value="Title"
tal:attributes="value data/dctitle" />
</div>
</div>
<div class="row">
<div class="label" i18n:translate="">Description</div>
<div class="field">
<textarea name="dcdescription" rows="12" cols="45"
tal:content="data/dcdescription">Blah Blah</textarea>
</div>
</div>
<div class="row">
<div class="controls">
<input type="submit" value="Refresh"
i18n:attributes="value refresh-button" />
<input type="submit" name="save" value="Save"
i18n:attributes="value save-changes-button"/>
</div>
</div>
<div class="row">
<div class="label" i18n:translate="">Created</div>
<div class="field" tal:content="data/created">2000-01-01 01:01:01</div>
</div>
<div class="row">
<div class="label" i18n:translate="">Content Last Modified</div>
<div class="field" tal:content="data/modified">2000-01-01 01:01:01</div>
</div>
<div class="row">
<div class="label" i18n:translate="">Creator</div>
<div class="field">
<span tal:repeat="creator data/creators"
tal:content="creator">Bart Simpson</span>
</div>
</div>
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/dublincore/browser/metadataedit.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Dublin Core Meta Data View
$Id: metadataedit.py,v 1.1 2004/03/01 13:26:55 philikon Exp $
"""
from datetime import datetime
from zope.app.event import publish
from zope.app.event.objectevent import ObjectAnnotationsModifiedEvent
from zope.app.i18n import ZopeMessageIDFactory as _
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.component import getAdapter
__metaclass__ = type
class MetaDataEdit:
"""Provide view for editing basic dublin-core meta-data."""
def edit(self):
request = self.request
formatter = self.request.locale.dates.getFormatter('dateTime', 'medium')
dc = getAdapter(self.context, IZopeDublinCore)
message=''
if 'dctitle' in request:
dc.title = request['dctitle']
dc.description = request['dcdescription']
publish(self.context, ObjectAnnotationsModifiedEvent(self.context))
message = _("Changed data ${datetime}")
message.mapping = {'datetime': formatter.format(datetime.utcnow())}
return {
'message': message,
'dctitle': dc.title,
'dcdescription': dc.description,
'modified': (dc.modified or dc.created) and \
formatter.format(dc.modified or dc.created) or '',
'created': dc.created and formatter.format(dc.created) or '',
'creators': dc.creators
}
More information about the Zope3-Checkins
mailing list