svn commit: r593644 - in /ofbiz/trunk/framework/webtools: config/ servicedef/ src/org/ofbiz/webtools/ webapp/webtools/WEB-INF/actions/entity/ webapp/webtools/entity/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r593644 - in /ofbiz/trunk/framework/webtools: config/ servicedef/ src/org/ofbiz/webtools/ webapp/webtools/WEB-INF/actions/entity/ webapp/webtools/entity/ widget/

adrianc
Author: adrianc
Date: Fri Nov  9 12:38:03 2007
New Revision: 593644

URL: http://svn.apache.org/viewvc?rev=593644&view=rev
Log:
More Webtools Entity Reference screen work. Also converted Webtools services to use a permission service. Converted EntityRefMain.bsh to a service - so that the entity reference data can be obtained through a service call.

Removed:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefMain.bsh
Modified:
    ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
    ofbiz/trunk/framework/webtools/servicedef/services.xml
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefList.ftl
    ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefMain.ftl
    ofbiz/trunk/framework/webtools/widget/EntityScreens.xml

Modified: ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties (original)
+++ ofbiz/trunk/framework/webtools/config/WebtoolsUiLabels.properties Fri Nov  9 12:38:03 2007
@@ -114,6 +114,7 @@
 WebtoolsEnable=Enable
 WebtoolsEngineName=Engine Name
 WebtoolsEntities=entities
+WebtoolsEntitiesAlpha=Entities - Alphabetical
 WebtoolsEntity=ENTITY
 WebtoolsEntityCurrentValue=Entity Current Value
 WebtoolsEntityDataMaintenance=Entity Data Maintenance
@@ -124,6 +125,7 @@
 WebtoolsEntityEngineTools=Entity Engine Tools
 WebtoolsEntityName=Entity Name
 WebtoolsEntityNames=Entity Names
+WebtoolsEntityPackages=Entity Packages
 WebtoolsEntityReference=Entity Reference
 WebtoolsEntityReferenceChart=Entity Reference Chart
 WebtoolsEntityReferenceMainPage=Entity Reference Main Page

Modified: ofbiz/trunk/framework/webtools/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/servicedef/services.xml?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/webtools/servicedef/services.xml Fri Nov  9 12:38:03 2007
@@ -29,6 +29,7 @@
     <service name="parseEntityXmlFile" engine="java" require-new-transaction="true"
             location="org.ofbiz.webtools.WebToolsServices" invoke="parseEntityXmlFile" auth="true" use-transaction="false">
         <description>Parses an entity xml file or an entity xml text</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
         <attribute name="url" type="java.net.URL" mode="IN" optional="true"/>
         <attribute name="xmltext" type="String" mode="IN" optional="true"/>
         <attribute name="mostlyInserts" type="String" mode="IN" optional="true"/>
@@ -41,6 +42,7 @@
     <service name="entityImport" engine="java"
             location="org.ofbiz.webtools.WebToolsServices" invoke="entityImport" auth="true" use-transaction="false">
         <description>Imports an entity xml file or text string</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
         <attribute name="filename" type="String" mode="IN" optional="true"/>
         <attribute name="fmfilename" type="String" mode="IN" optional="true"/>
         <attribute name="fulltext" type="String" mode="IN" optional="true"/>
@@ -55,6 +57,7 @@
     <service name="entityImportDir" engine="java"
             location="org.ofbiz.webtools.WebToolsServices" invoke="entityImportDir" auth="true" use-transaction="false">
         <description>Imports all entity xml files contained in a directory</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
         <attribute name="path" type="String" mode="IN" optional="true"/>
         <attribute name="mostlyInserts" type="String" mode="IN" optional="true"/>
         <attribute name="maintainTimeStamps" type="String" mode="IN" optional="true"/>
@@ -68,6 +71,7 @@
     <service name="entityImportReaders" engine="java"
         location="org.ofbiz.webtools.WebToolsServices" invoke="entityImportReaders" auth="true" use-transaction="false">
         <description>Imports an entity xml file or text string</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
         <attribute name="readers" type="String" mode="IN" optional="true"/>
         <attribute name="overrideDelegator" type="String" mode="IN" optional="true"/>
         <attribute name="overrideGroup" type="String" mode="IN" optional="true"/>
