[Zope3-checkins] CVS: Zope3/src/zope/app/browser/dublincore - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 edit.pt:1.1.2.1 metadataedit.py:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 14:31:08 -0500
Update of /cvs-repository/Zope3/src/zope/app/browser/dublincore
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/browser/dublincore
Added Files:
Tag: NameGeddon-branch
__init__.py configure.zcml edit.pt metadataedit.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/browser/dublincore/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/browser/dublincore/configure.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<browser:view for="zope.app.interfaces.annotation.IAnnotatable"
permission="Zope.ManageContent"
factory="zope.app.browser.dublincore.metadataedit.MetaDataEdit">
<browser:page name="EditMetaData.html"
template="edit.pt" />
</browser:view>
<browser:menuItems menu="zmi_views"
for="zope.app.interfaces.annotation.IAnnotatable">
<browser:menuItem title="Meta Data" action="@@EditMetaData.html"/>
</browser:menuItems>
</zopeConfigure>
=== Added File Zope3/src/zope/app/browser/dublincore/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" >Message here</p>
<p>Title: <input name="dctitle" size="50"
tal:attributes="value data/dctitle" />
</p>
<p>Description:<br />
<textarea name="dcdescription" rows="12" cols="45"
tal:content="data/dcdescription">Blah Blah</textarea>
</p>
<input type="submit" name="save" value="Save Changes" />
<p>
Created:
<span tal:replace="data/created">2000-01-01 01:01:01</span>
<br>
Content Last Modified:
<span tal:replace="data/modified">2000-01-01 01:01:01</span>
</p>
</form>
</div>
</body>
</html>
=== Added File Zope3/src/zope/app/browser/dublincore/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.
#
##############################################################################
"""
$Id: metadataedit.py,v 1.1.2.1 2002/12/23 19:31:06 jim Exp $
"""
from zope.component import getAdapter
from zope.app.interfaces.dublincore import IZopeDublinCore
from datetime import datetime
__metaclass__ = type
class MetaDataEdit:
"""Provide view for editing basic dublin-core meta-data
"""
def __init__(self, context, request):
self.context = context
self.request = request
def edit(self):
request = self.request
dc = getAdapter(self.context, IZopeDublinCore)
message=''
if 'dctitle' in request:
dc.title = request['dctitle']
dc.description = request['dcdescription']
message = "Changed data %s" % datetime.utcnow()
return {
'message': message,
'dctitle': dc.title,
'dcdescription': dc.description,
'modified': dc.modified,
'created': dc.created,
}
__doc__ = MetaDataEdit.__doc__ + __doc__