[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - configure.zcml:1.28 editconfiguration.pt:1.5 service.py:1.10 componentconfigitemedit.pt:NONE service_index.pt:NONE

Guido van Rossum guido@python.org
Mon, 10 Mar 2003 17:47:03 -0500


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

Modified Files:
	configure.zcml editconfiguration.pt service.py 
Removed Files:
	componentconfigitemedit.pt service_index.pt 
Log Message:
Restructure the default configuration manager view.

This now has two lines per configuration object.  Line one is the
"usage summary", typically showing the kind of configuration and the
key.  Line two is the "implementation summary", showing some of the
additionally configured information.  What exactly is shown is up to
the configuration object.

Adding the methods to come up with the summary lines to the
configuration object rather than making them views is perhaps a little
odd, but Jim decided that it was better than invoking the complicated
machinery needed to define views to return this information.

The "ItemEdit" views are gone, as are some associated templates.

I renamed some of the views to index.html, because we seem to like
that as the default view nowadays.


=== Zope3/src/zope/app/browser/services/configure.zcml 1.27 => 1.28 ===
--- Zope3/src/zope/app/browser/services/configure.zcml:1.27	Mon Mar 10 15:28:10 2003
+++ Zope3/src/zope/app/browser/services/configure.zcml	Mon Mar 10 17:46:30 2003
@@ -245,17 +245,6 @@
       class="zope.app.browser.services.componentconfigurl.ComponentConfigURL"
       />
 
-  <editform
-      for=
-      "zope.app.interfaces.services.configuration.INamedComponentConfiguration"
-      name="ItemEdit"
-      schema="zope.app.interfaces.services.configuration.IConfiguration"
-      template="componentconfigitemedit.pt"
-      label="XXX not used but can't be omitted"
-      class="zope.app.browser.services.componentconfigurl.ComponentConfigURL"
-      permission = "zope.ManageServices"
-      />
-
   <page
       for=
       "zope.app.interfaces.services.configuration.INamedComponentConfiguration"
@@ -307,15 +296,6 @@
     permission="zope.ManageServices"
     />
 
-<subeditform
-    schema="zope.app.interfaces.services.interfaces.IAdapterConfiguration"
-    name="ItemEdit"
-    label="Adapter"
-    permission="zope.ManageServices"
-    fields="forInterface providedInterface adapterName factoryName status"
-    fulledit="."
-    />
-
 <page
      for = "zope.app.interfaces.services.interfaces.IAdapterConfiguration"
      name = "ConfigurationSummary"
@@ -371,15 +351,6 @@
     permission="zope.ManageServices"
     />
 
-<subeditform
-    schema="zope.app.interfaces.services.interfaces.IViewConfiguration"
-    name="ItemEdit"
-    label="View"
-    permission="zope.ManageServices"
-    fields="forInterface viewName presentationType class_ layer permission
-            status"
-    />
-
 <page
      for = "zope.app.interfaces.services.interfaces.IViewConfiguration"
      name = "ConfigurationSummary"
@@ -438,15 +409,6 @@
     permission="zope.ManageServices"
     />
 
-<subeditform
-    schema="zope.app.interfaces.services.interfaces.IPageConfiguration"
-    name="ItemEdit"
-    label="Page"
-    permission="zope.ManageServices"
-    fields="forInterface viewName class_ layer permission
-            status"
-    />
-
 <page
      for="zope.app.interfaces.services.interfaces.IPageConfiguration"
      name="ConfigurationSummary"
@@ -572,7 +534,7 @@
 
   <page
      for="zope.app.interfaces.services.service.IServiceManager"
-     name="services.html"
+     name="index.html"
      menu="zmi_views" title="Services"
      template="services.pt"
      class=".service.ServiceSummary"
@@ -587,13 +549,6 @@
      permission="zope.ManageServices"
      />
 
-  <page
-     for="zope.app.interfaces.services.service.IServiceManager"
-     name="index.html"
-     template="service_index.pt"
-     permission="zope.ManageServices"
-     />
-
   <icon
       name="zmi_icon"
       for="zope.app.interfaces.services.service.IServiceManager" 
@@ -703,19 +658,13 @@
 
 <!-- ConfigurationManager -->
 
-  <defaultView
-     for=
-     "zope.app.interfaces.services.configurationmanager.IConfigurationManager"
-     name="contents.html"
-     />
-
   <page
-     name="contents.html" 
+     name="index.html" 
      for=
      "zope.app.interfaces.services.configurationmanager.IConfigurationManager"
      menu="zmi_views" title="Configuration"
      permission="zope.ManageServices"
-     class="zope.app.browser.services.service.EditConfiguration"
+     class=".service.EditConfiguration"
      template="editconfiguration.pt" 
      />
 


=== Zope3/src/zope/app/browser/services/editconfiguration.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/editconfiguration.pt:1.4	Tue Jan 21 16:37:37 2003
+++ Zope3/src/zope/app/browser/services/editconfiguration.pt	Mon Mar 10 17:46:30 2003
@@ -1,37 +1,59 @@
 <html metal:use-macro="views/standard_macros/page">
-<head>
-  <title>View Service Configuration</title>
-</head>
-<body>
-<div metal:fill-slot="body">
-<form action="." method="POST"
-      tal:define="info view/action"
-      tal:attributes="action request/URL">
-
-<div tal:condition="info" tal:content="info" />
-<div class="row" tal:repeat="config view/configInfo">
-   <div style="float:left">
-      <input type=checkbox name='keys:list'
-             value='2' 
-             tal:attributes="value config/key"/>
-   </div>
-   <div class="item">
-         <div tal:content="structure config/view">
-             Edit Adapter Directives
-         </div>
-   </div>
-</div>
-<div class="row">
-    <input type=submit name='refresh_submit' value="Refresh">
-    <input type=submit name='UPDATE_SUBMIT' value="Update">
-    <input type=submit name='add_submit' value="Add">
-    <input type=submit name='remove_submit' value="Remove">&nbsp;&nbsp;
-    <input type=submit name='top_submit' value="Top">
-    <input type=submit name='up_submit' value="Up">
-    <input type=submit name='down_submit' value="Down">
-    <input type=submit name='bottom_submit' value="Bottom">
-</div>
-</form>
-</div>
-</body>
+  <head>
+    <title>View Service Configuration</title>
+  </head>
+
+  <body metal:fill-slot="body">
+
+    <h2>Configuration Manager</h2>
+
+    <form action="." method="POST"
+          tal:define="message view/update"
+          tal:attributes="action request/URL">
+
+      <p tal:condition="message" tal:content="message" />
+
+      <table>
+        <thead>
+          <tr>
+            <th></th>
+            <th align="left">Summary</th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr tal:repeat="config view/configInfo">
+            <td valign="top">
+              <input type=checkbox name='keys:list' value='1'
+                     tal:attributes="value config/name" />
+            </td>
+            <td>
+              <a href="." tal:attributes="href config/name">
+                <span tal:content="config/line1|default">
+		  Config item <span tal:content="config/name" />
+                </span>
+              </a>
+              <span tal:condition="not:config/active">(disabled)</span>
+              <br>
+              <span tal:content="config/line2|default">
+                (No implementation summary)
+              </span>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <div class="row">
+        <input type=submit name='refresh_submit' value="Refresh">
+        <input type=submit name='UPDATE_SUBMIT' value="Submit">
+        <input type=submit name='remove_submit' value="Remove">
+        &nbsp;&nbsp;
+        <input type=submit name='top_submit' value="Top">
+        <input type=submit name='up_submit' value="Up">
+        <input type=submit name='down_submit' value="Down">
+        <input type=submit name='bottom_submit' value="Bottom">
+      </div>
+
+    </form>
+
+  </body>
 </html>


=== Zope3/src/zope/app/browser/services/service.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/browser/services/service.py:1.9	Mon Mar 10 15:35:16 2003
+++ Zope3/src/zope/app/browser/services/service.py	Mon Mar 10 17:46:30 2003
@@ -93,19 +93,14 @@
 
 
 class EditConfiguration(BrowserView):
-    """Adding component for service containers."""
-
-    menu_id = "add_component"
+    """A view on a configuration manager, used by configurations.pt."""
 
     def __init__(self, context, request):
         self.request = request
         self.context = context
 
-    def action(self):
+    def update(self):
         """Perform actions depending on user input."""
-        if 'add_submit' in self.request:
-            self.request.response.redirect('+')
-            return ''
 
         if 'keys' in self.request:
             k = self.request['keys']
@@ -129,6 +124,8 @@
         elif 'down_submit' in self.request:
             if not k: return msg
             self.context.moveDown(k)
+        elif 'refresh_submit' in self.request:
+            pass # Nothing to do
 
         return ''
 
@@ -140,13 +137,20 @@
 
     def configInfo(self):
         """Render View for each directives."""
-        r = []
-        for name, directive in self.context.items():
-            d = ContextWrapper(directive, self.context, name = name)
-            view = getView(d, 'ItemEdit', self.request)
-            view.setPrefix('config'+str(name))
-            r.append({'key': name, 'view': view})
-        return r
+        result = []
+        for name, configobj in self.context.items():
+            configobj = ContextWrapper(configobj, self.context, name=name)
+            url = str(getView(configobj, 'absolute_url', self.request))
+            active = configobj.status == Active
+            summary1 = getattr(configobj, "usageSummary", None)
+            summary2 = getattr(configobj, "implementationSummary", None)
+            item = {'name': name, 'url': url, 'active': active}
+            if summary1:
+                item['line1'] = summary1()
+            if summary2:
+                item['line2'] = summary2()
+            result.append(item)
+        return result
 
 
 class AddServiceConfiguration(BrowserView):

=== Removed File Zope3/src/zope/app/browser/services/componentconfigitemedit.pt ===

=== Removed File Zope3/src/zope/app/browser/services/service_index.pt ===