Skip to main content

A Plone content rules action that creates a chronological archive.

Project description

Overview

sc.contentrules.groupbydate is a content rule action used to organize content under a chronological-based hierarchy on a web site.

The 2.0 series introduces a major refactoring of the code base and is not backwards compatible with previous versions.

Base use case

A news portal with a few dozen new content items per day needs to organize its information in a chronological, yet human-readable, hierarchy.

To do so, this package is installed in a Plone Site and a new content rule is created. This content rule will be triggered by the publication of an News Item and will initialize a ‘’’Move an item to a date-based folder structure’’’.

This action has a Base folder (/news), a Hierarchy Structure (‘%Y/%m/%d’) and a Container (‘Folder’), so as our News Item, with id hello-world, is published on the site, it will be moved to a a new folder structure under /news. Supposing it’s March 29th, 2012, the item will end in /news/2012/03/29/hello-world.

Installation

Include this package in eggs and zcml section of your buildout. For further reference please refer to the official guide.

Using the action

We will explain step by step how to config this case through plone user interface.

  • In a Plone site go to Site Setup and then click on “Content Rules”.

  • Click on “Add content rule”.

  • Set the title to something meaninful – ‘Organize published News Items’ –, select “Workflow State Changed” in Triggered Event and save.

  • You will be redirected to the previous view but you will see the rule you added listed. Click on the title of the rule to edit it’s properties.

  • Ok, in here you will note that you have two settable categories. Conditions and actions. To make this happen, you need to add two conditions and one action.

    • The first condition must be related to the content type. Select “News item” and save.

    • The second one to the workflow state of the object. Select “Publish”.

  • Now is turn of the action. Select “Move an item to a date-based folder structure” and click add.

  • You are now in the add form for the action. You will see three required fields:

    • “Base folder” is the base folder for the date hierarchy. For this you have different ways to set it. You can search a folder in the text input field or select one of the dropdown menu. In the last one you will note and option called “One level up”. This means that the folder structure date hierarchy will be done one level up of the content selected in which the rule will be applied. This will be useful when we have it to multiple types of contents in which each one are added in different folders. Also, we have the option “Same folder of content” which is obvious to understand. In this case select “News”.

    • “Container” allows you to select the folderish content to be used to create the group by date structure. We suggest you to use “Folder”, the default option.

    • “Hierarchy structure” allows you to choose the way the structure will be created. Use strftime formating. e.g.: ‘%Y/%m/%d’ to have 2011/11/17 or ‘%Y/%m’ to have 2011/11. Leave this field with default value.

  • Now you just need to apply this rule in the right place of the site. If you don’t know how to do this, follow this link.

Mostly Harmless

https://secure.travis-ci.org/collective/sc.contentrules.groupbydate.png https://coveralls.io/repos/collective/sc.contentrules.groupbydate/badge.png:target:https://coveralls.io/r/collective/sc.contentrules.groupbydate

Have an idea? Found a bug? Let us know by opening a support ticket.

Contributors

  • Érico Andrei

  • Cleber J Santos

  • Gustavo Lepri

  • Héctor Velarde

  • Alejandro Pereira

  • Simone Orsi

You can find an updated list of package contributors on GitHub.

Development sponsored by Simples Consultoria.

Changelog

2.0.1 (unreleased)

  • Dexterity content types are now listed as options to folder creation [ericof]

  • Code cleanup [ericof]

2.0 (2013-04-13)

  • Plone 4.3 supported [ericof]

  • Update translations, add italian traslation [simahawk]

  • Update README and move to rst [simahawk]

2.0b2 (2012-11-30)

  • Execute IRuleExecutor for each folder created. This enables cascading content rules to be applied to newly created folders. [ericof]

2.0b1 (2012-11-27)

  • This package no longer needs to be installed in the site’s control panel. [ericof]

  • Removed the option to set the default layout for newly created folders. We suggest using sc.contentrules.layout for that. [ericof]

  • Improved test coverage [ericof]

  • PEP8 all over the code [ericof]

1.3b4 (2012-07-24)

  • Fix a performance issue with updating role mappings in portals with a huge amount of content already created [ericof]

1.3b3 (2012-07-10)

  • Removed dependency on plone.directives.form introduced on previous release. [aleGpereira]

1.3b2 (2012-07-03)

  • Default value for container field in schema was creating problems. Updating this value. [aleGpereira]

  • Fix a little bug for container searcher vocabulary class. [aleGpereira]

1.3b1 (2012-06-21)

  • Added Spanish and updated Brazilian Portuguese translations. [hvelarde]

  • Tested Plone 4.2 compatibility (fixes #1). [hvelarde]

  • Fixed package declaration and updated documentation. [hvelarde]

  • Adding option so user can select the content type used as container. [aleGpereira]

  • Adding a field to set a prefer view method for container. [aleGpereira]

  • Adding integrational and functional test for view validator and container object creation. [aleGpereira]

  • Update README documentation. [aleGpereira]

1.2 (2011-12-06)

  • Move testing to plone.app.testing [ericof]

  • Fix Dublin Core support [ericof]

  • Fix permissions for pt-br [lepri]

1.1.1 (2011-08-22)

  • Fix permission for Plone 4.x [cleberjsantos]

1.1 (2011-06-23)

  • Added z3c.autoinclude entry point to mark this as a Plone plugin [erico_andrei]

  • Support for Plone 4.1.x [erico_andrei]

1.0 (2010-07-02)

  • Allow relative paths as base_folder [erico_andrei]

  • Allow inputing of strftime formatting for structure field [erico_andrei]

  • Add dependency of placeful workflow as we need it to avoid publishing content in an unpublished structure [erico_andrei]

0.5 (2009-07-28)

  • Very earlier i18n support [erico_andrei]

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sc.contentrules.groupbydate-2.0.1.zip (49.2 kB view details)

Uploaded Source

File details

Details for the file sc.contentrules.groupbydate-2.0.1.zip.

File metadata

File hashes

Hashes for sc.contentrules.groupbydate-2.0.1.zip
Algorithm Hash digest
SHA256 624cf9144d4cd284ba4b56138e6c653d2a06551e6cff9f4e3aacb908df66a91e
MD5 a90ac272b80f85597aafbce0440976d2
BLAKE2b-256 b13d8fa41f00150f27e4a71037aed638cab8b5bc169e5735e0abd8f71dac09bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page