Package: redturtle.custommenu.factories
ContentsSummaryIdea behind thisHow to useInstallationCustomize the menuTALES expressionsGeneric setup supportDependenciesTODOChangelog0.3.1 (2015-02-24)0.3.0 (2013-07-10)0.2.0b - (2010-02-17)0.1.0a - (2010-01-04)SummaryThis 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
non-technical users.You can use this to add new non-standard stuff to the menu (like JavaScript links). See below.Idea behind thisThe case is related to developed content types that gets added to Plone only forusabilityenhancements.One example: have you ever used Plone4ArtistsVideo, orcollective.flowplayer?
In those products users that want to add new video to a site must use the “Add new…” menu and select
theFilecontent.So the editor (that isnevera 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.
Can’t be better if the user could 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 theFilecontent 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 what Plone users know is to look at the right menu to search for addable
types, not to look in a menu andalsoin 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 end users (no, the are not bad guys).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 classicFileentry (that point tohttp://myhost/mysite/createObject?type_name=File)a new “Video” entry (again pointing tohttp://myhost/mysite/createObject?type_name=File)This products is designed only for this or similar usability issues, however can help you to customize
existing elements of the menu on context (for example: the action of adding a new “News Item” content in
a folder can be customized to be an alias for another content type, but only for this special folder,
or you can disable with a falsy espression a content type in a folder, …).How to useInstallationSimply add the egg to your buildout, and re-run it.[instance]
...
eggs =
    ...
    redturtle.custommenu.factories
...Remember to add also the ZCML slug and overrides if you are testing this on Plone 3.2 or lesser.After this, install the new product in Plone.Customize the menuIn your “Add new…” menu you’ll find a new “Customize menu…” entry. This will lead you to a
form where you must enable customization feature on the current context.
After this you can use the a customization form where you can manage local menu changes.For every new entry you can/must fill this informations:idEnter 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 canreplaceone of the native (or inherited) menu entry with a new ones.nameRequired.
Provide the string to be used for displaying the new element.descriptionThe description is used to provide a tooltips hovering the element.iconA TALES expression that can be used to give an icon to the new element (very common).conditionA 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.URLRequired.
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 give a rightidto new entries not only to override menu element from Plone normal
behaviour, but also for change a customization done in the site root.TALES expressionsIn the TALES expression above, you can use those variables:contextThe current context, as Plone normal meaningcontainerThe container of the current context, or the context itself if the context is a container. This is
useful when writing expression that keep in mind the default document in a folder.portal_urlTheportal_urltool, taken from the Plone site.Generic setup supportJuan. [nueces] provided Generic Setup support for this package:<?xml version="1.0"?><object><propertyname="inherit">True</property><custommenu><propertyname="element-id">pdf-file</property><propertyname="element-name">PDFDocument</property><propertyname="element-descr">AfilecontenttobefilledwithaPDFdocument</property><propertyname="icon-tales">string:$portal_url/pdf_icon.gif</property><propertyname="condition-tales"></property><propertyname="element-tales">string:${container/absolute_url}/createObject?type_name=File</property></custommenu><custommenu>...</custommenu><objectname="documents"><propertyname="inherit">True</property><custommenu>...</custommenu><objectname="ebooks"><propertyname="inherit">True</property><custommenu>...</custommenu>...</object>...</object>...<object>For a complete code checkcollective.examples.custommenufactories.DependenciesAll Plone versions from 3.3 to 4.3 has been tested.TODOJavaScript features for managing entriescode needs refactoringthink about inherit customizations not only from portal rootsubsites testing neededChangelog0.3.1 (2015-02-24)Fixed issue when on folders that are not annotable
(uncommon, but may happen on old stuff like PloneGazette).
[keul]Plone 3/ Plone 4 compatibility on default menu title and description
[keul]Fixed tests
[keul]Pyflakes cleanup and related errors fixed
[keul]0.3.0 (2013-07-10)provided Generic Setup support [nueces]now can’t no-more manage menu without installing the product [keul]disabled useless JavaScript [keul]now works also with single entry menu (close#1) [keul]now supporting Plone 4 style icons [keul]0.2.0b - (2010-02-17)now local customizations must be enabled and disabled per-context [keul]fixes to XHTML structure and validation [keul]fixed CSS class names to be camelCase as Plone does [keul]added tests [keul]fixed templates to be test compatible [keul]fixed a bug on entry deletion [keul]added missing check on required element for entries (in facts were optional) [keul]added egg support for z3c.autoinclude [keul]now False condition for an element with id hide inherited element with same id [keul]added Plone 4 compatibility [keul]0.1.0a - (2010-01-04)initial release