[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - useconfiguration.pt:1.1.2.1 useconfiguration.py:1.1.2.1 configure.zcml:1.20.2.1

Jim Fulton jim@zope.com
Mon, 24 Feb 2003 18:36:56 -0500


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

Modified Files:
      Tag: use-config-branch
	configure.zcml 
Added Files:
      Tag: use-config-branch
	useconfiguration.pt useconfiguration.py 
Log Message:
Added the beginning of a view to display use configurations.


=== Added File Zope3/src/zope/app/browser/services/useconfiguration.pt ===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML metal:use-macro="context/@@standard_macros/page">
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Homepage Builder V4.0.0 for Linux">
<TITLE></TITLE>
</HEAD>
<BODY>
<div metal:fill-slot="body">
<P>Usages of this object:<BR>

<A href="http://."
   tal:repeat="use view/uses"
   tal:attributes="href use/url"
   tal:content="use/name">
   Utility Service
   </A>
</div>
</BODY>
</HTML>


=== Added File Zope3/src/zope/app/browser/services/useconfiguration.py ===
##############################################################################
# Copyright (c) 2003 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.
##############################################################################
"""Use-Configuration view

$Id: useconfiguration.py,v 1.1.2.1 2003/02/24 23:36:55 jim Exp $
"""
__metaclass__ = type

from zope.component import getAdapter, getView
from zope.app.interfaces.services.configuration import IUseConfiguration
from zope.app.traversing import traverse

class UseConfiguration:

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def uses(self):
        component = self.context
        useconfig = getAdapter(component, IUseConfiguration)
        result = []
        for path in useconfig.usages():
            config = traverse(component, path)
            url = getView(config, 'absolute_url', self.request)
            result.append({'name': path, 'url': url()})
        return result


=== Zope3/src/zope/app/browser/services/configure.zcml 1.20 => 1.20.2.1 ===
--- Zope3/src/zope/app/browser/services/configure.zcml:1.20	Fri Feb 21 09:50:05 2003
+++ Zope3/src/zope/app/browser/services/configure.zcml	Mon Feb 24 18:36:55 2003
@@ -250,6 +250,16 @@
       permission="zope.ManageServices"
       />
 
+  <browser:page
+      for="zope.app.interfaces.services.configuration.IUseConfigurable"
+      name="useConfiguration"
+      template="useconfiguration.pt"
+      class=".useconfiguration.UseConfiguration"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="Uses"
+      />
+
+
 <!-- INameComponentConfigurable default view -->
 
   <browser:page
@@ -388,6 +398,7 @@
      template = "view_search.pt"
      permission="zope.ManageServices" 
      class="zope.app.browser.services.view.ViewServiceView"
+     menu="zmi_views" title="Views"
      />  
 
 <browser:menuItem