Render an 'Open Document' Button in the Channel Manager
Introduction
Goal
Enable CMS users to open a document for editing straight from within the channel manager by rendering an "Open Document" button in the preview.
Background
When a channel is previewed in the CMS, an 'Open Document' button can be rendered next to each document. Clicking that button will directly open the document for editing.
Include the Button in a Template
The button can be included in a template using the tag 'hst:cmseditlink'. For example, to render a button for a Hippo document bean in a template variable 'document' you can use:
JSP
<hst:cmseditlink hippobean="${requestScope.document}"/>
Freemarker
<@hst.cmseditlink hippobean=document />
The code above will output all the necessary HTML to render the 'Open Document' button when the channel is previewed inside the CMS. In other cases, the tag outputs nothing.
The tag can also be used to get link to a CMS document. This can be used to render some custom link to a document when a channel is viewed outside the CMS (e.g. when a user is 'logged in' to a channel). Example:
JSP
<hst:cmseditlink hippobean="${requestScope.document}" var="cmsLink"/> <a href="${cmsLink}">Open document</a>
Freemarker
<@hst.cmseditlink hippobean=document var="cmsLink"/> <a href="${cmsLink}">Open document</a>
Position the Button
Each button should be located closely to the document it opens. The position of the button can be tweaked with CSS.