@@ -81,9 +85,20 @@
     <service name="entityExportAll" engine="java"
             location="org.ofbiz.webtools.WebToolsServices" invoke="entityExportAll" auth="true" use-transaction="false">
         <description>Exports all entities into xml files</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
         <attribute name="outpath" type="String" mode="IN" optional="true"/>
         <attribute name="txTimeout" type="Integer" mode="IN" optional="true"/>
         <attribute name="results" type="List" mode="OUT" optional="false"/>
     </service>
-
+    <service name="getEntityRefData" engine="java" location="org.ofbiz.webtools.WebToolsServices" invoke="getEntityRefData" auth="true" use-transaction="false">
+        <description>Gets the entity reference data - for the entity reference screen. See org.ofbiz.webtools.WebToolsServices.getEntityRefData().</description>
+        <permission-service service-name="entityMaintPermCheck" main-action="VIEW"/>
+        <attribute name="numberOfEntities" type="java.lang.Integer" mode="OUT" optional="true"/>
+        <attribute name="packagesList" type="java.util.List" mode="OUT" optional="true"/>
+    </service>
+    <service name="entityMaintPermCheck" engine="java" location="org.ofbiz.webtools.WebToolsServices" invoke="entityMaintPermCheck">
+        <description>Performs an entity maintenance security check. Returns hasPermission=true
+          if the user has the ENTITY_MAINT permission.</description>
+        <implements service="permissionInterface"/>
+    </service>
 </services>

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Fri Nov  9 12:38:03 2007
@@ -62,6 +62,11 @@
 import org.ofbiz.entity.util.EntitySaxReader;
 import org.ofbiz.entity.model.ModelReader;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.model.ModelField;
+import org.ofbiz.entity.model.ModelFieldType;
+import org.ofbiz.entity.model.ModelIndex;
+import org.ofbiz.entity.model.ModelRelation;
+import org.ofbiz.entity.model.ModelKeyMap;
 import org.ofbiz.entity.model.ModelViewEntity;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -85,11 +90,6 @@
 
     public static Map entityImport(DispatchContext dctx, Map context) {
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Security security = dctx.getSecurity();
-        if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", (Locale) context.get("locale")));
-        }
-
         LocalDispatcher dispatcher = dctx.getDispatcher();
 
         List messages = new ArrayList();
@@ -210,11 +210,6 @@
 
     public static Map entityImportDir(DispatchContext dctx, Map context) {
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Security security = dctx.getSecurity();
-        if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", (Locale) context.get("locale")));
-        }
-
         LocalDispatcher dispatcher = dctx.getDispatcher();
 
         List messages = FastList.newInstance();
@@ -319,12 +314,6 @@
     }
 
     public static Map entityImportReaders(DispatchContext dctx, Map context) {
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Security security = dctx.getSecurity();
-        if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", (Locale) context.get("locale")));
-        }
-
         String readers = (String) context.get("readers");
         String overrideDelegator = (String) context.get("overrideDelegator");
         String overrideGroup = (String) context.get("overrideGroup");
@@ -435,12 +424,6 @@
     }
     
     public static Map parseEntityXmlFile(DispatchContext dctx, Map context) {
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Security security = dctx.getSecurity();
-        if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", (Locale) context.get("locale")));
-        }
-
         GenericDelegator delegator = dctx.getDelegator();
 
         URL url = (URL)context.get("url");
