Skip to content

Commit

Permalink
Merge pull request #4 from eea/develop
Browse files Browse the repository at this point in the history
 Add support for Plone 5
  • Loading branch information
avoinea authored Mar 16, 2019
2 parents cd19d6f + cbddca0 commit cdcf43a
Show file tree
Hide file tree
Showing 21 changed files with 278 additions and 98 deletions.
6 changes: 6 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ pipeline {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-plone4" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:4 -v -vv -s $GIT_NAME'''
}
},

"Plone5": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-plone5" -e GIT_BRANCH="$BRANCH_NAME" -e ADDONS="$GIT_NAME" -e DEVELOP="src/$GIT_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" eeacms/plone-test:5 -v -vv -s $GIT_NAME'''
}
}
)
}
Expand Down
44 changes: 35 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,44 @@ to inherit faceted configuration from another faceted navigable object. This way
one can define a global faceted navigable folder and reuse this configuration
for multiple heritors.


Install
=======

* Add **eea.faceted.inheritance** to your **eggs** section in your buildout and
re-run buildout::

[buildout]
eggs +=
eea.faceted.inheritance

* You can download a sample buildout from:

- https://github.com/eea/eea.faceted.inheritance/tree/master/buildouts/plone4
- https://github.com/eea/eea.faceted.inheritance/tree/master/buildouts/plone5

* Or via docker::

$ docker run --rm -p 8080:8080 -e ADDONS="eea.faceted.inheritance" plone

* Install **EEA Faceted Inheritance** within **Site Setup > Add-ons**


Getting started
===============

* Go to your working space and add a **Folder** and within **Actions** menu
click on **Enable Faceted Inheritance**.
* See more on `EEA Faceted Navigation`_


Source code
===========

Latest source code in EEA GitHub:
https://github.com/eea/eea.faceted.inheritance

* https://github.com/eea/eea.faceted.inheritance


Copyright and license
=====================
Expand All @@ -35,17 +68,10 @@ Contributor(s): Alin Voinea (Eau de Web),

More details under docs/License.txt

Links
=====

1. EEA Faceted Navigation wiki page:
https://taskman.eionet.europa.eu/projects/zope/wiki/FacetedNavigation
2. Featured EEA products (Zope/Plone add-ons):
https://eea.github.io

Funding
=======

EEA_ - European Enviroment Agency (EU)

.. _EEA: https://www.eea.europa.eu/
.. _`EEA Faceted Navigation`: https://github.com/eea/eea.facetednavigation
16 changes: 16 additions & 0 deletions buildouts/plone4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pip-selfcheck.json
.*.cfg
src
parts
*eggs
*-dev.yml
bootstrap*
bin
lib*
var
local
share
secret.cfg
include
.Python
.idea
16 changes: 7 additions & 9 deletions buildouts/plone4/buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[buildout]
extends = versions.cfg
extends = https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-4.x.cfg
package-name = eea.faceted.inheritance
package-extras = [test]
develop = ../../
also-develop =
eea.facetednavigation
eea.faceted.vocabularies

[instance]
zcml +=
eea.faceted.inheritance-meta
eea.faceted.inheritance-overrides

[versions]
setuptools =
zc.buildout =
wheel =
pip =
1 change: 0 additions & 1 deletion buildouts/plone4/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
curl -o "bootstrap.sh" -k https://raw.githubusercontent.com/eea/eea.plonebuildout.core/master/install.sh
chmod u+x bootstrap.sh
./bootstrap.sh

4 changes: 0 additions & 4 deletions buildouts/plone4/versions.cfg

This file was deleted.

16 changes: 16 additions & 0 deletions buildouts/plone5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pip-selfcheck.json
.*.cfg
src
parts
*eggs
*-dev.yml
bootstrap*
bin
lib*
var
local
share
secret.cfg
include
.Python
.idea
11 changes: 11 additions & 0 deletions buildouts/plone5/buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[buildout]
extends = https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-5.x.cfg
package-name = eea.faceted.inheritance
package-extras = [test]
develop = ../../

