[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/DublinCore/Browser - MetaDataEdit.py:1.1.2.1 __init__.py:1.1.2.1 configure.zcml:1.1.2.1 edit.pt:1.1.2.1

Jim Fulton jim@zope.com
Fri, 4 Oct 2002 13:30:06 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/DublinCore/Browser
In directory cvs.zope.org:/tmp/cvs-serv10951/lib/python/Zope/App/DublinCore/Browser

Added Files:
      Tag: ZopeDublinCore-branch
	MetaDataEdit.py __init__.py configure.zcml edit.pt 
Log Message:
Commiting branch prior to merge

=== Added File Zope3/lib/python/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.
# 
##############################################################################
"""
$Id: MetaDataEdit.py,v 1.1.2.1 2002/10/04 17:30:05 jim Exp $
"""

from Zope.ComponentArchitecture import getAdapter
from Zope.App.DublinCore.IZopeDublinCore 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__



=== Added File Zope3/lib/python/Zope/App/DublinCore/Browser/__init__.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.
# 
##############################################################################


=== Added File Zope3/lib/python/Zope/App/DublinCore/Browser/configure.zcml ===
<zopeConfigure
   xmlns="http://namespaces.zope.org/zope"
   xmlns:browser="http://namespaces.zope.org/browser">

  <browser:view for="Zope.App.OFS.Annotation.IAnnotatable."
                permission="Zope.ManageContent"
                factory=".MetaDataEdit.">

    <browser:page name="EditMetaData.html"
                  template="edit.pt" />

  </browser:view>


  <browser:menuItems menu="zmi_views"
      for="Zope.App.OFS.Annotation.IAnnotatable.">
    <browser:menuItem title="Meta Data" action="@@EditMetaData.html"/>
  </browser:menuItems>

</zopeConfigure>


=== Added File Zope3/lib/python/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" >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>