/** * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getWidgetConfiguration(org.opencms.file.CmsObject, org.opencms.i18n.CmsMessages, org.opencms.widgets.I_CmsWidgetParameter) */ @Override protected CmsVfsImageWidgetConfiguration getWidgetConfiguration( CmsObject cms, CmsMessages messages, I_CmsWidgetParameter param) { if (m_widgetConfiguration == null) { m_widgetConfiguration = new CmsVfsImageWidgetConfiguration(cms, messages, param, getConfiguration()); } return m_widgetConfiguration; } }
/** * Generates an initialized configuration for the image widget using the given configuration string.<p> * * @param cms an initialized instance of a CmsObject * @param widgetDialog the dialog where the widget is used on * @param param the widget parameter to generate the widget for * @param configuration the widget configuration string */ public CmsVfsImageWidgetConfiguration( CmsObject cms, CmsMessages widgetDialog, I_CmsWidgetParameter param, String configuration) { super(); init(cms, widgetDialog, param, configuration); }
setClassName(jsonObj.optString(CONFIG_KEY_CLASS, null)); I_CmsImageWidgetDynamicConfiguration dynConf = null; if (getClassName() != null) { try { dynConf = (I_CmsImageWidgetDynamicConfiguration)Class.forName(getClassName()).newInstance(); } catch (Exception e) { setShowDescription(jsonObj.optBoolean(CONFIG_KEY_USEDESCRIPTION)); setShowFormat(jsonObj.optBoolean(CONFIG_KEY_USEFORMAT)); if (isShowFormat()) { setSelectFormatString(optionsStr); setSelectFormat(CmsSelectWidgetOption.parseOptions(optionsStr)); setFormatValues(formatValueList); setFormatValues( dynConf.getFormatValues(cms, widgetDialog, param, getSelectFormat(), getFormatValues())); setType(jsonObj.optString(CONFIG_KEY_TYPE)); if ((CONFIG_VALUE_DYNAMIC.equals(getType()) || CmsStringUtil.isEmpty(getType())) && (dynConf != null)) { setType(dynConf.getType(cms, widgetDialog, param)); setStartup(jsonObj.optString(CONFIG_KEY_STARTUP)); if ((CONFIG_VALUE_DYNAMIC.equals(getStartup()) || CmsStringUtil.isEmpty(getStartup())) && (dynConf != null)) { setStartup(dynConf.getStartup(cms, widgetDialog, param)); setScaleParams(jsonObj.optString(CONFIG_KEY_SCALEPARAMS));
CmsVfsImageWidgetConfiguration configuration = new CmsVfsImageWidgetConfiguration( cms, widgetDialog, result.append("\nvar startupFolder").append(idHash).append(" = \"").append(configuration.getStartup()).append( "\";"); result.append("\nvar startupType").append(idHash).append(" = \"").append(configuration.getType()).append("\";"); result.append("\n</script>"); if (configuration.isShowFormat()) { List options = configuration.getSelectFormat(); String selected = getSelectedValue(cms, options, format); int selectedIndex = 0; result.append("</td>"); result.append("</tr>"); List formatValues = configuration.getFormatValues(); String selectedFormat = ""; try { JSONArray formatsJson = new JSONArray(configuration.getFormatValues()); result.append("\nvar imgFmts").append(idHash).append(" = ").append(formatsJson).append(";"); result.append("\nvar imgFmtNames").append(idHash).append(" = \"").append( CmsEncoder.escape(configuration.getSelectFormatString(), CmsEncoder.ENCODING_UTF_8)).append("\";"); result.append("\nvar useFmts").append(idHash).append(" = true;"); result.append("\n</script>"); if (configuration.isShowDescription()) {
CmsVfsImageWidgetConfiguration configuration = new CmsVfsImageWidgetConfiguration( cms, widgetDialog, getConfiguration()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getStartup())) { result.append("\n<script type=\"text/javascript\">"); result.append("\nvar startupFolder").append(idHash).append(" = \"").append(configuration.getStartup()).append( "\";"); result.append("\nvar startupType").append(idHash).append(" = \"").append(configuration.getType()).append( "\";"); result.append("\n</script>"); if (configuration.isShowFormat()) { JSONArray formatsJson = new JSONArray(configuration.getFormatValues()); result.append("\nvar imgFmts").append(idHash).append(" = ").append(formatsJson).append(";"); result.append("\nvar imgFmtNames").append(idHash).append(" = \"").append( CmsEncoder.escape(configuration.getSelectFormatString(), CmsEncoder.ENCODING_UTF_8)).append("\";"); result.append("\nvar useFmts").append(idHash).append(" = true;"); result.append("\n</script>");
if (configuration.isShowFormat()) { List<CmsSelectWidgetOption> options = configuration.getSelectFormat(); String selected = getSelectedValue(cms, options, format); int selectedIndex = 0; result.append("</td>"); result.append("</tr>"); List<String> formatValues = configuration.getFormatValues(); String selectedFormat = ""; try { JSONArray formatsJson = new JSONArray(configuration.getFormatValues()); result.append("\nvar imgFmts").append(idHash).append(" = ").append(formatsJson).append(";"); result.append("\nvar imgFmtNames").append(idHash).append(" = \"").append( CmsEncoder.escape(configuration.getSelectFormatString(), CmsEncoder.ENCODING_UTF_8)).append("\";"); result.append("\nvar useFmts").append(idHash).append(" = true;"); result.append("\n</script>"); if (configuration.isShowDescription()) { result.append("<tr>"); result.append("<td class=\"xmlLabel\">"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getScaleParams()) && (scale.indexOf(configuration.getScaleParams()) == -1)) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(scale)) { scale += ","; scale += configuration.getScaleParams();
/** * @see org.opencms.widgets.A_CmsAdeGalleryWidget#getAdditionalGalleryInfo(org.opencms.file.CmsObject, java.lang.String, org.opencms.i18n.CmsMessages, org.opencms.widgets.I_CmsWidgetParameter) */ @Override protected JSONObject getAdditionalGalleryInfo( CmsObject cms, String resource, CmsMessages messages, I_CmsWidgetParameter param) throws JSONException { CmsVfsImageWidgetConfiguration config = getWidgetConfiguration(cms, messages, param); JSONObject result = new JSONObject(); result.put(I_CmsGalleryProviderConstants.CONFIG_USE_FORMATS, config.isShowFormat()); result.put(I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMATS, new JSONArray(config.getFormatValues())); String temp = config.getSelectFormatString(); String[] formatNames = new String[0]; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(temp)) { formatNames = config.getSelectFormatString().split("\\|"); } result.put(I_CmsGalleryProviderConstants.CONFIG_IMAGE_FORMAT_NAMES, new JSONArray(formatNames)); result.put(I_CmsGalleryProviderConstants.CONFIG_TAB_CONFIG, "selectDoc"); String uploadFolder = OpenCms.getWorkplaceManager().getRepositoryFolderHandler().getRepositoryFolder( cms, resource, GALLERY_NAME + "gallery"); if (uploadFolder != null) { result.put(I_CmsGalleryProviderConstants.CONFIG_UPLOAD_FOLDER, uploadFolder); } return result; }
setClassName(jsonObj.optString(CONFIG_KEY_CLASS, null)); I_CmsImageWidgetDynamicConfiguration dynConf = null; if (getClassName() != null) { try { dynConf = (I_CmsImageWidgetDynamicConfiguration)Class.forName(getClassName()).newInstance(); } catch (Exception e) { setShowDescription(jsonObj.optBoolean(CONFIG_KEY_USEDESCRIPTION)); setShowFormat(jsonObj.optBoolean(CONFIG_KEY_USEFORMAT)); if (isShowFormat()) { setSelectFormatString(optionsStr); setSelectFormat(CmsSelectWidgetOption.parseOptions(optionsStr)); setFormatValues(formatValueList); setFormatValues(dynConf.getFormatValues(cms, widgetDialog, param, getSelectFormat(), getFormatValues())); setType(jsonObj.optString(CONFIG_KEY_TYPE)); if ((CONFIG_VALUE_DYNAMIC.equals(getType()) || CmsStringUtil.isEmpty(getType())) && (dynConf != null)) { setType(dynConf.getType(cms, widgetDialog, param)); setStartup(jsonObj.optString(CONFIG_KEY_STARTUP)); if ((CONFIG_VALUE_DYNAMIC.equals(getStartup()) || CmsStringUtil.isEmpty(getStartup())) && (dynConf != null)) { setStartup(dynConf.getStartup(cms, widgetDialog, param)); setScaleParams(jsonObj.optString(CONFIG_KEY_SCALEPARAMS));
CmsVfsImageWidgetConfiguration configuration = new CmsVfsImageWidgetConfiguration( cms, widgetDialog.getMessages(), getConfiguration()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getStartup())) { result.append("\n<script type=\"text/javascript\">"); result.append("\nvar startupFolder").append(idHash).append(" = \"").append( configuration.getStartup()).append("\";"); result.append("\nvar startupType").append(idHash).append(" = \"").append( configuration.getType()).append("\";"); result.append("\n</script>"); } else { if (configuration.isShowFormat()) { JSONArray formatsJson = new JSONArray(configuration.getFormatValues()); result.append("\nvar imgFmts").append(idHash).append(" = ").append(formatsJson).append(";"); result.append("\nvar imgFmtNames").append(idHash).append(" = \"").append( CmsEncoder.escape(configuration.getSelectFormatString(), CmsEncoder.ENCODING_UTF_8)).append("\";"); result.append("\nvar useFmts").append(idHash).append(" = true;"); result.append("\n</script>");
/** * Generates an initialized configuration for the image widget using the given configuration string.<p> * * @param cms an initialized instance of a CmsObject * @param widgetDialog the dialog where the widget is used on * @param param the widget parameter to generate the widget for * @param configuration the widget configuration string */ public CmsVfsImageWidgetConfiguration( CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param, String configuration) { super(); init(cms, widgetDialog, param, configuration); }