[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - configureCache.pt:1.1 cache.py:1.6 cache.zcml:1.3 caches.pt:1.4 connections.pt:1.6

Guido van Rossum guido@python.org
Mon, 28 Apr 2003 11:04:39 -0400


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

Modified Files:
	cache.py cache.zcml caches.pt connections.pt 
Added Files:
	configureCache.pt 
Log Message:
Finish configuration of caches.

=== Added File Zope3/src/zope/app/browser/services/configureCache.pt ===
<html metal:use-macro="context/@@standard_macros/page">

<div metal:fill-slot="body"
     i18n:domain="zope"
     >

<h2 i18n:translate="">Cache configurations for
    <i tal:content="request/name" i18n:name="cache_name">name</i></h2>

<form method="POST"
      action="."
      tal:attributes="action request/URL"
      tal:define="form view/update"
      >
  <input type="hidden"
         name="name"
         tal:attributes="value request/name"
         />

  <div tal:replace="structure form" />

  <input type="submit"
         name="submit_update"
         value="Update"
         i18n:attributes="value form_update"
         />

</form>

</div>

</html>


=== Zope3/src/zope/app/browser/services/cache.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/services/cache.py:1.5	Thu Apr 24 17:01:25 2003
+++ Zope3/src/zope/app/browser/services/cache.py	Mon Apr 28 11:04:38 2003
@@ -22,9 +22,38 @@
 from zope.publisher.browser import BrowserView
 from zope.app.traversing import traverse
 
+class Caches(BrowserView):
+
+    # self.context is the local caching service
+
+    def getConfigs(self):
+        L = []
+        for name in self.context.listConfigurationNames():
+            cr = self.context.queryConfigurations(name)
+            active = cr.active()
+            d = {"name": name,
+                 "url": "",
+                 "configurl": ("@@configureCache.html?name=%s" % name),
+                 }
+            if active is not None:
+                d["url"] = str(getView(active.getComponent(),
+                                       "absolute_url",
+                                       self.request))
+            L.append((name, d))
+        L.sort()
+        return [d for name, d in L]
+
+class ConfigureCache(BrowserView):
+
+    def update(self):
+        cr = self.context.queryConfigurations(self.request['name'])
+        form = getView(cr, "ChangeConfigurations", self.request)
+        form.update()
+        return form
+
 class UseConfiguration(BrowserView):
 
-    """View for displaying the configurations for a connection."""
+    """View for displaying the configurations for a cache."""
 
     def uses(self):
         """Get a sequence of configuration summaries."""


=== Zope3/src/zope/app/browser/services/cache.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/services/cache.zcml:1.2	Thu Apr 24 17:01:25 2003
+++ Zope3/src/zope/app/browser/services/cache.zcml	Mon Apr 28 11:04:38 2003
@@ -1,25 +1,44 @@
 <zopeConfigure xmlns='http://namespaces.zope.org/browser'>
 
-  <menuItems
-      menu="zmi_views"
-      for="zope.app.services.cache.ILocalCachingService">
-      <menuItem title="Caches" action="index.html"/>
-    </menuItems>
+<!-- Browser directives for the cache service -->
 
+  <!-- "Add service" menu entry to add a cache service.
+       The action attribute matches a factory id defined in
+       zope/app/services/configure.zcml. -->
+  <menuItem
+      for="zope.app.interfaces.container.IAdding"
+      menu="add_service" title="Caching Service"
+      action="CachingService"
+      permission="zope.ManageServices"
+      description="A Persistent Caching Service for TTW development"
+      />
+
+  <!-- ZMI tab named "Caches" for the cache service -->
   <page
       for="zope.app.services.cache.ILocalCachingService"
       name="index.html"
       template="caches.pt"
-      class=".configuration.NameComponentConfigurableView"
-      permission="zope.ManageServices" 
+      class=".cache.Caches"
+      permission="zope.ManageServices"
+      menu="zmi_views" title="Caches"
       />
 
-  <menuItem
-      menu="add_service"
-      for="zope.app.interfaces.container.IAdding"
-      action="CachingService"
-      title="Caching Service"
-      description="A Persistent Caching Service for TTW development"
+<!-- Browser directives for configuring individual cache objects -->
+
+  <!-- Configuration page for cache objects.  You get here by
+       clicking on the (configure) link for a particular cache
+       in the "Caches" tab of the cache service.  It shows
+       a menu of different configurations, at most one of which
+       is active.  You can activate a different configuration, or
+       click on an individual configuration to edit it.
+       (Note that this page doesn't really apply to a single cache,
+       it applies to a single cache name. -->
+  <page
+      for="zope.app.services.cache.ILocalCachingService"
+      name="configureCache.html"
+      template="configureCache.pt"
+      class=".cache.ConfigureCache"
+      permission="zope.ManageServices"
       />
 
   <!-- ZMI tab named "Configurations" for cache objects.


=== Zope3/src/zope/app/browser/services/caches.pt 1.3 => 1.4 ===
--- Zope3/src/zope/app/browser/services/caches.pt:1.3	Sun Mar 23 11:45:43 2003
+++ Zope3/src/zope/app/browser/services/caches.pt	Mon Apr 28 11:04:38 2003
@@ -1,32 +1,44 @@
-<html metal:use-macro="views/standard_macros/page">
-<body metal:fill-slot="body">
-<div metal:use-macro="view/indexMacros/macros/body">
-
-  <h2 metal:fill-slot="heading">Caches configured in this cache service.</h2>
-
-  <p metal:fill-slot="empty_text">No caches have been configured</p>
-
-  <div metal:fill-slot="extra_top">
-
-    <p>For each cache, the cache name is given and all of the
-       components registered to provide the cache are shown.  You
-       may select the component to provide the cache or disable the
-       cache.
-    </p>
-
-    <p>Select a cache name or a component name to visit the cache
-       or component.
-    </p>
-
-  </div>
-
-  <p metal:fill-slot="help_text">To configure a cache, add a database
-     adapter component to a <em>site-management folder</em>. 
-     After the component
-     is added, add a cache configuration that configures the component to
-     provide a cache.
-  </p>
+<html metal:use-macro="context/@@standard_macros/page">
+
+<div metal:fill-slot="body"
+     i18n:domain="zope"
+     tal:define="configs view/getConfigs"
+     >
+
+<h2 i18n:translate="">Configured caches in this cache service:</h2>
+
+<table tal:condition="configs">
+  <tbody>
+    <tr tal:repeat="config configs">
+      <td>
+
+        <a href="."
+           tal:condition="config/url"
+           tal:attributes="href config/url"
+           >
+          <span i18n:translate="">
+            <span tal:replace="config/name" i18n:name="cache_name" />
+          </span>
+        </a>
+
+        <span tal:condition="not:config/url">
+          <span i18n:translate="">
+            <span tal:replace="config/name" i18n:name="cache_name" />
+          </span>
+          <span i18n:translate="">(inactive)</span>
+        </span>
+
+      </td>
+      <td>
+        <a href="."
+           tal:attributes="href config/configurl"
+           i18n:translate=""
+           >(configure)</a>
+      </td>
+    </tr>
+  </tbody>
+</table>
 
 </div>
-</body>
+
 </html>


=== Zope3/src/zope/app/browser/services/connections.pt 1.5 => 1.6 ===
--- Zope3/src/zope/app/browser/services/connections.pt:1.5	Wed Apr 23 17:04:32 2003
+++ Zope3/src/zope/app/browser/services/connections.pt	Mon Apr 28 11:04:38 2003
@@ -5,7 +5,7 @@
      tal:define="configs view/getConfigs"
      >
 
-<h2 i18n:translate="">Configured connections in this connection service:</h2>
+<h2 i18n:translate="">Configured caches in this cache service:</h2>
 
 <table tal:condition="configs">
   <tbody>
@@ -17,13 +17,13 @@
            tal:attributes="href config/url"
            >
           <span i18n:translate="">
-            <span tal:replace="config/name" i18n:name="connection_name" />
+            <span tal:replace="config/name" i18n:name="cache_name" />
           </span>
         </a>
 
         <span tal:condition="not:config/url">
           <span i18n:translate="">
-            <span tal:replace="config/name" i18n:name="connection_name" />
+            <span tal:replace="config/name" i18n:name="cache_name" />
           </span>
           <span i18n:translate="">(inactive)</span>
         </span>