[versions]
setuptools =
zc.buildout =
wheel =
pip =
9 changes: 9 additions & 0 deletions buildouts/plone5/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
faceted_navigation:
image: plone:5
ports:
- "8080"
volumes:
- ../../../:/plone/instance/src/eea.faceted.inheritance
environment:
ADDONS: "eea.faceted.inheritance plone.app.testing"
DEVELOP: "src/eea.faceted.inheritance"
4 changes: 4 additions & 0 deletions buildouts/plone5/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
curl -o "bootstrap.sh" -k https://raw.githubusercontent.com/eea/eea.plonebuildout.core/master/install.sh
chmod u+x bootstrap.sh
./bootstrap.sh
8 changes: 7 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

6.0 - (2019-03-16)
-----------------------
* Feature: Plone 5 support
[avoinea]
* Change: Disabling faceted advanced settings by default.
[avoinea]

5.5 - (2019-01-28)
---------------------
* Jenkins: Add sonarqube step
Expand Down Expand Up @@ -122,4 +129,3 @@ Changelog
0.1 (2010-01-18)
----------------
* Initial release

26 changes: 23 additions & 3 deletions eea/faceted/inheritance/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="eea">

<include package="eea.facetednavigation" />
<include file="minimal.zcml" />

<!-- Make default ATCT faceted heritable -->
<class class="Products.ATContentTypes.content.folder.ATFolder">
<class class="Products.ATContentTypes.content.folder.ATFolder"
zcml:condition="installed Products.ATContentTypes.content.folder">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

<class class="Products.ATContentTypes.content.folder.ATBTreeFolder">
<class class="Products.ATContentTypes.content.folder.ATBTreeFolder"
zcml:condition="installed Products.ATContentTypes.content.folder">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

<class class="Products.ATContentTypes.content.topic.ATTopic">
<class class="Products.ATContentTypes.content.topic.ATTopic"
zcml:condition="installed Products.ATContentTypes.content.topic">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

<class class="plone.app.folder.folder.ATFolder"
zcml:condition="installed plone.app.folder.folder">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

<class class="plone.dexterity.content.Container"
zcml:condition="installed plone.app.dexterity">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

<class class="plone.app.collection.collection.Collection"
zcml:condition="installed plone.app.collection">
<implements interface="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor" />
</class>

Expand Down
13 changes: 13 additions & 0 deletions eea/faceted/inheritance/dexterity.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone"
i18n_domain="eea">

<include package="plone.behavior" file="meta.zcml" />

<plone:behavior
title="Faceted inheritable"
description="Faceted inheritance can be activated on the instances of this content type."
provides="eea.faceted.inheritance.interfaces.IPossibleFacetedHeritor"
/>

</configure>
40 changes: 22 additions & 18 deletions eea/faceted/inheritance/docs/browser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,43 @@ Set up
Imports

>>> from zope.component import getMultiAdapter
>>> self.loginAsPortalOwner()
>>> from plone.testing.z2 import Browser
>>> from plone.app.testing import TEST_USER_NAME, TEST_USER_PASSWORD

Sandbox

>>> portal = layer["portal"]
>>> request = layer['request']
>>> sandbox = portal['sandbox']
>>> portal.error_log._ignored_exceptions = ()
>>> app = layer["app"]

Add ancestor

>>> fid = portal.invokeFactory('Folder', 'ancestor')
>>> ancestor = portal._getOb(fid)
>>> request = ancestor.REQUEST
>>> fid = sandbox.invokeFactory('Folder', 'ancestor')
>>> ancestor = sandbox._getOb(fid)
>>> subtyper = getMultiAdapter((ancestor, request), name=u'faceted_subtyper')
>>> subtyper.enable()
>>> ancestor.reindexObject()

Add heritor

