[Zope-CVS] SVN: zope.webdev/trunk/ Initial import.

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Jan 30 04:57:02 EST 2006


Log message for revision 41494:
  Initial import.
  

Changed:
  A   zope.webdev/trunk/
  A   zope.webdev/trunk/DEPENDENCIES.cfg
  A   zope.webdev/trunk/LICENSE.txt
  A   zope.webdev/trunk/README.txt
  A   zope.webdev/trunk/SETUP.cfg
  A   zope.webdev/trunk/__init__.py
  A   zope.webdev/trunk/browser/
  A   zope.webdev/trunk/browser/__init__.py
  A   zope.webdev/trunk/browser/addform.pt
  A   zope.webdev/trunk/browser/base.py
  A   zope.webdev/trunk/browser/configure.zcml
  A   zope.webdev/trunk/browser/content.py
  A   zope.webdev/trunk/browser/content.zcml
  A   zope.webdev/trunk/browser/content_package_overview.pt
  A   zope.webdev/trunk/browser/ftests.py
  A   zope.webdev/trunk/browser/headertool.pt
  A   zope.webdev/trunk/browser/helpheadertool.pt
  A   zope.webdev/trunk/browser/icons/
  A   zope.webdev/trunk/browser/icons/add.png
  A   zope.webdev/trunk/browser/icons/collapsed.png
  A   zope.webdev/trunk/browser/icons/content.png
  A   zope.webdev/trunk/browser/icons/exit.png
  A   zope.webdev/trunk/browser/icons/expanded.png
  A   zope.webdev/trunk/browser/icons/favicon.png
  A   zope.webdev/trunk/browser/icons/help.png
  A   zope.webdev/trunk/browser/icons/package.png
  A   zope.webdev/trunk/browser/icons/page.png
  A   zope.webdev/trunk/browser/icons/rdb.png
  A   zope.webdev/trunk/browser/icons/schema.png
  A   zope.webdev/trunk/browser/icons/zope_webdev_logo.png
  A   zope.webdev/trunk/browser/leftcolumn.pt
  A   zope.webdev/trunk/browser/main_template.pt
  A   zope.webdev/trunk/browser/menu.py
  A   zope.webdev/trunk/browser/menudropdown.pt
  A   zope.webdev/trunk/browser/package.py
  A   zope.webdev/trunk/browser/package.txt
  A   zope.webdev/trunk/browser/package.zcml
  A   zope.webdev/trunk/browser/package_overview.pt
  A   zope.webdev/trunk/browser/package_overview_manager.pt
  A   zope.webdev/trunk/browser/page.py
  A   zope.webdev/trunk/browser/page.zcml
  A   zope.webdev/trunk/browser/page_package_overview.pt
  A   zope.webdev/trunk/browser/pagelet.py
  A   zope.webdev/trunk/browser/pagelet.txt
  A   zope.webdev/trunk/browser/rdb.py
  A   zope.webdev/trunk/browser/rdb.zcml
  A   zope.webdev/trunk/browser/rdb_package_overview.pt
  A   zope.webdev/trunk/browser/schema.py
  A   zope.webdev/trunk/browser/schema.zcml
  A   zope.webdev/trunk/browser/schema_package_overview.pt
  A   zope.webdev/trunk/browser/skin.py
  A   zope.webdev/trunk/browser/webdev.css
  A   zope.webdev/trunk/browser/webdev.js
  A   zope.webdev/trunk/browser/widget.css
  A   zope.webdev/trunk/configure.zcml
  A   zope.webdev/trunk/content.py
  A   zope.webdev/trunk/content.txt
  A   zope.webdev/trunk/content.zcml
  A   zope.webdev/trunk/interfaces.py
  A   zope.webdev/trunk/menu.py
  A   zope.webdev/trunk/package.py
  A   zope.webdev/trunk/package.txt
  A   zope.webdev/trunk/package.zcml
  A   zope.webdev/trunk/page.py
  A   zope.webdev/trunk/page.txt
  A   zope.webdev/trunk/page.zcml
  A   zope.webdev/trunk/rdb.zcml
  A   zope.webdev/trunk/schema.py
  A   zope.webdev/trunk/schema.txt
  A   zope.webdev/trunk/schema.zcml
  A   zope.webdev/trunk/tests.py
  A   zope.webdev/trunk/vocabulary.py
  A   zope.webdev/trunk/webdev-configure.zcml

-=-
Added: zope.webdev/trunk/DEPENDENCIES.cfg
===================================================================
--- zope.webdev/trunk/DEPENDENCIES.cfg	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/DEPENDENCIES.cfg	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,4 @@
+zope.app
+
+zope.app.sqlexpr
+zope.app.schema

Added: zope.webdev/trunk/LICENSE.txt
===================================================================
--- zope.webdev/trunk/LICENSE.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/LICENSE.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,47 @@
+=====================================
+Zope Public License (ZPL) Version 2.1
+=====================================
+
+A copyright notice accompanies this license document that identifies the
+copyright holders.
+
+This license has been certified as open source. It has also been designated as
+GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions in source code must retain the accompanying copyright
+   notice, this list of conditions, and the following disclaimer.
+
+2.  Redistributions in binary form must reproduce the accompanying copyright
+   notice, this list of conditions, and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to endorse or promote
+   products derived from this software without prior written permission from
+   the copyright holders.
+
+4. The right to distribute this software or to use it for any purpose does not
+   give you the right to use Servicemarks (sm) or Trademarks (tm) of the
+   copyright holders. Use of them is covered by separate agreement with the
+   copyright holders.
+
+5. If any files are modified, you must cause the modified files to carry
+   prominent notices stating that you changed the files and the date of any
+   change.
+
+
+Disclaimer
+----------
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Property changes on: zope.webdev/trunk/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/README.txt
===================================================================
--- zope.webdev/trunk/README.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/README.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,60 @@
+=======================
+Web Development Package
+=======================
+
+The Wweb development package provides an application for Zope 3 to develop
+components and Web applications via a Web interface. All components will be
+stored in the ZODB.
+
+Contents
+--------
+
+1. The Package -- ``package.txt``
+
+2. The Schema
+
+3. The Content Component Definition and Instance -- ``content.txt``
+
+4. The Page -- ``page.txt``
+
+
+User Stories
+------------
+
+1. Creating a Content Type
+
+   (a) Creating a Schema
+
+   (b) Creating a Content Type
+
+   (c) Setup Security
+
+   (d) Create an Add Menu Entry
+
+2. Creating Views
+
+   (a) Create an Add Form
+
+   (b) Create an Edit Form
+
+   (c) Create a Regular Page
+
+   (d) Creating and Using Macros
+
+3. Creating a Simple SQL Application
+
+   (a) Setting Up a Database Connection
+
+   (b) Creating SQL scripts
+
+   (c) Using SQL Scripts in Page Templates
+
+   (d) Using SQL Expressions in Page Templates
+
+   (e) Putting together an application
+
+4. Creating Tests
+
+   (a) Recording a Test
+
+   (b) Running Tests


Property changes on: zope.webdev/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/SETUP.cfg
===================================================================
--- zope.webdev/trunk/SETUP.cfg	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/SETUP.cfg	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,5 @@
+# Tell zpkg how to install the ZCML slugs.
+
+<data-files zopeskel/etc/package-includes>
+  webdev-*.zcml
+</data-files>

Added: zope.webdev/trunk/__init__.py
===================================================================
--- zope.webdev/trunk/__init__.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/__init__.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1 @@
+# Make a package.


Property changes on: zope.webdev/trunk/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/__init__.py
===================================================================
--- zope.webdev/trunk/browser/__init__.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/__init__.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1 @@
+# Make a package.


Property changes on: zope.webdev/trunk/browser/__init__.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/addform.pt
===================================================================
--- zope.webdev/trunk/browser/addform.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/addform.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,49 @@
+<html metal:use-macro="context/@@standard_macros/page">
+<body>
+
+<span metal:fill-slot="pagetitle" i18n:translate="">
+  Add <span tal:replace="view/label" />
+</span>
+
+<div metal:fill-slot="body">
+
+  <div class="error"
+       tal:condition="view/status"
+       tal:content="view/status" />
+
+  <form action="." tal:attributes="action request/URL" method="post"
+        enctype="multipart/form-data">
+
+    <input type="hidden" name="doEdit" value="1"
+           tal:condition="request/form/doEdit|nothing" />
+
+    <table id="form">
+      <tr tal:repeat="widget view/widgets">
+        <th class="label">
+          <label for="form.field" title="Widget's Hint"
+              tal:attributes="for widget/name;
+                              title widget/hint"
+              tal:content="widget/label" />
+        </th>
+        <td class="field">
+          <div tal:replace="structure widget" />
+        </td>
+      </tr>
+    </table>
+
+    <br />
+
+    <div id="actionsView">
+      <span class="actionButtons">
+        <input tal:repeat="action view/actions"
+               tal:replace="structure action/render"
+               />
+      </span>
+    </div>
+
+  </form>
+
+</div>
+
+</body>
+</html>


Property changes on: zope.webdev/trunk/browser/addform.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/base.py
===================================================================
--- zope.webdev/trunk/browser/base.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/base.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Some base classes of views.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.formlib import form
+from zope.app import component
+from zope.app import zapi
+from zope.app.pagetemplate import ViewPageTemplateFile
+
+class UtilityAddFormBase(form.AddForm):
+    """Add form for utilities."""
+
+    # Must be provide the interface
+    interface = None
+
+    template = ViewPageTemplateFile('addform.pt')
+
+    def add(self, object):
+        object = super(UtilityAddFormBase, self).add(object)
+
+        # Add registration
+        name = zapi.getName(object)
+        package = self.context.context
+        registration = component.site.UtilityRegistration(
+            name, self.interface, object)
+        package.registrationManager.addRegistration(registration)
+        registration.status = component.interfaces.registration.ActiveStatus
+
+        return object
+
+    def nextURL(self):
+        return zapi.absoluteURL(self.context.context, self.request)


Property changes on: zope.webdev/trunk/browser/base.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/configure.zcml
===================================================================
--- zope.webdev/trunk/browser/configure.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/configure.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,293 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    xmlns:zope="http://namespaces.zope.org/zope"
+    >
+
+  <!-- Pagelet Framework Setup -->
+
+  <zope:view
+      name="pagelets"
+      for="zope.app.publisher.interfaces.browser.IBrowserView"
+      provides="zope.app.traversing.interfaces.ITraversable"
+      type="zope.publisher.interfaces.browser.IBrowserRequest"
+      factory=".pagelet.pageletsNamespace"
+      />
+
+  <zope:adapter
+      name="pagelets"
+      for="zope.app.publisher.interfaces.browser.IBrowserView"
+      provides="zope.app.traversing.interfaces.ITraversable"
+      factory=".pagelet.pageletsNamespace"
+      />
+
+  <!-- Skin Configuration -->
+
+  <layer
+      name="webdev"
+      interface="zope.webdev.browser.skin.webdev"
+      />
+
+  <skin
+      name="WebDev"
+      interface="zope.webdev.browser.skin.WebDev"
+      />
+
+  <menu
+      id="webdev_views"
+      title="Web Development Component Views" />
+
+  <menu
+      id="webdev_actions"
+      title="Web Development Actions" />
+
+  <resource
+      name="webdev.js"
+      file="webdev.js"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <resource
+      name="webdev.css"
+      file="webdev.css"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <resource
+      name="widget.css"
+      file="widget.css"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+   <resource
+      name="favicon.png"
+      file="icons/favicon.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+   <resource
+      name="logo.png"
+      file="icons/zope_webdev_logo.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+   <resource
+      name="expanded.png"
+      file="icons/expanded.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+   <resource
+      name="collapsed.png"
+      file="icons/collapsed.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <!-- Macros -->
+
+  <page
+      for="*"
+      name="standard_macros"
+      permission="zope.View"
+      class=".skin.StandardMacros"
+      allowed_interface="zope.interface.common.mapping.IItemMapping"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <page
+      for="*"
+      name="main_template_macros"
+      permission="zope.View"
+      template="main_template.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <!-- Viewlet and Pagelet Managers -->
+
+  <viewletManager
+      name="webdev.LeftColumn"
+      provides=".skin.ILeftColumn"
+      class=".skin.LeftColumn"
+      template="leftcolumn.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      permission="zope.Public"
+      />
+
+  <viewletManager
+      name="webdev.HeaderTools"
+      provides=".skin.IHeaderTools"
+      class=".skin.HeaderTools"
+      layer="zope.webdev.browser.skin.webdev"
+      permission="zope.Public"
+      />
+
+  <!-- Standard Header Tools -->
+
+  <resource
+      name="exit.png"
+      file="icons/exit.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <viewlet
+      name="exit"
+      manager=".skin.IHeaderTools"
+      class=".skin.ExitHeaderTool"
+      template="headertool.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="100"
+      />
+
+  <resource
+      name="help.png"
+      file="icons/help.png"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <viewlet
+      name="help"
+      manager=".skin.IHeaderTools"
+      class=".skin.HelpHeaderTool"
+      template="helpheadertool.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="70"
+      />
+
+  <!-- Breadcrumbs -->
+
+  <zope:view
+      for="*"
+      name="breadcrumbs"
+      factory=".skin.Breadcrumbs"
+      type="zope.webdev.browser.skin.webdev"
+      permission="zope.Public"
+      />
+
+  <!-- Standard Left Column viewlets -->
+
+  <page
+      for=".pagelet.IPagelet"
+      name="switch.html"
+      permission="zope.View"
+      class=".skin.Switch"
+      attribute="switch"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+  <viewlet
+      name="tools"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="0"
+      menu_id="zmi_actions"
+      />
+
+  <menu
+      id="webdev_components"
+      title="Components" />
+
+  <viewlet
+      name="webdev_components"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="10"
+      menu_id="webdev_components"
+      />
+
+  <menu
+      id="webdev_browser"
+      title="Browser" />
+
+  <viewlet
+      name="webdev_browser"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="20"
+      menu_id="webdev_browser"
+      />
+
+  <menu
+      id="webdev_forms"
+      title="Forms" />
+
+  <viewlet
+      name="webdev_forms"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="30"
+      menu_id="webdev_forms"
+      />
+
+  <menu
+      id="webdev_menus"
+      title="Menus" />
+
+  <viewlet
+      name="webdev_menus"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="40"
+      menu_id="webdev_menus"
+      />
+
+  <menu
+      id="webdev_utilities"
+      title="Utilities" />
+
+  <viewlet
+      name="webdev_utilities"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="50"
+      menu_id="webdev_utilities"
+      />
+
+  <menu
+      id="webdev_testing"
+      title="Testing" />
+
+  <viewlet
+      name="webdev_testing"
+      for="..interfaces.IPackage"
+      manager=".skin.ILeftColumn"
+      class=".skin.MenuDropDown"
+      template="menudropdown.pt"
+      permission="zope.Public"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="60"
+      menu_id="webdev_testing"
+      />
+
+  <!-- Link in other configuration -->
+
+  <include file="package.zcml" />
+  <include file="schema.zcml" />
+  <include file="content.zcml" />
+  <include file="page.zcml" />
+  <include file="rdb.zcml" />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/content.py
===================================================================
--- zope.webdev/trunk/browser/content.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/content.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Content Component Definition/Instance Views
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from zope.formlib import form
+from zope.app import apidoc
+from zope.app import zapi
+
+from zope.webdev import interfaces, content
+from zope.webdev.interfaces import _
+from zope.webdev.browser import base, package
+
+class AddForm(base.UtilityAddFormBase):
+
+    label = _('Content Component Definition')
+
+    form_fields = form.Fields(interfaces.IContentComponentDefinition).select(
+        'name', 'schema')
+
+    interface = interfaces.IContentComponentDefinition
+
+    def create(self, data):
+        return content.ContentComponentDefinition(**data)
+
+
+class PackageOverview(object):
+    """A pagelet that serves as the overview of the content component
+    definitions in the package overview."""
+    zope.interface.implements(package.IPackageOverviewPagelet)
+
+    title = _('Content Component Definitions')
+
+    def icon(self):
+        return zapi.getAdapter(self.request, name='content.png')()
+
+    def definitions(self):
+        """Return PT-friendly info dictionaries for all definitions."""
+        return [
+            {'name': value.name,
+             'schema': apidoc.utilities.getPythonPath(value.schema)}
+            for value in self.context.values()
+            if interfaces.IContentComponentDefinition.providedBy(value)]


