Repository: plone.app.controlpanel
Branch: refs/heads/master
Date: 2014-12-22T11:47:22+01:00
Author: Timo Stollenwerk () <contact@timostollenwerk.net>
Commit: https://github.com/plone/plone.app.controlpanel/commit/7d17ceff967024387abddae9fb58249160af5a12

Remove the syndication control panel (moved to Products.CMFPlone).

Files changed:
M CHANGES.rst
M plone/app/controlpanel/configure.zcml
M plone/app/controlpanel/syndication.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 3fc1415..6d29713 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,9 @@ Changelog
 3.0.0 (unreleased)
 ------------------
 
+- Remove the syndication control panel (moved to Products.CMFPlone).
+  [timo]
+
 - Remove the quickinstaller (moved to Products.CMFPlone).
   [timo]
 
diff --git a/plone/app/controlpanel/configure.zcml b/plone/app/controlpanel/configure.zcml
index 3be14a4..74ea35e 100644
--- a/plone/app/controlpanel/configure.zcml
+++ b/plone/app/controlpanel/configure.zcml
@@ -60,11 +60,4 @@
   <subscriber
       handler=".events.handleConfigurationChangedEvent" />
 
-  <browser:page
-      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
-      name="syndication-settings"
-      class=".syndication.SyndicationControlPanel"
-      permission="cmf.ManagePortal"
-      />
-
 </configure>
diff --git a/plone/app/controlpanel/syndication.py b/plone/app/controlpanel/syndication.py
index 912b825..e1d0f64 100644
--- a/plone/app/controlpanel/syndication.py
+++ b/plone/app/controlpanel/syndication.py
@@ -1,97 +1,3 @@
-from Products.CMFCore.utils import getToolByName
-from zope.component import getUtility
-from plone.registry.interfaces import IRegistry
-from zope.i18nmessageid import MessageFactory
-from Products.CMFPlone.interfaces.syndication import ISiteSyndicationSettings
-from plone.app.registry.browser import controlpanel
-from z3c.form import button
-from Products.statusmessages.interfaces import IStatusMessage
-
-_ = MessageFactory('plone')
-
-
-class SyndicationControlPanelForm(controlpanel.RegistryEditForm):
-    schema = ISiteSyndicationSettings
-    label = _(u'Syndication Settings')
-    description = _(u'Default syndication settings.')
-
-    def getSyndicationSettingsButtonShown(self):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'syndication' in actions.object.objectIds():
-            return actions.object.syndication.getProperty('visible')
-        else:
-            IStatusMessage(self.request).addStatusMessage(
-                _(u"Missing syndication settings action."), "warn")
-
-    def getSyndicationLinkShown(self):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'rss' in actions.document_actions.objectIds():
-            return actions.document_actions.rss.getProperty('visible')
-        else:
-            IStatusMessage(self.request).addStatusMessage(
-                _(u"Missing rss link action."), "warn")
-
-    def forceCheckboxValue(self, widget, checked):
-        if checked:
-            widget.value = ['selected']
-        else:
-            widget.value = []
-        for item in widget.items:
-            if 'checked' in item:
-                if checked:
-                    item['checked'] = True
-                else:
-                    item['checked'] = False
-
-    def update(self):
-        super(SyndicationControlPanelForm, self).update()
-
-        # We override this so we can get actual
-        # settings for portal_actions related settings
-        content = self.getContent()
-        show_settings_btn = self.getSyndicationSettingsButtonShown()
-        if show_settings_btn != content.show_syndication_button:
-            self.forceCheckboxValue(
-                self.widgets['show_syndication_button'], show_settings_btn)
-        show_link_btn = self.getSyndicationLinkShown()
-        if show_link_btn != content.show_syndication_link:
-            self.forceCheckboxValue(
-                self.widgets['show_syndication_link'], show_link_btn)
-
-    def setSyndicationActionSettings(self, data):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'syndication' in actions.object.objectIds():
-            actions.object.syndication._setPropValue(
-                'visible', data['show_syndication_button'])
-        if 'rss' in actions.document_actions.objectIds():
-            actions.document_actions.rss._setPropValue(
-                'visible', data['show_syndication_link'])
-
-    @button.buttonAndHandler(_(u"Save"), name='save')
-    def handleSave(self, action):
-        """
-        Again, we're customizing this to handle saving
-        portal_actions related setting data.
-        """
-        data, errors = self.extractData()
-        if errors:
-            self.status = self.formErrorsMessage
-            return
-
-        self.setSyndicationActionSettings(data)
-        self.applyChanges(data)
-        IStatusMessage(self.request).addStatusMessage(
-            _(u"Changes saved."), "info")
-        self.request.response.redirect("%s/%s" % (
-            self.context.absolute_url(), self.control_panel_view))
-
-    @button.buttonAndHandler(_(u"Cancel"), name='cancel')
-    def handleCancel(self, action):
-        IStatusMessage(self.request).addStatusMessage(
-            _(u"Edit cancelled."), "info")
-        self.request.response.redirect("%s/%s" % (
-            self.context.absolute_url(), self.control_panel_view))
-
-
-class SyndicationControlPanel(controlpanel.ControlPanelFormWrapper):
-    form = SyndicationControlPanelForm
+# Control panels for Plone 5 have been moved to CMFPlone. We keep those imports
+# for backwards compatibility.
+from Products.CMFPlone.controlpanel.syndication import SyndicationControlPanel  # noqa


