Products.Doormat

by Kees Hink last modified Dec 23, 2013 01:45 PM

Adds a doormat viewlet and installs it in the Plone footer. The links and text in the doormat are manageable as content.

Project Description

https://travis-ci.org/collective/Products.Doormat.png https://coveralls.io/repos/collective/Products.Doormat/badge.png

Introduction

A doormat is a couple of links which are presented in a structured way. One example is the current plone.org, where the div#sitemap at the bottom consists of some ordered bundles of internal and external links, with sections called "Downloads", "Documentation", "Developers", "Plone foundation" and "Support". See more examples of doormats.

This product adds a couple of content types (Archetypes), which are used to create a structure which is used for generating a doormat. A viewlet on this doormat is placed in the Plone footer. The links in the Doormat are managed as content, making the Doormat more flexible than a sitemap. It's also possible to add external links. It's also possible to add bits of text, with markup.

Quick feature overview

  • Internal links
  • External links
  • Text blocks (including images)
  • Links from Plone Collections
  • Can have any number of columns
  • Can have multiple sections per column

Similar products

collective.doormat

collective.doormat also lets you creates a doormat in your site, but takes a different approach: Instead of creating a structure of content objects, it offers a configuration panel where you can create the doormat in a single rich text field.

This approach is a lot easier for maintaining the doormat.

It doesn't take permissions into account, so links might point to internal content to which the visitor viewing the page has no access. There is also no way to add content from collections.

Getting started

