[Zope3-checkins] CVS: Zope3/src/zope/app/browser/dublincore - __init__.py:1.2 configure.zcml:1.2 edit.pt:1.2 metadataedit.py:1.2

Jim Fulton jim@zope.com
Wed, 25 Dec 2002 09:14:02 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/dublincore
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/browser/dublincore

Added Files:
	__init__.py configure.zcml edit.pt metadataedit.py 
Log Message:
Grand renaming:

- Renamed most files (especially python modules) to lower case.

- Moved views and interfaces into separate hierarchies within each
  project, where each top-level directory under the zope package
  is a separate project.

- Moved everything to src from lib/python.

  lib/python will eventually go away. I need access to the cvs
  repository to make this happen, however.

There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.



=== Zope3/src/zope/app/browser/dublincore/__init__.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:02 2002
+++ Zope3/src/zope/app/browser/dublincore/__init__.py	Wed Dec 25 09:12:31 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.


=== Zope3/src/zope/app/browser/dublincore/configure.zcml 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:02 2002
+++ Zope3/src/zope/app/browser/dublincore/configure.zcml	Wed Dec 25 09:12:31 2002
@@ -0,0 +1,22 @@
+<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>


=== Zope3/src/zope/app/browser/dublincore/edit.pt 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:02 2002
+++ Zope3/src/zope/app/browser/dublincore/edit.pt	Wed Dec 25 09:12:31 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>


=== Zope3/src/zope/app/browser/dublincore/metadataedit.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:02 2002
+++ Zope3/src/zope/app/browser/dublincore/metadataedit.py	Wed Dec 25 09:12:31 2002
@@ -0,0 +1,50 @@
+##############################################################################
+#
+# 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.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__