@@ -479,12 +462,6 @@
     }
 
     public static Map entityExportAll(DispatchContext dctx, Map context) {
-        GenericValue userLogin = (GenericValue) context.get("userLogin");
-        Security security = dctx.getSecurity();
-        if (!security.hasPermission("ENTITY_MAINT", userLogin)) {
-            return ServiceUtil.returnError(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", (Locale) context.get("locale")));
-        }
-
         GenericDelegator delegator = dctx.getDelegator();
 
         String outpath = (String)context.get("outpath"); // mandatory
@@ -573,5 +550,222 @@
         // send the notification
         Map resp = UtilMisc.toMap("results", results);
         return resp;
+    }
+    
+    /** Get entity reference data. Returns the number of entities in
+     * <code>numberOfEntities</code> and a List of Maps -
+     * <code>packagesList</code>.<br/> Each Map contains:<br/>
+     * <ul><li><code>packageName</code> - the entity package name</li>
+     * <li><code>entitiesList</code> - a list of Maps:
+       <ul>
+         <li><code>entityName</code></li>
+         <li><code>helperName</code></li>
+         <li><code>groupName</code></li>
+         <li><code>plainTableName</code></li>
+         <li><code>title</code></li>
+         <li><code>description</code></li>
+         <!-- <li><code>location</code></li> -->
+         <li><code>javaNameList</code> - list of Maps:
+           <ul>
+             <li><code>isPk</code></li>
+             <li><code>name</code></li>
+             <li><code>colName</code></li>
+             <li><code>description</code></li>
+             <li><code>type</code></li>
+             <li><code>javaType</code></li>
+             <li><code>sqlType</code></li>
+           </ul>
+         </li>
+         <li><code>relationsList</code> - list of Maps:
+           <ul>
+             <li><code>title</code></li>
+             <!-- <li><code>description</code></li> -->
+             <li><code>relEntity</code></li>
+             <li><code>fkName</code></li>
+             <li><code>type</code></li>
+             <li><code>length</code></li>
+             <li><code>keysList</code> - list of Maps:
+               <ul>
+                 <li><code>row</code></li>
+                 <li><code>fieldName</code></li>
+                 <li><code>relFieldName</code></li>
+               </ul>
+             </li>
+           </ul>
+         </li>
+         <li><code>indexList</code> - list of Maps:
+           <ul>
+             <li><code>name</code></li>
+             <!-- <li><code>description</code></li> -->
+             <li><code>fieldNameList</code> - list of Strings</li>
+           </ul>
+         </li>
+       </ul>
+       </li></ul>
+     * */
+    public static Map getEntityRefData(DispatchContext dctx, Map context) {
+        GenericDelegator delegator = dctx.getDelegator();
+        Map resultMap = ServiceUtil.returnSuccess();
+        
+        ModelReader reader = delegator.getModelReader();
+        Map packages = new HashMap();
+        TreeSet packageNames = new TreeSet();
+        TreeSet tableNames = new TreeSet();
+        
+        //put the entityNames TreeSets in a HashMap by packageName
+        try {
+            Collection ec = reader.getEntityNames();
+            resultMap.put("numberOfEntities", ec.size());
+            TreeSet entityNames = new TreeSet(ec);
+            Iterator ecIter = ec.iterator();
+            while (ecIter.hasNext()) {
+                String eName = (String) ecIter.next();
+                ModelEntity ent = reader.getModelEntity(eName);
+                //make sure the table name is in the list of all table names, if not null
+                if (UtilValidate.isNotEmpty(ent.getPlainTableName())) {
+                    tableNames.add(ent.getPlainTableName());
+                }
+                TreeSet entities = (TreeSet) packages.get(ent.getPackageName());
+                if (entities == null) {
+                    entities = new TreeSet();
+                    packages.put(ent.getPackageName(), entities);
+                    packageNames.add(ent.getPackageName());
+                }
+                entities.add(eName);
+            }
+        } catch (GenericEntityException e) {
+            return ServiceUtil.returnError("ERROR: getting entity names: " + e.getMessage());
+        }
+        
+        String search = (String) context.get("search");
+        List packagesList = new ArrayList();
+        Iterator piter = packageNames.iterator();
+        try {
+            while (piter.hasNext()) {
+                Map packageMap = new HashMap();
+                String pName = (String) piter.next();
+                TreeSet entities = (TreeSet) packages.get(pName);
+                List entitiesList = new ArrayList();
+                Iterator i = entities.iterator();
+                while (i.hasNext()) {
+                    Map entityMap = new HashMap();
+                    String entityName = (String) i.next();
+                    String helperName = delegator.getEntityHelperName(entityName);
+                    String groupName = delegator.getEntityGroupName(entityName);
+                    if (search == null || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1) {
+                        ModelEntity entity = reader.getModelEntity(entityName);
+
+                        // fields list
+                        List javaNameList = new ArrayList();
+                        TreeSet ufields = new TreeSet();
+                        for (int y = 0; y < entity.getFieldsSize(); y++) {
+                            Map javaNameMap = new HashMap();
+                            ModelField field = entity.getField(y);
+                            ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+                            String javaName = null;
+                            javaNameMap.put("isPk", field.getIsPk());
+                            javaNameMap.put("name", field.getName());
+                            javaNameMap.put("colName", field.getColName());
+                            javaNameMap.put("description", field.getDescription());
+                            javaNameMap.put("type", (field.getType()) != null ? field.getType() : null);
+                            javaNameMap.put("javaType", (field.getType() != null && type != null) ? type.getJavaType() : "Undefined");
+                            javaNameMap.put("sqlType", (type != null && type.getSqlType() != null) ? type.getSqlType() : "Undefined");
+                            javaNameList.add(javaNameMap);
+                        }
+
+                        // relations list
+                        List relationsList = new ArrayList();
+                        for (int r = 0; r < entity.getRelationsSize(); r++) {
+                            Map relationMap = new HashMap();
+                            ModelRelation relation = entity.getRelation(r);
+                            List keysList = new ArrayList();
+                            for (int km = 0; km < relation.getKeyMapsSize(); km++) {
+                                Map keysMap = new HashMap();
+                                ModelKeyMap keyMap = relation.getKeyMap(km);
+                                String fieldName = null;
+                                String relFieldName = null;
+                                if (keyMap.getFieldName().equals(keyMap.getRelFieldName())) {
+                                    fieldName = keyMap.getFieldName();
+                                    relFieldName = "aa";
+                                } else {
+                                    fieldName = keyMap.getFieldName();
+                                    relFieldName = keyMap.getRelFieldName();
+                                }
+                                keysMap.put("row", km + 1);
+                                keysMap.put("fieldName", fieldName);
+                                keysMap.put("relFieldName", relFieldName);
+                                keysList.add(keysMap);
+                            }
+                            relationMap.put("title", relation.getTitle());
+                            //relationMap.put("description", relation.getDescription());
+                            relationMap.put("relEntity", relation.getRelEntityName());
+                            relationMap.put("fkName", relation.getFkName());
+                            relationMap.put("type", relation.getType());
+                            relationMap.put("length", relation.getType().length());
+                            relationMap.put("keysList", keysList);
+                            relationsList.add(relationMap);
+                        }
+
+                        // index list
+                        List indexList = new ArrayList();
+                        for (int r = 0; r < entity.getIndexesSize(); r++) {
+                            List fieldNameList = new ArrayList();
+                            
+                            ModelIndex index = entity.getIndex(r);
+                            for (Iterator fieldIterator = index.getIndexFieldsIterator(); fieldIterator.hasNext();) {
+                                fieldNameList.add((String) fieldIterator.next());
+                            }
+                            
+                            Map indexMap = new HashMap();
+                            indexMap.put("name", index.getName());
+                            //indexMap.put("description", index.getDescription());
+                            indexMap.put("fieldNameList", fieldNameList);
+                            indexList.add(indexMap);
+                        }
+                        
+                        entityMap.put("entityName", entityName);
+                        entityMap.put("helperName", helperName);
+                        entityMap.put("groupName", groupName);
+                        entityMap.put("plainTableName", entity.getPlainTableName());
+                        entityMap.put("title", entity.getTitle());
+                        entityMap.put("description", entity.getDescription());
+                        //entityMap.put("location", entity.getLocation());
+                        entityMap.put("javaNameList", javaNameList);
+                        entityMap.put("relationsList", relationsList);
+                        entityMap.put("indexList", indexList);
+                        entitiesList.add(entityMap);
+                    }
+                }
+                packageMap.put("packageName", pName);
+                packageMap.put("entitiesList", entitiesList);
+                packagesList.add(packageMap);
+            }
+        } catch (GenericEntityException e) {
+            return ServiceUtil.returnError("ERROR: getting entity info: " + e.getMessage());
+        }
+        
+        resultMap.put("packagesList", packagesList);
+        return resultMap;
+    }
+
+    /** Performs an entity maintenance security check. Returns hasPermission=true
+     * if the user has the ENTITY_MAINT permission.
+     * @param dctx
+     * @param context
+     * @return
+     */
+    public static Map entityMaintPermCheck(DispatchContext dctx, Map context) {
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        Locale locale = (Locale) context.get("locale");
+        Security security = dctx.getSecurity();
+        Map resultMap = null;
+        if (security.hasPermission("ENTITY_MAINT", userLogin)) {
+            resultMap = ServiceUtil.returnSuccess();
+            resultMap.put("hasPermission", true);
+        } else {
+            resultMap = ServiceUtil.returnFailure(UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsPermissionError", locale));
+            resultMap.put("hasPermission", false);
+        }
+        return resultMap;
     }
 }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefList.ftl?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefList.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefList.ftl Fri Nov  9 12:38:03 2007
@@ -16,67 +16,80 @@
 specific language governing permissions and limitations
 under the License.
 -->
-<html>
+<#assign docLangAttr = locale.toString()?replace("_", "-")>
+<#assign langDir = "ltr">
+<#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
+    <#assign langDir = "rtl">
+</#if>
+<html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>${uiLabelMap.WebtoolsEntityReference}</title>
         <style>
-          A.listtext {font-family: Helvetica,sans-serif; font-size: 10pt; font-weight: bold; text-decoration: none; color: blue;}
-          A.listtext:hover {color:red;}
+           body, textarea, input, select {font-family: Helvetica, sans-serif; background-color: #ffffff; text-decoration: none;}
+          .section-header {font-size: 10pt; font-weight: bold; color: #000000; padding-bottom: 10;}
+          .listtext {font-size: 10pt; font-weight: bold; color: blue;}
+          .listtext a {text-decoration: none;}
+          .listtext a:hover {color:red; text-decoration: underline;}
         </style>
     </head>
-    <body bgcolor="#FFFFFF">
-        <div align="left">
+    <body>
+        <div class='listtext'>
             <#if !forstatic>
                 <#assign encodeURLMain = response.encodeURL(controlPath + "/main")>
                 <#assign encodeURLRefMain = response.encodeURL(controlPath + "/view/entityref_main")>
                 <#assign encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb")>
                 <#assign encodeURLModelInduceFromDb = response.encodeURL(controlPath + "/view/ModelInduceFromDb")>
-                <a href="${encodeURLMain}" target='main' class='listtext'>${uiLabelMap.WebtoolsPopupWebToolsMain}</A><BR>
-                <a href="${encodeURLRefMain}" target="entityFrame" class='listtext'>${uiLabelMap.WebtoolsEntityReferenceMainPage}</A><BR>
-                <a href="${encodeURLCheckDb}" target="entityFrame" class='listtext'>${uiLabelMap.WebtoolsCheckUpdateDatabase}</A>
+                <a href="${encodeURLMain}" target='main'>${uiLabelMap.WebtoolsPopupWebToolsMain}</A><BR>
+                <a href="${encodeURLRefMain}" target="entityFrame">${uiLabelMap.WebtoolsEntityReferenceMainPage}</A><BR>
+                <a href="${encodeURLCheckDb}" target="entityFrame">${uiLabelMap.WebtoolsCheckUpdateDatabase}</A>
                 <hr/>
-                <!--
+                <#--
                 <#assign encodeURLModelWriter = response.encodeURL(controlPath + "/ModelWriter")>
                 <#assign encodeURLModelWriterSaveFile = response.encodeURL(controlPath + "/ModelWriter?savetofile=true")>
                 <#assign encodeURLModelGroupWriter = response.encodeURL(controlPath + "/ModelGroupWriter")>
                 <#assign encodeURLModelGroupWriterSaveFile = response.encodeURL(controlPath + "/ModelGroupWriter?savetofile=true")>
                 -->
-                <!-- want to leave these out because they are only working so-so, and cause people more problems that they solve, IMHO
-                <a href="${encodeURLModelWriter}" target='_blank' class='listtext'>Generate Entity Model XML (all in one)</A><BR>
-                <a href="${encodeURLModelWriterSaveFile}<%=response.encodeURL(controlPath + "/ModelWriter?savetofile=true")%>" target='_blank' class='listtext'>Save Entity Model XML to Files</A><BR>
+                <#-- want to leave these out because they are only working so-so, and cause people more problems that they solve, IMHO
+                <a href="${encodeURLModelWriter}" target='_blank'>Generate Entity Model XML (all in one)</A><BR>
+                <a href="${encodeURLModelWriterSaveFile}<%=response.encodeURL(controlPath + "/ModelWriter?savetofile=true")%>" target='_blank'>Save Entity Model XML to Files</A><BR>
                 -->
-                <!-- this is not working now anyway...
-                <a href="${encodeURLModelGroupWriter}<%=response.encodeURL(controlPath + "/ModelGroupWriter")%>" target='_blank' class='listtext'>Generate Entity Group XML</A><BR>
-                <a href="${encodeURLModelGroupWriterSaveFile}<%=response.encodeURL(controlPath + "/ModelGroupWriter?savetofile=true")%>" target='_blank' class='listtext'>Save Entity Group XML to File</A><BR>
+                <#-- this is not working now anyway...
+                <a href="${encodeURLModelGroupWriter}<%=response.encodeURL(controlPath + "/ModelGroupWriter")%>" target='_blank'>Generate Entity Group XML</A><BR>
+                <a href="${encodeURLModelGroupWriterSaveFile}<%=response.encodeURL(controlPath + "/ModelGroupWriter?savetofile=true")%>" target='_blank'>Save Entity Group XML to File</A><BR>
                 -->
-                <a href="${encodeURLModelInduceFromDb}" target='_blank' class='listtext'>${uiLabelMap.WebtoolsInduceModelXMLFromDatabase}</A><BR>
+                <a href="${encodeURLModelInduceFromDb}" target='_blank'>${uiLabelMap.WebtoolsInduceModelXMLFromDatabase}</A><BR>
+            </#if>
+            <#if packageNames?has_content>
                 <hr/>
-            </#if>            
-            <#list packageNames as packageName>
-                <#if forstatic>
-                    <a href="entityref_main.html#${packageName}" target="entityFrame" class='listtext'>${packageName}</a><br/>
-                <#else>
-                    <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + packageName)>
-                    <a href="${encodeURL}" target="entityFrame" class='listtext'>${packageName}</a><br/>
-                </#if>
-            </#list>
-            <hr/>
-            <#list entitiesList as entity>
-                <#if forstatic>
-                    <#assign encodeURL = response.encodeURL(controlPath + "entityref_main#" + entity.entityName)>
-                    <a href="${encodeURL}" target="entityFrame" class='listtext'>${entity.entityName}</a>
-                <#else>
-                    <#if entity.url?has_content>
-                        <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + entity.entityName)>
-                    <#else/>
-                        <#-- I don't know about this entity.url stuff, but before cleaning things up here that is where the undefined url variable was -->
-                        <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + entity.entityName + entity.url)>
+                <div class="section-header">${uiLabelMap.WebtoolsEntityPackages}</div>
+                <#list packageNames as packageName>
+                    <#if forstatic>
+                        <a href="entityref_main.html#${packageName}" target="entityFrame">${packageName}</a><br/>
+                    <#else>
+                        <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + packageName)>
+                        <a href="${encodeURL}" target="entityFrame">${packageName}</a><br/>
                     </#if>
