Class CmsDialog

    • Constructor Detail

      • CmsDialog

        public CmsDialog​(CmsJspActionElement jsp)
        Public constructor with JSP action element.

        Parameters:
        jsp - an initialized JSP action element
      • CmsDialog

        public CmsDialog​(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 context
        req - the JSP request
        res - the JSP response
    • Method Detail

      • initCmsDialog

        public static CmsDialog initCmsDialog​(javax.servlet.jsp.PageContext context,
                                              javax.servlet.http.HttpServletRequest req,
                                              javax.servlet.http.HttpServletResponse res)
        Returns an initialized CmsDialog instance that is read from the request attributes.

        This method is used by dialog elements. The dialog elements do not initialize their own workplace class, but use the initialized instance of the "master" class. This is required to ensure that parameters of the "master" class can properly be kept on the dialog elements.

        To prevent null pointer exceptions, an empty dialog is returned if nothing is found in the request attributes.

        Parameters:
        context - the JSP page context
        req - the JSP request
        res - the JSP response
        Returns:
        an initialized CmsDialog instance that is read from the request attributes
      • actionCloseDialog

        public void actionCloseDialog()
                               throws javax.servlet.jsp.JspException
        Used to close the current JSP dialog.

        This method tries to include the URI stored in the workplace settings. This URI is determined by the frame name, which has to be set in the frame name parameter.

        Throws:
        javax.servlet.jsp.JspException - if including an element fails
      • buildAjaxResultContainer

        public java.lang.String buildAjaxResultContainer​(java.lang.String title)
        Returns the html code to build the ajax report container.

        Parameters:
        title - the title of the report box
        Returns:
        html code
      • buildLockAdditionalOptions

        public java.lang.String buildLockAdditionalOptions()
        Override to display additional options in the lock dialog.

        Returns:
        html code to display additional options
      • buildLockConfirmationMessageJS

        public java.lang.String buildLockConfirmationMessageJS()
        Returns the html code to build the confirmation messages.

        Returns:
        html code
      • dialog

        public java.lang.String dialog​(int segment,
                                       java.lang.String attributes)
        Builds the outer dialog window border.

        Parameters:
        segment - the HTML segment (START / END)
        attributes - optional additional attributes for the opening dialog table
        Returns:
        a dialog window start / end segment
      • dialogBlock

        public java.lang.String dialogBlock​(int segment,
                                            java.lang.String headline,
                                            boolean error)
        Builds a block with 3D border and optional subheadline in the dialog content area.

        Parameters:
        segment - the HTML segment (START / END)
        headline - the headline String for the block
        error - if true, an error block will be created
        Returns:
        3D block start / end segment
      • dialogBlockEnd

        public java.lang.String dialogBlockEnd()
        Builds the end HTML for a block with 3D border in the dialog content area.

        Returns:
        3D block start / end segment
      • dialogBlockStart

        public java.lang.String dialogBlockStart​(java.lang.String headline)
        Builds the start HTML for a block with 3D border and optional subheadline in the dialog content area.

        Parameters:
        headline - the headline String for the block
        Returns:
        3D block start / end segment
      • dialogButtonRow

        public java.lang.String dialogButtonRow​(int segment)
        Builds the button row under the dialog content area without the buttons.

        Parameters:
        segment - the HTML segment (START / END)
        Returns:
        the button row start / end segment
      • dialogButtonRowEnd

        public java.lang.String dialogButtonRowEnd()
        Builds the end of the button row under the dialog content area without the buttons.

        Returns:
        the button row end segment
      • dialogButtonRowStart

        public java.lang.String dialogButtonRowStart()
        Builds the start of the button row under the dialog content area without the buttons.

        Returns:
        the button row start segment
      • dialogButtons

        public java.lang.String dialogButtons​(int[] buttons,
                                              java.lang.String[] attributes)
        Builds the html for the button row under the dialog content area, including buttons.

        Parameters:
        buttons - array of constants of which buttons to include in the row
        attributes - array of Strings for additional button attributes
        Returns:
        the html for the button row under the dialog content area, including buttons
      • dialogButtonsClose

        public java.lang.String dialogButtonsClose()
        Builds a button row with a single "close" button.

        Returns:
        the button row
      • dialogButtonsClose

        public java.lang.String dialogButtonsClose​(java.lang.String closeAttribute)
        Builds a button row with a single "close" button.

        Parameters:
        closeAttribute - additional attributes for the "close" button
        Returns:
        the button row
      • dialogButtonsCloseDetails

        public java.lang.String dialogButtonsCloseDetails​(java.lang.String closeAttribute,
                                                          java.lang.String detailsAttribute)
        Builds a button row with a "close" and a "details" button.

        Parameters:
        closeAttribute - additional attributes for the "close" button
        detailsAttribute - additional attributes for the "details" button
        Returns:
        the button row
      • dialogButtonsOk

        public java.lang.String dialogButtonsOk()
        Builds a button row with a single "ok" button.

        Returns:
        the button row
      • dialogButtonsOk

        public java.lang.String dialogButtonsOk​(java.lang.String okAttribute)
        Builds a button row with a single "ok" button.

        Parameters:
        okAttribute - additional attributes for the "ok" button
        Returns:
        the button row
      • dialogButtonsOkCancel

        public java.lang.String dialogButtonsOkCancel()
        Builds a button row with an "ok" and a "cancel" button.

        Returns:
        the button row
      • dialogButtonsOkCancel

        public java.lang.String dialogButtonsOkCancel​(java.lang.String okAttributes,
                                                      java.lang.String cancelAttributes)
        Builds a button row with an "ok" and a "cancel" button.

        Parameters:
        okAttributes - additional attributes for the "ok" button
        cancelAttributes - additional attributes for the "cancel" button
        Returns:
        the button row
      • dialogButtonsOkCancelAdvanced

        public java.lang.String dialogButtonsOkCancelAdvanced​(java.lang.String okAttributes,
                                                              java.lang.String cancelAttributes,
                                                              java.lang.String advancedAttributes)
        Builds a button row with an "ok", a "cancel" and an "advanced" button.

        Parameters:
        okAttributes - additional attributes for the "ok" button
        cancelAttributes - additional attributes for the "cancel" button
        advancedAttributes - additional attributes for the "advanced" button
        Returns:
        the button row
      • dialogButtonsSetOkCancel

        public java.lang.String dialogButtonsSetOkCancel​(java.lang.String setAttributes,
                                                         java.lang.String okAttributes,
                                                         java.lang.String cancelAttributes)
        Builds a button row with a "set", an "ok", and a "cancel" button.

        Parameters:
        setAttributes - additional attributes for the "set" button
        okAttributes - additional attributes for the "ok" button
        cancelAttributes - additional attributes for the "cancel" button
        Returns:
        the button row
      • dialogContent

        public java.lang.String dialogContent​(int segment,
                                              java.lang.String title)
        Builds the content area of the dialog window.

        Parameters:
        segment - the HTML segment (START / END)
        title - the title String for the dialog window
        Returns:
        a content area start / end segment
      • dialogContentEnd

        public java.lang.String dialogContentEnd()
        Returns the end html for the content area of the dialog window.

        Returns:
        the end html for the content area of the dialog window
      • dialogContentStart

        public java.lang.String dialogContentStart​(java.lang.String title)
        Returns the start html for the content area of the dialog window.

        Parameters:
        title - the title for the dialog
        Returns:
        the start html for the content area of the dialog window
      • dialogEnd

        public java.lang.String dialogEnd()
        Returns the end html for the outer dialog window border.

        Returns:
        the end html for the outer dialog window border
      • dialogHead

        public java.lang.String dialogHead​(java.lang.String title)
        Builds the title of the dialog window.

        Parameters:
        title - the title String for the dialog window
        Returns:
        the HTML title String for the dialog window
      • dialogHorizontalSpacer

        public java.lang.String dialogHorizontalSpacer​(int width)
        Builds an invisible horizontal spacer with the specified width.

        Parameters:
        width - the width of the spacer in pixels
        Returns:
        an invisible horizontal spacer with the specified width
      • dialogLockButtons

        public java.lang.String dialogLockButtons()
        Builds the necessary button row.

        Returns:
        the button row
      • dialogRow

        public java.lang.String dialogRow​(int segment)
        Builds a dialog line without break (display: block).

        Parameters:
        segment - the HTML segment (START / END)
        Returns:
        a row start / end segment
      • dialogRowEnd

        public java.lang.String dialogRowEnd()
        Builds the end of a dialog line without break (display: block).

        Returns:
        the row end segment
      • dialogRowStart

        public java.lang.String dialogRowStart()
        Builds the start of a dialog line without break (display: block).

        Returns:
        the row start segment
      • dialogSeparator

        public java.lang.String dialogSeparator()
        Builds a horizontal separator line in the dialog content area.

        Returns:
        a separator element
      • dialogSpacer

        public java.lang.String dialogSpacer()
        Builds a space between two elements in the dialog content area.

        Returns:
        a space element
      • dialogStart

        public java.lang.String dialogStart()
        Returns the start html for the outer dialog window border.

        Returns:
        the start html for the outer dialog window border
      • dialogStart

        public java.lang.String dialogStart​(java.lang.String attributes)
        Returns the start html for the outer dialog window border.

        Parameters:
        attributes - optional html attributes to insert
        Returns:
        the start html for the outer dialog window border
      • dialogSubheadline

        public java.lang.String dialogSubheadline​(java.lang.String headline)
        Builds a subheadline in the dialog content area.

        Parameters:
        headline - the desired headline string
        Returns:
        a subheadline element
      • dialogToggleStart

        public java.lang.String dialogToggleStart​(java.lang.String headline,
                                                  java.lang.String id,
                                                  boolean show)
        Builds the HTML code to fold and unfold a white-box.

        Parameters:
        headline - the heading to display
        id - the id of the toggle
        show - true if the white box is open at the beginning
        Returns:
        HTML code to fold and unfold a white-box
      • dialogWhiteBox

        public java.lang.String dialogWhiteBox​(int segment)
        Builds a white box in the dialog content area.

        Parameters:
        segment - the HTML segment (START / END)
        Returns:
        the white box start / end segment
      • dialogWhiteBoxEnd

        public java.lang.String dialogWhiteBoxEnd()
        Builds the end of a white box in the dialog content area.

        Returns:
        the white box end segment
      • dialogWhiteBoxStart

        public java.lang.String dialogWhiteBoxStart()
        Builds the start of a white box in the dialog content area.

        Returns:
        the white box start segment
      • getAction

        public int getAction()
        Returns the action value.

        The action value is used on JSP pages to select the proper action in a large "switch" statement.

        Returns:
        the action value
      • getCancelAction

        public java.lang.String getCancelAction()
        Returns the action to be carried out after a click on the cancel button..

        Returns:
        the action to be carried out after a click on the cancel button.
      • getDialogRealUri

        public java.lang.String getDialogRealUri()
        Returns the http URI of the current dialog, to be used as value for the "action" attribute of a html form.

        This URI is the real one.

        Returns:
        the http URI of the current dialog
      • getDialogUri

        public java.lang.String getDialogUri()
        Returns the http URI of the current dialog, to be used as value for the "action" attribute of a html form.

        This URI could not be really the real one...

        Returns:
        the http URI of the current dialog
      • getOnlineHelpUriCustom

        public java.lang.String getOnlineHelpUriCustom()
        Returns the custom mapping for the online help.

        Returns:
        the custom mapping for the online help
      • getParamAction

        public java.lang.String getParamAction()
        Returns the value of the action parameter, or null if this parameter was not provided.

        The action parameter is very important, it will select the dialog action to perform. The value of the getAction() method will be initialized from the action parameter.

        Returns:
        the value of the action parameter
      • getParamCloseLink

        public java.lang.String getParamCloseLink()
        Returns the value of the close link parameter, or null if this parameter was not provided.

        Returns:
        the value of the close link parameter
      • getParamDialogtype

        public java.lang.String getParamDialogtype()
        Returns the value of the dialog type parameter, or null if this parameter was not provided.

        This parameter is very important. It must match to the localization keys, e.g. "copy" for the copy dialog.

        This parameter must be set manually by the subclass during first initialization.

        Returns:
        the value of the dialog type parameter
      • getParamFramename

        public java.lang.String getParamFramename()
        Returns the value of the frame name parameter.

        Returns:
        the value of the frame name parameter
      • getParamIsPopup

        public java.lang.String getParamIsPopup()
        Returns the is popup parameter.

        Use this parameter to indicate that the dialog is shown in a popup window.

        Returns:
        the is popup parameter
      • getParamMessage

        public java.lang.String getParamMessage()
        Returns the value of the message parameter, or null if this parameter was not provided.

        The message parameter is used on dialogs to show any text message.

        Returns:
        the value of the message parameter
      • getParamOriginalParams

        public java.lang.String getParamOriginalParams()
        Returns the value of the original parameters parameter.

        This stores the request parameter values from a previous dialog, if necessary.

        Returns:
        the value of the original parameters parameter
      • getParamPreActionDone

        public java.lang.String getParamPreActionDone()
        Returns the value of the preaction done parameter.

        Returns:
        the value of the preaction done parameter
      • getParamRedirect

        public java.lang.String getParamRedirect()
        Returns the value of the redirect flag parameter.

        Returns:
        the value of the redirect flag parameter
      • getParamResource

        public java.lang.String getParamResource()
        Returns the value of the file parameter, or null if this parameter was not provided.

        The file parameter selects the file on which the dialog action is to be performed.

        Returns:
        the value of the file parameter
      • getParamTitle

        public java.lang.String getParamTitle()
        Returns the value of the title parameter, or null if this parameter was not provided.

        This parameter is used to build the title of the dialog. It is a parameter so that the title can be passed to included elements.

        Returns:
        the value of the title parameter
      • getState

        public java.lang.String getState()
                                  throws CmsException
        Gets a formatted file state string.

        Returns:
        formatted state string
        Throws:
        CmsException - if something goes wrong
      • hasCorrectLockstate

        public boolean hasCorrectLockstate()
        Checks if the current resource has lock state exclusive or inherited.

        This is used to determine whether the dialog shows the option to delete all siblings of the resource or not.

        Returns:
        true if lock state is exclusive or inherited, otherwise false
      • hasSiblings

        public boolean hasSiblings()
        Checks if this resource has siblings.

        Returns:
        true if this resource has siblings
      • htmlStart

        public java.lang.String htmlStart()
        Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.

        Returns:
        the start html of the page
      • htmlStart

        public java.lang.String htmlStart​(java.lang.String helpUrl)
        Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.

        This overloads the default method of the parent class.

        Overrides:
        htmlStart in class CmsWorkplace
        Parameters:
        helpUrl - the key for the online help to include on the page
        Returns:
        the start html of the page
      • htmlStart

        public java.lang.String htmlStart​(java.lang.String helpUrl,
                                          java.lang.String title)
        Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.

        Parameters:
        helpUrl - the key for the online help to include on the page
        title - the title for the page
        Returns:
        the start html of the page
      • htmlStartStyle

        public java.lang.String htmlStartStyle​(java.lang.String title,
                                               java.lang.String stylesheet)
        Builds the start html of the page, including setting of DOCTYPE, inserting a header with the content-type and choosing an individual style sheet.

        Parameters:
        title - the title for the page
        stylesheet - the style sheet to include
        Returns:
        the start html of the page
      • includeErrorpage

        public void includeErrorpage​(CmsWorkplace wp,
                                     java.lang.Throwable t)
                              throws javax.servlet.jsp.JspException
        Displays the throwable on the error page and logs the error.

        Parameters:
        wp - the workplace class
        t - the throwable to be displayed on the error page
        Throws:
        javax.servlet.jsp.JspException - if the include of the error page jsp fails
      • isPopup

        public boolean isPopup()
        Returns the "isPopup" flag.

        Returns:
        the "isPopup" flag
      • isPreEditor

        public boolean isPreEditor()
        Returns if the dialog is called in direct edit mode before the editor is opened.

        Returns:
        true if the dialog is called in direct edit mode before the editor is opened
      • pageHtml

        public java.lang.String pageHtml​(int segment,
                                         java.lang.String helpUrl)
        Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.

        This overloads the default method of the parent class.

        Overrides:
        pageHtml in class CmsWorkplace
        Parameters:
        segment - the HTML segment (START / END)
        helpUrl - the url for the online help to include on the page
        Returns:
        the start html of the page
      • pageHtml

        public java.lang.String pageHtml​(int segment,
                                         java.lang.String helpUrl,
                                         java.lang.String title)
        Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.

        This overloads the default method of the parent class.

        Parameters:
        segment - the HTML segment (START / END)
        helpUrl - the url for the online help to include on the page
        title - the title for the page
        Returns:
        the start html of the page
      • setParamAction

        public void setParamAction​(java.lang.String value)
        Sets the value of the action parameter.

        Parameters:
        value - the value to set
      • setParamCloseLink

        public void setParamCloseLink​(java.lang.String value)
        Sets the value of the close link parameter.

        Parameters:
        value - the value to set
      • setParamDialogtype

        public void setParamDialogtype​(java.lang.String value)
        Sets the value of the dialog type parameter.

        Parameters:
        value - the value to set
      • setParamFramename

        public void setParamFramename​(java.lang.String value)
        Sets the value of the frame name parameter.

        Parameters:
        value - the value to set
      • setParamIsPopup

        public void setParamIsPopup​(java.lang.String value)
        Sets the is popup parameter.

        Parameters:
        value - the is popup parameter value
      • setParamMessage

        public void setParamMessage​(java.lang.String value)
        Sets the value of the message parameter.

        Parameters:
        value - the value to set
      • setParamOriginalParams

        public void setParamOriginalParams​(java.lang.String paramOriginalParams)
        Sets the value of the original parameters parameter.

        Parameters:
        paramOriginalParams - the value of the original parameters parameter
      • setParamPreActionDone

        public void setParamPreActionDone​(java.lang.String paramPreActionDone)
        Sets the value of the preaction done parameter.

        Parameters:
        paramPreActionDone - the value of the preaction done parameter
      • setParamRedirect

        public void setParamRedirect​(java.lang.String redirect)
        Sets the value of the redirect flag parameter.

        Parameters:
        redirect - the value of the redirect flag parameter
      • setParamResource

        public void setParamResource​(java.lang.String value)
        Sets the value of the file parameter.

        Parameters:
        value - the value to set
      • setParamTitle

        public void setParamTitle​(java.lang.String value)
        Sets the value of the title parameter.

        Parameters:
        value - the value to set
      • appendDelimiter

        protected java.lang.String appendDelimiter​(java.lang.String attribute)
        Appends a space char. between tag attributes.

        Parameters:
        attribute - a tag attribute
        Returns:
        the tag attribute with a leading space char
      • buildAjaxWaitMessage

        protected java.lang.String buildAjaxWaitMessage()
        Returns ajax wait message.

        Returns:
        html code
      • checkResourcePermissions

        protected boolean checkResourcePermissions​(CmsPermissionSet required,
                                                   boolean neededForFolder)
        Checks if the permissions of the current user on the resource to use in the dialog are sufficient.

        Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.

        Parameters:
        required - the required permissions for the dialog
        neededForFolder - if true, the permissions are required for the parent folder of the resource (e.g. for editors)
        Returns:
        true if the permissions are sufficient, otherwise false
      • checkResourcePermissions

        protected boolean checkResourcePermissions​(CmsPermissionSet required,
                                                   boolean neededForFolder,
                                                   CmsMessageContainer errorMessage)
        Checks if the permissions of the current user on the resource to use in the dialog are sufficient.

        Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.

        Parameters:
        required - the required permissions for the dialog
        neededForFolder - if true, the permissions are required for the parent folder of the resource (e.g. for editors)
        errorMessage - the message container that is stored in the session in case the permissions are not sufficient
        Returns:
        true if the permissions are sufficient, otherwise false
      • computeCurrentFolder

        protected java.lang.String computeCurrentFolder()
        Returns the full path of the current workplace folder.

        Returns:
        the full path of the current workplace folder
      • dialogButtonsHtml

        protected void dialogButtonsHtml​(java.lang.StringBuffer result,
                                         int button,
                                         java.lang.String attribute)
        Renders the HTML for a single input button of a specified type.

        Parameters:
        result - a string buffer where the rendered HTML gets appended to
        button - a integer key to identify the button
        attribute - an optional string with possible tag attributes, or null
      • getAdministrationBackLink

        protected java.lang.String getAdministrationBackLink()
        Returns the link URL to get back one folder in the administration view.

        Returns:
        the link URL to get back one folder in the administration view
      • openLaunchpad

        protected void openLaunchpad()
                              throws javax.servlet.jsp.JspException
        Opens the launch pad view.

        Throws:
        javax.servlet.jsp.JspException - in case writing to the JSP output stream fails
      • openWorkplaceLink

        protected void openWorkplaceLink​(java.lang.String workplaceLink)
                                  throws java.io.IOException
        Opens a workplace UI link in the top frame.

        Parameters:
        workplaceLink - the workplace link to open
        Throws:
        java.io.IOException - in case writing to the JSP output stream fails
      • setAction

        protected void setAction​(int value)
        Sets the action value.

        Parameters:
        value - the action value