diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fe640a..27b12b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,12 +9,14 @@ on: - "main" - "master" - "features/buildout-tox" + - "features/plone52" - "!releases/**" pull_request: branches: - "main" - "master" - "features/buildout-tox" + - "features/plone52" jobs: ci: diff --git a/CHANGES.rst b/CHANGES.rst index e2c2b05..dd82ce2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,9 @@ Changelog - Use tox for testing, ensure tests are passing for Plone 5.0.x, 5.1.x and 5.2.x. [thomasmassmann] +- Adjust configlet URLs to use navigation root url. This is required for Plone 5.2.x and is backward compatible. + [thomasmassmann] + 1.0a1 (2016-10-06) ------------------ diff --git a/README.rst b/README.rst index 679f24b..e42b7b8 100644 --- a/README.rst +++ b/README.rst @@ -34,22 +34,26 @@ Not available in Lineage Childsites The following control panels change global settings. Therefore they are not available in subsites. +- actions-controlpanel (Plone 5.1 and newer) - content-controlpanel - dexterity-types - filter-controlpanel - maintenance-controlpanel - prefs_install_products_form +- redirection-controlpanel (Plone 5.2 and newer) - resourceregistry-controlpanel -- security controlpanel +- security-controlpanel - usergroup-groupprefs - usergroup-userprefs This is also disabled, but should probably fixed to work with local registries too: + - portal_registry This one stores it's configuration in the registry but has changes one setting in portal_actions, which would affect all sites. Thus disabled. + - syndication-controlpanel diff --git a/base.cfg b/base.cfg index 6d619d6..d92988e 100644 --- a/base.cfg +++ b/base.cfg @@ -26,6 +26,8 @@ auto-checkout = * [sources] collective.lineage = git https://github.com/collective/collective.lineage.git +# Required until https://github.com/plone/Products.CMFPlone/issues/3288 is fixed. +cusy.patches.cmfplone = git https://github.com/cusyio/cusy.patches.cmfplone.git lineage.themeselection = git https://github.com/collective/lineage.themeselection.git @@ -39,6 +41,8 @@ eggs = Plone Pillow lineage.controlpanels [test] +# Required until https://github.com/plone/Products.CMFPlone/issues/3288 is fixed. + cusy.patches.cmfplone [vscode] recipe = collective.recipe.vscode diff --git a/src/lineage/controlpanels/configure.zcml b/src/lineage/controlpanels/configure.zcml index cf4a24f..1d17d94 100644 --- a/src/lineage/controlpanels/configure.zcml +++ b/src/lineage/controlpanels/configure.zcml @@ -1,7 +1,8 @@ + xmlns:zcml="http://namespaces.zope.org/zcml"> @@ -140,7 +141,27 @@ directory="profiles/default" description="Extension lineage.controlpanels to allow child-site specific configurations with Plone controlpanels." provides="Products.GenericSetup.interfaces.EXTENSION" + post_handler=".setuphandlers.post_install" /> + + + + + + + + + diff --git a/src/lineage/controlpanels/profiles/default/controlpanel.xml b/src/lineage/controlpanels/profiles/default/controlpanel.xml index 3342b43..d229f50 100644 --- a/src/lineage/controlpanels/profiles/default/controlpanel.xml +++ b/src/lineage/controlpanels/profiles/default/controlpanel.xml @@ -2,7 +2,7 @@ @@ -11,26 +11,26 @@ Plone Site Setup: Site Plone Site Setup: Site Plone Site Setup: Users and Groups @@ -39,47 +39,42 @@ Set own properties Set own password Plone Site Setup: Mail - - Plone Site Setup: Themes + Plone Site Setup: Editing Manage portal @@ -87,19 +82,19 @@ Plone Site Setup: Markup Plone Site Setup: Security @@ -108,33 +103,33 @@ Plone Site Setup: Search Plone Site Setup: Navigation Plone Site Setup: Language Plone Site Setup: Filtering @@ -143,12 +138,12 @@ Content rules: Manage rules @@ -157,20 +152,20 @@ Plone Site Setup: TinyMCE Plone Site Setup: Site Plone Site Setup: Imaging @@ -183,7 +178,7 @@ category="plone-general" condition_expr="" icon_expr="string:${portal_url}/discussionitem_icon.png" - url_expr="string:${object/aq_parent/absolute_url}/@@discussion-controlpanel" + url_expr="string:${plone_portal_state/navigation_root_url}/@@discussion-controlpanel" visible="True" i18n:attributes="title"> Manage portal @@ -196,7 +191,7 @@ appId="plone.app.theming" category="plone-general" condition_expr="" - url_expr="string:${object/aq_parent/absolute_url}/@@theming-controlpanel" + url_expr="string:${plone_portal_state/navigation_root_url}/@@theming-controlpanel" icon_expr="string:${portal_url}/++resource++plone.app.theming.gif" visible="True" i18n:attributes="title"> @@ -208,7 +203,7 @@ action_id="plone.app.registry" appId="plone.app.registry" category="plone-advanced" - condition_expr="not:object/aq_parent/@@lineageutils/isChildSite" + condition_expr="not:python:plone_portal_state.navigation_root().restrictedTraverse('@@lineageutils').isChildSite()" url_expr="string:${portal_url}/portal_registry" icon_expr="string:$portal_url/++resource++plone.app.registry/icon.png" visible="True" @@ -221,8 +216,8 @@ action_id="plone.app.registry-lineage" appId="plone.app.registry" category="plone-advanced" - condition_expr="object/aq_parent/@@lineageutils/isChildSite" - url_expr="string:${object/aq_parent/absolute_url}/lineage_registry" + condition_expr="python:plone_portal_state.navigation_root().restrictedTraverse('@@lineageutils').isChildSite()" + url_expr="string:${plone_portal_state/navigation_root_url}/lineage_registry" icon_expr="string:$portal_url/++resource++plone.app.registry/icon.png" visible="True" i18n:attributes="title"> @@ -231,7 +226,7 @@ @@ -243,7 +238,7 @@ action_id="dexterity-types" appId="Plone" category="plone-content" - condition_expr="not:object/aq_parent/@@lineageutils/isChildSite" + condition_expr="not:python:plone_portal_state.navigation_root().restrictedTraverse('@@lineageutils').isChildSite()" icon_expr="string:$portal_url/document_icon.png" title="Dexterity Content Types" url_expr="string:${portal_url}/@@dexterity-types" @@ -257,7 +252,7 @@ action_id="plone.app.caching" appId="plone.app.caching" category="plone-advanced" - condition_expr="not:object/aq_parent/@@lineageutils/isChildSite" + condition_expr="not:python:plone_portal_state.navigation_root().restrictedTraverse('@@lineageutils').isChildSite()" icon_expr="string:$portal_url/++resource++plone.app.caching.gif" url_expr="string:${portal_url}/@@caching-controlpanel" visible="True" diff --git a/src/lineage/controlpanels/profiles/plone51/controlpanel.xml b/src/lineage/controlpanels/profiles/plone51/controlpanel.xml new file mode 100644 index 0000000..01d8bd9 --- /dev/null +++ b/src/lineage/controlpanels/profiles/plone51/controlpanel.xml @@ -0,0 +1,13 @@ + + + + Manage Portal Aliases + + diff --git a/src/lineage/controlpanels/profiles/plone51/metadata.xml b/src/lineage/controlpanels/profiles/plone51/metadata.xml new file mode 100644 index 0000000..eec370b --- /dev/null +++ b/src/lineage/controlpanels/profiles/plone51/metadata.xml @@ -0,0 +1,6 @@ + + + 1 + + + diff --git a/src/lineage/controlpanels/profiles/plone52/controlpanel.xml b/src/lineage/controlpanels/profiles/plone52/controlpanel.xml new file mode 100644 index 0000000..b07f638 --- /dev/null +++ b/src/lineage/controlpanels/profiles/plone52/controlpanel.xml @@ -0,0 +1,10 @@ + + + + Manage portal + + diff --git a/src/lineage/controlpanels/profiles/plone52/metadata.xml b/src/lineage/controlpanels/profiles/plone52/metadata.xml new file mode 100644 index 0000000..eec370b --- /dev/null +++ b/src/lineage/controlpanels/profiles/plone52/metadata.xml @@ -0,0 +1,6 @@ + + + 1 + + + diff --git a/src/lineage/controlpanels/setuphandlers.py b/src/lineage/controlpanels/setuphandlers.py new file mode 100644 index 0000000..fb9a4df --- /dev/null +++ b/src/lineage/controlpanels/setuphandlers.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +from pkg_resources import parse_version +from Products.CMFPlone.interfaces import INonInstallable +from Products.GenericSetup.interfaces import IProfileImportedEvent +from zope.component import adapter +from zope.interface import implementer + +import plone.api + + +@implementer(INonInstallable) +class HiddenProfiles(object): + def getNonInstallableProfiles(self): + """Hide uninstall profile from site-creation and quickinstaller.""" + return [ + "lineage.controlpanels:uninstall", + "lineage.controlpanels:plone51", + "lineage.controlpanels:plone52", + ] + + +@adapter(IProfileImportedEvent) +def handle_profile_imported_event(event): + # Actions control panel was added + if event.profile_id == "profile-plone.app.upgrade.v51:to51alpha1": + setup = plone.api.portal.get_tool(name="portal_setup") + setup.runAllImportStepsFromProfile("profile-lineage.controlpanels:plone51") + + # RedirectionTool was added + if event.profile_id == "profile-plone.app.upgrade.v52:to52beta1": + setup = plone.api.portal.get_tool(name="portal_setup") + setup.runAllImportStepsFromProfile("profile-lineage.controlpanels:plone52") + + +def post_install(context): + """Post install script""" + # Check which additional configlets need to be installed/updated. + current_version = parse_version(plone.api.env.plone_version()) + setup = plone.api.portal.get_tool(name="portal_setup") + if current_version >= parse_version("5.1a1"): + setup.runAllImportStepsFromProfile("profile-lineage.controlpanels:plone51") + if current_version >= parse_version("5.2b1"): + setup.runAllImportStepsFromProfile("profile-lineage.controlpanels:plone52") + + +def uninstall(context): + """Uninstall script""" + # Do something at the end of the uninstallation of this package.