Skip to content

Commit

Permalink
Merge pull request #1 from IMIO/autopublishing
Browse files Browse the repository at this point in the history
Autopublishing
  • Loading branch information
boulch committed Jan 9, 2023
2 parents 066b462 + 67e3d2e commit 07d84aa
Show file tree
Hide file tree
Showing 8 changed files with 317 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
1.1.1 (unreleased)
------------------

- Install and configure autopublishing (with 15 min tick subscriber)
[boulch]

- Remove obsolete TinyMCE override
[laulaz]

Expand Down
1 change: 1 addition & 0 deletions src/imio/directory/policy/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<include package="imio.gdpr" />

<include file="permissions.zcml" />
<include file="subscribers.zcml" />
<include package=".browser" />
<include package=".upgrades" />

Expand Down
2 changes: 1 addition & 1 deletion src/imio/directory/policy/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<version>1002</version>
<version>1003</version>
<dependencies>
<dependency>profile-plone.app.contenttypes:plone-content</dependency>
<dependency>profile-plone.restapi:default</dependency>
Expand Down
140 changes: 140 additions & 0 deletions src/imio/directory/policy/profiles/default/registry/autopublishing.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0"?>
<registry
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="imio.smartweb">

<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.clear_expiration_on_publish"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="clear_expiration_on_publish">
<value>True</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.overwrite_expiration_on_retract"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="overwrite_expiration_on_retract">
<value>True</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.dry_run"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="dry_run">
<value>False</value>
</record>

<!-- Publishing complex record -->
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.date_index"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="date_index">
<field type="plone.registry.field.TextLine">
<default>effective</default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_date_index">By default publishing date (the 'effective' index) is used for 'publish actions', and expiration date (the 'expires' index) is used for 'retract actions'. If a custom method is to be used for the date, enter index_id|object_method_id. If index_id = method_id just enter index_id.</description>
<missing_value>effective</missing_value>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_date_index">Transaction trigger date catalog index / method</title>
</field>
<value>effective</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.initial_state"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="initial_state">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_initial_state">Initial workflow state</title>
</field>
<value>private</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.portal_types"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="portal_types">
<field type="plone.registry.field.Tuple">
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_ap_portaltypes">Content types this rule applies to.</description>
<missing_value/>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="">Content types</title>
<value_type type="plone.registry.field.Choice">
<vocabulary>plone.app.vocabularies.ReallyUserFriendlyTypes</vocabulary>
</value_type>
</field>
<value>
<element>Collection</element>
<element>imio.directory.Entity</element>
<element>imio.directory.Contact</element>
</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.transition"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="transition">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_transition">Transition from initial state</title>
</field>
<value>publish</value>
</record>

<!-- Retracting complex record -->
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.date_index"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="date_index">
<field type="plone.registry.field.TextLine">
<default>effective</default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_date_index">By default publishing date (the 'effective' index) is used for 'publish actions', and expiration date (the 'expires' index) is used for 'retract actions'. If a custom method is to be used for the date, enter index_id|object_method_id. If index_id = method_id just enter index_id.</description>
<missing_value>effective</missing_value>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_date_index">Transaction trigger date catalog index / method</title>
</field>
<value>effective</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.initial_state"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="initial_state">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_initial_state">Initial workflow state</title>
</field>
<value>published</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.portal_types"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="portal_types">
<field type="plone.registry.field.Tuple">
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_ap_portaltypes">Content types this rule applies to.</description>
<missing_value/>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="">Content types</title>
<value_type type="plone.registry.field.Choice">
<vocabulary>plone.app.vocabularies.ReallyUserFriendlyTypes</vocabulary>
</value_type>
</field>
<value>
<element>Collection</element>
<element>imio.directory.Entity</element>
<element>imio.directory.Contact</element>
</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.transition"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="transition">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_transition">Transition from initial state</title>
</field>
<value>retract</value>
</record>

</registry>
9 changes: 9 additions & 0 deletions src/imio/directory/policy/subscribers.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<configure
xmlns="http://namespaces.zope.org/zope">

