Class CmsWorkplace
- Direct Known Subclasses:
CmsToolDialog
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
The debug flag.static final String
Default value for date last modified, the release and expire date.static final String
Parameter for the default language.static final Locale
Parameter for the default locale.static final String
Constant for the JSP common files (e.g.static final String
Constant for the JSP common close dialog page.static final String
Constant for the JSP common confirmation dialog.static final String
Constant for the JSP common error dialog.static final String
Constant for the JSP common error dialog.static final String
Constant for the JSP common wait screen.static final String
Constant for the JSP explorer filelist file.static final String
Constant for the JSP common report page.static final int
Helper variable to deliver the html end part.static final int
Helper variable to deliver the html start part.static final String
Request parameter name prefix for the preferred editors.static final String
Request parameter name for no settings in start galleries.static final String
Path to the JSP workplace frame loader file.static final String
Request parameter name for the directpublish parameter.static final String
Request parameter name for the model file.static final String
Request parameter name for the new resource type.static final String
Request parameter name for the publishsiblings parameter.static final String
Request parameter name for the relatedresources parameter.static final String
Request parameter name for the resource list.static final String
Request parameter name for the subresources parameter.static final String
The request parameter for the workplace project selection.static final String
The request parameter for the workplace project selection.static final String
The request parameter for the workplace site selection.static final String
The request parameter for the workplace start selection.static final String
The request parameter for the workplace view selection.static final String
Constant for the JSP dialogs path.static final String
Constant for the JSP workplace path.protected static final String
Key name for the request attribute to indicate a multipart request was already parsed.protected static final String
Key name for the request attribute to reload the folder tree view.static final String
Path for file type icons relative to the resources folder.static final String
Path to exported system image folder.protected static final String
Key name for the session workplace class.static final String
Directory name of content default_bodies folder.static final String
Directory name of content templates folder.static final String
Path to commons.static final String
Path to the workplace editors.static final String
Path to the galleries.static final String
Path to locales.static final String
Absolute path to the model file dialog.static final String
Path to modules folder.static final String
Absolute path to thenew resource dialog.static final String
Path to system image folder.static final String
Path to sites folder.static final String
Path to system folder.static final String
Path to workplace views.static final String
Path to the workplace.static final String
Constant for the admin view JSP.static final String
Constant for the direct edit view JSP.static final String
The "explorerview" view selection.static final String
The "galleryview" view selection.static final String
The "list" view selection.static final String
Constant for the explorer view JSP. -
Constructor Summary
ConstructorDescriptionCmsWorkplace
(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) Public constructor with JSP variables.CmsWorkplace
(CmsObject cms, javax.servlet.http.HttpSession session) Constructor in case no page context is available.Public constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMessages
(String bundleName) Auxiliary method for initialization of messages.protected void
addMessages
(CmsMessages messages) Auxiliary method for initialization of messages.Returns all parameters of the current workplace class as hidden field tags that can be inserted in a form.Returns all present request parameters as String.Returns the values of all parameter methods of this workplace class instance.bodyEnd()
Builds the end html of the body.Builds the start html of the body.Builds the start html of the body.Generates a html select box out of the provided values.static String
buildSelect
(String parameters, List<String> options, List<String> values, int selected, boolean useLineFeed) Generates a html select box out of the provided values.Generates a button for the OpenCms workplace.Generates a button for the OpenCms workplace.buttonBar
(int segment) Returns the html for a button bar.Returns the html for a button bar.Generates a horizontal button bar separator line with maximum width.buttonBarLabel
(String label) Generates a button bar label.buttonBarLabel
(String label, String className) Generates a button bar label.buttonBarLine
(int leftPixel, int rightPixel, String className) Generates a variable button bar separator line.buttonBarLineSpacer
(int pixel) Generates a variable button bar separator line spacer.buttonBarSeparator
(int leftPixel, int rightPixel) Generates a button bar separator.buttonBarSpacer
(int width) Returns the html for an invisible spacer between button bar contents like buttons, labels, etc.buttonBarStartTab
(int leftPixel, int rightPixel) Generates a button bar starter tab.static boolean
canEditPermissionsForRoles
(CmsObject cms, String path) Checks if permissions for roles should be editable for the current user on the resource with the given path.void
Checks the lock state of the resource and locks it if the autolock feature is enabled.void
checkLock
(String resource, CmsLockType type) Checks the lock state of the resource and locks it if the autolock feature is enabled.protected void
Checks that the current user is a workplace user.protected String
decodeParamValue
(String paramName, String paramValue) Decodes an individual parameter value.void
fillParamValues
(javax.servlet.http.HttpServletRequest request) Fills all class parameter values from the data provided in the current request.void
fillParamValues
(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) First sets site and project in the workplace settings, then fills all class parameter values from the data provided in the current request.static String
Returns the style sheets for the report.static String
Generates the footer for the extended report view.static String
Generates the footer for the simple report view.static String
generatePageStartExtended
(CmsObject cms, String encoding) Generates the header for the extended report view.static String
Generates the header for the simple report view.Returns the message String for the broadcast message alert of the workplace.getCms()
Returns the initialized cms object for the current user.Returns the current workplace encoding.Returns the uri (including context path) to the explorer file list.getFrameSource
(String frameName, String uri) Returns the html for the frame name and source and stores this information in the workplace settings.getJsp()
Returns the JSP action element.Returns the current users workplace locale settings.Returns the current used macro resolver instance.Returns the current used message object.List<org.apache.commons.fileupload.FileItem>
Returns a list of FileItem instances parsed from the request, in the order that they were transmitted.Returns the map of parameters read from the current request.Returns the path to the workplace static resources.static String
getResourceUri
(String resourceName) Returns the full Workplace resource path to the selected resource.javax.servlet.http.HttpSession
Returns the current user http session.Returns the current users workplace settings.static String
Returns the path to the skin resources.static String
getStartSiteRoot
(CmsObject cms, CmsUserSettings userSettings) Returns the start site from the given user settings.static String
getStartSiteRoot
(CmsObject cms, CmsWorkplaceSettings settings) Returns the start site from the given workplace settings.static String
getStaticResourceUri
(String resourceName) Returns the URI to static resources served from the class path.static String
getStaticResourceUri
(String resourceName, String versionInfo) Returns the URI to static resources served from the class path.getStyleUri
(String filename) Returns the path to the cascading stylesheets.static String
Returns the path to the cascading stylesheets.static String
getStyleUri
(CmsJspActionElement jsp, String filename) Returns the path to the cascading stylesheets.static String
getTemporaryFileName
(String resourceName) Returns the temporary file name for the given resource name.static String
getWorkplaceExplorerLink
(CmsObject cms, String explorerRootPath) Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.static String
getWorkplaceExplorerLink
(CmsJspActionElement jsp, String explorerRootPath) Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.static CmsWorkplaceSettings
getWorkplaceSettings
(CmsObject cms, javax.servlet.http.HttpServletRequest req) Returns the workplace settings of the current user.htmlEnd()
Builds the end html of the page.Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.protected void
Initializes the message object.boolean
initSettings
(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) Sets site and project in the workplace settings with the request values of parameters
andPARAM_WP_SITE
.PARAM_WP_PROJECT
protected void
initTimeWarp
(CmsUserSettings settings, javax.servlet.http.HttpSession session) Sets the users time warp if configured and if the current timewarp setting is different or clears the current time warp setting if the user has no configured timewarp.static CmsWorkplaceSettings
initUserSettings
(CmsObject cms, CmsWorkplaceSettings settings, boolean update) Updates the user settings in the given workplace settings for the current user, reading the user settings from the database if required.protected void
initWorkplaceMembers
(CmsObject cms, javax.servlet.http.HttpSession session) Initializes this workplace class instance.protected void
Initializes this workplace class instance.protected abstract void
initWorkplaceRequestValues
(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) Analyzes the request for workplace parameters and adjusts the workplace settings accordingly.static CmsWorkplaceSettings
initWorkplaceSettings
(CmsObject cms, CmsWorkplaceSettings settings, boolean update) Updates the given workplace settings, also re-initializing the state of the Workplace to the users preferences (for example setting the startup site and project).boolean
Returns the forwarded flag.boolean
Returns true if the online help for the users current workplace language is installed.boolean
Returns true if the currently processed element is an included sub element.static boolean
isTemporaryFile
(CmsResource resource) Returnstrue
if the given resource is a temporary file.Returns the localized resource string for a given message key, checking the workplace default resources and all module bundles.Returns the localized resource string for a given message key, with the provided replacement parameters.keyDefault
(String keyName, String defaultValue) Returns the localized resource string for the given message key, checking the workplace default resources and all module bundles.nullToEmpty
(String value) Returns the empty String "" if the provided value is null, otherwise just returns the provided value.Builds the html of the body.Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type.pageHtmlStyle
(int segment, String title, String stylesheet) Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type, allowing the selection of an individual style sheet.Returns all initialized parameters of the current workplace class as hidden field tags that can be inserted in a form.paramsAsHidden
(Collection<String> excludes) Returns all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form.Returns all initialized parameters of the current workplace class in the form of a parameter map, i.e.Returns all initialized parameters of the current workplace class as request parameters, i.e.Returns the values of all parameter methods of this workplace class instance.resolveMacros
(String input) Resolves the macros in the given String and replaces them by their localized keys.void
sendCmsRedirect
(String location) Sends a http redirect to the specified URI in the OpenCms VFS.void
sendForward
(String location, Map<String, String[]> params) Forwards to the specified location in the OpenCms VFS.void
setForwarded
(boolean forwarded) Sets the forwarded flag.Get a localized short key value for the workplace.protected String
substituteSiteTitle
(String title) Replaces the site title, if necessary.static String
substituteSiteTitleStatic
(String title, Locale locale) Substitutes the site title.protected void
Helper method to change back from the temporary project to the current project.protected CmsUUID
Helper method to change the current project to the temporary file project.static void
updateUserPreferences
(CmsObject cms, javax.servlet.http.HttpServletRequest req) Updates the user preferences after changes have been made.
-
Field Details
-
DEBUG
The debug flag.- See Also:
-
JSP_WORKPLACE_URI
Path to the JSP workplace frame loader file.- See Also:
-
PARAM_MODELFILE
Request parameter name for the model file.- See Also:
-
INPUT_DEFAULT
Request parameter name prefix for the preferred editors.- See Also:
-
PARAM_RESOURCELIST
Request parameter name for the resource list.- See Also:
-
INPUT_NONE
Request parameter name for no settings in start galleries.- See Also:
-
VFS_PATH_SYSTEM
Path to system folder.- See Also:
-
VFS_PATH_SITES
Path to sites folder.- See Also:
-
VFS_PATH_WORKPLACE
Path to the workplace.- See Also:
-
PATH_DIALOGS
Constant for the JSP dialogs path.- See Also:
-
DEFAULT_LOCALE
Parameter for the default locale. -
DEFAULT_LANGUAGE
Parameter for the default language. -
DIALOG_PATH_COMMON
Constant for the JSP common files (e.g. error page) path.- See Also:
-
FILE_DIALOG_CLOSE
Constant for the JSP common close dialog page.- See Also:
-
FILE_DIALOG_SCREEN_CONFIRM
Constant for the JSP common confirmation dialog.- See Also:
-
FILE_DIALOG_SCREEN_ERROR
Constant for the JSP common error dialog.- See Also:
-
FILE_DIALOG_SCREEN_ERRORPAGE
Constant for the JSP common error dialog.- See Also:
-
FILE_DIALOG_SCREEN_WAIT
Constant for the JSP common wait screen.- See Also:
-
VFS_PATH_VIEWS
Path to workplace views.- See Also:
-
FILE_EXPLORER_FILELIST
Constant for the JSP explorer filelist file.- See Also:
-
FILE_REPORT_OUTPUT
Constant for the JSP common report page.- See Also:
-
HTML_END
Helper variable to deliver the html end part.- See Also:
-
HTML_START
Helper variable to deliver the html start part.- See Also:
-
PARAM_WP_EXPLORER_RESOURCE
The request parameter for the workplace project selection.- See Also:
-
PARAM_WP_PROJECT
The request parameter for the workplace project selection.- See Also:
-
PARAM_WP_SITE
The request parameter for the workplace site selection.- See Also:
-
PATH_WORKPLACE
Constant for the JSP workplace path.- See Also:
-
RES_PATH_FILETYPES
Path for file type icons relative to the resources folder.- See Also:
-
RFS_PATH_RESOURCES
Path to exported system image folder.- See Also:
-
VFS_DIR_DEFAULTBODIES
Directory name of content default_bodies folder.- See Also:
-
VFS_DIR_TEMPLATES
Directory name of content templates folder.- See Also:
-
VFS_PATH_COMMONS
Path to commons.- See Also:
-
VFS_PATH_EDITORS
Path to the workplace editors.- See Also:
-
VFS_PATH_GALLERIES
Path to the galleries.- See Also:
-
VFS_PATH_LOCALES
Path to locales.- See Also:
-
VFS_PATH_MODULES
Path to modules folder.- See Also:
-
VFS_PATH_RESOURCES
Path to system image folder.- See Also:
-
VIEW_DIRECT_EDIT
Constant for the direct edit view JSP.- See Also:
-
VIEW_WORKPLACE
Constant for the explorer view JSP.- See Also:
-
VIEW_ADMIN
Constant for the admin view JSP.- See Also:
-
REQUEST_ATTRIBUTE_MULTIPART
Key name for the request attribute to indicate a multipart request was already parsed.- See Also:
-
REQUEST_ATTRIBUTE_RELOADTREE
Key name for the request attribute to reload the folder tree view.- See Also:
-
SESSION_WORKPLACE_CLASS
Key name for the session workplace class.- See Also:
-
VIEW_EXPLORER
The "explorerview" view selection.- See Also:
-
VIEW_GALLERY
The "galleryview" view selection.- See Also:
-
VIEW_LIST
The "list" view selection.- See Also:
-
PARAM_DIRECTPUBLISH
Request parameter name for the directpublish parameter.- See Also:
-
PARAM_PUBLISHSIBLINGS
Request parameter name for the publishsiblings parameter.- See Also:
-
PARAM_RELATEDRESOURCES
Request parameter name for the relatedresources parameter.- See Also:
-
PARAM_SUBRESOURCES
Request parameter name for the subresources parameter.- See Also:
-
DEFAULT_DATE_STRING
Default value for date last modified, the release and expire date.- See Also:
-
VFS_PATH_MODELDIALOG
Absolute path to the model file dialog.- See Also:
-
VFS_PATH_NEWRESOURCEDIALOG
Absolute path to thenew resource dialog.- See Also:
-
PARAM_NEWRESOURCETYPE
Request parameter name for the new resource type.- See Also:
-
PARAM_WP_VIEW
The request parameter for the workplace view selection.- See Also:
-
PARAM_WP_START
The request parameter for the workplace start selection.- See Also:
-
-
Constructor Details
-
CmsWorkplace
Public constructor.- Parameters:
jsp
- the initialized JSP context
-
CmsWorkplace
Constructor in case no page context is available.- Parameters:
cms
- the current user contextsession
- the session
-
CmsWorkplace
public CmsWorkplace(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) Public constructor with JSP variables.- Parameters:
context
- the JSP page contextreq
- the JSP requestres
- the JSP response
-
-
Method Details
-
buildSelect
public static String buildSelect(String parameters, List<String> options, List<String> values, int selected, boolean useLineFeed) Generates a html select box out of the provided values.- Parameters:
parameters
- a string that will be inserted into the initial select tag, if null no parameters will be insertedoptions
- the optionsvalues
- the option values, if null the select will have no value attributesselected
- the index of the pre-selected option, if -1 no option is pre-selecteduseLineFeed
- if true, adds some formatting "\n" to the output String- Returns:
- a String representing a html select box
-
canEditPermissionsForRoles
Checks if permissions for roles should be editable for the current user on the resource with the given path.- Parameters:
cms
- the CMS contextpath
- the path of a resource- Returns:
true
if permissions for roles should be editable for the current user on the resource with the given path
-
generateCssStyle
Returns the style sheets for the report.- Parameters:
cms
- the current users context- Returns:
- the style sheets for the report
-
generatePageEndExtended
Generates the footer for the extended report view.- Returns:
- html code
-
generatePageEndSimple
Generates the footer for the simple report view.- Returns:
- html code
-
generatePageStartExtended
Generates the header for the extended report view.- Parameters:
cms
- the current users contextencoding
- the encoding string- Returns:
- html code
-
generatePageStartSimple
Generates the header for the simple report view.- Parameters:
wp
- the workplace instance- Returns:
- html code
-
getResourceUri
Returns the full Workplace resource path to the selected resource.- Parameters:
resourceName
- the name of the resource to get the resource path for- Returns:
- the full Workplace resource path to the selected resource
-
getSkinUri
Returns the path to the skin resources.- Returns:
- the path to the skin resources
-
getStartSiteRoot
Returns the start site from the given user settings.- Parameters:
cms
- the cms contextuserSettings
- the user settings- Returns:
- the start site root
-
getStartSiteRoot
Returns the start site from the given workplace settings.- Parameters:
cms
- the cms contextsettings
- the workplace settings- Returns:
- the start site root
-
getStaticResourceUri
Returns the URI to static resources served from the class path.- Parameters:
resourceName
- the resource name- Returns:
- the URI
-
getStaticResourceUri
Returns the URI to static resources served from the class path.- Parameters:
resourceName
- the resource nameversionInfo
- add an additional version info parameter to avoid browser caching issues- Returns:
- the URI
-
getStyleUri
Returns the path to the cascading stylesheets.- Parameters:
jsp
- the JSP context- Returns:
- the path to the cascading stylesheets
-
getStyleUri
Returns the path to the cascading stylesheets.- Parameters:
jsp
- the JSP contextfilename
- the name of the stylesheet- Returns:
- the path to the cascading stylesheets
-
getTemporaryFileName
Returns the temporary file name for the given resource name.To create a temporary file name of a resource name, the prefix char
'~'
(tilde) is added to the file name after all parent folder names have been removed.- Parameters:
resourceName
- the resource name to return the temporary file name for- Returns:
- the temporary file name for the given resource name
- See Also:
-
getWorkplaceExplorerLink
Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.- Parameters:
jsp
- needed for link functionality.explorerRootPath
- a root relative folder link (has to end with '/').- Returns:
- a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
-
getWorkplaceExplorerLink
Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.- Parameters:
cms
- the cms objectexplorerRootPath
- a root relative folder link (has to end with '/').- Returns:
- a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
-
getWorkplaceSettings
public static CmsWorkplaceSettings getWorkplaceSettings(CmsObject cms, javax.servlet.http.HttpServletRequest req) Returns the workplace settings of the current user.- Parameters:
cms
- the cms contextreq
- the request- Returns:
- the workplace settings or
null
if the user is not logged in
-
initUserSettings
public static CmsWorkplaceSettings initUserSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) Updates the user settings in the given workplace settings for the current user, reading the user settings from the database if required.- Parameters:
cms
- the cms object for the current usersettings
- the workplace settings to update (ifnull
a new instance is created)update
- flag indicating if settings are only updated (user preferences)- Returns:
- the current users workplace settings
- See Also:
-
initWorkplaceSettings
public static CmsWorkplaceSettings initWorkplaceSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) Updates the given workplace settings, also re-initializing the state of the Workplace to the users preferences (for example setting the startup site and project). The user settings will also be updated by calling
before updating the workplace project, selected site etc.initUserSettings(CmsObject, CmsWorkplaceSettings, boolean)
- Parameters:
cms
- the cms object for the current usersettings
- the workplace settings to update (ifnull
a new instance is created)update
- flag indicating if settings are only updated (user preferences)- Returns:
- the current users initialized workplace settings
- See Also:
-
isTemporaryFile
Returnstrue
if the given resource is a temporary file.A resource is considered a temporary file it is a file where the
CmsResource.FLAG_TEMPFILE
flag has been set, or if the file name (without parent folders) starts with the prefix char'~'
(tilde).- Parameters:
resource
- the resource name to check- Returns:
true
if the given resource name is a temporary file- See Also:
-
substituteSiteTitleStatic
Substitutes the site title.- Parameters:
title
- the raw site titlelocale
- the localel- Returns:
- the locale specific site title
-
updateUserPreferences
Updates the user preferences after changes have been made.- Parameters:
cms
- the current cms contextreq
- the current http request
-
allParamsAsHidden
Returns all parameters of the current workplace class as hidden field tags that can be inserted in a form.- Returns:
- all parameters of the current workplace class as hidden field tags that can be inserted in a html form
-
allParamsAsRequest
Returns all present request parameters as String.The String is formatted as a parameter String (
param1=val1¶m2=val2
) with UTF-8 encoded values.- Returns:
- all present request parameters as String
-
bodyEnd
Builds the end html of the body.- Returns:
- the end html of the body
-
bodyStart
Builds the start html of the body.- Parameters:
className
- optional class attribute to add to the body tag- Returns:
- the start html of the body
-
bodyStart
Builds the start html of the body.- Parameters:
className
- optional class attribute to add to the body tagparameters
- optional parameters to add to the body tag- Returns:
- the start html of the body
-
buildSelect
public String buildSelect(String parameters, List<String> options, List<String> values, int selected) Generates a html select box out of the provided values.- Parameters:
parameters
- a string that will be inserted into the initial select tag, if null no parameters will be insertedoptions
- the optionsvalues
- the option values, if null the select will have no value attributesselected
- the index of the pre-selected option, if -1 no option is pre-selected- Returns:
- a formatted html String representing a html select box
-
button
Generates a button for the OpenCms workplace.- Parameters:
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 only- Returns:
- a button for the OpenCms workplace
-
button
public String button(String href, String target, String image, String label, int type, String imagePath) Generates a button for the OpenCms workplace.- Parameters:
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 onlyimagePath
- the path to the image- Returns:
- a button for the OpenCms workplace
-
buttonBar
Returns the html for a button bar.- Parameters:
segment
- the HTML segment (START / END)- Returns:
- a button bar html start / end segment
-
buttonBar
Returns the html for a button bar.- Parameters:
segment
- the HTML segment (START / END)attributes
- optional attributes for the table tag- Returns:
- a button bar html start / end segment
-
buttonBarHorizontalLine
Generates a horizontal button bar separator line with maximum width.- Returns:
- a horizontal button bar separator line
-
buttonBarLabel
Generates a button bar label.- Parameters:
label
- the label to show- Returns:
- a button bar label
-
buttonBarLabel
Generates a button bar label.- Parameters:
label
- the label to showclassName
- the css class name for the formatting- Returns:
- a button bar label
-
buttonBarLine
Generates a variable button bar separator line.- Parameters:
leftPixel
- the amount of pixel left to the linerightPixel
- the amount of pixel right to the lineclassName
- the css class name for the formatting- Returns:
- a variable button bar separator line
-
buttonBarLineSpacer
Generates a variable button bar separator line spacer.- Parameters:
pixel
- the amount of pixel space- Returns:
- a variable button bar separator line spacer
-
buttonBarSeparator
Generates a button bar separator.- Parameters:
leftPixel
- the amount of pixel left to the separatorrightPixel
- the amount of pixel right to the separator- Returns:
- a button bar separator
-
buttonBarSpacer
Returns the html for an invisible spacer between button bar contents like buttons, labels, etc.- Parameters:
width
- the width of the invisible spacer- Returns:
- the html for the invisible spacer
-
buttonBarStartTab
Generates a button bar starter tab.- Parameters:
leftPixel
- the amount of pixel left to the starterrightPixel
- the amount of pixel right to the starter- Returns:
- a button bar starter tab
-
checkLock
Checks the lock state of the resource and locks it if the autolock feature is enabled.- Parameters:
resource
- the resource name which is checked- Throws:
CmsException
- if reading or locking the resource fails
-
checkLock
Checks the lock state of the resource and locks it if the autolock feature is enabled.- Parameters:
resource
- the resource name which is checkedtype
- indicates the modeCmsLockType.EXCLUSIVE
orCmsLockType.TEMPORARY
- Throws:
CmsException
- if reading or locking the resource fails
-
fillParamValues
public void fillParamValues(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) First sets site and project in the workplace settings, then fills all class parameter values from the data provided in the current request.- Parameters:
settings
- the workplace settingsrequest
- the current request
-
fillParamValues
Fills all class parameter values from the data provided in the current request.All methods that start with "setParam" are possible candidates to be automatically filled. The remaining part of the method name is converted to lower case. Then a parameter of this name is searched in the request parameters. If the parameter is found, the "setParam" method is automatically invoked by reflection with the value of the parameter.
- Parameters:
request
- the current JSP request
-
getBroadcastMessageString
Returns the message String for the broadcast message alert of the workplace.Caution: returns the pure message String (not escaped) or null, if no message is pending.
- Returns:
- the message String for the broadcast message alert of the workplace
-
getCms
Returns the initialized cms object for the current user.- Returns:
- the initialized cms object for the current user
-
getEncoding
Returns the current workplace encoding.- Returns:
- the current workplace encoding
-
getExplorerFileListFullUri
Returns the uri (including context path) to the explorer file list.- Returns:
- the uri (including context path) to the explorer file list
-
getFrameSource
Returns the html for the frame name and source and stores this information in the workplace settings.- Parameters:
frameName
- the name of the frameuri
- the absolute path of the frame- Returns:
- the html for the frame name and source
-
getJsp
Returns the JSP action element.- Returns:
- the JSP action element
-
getLocale
Returns the current users workplace locale settings.- Returns:
- the current users workplace locale setting
-
getMacroResolver
Returns the current used macro resolver instance.- Returns:
- the macro resolver
-
getMessages
Returns the current used message object.- Returns:
- the current used message object
-
getMultiPartFileItems
Returns a list of FileItem instances parsed from the request, in the order that they were transmitted.This list is automatically initialized from the createParameterMapFromMultiPart(HttpServletRequest) method.
- Returns:
- list of FileItem instances parsed from the request, in the order that they were transmitted
-
getResourceUri
Returns the path to the workplace static resources.Workplaces static resources are images, css files etc. These are exported during the installation of OpenCms, and are usually only read from this exported location to avoid the overhaead of accessing the database later.
- Returns:
- the path to the workplace static resources
-
getSession
Returns the current user http session.- Returns:
- the current user http session
-
getSettings
Returns the current users workplace settings.- Returns:
- the current users workplace settings
-
getStyleUri
Returns the path to the cascading stylesheets.- Parameters:
filename
- the name of the stylesheet- Returns:
- the path to the cascading stylesheets
-
htmlEnd
Builds the end html of the page.- Returns:
- the end html of the page
-
htmlStart
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.- Parameters:
title
- the content for the title tag- Returns:
- the start html of the page
-
initSettings
public boolean initSettings(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) Sets site and project in the workplace settings with the request values of parameters
andPARAM_WP_SITE
.PARAM_WP_PROJECT
- Parameters:
settings
- the workplace settingsrequest
- the current request- Returns:
- true, if a reload of the main body frame is required
-
isForwarded
Returns the forwarded flag.- Returns:
- the forwarded flag
-
isHelpEnabled
Returns true if the online help for the users current workplace language is installed.- Returns:
- true if the online help for the users current workplace language is installed
-
isSubElement
Returns true if the currently processed element is an included sub element.- Returns:
- true if the currently processed element is an included sub element
-
key
Returns the localized resource string for a given message key, checking the workplace default resources and all module bundles.If the key was not found, the return value is
"??? " + keyName + " ???"
.If the key starts with
"help."
and is not found, the value"index.html"
is returned.- Parameters:
keyName
- the key for the desired string- Returns:
- the resource string for the given key
- See Also:
-
key
Returns the localized resource string for a given message key, with the provided replacement parameters.If the key was found in the bundle, it will be formatted using a
using the provided parameters.MessageFormat
If the key was not found in the bundle, the return value is
"??? " + keyName + " ???"
. This will also be returned if the bundle was not properly initialized first.- Parameters:
keyName
- the key for the desired stringparams
- the parameters to use for formatting- Returns:
- the resource string for the given key
- See Also:
-
keyDefault
Returns the localized resource string for the given message key, checking the workplace default resources and all module bundles.If the key was not found, the provided default value is returned.
- Parameters:
keyName
- the key for the desired stringdefaultValue
- the default value in case the key does not exist in the bundle- Returns:
- the resource string for the given key it it exists, or the given default if not
- See Also:
-
nullToEmpty
Returns the empty String "" if the provided value is null, otherwise just returns the provided value.Use this method in forms if a getParamXXX method is used, but a String (not null) is required.
- Parameters:
value
- the String to check- Returns:
- the empty String "" if the provided value is null, otherwise just returns the provided value
-
pageBody
Builds the html of the body.- Parameters:
segment
- the HTML segment (START / END)className
- optional class attribute to add to the body tagparameters
- optional parameters to add to the body tag- Returns:
- the html of the body
-
pageHtml
Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type.- Parameters:
segment
- the HTML segment (START / END)title
- the title of the page, if null no title tag is inserted- Returns:
- the default html for a workplace page
-
pageHtmlStyle
Returns the default html for a workplace page, including setting of DOCTYPE and inserting a header with the content-type, allowing the selection of an individual style sheet.- Parameters:
segment
- the HTML segment (START / END)title
- the title of the page, if null no title tag is insertedstylesheet
- the used style sheet, if null the default stylesheet 'workplace.css' is inserted- Returns:
- the default html for a workplace page
-
paramsAsHidden
Returns all initialized parameters of the current workplace class as hidden field tags that can be inserted in a form.- Returns:
- all initialized parameters of the current workplace class as hidden field tags that can be inserted in a html form
-
paramsAsHidden
Returns all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form.- Parameters:
excludes
- the parameters to exclude- Returns:
- all initialized parameters of the current workplace class that are not in the given exclusion list as hidden field tags that can be inserted in a form
-
paramsAsParameterMap
Returns all initialized parameters of the current workplace class in the form of a parameter map, i.e. the values are arrays.- Returns:
- all initialized parameters of the current workplace class in the form of a parameter map
-
paramsAsRequest
Returns all initialized parameters of the current workplace class as request parameters, i.e. in the formkey1=value1&key2=value2
etc.- Returns:
- all initialized parameters of the current workplace class as request parameters
-
resolveMacros
Resolves the macros in the given String and replaces them by their localized keys.The following macro contexts are available in the Workplace:
- Macros based on the current users OpenCms context (obtained from the current
).CmsObject
- Localized key macros (obtained from the current
).CmsMessages
- Macros from the current JSP page context (obtained by
).getJsp()
- Parameters:
input
- the input String containing the macros- Returns:
- the resolved String
- See Also:
- Macros based on the current users OpenCms context (obtained from the current
-
sendCmsRedirect
Sends a http redirect to the specified URI in the OpenCms VFS.- Parameters:
location
- the location the response is redirected to- Throws:
IOException
- in case redirection fails
-
sendForward
public void sendForward(String location, Map<String, String[]> params) throws IOException, javax.servlet.ServletExceptionForwards to the specified location in the OpenCms VFS.- Parameters:
location
- the location the response is redirected toparams
- the map of parameters to use for the forwarded request- Throws:
IOException
- in case the forward failsjavax.servlet.ServletException
- in case the forward fails
-
setForwarded
Sets the forwarded flag.- Parameters:
forwarded
- the forwarded flag to set
-
shortKey
Get a localized short key value for the workplace.- Parameters:
keyName
- name of the key- Returns:
- a localized short key value
-
addMessages
Auxiliary method for initialization of messages.- Parameters:
messages
- theCmsMessages
to add
-
addMessages
Auxiliary method for initialization of messages.- Parameters:
bundleName
- the resource bundle name to add
-
allParamValues
Returns the values of all parameter methods of this workplace class instance.- Returns:
- the values of all parameter methods of this workplace class instance
-
checkRole
Checks that the current user is a workplace user.- Throws:
CmsRoleViolationException
- if the user does not have the required role
-
decodeParamValue
Decodes an individual parameter value.In special cases some parameters might require a different-from-default encoding. This is the case if the content of the parameter was encoded using the JavaScript encodeURIComponent() method on the client, which always encodes in UTF-8.
- Parameters:
paramName
- the name of the parameterparamValue
- the unencoded value of the parameter- Returns:
- the encoded value of the parameter
-
getParameterMap
Returns the map of parameters read from the current request.This method will also handle parameters from forms of type
multipart/form-data
.- Returns:
- the map of parameters read from the current request
-
initMessages
Initializes the message object.By default the
CmsWorkplaceMessages
are initialized.You SHOULD override this method for setting the bundles you really need, using the
oraddMessages(CmsMessages)
method.addMessages(String)
-
initTimeWarp
Sets the users time warp if configured and if the current timewarp setting is different or clears the current time warp setting if the user has no configured timewarp.Timwarping is controlled by the session attribute
CmsContextInfo.ATTRIBUTE_REQUEST_TIME
with a value of typeLong
.- Parameters:
settings
- the user settings which are configured via the preferences dialogsession
- the session of the user
-
initWorkplaceMembers
Initializes this workplace class instance.This method can be used in case there a workplace class was generated using
Class.forName(java.lang.String)
to initialize the class members.- Parameters:
jsp
- the initialized JSP context
-
initWorkplaceMembers
Initializes this workplace class instance.- Parameters:
cms
- the user contextsession
- the session
-
initWorkplaceRequestValues
protected abstract void initWorkplaceRequestValues(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) Analyzes the request for workplace parameters and adjusts the workplace settings accordingly.- Parameters:
settings
- the workplace settingsrequest
- the current request
-
paramValues
Returns the values of all parameter methods of this workplace class instance.- Returns:
- the values of all parameter methods of this workplace class instance
-
substituteSiteTitle
Replaces the site title, if necessary.- Parameters:
title
- the site title- Returns:
- the new site title
-
switchToCurrentProject
Helper method to change back from the temporary project to the current project.- Throws:
CmsException
- if switching back fails
-
switchToTempProject
Helper method to change the current project to the temporary file project.The id of the old project is stored in a member variable to switch back.
- Returns:
- the id of the tempfileproject
- Throws:
CmsException
- if getting the tempfileproject id fails
-