Property changes on: zope.webdev/trunk/browser/content.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/content.zcml
===================================================================
--- zope.webdev/trunk/browser/content.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/content.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,65 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    >
+
+  <icon
+      name="zmi_icon"
+      for="..interfaces.IContentComponentDefinition"
+      file="icons/content.png"
+      />
+
+  <resource
+      name="content.png"
+      image="icons/content.png" />
+
+  <!-- Register the addform -->
+
+  <page
+      for="zope.app.container.interfaces.IAdding"
+      name="AddContentComponentDefinition.html"
+      class=".content.AddForm"
+      permission="webdev.CreateContentComponentDefinition"
+      />
+
+  <menuItem
+      menu="webdev_components"
+      for="..interfaces.IPackage"
+      permission="webdev.CreateContentComponentDefinition"
+      icon="/@@/content.png"
+      title="Content Component Definition"
+      action="+/AddContentComponentDefinition.html="
+      />
+
+  <!-- Package Overview Viewlet -->
+
+  <viewlet
+      name="webdev.package.Overview.ContentComponents"
+      for="..interfaces.IPackage"
+      manager=".package.IPackageOverviewManager"
+      class=".content.PackageOverview"
+      template="content_package_overview.pt"
+      permission="webdev.ViewContentComponentDefinition"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="20"
+      />
+
+
+  <!-- Definition Overview -->
+
+  <!--page
+      for="..interfaces.IContentComponentDefinition"
+      permission="webdev.ViewContentComponentDefinition"
+      name="overview.html"
+      class=".content.Overview"
+      template="content_overview.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      menu="webdev_views"
+      title="Overview"
+      /-->
+
+  <defaultView
+      for="..interfaces.IContentComponentDefinition"
+      name="overview.html"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/content.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/content_package_overview.pt
===================================================================
--- zope.webdev/trunk/browser/content_package_overview.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/content_package_overview.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,13 @@
+<ul class="content-listing">
+  <li tal:repeat="definition view/definitions">
+    <div class="name">
+      <a href=""
+         tal:content="definition/name">
+        Person
+      </a>
+    </div>
+    <div class="details">
+      implements <tal:block replace="definition/schema" />
+    </div>
+  </li>
+</ul>


