Class CmsXmlContentEditor
- java.lang.Object
-
- org.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
-
- All Implemented Interfaces:
I_CmsWidgetDialog
public class CmsXmlContentEditor extends CmsEditor implements I_CmsWidgetDialog
Creates the editor for XML content definitions.- Since:
- 6.0.0
-
-
Field Summary
Fields Modifier and Type Field Description 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.editors.CmsEditor
ACTION_CHANGE_BODY, ACTION_DELETELOCALE, ACTION_EXIT, ACTION_PREVIEW, ACTION_SAVE, ACTION_SAVEACTION, ACTION_SAVEEXIT, ACTION_SHOW, ACTION_SHOW_ERRORMESSAGE, EDITOR_CHANGE_ELEMENT, EDITOR_CLEANUP, EDITOR_CLOSEBROWSER, EDITOR_DELETELOCALE, EDITOR_EXIT, EDITOR_PREVIEW, EDITOR_SAVE, EDITOR_SAVEACTION, EDITOR_SAVEEXIT, EDITOR_SHOW, EDITOR_SHOW_ERRORMESSAGE, EMPTY_LOCALE, PARAM_BACKLINK, PARAM_CONTENT, PARAM_DIRECTEDIT, PARAM_EDITASTEXT, PARAM_EDITORMODE, PARAM_ELEMENTLANGUAGE, PARAM_LOADDEFAULT, PARAM_MODIFIED, PARAM_OLDELEMENTLANGUAGE, PARAM_TEMPFILE, PATH_EDITORS
-
Fields inherited from class org.opencms.workplace.CmsDialog
ACTION_CANCEL, ACTION_CLOSEPOPUP, ACTION_CLOSEPOPUP_SAVE, ACTION_CONFIRMED, ACTION_CONTINUE, ACTION_DEFAULT, ACTION_LOCKS_CONFIRMED, ACTION_OK, ACTION_REPORT_BEGIN, ACTION_REPORT_END, ACTION_REPORT_UPDATE, ACTION_SET, ACTION_WAIT, ATTRIBUTE_THROWABLE, BUTTON_ADVANCED, BUTTON_BACK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_CONTINUE, BUTTON_DETAILS, BUTTON_DISCARD, BUTTON_EDIT, BUTTON_OK, BUTTON_OK_NO_SUBMIT, BUTTON_SET, DIALOG_BACK, DIALOG_CANCEL, DIALOG_CONFIRMED, DIALOG_CONTINUE, DIALOG_INITIAL, DIALOG_LOCKS_CONFIRMED, DIALOG_OK, DIALOG_SET, DIALOG_WAIT, PARAM_ACTION, PARAM_ACTION_VALUE_FOR_CHANGED_INDEX, PARAM_CLOSELINK, PARAM_DIALOGTYPE, PARAM_ERRORSTACK, PARAM_FILE, PARAM_FRAMENAME, PARAM_ISPOPUP, PARAM_LOCK, PARAM_MESSAGE, PARAM_ORIGINALPARAMS, PARAM_PREACTIONDONE, PARAM_REDIRECT, PARAM_RESOURCE, PARAM_TARGET, PARAM_THREAD, PARAM_THREAD_HASNEXT, PARAM_TITLE, REPORT_BEGIN, REPORT_END, REPORT_UPDATE
-
Fields inherited from class org.opencms.workplace.tools.CmsToolDialog
PARAM_ADMIN_PROJECT, PARAM_BASE, PARAM_FORCE, PARAM_PATH, PARAM_ROOT, PARAM_STYLE, STYLE_NEW
-
Fields inherited from class org.opencms.workplace.CmsWorkplace
DEBUG, DEFAULT_DATE_STRING, DEFAULT_LANGUAGE, DEFAULT_LOCALE, DIALOG_PATH_COMMON, FILE_DIALOG_CLOSE, FILE_DIALOG_SCREEN_CONFIRM, FILE_DIALOG_SCREEN_ERROR, FILE_DIALOG_SCREEN_ERRORPAGE, FILE_DIALOG_SCREEN_WAIT, FILE_EXPLORER_FILELIST, FILE_REPORT_OUTPUT, HTML_END, HTML_START, INPUT_DEFAULT, INPUT_NONE, JSP_WORKPLACE_URI, PARAM_DIRECTPUBLISH, PARAM_MODELFILE, PARAM_NEWRESOURCETYPE, PARAM_PUBLISHSIBLINGS, PARAM_RELATEDRESOURCES, PARAM_RESOURCELIST, PARAM_SUBRESOURCES, PARAM_WP_EXPLORER_RESOURCE, PARAM_WP_PROJECT, PARAM_WP_SITE, PARAM_WP_START, PARAM_WP_VIEW, PATH_DIALOGS, PATH_WORKPLACE, REQUEST_ATTRIBUTE_MULTIPART, REQUEST_ATTRIBUTE_RELOADTREE, RES_PATH_FILETYPES, RFS_PATH_RESOURCES, SESSION_WORKPLACE_CLASS, VFS_DIR_DEFAULTBODIES, VFS_DIR_TEMPLATES, VFS_PATH_COMMONS, VFS_PATH_EDITORS, VFS_PATH_GALLERIES, VFS_PATH_LOCALES, VFS_PATH_MODELDIALOG, VFS_PATH_MODULES, VFS_PATH_NEWRESOURCEDIALOG, VFS_PATH_RESOURCES, VFS_PATH_SITES, VFS_PATH_SYSTEM, VFS_PATH_VIEWS, VFS_PATH_WORKPLACE, VIEW_ADMIN, VIEW_DIRECT_EDIT, VIEW_EXPLORER, VIEW_GALLERY, VIEW_LIST, VIEW_WORKPLACE
-
-
Constructor Summary
Constructors Constructor Description CmsXmlContentEditor(CmsJspActionElement jsp)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
getParamMode()
Returns the mode.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
getParamPostCreateHandler()
Returns the postCreateHandler.java.lang.String
getUserAgent()
Returns the "user-agent" of the current request, ornull
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
setParamMode(java.lang.String mode)
Sets the content creation mode.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.void
setParamPostCreateHandler(java.lang.String handler)
Sets the post-create handler class name.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.CmsEditor
actionClose, buildSelectElementLanguage, button, buttonActionCancel, buttonActionDirectEdit, checkLock, clearEditorSessionInfo, createTempFile, decodeContent, decodeParamValue, deleteLocaleButton, deleteTempFile, encodeContent, getCloneCms, getEditorDisplayOptions, getEditorSessionInfo, getFileEncoding, getFileEncoding, getOpenCmsContext, getParamBacklink, getParamContent, getParamDirectedit, getParamEditastext, getParamEditormode, getParamElementlanguage, getParamLoaddefault, getParamModified, getParamOldelementlanguage, getParamTempfile, getPicsUri, initMessages, initSessionInfo, setFileEncoding, setParamBacklink, setParamContent, setParamDirectedit, setParamEditastext, setParamEditormode, setParamElementlanguage, setParamLoaddefault, setParamModified, setParamOldelementlanguage, setParamTempfile, showErrorPage, showErrorPage
-
Methods inherited from class org.opencms.workplace.editors.CmsEditorBase
checkResourcePermissions, checkRole, initTimeWarp
-
Methods inherited from class org.opencms.workplace.CmsDialog
actionCloseDialog, appendDelimiter, buildAjaxResultContainer, buildAjaxWaitMessage, buildLockAdditionalOptions, buildLockConfirmationMessageJS, buildLockHeaderBox, checkResourcePermissions, computeCurrentFolder, dialog, dialogBlock, dialogBlockEnd, dialogBlockStart, dialogButtonRow, dialogButtonRowEnd, dialogButtonRowStart, dialogButtons, dialogButtonsClose, dialogButtonsClose, dialogButtonsCloseDetails, dialogButtonsHtml, dialogButtonsOk, dialogButtonsOk, dialogButtonsOkCancel, dialogButtonsOkCancel, dialogButtonsOkCancelAdvanced, dialogButtonsSetOkCancel, dialogContent, dialogContentEnd, dialogContentStart, dialogEnd, dialogHead, dialogHorizontalSpacer, dialogLockButtons, dialogRow, dialogRowEnd, dialogRowStart, dialogScriptSubmit, dialogSeparator, dialogSpacer, dialogStart, dialogStart, dialogSubheadline, dialogToggleStart, dialogWhiteBox, dialogWhiteBoxEnd, dialogWhiteBoxStart, getAction, getAdministrationBackLink, getCancelAction, getDialogRealUri, getDialogUri, getOnlineHelpUriCustom, getParamAction, getParamCloseLink, getParamDialogtype, getParamFramename, getParamIsPopup, getParamMessage, getParamOriginalParams, getParamPreActionDone, getParamRedirect, getParamResource, getParamTitle, getState, hasCorrectLockstate, hasSiblings, htmlStart, htmlStart, htmlStart, htmlStartStyle, includeErrorpage, initCmsDialog, isPopup, isPreEditor, openLaunchpad, openWorkplaceLink, pageHtml, pageHtml, setAction, setOnlineHelpUriCustom, setParamAction, setParamCloseLink, setParamDialogtype, setParamFramename, setParamIsPopup, setParamMessage, setParamOriginalParams, setParamPreActionDone, setParamRedirect, setParamResource, setParamTitle
-
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 org.opencms.workplace.CmsWorkplace
addMessages, addMessages, allParamsAsHidden, allParamsAsRequest, allParamValues, bodyEnd, bodyStart, bodyStart, buildSelect, buildSelect, button, button, buttonBar, buttonBar, buttonBarHorizontalLine, buttonBarLabel, buttonBarLabel, buttonBarLine, buttonBarLineSpacer, buttonBarSeparator, buttonBarSpacer, buttonBarStartTab, canEditPermissionsForRoles, checkLock, fillParamValues, fillParamValues, generateCssStyle, generatePageEndExtended, generatePageEndSimple, generatePageStartExtended, generatePageStartSimple, getBroadcastMessageString, getCms, getEncoding, getExplorerFileListFullUri, getFrameSource, getJsp, getLocale, getMacroResolver, getMessages, getMultiPartFileItems, getParameterMap, getResourceUri, getResourceUri, getSession, getSettings, getSkinUri, getStartSiteRoot, getStartSiteRoot, getStaticResourceUri, getStaticResourceUri, getStyleUri, getStyleUri, getStyleUri, getTemporaryFileName, getWorkplaceExplorerLink, getWorkplaceExplorerLink, getWorkplaceSettings, htmlEnd, initSettings, initUserSettings, initWorkplaceMembers, initWorkplaceMembers, initWorkplaceSettings, isForwarded, isHelpEnabled, isSubElement, isTemporaryFile, key, key, keyDefault, nullToEmpty, paramsAsHidden, paramsAsHidden, paramsAsParameterMap, paramsAsRequest, paramValues, resolveMacros, sendCmsRedirect, sendForward, setForwarded, shortKey, substituteSiteTitle, substituteSiteTitleStatic, switchToCurrentProject, switchToTempProject, updateUserPreferences
-
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
-
ACTION_CHECK
public static final int ACTION_CHECK
Action for checking content before executing the direct edit action.- See Also:
- Constant Field Values
-
ACTION_CONFIRMCORRECTION
public static final int ACTION_CONFIRMCORRECTION
Action for confirming the XML content structure correction.- See Also:
- Constant Field Values
-
ACTION_COPYLOCALE
public static final int ACTION_COPYLOCALE
Value for the action: copy the current locale.- See Also:
- Constant Field Values
-
ACTION_CORRECTIONCONFIRMED
public static final int ACTION_CORRECTIONCONFIRMED
Action for correction of the XML content structure confirmed.- See Also:
- Constant Field Values
-
ACTION_ELEMENT_ADD
public static final int ACTION_ELEMENT_ADD
Action for optional element creation.- See Also:
- Constant Field Values
-
ACTION_ELEMENT_MOVE_DOWN
public static final int ACTION_ELEMENT_MOVE_DOWN
Action for element move down operation.- See Also:
- Constant Field Values
-
ACTION_ELEMENT_MOVE_UP
public static final int ACTION_ELEMENT_MOVE_UP
Action for element move up operation.- See Also:
- Constant Field Values
-
ACTION_ELEMENT_REMOVE
public static final int ACTION_ELEMENT_REMOVE
Action for optional element removal.- See Also:
- Constant Field Values
-
ACTION_NEW
public static final int ACTION_NEW
Action for new file creation.- See Also:
- Constant Field Values
-
ACTION_SUBCHOICES
public static final int ACTION_SUBCHOICES
Action that sub choices should be determined.- See Also:
- Constant Field Values
-
ATTRIBUTE_EDITCONTEXT
public static final java.lang.String ATTRIBUTE_EDITCONTEXT
Request context attribute for the page from which the editor was opened.
-
EDITOR_ACTION_CHECK
public static final java.lang.String EDITOR_ACTION_CHECK
Indicates that the content should be checked before executing the direct edit action.- See Also:
- Constant Field Values
-
EDITOR_ACTION_CONFIRMCORRECTION
public static final java.lang.String EDITOR_ACTION_CONFIRMCORRECTION
Indicates that the correction of the XML content structure should be confirmed.- See Also:
- Constant Field Values
-
EDITOR_ACTION_ELEMENT_ADD
public static final java.lang.String EDITOR_ACTION_ELEMENT_ADD
Indicates an optional element should be created.- See Also:
- Constant Field Values
-
EDITOR_ACTION_ELEMENT_MOVE_DOWN
public static final java.lang.String EDITOR_ACTION_ELEMENT_MOVE_DOWN
Indicates an element should be moved down.- See Also:
- Constant Field Values
-
EDITOR_ACTION_ELEMENT_MOVE_UP
public static final java.lang.String EDITOR_ACTION_ELEMENT_MOVE_UP
Indicates an element should be moved up.- See Also:
- Constant Field Values
-
EDITOR_ACTION_ELEMENT_REMOVE
public static final java.lang.String EDITOR_ACTION_ELEMENT_REMOVE
Indicates an optional element should be removed.- See Also:
- Constant Field Values
-
EDITOR_ACTION_NEW
public static final java.lang.String EDITOR_ACTION_NEW
Indicates a new file should be created.- See Also:
- Constant Field Values
-
EDITOR_ACTION_SUBCHOICES
public static final java.lang.String EDITOR_ACTION_SUBCHOICES
Indicates that sub choices should be determined.- See Also:
- Constant Field Values
-
EDITOR_COPYLOCALE
public static final java.lang.String EDITOR_COPYLOCALE
Indicates that the contents of the current locale should be copied to other locales.- See Also:
- Constant Field Values
-
EDITOR_CORRECTIONCONFIRMED
public static final java.lang.String EDITOR_CORRECTIONCONFIRMED
Indicates that the correction of the XML content structure was confirmed by the user.- See Also:
- Constant Field Values
-
PARAM_CHOICEELEMENT
public static final java.lang.String PARAM_CHOICEELEMENT
Parameter name for the request parameter "choiceelement".- See Also:
- Constant Field Values
-
PARAM_CHOICETYPE
public static final java.lang.String PARAM_CHOICETYPE
Parameter name for the request parameter "choicetype".- See Also:
- Constant Field Values
-
PARAM_EDITCONTEXT
public static final java.lang.String PARAM_EDITCONTEXT
Parameter name for the request parameter "editcontext".- See Also:
- Constant Field Values
-
PARAM_ELEMENTINDEX
public static final java.lang.String PARAM_ELEMENTINDEX
Parameter name for the request parameter "elementindex".- See Also:
- Constant Field Values
-
PARAM_ELEMENTNAME
public static final java.lang.String PARAM_ELEMENTNAME
Parameter name for the request parameter "elementname".- See Also:
- Constant Field Values
-
PARAM_NEWLINK
public static final java.lang.String PARAM_NEWLINK
Parameter name for the request parameter "newlink".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsXmlContentEditor
public CmsXmlContentEditor(CmsJspActionElement jsp)
Public constructor.- Parameters:
jsp
- an initialized JSP action element
-
-
Method Detail
-
actionChangeElementLanguage
public void actionChangeElementLanguage()
Performs the change element language action of the editor.
-
actionClear
public void actionClear(boolean forceUnlock)
Deletes the temporary file and unlocks the edited resource when in direct edit mode.- Specified by:
actionClear
in classCmsEditor
- Parameters:
forceUnlock
- if true, the resource will be unlocked anyway
-
actionCopyElementLocale
public void actionCopyElementLocale() throws javax.servlet.jsp.JspException
Performs the copy locale action.- Throws:
javax.servlet.jsp.JspException
- if something goes wrong
-
actionDeleteElementLocale
public void actionDeleteElementLocale() throws javax.servlet.jsp.JspException
Performs the delete locale action.- Throws:
javax.servlet.jsp.JspException
- if something goes wrong
-
actionDirectEdit
public void actionDirectEdit() throws java.io.IOException, javax.servlet.jsp.JspException, javax.servlet.ServletException
Performs a configurable action performed by the editor.The default action is: save resource, clear temporary files and publish the resource directly.
- Throws:
java.io.IOException
- if a forward failsjavax.servlet.ServletException
- of a forward failsjavax.servlet.jsp.JspException
- if including a JSP fails
-
actionExit
public void actionExit() throws java.io.IOException, javax.servlet.jsp.JspException, javax.servlet.ServletException
Performs the exit editor action.- Specified by:
actionExit
in classCmsEditor
- Throws:
java.io.IOException
- if a forward failsjavax.servlet.jsp.JspException
- if including an element failsjavax.servlet.ServletException
- if a forward fails- See Also:
CmsEditor.actionExit()
-
actionMoveElement
public void actionMoveElement() throws javax.servlet.jsp.JspException
Moves an element in the xml content either up or down.Depends on the given action value.
- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
actionNew
public void actionNew() throws javax.servlet.jsp.JspException
Creates a new XML content item for editing.- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
actionPreview
public void actionPreview() throws java.io.IOException, javax.servlet.jsp.JspException
Performs the preview XML content action in a new browser window.- Throws:
java.io.IOException
- if redirect failsjavax.servlet.jsp.JspException
- if inclusion of error page fails
-
actionSave
public void actionSave() throws javax.servlet.jsp.JspException
Performs the save content action.- Specified by:
actionSave
in classCmsEditor
- Throws:
javax.servlet.jsp.JspException
- if including an element fails- See Also:
CmsEditor.actionSave()
-
actionSave
public void actionSave(java.util.Locale locale) throws javax.servlet.jsp.JspException
Performs the save content action.This is also used when changing the element language.
- Parameters:
locale
- the locale to save the content- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
actionToggleElement
public void actionToggleElement() throws javax.servlet.jsp.JspException
Adds an optional element to the XML content or removes an optional element from the XML content.Depends on the given action value.
- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
buildElementChoices
public JSONArray buildElementChoices(java.lang.String elementName, boolean choiceType, boolean checkChoice)
Returns the JSON array with information about the choices of a given element.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.- Parameters:
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- Returns:
- the JSON array with information about the choices of a given element
-
buildSelectElementLanguage
public java.lang.String buildSelectElementLanguage(java.lang.String attributes)
Builds the HTML String for the element language selector.This method has to use the resource request parameter because the temporary file is not available in the upper button frame.
- Parameters:
attributes
- optional attributes for the <select> tag- Returns:
- the HTML for the element language select box
-
buildSubChoices
public java.lang.String buildSubChoices()
Returns the available sub choices for a nested choice element.- Returns:
- the available sub choices for a nested choice element as JSON array string
-
getButtonStyle
public int getButtonStyle()
Description copied from interface:I_CmsWidgetDialog
Returns the style setting to use when generating buttons for this widget dialog.- Specified by:
getButtonStyle
in interfaceI_CmsWidgetDialog
- Returns:
- the style setting to use when generating buttons for this widget dialog
- See Also:
I_CmsWidgetDialog.getButtonStyle()
-
getEditorResourceUri
public java.lang.String getEditorResourceUri()
Description copied from class:CmsEditor
Returns the URI to the editor resource folder where button images and javascripts are located.- Specified by:
getEditorResourceUri
in classCmsEditor
- Returns:
- the URI to the editor resource folder
- See Also:
CmsEditor.getEditorResourceUri()
-
getElementLocale
public java.util.Locale getElementLocale()
Returns the current element locale.- Returns:
- the current element locale
-
getHelpMessageIds
public java.util.Set<java.lang.String> getHelpMessageIds()
Description copied from interface:I_CmsWidgetDialog
Returns a set of help messages ids that are already included on the widget dialog.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.- Specified by:
getHelpMessageIds
in interfaceI_CmsWidgetDialog
- Returns:
- a set of help messages ids that are already included on the widget dialog
- See Also:
I_CmsWidgetDialog.getHelpMessageIds()
-
getParamChoiceElement
public java.lang.String getParamChoiceElement()
Returns the name of the choice element to add.- Returns:
- the name of the choice element to add
-
getParamChoiceType
public java.lang.String getParamChoiceType()
Returns the flag if the element to add is a choice type.- Returns:
- the flag if the element to add is a choice type
-
getParamEditContext
public java.lang.String getParamEditContext()
Gets the editor context path (usually either a container page path or null).- Returns:
- the editor context path
-
getParamElementIndex
public java.lang.String getParamElementIndex()
Returns the index of the element to add or remove.- Returns:
- the index of the element to add or remove
-
getParamElementName
public java.lang.String getParamElementName()
Returns the name of the element to add or remove.- Returns:
- the name of the element to add or remove
-
getParamMode
public java.lang.String getParamMode()
Returns the mode.- Returns:
- the mode
-
getParamModelFile
public java.lang.String getParamModelFile()
Returns the parameter that specifies the model file name.- Returns:
- the parameter that specifies the model file name
-
getParamNewLink
public java.lang.String getParamNewLink()
Returns the "new link" parameter.- Returns:
- the "new link" parameter
-
getParamPostCreateHandler
public java.lang.String getParamPostCreateHandler()
Returns the postCreateHandler.- Returns:
- the postCreateHandler
-
getUserAgent
public java.lang.String getUserAgent()
Description copied from interface:I_CmsWidgetDialog
Returns the "user-agent" of the current request, ornull
in case no request is available.- Specified by:
getUserAgent
in interfaceI_CmsWidgetDialog
- Returns:
- the "user-agent" of the current request
- See Also:
I_CmsWidgetDialog.getUserAgent()
-
getWidgetCollector
public CmsXmlContentWidgetVisitor getWidgetCollector()
Returns the different xml editor widgets used in the form to display.- Returns:
- the different xml editor widgets used in the form to display
-
getXmlEditorForm
public java.lang.String getXmlEditorForm()
Generates the HTML form for the XML content editor.- Returns:
- the HTML that generates the form for the XML editor
-
getXmlEditorHtmlEnd
public java.lang.String getXmlEditorHtmlEnd() throws javax.servlet.jsp.JspException
Generates the HTML for the end of the HTML editor form page.- Returns:
- the HTML for the end of the HTML editor form page
- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
getXmlEditorIncludes
public java.lang.String getXmlEditorIncludes() throws javax.servlet.jsp.JspException
Generates the JavaScript includes for the used widgets in the editor form.- Returns:
- the JavaScript includes for the used widgets
- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
getXmlEditorInitCalls
public java.lang.String getXmlEditorInitCalls() throws javax.servlet.jsp.JspException
Generates the JavaScript initialization calls for the used widgets in the editor form.- Returns:
- the JavaScript initialization calls for the used widgets
- Throws:
javax.servlet.jsp.JspException
- if including the error page fails
-
getXmlEditorInitMethods
public java.lang.String getXmlEditorInitMethods() throws javax.servlet.jsp.JspException
Generates the JavaScript initialization methods for the used widgets.- Returns:
- the JavaScript initialization methods for the used widgets
- Throws:
javax.servlet.jsp.JspException
- if an error occurs during JavaScript generation
-
hasValidationErrors
public boolean hasValidationErrors()
Returns true if the edited content contains validation errors, otherwise false.- Returns:
- true if the edited content contains validation errors, otherwise false
-
isPreviewEnabled
public boolean isPreviewEnabled()
Returns true if the preview is available for the edited xml content.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.
- Returns:
- true if the preview is enabled, otherwise false
-
setEditorValues
public void setEditorValues(java.util.Locale locale) throws CmsXmlException
Sets the editor values for the locale with the parameters from the request.Called before saving the xml content, redisplaying the input form, changing the language and adding or removing elements.
- Parameters:
locale
- the locale of the content to save- Throws:
CmsXmlException
- if something goes wrong
-
setParamChoiceElement
public void setParamChoiceElement(java.lang.String choiceElement)
Sets the name of the choice element to add.- Parameters:
choiceElement
- the name of the choice element to add
-
setParamChoiceType
public void setParamChoiceType(java.lang.String paramChoiceType)
Sets the flag if the element to add is a choice type.- Parameters:
paramChoiceType
- the flag if the element to add is a choice type
-
setParamEditContext
public void setParamEditContext(java.lang.String editContext)
Sets the edit context URI.- Parameters:
editContext
- the edit context URI.
-
setParamElementIndex
public void setParamElementIndex(java.lang.String elementIndex)
Sets the index of the element to add or remove.- Parameters:
elementIndex
- the index of the element to add or remove
-
setParamElementName
public void setParamElementName(java.lang.String elementName)
Sets the name of the element to add or remove.- Parameters:
elementName
- the name of the element to add or remove
-
setParamMode
public void setParamMode(java.lang.String mode)
Sets the content creation mode.- Parameters:
mode
- the content creation mode
-
setParamModelFile
public void setParamModelFile(java.lang.String paramMasterFile)
Sets the parameter that specifies the model file name.- Parameters:
paramMasterFile
- the parameter that specifies the model file name
-
setParamNewLink
public void setParamNewLink(java.lang.String paramNewLink)
Sets the "new link" parameter.- Parameters:
paramNewLink
- the "new link" parameter to set
-
setParamPostCreateHandler
public void setParamPostCreateHandler(java.lang.String handler)
Sets the post-create handler class name.- Parameters:
handler
- the post-create handler class name
-
showElementLanguageSelector
public boolean showElementLanguageSelector()
Determines if the element language selector is shown dependent on the available Locales.- Returns:
- true, if more than one Locale is available, otherwise false
-
useNewStyle
public boolean useNewStyle()
Description copied from class:CmsToolDialog
Tests if we are working with the new administration dialog style.The default is the new style, this parameter is not intended for external use.
- Specified by:
useNewStyle
in interfaceI_CmsWidgetDialog
- Overrides:
useNewStyle
in classCmsToolDialog
- Returns:
true
if using the new style- See Also:
CmsToolDialog.useNewStyle()
-
commitTempFile
protected void commitTempFile() throws CmsException
Description copied from class:CmsEditor
Writes the content of a temporary file back to the original file.- Overrides:
commitTempFile
in classCmsEditor
- Throws:
CmsException
- if something goes wrong- See Also:
CmsEditor.commitTempFile()
-
ensureLocale
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.- Parameters:
locale
- the requested locale- Returns:
- the locale
-
initContent
protected void initContent()
Initializes the editor content when opening the editor for the first time.Not necessary for the xmlcontent editor.
- Specified by:
initContent
in classCmsEditor
-
initElementLanguage
protected void initElementLanguage()
Initializes the element language for the first call of the editor.
-
initWorkplaceRequestValues
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request)
Description copied from class:CmsWorkplace
Analyzes the request for workplace parameters and adjusts the workplace settings accordingly.- Overrides:
initWorkplaceRequestValues
in classCmsDialog
- Parameters:
settings
- the workplace settingsrequest
- the current request- See Also:
CmsWorkplace.initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
-
-