[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/Browser - NameComponentConfigurable.pt:1.1 NameComponentConfigurableView.py:1.1 configure.zcml:1.5 NameConfigurable.pt:NONE NameConfigurableView.py:NONE

Steve Alexander steve@cat-box.net
Wed, 18 Dec 2002 15:23:35 -0500


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

Modified Files:
	configure.zcml 
Added Files:
	NameComponentConfigurable.pt NameComponentConfigurableView.py 
Removed Files:
	NameConfigurable.pt NameConfigurableView.py 
Log Message:
SteveA and Marius G.

We refactored the NamedComponentConfiguration and ComponentConfiguration.
Now, we have NamedConfiguration and NamedComponentConfiguration.

NamedConfigurable is now split into two parts, as appropriate to that
refactoring.

Cleaned up various extraneous imports, and changed various 
self --> wrapped_self. (Interestingly, this act revealed one ContextMethod
that did not in fact need to be a ContextMethod.)
 


=== Added File Zope3/lib/python/Zope/App/OFS/Services/Browser/NameComponentConfigurable.pt ===
<html metal:use-macro="views/standard_macros/page">
<body metal:fill-slot="body">
<div metal:define-macro="body">
<div tal:define="registries view/update">

  <h2 metal:define-slot="heading">Fruits configured in this fruits manager.</h2>

  <div tal:condition="not:registries">
       <p metal:define-slot="empty_text">No fruits have been configured</p>
  </div>

  <div tal:condition="registries">

    <div metal:define-slot="extra_top">

      <p>For each fruit, the fruit name is given and all of the components
         registered to provide the fruit are shown.  You may select the
         component to provide the fruit or disable the fruit.
      </p>

      <p>Select a fruit name or a component name to visit the fruit or
         component.
      </p>

    </div>

      <form action="." method="post" tal:attributes="action request/URL">

      <table width="100%">

         <tr tal:repeat="registry registries">
           <td valign="top" align="right">
              <a href="#"
                 tal:content="registry/name"
                 tal:attributes="href registry/url"
                 tal:condition="registry/active"
                 >Orange</a>
              <span tal:replace="registry/name"
                    tal:condition="registry/inactive" />
           </td>
           <td tal:content="structure registry/view">
           </td>
         </tr>

      </table>

      <input type=submit name="submit_update" value="Update"><br>

      </form>

    <div metal:define-slot="extra_bottom" />

  </div>

  <p metal:define-slot="help_text">To configure a fruit, add a fruit component
     to a <em>package</em> in <a href="Packages">Packages</a> or to the <a
     href="Packages/default">default package</a>. After the fruit is added, add
     a fruit configuration that configures the component to provide a fruit.
  </p>

</div>
</div>
</body>
</html>


=== Added File Zope3/lib/python/Zope/App/OFS/Services/Browser/NameComponentConfigurableView.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.
#
##############################################################################
"""Generic INameComponentConfigurable view mixin

$Id: NameComponentConfigurableView.py,v 1.1 2002/12/18 20:23:03 stevea Exp $
"""

from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.ComponentArchitecture import getView
from Zope.App.Traversing import traverse
from Zope.App.PageTemplate.ViewPageTemplateFile import ViewPageTemplateFile


class NameComponentConfigurableView(BrowserView):

    indexMacros = index = ViewPageTemplateFile('NameComponentConfigurable.pt')

    def update(self):

        names = list(self.context.listConfigurationNames())
        names.sort()

        items = []
        for name in names:
            registry = self.context.queryConfigurations(name)
            view = getView(registry, "ChangeConfigurations", self.request)
            view.setPrefix(name)
            view.update()
            cfg = registry.active()
            active = cfg is not None
            if active:
                ob = traverse(cfg, cfg.componentPath)
                url = str(getView(ob, 'absolute_url', self.request))
            else:
                url = None
            items.append(
                {"name": name,
                 "active": active,
                 "inactive": not active,
                 "view": view,
                 "url": url
                 })

        return items



=== Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml:1.4	Thu Dec 12 06:32:31 2002
+++ Zope3/lib/python/Zope/App/OFS/Services/Browser/configure.zcml	Wed Dec 18 15:23:03 2002
@@ -67,16 +67,16 @@
       permission="Zope.ManageServices"
       />
 
-<!-- INameConfigurable default view -->
+<!-- INameComponentConfigurable default view -->
 
   <defaultView
-      for=".ConfigurationInterfaces.INameConfigurable"
+      for=".ConfigurationInterfaces.INameComponentConfigurable"
       name="index.html"
       />
 
   <view
-      for=".ConfigurationInterfaces.INameConfigurable."
-      factory=".Browser.NameConfigurableView."
+      for=".ConfigurationInterfaces.INameComponentConfigurable."
+      factory=".Browser.NameComponentConfigurableView."
       permission="Zope.ManageServices">
     <page name="index.html" attribute="index" />
   </view>

=== Removed File Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurable.pt ===

=== Removed File Zope3/lib/python/Zope/App/OFS/Services/Browser/NameConfigurableView.py ===