/** * Returns the button bar configuration String for the FCKeditor widget.<p> * * @param configuration the configuration to use * @return the button bar configuration String for the FCKeditor widget */ public static String getButtonBar(CmsHtmlWidgetOption configuration) { return configuration.getButtonBar(BUTTON_TRANSLATION_MAP, ","); }
/** * Returns true if the widget editor should use a defined CSS style sheet.<p> * * @return if the widget editor should use a defined CSS style sheet */ public boolean useCss() { return CmsStringUtil.isNotEmpty(getCssPath()); }
/** * Returns the individual options for the format select box, if they were configured, otherwise an empty String.<p> * * @param option the configured HTML widget options * * @return the individual options for the format select box */ public static String getFormatSelectOptionsConfiguration(CmsHtmlWidgetOption option) { if (CmsStringUtil.isNotEmpty(option.getFormatSelectOptions())) { // individual options are used, create configuration output return "FCKConfig.FontFormats = \"" + option.getFormatSelectOptions() + "\";"; } return ""; }
if (!option.getEditorHeight().equals(EDITOR_DEFAULTHEIGHT)) { result.append(option.getEditorHeight()); added = true; if (option.useCss()) { result.append(option.getCssPath()); added = true; if (option.showStylesXml()) { result.append(option.getStylesXmlPath()); added = true; if (!option.getAdditionalButtons().isEmpty()) { option.getAdditionalButtons(), String.valueOf(DELIMITER_OPTION))); added = true; if (!option.getHiddenButtons().isEmpty()) { result.append(CmsStringUtil.collectionAsString(option.getHiddenButtons(), String.valueOf(DELIMITER_VALUE))); added = true; if (CmsStringUtil.isNotEmpty(option.getButtonBarOptionString())) { result.append(option.getButtonBarOptionString());
result.append(id); result.append("\" style=\"height: "); result.append(getHtmlWidgetOption().getEditorHeight()); result.append(";\" rows=\"20\" cols=\"60\">"); result.append(CmsEncoder.escapeXml(value)); if (getHtmlWidgetOption().useCss()) { cssPath = getHtmlWidgetOption().getCssPath(); getHtmlWidgetOption().setCssPath(null); cssConfigured = true; } else if (OpenCms.getWorkplaceManager().getEditorCssHandlers().size() > 0) { if (getHtmlWidgetOption().showStylesXml()) { result.append("editor.Config[\"StylesXmlPath\"] = \""); result.append(OpenCms.getLinkManager().substituteLink(cms, getHtmlWidgetOption().getStylesXmlPath())); result.append("\";\n"); getHtmlWidgetOption().setStylesXmlPath("true"); if (getHtmlWidgetOption().isFullPage()) { result.append("editor.Config[\"FullPage\"] = true;\n"); result.append("editor.Height = \"").append(getHtmlWidgetOption().getEditorHeight()).append("\";\n"); result.append("editor.ToolbarSet = \"OpenCmsWidget\";\n"); configJs.append(PARAM_CONFIGURATION); configJs.append("="); configJs.append(CmsHtmlWidgetOption.createConfigurationString(getHtmlWidgetOption()));
if (widgetOptions.isAllowScripts()) { result.put("allowscripts", Boolean.TRUE); result.put("fullpage", widgetOptions.isFullPage()); List<String> toolbarItems = widgetOptions.getButtonBarShownItems(); result.put("toolbar_items", toolbarItems); Locale workplaceLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); result.put("language", workplaceLocale.getLanguage()); String editorHeight = widgetOptions.getEditorHeight(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(editorHeight)) { editorHeight = editorHeight.replaceAll("px", ""); if (widgetOptions.useCss()) { cssPath = widgetOptions.getCssPath(); widgetOptions.setCssPath(null); cssConfigured = true; } else if (OpenCms.getWorkplaceManager().getEditorCssHandlers().size() > 0) { if (widgetOptions.showStylesFormat()) { try { CmsFile file = cms.readFile(widgetOptions.getStylesFormatPath()); String characterEncoding = OpenCms.getSystemInfo().getDefaultEncoding(); result.put("style_formats", new String(file.getContents(), characterEncoding)); } catch (CmsException cmsException) { LOG.error("Can not open file:" + widgetOptions.getStylesFormatPath(), cmsException); } catch (UnsupportedEncodingException ex) { LOG.error(ex);
CmsPair<String, Map<String, String>> simplifiedStringAndGalleryOptions = parseEmbeddedGalleryOptions( configuration); configuration = simplifiedStringAndGalleryOptions.getFirst(); setFormatSelectOptions(option); } else if (option.startsWith(OPTION_HEIGHT)) { setEditorHeight(option); setHiddenButtons(CmsStringUtil.splitAsList(option, DELIMITER_VALUE, true)); } else if (option.startsWith(OPTION_CSS)) { setCssPath(option); } else if (option.startsWith(OPTION_STYLES)) { setStylesXmlPath(option); } else if (option.startsWith(OPTION_STYLES_FORMAT)) { setStylesFormatPath(option); } else if (option.startsWith(OPTION_BUTTONBAR)) { setButtonBarOptionString(option); } else if (option.startsWith(OPTION_IMPORTCSS)) { m_importCss = true; addAdditionalButton(option);
setFormatSelectOptions(option); } else if (option.startsWith(OPTION_HEIGHT)) { setEditorHeight(option); setHiddenButtons(CmsStringUtil.splitAsList(option, DELIMITER_VALUE, true)); } else if (option.startsWith(OPTION_CSS)) { setCssPath(option); } else if (option.startsWith(OPTION_STYLES)) { setStylesXmlPath(option); } else if (option.startsWith(OPTION_BUTTONBAR)) { setButtonBarOptionString(option); } else { addAdditionalButton(option);
List<String> buttonBar = getButtonBarOption(); if (buttonBar.isEmpty()) { && defaultConf.contains(OPTION_BUTTONBAR)) { CmsHtmlWidgetOption option = new CmsHtmlWidgetOption(defaultConf); m_globalButtonBarOption = option.getButtonBarOption(); } else { if (getHiddenButtons().contains(barItem)) { if (!(getAdditionalButtons().contains(barItem) || getAdditionalButtons().contains(OPTION_IMAGE))) { if (!(getAdditionalButtons().contains(OPTION_LINK) || getAdditionalButtons().contains(OPTION_EDITORLINK) || getAdditionalButtons().contains(OPTION_ANCHOR))) { boolean showStyles = getAdditionalButtons().contains(barItem) || (getStylesFormatPath() != null) || (getStylesXmlPath() != null); if (!showStyles) { continue; } else if (!getAdditionalButtons().contains(barItem)) {
List<String> buttonBar = getButtonBarOption(); if (buttonBar.isEmpty()) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(defaultConf) && defaultConf.contains(OPTION_BUTTONBAR)) { CmsHtmlWidgetOption option = new CmsHtmlWidgetOption(defaultConf); m_globalButtonBarOption = option.getButtonBarOption(); } else { if (getHiddenButtons().contains(barItem)) { if (!(getAdditionalButtons().contains(barItem) || getAdditionalButtons().contains( OPTION_IMAGE))) { if (!(getAdditionalButtons().contains(OPTION_LINK) || getAdditionalButtons().contains(OPTION_EDITORLINK) || getAdditionalButtons().contains( OPTION_ANCHOR))) { if (!showStylesXml()) { } else if (!getAdditionalButtons().contains(barItem)) {
/** * @see org.opencms.widgets.A_CmsWidget#getConfiguration() */ @Override public String getConfiguration() { if (super.getConfiguration() != null) { return super.getConfiguration(); } return CmsHtmlWidgetOption.createConfigurationString(getHtmlWidgetOption()); }
/** * Returns true if the styles selector should be available.<p> * * @return if the styles selector should be available */ public boolean showStylesXml() { return CmsStringUtil.isNotEmpty(getStylesXmlPath()); }
if (!option.getEditorHeight().equals(EDITOR_DEFAULTHEIGHT)) { result.append(option.getEditorHeight()); added = true; if (option.useCss()) { result.append(option.getCssPath()); added = true; if (option.showStylesXml()) { result.append(option.getStylesXmlPath()); added = true; if (!option.getAdditionalButtons().isEmpty()) { CmsStringUtil.collectionAsString(option.getAdditionalButtons(), String.valueOf(DELIMITER_OPTION))); added = true; if (!option.getHiddenButtons().isEmpty()) { result.append(CmsStringUtil.collectionAsString(option.getHiddenButtons(), String.valueOf(DELIMITER_VALUE))); added = true; if (CmsStringUtil.isNotEmpty(option.getButtonBarOptionString())) { result.append(option.getButtonBarOptionString()); added = true;
/** * @see org.opencms.widgets.A_CmsWidget#getConfiguration() */ @Override public String getConfiguration() { if (super.getConfiguration() != null) { return super.getConfiguration(); } return CmsHtmlWidgetOption.createConfigurationString(getHtmlWidgetOption()); }
/** * Returns true if the styles selector should be available.<p> * * @return if the styles selector should be available */ public boolean showStylesXml() { return CmsStringUtil.isNotEmpty(getStylesXmlPath()); }
/** * Returns the specific editor button bar string generated from the configuration.<p> * * The lookup map can contain translations for the button names, the separator and the block names. * The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.<p> * * It may be necessary to write your own method to generate the button bar string for a specific editor widget. * In this case, use the method {@link #getButtonBarShownItems()} to get the calculated list of shown button bar items.<p> * * @param buttonNamesLookUp the lookup map with translations for the button names, the separator and the block names or <code>null</code> * @param itemSeparator the separator for the tool bar items * @return the button bar string generated from the configuration */ public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { return getButtonBar(buttonNamesLookUp, itemSeparator, true); }
/** * Returns true if the widget editor should use a defined CSS style sheet.<p> * * @return if the widget editor should use a defined CSS style sheet */ public boolean useCss() { return CmsStringUtil.isNotEmpty(getCssPath()); }
/** * Returns the specific editor button bar string generated from the configuration.<p> * * The lookup map can contain translations for the button names, the separator and the block names. * The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.<p> * * It may be necessary to write your own method to generate the button bar string for a specific editor widget. * In this case, use the method {@link #getButtonBarShownItems()} to get the calculated list of shown button bar items.<p> * * @param buttonNamesLookUp the lookup map with translations for the button names, the separator and the block names or <code>null</code> * @param itemSeparator the separator for the tool bar items * @return the button bar string generated from the configuration */ public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { return getButtonBar(buttonNamesLookUp, itemSeparator, true); }