[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.p - some view cleanup and fixes

Yvo Schubbe y.2011 at wcm-solutions.de
Thu Nov 17 08:30:15 UTC 2011


Log message for revision 123404:
  - some view cleanup and fixes

Changed:
  U   Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.pt
  U   Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py

-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.pt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.pt	2011-11-17 07:02:10 UTC (rev 123403)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.pt	2011-11-17 08:30:15 UTC (rev 123404)
@@ -1,37 +1,16 @@
 <html metal:use-macro="context/@@standard_macros/page">
-
 <body>
 
 <metal:slot metal:fill-slot="body" i18n:domain="cmf_default">
 
-<ul class="errors" tal:condition="view/errors">
- <li tal:repeat="error view/error_views"
-     tal:content="structure error">Error Message</li>
-</ul>
-
+<tal:case condition="not: view/allowed">
 <h1 tal:content="view/label">Folder Syndication</h1>
 
-<p class="errors" tal:condition="view/disabled"
-                  i18n:translate="">Portal syndication is currently disabled</p>
-
-<form action="." method="post"
-      tal:attributes="action request/ACTUAL_URL">
-
-    <fieldset tal:repeat="widget view/widgets">
-      <label tal:attributes="for widget/name" tal:content="widget/label"></label>
-      <tal:block replace="structure widget" />
-      <legend tal:content="widget/hint"></legend>
-      <tal:block condition="widget/error"
-          replace="structure widget/error" />
-    </fieldset>
-
-  <div class="buttons">
-    <tal:loop tal:repeat="action view/actions"
-     tal:replace="structure action/render" />
-  </div>
-
-</form>
-
+<p class="errors" i18n:translate="">Portal syndication is currently disabled</p>
+</tal:case>
+<tal:case condition="view/allowed">
+  <metal:macro metal:use-macro="view/base_template/macros/form" />
+</tal:case>
 </metal:slot>
 
 </body>

Modified: Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py	2011-11-17 07:02:10 UTC (rev 123403)
+++ Products.CMFDefault/trunk/Products/CMFDefault/browser/admin/syndication.py	2011-11-17 08:30:15 UTC (rev 123404)
@@ -12,22 +12,16 @@
 ##############################################################################
 """Syndication configuration views.
 """
-from zope.annotation.interfaces import IAnnotations
+
+from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 from zope.component import getAdapter
 from zope.component import getUtility
-from zope.component import adapts
-from zope.interface import alsoProvides
 from zope.formlib import form
-from zope.interface import implements
 
 from Products.CMFCore.interfaces import ISyndicationTool
-from Products.CMFCore.interfaces import IFolderish
-from Products.CMFDefault.SyndicationTool import SyndicationTool
-from Products.CMFDefault.SyndicationInfo import ISyndicationInfo
 from Products.CMFDefault.browser.utils import memoize
-from Products.CMFDefault.formlib.form import SettingsEditFormBase, EditFormBase
-from Products.CMFDefault.formlib.schema import ProxyFieldProperty
-from Products.CMFDefault.formlib.schema import SchemaAdapterBase
+from Products.CMFDefault.formlib.form import SettingsEditFormBase
+from Products.CMFDefault.SyndicationInfo import ISyndicationInfo
 from Products.CMFDefault.utils import Message as _
 
 
@@ -35,7 +29,7 @@
 
     """Enable or disable syndication for a site."""
 
-    form_fields = form.FormFields(ISyndicationInfo)
+    form_fields = form.FormFields(ISyndicationInfo).omit('enabled')
     label = _(u"Configure Portal Syndication")
 
     actions = form.Actions(
@@ -60,6 +54,11 @@
     )
 
     @memoize
+    def getContent(self):
+        syndtool = getUtility(ISyndicationTool)
+        return syndtool
+
+    @memoize
     def enabled(self, action=None):
         return self.getContent().enabled
 
@@ -67,16 +66,6 @@
     def disabled(self, action=None):
         return not self.getContent().enabled
 
-    @memoize
-    def getContent(self):
-        syndtool = getUtility(ISyndicationTool)
-        return syndtool
-
-    def setUpWidgets(self, ignore_request=False):
-        self.adapters = {}
-        super(Site, self).setUpWidgets(ignore_request)
-        self.widgets['enabled'].hide = True
-
     def handle_enable(self, action, data):
         self.getContent().enabled = True
         self._handle_success(action, data)
@@ -99,14 +88,16 @@
     """Enable, disable and customise syndication settings for a folder.
     """
 
-    form_fields = form.FormFields(ISyndicationInfo)
+    base_template = SettingsEditFormBase.template
+    template = ViewPageTemplateFile("syndication.pt")
+    form_fields = form.FormFields(ISyndicationInfo).omit('enabled')
     label = _(u"Configure Folder Syndication")
 
     actions = form.Actions(
         form.Action(
             name="enable",
             label=_(u"Enable Syndication"),
-            condition="allowed",
+            condition="disabled",
             success="handle_enable",
             ),
         form.Action(
@@ -141,22 +132,10 @@
     def enabled(self, action=None):
         return self.getContent().enabled
 
-    def setUpWidgets(self, ignore_request=False):
-        if not self.allowed():
-            self.form_fields = form.FormFields()
-            self.widgets = {}
-            return
-        super(Folder, self).setUpWidgets(ignore_request)
-        self.widgets['enabled'].hide = True
-
     @memoize
     def allowed(self, action=None):
         return self.getContent().allowed
 
-    def applyChanges(self, data):
-        return form.applyData(self.context, self.form_fields, data,
-                          self.adapters)
-
     def handle_enable(self, action, data):
         self.getContent().enable()
         self._handle_success(action, data)



More information about the checkins mailing list