[Zope3-checkins] CVS: Zope3/src/zope/app/browser/skins - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 managementviewselector.py:1.1.2.1 menu.py:1.1.2.1

Jim Fulton jim@zope.com
Mon, 23 Dec 2002 14:31:19 -0500


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

Added Files:
      Tag: NameGeddon-branch
	__init__.py configure.zcml managementviewselector.py menu.py 
Log Message:
Initial renaming before debugging

=== Added File Zope3/src/zope/app/browser/skins/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/browser/skins/configure.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   xmlns:browser='http://namespaces.zope.org/browser'
   >

<!-- Make index.html the (default) default view name for everything
     that doesn't provide its own default view.

     XXX this should eventually land in zope/app/browser/configure.zcml.
  --> 
<browser:defaultView name="index.html" />

<browser:view name="SelectedManagementView.html"
              permission="Zope.Public"
              factory="zope.app.browser.skins.managementviewselector.ManagementViewSelector" 
              allowed_interface="zope.publisher.interfaces.browser.IBrowserPublisher"
              allowed_attributes="__call__"
              />

<browser:view name="view_get_menu"
              permission="Zope.Public"
              factory="zope.app.browser.skins.menu.MenuAccessView" 
              allowed_interface="zope.app.interfaces.browser.skins.menu.IMenuAccessView"
              />

<include package=".ZopeTop" />

</zopeConfigure>


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

__metaclass__ = type

from zope.component import getService
from zope.publisher.browser import BrowserView
from zope.publisher.interfaces.browser import IBrowserPublisher

class ManagementViewSelector(BrowserView):
    """View that selects the first available management view
    """

    __implements__ = BrowserView.__implements__, IBrowserPublisher

    def browserDefault(self, request):
        return self, ()

    def __call__(self):
        context = self.context
        request = self.request
        browser_menu_service = getService(context, 'BrowserMenu')
        item = browser_menu_service.getFirstMenuItem(
            'zmi_views', context, request)
        if item:
            request.response.redirect(item['action'])
            return u''

        request.response.redirect('.') # Redirect to content/
        return u''
        

__doc__ = ManagementViewSelector.__doc__ + __doc__



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

from zope.publisher.browser import BrowserView
from zope.app.interfaces.browser.skins.menu import IMenuAccessView
from zope.component import getService

class MenuAccessView(BrowserView):
    __doc__ = IMenuAccessView.__doc__

    __implements__ = BrowserView.__implements__, IMenuAccessView

    def __getitem__(self, menu_id):
        context = self.context
        request = self.request
        browser_menu_service = getService(context, 'BrowserMenu')
        return browser_menu_service.getMenu(menu_id,
                                            self.context,
                                            self.request)
    

__doc__ = MenuAccessView.__doc__ + __doc__