After installing the product in your site, you should have a "Doormat" item in your Plone site, which should show up in the folder contents of the site. Inside it, you can create a hierarchical structure of Columns, Sections, links (both internal and external), Documents (Plone's Page type), and Links to a Collection (DoormatCollection). There should be one Column, one Section and one Document already there.

The Doormat may look like this, schematically:

+-- Doormat ----------------------------------------------------------------------------+
|                                                                                       |
|  +-- Column 1 ----------+  +-- Column 2----------+  +-- Column 3 ------------------+  |
|  |                      |  |                     |  |                              |  |
|  |  +-- Section 1 ----+ |  | +-- Section 1 ----+ |  | +-- Section 1 -------------+ |  |
|  |  |                 | |  | |                 | |  | |                          | |  |
|  |  |  +-- Link 1 --+ | |  | |  +-- Link 1 --+ | |  | |  +-- Document 1 -------+ | |  |
|  |  |  +------------+ | |  | |  +------------+ | |  | |  |                     | | |  |
|  |  |                 | |  | |                 | |  | |  | (Contact info)      | | |  |
|  |  |  +-- Link 2 --+ | |  | |  +-- Link 2 --+ | |  | |  |                     | | |  |
|  |  |  +------------+ | |  | |  +------------+ | |  | |  +---------------------+ | |  |
|  |  |                 | |  | |                 | |  | |                          | |  |
|  |  |  +- Document -+ | |  | |                 | |  | |  +- DoormatCollection -+ | |  |
|  |  |  |            | | |  | |                 | |  | |  |                     | | |  |
|  |  |  |            | | |  | |                 | |  | |  | Item 1 from Collctn | | |  |
|  |  |  +------------+ | |  | |                 | |  | |  | Item 2 from Collctn | | |  |
|  |  |                 | |  | |                 | |  | |  | (...)               | | |  |
|  |  |                 | |  | |                 | |  | |  | Link to Collection  | | |  |
|  |  |                 | |  | |                 | |  | |  |                     | | |  |
|  |  |                 | |  | |                 | |  | |  +---------------------| | |  |
|  |  |                 | |  | |                 | |  | |                          | |  |
|  |  +-----------------+ |  | +-----------------+ |  | +--------------------------+ |  |
|  |                      |  |                     |  |                              |  |
|  +----------------------+  +---------------------+  +------------------------------+  |
|                                                                                       |
+---------------------------------------------------------------------------------------+

In fact, you can add more than one section, they will be displayed below each other. In each section, you can mix internal links, external links and Documents.

And in real life:

http://plone.org/products/doormat/screenshot

Note that the product adds an extra hierarchical layer compared to the plone.org doormat: it adds a Column, which can contain more than one Section. An example using this structure is the Oosterpoort, which actually is the product's predecessor.

Adding a Document

Adding and editing a Document to the Doormat is just as simple as adding it in any other place. However, keep this in mind that only the "Body text" field will be displayed in the Doormat. Other fields, most notably the title and description will be omitted.

Adding an Image

To add an image to the Doormat, add a Document and include an image there. It's not possible to upload an Image to a DoormatSection, so you need to upload the image to another place in your site first.

Make sure you enable "Link using UIDs" (see above) first, because defining the image's location in a relative way will break in the same way as a relative link will break.

Simple configuration

By default, the Doormat is excluded from navigation.

There's a field showTitle on the folderish types (Doormat, Column and Section) which allows content managers to decide if the item's title should be displayed in the doormat.

More advanced configuration and styling

This section is intended for integrators and/or developers who would like to customize the way the doormat is rendered in more detail.

Moving the doormat

By default, the default doormat viewlet (doormat.footer) is placed in the plone.portalfooter viewlet manager. It's easy to modify this in an add-on product, so the doormat will display below the global navigation (portal tabs), or anywhere else in the site.

Displaying the doormat without the extra div elements

The default viewlet renders the doormat inside Plone's default footer elements, so it blends in with Plone 4's default Sunburst Theme:

<div class="row">
  <div class="cell width-full position-0" >
    <div id="doormat-container" />
  </div>
</div>

Using the doormat.footer.bare viewlet will omit the two outermost <div>'s. This may be handy when using the doormat in a different theme, or in a customized layout. You can hide the default viewlet and enable the bare version through @@manage-viewlets, or by adding a customized viewlets.xml to the product you're developing.

Caveats

More than one Doormat

The viewlet does a catalog lookup for the Doormat portal type. If you have more than one object of this type (nothing stops you), it will use the oldest one.

Uninstalling removes content

If you run the uninstall profile, like when you uninstall the product, all content will be deleted. This ensures the product uninstalls cleanly, for the convenience of migrations and of those just wanting to try it out.

If you have a Doormat in your site and you are happy with it, don't click uninstall.

Dependencies / Requirements

The product works on:

  • Plone 3
  • Plone 4

Credits

See Changelog.

This product was originally sponsored by GroningerForum.

Changelog

1.0 (2013-12-23)

  • Updated classifiers list and keywords for package [macagua]
  • Added Spanish translation [macagua]
  • Added i18n support [macagua]
  • Fix typo that broke Doormat when used with plone.app.contenttypes version 1.0b2 or above [ericof]
  • Fixed DoormatCollection without limit [lccruz]

0.9.1 (2013-10-10)

  • Make content creation depend on types, fixes error in install. Make clicking "Deactivate" run the uninstall profile. [khink]

0.9 (2013-10-10)

  • Remove UML. Add tests, use Travis and Coveralls. Create a Doormat on install. Add uninstall profile. [khink]

0.8 (2013-08-23)

  • Use archetypes.referencebrowserwidget in the DoormatReference if available. Note: archetypes.referencebrowserwidget 2.4.15 and 2.4.16 broke non-multi reference selection, so if your Plone version uses one of those versions, you should edit your buildout to use a newer version. [maurits]
  • Moved to github: https://github.com/collective/Products.Doormat [maurits]
  • Make compatible with Dexterity and new collections [pbauer]
  • Subclass from ATCTContent instead of BaseContent (taken from https://github.com/pymilya/Products.Doormat)
  • Search for doormats only in the navigation root. This allows to have a different doormat (or no doormat) in parts of the site. [maurits]

0.7 (2011-06-22)

Merged collections branch.

  • Add "DoormatCollection" type, which takes links from a Collection. Thanks to Alessandro Vermeulen's branch at https://github.com/spockz/Products.Doormat.
  • Don't subclass DoormatCollection from DoormatMixin. [khink]
  • Add labels and description for fields, add a pointer in the documentation. [khink]
  • contentValues() instead of objectValues() (only expose CMS content) [khink]

0.6 (2010-11-11)

0.5 (2010-10-25)

  • Set global_allow=False on DoormatSection by adding tagged value in UML. (agx mysteriously sets it to True by default) [khink]
  • Developer documentation (about using AGX)
  • Explicitly set external-link class for Link type objects.

0.4 (2010-10-05)

0.3 (2010-07-19)

  • Remove empty skins/ folders doormat_styles/ and doormat_templates/ (fixes http://plone.org/products/doormat/issues/4: Skin dirs missing from egg)
  • Added viewlet doormat.footer.bare to display the doormat without the div.row and div.cell wrapping.

0.2 (2010-06-11)

0.1.1 (2010-06-09)

0.1 (2010-06-08)

Initial release

For developers

UML deprecation notice

This product's content types were created with ArchGenXML (AGX), a tool to generate code from a UML model. AGX is no longer widely used, since Dexterity content types have replaced Archetypes as the default content type story.

Since version 0.9, this package has tests, for which plone.app.testing is used. Making AGX work with this doesn't seem to be worth the trouble. Therefore the UML model and everything that's related to it was removed.

You'll still find the UML and its documentation in a pre-0.9 version of the code.

To do

  • Add some sort of caching for getDoormatData and getDoormatTitle methods, or for the entire viewlet. Or at least get an idea of how expensive they are. Currently the viewlet computes the whole doormat each time it is rendered.

Self-Certification

[ ] Internationalized

[ ] Unit tests

[X] End-user documentation

[ ] Internal documentation (documentation, interfaces, etc.)

[X] Existed and maintained for at least 6 months

[X] Installs and uninstalls cleanly

[ ] Code structure follows best practice

Current Release
Products.Doormat 1.0

Released Dec 23, 2013 — tested with Plone 4.3

Download file Get Products.Doormat for all platforms
Products.Doormat-1.0.zip
If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.

All Releases

Version Released Description Compatibility Licenses Status
1.0 Dec 23, 2013 More about this release…
Plone 4.3
GPL final
0.9.1 Oct 10, 2013 More about this release… GPL final
0.9 Oct 10, 2013 More about this release… GPL final
0.8 Aug 23, 2013 More about this release… GPL final
0.7 Jun 22, 2011 Added "Collections" feature: Take links from a Collection. More about this release…
Plone 4
Plone 3
GPL final
0.6 Nov 11, 2010 Traverse using objectValues(), allow Column styling by position, document Image inclusion. More about this release…
Plone 4
Plone 3
GPL final
0.5 Oct 25, 2010 Bugfix: Make DoormatSection not addable globally. More about this release…
Plone 4
Plone 3
GPL final
0.4 Oct 05, 2010 Allow (rich-)text block in DoormatSections More about this release…
Plone 4
Plone 3
GPL final
0.3 Jul 19, 2010 Added a viewlet to display the doormat in bare forum (without surrounding HTML elements). More about this release…
Plone 4
Plone 3
GPL final
0.2 Jun 11, 2010 Now uninstalls cleanly More about this release…
Plone 4
Plone 3
GPL final
0.1.1 Jun 09, 2010 Bugfix release, fixes broken egg and allows to actually install the egg. No changes to code. More about this release…
Plone 4
Plone 3
GPL final
0.1 Jun 09, 2010 Initial release More about this release…
Plone 4
Plone 3
GPL final