|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.opencms.workplace.CmsWorkplace
org.opencms.workplace.tools.CmsToolDialog
org.opencms.workplace.CmsDialog
org.opencms.workplace.editors.CmsEditorBase
org.opencms.workplace.editors.CmsEditor
org.opencms.workplace.editors.CmsXmlContentEditor
public class CmsXmlContentEditor
Creates the editor for XML content definitions.
| Field Summary | |
|---|---|
static int |
ACTION_CHECK
Action for checking content before executing the direct edit action. |
static int |
ACTION_CONFIRMCORRECTION
Action for confirming the XML content structure correction. |
static int |
ACTION_COPYLOCALE
Value for the action: copy the current locale. |
static int |
ACTION_CORRECTIONCONFIRMED
Action for correction of the XML content structure confirmed. |
static int |
ACTION_ELEMENT_ADD
Action for optional element creation. |
static int |
ACTION_ELEMENT_MOVE_DOWN
Action for element move down operation. |
static int |
ACTION_ELEMENT_MOVE_UP
Action for element move up operation. |
static int |
ACTION_ELEMENT_REMOVE
Action for optional element removal. |
static int |
ACTION_NEW
Action for new file creation. |
static int |
ACTION_SUBCHOICES
Action that sub choices should be determined. |
static java.lang.String |
ATTRIBUTE_EDITCONTEXT
Request context attribute for the page from which the editor was opened. |
static java.lang.String |
EDITOR_ACTION_CHECK
Indicates that the content should be checked before executing the direct edit action. |
static java.lang.String |
EDITOR_ACTION_CONFIRMCORRECTION
Indicates that the correction of the XML content structure should be confirmed. |
static java.lang.String |
EDITOR_ACTION_ELEMENT_ADD
Indicates an optional element should be created. |
static java.lang.String |
EDITOR_ACTION_ELEMENT_MOVE_DOWN
Indicates an element should be moved down. |
static java.lang.String |
EDITOR_ACTION_ELEMENT_MOVE_UP
Indicates an element should be moved up. |
static java.lang.String |
EDITOR_ACTION_ELEMENT_REMOVE
Indicates an optional element should be removed. |
static java.lang.String |
EDITOR_ACTION_NEW
Indicates a new file should be created. |
static java.lang.String |
EDITOR_ACTION_SUBCHOICES
Indicates that sub choices should be determined. |
static java.lang.String |
EDITOR_COPYLOCALE
Indicates that the contents of the current locale should be copied to other locales. |
static java.lang.String |
EDITOR_CORRECTIONCONFIRMED
Indicates that the correction of the XML content structure was confirmed by the user. |
static java.lang.String |
PARAM_CHOICEELEMENT
Parameter name for the request parameter "choiceelement". |
static java.lang.String |
PARAM_CHOICETYPE
Parameter name for the request parameter "choicetype". |
static java.lang.String |
PARAM_EDITCONTEXT
Parameter name for the request parameter "editcontext". |
static java.lang.String |
PARAM_ELEMENTINDEX
Parameter name for the request parameter "elementindex". |
static java.lang.String |
PARAM_ELEMENTNAME
Parameter name for the request parameter "elementname". |
static java.lang.String |
PARAM_NEWLINK
Parameter name for the request parameter "newlink". |
| Fields inherited from class org.opencms.workplace.tools.CmsToolDialog |
|---|
PARAM_ADMIN_PROJECT, PARAM_BASE, PARAM_FORCE, PARAM_PATH, PARAM_ROOT, PARAM_STYLE, STYLE_NEW |
| Constructor Summary | |
|---|---|
CmsXmlContentEditor(CmsJspActionElement jsp)
Public constructor. |
|
| Method Summary | |
|---|---|
void |
actionChangeElementLanguage()
Performs the change element language action of the editor. |
void |
actionClear(boolean forceUnlock)
Deletes the temporary file and unlocks the edited resource when in direct edit mode. |
void |
actionCopyElementLocale()
Performs the copy locale action. |
void |
actionDeleteElementLocale()
Performs the delete locale action. |
void |
actionDirectEdit()
Performs a configurable action performed by the editor. |
void |
actionExit()
Performs the exit editor action. |
void |
actionMoveElement()
Moves an element in the xml content either up or down. |
void |
actionNew()
Creates a new XML content item for editing. |
void |
actionPreview()
Performs the preview XML content action in a new browser window. |
void |
actionSave()
Performs the save content action. |
void |
actionSave(java.util.Locale locale)
Performs the save content action. |
void |
actionToggleElement()
Adds an optional element to the XML content or removes an optional element from the XML content. |
JSONArray |
buildElementChoices(java.lang.String elementName,
boolean choiceType,
boolean checkChoice)
Returns the JSON array with information about the choices of a given element. |
java.lang.String |
buildSelectElementLanguage(java.lang.String attributes)
Builds the HTML String for the element language selector. |
java.lang.String |
buildSubChoices()
Returns the available sub choices for a nested choice element. |
protected void |
commitTempFile()
Writes the content of a temporary file back to the original file. |
protected java.util.Locale |
ensureLocale(java.util.Locale locale)
Makes sure the requested locale node is present in the content document by either copying an existing locale node or creating an empty one. |
int |
getButtonStyle()
Returns the style setting to use when generating buttons for this widget dialog. |
java.lang.String |
getEditorResourceUri()
Returns the URI to the editor resource folder where button images and javascripts are located. |
java.util.Locale |
getElementLocale()
Returns the current element locale. |
java.util.Set<java.lang.String> |
getHelpMessageIds()
Returns a set of help messages ids that are already included on the widget dialog. |
java.lang.String |
getParamChoiceElement()
Returns the name of the choice element to add. |
java.lang.String |
getParamChoiceType()
Returns the flag if the element to add is a choice type. |
java.lang.String |
getParamEditContext()
Gets the editor context path (usually either a container page path or null). |
java.lang.String |
getParamElementIndex()
Returns the index of the element to add or remove. |
java.lang.String |
getParamElementName()
Returns the name of the element to add or remove. |
java.lang.String |
getParamModelFile()
Returns the parameter that specifies the model file name. |
java.lang.String |
getParamNewLink()
Returns the "new link" parameter. |
java.lang.String |
getUserAgent()
Returns the "user-agent" of the current request, or null in case no
request is available. |
CmsXmlContentWidgetVisitor |
getWidgetCollector()
Returns the different xml editor widgets used in the form to display. |
java.lang.String |
getXmlEditorForm()
Generates the HTML form for the XML content editor. |
java.lang.String |
getXmlEditorHtmlEnd()
Generates the HTML for the end of the HTML editor form page. |
java.lang.String |
getXmlEditorIncludes()
Generates the JavaScript includes for the used widgets in the editor form. |
java.lang.String |
getXmlEditorInitCalls()
Generates the JavaScript initialization calls for the used widgets in the editor form. |
java.lang.String |
getXmlEditorInitMethods()
Generates the JavaScript initialization methods for the used widgets. |
boolean |
hasValidationErrors()
Returns true if the edited content contains validation errors, otherwise false. |
protected void |
initContent()
Initializes the editor content when opening the editor for the first time. |
protected void |
initElementLanguage()
Initializes the element language for the first call of the editor. |
protected void |
initWorkplaceRequestValues(CmsWorkplaceSettings settings,
javax.servlet.http.HttpServletRequest request)
Analyzes the request for workplace parameters and adjusts the workplace settings accordingly. |
boolean |
isPreviewEnabled()
Returns true if the preview is available for the edited xml content. |
void |
setEditorValues(java.util.Locale locale)
Sets the editor values for the locale with the parameters from the request. |
void |
setParamChoiceElement(java.lang.String choiceElement)
Sets the name of the choice element to add. |
void |
setParamChoiceType(java.lang.String paramChoiceType)
Sets the flag if the element to add is a choice type. |
void |
setParamEditContext(java.lang.String editContext)
Sets the edit context URI. |
void |
setParamElementIndex(java.lang.String elementIndex)
Sets the index of the element to add or remove. |
void |
setParamElementName(java.lang.String elementName)
Sets the name of the element to add or remove. |
void |
setParamModelFile(java.lang.String paramMasterFile)
Sets the parameter that specifies the model file name. |
void |
setParamNewLink(java.lang.String paramNewLink)
Sets the "new link" parameter. |
boolean |
showElementLanguageSelector()
Determines if the element language selector is shown dependent on the available Locales. |
boolean |
useNewStyle()
Tests if we are working with the new administration dialog style. |
| Methods inherited from class org.opencms.workplace.editors.CmsEditorBase |
|---|
initTimeWarp |
| Methods inherited from class org.opencms.workplace.tools.CmsToolDialog |
|---|
computeUpLevelLink, dialogTitle, getAdminTool, getCurrentToolPath, getParamBase, getParamForce, getParamPath, getParamRoot, getParamStyle, getParentPath, getToolManager, iconsBlockArea, iconsBlockAreaEnd, iconsBlockAreaStart, initAdminTool, pageBody, pageHtmlStyle, setParamBase, setParamForce, setParamPath, setParamRoot, setParamStyle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opencms.widgets.I_CmsWidgetDialog |
|---|
button, buttonBar, buttonBarHorizontalLine, buttonBarSeparator, buttonBarSpacer, buttonBarStartTab, dialogHorizontalSpacer, getLocale, getMessages |
| Field Detail |
|---|
public static final int ACTION_CHECK
public static final int ACTION_CONFIRMCORRECTION
public static final int ACTION_COPYLOCALE
public static final int ACTION_CORRECTIONCONFIRMED
public static final int ACTION_ELEMENT_ADD
public static final int ACTION_ELEMENT_MOVE_DOWN
public static final int ACTION_ELEMENT_MOVE_UP
public static final int ACTION_ELEMENT_REMOVE
public static final int ACTION_NEW
public static final int ACTION_SUBCHOICES
public static final java.lang.String ATTRIBUTE_EDITCONTEXT
public static final java.lang.String EDITOR_ACTION_CHECK
public static final java.lang.String EDITOR_ACTION_CONFIRMCORRECTION
public static final java.lang.String EDITOR_ACTION_ELEMENT_ADD
public static final java.lang.String EDITOR_ACTION_ELEMENT_MOVE_DOWN
public static final java.lang.String EDITOR_ACTION_ELEMENT_MOVE_UP
public static final java.lang.String EDITOR_ACTION_ELEMENT_REMOVE
public static final java.lang.String EDITOR_ACTION_NEW
public static final java.lang.String EDITOR_ACTION_SUBCHOICES
public static final java.lang.String EDITOR_COPYLOCALE
public static final java.lang.String EDITOR_CORRECTIONCONFIRMED
public static final java.lang.String PARAM_CHOICEELEMENT
public static final java.lang.String PARAM_CHOICETYPE
public static final java.lang.String PARAM_EDITCONTEXT
public static final java.lang.String PARAM_ELEMENTINDEX
public static final java.lang.String PARAM_ELEMENTNAME
public static final java.lang.String PARAM_NEWLINK
| Constructor Detail |
|---|
public CmsXmlContentEditor(CmsJspActionElement jsp)
jsp - an initialized JSP action element| Method Detail |
|---|
public void actionChangeElementLanguage()
public void actionClear(boolean forceUnlock)
actionClear in class CmsEditorforceUnlock - if true, the resource will be unlocked anyway
public void actionCopyElementLocale()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if something goes wrong
public void actionDeleteElementLocale()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if something goes wrong
public void actionDirectEdit()
throws java.io.IOException,
javax.servlet.jsp.JspException,
javax.servlet.ServletException
The default action is: save resource, clear temporary files and publish the resource directly.
java.io.IOException - if a forward fails
javax.servlet.ServletException - of a forward fails
javax.servlet.jsp.JspException - if including a JSP fails
public void actionExit()
throws java.io.IOException,
javax.servlet.jsp.JspException,
javax.servlet.ServletException
actionExit in class CmsEditorjava.io.IOException - if a forward fails
javax.servlet.jsp.JspException - if including an element fails
javax.servlet.ServletException - if a forward failsCmsEditor.actionExit()
public void actionMoveElement()
throws javax.servlet.jsp.JspException
Depends on the given action value.
javax.servlet.jsp.JspException - if including the error page fails
public void actionNew()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - in case something goes wrong
public void actionPreview()
throws java.io.IOException,
javax.servlet.jsp.JspException
java.io.IOException - if redirect fails
javax.servlet.jsp.JspException - if inclusion of error page fails
public void actionSave()
throws javax.servlet.jsp.JspException
actionSave in class CmsEditorjavax.servlet.jsp.JspException - if including an element failsCmsEditor.actionSave()
public void actionSave(java.util.Locale locale)
throws javax.servlet.jsp.JspException
This is also used when changing the element language.
locale - the locale to save the content
javax.servlet.jsp.JspException - if including the error page fails
public void actionToggleElement()
throws javax.servlet.jsp.JspException
Depends on the given action value.
javax.servlet.jsp.JspException - if including the error page fails
public JSONArray buildElementChoices(java.lang.String elementName,
boolean choiceType,
boolean checkChoice)
The returned array is only filled if the given element has choice options, otherwise an empty array is returned.
Note: the first array element is an object containing information if the element itself is a choice type,
the following elements are the choice option items.
elementName - the element name to check (complete xpath)choiceType - flag indicating if the given element name represents a choice type or notcheckChoice - flag indicating if the element name should be checked if it is a choice option and choice type
public java.lang.String buildSelectElementLanguage(java.lang.String attributes)
This method has to use the resource request parameter because the temporary file is not available in the upper button frame.
attributes - optional attributes for the <select> tag
public java.lang.String buildSubChoices()
public int getButtonStyle()
I_CmsWidgetDialog
getButtonStyle in interface I_CmsWidgetDialogI_CmsWidgetDialog.getButtonStyle()public java.lang.String getEditorResourceUri()
CmsEditor
getEditorResourceUri in class CmsEditorCmsEditor.getEditorResourceUri()public java.util.Locale getElementLocale()
public java.util.Set<java.lang.String> getHelpMessageIds()
I_CmsWidgetDialog
This is used to prevent the occurence of multiple html div id's with the same
value when generating the help texts. For valid html, each id can be used only once.
getHelpMessageIds in interface I_CmsWidgetDialogI_CmsWidgetDialog.getHelpMessageIds()public java.lang.String getParamChoiceElement()
public java.lang.String getParamChoiceType()
public java.lang.String getParamEditContext()
public java.lang.String getParamElementIndex()
public java.lang.String getParamElementName()
public java.lang.String getParamModelFile()
public java.lang.String getParamNewLink()
public java.lang.String getUserAgent()
I_CmsWidgetDialognull in case no
request is available.
getUserAgent in interface I_CmsWidgetDialogI_CmsWidgetDialog.getUserAgent()public CmsXmlContentWidgetVisitor getWidgetCollector()
public java.lang.String getXmlEditorForm()
public java.lang.String getXmlEditorHtmlEnd()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if including the error page fails
public java.lang.String getXmlEditorIncludes()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if including the error page fails
public java.lang.String getXmlEditorInitCalls()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if including the error page fails
public java.lang.String getXmlEditorInitMethods()
throws javax.servlet.jsp.JspException
javax.servlet.jsp.JspException - if an error occurs during JavaScript generationpublic boolean hasValidationErrors()
public boolean isPreviewEnabled()
This method has to use the resource request parameter and read the file from vfs because the temporary file is not available in the upper button frame.
public void setEditorValues(java.util.Locale locale)
throws CmsXmlException
Called before saving the xml content, redisplaying the input form, changing the language and adding or removing elements.
locale - the locale of the content to save
CmsXmlException - if something goes wrongpublic void setParamChoiceElement(java.lang.String choiceElement)
choiceElement - the name of the choice element to addpublic void setParamChoiceType(java.lang.String paramChoiceType)
paramChoiceType - the flag if the element to add is a choice typepublic void setParamEditContext(java.lang.String editContext)
editContext - the edit context URI.public void setParamElementIndex(java.lang.String elementIndex)
elementIndex - the index of the element to add or removepublic void setParamElementName(java.lang.String elementName)
elementName - the name of the element to add or removepublic void setParamModelFile(java.lang.String paramMasterFile)
paramMasterFile - the parameter that specifies the model file namepublic void setParamNewLink(java.lang.String paramNewLink)
paramNewLink - the "new link" parameter to setpublic boolean showElementLanguageSelector()
public boolean useNewStyle()
CmsToolDialogThe default is the new style, this parameter is not intended for external use.
useNewStyle in interface I_CmsWidgetDialoguseNewStyle in class CmsToolDialogtrue if using the new styleCmsToolDialog.useNewStyle()
protected void commitTempFile()
throws CmsException
CmsEditor
commitTempFile in class CmsEditorCmsException - if something goes wrongCmsEditor.commitTempFile()protected java.util.Locale ensureLocale(java.util.Locale locale)
locale - the requested locale
protected void initContent()
Not necessary for the xmlcontent editor.
initContent in class CmsEditorprotected void initElementLanguage()
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings,
javax.servlet.http.HttpServletRequest request)
CmsWorkplace
initWorkplaceRequestValues in class CmsDialogsettings - the workplace settingsrequest - the current requestCmsWorkplace.initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||