[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container -
add.pt:1.11 adding.py:1.14 commontasks.pt:1.5
configure.zcml:1.14 contents.pt:1.7 contents.py:1.25
find.pt:1.5 find.py:1.4 index.pt:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Aug 6 11:42:17 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv17028/app/browser/container
Modified Files:
add.pt adding.py commontasks.pt configure.zcml contents.pt
contents.py find.pt find.py index.pt
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/container/add.pt 1.10 => 1.11 ===
--- Zope3/src/zope/app/browser/container/add.pt:1.10 Mon Jun 30 13:04:41 2003
+++ Zope3/src/zope/app/browser/container/add.pt Wed Aug 6 10:41:36 2003
@@ -1,50 +1,51 @@
-<html metal:use-macro="views/standard_macros/dialog" i18n:domain="zope">
+<html metal:use-macro="views/standard_macros/dialog">
<body>
-
<div metal:fill-slot="body">
-<form action="action.html" method="post">
-<table class="TypeListing" cellpadding="3">
- <caption i18n:translate="">Add Content</caption>
+ <form action="action.html" method="post">
+ <table class="TypeListing" cellpadding="3">
+
+ <caption i18n:translate="">Add Content</caption>
+
+ <tbody tal:define="infos view/addingInfo">
- <tbody tal:define="infos view/addingInfo">
+ <tr tal:repeat="info infos">
- <tr tal:repeat="info infos">
+ <td class="Selector">
+ <input type="radio" name="type_name"
+ tal:attributes="value info/action;
+ id info/action;
+ checked python:len(infos)==1" />
+ </td>
+
+ <td class="TypeName">
+ <label style="font-weight: bold;"
+ tal:attributes="for info/action">
+ <span tal:replace="info/title" >Folder</span>
+ </label>
+ <div class="TypeDescription" tal:content="info/description">
+ Folders are generic containers for content, including other
+ folders.
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td><br /></td>
+ <td>
+ <input type="text" name="id"
+ tal:condition="view/namesAccepted"
+ tal:attributes="value request/id | nothing" />
+ <input type="submit" value=" Add "
+ i18n:attributes="value add-button" />
+ </td>
+ </tr>
- <td class="Selector">
- <input type="radio" name="type_name"
- tal:attributes="value info/action;
- id info/action;
- checked python:len(infos)==1" />
- </td>
-
- <td class="TypeName">
- <label style="font-weight: bold;"
- tal:attributes="for info/action">
- <span tal:replace="info/title" >Folder</span>
- </label>
- <div class="TypeDescription" tal:content="info/description">
- Folders are generic containers for content, including other
- folders.
- </div>
- </td>
- </tr>
-
- <tr>
- <td><br /></td>
- <td>
- <input type="text" name="id"
- tal:condition="view/namesAccepted"
- tal:attributes="value request/id | nothing"
- />
- <input type="submit" value=" Add " i18n:attributes="value" />
- </td>
- </tr>
+ </tbody>
- </tbody>
+ </table>
+ </form>
-</table>
-</form>
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/container/adding.py 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.13 Mon Aug 4 09:58:05 2003
+++ Zope3/src/zope/app/browser/container/adding.py Wed Aug 6 10:41:36 2003
@@ -11,7 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Adding View
+
+The Adding View is used to add new objects to a container. It is sort of a
+factory screen.
$Id$
"""
@@ -38,11 +41,8 @@
implements(IAdding, IPublishTraverse)
- ############################################################
- # Implementation methods for interface
- # IAdding.py
-
def add(self, content):
+ """See zope.app.interfaces.container.IAdding"""
container = zapi.getAdapter(self.context, IZopeContainer)
name = container.setObject(self.contentName, content)
return container[name]
@@ -50,6 +50,7 @@
contentName = None # usually set by Adding traverser
def nextURL(self):
+ """See zope.app.interfaces.container.IAdding"""
return (str(zapi.getView(self.context, "absolute_url", self.request))
+ '/@@contents.html')
@@ -58,7 +59,7 @@
context = None # set in BrowserView.__init__
def publishTraverse(self, request, name):
-
+ """See zope.app.interfaces.container.IAdding"""
if '=' in name:
view_name, content_name = name.split("=", 1)
self.contentName = content_name
@@ -83,10 +84,8 @@
return factory
+ # See zope.app.interfaces.container.IAdding
publishTraverse = zapi.ContextMethod(publishTraverse)
-
- #
- ############################################################
def action(self, type_name='', id=''):
if not type_name:
=== Zope3/src/zope/app/browser/container/commontasks.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/container/commontasks.pt:1.4 Thu Apr 17 12:02:36 2003
+++ Zope3/src/zope/app/browser/container/commontasks.pt Wed Aug 6 10:41:36 2003
@@ -1,16 +1,21 @@
<tal:block define="addingInfo context/@@+/addingInfo|nothing"
condition="addingInfo" i18n:domain="zope">
-<div class="content even"><strong i18n:translate="">Add new content</strong></div>
+
+ <div class="content even">
+ <strong i18n:translate="">Add new content</strong>
+ </div>
<tal:block repeat="info addingInfo">
- <div tal:define="oddrow repeat/info/odd" class="even"
- tal:attributes="class python:oddrow and 'content even' or 'content odd'">
- <a href="#"
+ <div tal:define="oddrow repeat/info/odd" class="even"
+ tal:attributes="class python:oddrow and 'content even' or 'content odd'">
+
+ <a href="#"
tal:define="baseurl python:request.getURL(1)"
- tal:attributes="href string:${baseurl}/@@contents.html?type_name=${info/action};
- class info/selected"
- tal:content="info/title" i18n:translate="">Folder
+ tal:attributes="
+ href string:${baseurl}/@@contents.html?type_name=${info/action};
+ class info/selected"
+ tal:content="info/title" i18n:translate="">Folder
</a>
- </div>
+ </div>
</tal:block>
</tal:block>
=== Zope3/src/zope/app/browser/container/configure.zcml 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/container/configure.zcml:1.13 Sun Aug 3 13:48:51 2003
+++ Zope3/src/zope/app/browser/container/configure.zcml Wed Aug 6 10:41:36 2003
@@ -1,33 +1,28 @@
-<configure
- xmlns='http://namespaces.zope.org/browser'
- i18n_domain='zope'
- >
+<configure xmlns="http://namespaces.zope.org/browser">
- <view
- for="zope.app.interfaces.container.IContentContainer"
- name="+"
- menu="zmi_actions" title="Add"
- class="zope.app.browser.container.adding.Adding"
- permission="zope.ManageContent"
- allowed_attributes="addingInfo"
- >
-
- <page name="index.html" template="add.pt" />
- <page name="action.html" attribute="action" />
-
- </view>
+ <view
+ for="zope.app.interfaces.container.IContentContainer"
+ name="+"
+ menu="zmi_actions" title="Add"
+ class="zope.app.browser.container.adding.Adding"
+ permission="zope.ManageContent"
+ allowed_attributes="addingInfo">
+
+ <page name="index.html" template="add.pt" />
+ <page name="action.html" attribute="action" />
+
+ </view>
<page
for="zope.app.interfaces.container.IReadContainer"
name="find.html"
- menu="zmi_actions"
- title="Find"
permission="zope.ManageContent"
class="zope.app.browser.container.find.Find"
- attribute="index"
- />
+ template="find.pt"
+ menu="zmi_actions" title="Find" />
- <page for="zope.app.interfaces.container.IWriteContainer"
+ <page
+ for="zope.app.interfaces.container.IWriteContainer"
permission="zope.ManageContent"
name="commonTasks"
class="zope.app.browser.container.contents.Contents"
=== Zope3/src/zope/app/browser/container/contents.pt 1.6 => 1.7 ===
--- Zope3/src/zope/app/browser/container/contents.pt:1.6 Tue Jul 1 11:27:31 2003
+++ Zope3/src/zope/app/browser/container/contents.pt Wed Aug 6 10:41:36 2003
@@ -1,16 +1,12 @@
-<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
-<head>
-<style metal:fill-slot="headers" type="text/css">
-</style>
-</head>
+<html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body">
-<div metal:define-macro="contents">
- <form name="containerContentsForm" method="POST" action="."
- tal:attributes="action request/URL"
- tal:define="container_contents view/listContentInfo"
- >
+ <div metal:define-macro="contents">
+
+ <form name="containerContentsForm" method="POST" action="."
+ tal:attributes="action request/URL"
+ tal:define="container_contents view/listContentInfo">
<input type="hidden" name="type_name" value=""
tal:attributes="value request/type_name"
@@ -23,20 +19,22 @@
<div class="page_error"
tal:condition="view/error"
- tal:content="view/error">
+ tal:content="view/error"
+ i18n:translate="">
Error message
</div>
- <table id="sortable" class="listing" summary="Content listing">
+ <table id="sortable" class="listing" summary="Content listing"
+ i18n:attributes="summary">
<thead>
<tr>
<th> </th>
- <th>Name</th>
- <th>Title</th>
- <th>Size</th>
- <th>Created</th>
- <th>Modified</th>
+ <th i18n:translate="">Name</th>
+ <th i18n:translate="">Title</th>
+ <th i18n:translate="">Size</th>
+ <th i18n:translate="">Created</th>
+ <th i18n:translate="">Modified</th>
</tr>
</thead>
@@ -101,8 +99,10 @@
tal:content="item/title|default"
> </span>
</td>
+
<td><span tal:attributes="size item/size/sizeForSorting"
- tal:content="item/size/sizeForDisplay"> </span></td>
+ tal:content="item/size/sizeForDisplay"
+ > </span></td>
<td><span tal:define="created item/created|default"
tal:content="created"> </span></td>
<td><span tal:define="modified item/modified|default"
@@ -115,23 +115,23 @@
<div tal:condition="view/normalButtons">
<input type="submit" name="container_rename_button" value="Rename"
- i18n:attributes="value container_rename_button"
+ i18n:attributes="value container-rename-button"
tal:condition="view/supportsRename"
/>
<input type="submit" name="container_cut_button" value="Cut"
- i18n:attributes="value container_cut_button"
+ i18n:attributes="value container-cut-button"
tal:condition="view/supportsCut"
/>
<input type="submit" name="container_copy_button" value="Copy"
- i18n:attributes="value container_copy_button"
+ i18n:attributes="value container-copy-button"
tal:condition="view/supportsCopy"
/>
<input type="submit" name="container_paste_button" value="Paste"
tal:condition="view/hasClipboardContents"
- i18n:attributes="value container_paste_button"
+ i18n:attributes="value container-paste-button"
/>
<input type="submit" name="container_delete_button" value="Delete"
- i18n:attributes="value container_delete_button"
+ i18n:attributes="value container-delete-button"
i18n:domain="zope"
/>
</div>
@@ -141,20 +141,20 @@
i18n:attributes="value container_apply_button"
/>
<input type="submit" name="container_cancel_button" value="Cancel"
- i18n:attributes="value container_cancel_button"
+ i18n:attributes="value container-cancel-button"
/>
</div>
- </form>
+ </form>
- <script ><!--
- prettydump('focus', LG_INFO);
- document.containerContentsForm.new_value.focus();
- //-->
- </script>
+ <script ><!--
+ prettydump('focus', LG_INFO);
+ document.containerContentsForm.new_value.focus();
+ //-->
+ </script>
+ </div>
-</div>
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/container/contents.py 1.24 => 1.25 ===
--- Zope3/src/zope/app/browser/container/contents.py:1.24 Tue Jul 1 11:27:31 2003
+++ Zope3/src/zope/app/browser/container/contents.py Wed Aug 6 10:41:36 2003
@@ -11,9 +11,9 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""View Class for the Container's Contents view.
-Revision information: $Id$
+$Id$
"""
from zope.app import zapi
@@ -314,8 +314,7 @@
return self._index()
class JustContents(Contents):
- """Like Contents, but does't delegate to item named index.html
- """
+ """Like Contents, but does't delegate to item named index.html"""
def index(self):
return self._index()
=== Zope3/src/zope/app/browser/container/find.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/container/find.pt:1.4 Wed Jun 25 14:43:03 2003
+++ Zope3/src/zope/app/browser/container/find.pt Wed Aug 6 10:41:36 2003
@@ -1,15 +1,21 @@
-<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
+<html metal:use-macro="views/standard_macros/page">
<body>
<div metal:fill-slot="body" >
-<form action="@@find.html" method="get">
-<input type="text" name="ids" value="" /><br />
-<input type="submit" name="find_submit" value=" Find " i18n:attributes="value"/>
-</form>
-<table tal:condition="request/ids | nothing">
-<tr tal:repeat="item python:view.findByIds(request['ids'])">
-<td><a href="" tal:attributes="href item/url" tal:content="item/id">id</a></td>
-</tr>
-</table>
+
+ <form action="@@find.html" method="get">
+ <input type="text" name="ids" value="" /><br />
+ <input type="submit" name="find_submit" value=" Find "
+ i18n:attributes="value find-button"/>
+ </form>
+
+ <table tal:condition="request/ids|nothing">
+ <tr tal:repeat="item python:view.findByIds(request['ids'])">
+ <td>
+ <a href="" tal:attributes="href item/url" tal:content="item/id">id</a>
+ </td>
+ </tr>
+ </table>
+
</div>
</body>
</html>
=== Zope3/src/zope/app/browser/container/find.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/container/find.py:1.3 Tue May 27 10:18:06 2003
+++ Zope3/src/zope/app/browser/container/find.py Wed Aug 6 10:41:36 2003
@@ -11,29 +11,24 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Find View Class
$Id$
"""
-
-from zope.app.interfaces.container.find import IFind
-from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.context import getInnerWrapperData
# XXX this needs to be looked up in a registry
from zope.app.container.find import SimpleIdFindFilter
-
+from zope.app.interfaces.container.find import IFind
+from zope.app.traversing import getName
from zope.component import getAdapter, getView
+from zope.context import getInnerWrapperData
from zope.publisher.browser import BrowserView
# XXX very simple implementation right now
class Find(BrowserView):
- index = ViewPageTemplateFile('find.pt')
-
def findByIds(self, ids):
- """Do a find for the ids listed in ids, which is a string.
- """
+ """Do a find for the ids listed in ids, which is a string."""
finder = getAdapter(self.context, IFind)
ids = ids.split()
# if we don't have any ids listed, don't search at all
@@ -42,15 +37,6 @@
request = self.request
result = []
for object in finder.find([SimpleIdFindFilter(ids)]):
- id = getId(object)
url = str(getView(object, 'absolute_url', request))
- result.append({ 'id': id, 'url': url})
+ result.append({ 'id': getName(object), 'url': url})
return result
-
-
-# XXX get the id of an object (should be imported from somewhere)
-def getId(object):
- dict = getInnerWrapperData(object)
- if dict:
- return dict.get('name')
- return None
=== Zope3/src/zope/app/browser/container/index.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/container/index.pt:1.4 Mon Jun 30 13:04:41 2003
+++ Zope3/src/zope/app/browser/container/index.pt Wed Aug 6 10:41:36 2003
@@ -1,26 +1,24 @@
-<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
+<html metal:use-macro="views/standard_macros/page">
<head>
-<style metal:fill-slot="headers" type="text/css">
-<!--
+ <style metal:fill-slot="headers" type="text/css">
+ <!--
+ .ContentIcon {
+ width: 20px;
+ }
-.ContentIcon {
- width: 20px;
-}
-
-.ContentTitle {
- text-align: left;
-}
--->
-</style>
+ .ContentTitle {
+ text-align: left;
+ }
+ -->
+ </style>
</head>
<body>
<div metal:fill-slot="body">
- <table
- id="sortable" class="listing" summary="Content listing"
- cellpadding="2" cellspacing="0"
- i18n:attributes="summary"
- >
+ <table
+ id="sortable" class="listing" summary="Content listing"
+ cellpadding="2" cellspacing="0"
+ i18n:attributes="summary">
<thead>
<tr>
@@ -35,14 +33,11 @@
<tbody>
<tr tal:repeat="info view/listContentInfo">
-
<td>
- <a
- href="#"
- tal:attributes="href info/url"
- tal:content="structure info/icon|default"
- >
- </a>
+ <a
+ href="#"
+ tal:attributes="href info/url"
+ tal:content="structure info/icon|default" />
</td>
<td class="ContentTitle">
@@ -72,7 +67,6 @@
</tbody>
</table>
- <br />
</div>
</body>
More information about the Zope3-Checkins
mailing list