Skip to main content

Customize the Plone "add portal content" menu

Project description

Summary

This product make possible the customization of the Plone “Add new…” menu, commonly filled from the Plone available content types.

This is designed for avoiding useless content types but, at the same time, help UI experience of not experienced users.

You can use this to add new non-standard stuff to the menu (like Javascript links). See below.

Idea behind this

The case is related to developed content types that gets added to Plone only for usability enhancements.

One example: have you ever used Plone4ArtistsVideo, or collective.flowplayer? In those products users that want to add new video to a site must use the “Add new…” menu and select the File content.

So the editor (that is never a developer in real life… you must accept it) must know that when he add a new file, it magically became a video… This is not so simple to understand; also is impossible to understand it without a training or by past experience. Will not be better if the user can read “Add new video” in the menu instead?

Right now the best usability choice is to add a new content type to the menu, or develop a new helper portlet that show some links like “add a new video here”.

In the first case, just copy/paste the original used content if enough (copy/paste the File content type and rename it in something like “Video”). But you know… we don’t really need those new content types.

In the second case all is ok, but all that Plone users know is to look at the right menu to search for addable types, not to look in a menu and also in another place.

So:

  • user know that for adding new content types, they must use the “Add new…

  • users often ignores the magic behind Plone (like the File that became a Video)

  • developer don’t like to add new silly content types only to help editors.

The problem above is related to the not-customizable state of the “Add new…” menu: the editor and the developer will be both happy if a new, fake entry could be added to this menu. Going back to the video example:

  • the classic File entry (that point to http://myhost/mysite/createObject?type_name=File)

  • a new “Video” entry (again pointing to http://myhost/mysite/createObject?type_name=File)

This products is designed only for this or similar usability issues.

How to use

Installation

Simply add the egg to your buildout, and re-run it. Remember to add also the ZCML overrides.

[instance]
...
eggs =
    ...
    redturtle.custommenu.factories
...

zcml =
    ...
    redturtle.custommenu.factories
    redturtle.custommenu.factories-overrides
...

After this, install the new product in Plone.

Uninstallation

You can reinstall the products safely without lose any customization data. If you uninstall it, all customization will be removed from your Plone site, leaving no garbage behind.

Customize the menu

In your “Add new…” menu you’ll find a new “Customize menu…” entry. This will lead you to a customization form where you can manage local menu changes of the current context.

http://keul.it/images/plone/redturtle.customizemenu.factories1.png

The used context is always the container where you can find the context, or the context itself if it’s a container.

for every new entry you can/must fill this informations:

id

Enter here a string to be used to add an HTML id attribute to the new element. You can not provide it, but if you use an already existing ids, the new one will override the old. In this way you can replace one of the native (or inherited) menu entry with a new ones.

name

Required. Provide the string to be used for displaying the new element.

description

The description is used to provide a tooltips hovering the element.

icon

A TALES expression that can be used to give an icon to the new element (very common).

condition

A TALES condition expression. If not provided, the new element is added to the menu. In provided it is evaluated as True or False, so the element is displayed or not.

URL

Required. A TALES expression used to render the HREF attribute on the link in the element. You have total freedom here: you can also render a string as “javascript:…” to provide some Javascript features.

Also you can inherit the customization done in the site root everywhere in the site, adding this to all other customizations. You can also locally block the inherit of root customization but you can also make new menu elements defined in the root available only in the root itself.

Also, you can five a right id to new entries not only to override menu element from Plone normal behaviour, but also for change a customization done in the site root.

http://keul.it/images/plone/redturtle.customizemenu.factories2.png

TALES expressions

In the TALES expression above, you can use those variables:

context

The current context, as Plone normal meaning

container

The container of the current context, or the context itself if the context is a container or you are viewing a default document in a folder.

portal_url

The portal_url tool, taken from the Plone site.

TODO

  • localization

  • browser tests

  • javascript features for managing entries

  • code needs refactoring

  • tests on Plone 4

Changelog

0.1.0a - (2010-01-04)

  • 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

redturtle.custommenu.factories-0.1.0a.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file redturtle.custommenu.factories-0.1.0a.tar.gz.

File metadata

File hashes

Hashes for redturtle.custommenu.factories-0.1.0a.tar.gz
Algorithm Hash digest
SHA256 e5ee542541ec47f746742b807bf3a9d4f16e1d8d8c0e84067234b471016835a2
MD5 7237192aa596b553a60279fd9df5c529
BLAKE2b-256 6bd2cd9814ba4f9620468f25cb81b9addb5e80d2b4b4aa90d2d1281f4bd51237

See more details on using hashes here.

File details

Details for the file redturtle.custommenu.factories-0.1.0a-py2.4.egg.

File metadata

File hashes

Hashes for redturtle.custommenu.factories-0.1.0a-py2.4.egg
Algorithm Hash digest
SHA256 4f3bfc8ada5a9ad620a354745f5a39b3800521879f4a619ec52a928873cb83cb
MD5 91ada5d9eb201a9c1adf138c5cb6ea9b
BLAKE2b-256 22700dd8968b572dfa7fda2ee3e3c540b5b0b00150663c8507891405f857826a

See more details on using hashes here.

Supported by

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