[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/Browser - addservicemanager.py:1.1 configure.zcml:1.8

Jim Fulton jim@zope.com
Fri, 20 Dec 2002 18:13:02 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/Browser
In directory cvs.zope.org:/tmp/cvs-serv8305/Browser

Modified Files:
	configure.zcml 
Added Files:
	addservicemanager.py 
Log Message:
navigation to anfd creation of service managers is now accomplished
via the actions menu.



=== Added File Zope3/lib/python/Zope/App/OFS/Services/Browser/addservicemanager.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: addservicemanager.py,v 1.1 2002/12/20 23:13:00 jim Exp $
"""

from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Services.ServiceManager.ServiceManager import ServiceManager


class AddServiceManager(BrowserView):

    def addServiceManager(self):
        sm = ServiceManager()
        if self.context.hasServiceManager():
            raise ValueError(
                  'This folder already contains a service manager')
        self.context.setServiceManager(sm)
        self.request.response.redirect("++etc++Services/")


=== Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml:1.7	Thu Dec 19 15:38:23 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml	Fri Dec 20 18:13:00 2002
@@ -299,6 +299,31 @@
     title="ZPT Template"
     />
 
+<!-- Service Manager navigation action -->
+
+<view
+  for="Zope.App.ComponentArchitecture.IServiceManagerContainer."
+  permission="Zope.ManageServices" 
+  factory=".Browser.addservicemanager.AddServiceManager"
+  >
+  <page name="addServiceManager.html" attribute="addServiceManager" />
+</view>
+
+<menuItems menu="zmi_actions"
+  for="Zope.App.ComponentArchitecture.IServiceManagerContainer."
+  >
+
+  <menuItem title="Local Service Manager"
+            action="++etc++Services/index.html"
+            filter="context/hasServiceManager"
+            />
+
+  <menuItem title="Turn On Local Service Manager"
+            action="@@addServiceManager.html"
+            filter="not:context/hasServiceManager"
+             />
+
+</menuItems>
 
 
 </zope:zopeConfigure>