<subscriber
for="collective.timedevents.interfaces.IIntervalTicks15Event"
handler="collective.autopublishing.eventhandler.autopublish_handler"
/>

</configure>
23 changes: 23 additions & 0 deletions src/imio/directory/policy/upgrades/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:registerProfile
name="upgrade_1002_to_1003"
title="Upgrade policy from 1002 to 1003"
directory="profiles/1002_to_1003"
description="Configure autopublishing settings"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

<genericsetup:upgradeSteps
source="1000"
destination="1001"
Expand All @@ -32,4 +40,19 @@
/>
</genericsetup:upgradeSteps>

<genericsetup:upgradeSteps
source="1002"
destination="1003"
profile="imio.directory.policy:default">
<genericsetup:upgradeDepends
title="Install collective.autopublishing"
import_profile="collective.autopublishing:default"
/>
<genericsetup:upgradeDepends
title="Configure autopublishing settings"
import_profile="imio.directory.policy.upgrades:upgrade_1002_to_1003"
import_steps="plone.app.registry"
/>
</genericsetup:upgradeSteps>

</configure>
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0"?>
<registry
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="imio.smartweb">

<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.clear_expiration_on_publish"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="clear_expiration_on_publish">
<value>True</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.overwrite_expiration_on_retract"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="overwrite_expiration_on_retract">
<value>True</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema.dry_run"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSettingsSchema"
field="dry_run">
<value>False</value>
</record>

<!-- Publishing complex record -->
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.date_index"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="date_index">
<field type="plone.registry.field.TextLine">
<default>effective</default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_date_index">By default publishing date (the 'effective' index) is used for 'publish actions', and expiration date (the 'expires' index) is used for 'retract actions'. If a custom method is to be used for the date, enter index_id|object_method_id. If index_id = method_id just enter index_id.</description>
<missing_value>effective</missing_value>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_date_index">Transaction trigger date catalog index / method</title>
</field>
<value>effective</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.initial_state"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="initial_state">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_initial_state">Initial workflow state</title>
</field>
<value>private</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.portal_types"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="portal_types">
<field type="plone.registry.field.Tuple">
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_ap_portaltypes">Content types this rule applies to.</description>
<missing_value/>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="">Content types</title>
<value_type type="plone.registry.field.Choice">
<vocabulary>plone.app.vocabularies.ReallyUserFriendlyTypes</vocabulary>
</value_type>
</field>
<value>
<element>Collection</element>
<element>imio.directory.Entity</element>
<element>imio.directory.Contact</element>
</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.publish_actions/r0.transition"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="transition">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_transition">Transition from initial state</title>
</field>
<value>publish</value>
</record>

<!-- Retracting complex record -->
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.date_index"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="date_index">
<field type="plone.registry.field.TextLine">
<default>effective</default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_date_index">By default publishing date (the 'effective' index) is used for 'publish actions', and expiration date (the 'expires' index) is used for 'retract actions'. If a custom method is to be used for the date, enter index_id|object_method_id. If index_id = method_id just enter index_id.</description>
<missing_value>effective</missing_value>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_date_index">Transaction trigger date catalog index / method</title>
</field>
<value>effective</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.initial_state"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="initial_state">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_initial_state">Initial workflow state</title>
</field>
<value>published</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.portal_types"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="portal_types">
<field type="plone.registry.field.Tuple">
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="help_ap_portaltypes">Content types this rule applies to.</description>
<missing_value/>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="">Content types</title>
<value_type type="plone.registry.field.Choice">
<vocabulary>plone.app.vocabularies.ReallyUserFriendlyTypes</vocabulary>
</value_type>
</field>
<value>
<element>Collection</element>
<element>imio.directory.Entity</element>
<element>imio.directory.Contact</element>
</value>
</record>
<record name="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification.retract_actions/r0.transition"
interface="collective.autopublishing.browser.autopublishsettings.IAutopublishSpecification"
field="transition">
<field type="plone.registry.field.TextLine">
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n"
ns0:domain="collective.autopublishing"
ns0:translate="label_transition">Transition from initial state</title>
</field>
<value>retract</value>
</record>

</registry>

0 comments on commit 07d84aa

Please sign in to comment.