Merge pull request #87 from plone/thet-control-panel-url

Use ``getSite()`` instead of portal url
This commit is contained in:
Jens W. Klein 2016-03-14 11:06:43 +01:00
commit 12d5347ca8
3 changed files with 17 additions and 8 deletions

View File

@ -6,7 +6,9 @@ Changelog
New: 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: Fixes:

View File

@ -22,7 +22,7 @@
<tal:link i18n:name="label_mail_control_panel_link"> <tal:link i18n:name="label_mail_control_panel_link">
<a href="" <a href=""
i18n:translate="text_no_mailhost_configured_control_panel_link" i18n:translate="text_no_mailhost_configured_control_panel_link"
tal:attributes="href string:${portal_url}/@@mail-controlpanel" tal:attributes="href string:${view/site_url}/@@mail-controlpanel"
>Mail control panel</a> >Mail control panel</a>
</tal:link> </tal:link>
to fix this. to fix this.
@ -42,7 +42,7 @@
<tal:link i18n:name="label_discussion_control_panel_link"> <tal:link i18n:name="label_discussion_control_panel_link">
<a href="" <a href=""
i18n:translate="text_discussion_type_control_panel_link" i18n:translate="text_discussion_type_control_panel_link"
tal:attributes="href string:${portal_url}/@@content-controlpanel?type_id=Discussion Item" tal:attributes="href string:${view/site_url}/@@content-controlpanel?type_id=Discussion Item"
>Types control panel</a> >Types control panel</a>
</tal:link> </tal:link>
to choose a workflow for the 'Discussion Item' type. to choose a workflow for the 'Discussion Item' type.
@ -61,7 +61,7 @@
<tal:link i18n:name="label_comments_migration_link"> <tal:link i18n:name="label_comments_migration_link">
<a href="" <a href=""
i18n:translate="text_comments_migration_link" i18n:translate="text_comments_migration_link"
tal:attributes="href string:${portal_url}/@@comment-migration" tal:attributes="href string:${view/site_url}/@@comment-migration"
>migrate your comments</a> >migrate your comments</a>
</tal:link> </tal:link>
to fix this. to fix this.
@ -73,7 +73,7 @@
</div> </div>
<a id="setup-link" class="link-parent" <a id="setup-link" class="link-parent"
tal:attributes="href string:$portal_url/@@overview-controlpanel" tal:attributes="href string:${view/site_url}/@@overview-controlpanel"
i18n:translate=""> i18n:translate="">
Site Setup Site Setup
</a> </a>
@ -87,7 +87,7 @@
</div> </div>
<script type="text/javascript" <script type="text/javascript"
tal:attributes="src string:${context/portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js"> tal:attributes="src string:${portal_url}/++resource++plone.app.discussion.javascripts/controlpanel.js">
</script> </script>
</article> </article>

View File

@ -104,6 +104,13 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper):
form = DiscussionSettingsEditForm form = DiscussionSettingsEditForm
index = ViewPageTemplateFile('controlpanel.pt') 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): def settings(self):
"""Compose a string that contains all registry settings that are """Compose a string that contains all registry settings that are
needed for the discussion control panel. needed for the discussion control panel.