public class CmsJspTagEditable
extends javax.servlet.jsp.tagext.BodyTagSupport
<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
.
限定符和类型 | 字段和说明 |
---|---|
protected java.lang.String |
m_file
File with editable elements.
|
protected CmsDirectEditMode |
m_mode
Indicates which direct edit mode is active.
|
protected java.lang.String |
m_provider
Class name of the direct edit provider.
|
构造器和说明 |
---|
CmsJspTagEditable() |
限定符和类型 | 方法和说明 |
---|---|
int |
doEndTag()
Close the direct edit tag, also prints the direct edit HTML to the current page.
|
int |
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.
|
static void |
editableTagAction(javax.servlet.jsp.PageContext context,
java.lang.String provider,
CmsDirectEditMode mode,
java.lang.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.
|
java.lang.String |
getFile()
Gets the file with elements for direct editing.
|
java.lang.String |
getMode()
Returns the direct edit mode.
|
java.lang.String |
getProvider()
Returns the class name of the direct edit provider.
|
static void |
insertEditEmpty(javax.servlet.jsp.PageContext context,
I_CmsXmlContentContainer container,
CmsDirectEditMode mode)
Inserts direct edit for empty collector lists.
|
static boolean |
isDirectEditDisabled(javax.servlet.ServletRequest request)
Returns if direct edit is disabled for the current request.
|
static boolean |
isEditableRequest(javax.servlet.ServletRequest req)
Checks if the current request should be direct edit enabled.
|
boolean |
isEditEmpty()
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 |
setFile(java.lang.String file)
Sets the file with elements for direct editing.
|
void |
setMode(java.lang.String mode)
Sets the direct edit mode.
|
void |
setProvider(java.lang.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.
|
doAfterBody, doInitBody, getBodyContent, getPreviousOut, setBodyContent
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
protected java.lang.String m_file
protected transient CmsDirectEditMode m_mode
protected java.lang.String m_provider
public static void editableTagAction(javax.servlet.jsp.PageContext context, java.lang.String provider, CmsDirectEditMode mode, java.lang.String fileName) throws javax.servlet.jsp.JspException
context
- the current JSP page contextprovider
- the class name of the direct edit privider to use (may be null
, which means use the default)mode
- the direct edit mode to use (may be null
, which means current use mode on page)fileName
- optional filename parameter for the direct edit provider (may be null
, which means use the default)javax.servlet.jsp.JspException
- in case something goes wrongpublic static void endDirectEdit(javax.servlet.jsp.PageContext context) throws javax.servlet.jsp.JspException
context
- the current JSP page contextjavax.servlet.jsp.JspException
- in case something goes wrongpublic static I_CmsDirectEditProvider getDirectEditProvider(javax.servlet.jsp.PageContext context)
context
- the current JSP page contextpublic static void insertEditEmpty(javax.servlet.jsp.PageContext context, I_CmsXmlContentContainer container, CmsDirectEditMode mode) throws CmsException, javax.servlet.jsp.JspException
context
- the current JSP page contextcontainer
- the parent content load containermode
- the direct edit mode to use (may be null
, which means current use mode on page)CmsException
- in case of invalid collector settingsjavax.servlet.jsp.JspException
- in case writing to page context failspublic static boolean isDirectEditDisabled(javax.servlet.ServletRequest request)
request
- the servlet requesttrue
if direct edit is disabled for the current requestpublic static boolean isEditableRequest(javax.servlet.ServletRequest req)
req
- the servlet requesttrue
if the current request should be direct edit enabledpublic static boolean startDirectEdit(javax.servlet.jsp.PageContext context, CmsDirectEditParams params) throws javax.servlet.jsp.JspException
context
- the current JSP page contextparams
- the direct edit parameterstrue
in case a direct edit element has been openedjavax.servlet.jsp.JspException
- in case something goes wrongprotected static CmsDirectEditParams getDirectEditProviderParams(javax.servlet.jsp.PageContext context)
Also removes the parameters from the given page context.
context
- the current JSP page contextprotected static void setDirectEditProvider(javax.servlet.jsp.PageContext context, I_CmsDirectEditProvider provider)
context
- the current JSP page contextprovider
- the current initialized instance of the direct edit provider to setprotected static void setDirectEditProviderParams(javax.servlet.jsp.PageContext context, CmsDirectEditParams params)
context
- the current JSP page contextparams
- the current initialized instance of the direct edit provider parameters to setpublic int doEndTag() throws javax.servlet.jsp.JspException
doEndTag
在接口中 javax.servlet.jsp.tagext.Tag
doEndTag
在类中 javax.servlet.jsp.tagext.BodyTagSupport
Tag.EVAL_PAGE
javax.servlet.jsp.JspException
- in case something goes wrongpublic int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
在接口中 javax.servlet.jsp.tagext.Tag
doStartTag
在类中 javax.servlet.jsp.tagext.BodyTagSupport
Tag.EVAL_BODY_INCLUDE
javax.servlet.jsp.JspException
- in case something goes wrongpublic java.lang.String getFile()
public java.lang.String getMode()
public java.lang.String getProvider()
public boolean isEditEmpty()
public void release()
release
在接口中 javax.servlet.jsp.tagext.Tag
release
在类中 javax.servlet.jsp.tagext.BodyTagSupport
public void setEditEmpty(boolean editEmpty)
editEmpty
- the edit empty attribute to setpublic void setFile(java.lang.String file)
file
- the file to setpublic void setMode(java.lang.String mode)
mode
- the direct edit mode to setpublic void setProvider(java.lang.String provider)
provider
- the class name of the direct edit provider to set