⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmsdialog.java

📁 OpenCms 是一个J2EE的产品
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        return dialog(HTML_START, attributes);
    }

    /**
     * Builds a subheadline in the dialog content area.<p>
     * 
     * @param headline the desired headline string
     * @return a subheadline element
     */
    public String dialogSubheadline(String headline) {

        StringBuffer retValue = new StringBuffer(128);
        retValue.append("<div class=\"dialogsubheader\" unselectable=\"on\">");
        retValue.append(headline);
        retValue.append("</div>\n");
        return retValue.toString();
    }

    /**
     * Builds the HTML code to fold and unfild a white-box.<p>
     * 
     * @param headline the heading to display
     * @param id the id of the toggle
     * @param show true if the white box is open at the beginning
     * 
     * @return HTML code to fold and unfild a white-box
     */
    public String dialogToggleStart(String headline, String id, boolean show) {

        StringBuffer result = new StringBuffer(512);
        // set icon and style class to use: hide user permissions
        String image = "plus.png";
        String styleClass = "hide";
        if (show) {
            // show user permissions
            image = "minus.png";
            styleClass = "show";
        }

        result.append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n");
        result.append("<tr>\n");
        result.append("\t<td style=\"vertical-align: bottom; padding-bottom: 2px;\"><a href=\"javascript:toggleDetail('");
        result.append(id);
        result.append("');\"><img src=\"");
        result.append(getSkinUri());
        result.append("commons/");
        result.append(image);
        result.append("\" class=\"noborder\" id=\"ic-");
        result.append(id);
        result.append("\"></a></td>\n");
        result.append("\t<td>");
        result.append(dialogSubheadline(headline));
        result.append("</td>\n");
        result.append("</tr>\n");
        result.append("</table>\n");

        result.append("<div class=\"");
        result.append(styleClass);
        result.append("\" id=\"");
        result.append(id);
        result.append("\">\n");
        return result.toString();
    }

    /**
     * Builds a white box in the dialog content area.<p>
     * 
     * @param segment the HTML segment (START / END)
     * @return the white box start / end segment
     */
    public String dialogWhiteBox(int segment) {

        if (segment == HTML_START) {
            return "<!-- white box start -->\n"
                + "<div class=\"dialoginnerboxborder\">\n"
                + "<div class=\"dialoginnerbox\" unselectable=\"off\">\n";
        } else {
            return "</div>\n</div>\n<!-- white box end -->\n";
        }
    }

    /**
     * Builds the end of a white box in the dialog content area.<p>
     * 
     * @return the white box end segment
     */
    public String dialogWhiteBoxEnd() {

        return dialogWhiteBox(HTML_END);
    }

    /**
     * Builds the start of a white box in the dialog content area.<p>
     * 
     * @return the white box start segment
     */
    public String dialogWhiteBoxStart() {

        return dialogWhiteBox(HTML_START);
    }

    /**
     * Returns the action value.<p>
     * 
     * The action value is used on JSP pages to select the proper action 
     * in a large "switch" statement.<p>
     * 
     * @return the action value
     */
    public int getAction() {

        return m_action;
    }

    /**
     * Returns the action to be carried out after a click on the cancel button..<p>
     * 
     * @return the action to be carried out after a click on the cancel button.
     */
    public String getCancelAction() {

        return DIALOG_CANCEL;
    }

    /**
     * Returns the http URI of the current dialog, to be used
     * as value for the "action" attribute of a html form.<p>
     *
     * This URI is the real one.<p>
     *  
     * @return the http URI of the current dialog
     */
    public String getDialogRealUri() {

        return getJsp().link(getJsp().getRequestContext().getUri());
    }

    /**
     * Returns the http URI of the current dialog, to be used
     * as value for the "action" attribute of a html form.<p>
     *
     * This URI could not be really the real one... <p>
     *  
     * @return the http URI of the current dialog
     */
    public String getDialogUri() {

        if (!useNewStyle()) {
            return getDialogRealUri();
        } else {
            return CmsToolManager.linkForToolPath(getJsp(), getCurrentToolPath());
        }
    }

    /**
     * Returns the custom mapping for the online help.<p>
     * 
     * @return the custom mapping for the online help
     */
    public String getOnlineHelpUriCustom() {

        if (m_onlineHelpUriCustom == null) {
            return null;
        }
        StringBuffer result = new StringBuffer(m_onlineHelpUriCustom.length() + 4);
        result.append("\"");
        result.append(m_onlineHelpUriCustom);
        result.append("\"");
        return result.toString();
    }

    /**
     * Returns the value of the action parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * The action parameter is very important, 
     * it will select the dialog action to perform.
     * The value of the {@link #getAction()} method will be
     * initialized from the action parameter.<p>
     * 
     * @return the value of the action parameter
     */
    public String getParamAction() {

        return m_paramAction;
    }

    /**
     * Returns the value of the closelink parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * @return the value of the closelink parameter
     */
    public String getParamCloseLink() {

        if ((m_paramCloseLink == null) || "null".equals(m_paramCloseLink)) {
            return null;
        }
        return m_paramCloseLink;
    }

    /**
     * Returns the value of the dialogtype parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * This parameter is very important. 
     * It must match to the localization keys,
     * e.g. "copy" for the copy dialog.<p>
     * 
     * This parameter must be set manually by the subclass during 
     * first initialization.<p> 
     * 
     * @return the value of the dialogtype parameter
     */
    public String getParamDialogtype() {

        return m_paramDialogtype;
    }

    /**
     * Returns the value of the frame name parameter.<p>
     * 
     * @return the value of the errorstack parameter
     */
    public String getParamFramename() {

        if (m_paramFrameName != null && !"null".equals(m_paramFrameName)) {
            return m_paramFrameName;
        } else {
            return null;
        }
    }

    /**
     * Returns the ispopup parameter.<p>
     * 
     * Use this parameter to indicate that the dialog is shown in a popup window.<p>
     * 
     * @return the ispopup parameter
     */
    public String getParamIsPopup() {

        return m_paramIsPopup;
    }

    /**
     * Returns the value of the message parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * The message parameter is used on dialogs to 
     * show any text message.<p>
     * 
     * @return the value of the message parameter
     */
    public String getParamMessage() {

        return m_paramMessage;
    }

    /**
     * Returns the value of the redirect flag parameter.<p>
     * 
     * @return the value of the redirect flag parameter
     */
    public String getParamRedirect() {

        return m_paramRedirect;
    }

    /**
     * Returns the value of the file parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * The file parameter selects the file on which the dialog action
     * is to be performed.<p>
     * 
     * @return the value of the file parameter
     */
    public String getParamResource() {

        if (m_paramResource != null && !"null".equals(m_paramResource)) {
            return m_paramResource;
        } else {
            return null;
        }
    }

    /**
     * Returns the value of the title parameter, 
     * or null if this parameter was not provided.<p>
     * 
     * 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.<p>
     * 
     * @return the value of the title parameter
     */
    public String getParamTitle() {

        return m_paramTitle;
    }

    /**
     * Gets a formatted file state string.<p>
     * 
     * @return formatted state string
     * @throws CmsException if something goes wrong
     */
    public String getState() throws CmsException {

        if (CmsStringUtil.isNotEmpty(getParamResource())) {
            CmsResource file = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
            if (getCms().isInsideCurrentProject(getParamResource())) {
                return key(Messages.getStateKey(file.getState()));
            } else {
                return key(Messages.GUI_EXPLORER_STATENIP_0);
            }
        }
        return "+++ resource parameter not found +++";
    }

    /**
     * Builds the start html of the page, including setting of DOCTYPE and 
     * inserting a header with the content-type.<p>
     * 
     * @return the start html of the page
     */
    public String htmlStart() {

        return pageHtml(HTML_START, null);
    }

    /**
     * Builds the start html of the page, including setting of DOCTYPE and 
     * inserting a header with the content-type.<p>
     * 
     * This overloads the default method of the parent class.<p>
     * 
     * @param helpUrl the key for the online help to include on the page
     * @return the start html of the page
     */
    public String htmlStart(String helpUrl) {

        return pageHtml(HTML_START, helpUrl);
    }

    /**
     * Builds the start html of the page, including setting of DOCTYPE and 
     * inserting a header with the content-type.<p>
     * 
     * @param helpUrl the key for the online help to include on the page
     * @param title the title for the page
     * @return the start html of the page
     */
    public String htmlStart(String helpUrl, String title) {

        return pageHtml(HTML_START, helpUrl, title);
    }

    /**
     * Builds the start html of the page, including setting of DOCTYPE, 
     * inserting a header with the content-type and choosing an individual style sheet.<p>
     * 
     * @param title the title for the page
     * @param stylesheet the style sheet to include
     * @return the start html of the page
     */
    public String htmlStartStyle(String title, String stylesheet) {

        return pageHtmlStyle(HTML_START, title, stylesheet);
    }

    /**
     * Displays the throwable on the error page and logs the error.<p>
     * 
     * @param wp the workplace class
     * @param t the throwable to be displayed on the errorpage
     * @throws JspException if the include of the errorpage jsp fails
     */
    public void includeErrorpage(CmsWorkplace wp, Throwable t) throws JspException {

        CmsLog.getLog(wp).error(Messages.get().getBundle().key(Messages.ERR_WORKPLACE_DIALOG_0), t);
        getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, wp);
        getJsp().getRequest().setAttribute(ATTRIBUTE_THROWABLE, t);
        getJsp().include(FILE_DIALOG_SCREEN_ERRORPAGE);
    }

    /**
     * Returns the "isPopup" flag.<p>
     *
     * @return the "isPopup" flag
     */
    public boolean isPopup() {

        return Boolean.valueOf(getParamIsPopup()).booleanValue();
    }

    /**
     * Builds the start html of the page, including setting of DOCTYPE and 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -