/** * Returns the HTML formatted error stack of a Throwable.<p> * * The error stack is used by the common error screen * that is displayed if an error occurs.<p> * * @param t the throwable to get the errorstack from * @return the formatted value of the errorstack parameter */ public static String getFormattedErrorstack(Throwable t) { String stacktrace = CmsException.getStackTraceAsString(t); if (CmsStringUtil.isEmpty(stacktrace)) { return ""; } else { stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); StringBuffer result = new StringBuffer(256); result.append("<html><body style='background-color: Window; overflow: scroll;'><pre>"); result.append(stacktrace); result.append("</pre></body></html>"); return result.toString(); } }
/** * Returns the HTML formatted error stack of a Throwable.<p> * * The error stack is used by the common error screen * that is displayed if an error occurs.<p> * * @param t the throwable to get the errorstack from * @return the formatted value of the errorstack parameter */ public static String getFormattedErrorstack(Throwable t) { String stacktrace = CmsException.getStackTraceAsString(t); if (CmsStringUtil.isEmpty(stacktrace)) { return ""; } else { stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); StringBuffer result = new StringBuffer(256); result.append( "<html><body style='background-color: /*begin-color Window*/#ffffff/*end-color*/; overflow: scroll;'><pre>"); result.append(stacktrace); result.append("</pre></body></html>"); return result.toString(); } }
/** * @see org.opencms.workplace.list.CmsListIndependentAction#resolveOnClic(org.opencms.workplace.CmsWorkplace) */ @Override protected String resolveOnClic(CmsWorkplace wp) { String confirmationMessage = getConfirmationMessage().key(wp.getLocale()); StringBuffer onClic = new StringBuffer(128); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { onClic.append("if (confirm('"); onClic.append(CmsStringUtil.escapeJavaScript(confirmationMessage)); onClic.append("')) { "); } onClic.append(jsCode(wp)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { onClic.append(" } "); } return onClic.toString(); }
/** * @see org.opencms.workplace.list.CmsListIndependentAction#resolveOnClic(org.opencms.workplace.CmsWorkplace) */ @Override protected String resolveOnClic(CmsWorkplace wp) { String confirmationMessage = getConfirmationMessage().key(wp.getLocale()); StringBuffer onClic = new StringBuffer(128); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { onClic.append("if (confirm('"); onClic.append(CmsStringUtil.escapeJavaScript(confirmationMessage)); onClic.append("')) { "); } onClic.append(jsCode(wp)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(confirmationMessage)) { onClic.append(" } "); } return onClic.toString(); }
/** * @see org.opencms.widgets.A_CmsWidget#getHelpBubble(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter) */ @Override public String getHelpBubble(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { StringBuffer result = new StringBuffer(128); String locKey = getDisabledHelpKey(param); String locValue = widgetDialog.getMessages().key(locKey, true); if (locValue == null) { // there was no help message found for this key, so return a spacer cell return widgetDialog.dialogHorizontalSpacer(16); } else { result.append("<td>"); result.append("<img name=\"img"); result.append(locKey); result.append("\" id=\"img"); result.append(locKey); result.append("\" src=\""); result.append(OpenCms.getLinkManager().substituteLink(cms, "/system/workplace/resources/commons/help.png")); result.append("\" alt=\"\" border=\"0\""); if (widgetDialog.useNewStyle()) { result.append(getJsHelpMouseHandler(widgetDialog, locKey, null)); } else { result.append(getJsHelpMouseHandler(widgetDialog, locKey, CmsStringUtil.escapeJavaScript(locValue))); } result.append("></td>"); return result.toString(); } }
/** * Returns the html code for the search bar.<p> * * @param wp the workplace context * * @return html code */ public String barHtml(CmsWorkplace wp) { if (wp == null) { wp = getWp(); } StringBuffer html = new StringBuffer(1024); html.append("\t\t<input type='text' name='"); html.append(SEARCH_BAR_INPUT_ID); html.append("' id='"); html.append(SEARCH_BAR_INPUT_ID); html.append("' value='"); if (wp instanceof A_CmsListDialog) { // http://www.securityfocus.com/archive/1/490498: searchfilter cross site scripting vulnerability: html.append(CmsStringUtil.escapeJavaScript(CmsEncoder.escapeXml(((A_CmsListDialog)wp).getList().getSearchFilter()))); } html.append("' size='20' maxlength='245' style='vertical-align: bottom;' >\n"); html.append(buttonHtml(wp)); if (getShowAllAction() != null) { html.append(" "); html.append(getShowAllAction().buttonHtml()); } return html.toString(); }
CmsStringUtil.escapeJavaScript( CmsEncoder.escapeXml(((A_CmsListDialog)wp).getList().getSearchFilter())));
content.append(CmsStringUtil.escapeJavaScript(getSettings().getErrorMessage().key(getLocale()))); content.append("\");\n");
onClic.append("conf" + getId()); } else { onClic.append(CmsStringUtil.escapeJavaScript(confirmationMessage)); onClic.append(CmsStringUtil.escapeJavaScript(getItem().getId())); onClic.append("');"); return onClic.toString();
onClic.append("conf" + getId()); } else { onClic.append(CmsStringUtil.escapeJavaScript(confirmationMessage)); onClic.append(CmsStringUtil.escapeJavaScript(getItem().getId())); onClic.append("');"); return onClic.toString();
result.append(getJsHelpMouseHandler(widgetDialog, locKey, CmsStringUtil.escapeJavaScript(locValue)));
/** * Help method to resolve the on clic text to use.<p> * * @param wp the workplace context * * @return the on clic text */ protected String resolveOnClic(CmsWorkplace wp) { return "listIndepAction('" + getListId() + "','" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; }
/** * Help method to resolve the on clic text to use.<p> * * @param wp the workplace context * * @return the on clic text */ protected String resolveOnClic(CmsWorkplace wp) { return "listIndepAction('" + getListId() + "','" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } String onClic = "listSearchAction('" + getListId() + "', '" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } String onClic = "listSearchAction('" + getListId() + "', '" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); } };
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } String onClic = "listSearchAction('" + getListId() + "', '" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } String onClic = "listSearchAction('" + getListId() + "', '" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "');"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); } };
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ @Override public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } if (isEnabled()) { String onClic = "listMAction('" + getListId() + "','" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "', " + CmsHtmlList.NO_SELECTION_HELP_VAR + ");"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_ONLY, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); } return ""; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } if (isEnabled()) { String onClic = "listMAction('" + getListId() + "','" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "', " + CmsHtmlList.NO_SELECTION_HELP_VAR + ");"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); } return ""; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#buttonHtml(CmsWorkplace) */ public String buttonHtml(CmsWorkplace wp) { if (!isVisible()) { return ""; } if (isEnabled()) { String onClic = "listMAction('" + getListId() + "','" + getId() + "', '" + CmsStringUtil.escapeJavaScript(wp.resolveMacros(getConfirmationMessage().key(wp.getLocale()))) + "', " + CmsHtmlList.NO_SELECTION_HELP_VAR + ");"; return A_CmsHtmlIconButton.defaultButtonHtml( CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT, getId(), getName().key(wp.getLocale()), getHelpText().key(wp.getLocale()), isEnabled(), getIconPath(), null, onClic); } return ""; }