[Zope3-checkins] SVN: Zope3/branches/srichter-blow-services/src/zope/app/ Registration viewing in page folders now works properly.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Feb 4 17:31:20 EST 2005


Log message for revision 29049:
  Registration viewing in page folders now works properly.
  
  

Changed:
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml
  U   Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/__init__.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.py
  U   Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.zcml
  U   Zope3/branches/srichter-blow-services/src/zope/app/presentation/configure.zcml
  A   Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagereg_details.pt
  U   Zope3/branches/srichter-blow-services/src/zope/app/presentation/registration.py

-=-
Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/browser/configure.zcml	2005-02-04 22:31:20 UTC (rev 29049)
@@ -84,6 +84,13 @@
       menu="zmi_views" title="Registration"
       />
 
+  <menuItem
+      menu="zmi_actions"
+      for="zope.app.component.interfaces.registration.IRegisterableContainer"
+      title="Registrations"
+      action="++registrations++/@@SelectedManagementView.html"
+      permission="zope.ManageSite"
+      />
 
 <!-- Site Management Folder -->
 
@@ -197,17 +204,7 @@
     <page name="index.html" template="site_management.pt" />
   </view>
 
-<!-- Site Management Folder -->
 
-  <menuItem
-      menu="zmi_actions"
-      for="zope.app.component.interfaces.ISiteManagementFolder"
-      title="Registrations"
-      action="++registrations++/@@SelectedManagementView.html"
-      permission="zope.ManageSite"
-      />
-
-
 <!-- Utility Registration -->
 
   <!-- When creating a new utility object, you are taken to this

Modified: Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/__init__.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/__init__.py	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/component/interfaces/__init__.py	2005-02-04 22:31:20 UTC (rev 29049)
@@ -135,7 +135,7 @@
     # XXX: for now
     factoryName = zope.schema.TextLine(
         title=_(u"Factory Name"),
-        readonly=True,
+        readonly=False,
         required=False,
         )
 

Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.py	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.py	2005-02-04 22:31:20 UTC (rev 29049)
@@ -16,6 +16,7 @@
 $Id$
 """
 __docformat__ = "reStructuredText"
+from zope.app import zapi
 
 class PageFolderDefaultConfiguration(object):
     "Make sure to update all page template registrations, when info changed"
@@ -43,3 +44,19 @@
         super(PageRegistrationView, self).update()
         if "UPDATE_SUBMIT" in self.request:
             self.context.validate()
+
+class PageRegistrationDetails(object):
+
+    def required(self):
+        required = self.context.required
+        return required.__module__ + '.' + required.__name__
+
+    def name(self):
+        return self.context.name or '<no name>'
+
+    def template(self):
+        url = zapi.getMultiAdapter(
+            (self.context.template, self.request), name='absolute_url')
+        name = zapi.name(self.context.template)
+        return {'url': url, 'name': name}
+    

Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.zcml	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/browser.zcml	2005-02-04 22:31:20 UTC (rev 29049)
@@ -16,6 +16,7 @@
       schema=".interfaces.IPageRegistration"
       name="index.html"
       class=".browser.PageRegistrationView"
+      fields="required name template factoryName permission status attribute"
       menu="zmi_views" label="Change page"
       permission="zope.ManageSite" />
 
@@ -57,36 +58,43 @@
   <!-- Page Template -->
 
   <view
-    for=".interfaces.IZPTTemplate"
-    name="index.html"
-    class=".browser.Source"
-    permission="zope.ManageSite" />
+      for=".interfaces.IZPTTemplate"
+      name="index.html"
+      class=".browser.Source"
+      permission="zope.ManageSite" />
 
   <editform
-    schema=".interfaces.IZPTInfo"
-    name="edit.html"
-    menu="zmi_views"
-    label="ZPT Template"
-    permission="zope.ManageSite" 
-    />
+      schema=".interfaces.IZPTInfo"
+      name="edit.html"
+      menu="zmi_views"
+      label="ZPT Template"
+      permission="zope.ManageSite" 
+      />
 
   <addMenuItem
-    permission="zope.ManageSite"
-    class=".zpt.ZPTTemplate"
-    title="ZPT Template" />
+      permission="zope.ManageSite"
+      class=".zpt.ZPTTemplate"
+      title="ZPT Template" />
 
- <addform
+  <addform
       for=".interfaces.IZPTTemplate"
       schema=".interfaces.IPageRegistration"
       name="addRegistration.html"
       class="zope.app.component.browser.registration.AddComponentRegistration"
       label="Register a view ZPT"
       permission="zope.ManageSite"
-      fields="required name
-              template factoryName permission status attribute"
+      fields="required name template factoryName permission status attribute"
       content_factory=".registration.PageRegistration"
       arguments="name"
       keyword_arguments="required permission factoryName template attribute"
       />
 
+  <page
+      for=".interfaces.IPageRegistration"
+      name="details"
+      template="pagereg_details.pt"
+      class=".browser.PageRegistrationDetails"
+      permission="zope.Public"
+      />
+
 </configure>

Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/configure.zcml
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/configure.zcml	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/configure.zcml	2005-02-04 22:31:20 UTC (rev 29049)
@@ -12,6 +12,17 @@
         />
   </content>
   
+  <class class=".registration.Registered">
+    <allow attributes="registrations" />
+  </class>
+
+  <adapter
+      for=".interfaces.IZPTTemplate"
+      provides="..component.interfaces.registration.IRegistered"
+      factory=".registration.Registered"
+      trusted="true"
+      />
+
   <subscriber
       factory=".registration.PageRegistrationAddSubscriber"
       for=".interfaces.IPageRegistration 

Added: Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagereg_details.pt
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagereg_details.pt	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/pagereg_details.pt	2005-02-04 22:31:20 UTC (rev 29049)
@@ -0,0 +1,17 @@
+<ul style="margin-top: 0; margin-bottom: 0">
+  <li>
+    <i i18n:translate="">for:</i>
+      <span tal:content="view/required">zope.interface.Interface</span>
+  </li>
+  <li>
+    <i i18n:translate="">name:</i>
+    <span tal:content="view/name">myutility</span>
+  </li>
+  <li tal:define="component view/template">
+    <i i18n:translate="">template:</i>
+    <a href="" 
+       tal:attributes="href 
+         string:${component/url}/@@SelectedManagementView.html"
+       tal:content="component/name">myutility</a>
+  </li>
+</ul>
\ No newline at end of file

Modified: Zope3/branches/srichter-blow-services/src/zope/app/presentation/registration.py
===================================================================
--- Zope3/branches/srichter-blow-services/src/zope/app/presentation/registration.py	2005-02-04 22:19:53 UTC (rev 29048)
+++ Zope3/branches/srichter-blow-services/src/zope/app/presentation/registration.py	2005-02-04 22:31:20 UTC (rev 29049)
@@ -99,6 +99,22 @@
     component = property(component)
 
 
+class Registered(object):
+    """An adapter from IRegisterable to IRegistered."""
+    implements(zope.app.component.interfaces.registration.IRegistered)
+    __used_for__ = zope.app.component.interfaces.registration.IRegisterable
+
+    def __init__(self, registerable):
+        self.registerable = registerable
+
+    def registrations(self):
+        rm = zapi.getParent(self.registerable).registrationManager
+        ICR = zope.app.component.interfaces.registration.IComponentRegistration
+        return [reg for reg in rm.values()
+                if (ICR.providedBy(reg) and
+                    reg.template is self.registerable)]
+
+
 def PageRegistrationAddSubscriber(registration, event):
     if registration.template is not None:
         # XXX: Needs investigating



More information about the Zope3-Checkins mailing list