Author: jleroux
Date: Sun Jul 26 15:12:49 2015
New Revision: 1692725
URL: http://svn.apache.org/r1692725
Log:
A patch from Gil Portenseigne for OFBIZ-6545 - Replace
webtools/control/EntitySQLProcessor FTL with widgets
And while at it set ofbiz.org as default selGroup when none exist. This will
prevent the unobvious error message
<<Unable to esablish a connection with the database. (Unable to acquire a new
connection from the pool)>>
in most cases!
This patch replaces EntitySQLCommand ftl to widget. List screen couldn't be
migrated to widget due to dynamic column rendering.
To get the default group, a little trick is used, constructing the list of map
for drop-down list-option widget.
Modified:
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy
ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntitySQLProcessor.ftl
ofbiz/trunk/framework/webtools/widget/EntityForms.xml
ofbiz/trunk/framework/webtools/widget/EntityScreens.xml
Modified:
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy?rev=1692725&r1=1692724&r2=1692725&view=diff
==============================================================================
---
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy
(original)
+++
ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntitySQLProcessor.groovy
Sun Jul 26 15:12:49 2015
@@ -31,7 +31,8 @@ rs = null;
columns = [];
records = [];
mgr = delegator.getModelGroupReader();
-groups = mgr.getGroupNames(delegator.getDelegatorName());
+groups = [];
+for (String group : mgr.getGroupNames(delegator.getDelegatorName()))
groups.add(0,["group":group]); //use for list-option in widget drop-down
if (sqlCommand && selGroup) {
du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup));
Modified:
ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntitySQLProcessor.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntitySQLProcessor.ftl?rev=1692725&r1=1692724&r2=1692725&view=diff
==============================================================================
---
ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntitySQLProcessor.ftl
(original)
+++
ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntitySQLProcessor.ftl
Sun Jul 26 15:12:49 2015
@@ -16,45 +16,6 @@ KIND, either express or implied. See th
specific language governing permissions and limitations
under the License.
-->
- <form method="post" action="EntitySQLProcessor" name="EntitySQLCommand">
- <table class="basic-table" cellspacing="0">
- <tr>
- <td class="label">
- ${uiLabelMap.CommonGroup}
- </td>
- <td>
- <select name="group">
- <#list groups as group>
- <option value="${group}" <#if selGroup??><#if group =
selGroup>selected="selected"</#if></#if>>${group}</option>
- </#list>
- </select>
- </td>
- </tr>
- <tr>
- <td class="label">
- ${uiLabelMap.WebtoolsSqlCommand}
- </td>
- <td>
- <textarea name="sqlCommand" cols="100"
rows="5">${sqlCommand!}</textarea>
- </td>
- </tr>
- <tr>
- <td class="label">
- ${uiLabelMap.WebtoolsLimitRowsTo}
- </td>
- <td>
- <input name="rowLimit" type="text" size="5"
value="${rowLimit?default(200)}"/>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="submit" name="submitButton"
value="${uiLabelMap.CommonSubmit}"/>
- </td>
- </tr>
- </table>
- </form>
-
<div class="screenlet">
<div class="screenlet-title-bar">
<ul>
Modified: ofbiz/trunk/framework/webtools/widget/EntityForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/EntityForms.xml?rev=1692725&r1=1692724&r2=1692725&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/EntityForms.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/EntityForms.xml Sun Jul 26 15:12:49
2015
@@ -67,4 +67,17 @@ under the License.
<include-menu name="ListEntitiesAction"
location="component://webtools/widget/Menus.xml"/>
</field>
</grid>
+
+ <form name="EntitySQLCommand" target="EntitySQLProcessor">
+ <field name="group" title="${uiLabelMap.CommonGroup}">
+ <drop-down allow-empty="false">
+ <list-options list-name="groups" key-name="group"
description="${group}"/>
+ </drop-down>
+ </field>
+ <field name="sqlCommand" title="${uiLabelMap.WebtoolsSqlCommand}">
+ <textarea cols="60" rows="6"/>
+ </field>
+ <field name="rowLimit" title="${uiLabelMap.WebtoolsLimitRowsTo}"
encode-output="false"><text default-value="200" size="5"/></field>
+ <field name="submitButton"
title="${uiLabelMap.CommonSend}"><submit/></field>
+ </form>
</forms>
Modified: ofbiz/trunk/framework/webtools/widget/EntityScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml?rev=1692725&r1=1692724&r2=1692725&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/EntityScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/EntityScreens.xml Sun Jul 26 15:12:49
2015
@@ -37,6 +37,7 @@ under the License.
<widgets>
<decorator-screen name="CommonEntityDecorator"
location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
+ <include-form name="EntitySQLCommand"
location="component://webtools/widget/EntityForms.xml"/>
<platform-specific>
<html><html-template
location="component://webtools/webapp/webtools/entity/EntitySQLProcessor.ftl"/></html>
</platform-specific>
@@ -170,13 +171,13 @@ under the License.
<include-form name="FilterEntities"
location="component://webtools/widget/EntityForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsFindRecord}">
- <iterate-section entry="firstChar"
list="firstChars" view-size="100">
- <section>
- <widgets>
- <link text="${firstChar}"
style="buttontext button-bar" target="#${firstChar}" full-path="true"
url-mode="plain"></link>
- </widgets>
- </section>
- </iterate-section>
+ <iterate-section entry="firstChar"
list="firstChars" view-size="100">
+ <section>
+ <widgets>
+ <link text="${firstChar}"
style="buttontext button-bar" target="#${firstChar}" full-path="true"
url-mode="plain"></link>
+ </widgets>
+ </section>
+ </iterate-section>
</screenlet>
<screenlet title="${uiLabelMap.WebtoolsEntitiesAlpha}">
<include-grid name="ListEntities"
location="component://webtools/widget/EntityForms.xml"/>