>>> fid = portal.invokeFactory('Folder', 'heritor')
>>> heritor = portal._getOb(fid)
>>> fid = sandbox.invokeFactory('Folder', 'heritor')
>>> heritor = sandbox._getOb(fid)
>>> hertyper = getMultiAdapter((heritor, heritor.REQUEST), name=u'facetedheritor_subtyper')
>>> hertyper.can_enable_heritor
True

>>> hertyper.enable()
>>> heritor.reindexObject()

Login
Initialize browser

>>> self.logout()
>>> from Products.Five.testbrowser import Browser
>>> from Products.PloneTestCase import PloneTestCase
>>> browser = Browser()
>>> browser = Browser(app)
>>> browser.handleErrors = False
>>> self.portal.error_log._ignored_exceptions = ()
>>> browser.addHeader('Authorization',
... 'Basic %s:%s' % (PloneTestCase.portal_owner,
... PloneTestCase.default_password))
>>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD))
>>> import transaction
>>> transaction.commit()

Default heritor view

Expand All @@ -51,15 +55,15 @@ Set up
>>> browser.open(heritor_url + '/@@configure_faceted.html')
>>> control = browser.getControl(name='ancestor')
>>> control.options
['', '/plone/ancestor']
['', '/plone/sandbox/ancestor']

>>> control.value = ['/plone/ancestor']
>>> control.value = ['/plone/sandbox/ancestor']
>>> browser.getControl('Save').click()
>>> 'Changes saved' in browser.contents
True

>>> browser.getControl(name='ancestor').value
['/plone/ancestor']
['/plone/sandbox/ancestor']

Check results

Expand Down
18 changes: 9 additions & 9 deletions eea/faceted/inheritance/docs/inheritance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ Imports
Set up
------

>>> self.loginAsPortalOwner()
>>> portal = layer["portal"]
>>> request = layer['request']
>>> sandbox = portal['sandbox']

Create a faceted navigable folder
---------------------------------

>>> fid = portal.invokeFactory('Folder', 'ancestor')
>>> ancestor = portal._getOb(fid)
>>> request = ancestor.REQUEST
>>> fid = sandbox.invokeFactory('Folder', 'ancestor')
>>> ancestor = sandbox._getOb(fid)
>>> subtyper = getMultiAdapter((ancestor, request), name=u'faceted_subtyper')
>>> subtyper.enable()

Expand All @@ -41,9 +42,8 @@ Create a faceted navigable folder
Create a faceted heritor folder
-------------------------------

>>> fid = portal.invokeFactory('Folder', 'heritor')
>>> heritor = portal._getOb(fid)
>>> request = heritor.REQUEST
>>> fid = sandbox.invokeFactory('Folder', 'heritor')
>>> heritor = sandbox._getOb(fid)
>>> hertyper = getMultiAdapter((heritor, request), name=u'facetedheritor_subtyper')
>>> hertyper.can_enable_heritor
True
Expand All @@ -52,9 +52,9 @@ Create a faceted heritor folder

Connect heritor with ancestor

>>> IHeritorAccessor(heritor).ancestor = '/plone/ancestor'
>>> IHeritorAccessor(heritor).ancestor = '/plone/sandbox/ancestor'
>>> IHeritorAccessor(heritor).ancestor
'/plone/ancestor'
'/plone/sandbox/ancestor'

Now faceted configuration from ancestor is available also for heritor. Let's
check that:
Expand Down
6 changes: 6 additions & 0 deletions eea/faceted/inheritance/minimal.zcml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:zcml="http://namespaces.zope.org/zcml"
i18n_domain="eea">

<!-- Dependencies -->
<include file="meta.zcml" />
<include package="eea.facetednavigation" file="minimal.zcml" />

<configure zcml:condition="installed plone.app.dexterity">
<include file="dexterity.zcml" />
</configure>

<include file="profiles.zcml" />

<include package=".subtypes" />
Expand Down
Loading

0 comments on commit cdcf43a

Please sign in to comment.