Property changes on: zope.webdev/trunk/browser/content_package_overview.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/ftests.py
===================================================================
--- zope.webdev/trunk/browser/ftests.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/ftests.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,31 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""WebDev Browser Tests
+
+$Id$
+"""
+import unittest
+import doctest
+from zope.app.testing.functional import FunctionalDocFileSuite
+
+def test_suite():
+    return unittest.TestSuite((
+        FunctionalDocFileSuite(
+            'package.txt',
+            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+            ),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: zope.webdev/trunk/browser/ftests.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/headertool.pt
===================================================================
--- zope.webdev/trunk/browser/headertool.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/headertool.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,8 @@
+<div class="headertool">
+  <a href=""
+     tal:attributes="href view/url">
+    <img src="" border="0"
+         tal:attributes="src view/icon_url" />
+    <span tal:content="view/title">Exit</span>
+  </a>
+</div>


Property changes on: zope.webdev/trunk/browser/headertool.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/helpheadertool.pt
===================================================================
--- zope.webdev/trunk/browser/helpheadertool.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/helpheadertool.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,20 @@
+<div class="headertool">
+  <a href="#" class="topmenu"
+     tal:define="url string:'${view/url}';
+                 name string:'OnlineHelp';
+                 settings string:'height=500
+                                  ,width=950
+                                  ,resizable=1
+                                  ,scrollbars=yes
+                                  ,location=no
+                                  ,status=no
+                                  ,toolbar=no
+                                  ,menubar=no'"
+     tal:attributes="
+  href python:'javascript:window.open('+ url + ',' + name + ','+ settings +')'"
+     >
+    <img src="" border="0"
+         tal:attributes="src view/icon_url" />
+    <span tal:content="view/title">Help</span>
+  </a>
+</div>


Property changes on: zope.webdev/trunk/browser/helpheadertool.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/icons/add.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/add.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/collapsed.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/collapsed.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/content.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/content.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/exit.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/exit.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/expanded.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/expanded.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/favicon.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/favicon.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/help.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/help.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/package.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/package.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/page.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/page.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/rdb.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/rdb.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/schema.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/schema.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/icons/zope_webdev_logo.png
===================================================================
(Binary files differ)


Property changes on: zope.webdev/trunk/browser/icons/zope_webdev_logo.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: zope.webdev/trunk/browser/leftcolumn.pt
===================================================================
--- zope.webdev/trunk/browser/leftcolumn.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/leftcolumn.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,46 @@
+<tal:block repeat="viewlet view/viewlets">
+<div class="slotbox"
+     tal:define="
+         show viewlet/state/expanded|nothing;
+         url request/URL;
+         managerName view/__name__;
+         viewletName viewlet/__name__;
+         elementId string:${managerName}*${viewletName}">
+
+  <div class="header">
+    <div class="title" tal:content="viewlet/title">Tools</div>
+    <div class="controller">
+
+      <img src="expanded.png" id=".switcher" onClick=""
+           tal:condition="show"
+           tal:attributes="
+               id string:${elementId}.switcher;
+               src context/++resource++expanded.png;
+               onClick string:javascript:switchDisplay('${elementId}', '$url')"
+               />
+
+      <img src="collapsed.png" id=".switcher" onClick=""
+           tal:condition="not:show"
+           tal:attributes="
+               id string:${elementId}.switcher;
+               src context/++resource++collapsed.png;
+               onClick string:javascript:switchDisplay('${elementId}', '$url')"
+           />
+
+    </div>
+  </div>
+
+  <div id="name" class="body" style="display:;"
+       tal:condition="show"
+       tal:attributes="id elementId">
+    <div tal:replace="structure viewlet">Contents</div>
+  </div>
+
+  <div id="name" class="body" style="display: none;"
+       tal:condition="not:show"
+       tal:attributes="id elementId">
+    <div tal:replace="structure viewlet">Contents</div>
+  </div>
+
+</div>
+</tal:block>


Property changes on: zope.webdev/trunk/browser/leftcolumn.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/main_template.pt
===================================================================
--- zope.webdev/trunk/browser/main_template.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/main_template.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,95 @@
+<metal:block define-macro="page"><metal:block define-slot="doctype"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></metal:block>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xml:lang="en" lang="en"
+      i18n:domain="webdev">
+<head>
+  <title metal:define-slot="title">
+    Zope 3 WebDev
+  </title>
+
+  <script type="text/javascript" src="webdev.js"
+          tal:attributes="src string:${context/++resource++webdev.js}" >
+  </script>
+
+  <style type="text/css" media="all"
+         tal:content="string:@import url(${context/++resource++webdev.css});">
+    @import url(webdev.css);
+  </style>
+
+  <style type="text/css" media="all"
+         tal:content="string:@import url(${context/++resource++widget.css});">
+    @import url(widget.css);
+  </style>
+
+  <link rel="icon" type="image/png"
+        tal:attributes="href context/++resource++favicon.png" />
+</head>
+
+<body>
+
+  <table id="layout">
+    <tr class="head">
+      <td class="logo">
+        <img width="107" height="38"
+             tal:attributes="src context/++resource++logo.png" />
+      </td>
+      <td align="center">
+        <div id="page-title">
+          <span metal:define-slot="pagetitle">
+            Page Title
+          </span>
+        </div>
+        <div id="breadcrumbs" metal:define-slot="breadcrumbs">
+          <span tal:repeat="crumb context/@@breadcrumbs/allcrumbs">
+            <span tal:replace="structure crumb/icon|default" />
+            <a href=""
+                tal:attributes="href string:${crumb/url}/">
+              <span tal:replace="crumb/name" />
+            </a>
+            <span class="separator" tal:condition="not:repeat/crumb/end">
+              &raquo;
+            </span>
+          </span>
+        </div>
+      </td>
+      <td id="headertools" class="headertools" width="10%">
+        <tal:block replace="structure provider:webdev.HeaderTools" />
+      </td>
+    </tr>
+    <tr class="content">
+      <td class="navigation">
+        <div id="slotbox">
+          <tal:block replace="structure provider:webdev.LeftColumn" />
+        </div>
+        <div id="credits">
+          Zope 3 WebDev User Interface <br />
+          Version: pre-alpha
+        </div>
+      </td>
+      <td id="content" colspan="2">
+        <!-- context menu (webdev_views) just visible in view template -->
+        <div id="contextmenu"
+             tal:define="views context/@@view_get_menu/webdev_views"
+             tal:condition="views">
+          <span tal:repeat="view views">
+            <a href=""
+               tal:attributes="href view/action;
+                               class view/selected;"
+               tal:content="view/title"
+               i18n:translate="">label</a>
+          </span>
+        </div>
+        <!-- content area -->
+        <div metal:define-slot="message" id="message" />
+        <div id="content-body">
+          <div metal:define-slot="body">Page Content</div>
+        </div>
+        <div id="footer" metal:define-macro="footer" />
+      </td>
+    </tr>
+  </table>
+
+</body>
+</html>
+</metal:block>


Property changes on: zope.webdev/trunk/browser/main_template.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/menu.py
===================================================================
--- zope.webdev/trunk/browser/menu.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/menu.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,24 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""WebDev Menu Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+
+from zope.formlib import form
+
+class MenuAddForm:
+    pass


Property changes on: zope.webdev/trunk/browser/menu.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/menudropdown.pt
===================================================================
--- zope.webdev/trunk/browser/menudropdown.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/menudropdown.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,15 @@
+<span tal:repeat="menuitem view/menuItems" tal:omit-tag="">
+  <div class="even"
+       tal:define="oddrow repeat/menuitem/odd"
+       tal:attributes="class python:oddrow and 'content even' or 'content odd'">
+    <a href=""
+      tal:attributes="href menuitem/action;
+                      class menuitem/selected;">
+      <img class="itemicon"
+           tal:condition="menuitem/icon"
+           tal:attributes="src menuitem/icon" />
+      &nbsp;
+      <span tal:content="menuitem/title" />
+    </a>
+  </div>
+</span>


Property changes on: zope.webdev/trunk/browser/menudropdown.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/package.py
===================================================================
--- zope.webdev/trunk/browser/package.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/package.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,123 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Package Browser Code.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import datetime
+import pytz
+
+import zope.event
+import zope.interface
+import zope.schema
+import zope.app.event.objectevent
+from zope import viewlet
+from zope.formlib import form
+from zope.interface.common import idatetime
+from zope.app import zapi
+from zope.app.pagetemplate import ViewPageTemplateFile
+from zope.webdev import interfaces
+from zope.webdev.browser import pagelet
+
+from zope.webdev.interfaces import _
+
+def haveEditFlag(form, action):
+    if 'doEdit' in form.request:
+        return True
+    return False
+
+class Overview(form.EditForm):
+    """Package Overview."""
+
+    form_fields = form.Fields(interfaces.IPackage).select(
+        'docstring', 'version', 'license', 'author')
+    template = ViewPageTemplateFile('package_overview.pt')
+
+    def fixUpWidgets(self):
+        self.widgets.get('docstring').height = 3
+
+    def setUpWidgets(self, ignore_request=False):
+        for_display = True
+        if 'doEdit' in self.request:
+            for_display = False
+
+        self.adapters = {}
+        self.widgets = form.setUpEditWidgets(
+            self.form_fields, self.prefix, self.context, self.request,
+            adapters=self.adapters, for_display=for_display,
+            ignore_request=ignore_request
+            )
+        if not for_display:
+            self.fixUpWidgets()
+
+    @form.action(_("Edit"), condition=lambda *args: not haveEditFlag(*args))
+    def handleStartEditAction(self, action, data):
+        self.request.form['doEdit'] = True
+        self.setUpWidgets()
+
+    @form.action(_("Apply"), condition=haveEditFlag)
+    def handleEditAction(self, action, data):
+        del self.request.form['doEdit']
+
+        if form.applyChanges(self.context, self.form_fields,
+                             data, self.adapters):
+            zope.event.notify(
+                zope.app.event.objectevent.ObjectModifiedEvent(self.context))
+            formatter = self.request.locale.dates.getFormatter(
+                'dateTime', 'medium')
+
+            try:
+                time_zone = idatetime.ITZInfo(self.request)
+            except TypeError:
+                time_zone = pytz.UTC
+
+            status = _("Updated on ${date_time}",
+                       mapping={'date_time':
+                                formatter.format(
+                                   datetime.datetime.now(time_zone)
+                                   )
+                        }
+                       )
+            self.status = status
+        else:
+            self.status = _('No changes')
+
+    @form.action(_("Cancel"), condition=haveEditFlag)
+    def handleCancelAction(self, action, data):
+        del self.request.form['doEdit']
+
+
+class IPackageOverviewManager(pagelet.IPageletManager):
+    """A pagelet manager to display contents of a package."""
+
+
+class IPackageOverviewPagelet(pagelet.IPagelet):
+    """A pagelet that is displayed in the package overview pagelet manager."""
+
+    title = zope.schema.TextLine(
+        title=u'Title',
+        description=u'The title of the pagelet.',
+        required=True)
+
+
+class PackageOverviewManager(pagelet.PageletManagerBase,
+                             viewlet.manager.ViewletManagerBase):
+    """Ordered pagelet manager."""
+    zope.interface.implements(IPackageOverviewManager)
+
+    def sort(self, viewlets):
+        """Sort the viewlets on their weight."""
+        return sorted(viewlets,
+                      lambda x, y: cmp(int(x[1].weight), int(y[1].weight)))


Property changes on: zope.webdev/trunk/browser/package.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/package.txt
===================================================================
--- zope.webdev/trunk/browser/package.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/package.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,49 @@
+==============================
+Package Browser User Interface
+==============================
+
+Let's first connect to the site and log in as a manager, since this role has
+all permissions.
+
+  >>> from zope.testbrowser import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+  >>> browser.open('http://localhost/manage')
+
+Since packages manage non-content components, they are developed in the
+site-management section.
+
+  >>> browser.getLink('Manage Site').click()
+
+However, packages are not site-management folder, but registerable containers
+in their own right. Thus, you should now be able to add a new pacakge:
+
+  >>> browser.getLink('WebDev Package')
+  <Link text='WebDev Package' url='...ion.html?type_name=AddWebDevPackage.html'>
+
+By clicking the above link,
+
+  >>> browser.getLink('WebDev Package').click()
+
+you will be presented with the package add-form. All of the fields you are
+seeing are optional. Really, the most important field is the object name,
+since it will be the package name.
+
+  >>> browser.getControl('Docstring').value = u'My first package.'
+  >>> browser.getControl('Version').value = u'pre-alpha'
+  >>> browser.getControl('License').value = u'GPL'
+  >>> browser.getControl('Author').value = u'Stephan Richter'
+
+  >>> browser.getControl(name='add_input_name').value = u'first'
+
+  >>> browser.getControl('Add').click()
+
+You are now brought back to the site manager contents screen and you should
+see your package:
+
+  >>> browser.getLink('first')
+  <Link text='first' url='.../++etc++site/first/@@SelectedManagementView.html'>
+
+
+Overview Screen
+---------------


Property changes on: zope.webdev/trunk/browser/package.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/package.zcml
===================================================================
--- zope.webdev/trunk/browser/package.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/package.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,69 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    >
+
+  <icon
+      name="zmi_icon"
+      for="..interfaces.IPackage"
+      file="icons/package.png"
+      />
+
+  <!-- Provide an adding view for the package -->
+
+  <containerViews
+      for="..interfaces.IPackage"
+      add="webdev.ManagePackage"
+      />
+
+  <icon
+      name="zmi_icon"
+      for="zope.app.container.interfaces.IAdding"
+      file="icons/add.png"
+      />
+
+  <!-- Register the addform -->
+
+  <addform
+      label="WebDev Package"
+      name="AddWebDevPackage.html"
+      schema="..interfaces.IPackage"
+      fields="docstring version license author"
+      content_factory="..package.Package"
+      permission="webdev.CreatePackage"
+      />
+
+  <addMenuItem
+      class="..package.Package"
+      title="WebDev Package"
+      description="Add a WebDev Package"
+      permission="webdev.CreatePackage"
+      view="AddWebDevPackage.html"
+      />
+
+  <!-- Package Overview -->
+
+  <viewletManager
+      name="webdev.package.Overview"
+      provides=".package.IPackageOverviewManager"
+      class=".package.PackageOverviewManager"
+      template="package_overview_manager.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      permission="zope.Public"
+      />
+
+  <page
+      for="..interfaces.IPackage"
+      permission="webdev.ViewPackage"
+      name="overview.html"
+      class=".package.Overview"
+      layer="zope.webdev.browser.skin.webdev"
+      menu="webdev_views"
+      title="Overview"
+      />
+
+  <defaultView
+      for="..interfaces.IPackage"
+      name="overview.html"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/package.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/package_overview.pt
===================================================================
--- zope.webdev/trunk/browser/package_overview.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/package_overview.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,51 @@
+<html metal:use-macro="context/@@standard_macros/view">
+<body>
+
+<span metal:fill-slot="pagetitle">Package Overview</span>
+
+<div metal:fill-slot="body">
+
+  <div class="error"
+       tal:condition="view/status"
+       tal:content="view/status" />
+
+  <form action="." tal:attributes="action request/URL" method="post"
+        enctype="multipart/form-data">
+
+    <input type="hidden" name="doEdit" value="1"
+           tal:condition="request/form/doEdit|nothing" />
+
+    <table id="form">
+      <tr tal:repeat="widget view/widgets">
+        <th class="label">
+          <label for="form.field" title="Widget's Hint"
+              tal:attributes="for widget/name;
+                              title widget/hint"
+              tal:content="widget/label" />
+        </th>
+        <td class="field">
+          <div tal:replace="structure widget" />
+        </td>
+      </tr>
+    </table>
+
+    <br />
+
+    <div id="actionsView">
+      <span class="actionButtons">
+        <input tal:repeat="action view/actions"
+               tal:replace="structure action/render"
+               />
+      </span>
+    </div>
+
+  </form>
+
+  <br />
+
+  <tal:block replace="structure provider:webdev.package.Overview" />
+
+</div>
+
+</body>
+</html>


Property changes on: zope.webdev/trunk/browser/package_overview.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/package_overview_manager.pt
===================================================================
--- zope.webdev/trunk/browser/package_overview_manager.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/package_overview_manager.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,21 @@
+<div class="overview" tal:repeat="viewlet view/viewlets">
+  <div class="header">
+    <img src="" style="vertical-align: bottom"
+         tal:attributes="src viewlet/icon" />
+
+    <span tal:content="viewlet/title">Utilities</span>
+
+    <img src="expanded.png" style="vertical-align: bottom; float: right"
+         tal:attributes="src context/++resource++expanded.png" />
+
+  </div>
+  <div class="body">
+    <div tal:replace="structure viewlet">Contents</div>
+
+    <div style="margin-top: 0.8em">
+      <input type="submit" value="Rename" />
+      <input type="submit" value="Delete" />
+    </div>
+  </div>
+  <br/>
+</div>


Property changes on: zope.webdev/trunk/browser/package_overview_manager.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/page.py
===================================================================
--- zope.webdev/trunk/browser/page.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/page.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,61 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Schema Views
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from zope.formlib import form
+from zope.app import zapi
+from zope.app import apidoc
+
+from zope.webdev import interfaces, page
+from zope.webdev.browser import base, package
+from zope.webdev.interfaces import _
+
+class AddForm(base.UtilityAddFormBase):
+
+    label = _('Page')
+
+    form_fields = form.Fields(interfaces.IPage).select(
+        'name', 'for_')
+
+    interface = interfaces.IPage
+
+    def create(self, data):
+        return page.Page(**data)
+
+
+class PackageOverview(object):
+    """A pagelet that serves as the overview of pages in the package
+    overview."""
+    zope.interface.implements(package.IPackageOverviewPagelet)
+
+    title = _("Pages")
+
+    def icon(self):
+        return zapi.getAdapter(self.request, name='page.png')()
+
+    def pages(self):
+        """Return PT-friendly info dictionaries for all pages."""
+        pages = []
+        for page in self.context.values():
+            if interfaces.IPage.providedBy(page):
+                pages.append(
+                    {'name': page.name,
+                     'for':  apidoc.utilities.getPythonPath(page.for_)})
+
+        return pages


Property changes on: zope.webdev/trunk/browser/page.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/page.zcml
===================================================================
--- zope.webdev/trunk/browser/page.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/page.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,65 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    >
+
+  <icon
+      name="zmi_icon"
+      for="..interfaces.IPage"
+      file="icons/page.png"
+      />
+
+  <resource
+      name="page.png"
+      image="icons/page.png" />
+
+  <!-- Register the addform -->
+
+  <page
+      for="zope.app.container.interfaces.IAdding"
+      name="AddPage.html"
+      class=".page.AddForm"
+      permission="webdev.CreatePage"
+      />
+
+  <menuItem
+      menu="webdev_browser"
+      for="..interfaces.IPackage"
+      permission="webdev.CreatePage"
+      icon="/@@/page.png"
+      title="Page"
+      action="+/AddPage.html="
+      />
+
+  <!-- Package Overview Viewlet -->
+
+  <viewlet
+      name="webdev.package.Overview.Page"
+      for="..interfaces.IPackage"
+      manager=".package.IPackageOverviewManager"
+      class=".page.PackageOverview"
+      template="page_package_overview.pt"
+      permission="webdev.ViewPage"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="40"
+      />
+
+
+  <!-- Definition Overview -->
+
+  <!--page
+      for="..interfaces.ISchema"
+      permission="webdev.Schema"
+      name="overview.html"
+      class=".content.Overview"
+      template="content_overview.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      menu="webdev_views"
+      title="Overview"
+      /-->
+
+  <defaultView
+      for="..interfaces.IPage"
+      name="overview.html"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/page.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/page_package_overview.pt
===================================================================
--- zope.webdev/trunk/browser/page_package_overview.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/page_package_overview.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,14 @@
+<ul class="content-listing">
+  <li tal:repeat="page view/pages">
+    <div class="name">
+      <a href=""
+         tal:content="page/name">
+        index.html
+      </a>
+    </div>
+    <div class="details">
+      for:
+        <span tal:replace="page/for" />
+    </div>
+  </li>
+</ul>


Property changes on: zope.webdev/trunk/browser/page_package_overview.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/pagelet.py
===================================================================
--- zope.webdev/trunk/browser/pagelet.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/pagelet.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,90 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Simple Pagelet Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.component
+import zope.contentprovider
+import zope.interface
+import zope.security.proxy
+import zope.viewlet
+from persistent.dict import PersistentDict
+from zope.app import annotation
+from zope.app import container
+from zope.app.component import hooks
+
+PAGELET_MANAGER_KEY = 'zope.webdev.pageletmanagaer'
+
+
+class IPagelet(zope.viewlet.interfaces.IViewlet):
+    """A viewlet that knows about its state."""
+
+    state = zope.interface.Attribute('State of the pagelet')
+
+
+class IPageletManager(zope.viewlet.interfaces.IViewletManager,
+                      container.interfaces.ISimpleReadContainer):
+    """A viewlet manager that can be traversed and store the state of its
+    viewlets."""
+
+    def getState(name):
+        """Get the state object for the named pagelet."""
+
+
+class PageletManagerBase(object):
+    """A class that must be used as a base class in combination with an object
+    implementing ``IViewletManager``."""
+
+    def getState(self, name):
+        """See IPageletManager."""
+        site = hooks.getSite()
+        # get the pagelet manager annotations; they are stored in the site.
+        ann = annotation.interfaces.IAnnotations(site)
+        if not ann.has_key(PAGELET_MANAGER_KEY):
+            ann[PAGELET_MANAGER_KEY] = PersistentDict()
+        # get the state object.
+        states = ann[PAGELET_MANAGER_KEY]
+        if not states.has_key(name):
+            states[name] = PersistentDict()
+
+        return states[name]
+
+
+class pageletsNamespace(object):
+    """Used to traverse to a pagelet manager."""
+    def __init__(self, ob, request=None):
+        if request is None:
+            # the object *must* be a view
+            request = ob.request
+        self.view = ob
+        naked = zope.security.proxy.removeSecurityProxy(ob)
+        self.context = naked.context
+        self.request = request
+
+    def traverse(self, name, ignore):
+        if not name:
+            raise ValueError('A pagelet manager name is required.')
+
+        manager = zope.component.queryMultiAdapter(
+            (self.context, self.request, self.view), IPageletManager, name)
+
+        # Provide a useful error message, if the manager was not found.
+        if manager is None:
+            raise \
+              zope.contentprovider.interfaces.ContentProviderLookupError(name)
+
+        return manager


Property changes on: zope.webdev/trunk/browser/pagelet.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/pagelet.txt
===================================================================
--- zope.webdev/trunk/browser/pagelet.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/pagelet.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,3 @@
+======================
+Pagelet Implementation
+======================


Property changes on: zope.webdev/trunk/browser/pagelet.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/rdb.py
===================================================================
--- zope.webdev/trunk/browser/rdb.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/rdb.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,76 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Content Component Definition/Instance Views
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from zope.formlib import form
+from zope.schema import Choice
+from zope.schema import TextLine
+from zope.app import zapi
+from zope.app.rdb.interfaces import IManageableZopeDatabaseAdapter
+
+from zope.webdev.interfaces import _
+from zope.webdev.browser import base, package
+
+
+class AddForm(base.UtilityAddFormBase):
+
+    label = _('Database adapter')
+
+    form_fields = form.fields(
+        TextLine(__name__='name',
+            title=_("Name"),
+            description=_("The name under which the utility will added and registred."),
+            readonly=False,
+            required=True,
+            default=u''),
+        Choice(__name__='factory',
+            title = _(u"Database Adapter"),
+            description = _(u"Select a database adapter factory."),
+            required = True,
+            vocabulary = "WebDev Database Adapter Factories"),
+        IManageableZopeDatabaseAdapter
+        ).select('name', 'dsn', 'factory')
+
+    interface = IManageableZopeDatabaseAdapter
+
+    def create(self, data):
+        factory = data.get('factory', None)
+        self.context.contentName = data.get('name', None)
+        dsn = data.get('dsn', '')
+        if IManageableZopeDatabaseAdapter not in factory.getInterfaces():
+            raise TypeError("%s is not a IManageableZopeDatabaseAdapter" % factory)
+        return factory(dsn)
+
+
+class PackageOverview(object):
+    """A pagelet that serves as the overview of the database adapters in the 
+    package overview."""
+    zope.interface.implements(package.IPackageOverviewPagelet)
+
+    title = _('Database adapters')
+
+    def icon(self):
+        return zapi.getAdapter(self.request, name='rdb.png')()
+
+    def definitions(self):
+        """Return PT-friendly info dictionaries for all database adapters."""
+        return [
+            {'name': zapi.getName(value), 'dsn': value.dsn}
+            for value in self.context.values()
+            if IManageableZopeDatabaseAdapter.providedBy(value)]


Property changes on: zope.webdev/trunk/browser/rdb.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/rdb.zcml
===================================================================
--- zope.webdev/trunk/browser/rdb.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/rdb.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,54 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    >
+
+  <!-- TODO: we sould move this to the zope.app.rdb package or use a layer
+       otherwise we could run into a duplicated registration -->
+  <icon
+      name="zmi_icon"
+      for="zope.app.rdb.interfaces.IManageableZopeDatabaseAdapter"
+      file="icons/rdb.png"
+      />
+
+  <resource
+      name="rdb.png"
+      image="icons/rdb.png" />
+
+  <!-- Register the addform -->
+
+  <page
+      for="zope.app.container.interfaces.IAdding"
+      name="AddDatabaseAdapter.html"
+      class=".rdb.AddForm"
+      permission="webdev.CreateDatabaseAdapter"
+      />
+
+  <menuItem
+      menu="webdev_utilities"
+      for="..interfaces.IPackage"
+      permission="webdev.CreateDatabaseAdapter"
+      icon="/@@/rdb.png"
+      title="Database adapter"
+      action="+/AddDatabaseAdapter.html="
+      />
+
+  <!-- Package Overview Viewlet -->
+
+  <viewlet
+      name="webdev.package.Overview.DatabaseAdapter"
+      for="..interfaces.IPackage"
+      manager=".package.IPackageOverviewManager"
+      class=".rdb.PackageOverview"
+      template="rdb_package_overview.pt"
+      permission="webdev.ViewDatabaseAdapter"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="20"
+      />
+
+  <defaultView
+      for="zope.app.rdb.interfaces.IManageableZopeDatabaseAdapter"
+      name="overview.html"
+      layer="zope.webdev.browser.skin.webdev"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/rdb.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/rdb_package_overview.pt
===================================================================
--- zope.webdev/trunk/browser/rdb_package_overview.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/rdb_package_overview.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,13 @@
+<ul class="content-listing">
+  <li tal:repeat="definition view/definitions">
+    <div class="name">
+      <a href=""
+         tal:content="definition/name">
+        Name
+      </a>
+    </div>
+    <div class="details">
+      dsn <tal:block replace="definition/dsn" />
+    </div>
+  </li>
+</ul>


Property changes on: zope.webdev/trunk/browser/rdb_package_overview.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/schema.py
===================================================================
--- zope.webdev/trunk/browser/schema.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/schema.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,65 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Schema Views
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from zope.formlib import form
+from zope.app import zapi
+
+from zope.webdev import interfaces, schema
+from zope.webdev.browser import base, package
+from zope.webdev.interfaces import _
+
+class AddForm(base.UtilityAddFormBase):
+
+    label = _('Schema')
+
+    form_fields = form.Fields(interfaces.ISchema).select(
+        'name', 'docstring', 'bases')
+
+    interface = interfaces.ISchema
+
+    def create(self, data):
+        return schema.Schema(**data)
+
+
+class PackageOverview(object):
+    """A pagelet that serves as the overview of schemas in the package
+    overview."""
+    zope.interface.implements(package.IPackageOverviewPagelet)
+
+    title = _('Schemas')
+
+    def icon(self):
+        return zapi.getAdapter(self.request, name='schema.png')()
+
+    def schemas(self):
+        """Return PT-friendly info dictionaries for all schemas."""
+        schemas = []
+        for schema in self.context.values():
+            if interfaces.ISchema.providedBy(schema):
+                fields = [
+                    {'name': name,
+                     'type': field.__class__.__name__}
+                    for name, field in schema.namesAndDescriptions()]
+                schemas.append(
+                    {'name': schema.name,
+                     'bases': [base.getName() for base in schema.getBases()],
+                     'fields': fields})
+
+        return schemas


Property changes on: zope.webdev/trunk/browser/schema.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/schema.zcml
===================================================================
--- zope.webdev/trunk/browser/schema.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/schema.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,65 @@
+<configure
+    xmlns="http://namespaces.zope.org/browser"
+    >
+
+  <icon
+      name="zmi_icon"
+      for="..interfaces.ISchema"
+      file="icons/schema.png"
+      />
+
+  <resource
+      name="schema.png"
+      image="icons/schema.png" />
+
+  <!-- Register the addform -->
+
+  <page
+      for="zope.app.container.interfaces.IAdding"
+      name="AddSchema.html"
+      class=".schema.AddForm"
+      permission="webdev.CreateSchema"
+      />
+
+  <menuItem
+      menu="webdev_components"
+      for="..interfaces.IPackage"
+      permission="webdev.CreateSchema"
+      icon="/@@/schema.png"
+      title="Schema"
+      action="+/AddSchema.html="
+      />
+
+  <!-- Package Overview Viewlet -->
+
+  <viewlet
+      name="webdev.package.Overview.Schema"
+      for="..interfaces.IPackage"
+      manager=".package.IPackageOverviewManager"
+      class=".schema.PackageOverview"
+      template="schema_package_overview.pt"
+      permission="webdev.ViewSchema"
+      layer="zope.webdev.browser.skin.webdev"
+      weight="10"
+      />
+
+
+  <!-- Definition Overview -->
+
+  <!--page
+      for="..interfaces.ISchema"
+      permission="webdev.Schema"
+      name="overview.html"
+      class=".content.Overview"
+      template="content_overview.pt"
+      layer="zope.webdev.browser.skin.webdev"
+      menu="webdev_views"
+      title="Overview"
+      /-->
+
+  <defaultView
+      for="..interfaces.ISchema"
+      name="overview.html"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/browser/schema.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/schema_package_overview.pt
===================================================================
--- zope.webdev/trunk/browser/schema_package_overview.pt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/schema_package_overview.pt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,22 @@
+<ul class="content-listing">
+  <li tal:repeat="schema view/schemas">
+    <div class="name">
+      <a href=""
+         tal:content="schema/name">
+        IPerson
+      </a>
+      (
+      <tal:block repeat="base schema/bases">
+        <span tal:content="base" />
+        <tal:block condition="not:repeat/base/end">,</tal:block>
+      </tal:block>
+      )
+    </div>
+    <div class="details">
+      fields:
+      <tal:block repeat="field schema/fields">
+        <span tal:replace="field/name" /> (<span tal:replace="field/type"/>)
+      </tal:block>
+    </div>
+  </li>
+</ul>


Property changes on: zope.webdev/trunk/browser/schema_package_overview.pt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/skin.py
===================================================================
--- zope.webdev/trunk/browser/skin.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/skin.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,168 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Skin-related Tools
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.security.proxy
+from zope import viewlet
+from zope.publisher.interfaces.browser import IBrowserRequest
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+
+from zope.app import zapi
+from zope.app.basicskin.standardmacros import StandardMacros as BaseMacros
+from zope.app.component import hooks
+from zope.app.publisher.browser import BrowserView
+from zope.app.publisher.interfaces.browser import IBrowserMenu
+
+from zope.webdev import interfaces
+from zope.webdev.browser import pagelet
+from zope.webdev.interfaces import _
+
+class webdev(IBrowserRequest):
+    """The `webdev` layer."""
+
+
+class WebDev(webdev, IDefaultBrowserLayer):
+    """The `WebDev` skin."""
+
+
+class StandardMacros(BaseMacros):
+    macro_pages = ('main_template_macros',)
+
+
+class ILeftColumn(pagelet.IPageletManager):
+    """Left column pagelet manager."""
+
+
+class LeftColumn(pagelet.PageletManagerBase,
+                 viewlet.manager.ViewletManagerBase):
+    """Ordered pagelet manager."""
+    zope.interface.implements(ILeftColumn)
+
+    def sort(self, viewlets):
+        """Sort the viewlets on their weight."""
+        return sorted(viewlets,
+                      lambda x, y: cmp(x[1].getWeight(), y[1].getWeight()))
+
+
+class MenuDropDown(object):
+    """A viewlet displaying a menu"""
+    zope.interface.implements(pagelet.IPagelet)
+
+    menu_id = None
+
+    def __init__(self, *args, **kwargs):
+        super(MenuDropDown, self).__init__(*args, **kwargs)
+        self.menu = zapi.getUtility(IBrowserMenu, name=self.menu_id)
+
+    @property
+    def state(self):
+        return self.manager.getState(self.__name__)
+
+    def menuItems(self):
+        return self.menu.getMenuItems(self.context, self.request)
+
+    def title(self):
+        return self.menu.title
+
+    def getWeight(self):
+        return int(self.weight)
+
+class Switch(object):
+    """A browser view for the left column viewlets to expand or collapse the
+    viewlet."""
+
+    def switch(self):
+        state = zope.security.proxy.removeSecurityProxy(self.context).state
+        if not state.has_key('expanded'):
+            state['expanded'] = False
+
+        state['expanded'] = not state['expanded']
+        return u'Ok'
+
+
+class IHeaderTools(viewlet.interfaces.IViewletManager):
+    """Tools that are displayed in the header."""
+
+
+class HeaderTools(viewlet.manager.ViewletManagerBase):
+    """Ordered viewlet."""
+
+    def sort(self, viewlets):
+        """Sort the viewlets on their weight."""
+        return sorted(viewlets,
+                      lambda x, y: cmp(int(x[1].weight), int(y[1].weight)))
+
+
+class HelpHeaderTool(object):
+    """Header tool implementing the help system."""
+
+    title = u'Help'
+
+    def icon_url(self):
+        return zapi.getAdapter(self.request, name='help.png')()
+
+    def url(self):
+        return '++help++'
+
+
+class ExitHeaderTool(object):
+    """Header tool implementing the exit option."""
+
+    title = u'Exit'
+
+    def icon_url(self):
+        return zapi.getAdapter(self.request, name='exit.png')()
+
+    def url(self):
+        site = hooks.getSite()
+        url = zapi.absoluteURL(site, self.request)
+        # Remove the WebDev skin, since it does not work for all of Zope 3
+        url = url.replace('/++skin++WebDev', '')
+        return url + '/@@SelectedManagementView.html'
+
+
+class Breadcrumbs(BrowserView):
+    """A custom breadcrumbs implementation"""
+
+    def allcrumbs(self):
+        result = []
+        passedPackage = False
+        obj = self.context
+        while passedPackage is False and obj is not None:
+            if interfaces.IPackage.providedBy(obj):
+                passedPackage = True
+
+            name = zapi.name(obj)
+            # Special case for adding view
+            if name == '+':
+                name = _('Add')
+
+            # Get the info for the current object
+            info = {'name': name,
+                    'url': zapi.absoluteURL(obj, self.request),
+                    'icon': None}
+            zmi_icon = zapi.queryMultiAdapter(
+                (obj, self.request), name='zmi_icon')
+            if zmi_icon:
+                info['icon'] = zmi_icon()
+            result.append(info)
+            obj = zapi.getParent(obj)
+
+        result.reverse()
+        return result


Property changes on: zope.webdev/trunk/browser/skin.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/browser/webdev.css
===================================================================
--- zope.webdev/trunk/browser/webdev.css	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/webdev.css	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,652 @@
+/***************************************************************************
+* WebDev style sheet for CSS2-capable browsers.
+*
+* (originally from the Boston skin)
+*
+*****************************************************************************/
+
+
+/* ********** Basic Elements ********** */
+html {
+    height: 100%;
+}
+
+body {
+    height: 100%;
+    font: 75% Verdana, Helvetica, Arial, sans-serif;
+    color: #181818;
+    background: #F9F9F9;
+    margin: 0;
+    padding: 0;
+}
+
+a {
+    text-decoration: none;
+    color: BLACK;
+    background-color: transparent;
+}
+
+a:hover {
+    text-decoration: underline;
+}
+
+img {
+    border: none;
+}
+
+p {
+    margin: 0.5em 0em 1em 0em;
+    line-height: 1.5em;
+}
+
+p a {
+    text-decoration: underline;
+}
+
+p a:visited {
+    color: Purple;
+    background-color: transparent;
+}
+
+p a:active {
+    color: Red;
+    background-color: transparent;
+}
+
+p img {
+    border: 0;
+    margin: 0;
+}
+
+
+hr {
+    clear: both;
+    height: 1px;
+    color: #006600;
+    background-color: transparent;
+}
+
+
+h1, h2, h3, h4, h5, h6 {
+    color: Black;
+    clear: left;
+    font: 100% bold Verdana, Helvetica, Arial, sans-serif;
+    margin: 0;
+    padding-top: 0.5em;
+}
+
+h1 {
+    font-size: 140%;
+}
+
+h2 {
+    font-size: 120%;
+}
+
+h3 {
+    font-weight: bold;
+    font-size: 100%;
+}
+
+h4 {
+    color: #777777;
+    font-size: 100%;
+    font-weight: bold;
+}
+
+h5 {
+    font-size: 100%;
+}
+
+h6 {
+    font-size: 80%;
+}
+
+
+ol {
+    line-height: 1.5em;
+    margin-left: 2em;
+    padding:0;
+}
+
+ol a {
+    text-decoration: underline;
+}
+
+dl {
+}
+
+dt {
+    font-weight: bold;
+}
+
+dd {
+    line-height: 1.5em;
+    margin-bottom: 1em;
+}
+
+
+fieldset {
+    border: 1px solid #A0A0A0;
+    margin: 2em 0em 1em 0em;
+    padding: 1em 0em;
+}
+
+legend {
+    background: transparent;
+    padding: 0.5em;
+}
+
+
+form {
+    border: none;
+    margin: 0;
+    padding: 0;
+}
+
+textarea {
+    color: Black;
+    border: 1px solid #9B9B9B;
+    padding: 0.1em;
+}
+
+input {
+    font: normal 100% Verdana, Helvetica, Arial, sans-serif;
+    color: Black;
+    border: 1px solid #9B9B9B;
+    vertical-align: middle;
+    margin-bottom: 1px; /* IE bug fix */
+    padding: 0.1em;
+}
+
+input.noborder {
+    border: 0;
+}
+
+select {
+    font: normal 100% Verdana, Helvetica, Arial, sans-serif;
+    vertical-align: top;
+}
+
+abbr, acronym, .explain {
+    border-bottom: 1px dotted Black;
+    color: Black;
+    background-color: transparent;
+    cursor: help;
+}
+
+q {
+    font-family: Times, "Times New Roman", serif;
+    font-style: italic;
+    font-size: 120%;
+}
+
+blockquote {
+    font-family: Times, "Times New Roman", serif;
+    font-style: italic;
+    font-size: 120%;
+}
+
+code {
+    font-size: 120%;
+    color: Black;
+    background-color: #CCCCCC;
+}
+
+pre {
+    font-size: 120%;
+    padding: 1em;
+    border: 1px solid #A0A0A0;
+    color: Black;
+    background-color: #CCCCCC;
+}
+
+table {
+    border-collapse: collapse;
+    font-size: 100%;
+}
+
+.netscape4 {
+    display: none;
+}
+
+
+/* ********** layout styles ********** */
+#layout {
+    width: 100%;
+    height: 79px;
+    font-size: 100%;
+}
+
+#layout td {
+    vertical-align: top;
+}
+
+#layout tr.menu {
+    width: 100%;
+}
+
+#layout tr.head{
+    background-color: #2475BB;
+}
+
+
+#layout tr.head td {
+    border-bottom: 1px solid #D8D2BD;
+}
+
+#layout td.logo {
+    height: 55px;
+    width: 250px;
+}
+
+#layout td.logo img {
+    padding-top: 7px;
+    padding-left: 7px;
+}
+
+#layout td.headertools {
+    vertical-align: bottom;
+}
+
+.actions {
+    height: 20px;
+    float: left;
+    padding: 4px 0px 0px 0px;
+}
+
+.actions span {
+    white-space: nowrap;
+}
+
+.actions a {
+    color: #666666;
+    margin: 1px 6px 3px 6px;
+}
+
+.actions a:hover {
+    color: black;
+    text-decoration: none;
+    background-color: #D9DAF2;
+    border: 1px solid #2475BB;
+    padding: 1px 5px 3px 5px;
+    margin: 0px;
+}
+
+#page-title {
+    color: white;
+    font-size: 220%;
+    font-variant: small-caps;
+    font-weight: bold;
+}
+
+#breadcrumbs {
+    color: white;
+    font: Verdana, Helvetica, Arial, sans-serif;
+    font-weight: bold;
+    font-size: 120%;
+    margin: 10px 0px 0px 5px;
+}
+
+#breadcrumbs a {
+    color: #EEEEEE;
+    text-decoration: none;
+    vertical-align: bottom;
+}
+
+#breadcrumbs a:hover {
+    color: white;
+}
+
+#breadcrumbs img {
+    vertical-align: top;
+}
+
+#breadcrumbs span.separator {
+    color: #BBB;
+    vertical-align: bottom;
+}
+
+#headertools {
+    font-weight: bold;
+    vertical-align: bottom;
+    padding: 2px;
+}
+
+#headertools a {
+    color: #EEEEEE;
+    text-decoration: none;
+}
+
+#headertools a:hover {
+    color: white;
+}
+
+#headertools img {
+    vertical-align: middle;
+}
+
+div.headertool {
+  margin-bottom: 3px;
+}
+
+#content-body {
+  padding: 0em 1em;
+}
+
+#credits {
+  padding-top: 1em;
+  border-top: 1px solid #333;
+  text-align: center;
+}
+
+/* ********** navigation area ********** */
+
+td.navigation {
+    width: 200px;
+    vertical-align: top;
+    padding: 0px;
+    margin: 0px;
+}
+
+
+/* ********** slot boxes ********** */
+#slotbox {
+    width: 200px;
+    padding: 15px 5px 0px 5px;
+}
+
+.slotbox {
+    border: 2px solid #2475BB;
+    margin-bottom: 10px;
+    padding: 0px;
+}
+
+.slotbox div.header {
+    widht: 100%;
+    height: 22px;
+    color: white;
+    font-weight: bold;
+    background-color: #2475BB;
+    padding: 0px 0px 0px 5px;
+    margin: 0px 0px 0px 0px;
+}
+
+.slotbox div.header img.icon {
+	float: right;
+	position: relative;
+	padding: 2px;
+}
+
+.slotbox div.title {
+    float: left;
+    height: 17px;
+    // color: #FFEE44;
+    font-size: 130%;
+    white-space: nowrap;
+    padding: 3px 0px 0px 0px;
+}
+
+.slotbox div.controller {
+    float: right;
+    margin-right: 3px;
+}
+
+.slotbox div.body {
+	margin: 0px 0px 0px 0px;
+}
+
+.slotbox div.body div {
+    color: #777777;
+    padding: 2px 0px 5px 5px;
+    margin: 0px;
+}
+
+.slotbox div.body div.tip {
+    color: #B30000;
+    padding: 2px 0px 5px 5px;
+}
+
+.slotbox div.treebody {
+    margin: 5px 5px 5px 5px;
+}
+
+.slotbox div.body div.even {
+    background: #EBEBE2;
+    padding: 4px;
+}
+
+.slotbox div.body div.odd {
+    padding: 4px;
+}
+
+.slotbox div.body a {
+    text-decoration: none;
+}
+
+.slotbox div.body a:hover {
+    color: #333;
+}
+
+.slotbox img.itemicon {
+    vertical-align: bottom;
+}
+
+/* ********** content area ********** */
+#contextmenu {
+    font: 100% Verdana, Helvetica, Arial, sans-serif;
+    background-color: #EBE9DF;
+    padding: 6px; // 3px 0px 5px 5px;
+    margin: 2px 0px 10px 0px;
+}
+
+#contextmenu span {
+    white-space: nowrap;
+}
+
+#contextmenu a {
+    color: #666666;
+    font-weight: normal;
+    padding: 2px 6px 2px 6px;
+}
+
+#contextmenu a:hover {
+    color: black;
+    text-decoration: none;
+    background-color: #CECEFF;
+    border: 1px solid #2475BB;
+    padding: 2px 5px 2px 5px;
+}
+
+#contextmenu a.selected {
+    color: black;
+    text-decoration: none;
+    background-color: #D9DAF2;
+    border: 1px solid #2475BB;
+    padding: 2px 5px 2px 5px;
+}
+
+#content {
+    width: 100%;
+    margin: 0px;
+    padding: 15px 10px 0px 10px;
+}
+
+
+/* ********** standard fields ********** */
+div.row {
+    padding-top: 1em;
+    clear: both;
+}
+
+/* XXX: div.row div.field doesn't appear to be selecting. div.row div
+        is a workaround */
+div.row div {
+    float: left;
+}
+
+div.row div.label {
+    float: left;
+    font-weight: bold;
+    margin: 0;
+    padding-right: 1em;
+}
+
+div.row span.error {
+    background: #A51212;
+    color: white;
+    margin: 0;
+}
+
+
+/* ********** widget row layout ********** */
+
+#widgets {
+    width: 100%;
+    margin: 0px 0px 10px 0px;
+}
+
+#widgets td {
+    height: 25px;
+    vertical-align: top;
+}
+
+#widgets td.labels {
+    width: 100px;
+    text-align: right;
+    background: #DAD8CF;
+    padding: 7px 5px 5px 0px;
+}
+
+#widgets td.fields {
+    background: #EBEBE2;
+    padding: 7px 5px 5px 20px;
+}
+
+div.error {
+    color: #A51212;
+    border: 1px solid #A51212;
+    padding: 3px;
+    margin-bottom: 1em;
+}
+
+#form th.label {
+    text-align: left;
+    padding-right: 2em;
+    height: 2.5em;
+}
+
+#form td.field {
+    vertical-align: middle;
+}
+
+
+/* ********** footer area ********** */
+#footer {
+    float: left;
+    clear: both;
+}
+
+
+/* ********** table layout ********** */
+table.listing {
+    width: 100%;
+    margin: 0px 0px 10px 0px;
+}
+
+table.listing th {
+    height: 18px;
+    background: #EBE9DF;
+    color: black;
+    font-weight: normal;
+    text-align: left;
+    white-space: nowrap;
+    padding: 2px 0px 2px 0px;
+    margin: 0px 0px 0px 0px;
+}
+
+table.listing td.top {
+    text-align: right ! important;
+    padding: 0px 0px 0px 0px;
+}
+
+table.listing tr.odd {
+    background: #F3F3EE;
+}
+
+table.listing tr.even {
+    border: 0px;
+    background: transparent;
+}
+
+table.listing td {
+    text-align: left;
+    padding: 2px 0px 2px 0px;
+}
+
+table.listing img {
+    vertical-align: middle;
+}
+
+table.listing input {
+    padding: 3px 5px 0px 5px;
+}
+
+
+/* ********** messages and errors ********** */
+div.message {
+    height: 18px;
+    color: Black;
+    font: 100% Verdana, Helvetica, Arial, sans-serif;
+    background: #D9DAF2;
+    border: 1px solid #2475BB;
+    padding: 3px 6px 10px 6px;
+    margin-right: 10px;
+}
+
+div.message a {
+    color: Black;
+    text-decoration: underline;
+}
+
+div.page_error {
+    font: 100% Verdana, Helvetica, Arial, sans-serif;
+    background: #F29F9F;
+    border: 1px solid #A51212;
+    padding: 2px 5px;
+    margin: 0px 0px 10px 0px;
+    vertical-align: middle;
+}
+
+/* ********** Overview Pagelet and Pagelet Manager ********** */
+
+div.overview div.header {
+    padding: 3px;
+    margin-bottom: 3px;
+    background-color: #2475BB;
+    color: white;
+    font-weight: bold;
+    font-size: 130%;
+    font-style: italic;
+}
+
+div.overview div.body {
+    margin-left: 0.5em;
+}
+
+/* Specific Content Definition classes */
+
+ul.content-listing {
+    margin: 0px;
+    padding-left: 2em;
+}
+
+ul.content-listing div.name a {
+    color: #2475BB;
+    font-size: 120%;
+}
+
+ul.content-listing div.details {
+    font-style: italic;
+    font-size: 90%;
+}


Property changes on: zope.webdev/trunk/browser/webdev.css
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/browser/webdev.js
===================================================================
--- zope.webdev/trunk/browser/webdev.js	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/webdev.js	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,68 @@
+function switchDisplay(id, url) {
+
+    if(document.getElementById) {
+       // DOM
+       var element = document.getElementById(id);
+    } else {
+        if(document.all) {
+            // Proprietary DOM
+            var element = document.all[id];
+        } else {
+            // Create an object to prevent errors further on
+            var element = new Object();
+        }
+    }
+
+    if(!element) {
+        /* The page has not loaded or the browser claims to support
+        document.getElementById or document.all but cannot actually
+        use either */
+        return;
+    }
+
+    // Reference the style ...
+    if (element.style) {
+        style = element.style;
+    }
+
+    if (typeof(style.display) == 'undefined' &&
+        !( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) {
+        //The browser does not allow us to change the display style
+        //Alert something sensible (not what I have here ...)
+        window.alert( 'Your browser does not support this' );
+        return;
+    }
+
+   // Change the display style
+   if (style.display == 'none') {
+       style.display = '';
+       switchImage(id, 'collapsed.png', 'expanded.png');
+   }
+   else {
+       style.display = 'none';
+       switchImage(id, 'expanded.png', 'collapsed.png');
+   }
+   saveSwitch(id, url);
+}
+
+function switchImage(id, oldname, newname) {
+    if(document.getElementById) {
+       // DOM
+       var element = document.getElementById(id+'.switcher');
+    } else {
+       // Proprietary DOM
+       var element = document.all[id+'.switcher'];
+    }
+    element.src = element.src.replace(oldname, newname);
+}
+
+function saveSwitch(id, url) {
+    var names = id.split('*');
+    managerName = names[0];
+    viewletName = names[1];
+    var req = new XMLHttpRequest();
+    req.open("POST",
+             url+'/++pagelets++'+managerName+'/'+viewletName+'/@@switch.html',
+             false);
+    req.send(null);
+}

Added: zope.webdev/trunk/browser/widget.css
===================================================================
--- zope.webdev/trunk/browser/widget.css	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/browser/widget.css	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,9 @@
+/*colorize the matrix table used in grant.html*/
+table.matrix td.default {
+    background: #82BA78;
+}
+
+
+table.matrix td.changed {
+    background: #D96868;
+}


Property changes on: zope.webdev/trunk/browser/widget.css
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/configure.zcml
===================================================================
--- zope.webdev/trunk/configure.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/configure.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,27 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <!-- Registration of Documentation with apidoc -->
+
+  <apidoc:bookchapter
+      id="webdev"
+      title="Web Components Development"
+      doc_path="README.txt"
+      zcml:condition="have apidoc"
+      />
+
+  <!-- Link in other configuration -->
+
+  <include file="package.zcml" />
+  <include file="schema.zcml" />
+  <include file="content.zcml" />
+  <include file="page.zcml" />
+  <include file="rdb.zcml" />
+
+  <include package=".browser" />
+
+</configure>


Property changes on: zope.webdev/trunk/configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/content.py
===================================================================
--- zope.webdev/trunk/content.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/content.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,108 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Content Component Definition and Instance
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import persistent
+import zope.interface
+import zope.schema
+from zope.schema import fieldproperty
+from zope.security import checker
+from zope.app import annotation
+from zope.app import container
+from zope.webdev import interfaces
+
+
+class ContentComponentDefinition(persistent.Persistent,
+                                 container.contained.Contained):
+    """Content Component Definition
+
+    A persistent implementation of a content component definition. It can be
+    used to create content components on local sites.
+    """
+    zope.interface.implements(interfaces.IContentComponentDefinition)
+
+    def __init__(self, name=u'', schema=None):
+        self.name = name
+        self.schema = schema
+        self.permissions = persistent.dict.PersistentDict()
+
+    def __call__(self, **kwargs):
+        """See interfaces.IContentComponentDefinition"""
+        instance = ContentComponentInstance(self)
+        # We do not want to update the isntance dictionary directly, since we
+        # want to use the ``__setattr__`` method to ensure that only supported
+        # attributes are set.
+        for key, value in kwargs.items():
+            setattr(instance, key, value)
+        return instance
+
+    def __repr__(self):
+        # If it is added to a package, make it part of the name
+        if self.__parent__:
+            name = self.__parent__.__name__ + '.' + self.name
+        else:
+            name = self.name
+        return '<%s %r>' %(self.__class__.__name__, name)
+
+
+class ContentComponentInstance(persistent.Persistent,
+                               container.contained.Contained):
+    """Content Component Instance
+
+    An object that acts as an instance of a content component definition.
+    """
+    zope.interface.implements(interfaces.IContentComponentInstance,
+                              annotation.interfaces.IAttributeAnnotatable)
+
+    def __init__(self, definition):
+        super(ContentComponentInstance, self).__init__()
+        # See interfaces.IContentComponentInstance
+        self.__definition__ = definition
+        # Update the instance
+        self.__update__()
+
+    def __update__(self):
+        """See interfaces.IContentComponentInstance"""
+        schema = self.__definition__.schema
+
+        # Make sure the instance provides the schema.
+        zope.interface.directlyProvides(self, schema)
+
+        # Add the new attributes
+        for name, field in zope.schema.getFields(schema).items():
+            # Only set the field to the default value, if it is not already set
+            if not hasattr(self, name):
+                setattr(self, name, field.default)
+
+        # Build up Checker rules
+        checker_getattr = {}
+        checker_setattr = {}
+        permissions = self.__definition__.permissions
+        for name in zope.schema.getFields(schema):
+            get_perm, set_perm = permissions.get(name, (None, None))
+            checker_getattr[name] = get_perm or checker.CheckerPublic
+            checker_setattr[name] = set_perm or checker.CheckerPublic
+
+        # Store the checker in an attribute that is recognized by the security
+        # framework.
+        self.__Security_checker__ = checker.Checker(
+            checker_getattr, checker_setattr)
+
+
+    def __repr__(self):
+        return '<Instance of %r>' %self.__definition__


Property changes on: zope.webdev/trunk/content.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/content.txt
===================================================================
--- zope.webdev/trunk/content.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/content.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,102 @@
+=============================================
+The Content Component Definition and Instance
+=============================================
+
+Content component definitions and instances are used to implement
+Web-developed classes and instances. However, they are very simple "classes",
+since they only implement one schema. Thus, the first task is to create a
+schema:
+
+  >>> import zope.interface
+  >>> import zope.schema
+  >>> class IPerson(zope.interface.Interface):
+  ...     last = zope.schema.TextLine(title=u"Last Name")
+  ...     first = zope.schema.TextLine(title=u"First Name")
+
+Now that we have a schema, we can create a content component definition for
+it:
+
+  >>> from zope.webdev import content
+  >>> Person = content.ContentComponentDefinition('Person', IPerson)
+  >>> Person
+  <ContentComponentDefinition 'Person'>
+
+Another feature of the definition is the management of the security
+declarations for each field in the schema. In our case I would like to make
+the access of the attributes public (i.e. use the ``zope.Public`` permission),
+but create a new edit permission for setting them:
+
+  >>> from zope.security.checker import CheckerPublic
+  >>> from zope.app.security import permission
+  >>> edit = permission.Permission('Edit')
+
+Now we set the permissions:
+
+  >>> Person.permissions = {'last': (CheckerPublic, edit),
+  ...                       'first': (CheckerPublic, edit),}
+
+Usually, content component definitions are added to packages:
+
+  >>> from zope.webdev import package
+  >>> person = package.Package('person')
+
+  >>> person['Person'] = Person
+
+Then the representation of the person changes slightly to incorporate the
+package name:
+
+  >>> Person
+  <ContentComponentDefinition 'person.Person'>
+
+Once our definition is created, we can create instances from the definition by
+simply calling it:
+
+  >>> stephan = Person(first=u'Stephan', last=u'Richter')
+  >>> stephan
+  <Instance of <ContentComponentDefinition 'person.Person'>>
+
+  >>> stephan.first
+  u'Stephan'
+  >>> stephan.last
+  u'Richter'
+
+Of course, the instance provides the schema:
+
+  >>> IPerson.providedBy(stephan)
+  True
+
+We can also see that the security checker is properly set during
+initialization:
+
+  >>> stephan.__Security_checker__
+  <zope.security.checker.Checker object at ...>
+
+  >>> stephan.__Security_checker__.get_permissions
+  {'last': Global(CheckerPublic,zope.security.checker),
+   'first': Global(CheckerPublic,zope.security.checker)}
+
+  >>> stephan.__Security_checker__.set_permissions
+  {'last': <zope.app.security.permission.Permission object at ...>,
+   'first': <zope.app.security.permission.Permission object at ...>}
+
+Finally, during development it is very likely that you are constantly changing
+the schema and update the permissions. It would be cumbersome to cosntantly
+remove and recreate the test instances. Thus the instance can be updated:
+
+  >>> class IPersonExtended(IPerson):
+  ...     phone = zope.schema.TextLine(title=u'Phone', default=u'555-776-6333')
+  >>> Person.schema = IPersonExtended
+  >>> Person.permissions['phone'] = (CheckerPublic, edit)
+
+  >>> stephan.phone
+  Traceback (most recent call last):
+  ...
+  AttributeError: 'ContentComponentInstance' object has no attribute 'phone'
+
+  >>> stephan.__update__()
+
+  >>> stephan.phone
+  u'555-776-6333'
+
+  >>> IPersonExtended.providedBy(stephan)
+  True


Property changes on: zope.webdev/trunk/content.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/content.zcml
===================================================================
--- zope.webdev/trunk/content.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/content.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,51 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <!-- Permission Definitions -->
+
+  <permission
+      id="webdev.CreateContentComponentDefinition"
+      title="Create Content Component Definition"
+      />
+
+  <permission
+      id="webdev.ManageContentComponentDefinition"
+      title="Manage Content Component Definition"
+      />
+
+  <permission
+      id="webdev.ViewContentComponentDefinition"
+      title="View Content Component Definition"
+      />
+
+  <!-- Security Declarations -->
+
+  <content class=".content.ContentComponentDefinition">
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="webdev.ViewContentComponentDefinition"
+        interface=".interfaces.IContentComponentDefinition"
+        />
+    <require
+        permission="webdev.ManageContentComponentDefinition"
+        set_schema=".interfaces.IContentComponentDefinition"
+        />
+  </content>
+
+  <!-- Registration of Documentation with apidoc -->
+
+  <apidoc:bookchapter
+      id="content"
+      title="The Content Component Definition/Instance"
+      parent="webdev"
+      doc_path="content.txt"
+      zcml:condition="have apidoc"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/content.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/interfaces.py
===================================================================
--- zope.webdev/trunk/interfaces.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/interfaces.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,181 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""WebDev Interfaces
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+import zope.i18nmessageid
+import zope.schema
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+
+import zope.app.schema.interfaces
+from zope.app import schema
+from zope.app.component import interfaces
+from zope.app.container import constraints
+
+_ = zope.i18nmessageid.MessageFactory('zope.webdev')
+
+class IPackage(interfaces.registration.IRegisterableContainer):
+    """A package for the Web-based development
+
+    This object is roughly equivalent to a Python package for filesystem-based
+    developement.
+    """
+    constraints.containers(interfaces.ILocalSiteManager)
+
+    name = zope.schema.BytesLine(
+        title=_('Name'),
+        description=_('The name of the package, which must be a valid Python '
+                      'identifier.'),
+        required=True,
+        # The name is usually controlled by the containment variable.
+        readonly=True)
+
+    docstring = zope.schema.Text(
+        title=_('Docstring'),
+        description=_('The documentation string for the package.'),
+        required=False)
+
+    version = zope.schema.TextLine(
+        title=_('Version'),
+        description=_('The version of the package.'),
+        required=False)
+
+    license = zope.schema.TextLine(
+        title=_('License'),
+        description=_('The source code license of the package.'),
+        required=False)
+
+    author = zope.schema.TextLine(
+        title=_('Author'),
+        description=_('The author of the package.'),
+        required=False)
+
+
+class ISchema(schema.interfaces.IMutableSchema):
+    """A schema that can be modified."""
+
+    name = zope.schema.TextLine(
+        title=_("Schema Name"),
+        description=_("This is the name of the schema."),
+        required=True,
+        readonly=True)
+
+    docstring = zope.schema.Text(
+        title=_('Docstring'),
+        description=_('The documentation string for the schema.'),
+        required=False)
+
+    bases = zope.schema.List(
+        title=_('Bases'),
+        description=_("Specifies the bases for the schema."),
+        value_type=zope.schema.Choice(vocabulary='Interfaces'),
+        required=True)
+
+
+class IContentComponentDefinition(interfaces.ILocalUtility):
+    """Content Component Definitions describe simple single-schema based
+    content components including their security declarations."""
+    constraints.containers(IPackage)
+
+    name = zope.schema.TextLine(
+        title=_("Content Type Name"),
+        description=_("This is the name of the content component type."),
+        required=True,
+        readonly=True)
+
+    schema = zope.schema.Choice(
+        title=_('Schema'),
+        description=_("Specifies the schema that characterizes the component."),
+        vocabulary="Interfaces",
+        required=True)
+
+    permissions = zope.interface.Attribute(
+        u"A dictionary that maps set/get permissions on the schema's"
+        u"fields. Entries looks as follows: {fieldname:(set_perm, get_perm)}")
+
+    def __call__(**kwargs):
+        """Constructor for the content component instance.
+
+        The keyword arguments will be used to set the attributes on the
+        instance.
+        """
+
+
+class IContentComponentInstance(zope.interface.Interface):
+    """Interface describing a Content Component Instance"""
+
+    __definition__ = zope.schema.Object(
+        title=_("Content Component Definition"),
+        description=_("The content component definition for which the "
+                      "instance is created."),
+        schema=IContentComponentDefinition,
+        required=True)
+
+    def update():
+        """Update the content component instance to the latest definition.
+
+        This method is useful during development. If you keep changing the
+        schema and permissions of the content component definition, this
+        method can update the instance to apply the changes.
+        """
+
+class IPage(interfaces.registration.IRegisterable):
+    """A persistent page."""
+
+    name = zope.schema.TextLine(
+        title=_("Page Name"),
+        description=_("This is the name of the page."),
+        required=True,
+        readonly=True)
+
+    for_ = zope.schema.Choice(
+        title=_('For'),
+        description=_("The interface the page is for."),
+        vocabulary="Interfaces",
+        required=True)
+
+    layer = zope.schema.Choice(
+        title=_('Layer'),
+        description=_("The layer in which the page will be available."),
+        vocabulary="Layers",
+        required=True,
+        default=IDefaultBrowserLayer)
+
+    permission = zope.schema.Choice(
+        title=_(u"Permission"),
+        description=_(u"The permission required to view the page"),
+        vocabulary="Permission Ids",
+        required = True,
+        )
+
+    templateSource = zope.schema.Text(
+        title=_("Template Source"),
+        description=_("The page template source of the template."),
+        required=True,
+        default=u'')
+
+    moduleSource = zope.schema.Text(
+        title=_("Module Source"),
+        description=_("The Python source that provides the view class."),
+        required=True,
+        default=u'')
+
+    className = zope.schema.BytesLine(
+        title=_("Class Name"),
+        description=_("The name of the class defined in the module."),
+        required=True)


Property changes on: zope.webdev/trunk/interfaces.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/menu.py
===================================================================
--- zope.webdev/trunk/menu.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/menu.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""WebDev Menu Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import persistent
+from zope.app.publisher.browser import menu
+
+class BrowserMenu(menu.BrowserMenu, persistent.Persistent):
+    """A persistent browser menu."""
+
+    def __init__(self, id, title=u'', description=u'', menuItemType=None):
+        self.id = id
+        self.title = title
+        self.description = description
+        self.menuItemType = menuItemType
+
+    def getMenuItemType(self):
+        """See zope.app.publisher.interfaces.browser.IBrowserMenu"""
+        return self.menuItemType


Property changes on: zope.webdev/trunk/menu.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/package.py
===================================================================
--- zope.webdev/trunk/package.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/package.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Package Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import zope.interface
+from zope.schema import fieldproperty
+from zope.app.component import registration
+from zope.app.container import btree, contained
+from zope.webdev import interfaces
+
+
+class Package(registration.RegisterableContainer,
+              btree.BTreeContainer,
+              contained.Contained):
+    """A WebDev Package."""
+    zope.interface.implements(interfaces.IPackage)
+
+    # See interfaces.IPackage
+    docstring = fieldproperty.FieldProperty(interfaces.IPackage['docstring'])
+
+    version = fieldproperty.FieldProperty(interfaces.IPackage['version'])
+
+    license = fieldproperty.FieldProperty(interfaces.IPackage['license'])
+
+    author = fieldproperty.FieldProperty(interfaces.IPackage['author'])
+
+    def __init__(self, name=None, docstring=None, version=None,
+                 license=None, author=None):
+        super(Package, self).__init__()
+        self.__name__, self.docstring, self.version = name, docstring, version
+        self.license, self.author = license, author
+
+    @property
+    def name(self):
+        return self.__name__
+
+    def __repr__(self):
+        return '<%s %r>' %(self.__class__.__name__, self.name)


Property changes on: zope.webdev/trunk/package.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/package.txt
===================================================================
--- zope.webdev/trunk/package.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/package.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,92 @@
+===========
+The Package
+===========
+
+The package is the WebDev version of a traditional Python package. It is very
+similar to a site-management folder that manages the package's "code".
+
+  >>> from zope.webdev import package
+
+Every package has a name that must be a Python identifier. While the name does
+not have to be set during initialization, it is very important to specify it
+always:
+
+  >>> person = package.Package('person')
+  >>> person
+  <Package 'person'>
+
+  >>> person.name
+  'person'
+
+Note: The reason it is not required is because of the Web interface. There the
+name is assigned when the package is added to the container.
+
+Additionally, the package supports a docstring, version, license and author
+field.
+
+  >>> person.docstring
+  >>> person.docstring = u'A package for defining and managing people.'
+  >>> person.docstring
+  u'A package for defining and managing people.'
+
+  >>> person.version
+  >>> person.version = u'0.1'
+  >>> person.version
+  u'0.1'
+
+  >>> person.license
+  >>> person.license = u'ZPL 2.1'
+  >>> person.license
+  u'ZPL 2.1'
+
+  >>> person.author
+  >>> person.author = u'Stephan Richter'
+  >>> person.author
+  u'Stephan Richter'
+
+Of course, all those parameters can also be passed into the constructor:
+
+  >>> pp = package.Package('person', u'A people package',
+  ...                      u'0.1', u'ZPL 2.1', u'Stephan Richter')
+
+  >>> pp.name
+  'person'
+  >>> pp.docstring
+  u'A people package'
+  >>> pp.version
+  u'0.1'
+  >>> pp.license
+  u'ZPL 2.1'
+  >>> pp.author
+  u'Stephan Richter'
+
+Also note that the ``name`` attribute is read-only.
+
+  >>> pp.name = 'newperson'
+  Traceback (most recent call last):
+  ...
+  AttributeError: can't set attribute
+
+This is because the naming of the package should only be controlled by the
+container, in this case the site manager. The site manager sets the
+``__name__`` attribute,
+
+  >>> pp.__name__ = 'newperson'
+
+which sets the name:
+
+  >>> pp.name
+  'newperson'
+
+Now, a package is not really a site-management folder, but just another
+component implementing ``IRegisterableContainer``. Let's make sure the at
+interface is provided,
+
+  >>> from zope.app.component import interfaces
+  >>> interfaces.registration.IRegisterableContainer.providedBy(person)
+  True
+
+and that the package provides the registration manager:
+
+  >>> person.registrationManager
+  <zope.app.component.registration.RegistrationManager ...>


Property changes on: zope.webdev/trunk/package.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/package.zcml
===================================================================
--- zope.webdev/trunk/package.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/package.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,53 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <!-- Permission Definitions -->
+
+  <permission
+      id="webdev.CreatePackage"
+      title="Create Package"
+      />
+
+  <permission
+      id="webdev.ManagePackage"
+      title="Manage Package"
+      />
+
+  <permission
+      id="webdev.ViewPackage"
+      title="View Package"
+      />
+
+  <!-- Security Declarations -->
+
+  <content class="zope.webdev.package.Package">
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="webdev.ViewPackage"
+        interface="zope.app.container.interfaces.IReadContainer"
+        attributes="name docstring version license author registrationManager"
+        />
+    <require
+        permission="webdev.ManagePackage"
+        interface="zope.app.container.interfaces.IWriteContainer"
+        set_attributes="docstring version license author registrationManager"
+        />
+  </content>
+
+  <!-- Registration of Documentation with apidoc -->
+
+  <apidoc:bookchapter
+      id="package"
+      title="The Package"
+      parent="webdev"
+      doc_path="package.txt"
+      zcml:condition="have apidoc"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/package.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/page.py
===================================================================
--- zope.webdev/trunk/page.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/page.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,122 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Page Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+import persistent
+import zope.interface
+import zope.security.checker
+import zope.app.component.site
+import zope.app.component.interfaces.registration
+import zope.app.container.contained
+import zope.app.module.manager
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+from zope.app.publisher.interfaces.browser import IBrowserView
+from zope.app import zapi
+from zope.app import publisher
+from zope.app.presentation import zpt, registration
+
+from zope.webdev import interfaces
+
+
+class Page(persistent.Persistent, zope.app.container.contained.Contained):
+    """Local page."""
+    zope.interface.implements(interfaces.IPage)
+
+    def __init__(self, name,
+                 for_=zope.interface.Interface,
+                 layer=IDefaultBrowserLayer,
+                 permission=zope.security.checker.CheckerPublic,
+                 templateSource=None, moduleSource=None, className=None):
+
+        self._template = zpt.ZPTTemplate()
+        self._module = zope.app.module.manager.ModuleManager()
+
+        self.name = name
+        self.for_ = for_
+        self.layer = layer
+        self.permission = permission
+        if templateSource is not None:
+            self.templateSource = templateSource
+        if moduleSource is not None:
+            self.moduleSource = moduleSource
+        self.className = className
+
+    @apply
+    def templateSource():
+        def get(self):
+            return self._template.source
+
+        def set(self, value):
+            self._template.source = value
+
+        return property(get, set)
+
+    @apply
+    def moduleSource():
+        def get(self):
+            return self._module.source
+
+        def set(self, value):
+            self._module.source = value
+
+        return property(get, set)
+
+
+    def register(self):
+        reg = PageRegistration(self)
+        package = zapi.getParent(self)
+        package.registrationManager.addRegistration(reg)
+        reg.status = zope.app.component.interfaces.registration.ActiveStatus
+
+
+class PageRegistration(zope.app.component.site.AdapterRegistration):
+
+    provided = zope.interface.Interface
+
+    def __init__(self, page):
+        self.page = page
+
+    @property
+    def name(self):
+        return zapi.name(self.page)
+
+    @property
+    def with(self):
+        return (self.page.layer, )
+
+    @property
+    def required(self):
+        return self.page.for_
+
+    @property
+    def component(self):
+
+        def makeViewClass(context, request):
+            if self.page._module and self.page.className:
+                class_ = getattr(self.page._module.getModule(),
+                                 self.page.className)
+            else:
+                class_  = publisher.browser.BrowserView
+
+            if not IBrowserView.implementedBy(class_):
+                class_ = type(class_.__name__,
+                              (class_, publisher.browser.BrowserView), {})
+
+            return class_(context, request)
+
+        return registration.TemplateViewFactory(
+            makeViewClass, self.page._template, self.page.permission)


Property changes on: zope.webdev/trunk/page.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/page.txt
===================================================================
--- zope.webdev/trunk/page.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/page.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,67 @@
+========
+The Page
+========
+
+First we create a site:
+
+  >>> from zope.app.testing import setup
+  >>> from zope.app.folder import rootFolder
+  >>> site = rootFolder()
+  >>> setup.createSiteManager(site, setsite=True)
+  <zope.app.component.site.LocalSiteManager object at ...>
+
+  >>> site['image.gif'] = object()
+  >>> site['file.txt'] = object()
+
+  >>> from zope.webdev.page import Page
+  >>> names_html = Page('names.html')
+  >>> site.getSiteManager()['default']['names.html'] = names_html
+  >>> names_html.register()
+
+defaults are: for=Interface, layers=(IDefaultLayer,),
+              permission=CheckerPublic, template=zptpage.ZPTPage(),
+              module=ModuleManager(), className=None)
+
+is automatically registered.
+
+  >>> names_html.templateSource = u'''
+  ... <html>
+  ...   <body>
+  ...     <h1>Folder contents</h1>
+  ...     <ul>
+  ...       <li tal:repeat="name view/names"
+  ...           tal:content="name" />
+  ...     </ul>
+  ...   </body>
+  ... </html>
+  ... '''
+
+  >>> names_html.moduleSource = '''
+  ... class FolderContents(object):
+  ...     @property
+  ...     def names(self):
+  ...         return sorted(self.context.keys())
+  ... '''
+  >>> names_html.className = 'FolderContents'
+
+Now the page is setup and it should be available for any folder:
+
+  >>> import zope.component
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+
+  >>> page = zope.component.getMultiAdapter(
+  ...     (site, request), name='names.html')
+
+Now render the page:
+
+  >>> print page()
+  <html>
+    <body>
+      <h1>Folder contents</h1>
+      <ul>
+        <li>file.txt</li>
+        <li>image.gif</li>
+      </ul>
+    </body>
+  </html>


Property changes on: zope.webdev/trunk/page.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/page.zcml
===================================================================
--- zope.webdev/trunk/page.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/page.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,50 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    >
+
+  <!-- Permission Definitions -->
+
+  <permission
+      id="webdev.CreatePage"
+      title="Create PAge"
+      />
+
+  <permission
+      id="webdev.ManagePage"
+      title="Manage Page"
+      />
+
+  <permission
+      id="webdev.ViewPage"
+      title="View Page"
+      />
+
+  <!-- Security Declarations -->
+
+  <content class="zope.webdev.page.Page">
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="webdev.ViewPage"
+        interface=".interfaces.IPage"
+        />
+    <require
+        permission="webdev.ManagePage"
+        set_schema=".interfaces.IPage"
+        />
+  </content>
+
+  <!-- Registration of Documentation with apidoc -->
+
+  <apidoc:bookchapter
+      id="page"
+      title="The Page"
+      parent="webdev"
+      doc_path="page.txt"
+      zcml:condition="have apidoc"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/page.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/rdb.zcml
===================================================================
--- zope.webdev/trunk/rdb.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/rdb.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,32 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <!-- Permission Definitions -->
+
+  <permission
+      id="webdev.CreateDatabaseAdapter"
+      title="Create Database Adapter"
+      />
+
+  <permission
+      id="webdev.ManageDatabaseAdapter"
+      title="Manage Database Adapter"
+      />
+
+  <permission
+      id="webdev.ViewDatabaseAdapter"
+      title="View Database Adapter"
+      />
+
+  <!-- Database adapter factory vocabulary -->
+  <vocabulary
+     name="WebDev Database Adapter Factories"
+     factory="zope.webdev.vocabulary.FactoryVocabulary"
+     interface="zope.app.rdb.interfaces.IManageableZopeDatabaseAdapter"
+     />
+
+</configure>


Property changes on: zope.webdev/trunk/rdb.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/schema.py
===================================================================
--- zope.webdev/trunk/schema.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/schema.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,46 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Schema Implementation
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import zope.interface
+from zope.app.schema import schema
+
+from zope.webdev import interfaces
+
+class Schema(schema.SchemaUtility):
+    """Special Persistent Schema that is more schema-driven."""
+    zope.interface.implements(interfaces.ISchema)
+
+    name = property(schema.SchemaUtility.getName,
+                     schema.SchemaUtility.setName)
+
+    bases = schema.SchemaUtility.__bases__
+
+    @apply
+    def docstring():
+
+        def get(self):
+            return self.__docstring__
+
+        def set(self, value):
+            self.__docstring__ = value
+
+        return property(get, set)
+
+    def __init__(self, name, bases=(), docstring=None):
+        super(Schema, self).__init__(name, bases, __doc__=docstring)


Property changes on: zope.webdev/trunk/schema.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/schema.txt
===================================================================
--- zope.webdev/trunk/schema.txt	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/schema.txt	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,3 @@
+==================
+Persistent Schemas
+==================


Property changes on: zope.webdev/trunk/schema.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/schema.zcml
===================================================================
--- zope.webdev/trunk/schema.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/schema.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,51 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:apidoc="http://namespaces.zope.org/apidoc"
+    xmlns:zcml="http://namespaces.zope.org/zcml"
+    i18n_domain="webdev"
+    >
+
+  <!-- Permission Definitions -->
+
+  <permission
+      id="webdev.CreateSchema"
+      title="Create Schema"
+      />
+
+  <permission
+      id="webdev.ManageSchema"
+      title="Manage Schema"
+      />
+
+  <permission
+      id="webdev.ViewSchema"
+      title="View Schema"
+      />
+
+  <!-- Security Declarations -->
+
+  <content class=".schema.Schema">
+    <implements
+        interface="zope.app.annotation.interfaces.IAttributeAnnotatable"
+        />
+    <require
+        permission="webdev.ViewSchema"
+        interface="zope.app.schema.interfaces.IReadMutableSchema"
+        attributes="name dostring bases getBases"/>
+    <require
+        permission="webdev.ManageSchema"
+        interface="zope.app.schema.interfaces.IWriteMutableSchema"
+        set_attributes="name docstring bases" />
+  </content>
+
+  <!-- Registration of Documentation with apidoc -->
+
+  <apidoc:bookchapter
+      id="schema"
+      title="The Schema"
+      parent="webdev"
+      doc_path="schema.txt"
+      zcml:condition="have apidoc"
+      />
+
+</configure>


Property changes on: zope.webdev/trunk/schema.zcml
___________________________________________________________________
Name: svn:eol-style
   + native

Added: zope.webdev/trunk/tests.py
===================================================================
--- zope.webdev/trunk/tests.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/tests.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,55 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Viewlet tests
+
+$Id$
+"""
+__docformat__ = 'restructuredtext'
+
+import unittest
+from zope.testing import doctest
+from zope.testing.doctestunit import DocTestSuite, DocFileSuite
+from zope.app.testing import setup
+
+
+def setUp(test):
+    setup.placefulSetUp()
+
+
+def tearDown(test):
+    setup.placefulTearDown()
+
+
+def test_suite():
+    return unittest.TestSuite((
+        DocFileSuite('package.txt',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        DocFileSuite('content.txt',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        DocFileSuite('page.txt',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        DocTestSuite('zope.webdev.vocabulary',
+                     setUp=setUp, tearDown=tearDown,
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     ),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: zope.webdev/trunk/tests.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/vocabulary.py
===================================================================
--- zope.webdev/trunk/vocabulary.py	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/vocabulary.py	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1,180 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Utility Vocabulary.
+
+This vocabulary provides terms for all utilities providing a given interface.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+
+from zope.interface import implements
+from zope.interface.interfaces import IInterface
+from zope.schema.interfaces import ITokenizedTerm
+from zope.component.interfaces import IFactory
+
+from zope.app import zapi
+from zope.app.component.vocabulary import UtilityVocabulary
+
+
+
+# TODO: this vocabulary should go to zope.app.component where the IFactory 
+# is located.
+class FactoryTerm(object):
+    """A term representing a factory.
+
+    The token of the term is the name of the factory. Here is a brief example
+    on how the IVocabulary interface is handled in this term as a factory:
+
+    >>> from zope.schema.interfaces import IVocabulary
+    >>> from zope.interface.verify import verifyObject
+    >>> term = FactoryTerm(IVocabulary, 'zope.schema.interfaces.IVocabulary')
+    >>> verifyObject(ITokenizedTerm, term)
+    True
+
+    >>> term.value
+    <InterfaceClass zope.schema.interfaces.IVocabulary>
+    >>> term.token
+    'zope.schema.interfaces.IVocabulary'
+
+    >>> term
+    <FactoryTerm zope.schema.interfaces.IVocabulary, instance of <InterfaceClass zope.schema.interfaces.IVocabulary>>
+    """
+    implements(ITokenizedTerm)
+
+    def __init__(self, value, token):
+        """Create a term for value and token."""
+        self.value = value
+        self.token = token
+
+    def __repr__(self):
+        return '<FactoryTerm %s, instance of %s>' %(
+            self.token, self.value)
+
+
+# TODO: Cut the too long test output
+class FactoryVocabulary(UtilityVocabulary):
+    """Vocabulary that provides utilities of a specified interface.
+
+    Here is a short example of how the vocabulary should work.
+
+    First we need to create a utility interface and some utilities:
+
+    >>> from zope.interface import Interface
+    >>> from zope.component.factory import Factory
+    >>> class IObject(Interface):
+    ...     'Simple interface to mark object utilities.'
+    >>>
+    >>> class Object(object):
+    ...     implements(IObject)
+    ...     def __init__(self, name):
+    ...         self.name = name
+    ...     def __repr__(self):
+    ...         return '<Object %s>' %self.name
+
+    Now we register a factory for IObject
+
+    >>> from zope.app.testing import ztapi
+    >>> factory = Factory(Object, interfaces=(IObject,))
+    >>> ztapi.provideUtility(IFactory, factory, 'zope.webdev.vocabulary.IObject')
+
+    We are now ready to create a vocabulary that we can use; in our case
+    everything is global, so the context is None.
+
+    >>> vocab = FactoryVocabulary(None, IObject)
+    >>> import pprint
+    >>> pprint.pprint(vocab._terms.items())
+    [(u'zope.webdev.vocabulary.IObject',
+      <FactoryTerm zope.webdev.vocabulary.IObject, instance of <Factory for <class 'zope.webdev.vocabulary.Object'>>>)]
+
+    Now let's see how the other methods behave in this context. First we can
+    just use the 'in' opreator to test whether a value is available.
+
+    >>> factory in vocab
+    True
+
+    We can also create a lazy iterator.
+
+    >>> iterator = iter(vocab)
+    >>> terms = list(iterator)
+    >>> names = [term.token for term in terms]
+    >>> names.sort()
+    >>> names
+    [u'zope.webdev.vocabulary.IObject']
+
+    Determining the amount of factories available via the vocabulary is also
+    possible.
+
+    >>> len(vocab)
+    1
+
+    Next we are looking at some of the more vocabulary-characteristic API
+    methods.
+
+    One can get a term for a given value using ``getTerm()``:
+
+    >>> vocab.getTerm(factory)
+    <FactoryTerm zope.webdev.vocabulary.IObject, instance of <Factory for <class 'zope.webdev.vocabulary.Object'>>>
+
+    On the other hand, if you want to get a term by the token, then you do
+    that with:
+
+    >>> vocab.getTermByToken('zope.webdev.vocabulary.IObject')
+    <FactoryTerm zope.webdev.vocabulary.IObject, instance of <Factory for <class 'zope.webdev.vocabulary.Object'>>>
+    >>> vocab.getTermByToken('noneExist')
+    Traceback (most recent call last):
+    ...
+    LookupError: noneExist
+
+    That's it. It is all pretty straight forward, but it allows us to easily
+    create a vocabulary for any factory. In fact, to make it easy to register
+    such a vocabulary via ZCML, the `interface` argument to the constructor
+    can be a string that is resolved via the utility registry. The ZCML looks
+    like this:
+
+    <zope:vocabulary
+        name='IObjects'
+        factory='zope.webdev.vocabulary.FactoryVocabulary'
+        interface='zope.webdev.vocabulary.IObject' />
+    >>> ztapi.provideUtility(IInterface, IObject,
+    ...                      'zope.webdev.vocabulary.IObject')
+    >>> vocab = FactoryVocabulary(None, 'zope.webdev.vocabulary.IObject')
+    >>> pprint.pprint(vocab._terms.items())
+    [(u'zope.webdev.vocabulary.IObject',
+      <FactoryTerm zope.webdev.vocabulary.IObject, instance of <Factory for <class 'zope.webdev.vocabulary.Object'>>>)]
+
+    Sometimes it is desirable to only select the name of a utility. For
+    this purpose a `nameOnly` argument was added to the constructor, in which
+    case the UtilityTerm's value is not the utility itself but the name of the
+    utility.
+
+    >>> vocab = FactoryVocabulary(None, IObject, nameOnly=True)
+    >>> pprint.pprint([term.value for term in vocab])
+    [u'zope.webdev.vocabulary.IObject']
+    """
+
+    def __init__(self, context, interface, nameOnly=False):
+        if nameOnly is not False:
+            nameOnly = True
+        if isinstance(interface, (str, unicode)):
+            interface = zapi.getUtility(IInterface, interface)
+        self.interface = interface
+        utils = zapi.getUtilitiesFor(IFactory)
+        factories = []
+        for name, factory in utils:
+            if interface in factory.getInterfaces():
+                factories.append((name, factory))
+        self._terms = dict([(name, FactoryTerm(nameOnly and name or util, name))
+                            for name, util in factories])


Property changes on: zope.webdev/trunk/vocabulary.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: zope.webdev/trunk/webdev-configure.zcml
===================================================================
--- zope.webdev/trunk/webdev-configure.zcml	2006-01-30 09:56:12 UTC (rev 41493)
+++ zope.webdev/trunk/webdev-configure.zcml	2006-01-30 09:57:00 UTC (rev 41494)
@@ -0,0 +1 @@
+<include package="zope.webdev" />


Property changes on: zope.webdev/trunk/webdev-configure.zcml
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Zope-CVS mailing list