|
|||||||||||
| 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.CmsEditor
Provides basic methods for building the file editors of OpenCms.
The editor classes have to extend this class and implement action methods for common editor actions.
| Field Summary | |
static int |
ACTION_CHANGE_BODY
Value for the action: change the body. |
static int |
ACTION_EXIT
Value for the action: exit. |
static int |
ACTION_PREVIEW
Value for the action: show a preview. |
static int |
ACTION_SAVE
Value for the action: save. |
static int |
ACTION_SAVEACTION
Constant value for the customizable action button. |
static int |
ACTION_SAVEEXIT
Value for the action: save and exit. |
static int |
ACTION_SHOW
Value for the action: show the editor. |
static int |
ACTION_SHOW_ERRORMESSAGE
Value for the action: an error occured. |
static String |
EDITOR_CHANGE_ELEMENT
Value for the action parameter: change the element. |
static String |
EDITOR_CLEANUP
Value for the action parameter: cleanup content. |
static String |
EDITOR_EXIT
Value for the action parameter: exit editor. |
static String |
EDITOR_PREVIEW
Value for the action parameter: show a preview. |
static String |
EDITOR_SAVE
Value for the action parameter: save content. |
static String |
EDITOR_SAVEACTION
Value for the customizable action button. |
static String |
EDITOR_SAVEEXIT
Value for the action parameter: save and exit. |
static String |
EDITOR_SHOW
Value for the action parameter: show the editor. |
static String |
EDITOR_SHOW_ERRORMESSAGE
Value for the action parameter: an error occured. |
static String |
FILE_DIALOG_EDITOR_CONFIRM
Constant for the Editor special "save error" confirmation dialog. |
static String |
PARAM_BACKLINK
Parameter name for the request parameter "backlink". |
static String |
PARAM_CONTENT
Parameter name for the request parameter "content". |
static String |
PARAM_DIRECTEDIT
Parameter name for the request parameter "directedit". |
static String |
PARAM_EDITASTEXT
Parameter name for the request parameter "editastext". |
static String |
PARAM_EDITORMODE
Parameter name for the request parameter "editormode". |
static String |
PARAM_ELEMENTLANGUAGE
Parameter name for the request parameter "element language". |
static String |
PARAM_LOADDEFAULT
Parameter name for the request parameter "loaddefault". |
static String |
PARAM_MODIFIED
Parameter name for the request parameter "modified". |
static String |
PARAM_OLDELEMENTLANGUAGE
Parameter name for the request parameter "old element language". |
static String |
PARAM_TEMPFILE
Parameter name for the request parameter "tempfile". |
static String |
PATH_EDITORS
Stores the VFS editor path. |
| Fields inherited from class org.opencms.workplace.tools.CmsToolDialog |
PARAM_PATH, PARAM_ROOT, PARAM_STYLE |
| Constructor Summary | |
CmsEditor(CmsJspActionElement jsp)
Public constructor. |
|
| Method Summary | |
abstract void |
actionClear(boolean forceUnlock)
Unlocks the edited resource when in direct edit mode or when the resource was not modified. |
protected void |
actionClose()
Closes the editor and redirects to the workplace or the resource depending on the editor mode. |
abstract void |
actionExit()
Performs the exit editor action. |
abstract void |
actionSave()
Performs the save content action. |
String |
buildSelectElementLanguage(String attributes,
String resource,
Locale selectedLocale)
Builds the html String for the element language selector. |
String |
button(String href,
String target,
String image,
String label,
int type,
boolean useCustomImage)
Generates a button for the OpenCms editor. |
String |
buttonActionCancel()
Returns the editor action for a "cancel" button. |
String |
buttonActionDirectEdit(String jsFunction,
int type)
Builds the html to display the special action button for the direct edit mode of the editor. |
void |
checkLock(String resource,
int mode)
Checks the lock state of the resource and locks it if the autolock feature is enabled. |
protected void |
commitTempFile()
Writes the content of a temporary file back to the original file. |
protected String |
createTempFile()
Creates a temporary file which is needed while working in an editor with preview option. |
protected String |
decodeContent(String content)
Decodes the given content the same way the client would do it. |
protected String |
decodeParamValue(String paramName,
String paramValue)
Decodes an individual parameter value, ensuring the content is always decoded in UTF-8. |
protected void |
deleteTempFile()
Deletes a temporary file from the OpenCms VFS, needed when exiting an editor. |
protected String |
encodeContent(String content)
Encodes the given content so that it can be transfered to the client. |
CmsEditorDisplayOptions |
getEditorDisplayOptions()
Returns the instanciated editor display option class from the workplace manager. |
abstract String |
getEditorResourceUri()
Returns the URI to the editor resource folder where button images and javascripts are located. |
protected String |
getFileEncoding()
Returns the encoding parameter. |
protected String |
getFileEncoding(CmsObject cms,
String filename)
Helper method to determine the encoding of the given file in the VFS, which must be set using the "content-encoding" property. |
String |
getOpenCmsContext()
Returns the OpenCms request context path. |
String |
getParamBacklink()
Returns the back link when closing the editor. |
String |
getParamContent()
Returns the content of the editor. |
String |
getParamDirectedit()
Returns the direct edit flag parameter. |
String |
getParamEditastext()
Returns the edit as text parameter. |
String |
getParamEditormode()
Returns the editor mode parameter. |
String |
getParamElementlanguage()
Returns the current element language. |
String |
getParamLoaddefault()
Returns the "loaddefault" parameter to determine if the default editor should be loaded. |
String |
getParamModified()
Returns the modified parameter indicating if the resource has been saved. |
String |
getParamOldelementlanguage()
Returns the old element language. |
String |
getParamTempfile()
Returns the name of the temporary file. |
String |
getPicsUri()
Returns the path to the images used by this editor. |
protected abstract void |
initContent()
Initializes the editor content when openening the editor for the first time. |
protected void |
setFileEncoding(String value)
Sets the encoding parameter. |
void |
setParamBacklink(String backLink)
Sets the back link when closing the editor. |
void |
setParamContent(String content)
Sets the content of the editor. |
void |
setParamDirectedit(String direct)
Sets the direct edit flag parameter. |
void |
setParamEditastext(String editAsText)
Sets the edit as text parameter. |
void |
setParamEditormode(String mode)
Sets the editor mode parameter. |
void |
setParamElementlanguage(String elementLanguage)
Sets the current element language. |
void |
setParamLoaddefault(String loadDefault)
Sets the "loaddefault" parameter to determine if the default editor should be loaded. |
void |
setParamModified(String modified)
Sets the modified parameter indicating if the resource has been saved. |
void |
setParamOldelementlanguage(String oldElementLanguage)
Sets the old element language. |
void |
setParamTempfile(String fileName)
Sets the name of the temporary file. |
protected void |
showErrorPage(Exception exception)
Shows the selected error page in case of an exception. |
protected void |
showErrorPage(Object editor,
Exception exception)
Shows the selected error page in case of an exception. |
| Methods inherited from class org.opencms.workplace.tools.CmsToolDialog |
dialogTitle, getAdminTool, getCurrentToolPath, getParamPath, getParamRoot, getParamStyle, getParentPath, getToolManager, iconsBlockArea, iconsBlockAreaEnd, iconsBlockAreaStart, initAdminTool, pageBody, pageHtmlStyle, setParamPath, setParamRoot, setParamStyle, useNewStyle |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int ACTION_CHANGE_BODY
public static final int ACTION_EXIT
public static final int ACTION_PREVIEW
public static final int ACTION_SAVE
public static final int ACTION_SAVEACTION
public static final int ACTION_SAVEEXIT
public static final int ACTION_SHOW
public static final int ACTION_SHOW_ERRORMESSAGE
public static final String PATH_EDITORS
public static final String FILE_DIALOG_EDITOR_CONFIRM
public static final String EDITOR_CHANGE_ELEMENT
public static final String EDITOR_CLEANUP
public static final String EDITOR_EXIT
public static final String EDITOR_PREVIEW
public static final String EDITOR_SAVE
public static final String EDITOR_SAVEACTION
public static final String EDITOR_SAVEEXIT
public static final String EDITOR_SHOW
public static final String EDITOR_SHOW_ERRORMESSAGE
public static final String PARAM_BACKLINK
public static final String PARAM_CONTENT
public static final String PARAM_DIRECTEDIT
public static final String PARAM_EDITASTEXT
public static final String PARAM_EDITORMODE
public static final String PARAM_ELEMENTLANGUAGE
public static final String PARAM_LOADDEFAULT
public static final String PARAM_MODIFIED
public static final String PARAM_OLDELEMENTLANGUAGE
public static final String PARAM_TEMPFILE
| Constructor Detail |
public CmsEditor(CmsJspActionElement jsp)
jsp - an initialized JSP action element| Method Detail |
public abstract void actionClear(boolean forceUnlock)
forceUnlock - if true, the resource will be unlocked anyway
public abstract void actionExit()
throws CmsException,
IOException,
JspException
CmsException - if something goes wrong
IOException - if a redirection fails
JspException - if including an element fails
public abstract void actionSave()
throws IOException,
JspException
IOException - if a redirection fails
JspException - if including an element fails
public String buildSelectElementLanguage(String attributes,
String resource,
Locale selectedLocale)
attributes - optional attributes for the <select> tagresource - the name of the resource to editselectedLocale - the currently selected Locale
public String button(String href,
String target,
String image,
String label,
int type,
boolean useCustomImage)
href - the href link for the button, if none is given the button will be disabledtarget - the href link target for the button, if none is given the target will be same windowimage - the image name for the button, skin path will be automattically added as prefixlabel - the label for the text of the buttontype - 0: image only (default), 1: image and text, 2: text onlyuseCustomImage - if true, the button has to be placed in the editors "custom pics" folder
public String buttonActionCancel()
This overwrites the cancel method of the CmsDialog class.
Always use this value, do not write anything directly in the html page.
public String buttonActionDirectEdit(String jsFunction,
int type)
jsFunction - the JavaScript function which will be executed on the mouseup eventtype - 0: image only (default), 1: image and text, 2: text only
public void checkLock(String resource,
int mode)
throws CmsException
CmsWorkplace
checkLock in class CmsWorkplaceresource - the resource name which is checkedmode - flag indicating the mode (temporary or common) of a lock
CmsException - if reading or locking the resource failsCmsWorkplace.checkLock(java.lang.String, int)public CmsEditorDisplayOptions getEditorDisplayOptions()
This is a convenience method to be used on editor JSPs.
public abstract String getEditorResourceUri()
public String getOpenCmsContext()
This is a convenience method to use in the editor.
public String getParamBacklink()
public String getParamContent()
public String getParamDirectedit()
public String getParamEditastext()
public String getParamEditormode()
public String getParamElementlanguage()
public String getParamLoaddefault()
public String getParamModified()
public String getParamOldelementlanguage()
public String getParamTempfile()
public String getPicsUri()
public void setParamBacklink(String backLink)
backLink - the back linkpublic void setParamContent(String content)
content - the content of the editorpublic void setParamDirectedit(String direct)
direct - the direct edit flag parameterpublic void setParamEditastext(String editAsText)
editAsText - "true" if the resource should be handled like a text filepublic void setParamEditormode(String mode)
mode - the editor mode parameterpublic void setParamElementlanguage(String elementLanguage)
elementLanguage - the current element languagepublic void setParamLoaddefault(String loadDefault)
loadDefault - the "loaddefault" parameterpublic void setParamModified(String modified)
modified - the modified parameter indicating if the resource has been savedpublic void setParamOldelementlanguage(String oldElementLanguage)
oldElementLanguage - the old element languagepublic void setParamTempfile(String fileName)
fileName - the name of the temporary file
protected void actionClose()
throws IOException,
JspException
IOException - if a redirection fails
JspException - if including a JSP fails
protected void commitTempFile()
throws CmsException
CmsException - if something goes wrong
protected String createTempFile()
throws CmsException
CmsException - if something goes wrongprotected String decodeContent(String content)
Content is decoded as if it was encoded using the JavaScript "encodeURIComponent()" function.
content - the content to decode
protected String decodeParamValue(String paramName,
String paramValue)
For editors the content is always encoded using the JavaScript encodeURIComponent() method on the client, which always encodes in UTF-8.
decodeParamValue in class CmsWorkplaceparamName - the name of the parameterparamValue - the unencoded value of the parameter
protected void deleteTempFile()
protected String encodeContent(String content)
Content is encoded so that it is compatible with the JavaScript "decodeURIComponent()" function.
content - the content to encode
protected String getFileEncoding()
protected String getFileEncoding(CmsObject cms,
String filename)
cms - the CmsObjectfilename - the name of the file which is to be checked
protected abstract void initContent()
protected void setFileEncoding(String value)
value - the encoding value to set
protected void showErrorPage(Exception exception)
throws JspException
exception - the current exception
JspException - if inclusion of the error page fails
protected void showErrorPage(Object editor,
Exception exception)
throws JspException
editor - initialized instance of the editor classexception - the current exception
JspException - if inclusion of the error page fails
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||