[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - meta.zcml:1.1 metaconfigure.py:1.1 configure.zcml:1.20

K.Narasimha Murthy nmurthy at zeomega.com
Thu Dec 18 05:27:06 EST 2003


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

Modified Files:
	configure.zcml 
Added Files:
	meta.zcml metaconfigure.py 
Log Message:
Added new directive called containerViews to simplifys defination of container contents,index and add views.


=== Added File Zope3/src/zope/app/browser/container/meta.zcml ===
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:meta="http://namespaces.zope.org/meta">

  <meta:directives namespace="http://namespaces.zope.org/browser">

  <!-- browser cotainer views -->
  <meta:directive
        name="containerViews"
        schema=".metaconfigure.IContainerViews"
        handler=".metaconfigure.containerViews"
        />

  </meta:directives>

</configure>

=== Added File Zope3/src/zope/app/browser/container/metaconfigure.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

from zope.interface import Interface
from zope.configuration.fields import GlobalObject
from zope.schema import TextLine, Text, Id
from zope.app.publisher.browser.viewmeta import page, view
from zope.app.browser.container.contents import Contents
from zope.app.browser.container.adding import Adding

class IContainerViews(Interface):
    """Define a container views"""

    for_ = GlobalObject(
        title=u"The interface this containerViews are for.",
        description=u"""
        The containerViews will be for all objects that implement this
        interface.""",
        required=True
        )
     
    contents = Id(
        title=u"The permission needed for content page.",
        required=False,
        )

    index = Id(
        title=u"The permission needed for index page.",
        required=False,
        )

    add = Id(
        title=u"The permission needed for add page.",
        required=False,
        )


def containerViews(_context, for_, contents=None, add=None, index=None):
    """Create an container view for a given content type"""

    if for_ is None:
            raise ValueError("A for interface must be specified.")

    if contents is not None:
        page(_context=_context, name='contents.html', permission=contents,
            for_=for_, class_=Contents, attribute='contents', menu='zmi_views',
            title='Contents')
            
    if index is not None:
        page(_context=_context, name='index.html', permission=index, for_=for_, 
            class_=Contents, attribute='contents')

    if add is not None:
        viewObj = view(_context, name='+', menu='zmi_actions',
                       title='Add', for_=for_, permission=add, class_=Adding)
        viewObj.page(_context, name='index.html', attribute='index')
        viewObj.page(_context, name='action.html', attribute='action')
        viewObj()


        



=== Zope3/src/zope/app/browser/container/configure.zcml 1.19 => 1.20 ===
--- Zope3/src/zope/app/browser/container/configure.zcml:1.19	Thu Dec 18 04:57:07 2003
+++ Zope3/src/zope/app/browser/container/configure.zcml	Thu Dec 18 05:26:35 2003
@@ -31,4 +31,6 @@
       class="zope.app.browser.container.contents.Contents"
       template="commontasks.pt" />
 
+
+
 </zope:configure>




More information about the Zope3-Checkins mailing list