-                    <a href="${encodeURL}" target="entityFrame" class='listtext'>${entity.entityName}</a>
-                </#if>
-                <br/>
-            </#list>
-            <br/>
+                </#list>
+            </#if>
+            <#if entitiesList?has_content>
+                <hr/>
+                <div class="section-header">${uiLabelMap.WebtoolsEntitiesAlpha}</div>
+                <#list entitiesList as entity>
+                    <#if forstatic>
+                        <#assign encodeURL = response.encodeURL(controlPath + "entityref_main#" + entity.entityName)>
+                        <a href="${encodeURL}" target="entityFrame">${entity.entityName}</a>
+                    <#else>
+                        <#if entity.url?has_content>
+                            <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + entity.entityName)>
+                        <#else/>
+                            <#-- I don't know about this entity.url stuff, but before cleaning things up here that is where the undefined url variable was -->
+                            <#assign encodeURL = response.encodeURL(controlPath + "/view/entityref_main#" + entity.entityName + entity.url)>
+                        </#if>
+                        <a href="${encodeURL}" target="entityFrame">${entity.entityName}</a>
+                    </#if>
+                    <br/>
+                </#list>
+            </#if>
         </div>
     </body>
 </html>

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefMain.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefMain.ftl?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefMain.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/entity/EntityRefMain.ftl Fri Nov  9 12:38:03 2007
@@ -21,7 +21,10 @@
 <#if "ar.iw"?contains(docLangAttr?substring(0, 2))>
     <#assign langDir = "rtl">
 </#if>
