Class CmsJspTagEditable
- All Implemented Interfaces:
Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
<cms:editable/>
tag.
This class is also used to generate the direct edit buttons for the
<cms:include editable="..." />
and <cms:contentload editable="..." />
tags.
Since OpenCms version 6.2.3, the direct edit button HTML generated is controlled by an instance of I_CmsDirectEditProvider
.
The default direct edit provider used can be configured in opencms-workplace.xml
in the
<directeditprovider class="..." />
node. The standard provider is
CmsDirectEditDefaultProvider
.
It's possible to override the default provider onm a page-by-page basis by initializing direct edit with
<cms:editable provider="...." />
on top of the page.
Since OpenCms version 6.2.3, it is also possible to place the HTML of the direct edit buttons manually.
This is intended for pages where the template HTML is not compatible with the direct edit HTML,
which usually results in a funny placement of the direct edit buttons in a totally wrong position.
To do manual placement of the direct edit buttons, you need to place <cms:editable mode="manual">
and
</cms:editable>
around your HTML. Both tags (start and end) will insert HTML according to
the used I_CmsDirectEditProvider
. The direct edit provider used must also support manual
placing, or the manual tags will be ignored and the HTML will be inserted at the automatic position.
A provider which support manual placing is the CmsDirectEditTextButtonProvider
.
- Since:
- 6.0.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
File with editable elements.protected CmsDirectEditMode
Indicates which direct edit mode is active.protected String
Class name of the direct edit provider.Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
doEndTag()
Close the direct edit tag, also prints the direct edit HTML to the current page.int
Opens the direct edit tag, if manual mode is set then the next start HTML for the direct edit buttons is printed to the page.static void
editableTagAction
(javax.servlet.jsp.PageContext context, String provider, CmsDirectEditMode mode, String fileName) Editable action method.static void
endDirectEdit
(javax.servlet.jsp.PageContext context) Closes the current direct edit element.static I_CmsDirectEditProvider
getDirectEditProvider
(javax.servlet.jsp.PageContext context) Returns the current initialized instance of the direct edit provider.protected static CmsDirectEditParams
getDirectEditProviderParams
(javax.servlet.jsp.PageContext context) Returns the current initialized instance of the direct edit provider parameters from the given page context.getFile()
Gets the file with elements for direct editing.getMode()
Returns the direct edit mode.Returns the class name of the direct edit provider.static void
insertEditEmpty
(javax.servlet.jsp.PageContext context, I_CmsXmlContentContainer container, CmsDirectEditMode mode, String id) Inserts direct edit for empty collector lists.static boolean
isEditableRequest
(javax.servlet.ServletRequest req) Checks if the current request should be direct edit enabled.boolean
Returns the edit empty attribute.void
release()
Releases any resources we may have (or inherit).protected static void
setDirectEditProvider
(javax.servlet.jsp.PageContext context, I_CmsDirectEditProvider provider) Sets the current initialized instance of the direct edit provider.protected static void
setDirectEditProviderParams
(javax.servlet.jsp.PageContext context, CmsDirectEditParams params) Sets the current initialized instance of the direct edit provider parameters to the page context.void
setEditEmpty
(boolean editEmpty) Sets the edit empty attribute.void
Sets the file with elements for direct editing.void
Sets the direct edit mode.void
setProvider
(String provider) Sets the class name of the direct edit provider.static boolean
startDirectEdit
(javax.servlet.jsp.PageContext context, CmsDirectEditParams params) Includes the "direct edit" start element that adds HTML for the editable area to the output page.Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
-
Field Details
-
m_file
File with editable elements. -
m_mode
Indicates which direct edit mode is active. -
m_provider
Class name of the direct edit provider.
-
-
Constructor Details
-
CmsJspTagEditable
public CmsJspTagEditable()
-
-
Method Details
-
editableTagAction
public static void editableTagAction(javax.servlet.jsp.PageContext context, String provider, CmsDirectEditMode mode, String fileName) throws javax.servlet.jsp.JspException Editable action method.- Parameters:
context
- the current JSP page contextprovider
- the class name of the direct edit privider to use (may benull
, which means use the default)mode
- the direct edit mode to use (may benull
, which means current use mode on page)fileName
- optional filename parameter for the direct edit provider (may benull
, which means use the default)- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
endDirectEdit
public static void endDirectEdit(javax.servlet.jsp.PageContext context) throws javax.servlet.jsp.JspException Closes the current direct edit element.- Parameters:
context
- the current JSP page context- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
getDirectEditProvider
Returns the current initialized instance of the direct edit provider.- Parameters:
context
- the current JSP page context- Returns:
- the current initialized instance of the direct edit provider
-
insertEditEmpty
public static void insertEditEmpty(javax.servlet.jsp.PageContext context, I_CmsXmlContentContainer container, CmsDirectEditMode mode, String id) throws CmsException, javax.servlet.jsp.JspException Inserts direct edit for empty collector lists.- Parameters:
context
- the current JSP page contextcontainer
- the parent content load containermode
- the direct edit mode to use (may benull
, which means current use mode on page)id
- an id for the content info bean, if available- Throws:
CmsException
- in case of invalid collector settingsjavax.servlet.jsp.JspException
- in case writing to page context fails
-
isEditableRequest
Checks if the current request should be direct edit enabled.- Parameters:
req
- the servlet request- Returns:
true
if the current request should be direct edit enabled
-
startDirectEdit
public static boolean startDirectEdit(javax.servlet.jsp.PageContext context, CmsDirectEditParams params) throws javax.servlet.jsp.JspException Includes the "direct edit" start element that adds HTML for the editable area to the output page.- Parameters:
context
- the current JSP page contextparams
- the direct edit parameters- Returns:
true
in case a direct edit element has been opened- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
getDirectEditProviderParams
protected static CmsDirectEditParams getDirectEditProviderParams(javax.servlet.jsp.PageContext context) Returns the current initialized instance of the direct edit provider parameters from the given page context.Also removes the parameters from the given page context.
- Parameters:
context
- the current JSP page context- Returns:
- the current initialized instance of the direct edit provider parameters
-
setDirectEditProvider
protected static void setDirectEditProvider(javax.servlet.jsp.PageContext context, I_CmsDirectEditProvider provider) Sets the current initialized instance of the direct edit provider.- Parameters:
context
- the current JSP page contextprovider
- the current initialized instance of the direct edit provider to set
-
setDirectEditProviderParams
protected static void setDirectEditProviderParams(javax.servlet.jsp.PageContext context, CmsDirectEditParams params) Sets the current initialized instance of the direct edit provider parameters to the page context.- Parameters:
context
- the current JSP page contextparams
- the current initialized instance of the direct edit provider parameters to set
-
doEndTag
Close the direct edit tag, also prints the direct edit HTML to the current page.- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Returns:
Tag.EVAL_PAGE
- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
doStartTag
Opens the direct edit tag, if manual mode is set then the next start HTML for the direct edit buttons is printed to the page.- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Returns:
Tag.EVAL_BODY_INCLUDE
- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
getFile
Gets the file with elements for direct editing.- Returns:
- the file
-
getMode
Returns the direct edit mode.- Returns:
- the direct edit mode
-
getProvider
Returns the class name of the direct edit provider.- Returns:
- the class name of the direct edit provider
-
isEditEmpty
Returns the edit empty attribute.- Returns:
- the edit empty attribute
-
release
Releases any resources we may have (or inherit).- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classjavax.servlet.jsp.tagext.BodyTagSupport
-
setEditEmpty
Sets the edit empty attribute.- Parameters:
editEmpty
- the edit empty attribute to set
-
setFile
Sets the file with elements for direct editing.- Parameters:
file
- the file to set
-
setMode
Sets the direct edit mode.- Parameters:
mode
- the direct edit mode to set
-
setProvider
Sets the class name of the direct edit provider.- Parameters:
provider
- the class name of the direct edit provider to set
-