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

Jim Fulton jim@zope.com
Fri, 4 Oct 2002 15:05:51 -0400


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

Added Files:
	MetaDataEdit.py __init__.py configure.zcml edit.pt 
Log Message:

Added initial Dublin-Core meta-data support. This inclused a number of
interfaces, including:

  - Low level interfaces for reading and writing dublin core data in
    it's full generality, including qualifiers and repeated values.

  - A clone of the CMF DublinCore query interface with a wart fixed
    (having to do with a method that Tres and I agreed should have a
    sequence value but that has a scalar value in the CMF).

  - A number of small interfaces defining properties for common
    fields. (e.g. title, description, modified, properties).
   
Also included:

  - An adapter for managing Dublin-Core data on annotatable objects.

  - A first cut at a view for editing DC data on annotatable objects.
    This needs more thought. For example, perhaps subjects should come
    from a centralized vocabulary.

    For now, it just lets you edit title and description.

  - A pair of global event subscribers that catch creation and
    modification events and set the DC created and modified
    properties.

There's still a good bit left to do, including:

  - Sorting out how elements like type, identifier, format should be
    gotten. 

  - There should be some sort of framework for instructing the DC
    adapter to get and set some elements from the content. For
    example, some meta-data, like title or type, could simply mirror
    content data or methods.




=== Zope3/lib/python/Zope/App/DublinCore/Browser/MetaDataEdit.py 1.1 => 1.2 ===
--- /dev/null	Fri Oct  4 15:05:51 2002
+++ Zope3/lib/python/Zope/App/DublinCore/Browser/MetaDataEdit.py	Fri Oct  4 15:05:50 2002
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# 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$
+"""
+
+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__
+


=== Zope3/lib/python/Zope/App/DublinCore/Browser/__init__.py 1.1 => 1.2 ===
--- /dev/null	Fri Oct  4 15:05:51 2002
+++ Zope3/lib/python/Zope/App/DublinCore/Browser/__init__.py	Fri Oct  4 15:05:50 2002
@@ -0,0 +1,13 @@
+##############################################################################
+#
+# 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.
+# 
+##############################################################################


=== Zope3/lib/python/Zope/App/DublinCore/Browser/configure.zcml 1.1 => 1.2 ===
--- /dev/null	Fri Oct  4 15:05:51 2002
+++ Zope3/lib/python/Zope/App/DublinCore/Browser/configure.zcml	Fri Oct  4 15:05:50 2002
@@ -0,0 +1,20 @@
+<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>


=== Zope3/lib/python/Zope/App/DublinCore/Browser/edit.pt 1.1 => 1.2 ===
--- /dev/null	Fri Oct  4 15:05:51 2002
+++ Zope3/lib/python/Zope/App/DublinCore/Browser/edit.pt	Fri Oct  4 15:05:50 2002
@@ -0,0 +1,37 @@
+<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>