From ec7fe25b6cc246aad07a3b892ae8b518f6851ef6 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Fri, 11 Mar 2016 14:12:03 +0100 Subject: [PATCH] Use ``getSite()`` instead of portal url For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding. This allows for more flexibility when configuring it to be allowed on a sub site with a local registry. --- CHANGES.rst | 4 +++- plone/app/discussion/browser/controlpanel.pt | 14 +++++++------- plone/app/discussion/browser/controlpanel.py | 7 +++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f7cb874..011a53a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,7 +6,9 @@ Changelog New: -- *add item here* +- For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding. + This allows for more flexibility when configuring it to be allowed on a sub site with a local registry. + [thet] Fixes: diff --git a/plone/app/discussion/browser/controlpanel.pt b/plone/app/discussion/browser/controlpanel.pt index b389c24..3486ba2 100644 --- a/plone/app/discussion/browser/controlpanel.pt +++ b/plone/app/discussion/browser/controlpanel.pt @@ -22,7 +22,7 @@ Mail control panel to fix this. @@ -42,7 +42,7 @@ Types control panel to choose a workflow for the 'Discussion Item' type. @@ -61,7 +61,7 @@ migrate your comments to fix this. @@ -73,9 +73,9 @@ - Site Setup + tal:attributes="href string:${view/site_url}/@@overview-controlpanel" + i18n:translate=""> + Site Setup

View Title

@@ -87,7 +87,7 @@ diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py index 4f19619..b21a6dc 100644 --- a/plone/app/discussion/browser/controlpanel.py +++ b/plone/app/discussion/browser/controlpanel.py @@ -104,6 +104,13 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): form = DiscussionSettingsEditForm index = ViewPageTemplateFile('controlpanel.pt') + @property + def site_url(self): + """Return the absolute URL to the current site, which is likely not + necessarily the portal root. + """ + return getSite().absolute_url() + def settings(self): """Compose a string that contains all registry settings that are needed for the discussion control panel.