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

📄 cmsdialog.java

📁 找了很久才找到到源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                getJsp().include(frameUri, null, params);
            } else {
                // no URI found, include the explorer file list
                getJsp().include(FILE_EXPLORER_FILELIST, null, params);
            }
        } else {
            // no framename parameter found, include the explorer file list
            getJsp().include(FILE_EXPLORER_FILELIST, null, params);
        }
    }

    /**
     * Returns the html code to build the ajax report container.<p>
     * 
     * @param title the title of the report box
     * 
     * @return html code
     */
    public String buildAjaxResultContainer(String title) {

        StringBuffer html = new StringBuffer(512);
        html.append(dialogBlockStart(title));
        html.append(dialogWhiteBoxStart());
        html.append("<div id='ajaxreport' >");
        html.append(buildAjaxWaitMessage());
        html.append("</div>\n");
        html.append(dialogWhiteBoxEnd());
        html.append(dialogBlockEnd());
        html.append("&nbsp;<br>\n");
        return html.toString();
    }

    /**
     * Override to display additional options in the lock dialog.<p>
     * 
     * @return html code to display additional options
     */
    public String buildLockAdditionalOptions() {

        return "";
    }

    /**
     * Returns the html code to build the confirmation messages.<p>
     * 
     * @return html code
     */
    public String buildLockConfirmationMessageJS() {

        StringBuffer html = new StringBuffer(512);
        html.append("<script type='text/javascript'><!--\n");
        html.append("function setConfirmationMessage(locks, blockinglocks) {\n");
        html.append("\tvar confMsg = document.getElementById('conf-msg');\n");
        html.append("\tif (locks > -1) {\n");
        html.append("\t\tif (blockinglocks > '0') {\n");
        html.append("\t\t\tshowAjaxReportContent();\n");
        html.append("\t\t\tdocument.getElementById('lock-body-id').className = '';\n");
        html.append("\t\t\tdocument.getElementById('butClose').className = '';\n");
        html.append("\t\t\tdocument.getElementById('butContinue').className = 'hide';\n");
        html.append("\t\t\tconfMsg.innerHTML = '");
        html.append(key(org.opencms.workplace.commons.Messages.GUI_OPERATION_BLOCKING_LOCKS_0));
        html.append("';\n");
        html.append("\t\t} else {\n");
        html.append("\t\t\tsubmitAction('");
        html.append(CmsDialog.DIALOG_OK);
        html.append("', null, 'main');\n");
        html.append("\t\t\tdocument.forms['main'].submit();\n");
        html.append("\t\t}\n");
        html.append("\t} else {\n");
        html.append("\t\tdocument.getElementById('butClose').className = '';\n");
        html.append("\t\tdocument.getElementById('butContinue').className = 'hide';\n");
        html.append("\t\tconfMsg.innerHTML = '");
        html.append(key(Messages.GUI_AJAX_REPORT_WAIT_0));
        html.append("';\n");
        html.append("\t}\n");
        html.append("}\n");
        html.append("// -->\n");
        html.append("</script>\n");
        return html.toString();
    }

    /**
     * Returns the html code to build the lock dialog.<p>
     * 
     * @return html code
     * 
     * @throws CmsException if something goes wrong
     */
    public String buildLockDialog() throws CmsException {

        return buildLockDialog(null, null, 2000, false);
    }

    /**
     * Returns the html code to build the lock dialog.<p>
     * 
     * @param nonBlockingFilter the filter to get all non blocking locks
     * @param blockingFilter the filter to get all blocking locks
     * @param hiddenTimeout the maximal number of millis the dialog will be hidden
     * @param includeRelated indicates if the report should include related resources
     * 
     * @return html code
     * 
     * @throws CmsException if something goes wrong
     */
    public String buildLockDialog(
        CmsLockFilter nonBlockingFilter,
        CmsLockFilter blockingFilter,
        int hiddenTimeout,
        boolean includeRelated) throws CmsException {

        setParamAction(CmsDialog.DIALOG_LOCKS_CONFIRMED);
        CmsLock lockwp = new CmsLock(getJsp());
        lockwp.setBlockingFilter(blockingFilter);
        lockwp.setNonBlockingFilter(nonBlockingFilter);

        StringBuffer html = new StringBuffer(512);
        html.append(htmlStart("help.explorer.contextmenu.lock"));
        html.append(lockwp.buildIncludeJs());
        html.append(buildLockConfirmationMessageJS());
        html.append(bodyStart("dialog"));
        html.append("<div id='lock-body-id' class='hide'>\n");
        html.append(dialogStart());
        html.append(dialogContentStart(getParamTitle()));
        html.append(buildLockHeaderBox());
        html.append(dialogSpacer());
        html.append("<form name='main' action='");
        html.append(getDialogUri());
        html.append("' method='post' class='nomargin' onsubmit=\"return submitAction('");
        html.append(CmsDialog.DIALOG_OK);
        html.append("', null, 'main');\">\n");
        html.append(paramsAsHidden());
        html.append("<input type='hidden' name='");
        html.append(CmsDialog.PARAM_FRAMENAME);
        html.append("' value=''>\n");
        html.append(buildAjaxResultContainer(key(org.opencms.workplace.commons.Messages.GUI_LOCK_RESOURCES_TITLE_0)));
        html.append("<div id='conf-msg'></div>\n");
        html.append(buildLockAdditionalOptions());
        html.append(dialogContentEnd());
        html.append(dialogLockButtons());
        html.append("</form>\n");
        html.append(dialogEnd());
        html.append("</div>\n");
        html.append(bodyEnd());
        html.append(lockwp.buildLockRequest(hiddenTimeout, includeRelated));
        html.append(htmlEnd());
        return html.toString();
    }

    /**
     * Returns the html code to build the header box.<p>
     * 
     * @return html code
     * 
     * @throws CmsException if something goes wrong
     */
    public String buildLockHeaderBox() throws CmsException {

        StringBuffer html = new StringBuffer(512);
        // include resource info  
        html.append(dialogBlockStart(null));
        html.append(key(org.opencms.workplace.commons.Messages.GUI_LABEL_TITLE_0));
        html.append(": ");
        html.append(getJsp().property("Title", getParamResource(), ""));
        html.append("<br>\n");
        html.append(key(org.opencms.workplace.commons.Messages.GUI_LABEL_STATE_0));
        html.append(": ");
        html.append(getState());
        html.append("<br>\n");
        html.append(key(org.opencms.workplace.commons.Messages.GUI_LABEL_PERMALINK_0));
        html.append(": ");
        html.append(OpenCms.getLinkManager().getPermalink(getCms(), getParamResource()));
        html.append(dialogBlockEnd());
        return html.toString();
    }

    /**
     * Builds the outer dialog window border.<p>
     * 
     * @param segment the HTML segment (START / END)
     * @param attributes optional additional attributes for the opening dialog table
     * @return a dialog window start / end segment
     */
    public String dialog(int segment, String attributes) {

        if (segment == HTML_START) {
            StringBuffer html = new StringBuffer(512);
            if (useNewStyle()) {
                html.append(dialogTitle());
            }
            html.append("<table class=\"dialog\" cellpadding=\"0\" cellspacing=\"0\"");
            if (attributes != null) {
                html.append(" ");
                html.append(attributes);
            }
            html.append("><tr><td>\n<table class=\"dialogbox\" cellpadding=\"0\" cellspacing=\"0\">\n");
            html.append("<tr><td>\n");
            if (useNewStyle() && getToolManager().hasToolPathForUrl(getJsp().getRequestContext().getUri())) {
                html.append(getAdminTool().groupHtml(this));
            }
            return html.toString();
        } else {
            return "</td></tr></table>\n</td></tr></table>\n<p>&nbsp;</p>\n";
        }
    }

    /**
     * Builds a block with 3D border and optional subheadline in the dialog content area.<p>
     * 
     * @param segment the HTML segment (START / END)
     * @param headline the headline String for the block
     * @param error if true, an error block will be created
     * @return 3D block start / end segment
     */
    public String dialogBlock(int segment, String headline, boolean error) {

        if (segment == HTML_START) {
            StringBuffer result = new StringBuffer(512);
            String errorStyle = "";
            if (error) {
                errorStyle = " dialogerror";
            }
            result.append("<!-- 3D block start -->\n");
            result.append("<fieldset class=\"dialogblock\">\n");
            if (CmsStringUtil.isNotEmpty(headline)) {
                result.append("<legend>");
                result.append("<span class=\"textbold");
                result.append(errorStyle);
                result.append("\" unselectable=\"on\">");
                result.append(headline);
                result.append("</span></legend>\n");
            }
            return result.toString();
        } else {
            return "</fieldset>\n<!-- 3D block end -->\n";
        }
    }

    /**
     * Builds the end HTML for a block with 3D border in the dialog content area.<p>
     * 
     * @return 3D block start / end segment
     */
    public String dialogBlockEnd() {

        return dialogBlock(HTML_END, null, false);
    }

    /**
     * Builds the start HTML for a block with 3D border and optional subheadline in the dialog content area.<p>
     * 
     * @param headline the headline String for the block
     * @return 3D block start / end segment
     */
    public String dialogBlockStart(String headline) {

        return dialogBlock(HTML_START, headline, false);
    }

    /**
     * Builds the button row under the dialog content area without the buttons.<p>
     * 
     * @param segment the HTML segment (START / END)
     * @return the button row start / end segment
     */
    public String dialogButtonRow(int segment) {

        if (segment == HTML_START) {
            return "<!-- button row start -->\n<div class=\"dialogbuttons\" unselectable=\"on\">\n";
        } else {
            return "</div>\n<!-- button row end -->\n";
        }
    }

    /**
     * Builds the end of the button row under the dialog content area without the buttons.<p>
     * 
     * @return the button row end segment
     */
    public String dialogButtonRowEnd() {

        return dialogButtonRow(HTML_END);
    }

    /**
     * Builds the start of the button row under the dialog content area without the buttons.<p>
     * 
     * @return the button row start segment
     */
    public String dialogButtonRowStart() {

        return dialogButtonRow(HTML_START);
    }

    /**
     * Builds the html for the button row under the dialog content area, including buttons.<p>
     * 
     * @param buttons array of constants of which buttons to include in the row
     * @param attributes array of Strings for additional button attributes
     * @return the html for the button row under the dialog content area, including buttons
     */
    public String dialogButtons(int[] buttons, String[] attributes) {

        StringBuffer result = new StringBuffer(256);
        result.append(dialogButtonRow(HTML_START));
        for (int i = 0; i < buttons.length; i++) {
            dialogButtonsHtml(result, buttons[i], attributes[i]);
        }
        result.append(dialogButtonRow(HTML_END));
        return result.toString();
    }

    /**
     * Builds a button row with a single "close" button.<p>
     * 
     * @return the button row 
     */
    public String dialogButtonsClose() {

        return dialogButtons(new int[] {BUTTON_CLOSE}, new String[1]);
    }

    /**
     * Builds a button row with a single "close" button.<p>
     * 
     * @param closeAttribute additional attributes for the "close" button
     * @return the button row 
     */
    public String dialogButtonsClose(String closeAttribute) {

        return dialogButtons(new int[] {BUTTON_CLOSE}, new String[] {closeAttribute});
    }

    /**
     * Builds a button row with a "close" and a "details" button.<p>
     * 
     * @param closeAttribute additional attributes for the "close" button
     * @param detailsAttribute additional attributes for the "details" button
     * @return the button row 
     */
    public String dialogButtonsCloseDetails(String closeAttribute, String detailsAttribute) {

        return dialogButtons(new int[] {BUTTON_CLOSE, BUTTON_DETAILS}, new String[] {closeAttribute, detailsAttribute});
    }

    /**
     * Builds a button row with a single "ok" button.<p>
     * 
     * @return the button row 
     */
    public String dialogButtonsOk() {

        return dialogButtons(new int[] {BUTTON_OK}, new String[1]);
    }

    /**
     * Builds a button row with a single "ok" button.<p>
     * 
     * @param okAttribute additional attributes for the "ok" button
     * @return the button row 
     */
    public String dialogButtonsOk(String okAttribute) {

        return dialogButtons(new int[] {BUTTON_OK}, new String[] {okAttribute});
    }

    /**

⌨️ 快捷键说明

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