[Zope3-checkins] CVS: Zope3/src/zope/app/browser/dublincore - box.pt:1.3 configure.zcml:1.8 edit.pt:1.5 metadataedit.py:1.6

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 6 11:42:27 EDT 2003


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

Modified Files:
	box.pt configure.zcml edit.pt metadataedit.py 
Log Message:
Internationalized a whole bunch templates and screens. I also took the 
oppurtunity to clean some old code up. 

I noticed that particularly the basic Content Objects are in bad shape.

There is still a lot left to do!


=== Zope3/src/zope/app/browser/dublincore/box.pt 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/dublincore/box.pt:1.2	Wed Mar  5 17:28:43 2003
+++ Zope3/src/zope/app/browser/dublincore/box.pt	Wed Aug  6 10:41:51 2003
@@ -1,22 +1,22 @@
-<tal:block define="data view/edit"
-           condition="data">
+<tal:block define="data view/edit" condition="data">
 
    <div tal:condition="data/dctitle">
-     <span class="label">Title:</span> <span tal:replace="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" />
+     <span class="label">Description:</span> 
+     <span tal:replace="data/dcdescription" />
    </div>
    <div tal:condition="data/created">
-      <!-- XXX TODO localize time format -->     
-      <span class="label">Created:</span>
-      <span tal:replace="python: data['created'].strftime('%m/%d/%Y')">2000-01-01 01:01:01</span>
+     <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="python: data['modified'].strftime('%m/%d/%Y')">2000-01-01 01:01:01</span>
+     <span class="label">Modified:</span>
+     <span tal:replace="data/modified">2000-01-01 01:01:01</span>
    </div>
 
 </tal:block>


=== Zope3/src/zope/app/browser/dublincore/configure.zcml 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/dublincore/configure.zcml:1.7	Sun Aug  3 13:48:57 2003
+++ Zope3/src/zope/app/browser/dublincore/configure.zcml	Wed Aug  6 10:41:51 2003
@@ -1,22 +1,14 @@
-<configure
-   xmlns="http://namespaces.zope.org/zope"
-   xmlns:browser="http://namespaces.zope.org/browser"
-   i18n_domain='zope'
-   >
+<configure xmlns="http://namespaces.zope.org/browser">
 
-  <browser:pages
+  <pages
       for="zope.app.interfaces.annotation.IAnnotatable"
       permission="zope.ManageContent"
-      class="zope.app.browser.dublincore.metadataedit.MetaDataEdit"
-      >
+      class=".metadataedit.MetaDataEdit">
 
-    <browser:page name="EditMetaData.html"
-                  menu="zmi_views" title="Metadata"
-                  template="edit.pt" />
+    <page name="EditMetaData.html" template="edit.pt"
+          menu="zmi_views" title="Metadata" />
+    <page name="MetaDataBox" template="box.pt" />
 
-    <browser:page name="MetaDataBox"
-                  template="box.pt" />
-
-  </browser:pages>
+  </pages>
 
 </configure>


=== Zope3/src/zope/app/browser/dublincore/edit.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/dublincore/edit.pt:1.4	Wed Jun 25 17:18:51 2003
+++ Zope3/src/zope/app/browser/dublincore/edit.pt	Wed Aug  6 10:41:51 2003
@@ -1,41 +1,58 @@
 <html metal:use-macro="views/standard_macros/page">
+<body>
+<div metal:fill-slot="body">
 
-  <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 />
+  <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>
-      </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>
-       <br />
-       <span tal:repeat="creator data/creators">
-        Creator: <span tal:replace="creator">Bart Simpson</span> <br />
-        </span>
-      </p>
+      </div>
+    </div>
 
-    </form>
+    <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>
 
-  </div>
-  </body>
+  </form>
 
+</div>
+</body>
 </html>


=== Zope3/src/zope/app/browser/dublincore/metadataedit.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/dublincore/metadataedit.py:1.5	Sat Aug  2 04:46:24 2003
+++ Zope3/src/zope/app/browser/dublincore/metadataedit.py	Wed Aug  6 10:41:51 2003
@@ -11,28 +11,25 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-"""
+"""Dublin Core Meta Data View
+
 $Id$
 """
-
-from zope.component import getAdapter
-from zope.app.interfaces.dublincore import IZopeDublinCore
 from datetime import datetime
-from zope.app.event.objectevent import ObjectAnnotationsModifiedEvent
 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 __init__(self, context, request):
-        self.context = context
-        self.request = request
-
     def edit(self):
         request = self.request
+        formatter = request.locale.getDateTimeFormatter('medium')
         dc = getAdapter(self.context, IZopeDublinCore)
         message=''
 
@@ -40,15 +37,15 @@
             dc.title = request['dctitle']
             dc.description = request['dcdescription']
             publish(self.context, ObjectAnnotationsModifiedEvent(self.context))
-            message = "Changed data %s" % datetime.utcnow()
+            message = _("Changed data ${datetime}")
+            message.mapping = {'datetime': formatter.format(datetime.utcnow())}
 
         return {
             'message': message,
             'dctitle': dc.title,
             'dcdescription': dc.description,
-            'modified': dc.modified,
-            'created': dc.created,
+            '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
             }
-
-__doc__ = MetaDataEdit.__doc__ + __doc__




More information about the Zope3-Checkins mailing list