-
+<#assign forstatic = false/>
+<#if (parameters.forstatic)?default("false") == "true">
+  <#assign forstatic = true/>
+</#if>
 <html lang="${docLangAttr}" dir="${langDir}" xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>${uiLabelMap.WebtoolsEntityReference}</title>
@@ -59,7 +62,7 @@
                                 <#if entity.plainTableName?has_content>  | ${uiLabelMap.WebtoolsTable}: ${entity.plainTableName}</#if>
                             </div>
                             <div>${entity.title}&nbsp;
-                                <#if !forstatic>
+                                <#if (parameters.forstatic)?default("false") == "false">
                                     <#assign encodeURL = response.encodeURL(controlPath + "/FindGeneric?entityName=" + entity.entityName + "&find=true&VIEW_SIZE=50&VIEW_INDEX=0")>
                                     <a target='main' href="${encodeURL}">[${uiLabelMap.WebtoolsViewData}]</a>
                                 </#if>

Modified: ofbiz/trunk/framework/webtools/widget/EntityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/EntityScreens.xml?rev=593644&r1=593643&r2=593644&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/EntityScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/EntityScreens.xml Fri Nov  9 12:38:03 2007
@@ -255,7 +255,7 @@
             </condition>
             <actions>
                 <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
-                <set field="titleProperty" value="WebtoolsEntityReferenceChart"/>          
+                <set field="titleProperty" value="WebtoolsEntityReferenceChart"/>
                 <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRef.bsh"/>                            
             </actions>
             <widgets>
@@ -282,7 +282,9 @@
             <actions>
                 <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="titleProperty" value="WebtoolsEntityReferenceChart"/>          
-                <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefMain.bsh"/>                            
+                <service service-name="getEntityRefData" result-map-name="result"/>
+                <set field="numberOfEntities" from-field="result.numberOfEntities"/>
+                <set field="packagesList" from-field="result.packagesList"/>
             </actions>
             <widgets>
                 <section>
@@ -307,8 +309,8 @@
             </condition>
             <actions>
                 <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap" global="true"/>
-                <set field="titleProperty" value="WebtoolsEntityReference"/>          
-                <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.bsh"/>                            
+                <set field="titleProperty" value="WebtoolsEntityReference"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/entity/EntityRefList.bsh"/>
             </actions>
             <widgets>
                 <section>