Repository: plone.app.controlpanel
Branch: refs/heads/master
Date: 2014-12-22T13:18:54+01:00
Author: Timo Stollenwerk (tisto) <tisto@plone.org>
Commit: https://github.com/plone/plone.app.controlpanel/commit/c3e75af6386952ce0714ec767b2779d541a8bc2e

Merge pull request #39 from plone/plip10359-syndication

Plip10359 syndication

Files changed:
M CHANGES.rst
M plone/app/controlpanel/configure.zcml
M plone/app/controlpanel/syndication.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 3fc1415..6d29713 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,9 @@ Changelog
 3.0.0 (unreleased)
 ------------------
 
+- Remove the syndication control panel (moved to Products.CMFPlone).
+  [timo]
+
 - Remove the quickinstaller (moved to Products.CMFPlone).
   [timo]
 
diff --git a/plone/app/controlpanel/configure.zcml b/plone/app/controlpanel/configure.zcml
index 3be14a4..74ea35e 100644
--- a/plone/app/controlpanel/configure.zcml
+++ b/plone/app/controlpanel/configure.zcml
@@ -60,11 +60,4 @@
   <subscriber
       handler=".events.handleConfigurationChangedEvent" />
 
-  <browser:page
-      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
-      name="syndication-settings"
-      class=".syndication.SyndicationControlPanel"
-      permission="cmf.ManagePortal"
-      />
-
 </configure>
diff --git a/plone/app/controlpanel/syndication.py b/plone/app/controlpanel/syndication.py
index 912b825..e1d0f64 100644
--- a/plone/app/controlpanel/syndication.py
+++ b/plone/app/controlpanel/syndication.py
@@ -1,97 +1,3 @@
-from Products.CMFCore.utils import getToolByName
-from zope.component import getUtility
-from plone.registry.interfaces import IRegistry
-from zope.i18nmessageid import MessageFactory
-from Products.CMFPlone.interfaces.syndication import ISiteSyndicationSettings
-from plone.app.registry.browser import controlpanel
-from z3c.form import button
-from Products.statusmessages.interfaces import IStatusMessage
-
-_ = MessageFactory('plone')
-
-
-class SyndicationControlPanelForm(controlpanel.RegistryEditForm):
-    schema = ISiteSyndicationSettings
-    label = _(u'Syndication Settings')
-    description = _(u'Default syndication settings.')
-
-    def getSyndicationSettingsButtonShown(self):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'syndication' in actions.object.objectIds():
-            return actions.object.syndication.getProperty('visible')
-        else:
-            IStatusMessage(self.request).addStatusMessage(
-                _(u"Missing syndication settings action."), "warn")
-
-    def getSyndicationLinkShown(self):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'rss' in actions.document_actions.objectIds():
-            return actions.document_actions.rss.getProperty('visible')
-        else:
-            IStatusMessage(self.request).addStatusMessage(
-                _(u"Missing rss link action."), "warn")
-
-    def forceCheckboxValue(self, widget, checked):
-        if checked:
-            widget.value = ['selected']
-        else:
-            widget.value = []
-        for item in widget.items:
-            if 'checked' in item:
-                if checked:
-                    item['checked'] = True
-                else:
-                    item['checked'] = False
-
-    def update(self):
-        super(SyndicationControlPanelForm, self).update()
-
-        # We override this so we can get actual
-        # settings for portal_actions related settings
-        content = self.getContent()
-        show_settings_btn = self.getSyndicationSettingsButtonShown()
-        if show_settings_btn != content.show_syndication_button:
-            self.forceCheckboxValue(
-                self.widgets['show_syndication_button'], show_settings_btn)
-        show_link_btn = self.getSyndicationLinkShown()
-        if show_link_btn != content.show_syndication_link:
-            self.forceCheckboxValue(
-                self.widgets['show_syndication_link'], show_link_btn)
-
-    def setSyndicationActionSettings(self, data):
-        actions = getToolByName(self.context, 'portal_actions')
-        if 'syndication' in actions.object.objectIds():
-            actions.object.syndication._setPropValue(
-                'visible', data['show_syndication_button'])
-        if 'rss' in actions.document_actions.objectIds():
-            actions.document_actions.rss._setPropValue(
-                'visible', data['show_syndication_link'])
-
-    @button.buttonAndHandler(_(u"Save"), name='save')
-    def handleSave(self, action):
-        """
-        Again, we're customizing this to handle saving
-        portal_actions related setting data.
-        """
-        data, errors = self.extractData()
-        if errors:
-            self.status = self.formErrorsMessage
-            return
-
-        self.setSyndicationActionSettings(data)
-        self.applyChanges(data)
-        IStatusMessage(self.request).addStatusMessage(
-            _(u"Changes saved."), "info")
-        self.request.response.redirect("%s/%s" % (
-            self.context.absolute_url(), self.control_panel_view))
-
-    @button.buttonAndHandler(_(u"Cancel"), name='cancel')
-    def handleCancel(self, action):
-        IStatusMessage(self.request).addStatusMessage(
-            _(u"Edit cancelled."), "info")
-        self.request.response.redirect("%s/%s" % (
-            self.context.absolute_url(), self.control_panel_view))
-
-
-class SyndicationControlPanel(controlpanel.ControlPanelFormWrapper):
-    form = SyndicationControlPanelForm
+# Control panels for Plone 5 have been moved to CMFPlone. We keep those imports
+# for backwards compatibility.
+from Products.CMFPlone.controlpanel.syndication import SyndicationControlPanel  # noqa