From: <fg...@us...> - 2008-07-21 13:23:34
|
Revision: 888 http://openutils.svn.sourceforge.net/openutils/?rev=888&view=rev Author: fgiust Date: 2008-07-21 13:23:39 +0000 (Mon, 21 Jul 2008) Log Message: ----------- only include javascript once + new "combo" control type Modified Paths: -------------- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/ConfigurableFreemarkerDialog.java trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl trunk/openutils-mgnlcontrols/src/site/apt/grid.apt trunk/openutils-mgnlcontrols/src/site/changes/changes.xml Modified: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/ConfigurableFreemarkerDialog.java =================================================================== --- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/ConfigurableFreemarkerDialog.java 2008-07-20 17:24:46 UTC (rev 887) +++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/ConfigurableFreemarkerDialog.java 2008-07-21 13:23:39 UTC (rev 888) @@ -158,10 +158,13 @@ /** * {@inheritDoc} */ + @SuppressWarnings("unchecked") @Override public void drawHtml(Writer out) throws IOException { + String alreadyRenderedKey = "freemarker/" + getPath(); + Map parameters = new HashMap(); parameters.put("name", this.getName()); parameters.put("value", this.getValue()); @@ -169,6 +172,7 @@ parameters.put("request", this.getRequest()); parameters.put("debug", SystemProperty.getBooleanProperty("magnolia.develop")); parameters.put("configuration", this.configuration); + parameters.put("alreadyrendered", getRequest().getAttribute(alreadyRenderedKey) != null); this.drawHtmlPre(out); try @@ -180,7 +184,6 @@ control.setName(this.getName()); control.drawHtml(out, getPath(), parameters); } - catch (TemplateException ex) { log.error("Error processing dialog template:", ex); @@ -188,6 +191,8 @@ } this.drawHtmlPost(out); + + getRequest().setAttribute(alreadyRenderedKey, Boolean.TRUE); } /** Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2008-07-20 17:24:46 UTC (rev 887) +++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2008-07-21 13:23:39 UTC (rev 888) @@ -1,23 +1,30 @@ +[#if !alreadyrendered] + <script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-base.js"></script> -<script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-base.js"></script> + [#if debug] + <script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-all-debug.js"></script> + [#else] + <script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-all.js"></script> + [/#if] + <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/LinkField.js"></script> + <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/CheckColumn.js"></script> -[#if debug] -<script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-all-debug.js"></script> -[#else] -<script type="text/javascript" src="${request.contextPath}/.resources/ext/ext-all.js"></script> + <link rel="stylesheet" type="text/css" href="${request.contextPath}/.resources/ext/css/ext-all.css" /> + <link rel="stylesheet" type="text/css" href="${request.contextPath}/.resources/controls/css/grid.css" /> [/#if] -<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/LinkField.js"></script> -<script type="text/javascript" src="${request.contextPath}/.resources/controls/js/CheckColumn.js"></script> -<link rel="stylesheet" type="text/css" href="${request.contextPath}/.resources/ext/css/ext-all.css" /> -<link rel="stylesheet" type="text/css" href="${request.contextPath}/.resources/controls/css/grid.css" /> - <input type="hidden" id="${name}" name="${name}" value="${value}"/> -<div id="grid-container-${name}"> - <div id="grid-${name}"></div> -</div> +[#list configuration.columns?values as colmap] + [#if (colmap.type?? && colmap.type = 'combo')] + <select id="combo-${name}" name="combo-${name}" style="display: none;"> + [#list colmap.options?values as option] + <option value="${option.value}">${option.label}</option> + [/#list] + </select> + [/#if] +[/#list] <script type="text/javascript"> // <![CDATA[ @@ -65,6 +72,14 @@ [#if (colmap.type?? && colmap.type = 'link')] editor: new Ed(new LinkField({ })) + [#elseif (colmap.type?? && colmap.type = 'combo')] + editor: new Ed(new fm.ComboBox({ + typeAhead: true, + triggerAction: 'all', + transform: 'combo-${name}', + lazyRender: true, + listClass: 'x-combo-list-small' + })) [#else] editor: new Ed(new fm.TextField({ allowBlank: true Modified: trunk/openutils-mgnlcontrols/src/site/apt/grid.apt =================================================================== --- trunk/openutils-mgnlcontrols/src/site/apt/grid.apt 2008-07-20 17:24:46 UTC (rev 887) +++ trunk/openutils-mgnlcontrols/src/site/apt/grid.apt 2008-07-21 13:23:39 UTC (rev 888) @@ -39,7 +39,9 @@ * link: a text fields with a button that can be used to insert an internal link + * combo: a list of predefined values (configured in the "options" node) + Hacking it The grid editor is actually implemented as a freemarker control, so it can easily be modified and improved. Modified: trunk/openutils-mgnlcontrols/src/site/changes/changes.xml =================================================================== --- trunk/openutils-mgnlcontrols/src/site/changes/changes.xml 2008-07-20 17:24:46 UTC (rev 887) +++ trunk/openutils-mgnlcontrols/src/site/changes/changes.xml 2008-07-21 13:23:39 UTC (rev 888) @@ -8,6 +8,11 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> + <release version="3.5.4" date="2008-07-21" description=""> + <action type="fix" dev="fgiust">esternal javascript are now included only once when using multiple grid + controls in the same dialog</action> + <action type="add" dev="fgiust">New "combo" control type handled by grid</action> + </release> <release version="3.5.3" date="2008-07-13" description=""> <action type="update" dev="fgiust">Extjs has been moved to openutils-mgnlext, which is now a required dependency</action> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |