[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services - service.py:1.7.2.2 serviceactivation.pt:1.1.2.2

Tim Peters tim.one@comcast.net
Thu, 6 Mar 2003 18:14:18 -0500


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

Modified Files:
      Tag: service-config-branch
	service.py serviceactivation.pt 
Log Message:
The new screen listing the configurations for a service is functional
now:  you can switch to a new active configuration, or disable all
configurations, for a service via clicking the appropriate radio button.
Each configuration consumes one line, with a radio button, the
implementation object name (which is also a link), and the configuration
object name (also a link).


=== Zope3/src/zope/app/browser/services/service.py 1.7.2.1 => 1.7.2.2 ===
--- Zope3/src/zope/app/browser/services/service.py:1.7.2.1	Thu Mar  6 16:51:51 2003
+++ Zope3/src/zope/app/browser/services/service.py	Thu Mar  6 18:14:18 2003
@@ -259,3 +259,25 @@
                     }
             result.append(item)
         return result
+
+    def action(self):
+        active = self.request.get("active")
+        if not active:
+            return ""
+
+        sm = getServiceManager(self.context)
+        registry = sm.queryConfigurationsFor(self.context)
+        old_active = registry.active()
+        if active == "None":
+            new_active = None
+        else:
+            new_active = traverse(sm, "Packages/" + active)
+        if old_active == new_active:
+            return "No change"
+
+        if new_active is None:
+            old_active.status = Registered
+            return "Service deactivated"
+        else:
+            new_active.status = Active
+            return active + " activated"


=== Zope3/src/zope/app/browser/services/serviceactivation.pt 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/browser/services/serviceactivation.pt:1.1.2.1	Thu Mar  6 16:51:51 2003
+++ Zope3/src/zope/app/browser/services/serviceactivation.pt	Thu Mar  6 18:14:18 2003
@@ -17,7 +17,9 @@
     <span tal:replace="view/serviceName" /> 
   </h2>
 
-  <form>
+  <p tal:content="view/action">Message from action() goes here</p>
+
+  <form action="@@serviceActivation.html" method="POST">
     <table tal:define="registry view/listRegistry">
 
       <thead>
@@ -27,7 +29,7 @@
       <tbody>
 
         <tr tal:repeat="config registry">
-          <td><input type="radio" name="Active" value="default/configure/1"
+          <td><input type="radio" name="active" value="default/configure/1"
                      tal:attributes="value config/id;
                                      checked config/active" /></td>
           <td><a href="foo"
@@ -39,7 +41,7 @@
         </tr>
 
         <tr>
-          <td><input type="radio" name="Active" value="None"
+          <td><input type="radio" name="active" value="None"
                      tal:attributes="checked view/isDisabled"></td>
           <td>Disable</td>
         </tr>
@@ -54,4 +56,3 @@
 
 </div>
 </html>
-