Re: svn commit: r1783427 - in /ofbiz/ofbiz-framework/trunk/framework/webtools: groovyScripts/entity/ template/entity/ widget/

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

Re: svn commit: r1783427 - in /ofbiz/ofbiz-framework/trunk/framework/webtools: groovyScripts/entity/ template/entity/ widget/

Jacques Le Roux
Administrator
Hi Nicolas,

Not totally sure, but it seems it would be good if you could put the svn config file in the right place.

This to possibly avoid all those false changes below. If you did, forget it, it's something else and I don't know what). Else see the committers wiki
page for more...

Thanks

Jacques


Le 17/02/2017 à 18:00, [hidden email] a écrit :

> Author: nmalin
> Date: Fri Feb 17 17:00:31 2017
> New Revision: 1783427
>
> URL: http://svn.apache.org/viewvc?rev=1783427&view=rev
> Log:
> Improved: Improve FindGeneric entity screen with xml form (OFBIZ-9217)
> Replace the current groovy and ftl form rendering by a dynamic call to screen xml with build the xml form by analyse the entity
> The find operation is now realize by the perfomFind service
>
> Modified:
>      ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>      ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>      ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy Fri Feb 17 17:00:31 2017
> @@ -17,240 +17,92 @@
>    * under the License.
>    */
>  
> -import org.apache.ofbiz.base.util.UtilMisc
> -import org.apache.ofbiz.entity.Delegator
> -import org.apache.ofbiz.entity.GenericValue
> +import org.apache.ofbiz.base.util.Debug
> +import org.apache.ofbiz.base.util.UtilValidate
> +import org.apache.ofbiz.base.util.UtilProperties
> +import org.apache.ofbiz.base.util.UtilXml
>   import org.apache.ofbiz.entity.GenericEntityException
> -import org.apache.ofbiz.security.Security
> -import org.apache.ofbiz.entity.model.ModelReader
>   import org.apache.ofbiz.entity.model.ModelEntity
> -import org.apache.ofbiz.entity.model.ModelViewEntity
> -import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
> -import org.apache.ofbiz.entity.model.ModelField
>   import org.apache.ofbiz.entity.model.ModelFieldType
> -import org.apache.ofbiz.entity.GenericEntity
> -import org.apache.ofbiz.base.util.UtilFormatOut
> -import org.apache.ofbiz.base.util.UtilProperties
> -import org.apache.ofbiz.entity.condition.EntityExpr
> -import org.apache.ofbiz.entity.condition.EntityCondition
> -import org.apache.ofbiz.entity.condition.EntityConditionList
> -import org.apache.ofbiz.entity.condition.EntityFieldMap
> -import org.apache.ofbiz.entity.condition.EntityOperator
> -import org.apache.ofbiz.entity.transaction.TransactionUtil
> -import org.apache.ofbiz.entity.util.EntityFindOptions
> -import org.apache.ofbiz.entity.util.EntityListIterator
> -import org.apache.ofbiz.entity.util.EntityUtilProperties
> -import org.apache.ofbiz.base.util.Debug
> -import java.sql.Timestamp
> -import java.sql.Date
> -import java.sql.Time
> -
> -entityName = parameters.entityName
> -
> -ModelReader reader = delegator.getModelReader()
> -ModelEntity modelEntity = reader.getModelEntity(entityName)
> -
> -groupByFields = []
> -functionFields = []
> -
> -if (modelEntity instanceof ModelViewEntity) {
> -    aliases = modelEntity.getAliasesCopy()
> -    for (ModelAlias alias : aliases) {
> -        if (alias.getGroupBy()) {
> -            groupByFields.add(alias.getName())
> -        } else if (alias.getFunction()) {
> -            functionFields.add(alias.getName())
> -        }
> -    }
> -}
> -
> -context.entityName = modelEntity.getEntityName()
> -context.plainTableName = modelEntity.getPlainTableName()
> -
> -String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N"
> -String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N"
> -String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N"
> -String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N"
> -
> -context.hasViewPermission = hasViewPermission
> -context.hasCreatePermission = hasCreatePermission
> -context.hasUpdatePermission = hasUpdatePermission
> -context.hasDeletePermission = hasDeletePermission
> -
> -String find = parameters.find
> -if (find == null) {
> -    find = "false"
> -}
> -
> -String curFindString = "entityName=" + entityName + "&find=" + find
> -
> -GenericEntity findByEntity = delegator.makeValue(entityName)
> -List errMsgList = []
> -Iterator fieldIterator = modelEntity.getFieldsIterator()
> -while (fieldIterator.hasNext()) {
> -    ModelField field = fieldIterator.next()
> -    String fval = parameters.get(field.getName())
> -    if (fval != null) {
> -        if (fval.length() > 0) {
> -            curFindString = curFindString + "&" + field.getName() + "=" + fval
> -            try {
> -                findByEntity.setString(field.getName(), fval)
> -            } catch (NumberFormatException nfe) {
> -                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy")
> -                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
> -            }
> -        }
> -    }
> -}
> -if (errMsgList) {
> -    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
> -}
> -
> -curFindString = UtilFormatOut.encodeQuery(curFindString)
> -context.curFindString = curFindString
> -
> -try {
> -    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
> -} catch (NumberFormatException nfe) {
> -    viewIndex = 0
> -}
> -
> -context.viewIndexFirst = 0
> -context.viewIndex = viewIndex
> -context.viewIndexPrevious = viewIndex-1
> -context.viewIndexNext = viewIndex+1
> +import org.apache.ofbiz.entity.model.ModelReader
> +import org.apache.ofbiz.widget.model.FormFactory
> +import org.apache.ofbiz.widget.model.ModelForm
> +import org.apache.ofbiz.widget.renderer.FormRenderer
> +import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
> +import org.w3c.dom.Document
>  
> +ModelEntity modelEntity = null
>   try {
> -    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
> -} catch (NumberFormatException nfe) {
> -    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue()
> -}
> -
> -context.viewSize = viewSize
> -
> -int lowIndex = viewIndex*viewSize+1
> -int highIndex = (viewIndex+1)*viewSize
> -context.lowIndex = lowIndex
> -
> -int arraySize = 0
> -List resultPartialList = null
> -
> -if ("true".equals(find)) {
> -    //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
> -
> -    // small variation to support LIKE if a wildcard (%) is found in a String
> -    conditionList = []
> -    findByKeySet = findByEntity.keySet()
> -    fbksIter = findByKeySet.iterator()
> -    while (fbksIter.hasNext()) {
> -        findByKey = fbksIter.next()
> -        if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
> -            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)))
> -        } else {
> -            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)))
> -        }
> -    }
> -    condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
> -
> -    if ((highIndex - lowIndex + 1) > 0) {
> -        boolean beganTransaction = false
> -        try {
> -            beganTransaction = TransactionUtil.begin()
> -
> -            EntityFindOptions efo = new EntityFindOptions()
> -            efo.setMaxRows(highIndex)
> -            efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
> -            EntityListIterator resultEli = null
> -            fieldsToSelect = null
> -
> -            if (groupByFields || functionFields) {
> -                fieldsToSelect = [] as Set
> -
> -                for (String groupByField : groupByFields) {
> -                    fieldsToSelect.add(groupByField)
> -                }
> -
> -                for (String functionField : functionFields) {
> -                    fieldsToSelect.add(functionField)
> -                }
> +    modelEntity = delegator.getModelEntity(parameters.entityName)
> +} catch(GenericEntityException e) {
> +    Debug.logError("The entityName " + parameters.entityName + " is not found", "FindGeneric.groovy")
> +}
> +
> +if (modelEntity) {
> +    entityName = modelEntity.entityName
> +    context.entityName = entityName
> +    ModelReader entityModelReader = delegator.getModelReader()
> +    //create the search form with auto-fields-entity
> +    String dynamicAutoEntityFieldSearchForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
> +            '<form name="FindGeneric" type="single" target="FindGeneric">' +
> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
> +            '<field name="noConditionFind"><hidden value="Y"/></field>' +
> +            '<field name="searchOptions_collapsed" ><hidden value="true"/></field>' +
> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
> +            '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) + '"><submit/></field>'
> +
> +    //call modelEntity to complete information on the field type
> +    modelEntity.getFieldsUnmodifiable().each {
> +        modelField ->
> +            if (! modelEntity.getAutomaticFieldNames().contains(modelField.name)) {
> +                ModelFieldType type = delegator.getEntityFieldType(modelEntity, modelField.getType())
> +                dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm +
> +                        '<field name="' + modelField.name + '" tooltip="' +
> +                        (modelField.getIsPk() ? "* " : " ") +
> +                        modelField.getType() + " (${type.getJavaType()} - ${type.getSqlType()})" +
> +                        '"/>'
>               }
> -            Collection pkNames = []
> -            Iterator iter = modelEntity.getPksIterator()
> -            while (iter != null && iter.hasNext()) {
> -                ModelField curField = (ModelField) iter.next()
> -                pkNames.add(curField.getName())
> -            }
> -            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo)
> -            resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1)
> -
> -            arraySize = resultEli.getResultsSizeAfterPartialList()
> -            if (arraySize < highIndex) {
> -                highIndex = arraySize
> -            }
> -
> -            resultEli.close()
> -        } catch (GenericEntityException e) {
> -            Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy")
> -            try {
> -                // only rollback the transaction if we started one...
> -                TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
> -            } catch (GenericEntityException e2) {
> -                Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy")
> -            }
> -            // after rolling back, rethrow the exception
> -            throw e
> -        } finally {
> -            // only commit the transaction if we started one... this will throw an exception if it fails
> -            TransactionUtil.commit(beganTransaction)
> -        }
>       }
> -}
> -context.highIndex = highIndex
> -context.arraySize = arraySize
> -context.resultPartialList = resultPartialList
> -
> -viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
> -context.viewIndexLast = viewIndexLast
> -
> -List fieldList = []
> -fieldIterator = modelEntity.getFieldsIterator()
> -while (fieldIterator.hasNext()) {
> -    ModelField field = fieldIterator.next()
> -    ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType())
> -
> -    Map fieldMap = [:]
> -    fieldMap.put("name", field.getName())
> -    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
> -    fieldMap.put("javaType", type.getJavaType())
> -    fieldMap.put("sqlType", type.getSqlType())
> -    fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""))
> -
> -    fieldList.add(fieldMap)
> -}
> -context.fieldList = fieldList
> -context.columnCount = fieldList.size()+2
> -
> -List records = []
> -if (resultPartialList != null) {
> -    Iterator resultPartialIter = resultPartialList.iterator()
> -    while (resultPartialIter.hasNext()) {
> -        Map record = [:]
> -
> -        GenericValue value = (GenericValue)resultPartialIter.next()
> -        String findString = "entityName=" + entityName
> -        Iterator pkIterator = modelEntity.getPksIterator()
> -        while (pkIterator.hasNext()) {
> -            ModelField pkField = pkIterator.next()
> -            ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType())
> -            findString += "&" + pkField.getName() + "=" + value.get(pkField.getName())
> -        }
> -        record.put("findString", findString)
> +    dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm + '</form></forms>'
> +    Document dynamicAutoEntityFieldSearchFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldSearchForm, true, true)
> +    Map<String, ModelForm> modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldSearchFormXml, entityModelReader, dispatcher.getDispatchContext(), null)
> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
> +        modelForm = entry.getValue()
> +    }
>  
> -        record.put("fields", value)
> -        records.add(record)
> +    MacroFormRenderer renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
> +    FormRenderer dynamicAutoEntitySearchFormRenderer = new FormRenderer(modelForm, renderer)
> +    Writer writer = new StringWriter()
> +    dynamicAutoEntitySearchFormRenderer.render(writer, context)
> +    context.dynamicAutoEntitySearchForm = writer
> +
> +    //prepare the result list from performFind
> +    String dynamicAutoEntityFieldListForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
> +            '<form name="ListGeneric" type="list" target="FindGeneric" list-name="listIt" ' +
> +            '  odd-row-style="alternate-row" default-table-style="basic-table light-grid hover-bar">' +
> +            '<actions><service service-name="performFind">' +
> +            '<field-map field-name="inputFields" from-field="parameters"/>' +
> +            '<field-map field-name="entityName" value="' + entityName + '"/>' +
> +            '</service></actions>' +
> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="display"/>' +
> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
> +            '<field name="viewGeneric" title=" "><hyperlink target="ViewGeneric" description="view">' +
> +            '    <auto-parameters-entity entity-name="' + entityName + '"/>' +
> +            '    <parameter param-name="entityName" value="' + entityName + '"/>' +
> +            '</hyperlink></field>' +
> +            '<sort-order><sort-field name="viewGeneric"/></sort-order>' +
> +            '</form></forms>'
> +    //Debug.logInfo(dynamicAutoEntityFieldForm, "")
> +    Document dynamicAutoEntityFieldListFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldListForm, true, true)
> +    modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldListFormXml, entityModelReader, dispatcher.getDispatchContext(), null)
> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
> +        modelForm = entry.getValue()
>       }
> -}
> -context.records = records
> -context.lowCount = lowIndex
> -context.highCount = lowIndex + records.size() - 1
> -context.total = arraySize
> +    renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
> +    FormRenderer dynamicAutoEntityListFormRenderer = new FormRenderer(modelForm, renderer)
> +    Writer writerList = new StringWriter()
> +    dynamicAutoEntityListFormRenderer.render(writerList, context)
> +    context.dynamicAutoEntityListForm = writerList
> +}
> \ No newline at end of file
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl Fri Feb 17 17:00:31 2017
> @@ -83,7 +83,7 @@ under the License.
>                   <#if entity.entityPermissionView == 'Y'>
>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsReln}</a>
>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsFind}</a>
> -                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>                   </#if>
>                 <#else>
>                   <#if entity.entityPermissionCreate == 'Y'>
> @@ -92,7 +92,7 @@ under the License.
>                   <#if entity.entityPermissionView == 'Y'>
>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>' title='${uiLabelMap.WebtoolsViewRelations}'>${uiLabelMap.WebtoolsReln}</a>
>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>' title='${uiLabelMap.WebtoolsFindRecord}'>${uiLabelMap.WebtoolsFind}</a>
> -                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>' title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>' title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>                   </#if>
>                 </#if>
>               </td>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl Fri Feb 17 17:00:31 2017
> @@ -63,7 +63,7 @@ under the License.
>                               </div>
>                               <div>${entity.title}&nbsp;
>                                   <#if !forstatic>
> -                                    <a target='main' href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
> +                                    <a target='main' href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>                                   </#if>
>                                   <#if !forstatic>
>                                       <a target='main' href="<@ofbizUrl>ArtifactInfo?name=${entity.entityName}&amp;type=entity</@ofbizUrl>">[${uiLabelMap.WebtoolsArtifactInfo}]</a>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl Fri Feb 17 17:00:31 2017
> @@ -16,27 +16,6 @@ KIND, either express or implied.  See th
>   specific language governing permissions and limitations
>   under the License.
>   -->
> -        <form method="post" action="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>">
> -          <input type="hidden" name="find" value="true"/>
> -          <input type="hidden" name="searchOptions_collapsed" value="true"/>
> -          <table class="basic-table" cellspacing="0">
> -            <tr class="header-row-2">
> -              <td>${uiLabelMap.WebtoolsFieldName}</td>
> -              <td>${uiLabelMap.WebtoolsPk}</td>
> -              <td>${uiLabelMap.WebtoolsFieldType}</td>
> -              <td>&nbsp;</td>
> -            </tr>
> -            <#list fieldList as field>
> -                <tr>
> -                    <td>${field.name}</td>
> -                    <td><#if field.isPk == 'Y'>*</#if></td>
> -                    <td>${field.javaType},&nbsp;${field.sqlType}</td>
> -                    <td><input type="text" name="${field.name}" value="${field.param}" size="40"/></td>
> -                </tr>
> -            </#list>
> -                <tr>
> -                    <td colspan="3"><h3>${uiLabelMap.WebtoolsToFindAll} ${entityName}, ${uiLabelMap.WebtoolsLeaveAllEntriesBlank}</h3></td>
> -                    <td><input type="submit" value="${uiLabelMap.CommonFind}"/></td>
> -                </tr>
> -            </table>
> -        </form>
> +    <#if entityName?has_content>
> +        ${dynamicAutoEntitySearchForm?string}
> +    </#if>
> \ No newline at end of file
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl Fri Feb 17 17:00:31 2017
> @@ -16,42 +16,8 @@ KIND, either express or implied.  See th
>   specific language governing permissions and limitations
>   under the License.
>   -->
> -        <#if (arraySize > 0)>
> -            <#assign commonUrl="FindGeneric?${curFindString}&amp;searchOptions_collapsed=${(parameters.searchOptions_collapsed)?default(\"false\")}&amp;"/>
> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex commonDisplaying=commonDisplaying/>
> -        </#if>
> -          <table class="basic-table hover-bar" cellspacing="0">
> -            <tr class="header-row-2">
> -                <td>&nbsp;</td>
> -                <#list fieldList as field>
> -                    <td>${field.name}</td>
> -                </#list>
> -            </tr>
> -            <#if resultPartialList?has_content>
> -                <#assign alt_row = false>
> -                <#list records as record>
> -                    <tr<#if alt_row> class="alternate-row"</#if>>
> -                        <td class="button-col">
> -                            <a href='<@ofbizUrl>ViewGeneric?${record.findString}</@ofbizUrl>'>${uiLabelMap.CommonView}</a>
> -                        <#if hasDeletePermission == 'Y'>
> -                            <a onclick="return confirm ('${uiLabelMap.WebtoolsConfirmDelete}')" href='<@ofbizUrl>UpdateGeneric?${record.findString}&amp;UPDATE_MODE=DELETE</@ofbizUrl>'>${uiLabelMap.CommonDelete}</a>
> -                        </#if>
> -                        </td>
> -                        <#list fieldList as field>
> -                            <td>${Static["org.apache.ofbiz.base.util.UtilFormatOut"].makeString(record.fields.get(field.name))}</td>
> -                            <#-- <td>${record.fields.get(field.name)!?string}</td> -->
> -                        </#list>
> -                    </tr>
> -                    <#assign alt_row = !alt_row>
> -                </#list>
> -            <#else>
> -                <tr>
> -                    <td colspan="${columnCount}">
> -                        <h2>${uiLabelMap.WebtoolsNoEntityRecordsFound} ${entityName}.</h2>
> -                    </td>
> -                </tr>
> -            </#if>
> -        </table>
> -        <#if (arraySize > 0)>
> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex  highIndex=highIndex />
> -        </#if>
> +    <#if entityName?has_content>
> +        ${dynamicAutoEntityListForm?string}
> +    <#else>
> +        ${uiLabelMap['genericWebEvent.entity_name_not_specified']}
> +    </#if>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl Fri Feb 17 17:00:31 2017
> @@ -50,7 +50,7 @@ function ShowTab(lname) {
>       <h2>${uiLabelMap.WebtoolsWithPk}: ${findByPk}</h2>
>       <br />
>       <div class="button-bar">
> -      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>' class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
> +      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;noConditionFind=Y</@ofbizUrl>' class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>         <#if enableEdit = "false">
>           <#if hasCreatePermission>
>             <a href='<@ofbizUrl>ViewGeneric?entityName=${entityName}&amp;enableEdit=true</@ofbizUrl>' class="buttontext create">${uiLabelMap.CommonCreateNew}</a>
> @@ -228,7 +228,7 @@ function ShowTab(lname) {
>               <div class="screenlet-title-bar">
>                 <ul>
>                   <li class="h3">${uiLabelMap.WebtoolsRelatedEntity}: ${relation.title}${relation.relatedTable} (${relation.type})</li>
> -                <li><a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
> +                <li><a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>                   <#if relation.valueRelated?has_content>
>                     <li><a href="<@ofbizUrl>ViewGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonView}</a></li>
>                   </#if>
> @@ -257,7 +257,7 @@ function ShowTab(lname) {
>                 <#if "one" = relation.type>
>                 <b>${uiLabelMap.WebtoolsNoValueFoundFor}</b> ${relation.title}${relation.relatedTable}.
>                 <#else>
> -              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonFind}</a>
> +              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonFind}</a>
>                 </#if>
>               </#if>
>             </div>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl Fri Feb 17 17:00:31 2017
> @@ -29,7 +29,7 @@ under the License.
>           <h2>${uiLabelMap.WebtoolsForEntity}: ${entityName}</h2>
>           <br />
>           <div class="button-bar">
> -            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>" class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
> +            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>           </div>
>           <br />
>           <table class="basic-table hover-bar" cellspacing="0">
> @@ -44,7 +44,7 @@ under the License.
>               <#list relations as relation>
>                   <tr<#if alt_row> class="alternate-row"</#if>>
>                       <td>${relation.title}</td>
> -                    <td class="button-col"><a href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${relation.relEntityName}</a></td>
> +                    <td class="button-col"><a href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}</@ofbizUrl>'>${relation.relEntityName}</a></td>
>                       <td>${relation.type}</td>
>                       <td>${relation.fkName}</td>
>                       <td>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml Fri Feb 17 17:00:31 2017
> @@ -194,6 +194,7 @@ under the License.
>                   <if-has-permission permission="ENTITY_MAINT"/>
>               </condition>
>               <actions>
> +                <property-map resource="WebtoolsErrorUiLabels" map-name="uiLabelMap"/>
>                   <script location="component://webtools/groovyScripts/entity/FindGeneric.groovy"/>
>                   <property-map resource="CommonUiLabels" map-name="uiLabelMap"/>
>                   <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap"/>
> @@ -209,10 +210,10 @@ under the License.
>                                   <container style="button-bar button-style-1">
>                                       <link target="entitymaint" text="${uiLabelMap.WebtoolsBackToEntityList}"/>
>                                       <link target="ViewRelations" text="${uiLabelMap.WebtoolsViewRelations}">
> -                                        <parameter param-name="entityName" from-field="entityName"/>
> +                                        <parameter param-name="entityName"/>
>                                       </link>
>                                       <link target="ViewGeneric" text="${uiLabelMap.CommonCreateNew}" style="create">
> -                                        <parameter param-name="entityName" from-field="entityName"/>
> +                                        <parameter param-name="entityName"/>
>                                           <parameter param-name="enableEdit" value="true"/>
>                                       </link>
>                                   </container>
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
> ==============================================================================
> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml Fri Feb 17 17:00:31 2017
> @@ -242,7 +242,7 @@ under the License.
>           <menu-item name="all" title="${uiLabelMap.WebtoolsAll}">
>               <link target="FindGeneric">
>                   <parameter param-name="entityName"/>
> -                <parameter param-name="find" value="true"/>
> +                <parameter param-name="noConditionFind" value="Y"/>
>               </link>
>           </menu-item>
>       </menu>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1783427 - in /ofbiz/ofbiz-framework/trunk/framework/webtools: groovyScripts/entity/ template/entity/ widget/

Jacques Le Roux
Administrator
Nicolas,

OK Forget it, viewing your patch at OFBIZ-9217 I saw some properties set. But when you committed I saw no properties and wondered

But all the files you committed already existed, had the properties already set. So in both cases it's OK.

Anyway with the *svn:auto-props* set on the OFBiz "repo" http://svn.apache.org/viewvc/ofbiz/ we no longer have to worry about that. Just that for the
rest (no *auto-props) *it's better to have the svn config ready and I suppose you have it has the patch shows

Jacques


Le 18/02/2017 à 10:17, Jacques Le Roux a écrit :

> Hi Nicolas,
>
> Not totally sure, but it seems it would be good if you could put the svn config file in the right place.
>
> This to possibly avoid all those false changes below. If you did, forget it, it's something else and I don't know what). Else see the committers
> wiki page for more...
>
> Thanks
>
> Jacques
>
>
> Le 17/02/2017 à 18:00, [hidden email] a écrit :
>> Author: nmalin
>> Date: Fri Feb 17 17:00:31 2017
>> New Revision: 1783427
>>
>> URL: http://svn.apache.org/viewvc?rev=1783427&view=rev
>> Log:
>> Improved: Improve FindGeneric entity screen with xml form (OFBIZ-9217)
>> Replace the current groovy and ftl form rendering by a dynamic call to screen xml with build the xml form by analyse the entity
>> The find operation is now realize by the perfomFind service
>>
>> Modified:
>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy Fri Feb 17 17:00:31 2017
>> @@ -17,240 +17,92 @@
>>    * under the License.
>>    */
>>   -import org.apache.ofbiz.base.util.UtilMisc
>> -import org.apache.ofbiz.entity.Delegator
>> -import org.apache.ofbiz.entity.GenericValue
>> +import org.apache.ofbiz.base.util.Debug
>> +import org.apache.ofbiz.base.util.UtilValidate
>> +import org.apache.ofbiz.base.util.UtilProperties
>> +import org.apache.ofbiz.base.util.UtilXml
>>   import org.apache.ofbiz.entity.GenericEntityException
>> -import org.apache.ofbiz.security.Security
>> -import org.apache.ofbiz.entity.model.ModelReader
>>   import org.apache.ofbiz.entity.model.ModelEntity
>> -import org.apache.ofbiz.entity.model.ModelViewEntity
>> -import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
>> -import org.apache.ofbiz.entity.model.ModelField
>>   import org.apache.ofbiz.entity.model.ModelFieldType
>> -import org.apache.ofbiz.entity.GenericEntity
>> -import org.apache.ofbiz.base.util.UtilFormatOut
>> -import org.apache.ofbiz.base.util.UtilProperties
>> -import org.apache.ofbiz.entity.condition.EntityExpr
>> -import org.apache.ofbiz.entity.condition.EntityCondition
>> -import org.apache.ofbiz.entity.condition.EntityConditionList
>> -import org.apache.ofbiz.entity.condition.EntityFieldMap
>> -import org.apache.ofbiz.entity.condition.EntityOperator
>> -import org.apache.ofbiz.entity.transaction.TransactionUtil
>> -import org.apache.ofbiz.entity.util.EntityFindOptions
>> -import org.apache.ofbiz.entity.util.EntityListIterator
>> -import org.apache.ofbiz.entity.util.EntityUtilProperties
>> -import org.apache.ofbiz.base.util.Debug
>> -import java.sql.Timestamp
>> -import java.sql.Date
>> -import java.sql.Time
>> -
>> -entityName = parameters.entityName
>> -
>> -ModelReader reader = delegator.getModelReader()
>> -ModelEntity modelEntity = reader.getModelEntity(entityName)
>> -
>> -groupByFields = []
>> -functionFields = []
>> -
>> -if (modelEntity instanceof ModelViewEntity) {
>> -    aliases = modelEntity.getAliasesCopy()
>> -    for (ModelAlias alias : aliases) {
>> -        if (alias.getGroupBy()) {
>> -            groupByFields.add(alias.getName())
>> -        } else if (alias.getFunction()) {
>> -            functionFields.add(alias.getName())
>> -        }
>> -    }
>> -}
>> -
>> -context.entityName = modelEntity.getEntityName()
>> -context.plainTableName = modelEntity.getPlainTableName()
>> -
>> -String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) ||
>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N"
>> -String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) ||
>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N"
>> -String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) ||
>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N"
>> -String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) ||
>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N"
>> -
>> -context.hasViewPermission = hasViewPermission
>> -context.hasCreatePermission = hasCreatePermission
>> -context.hasUpdatePermission = hasUpdatePermission
>> -context.hasDeletePermission = hasDeletePermission
>> -
>> -String find = parameters.find
>> -if (find == null) {
>> -    find = "false"
>> -}
>> -
>> -String curFindString = "entityName=" + entityName + "&find=" + find
>> -
>> -GenericEntity findByEntity = delegator.makeValue(entityName)
>> -List errMsgList = []
>> -Iterator fieldIterator = modelEntity.getFieldsIterator()
>> -while (fieldIterator.hasNext()) {
>> -    ModelField field = fieldIterator.next()
>> -    String fval = parameters.get(field.getName())
>> -    if (fval != null) {
>> -        if (fval.length() > 0) {
>> -            curFindString = curFindString + "&" + field.getName() + "=" + fval
>> -            try {
>> -                findByEntity.setString(field.getName(), fval)
>> -            } catch (NumberFormatException nfe) {
>> -                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy")
>> -                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
>> -            }
>> -        }
>> -    }
>> -}
>> -if (errMsgList) {
>> -    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
>> -}
>> -
>> -curFindString = UtilFormatOut.encodeQuery(curFindString)
>> -context.curFindString = curFindString
>> -
>> -try {
>> -    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
>> -} catch (NumberFormatException nfe) {
>> -    viewIndex = 0
>> -}
>> -
>> -context.viewIndexFirst = 0
>> -context.viewIndex = viewIndex
>> -context.viewIndexPrevious = viewIndex-1
>> -context.viewIndexNext = viewIndex+1
>> +import org.apache.ofbiz.entity.model.ModelReader
>> +import org.apache.ofbiz.widget.model.FormFactory
>> +import org.apache.ofbiz.widget.model.ModelForm
>> +import org.apache.ofbiz.widget.renderer.FormRenderer
>> +import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
>> +import org.w3c.dom.Document
>>   +ModelEntity modelEntity = null
>>   try {
>> -    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
>> -} catch (NumberFormatException nfe) {
>> -    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue()
>> -}
>> -
>> -context.viewSize = viewSize
>> -
>> -int lowIndex = viewIndex*viewSize+1
>> -int highIndex = (viewIndex+1)*viewSize
>> -context.lowIndex = lowIndex
>> -
>> -int arraySize = 0
>> -List resultPartialList = null
>> -
>> -if ("true".equals(find)) {
>> -    //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
>> -
>> -    // small variation to support LIKE if a wildcard (%) is found in a String
>> -    conditionList = []
>> -    findByKeySet = findByEntity.keySet()
>> -    fbksIter = findByKeySet.iterator()
>> -    while (fbksIter.hasNext()) {
>> -        findByKey = fbksIter.next()
>> -        if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
>> - conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)))
>> -        } else {
>> - conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)))
>> -        }
>> -    }
>> -    condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
>> -
>> -    if ((highIndex - lowIndex + 1) > 0) {
>> -        boolean beganTransaction = false
>> -        try {
>> -            beganTransaction = TransactionUtil.begin()
>> -
>> -            EntityFindOptions efo = new EntityFindOptions()
>> -            efo.setMaxRows(highIndex)
>> - efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
>> -            EntityListIterator resultEli = null
>> -            fieldsToSelect = null
>> -
>> -            if (groupByFields || functionFields) {
>> -                fieldsToSelect = [] as Set
>> -
>> -                for (String groupByField : groupByFields) {
>> -                    fieldsToSelect.add(groupByField)
>> -                }
>> -
>> -                for (String functionField : functionFields) {
>> -                    fieldsToSelect.add(functionField)
>> -                }
>> +    modelEntity = delegator.getModelEntity(parameters.entityName)
>> +} catch(GenericEntityException e) {
>> +    Debug.logError("The entityName " + parameters.entityName + " is not found", "FindGeneric.groovy")
>> +}
>> +
>> +if (modelEntity) {
>> +    entityName = modelEntity.entityName
>> +    context.entityName = entityName
>> +    ModelReader entityModelReader = delegator.getModelReader()
>> +    //create the search form with auto-fields-entity
>> +    String dynamicAutoEntityFieldSearchForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>> +            '<form name="FindGeneric" type="single" target="FindGeneric">' +
>> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
>> +            '<field name="noConditionFind"><hidden value="Y"/></field>' +
>> +            '<field name="searchOptions_collapsed" ><hidden value="true"/></field>' +
>> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
>> +            '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) +
>> '"><submit/></field>'
>> +
>> +    //call modelEntity to complete information on the field type
>> +    modelEntity.getFieldsUnmodifiable().each {
>> +        modelField ->
>> +            if (! modelEntity.getAutomaticFieldNames().contains(modelField.name)) {
>> +                ModelFieldType type = delegator.getEntityFieldType(modelEntity, modelField.getType())
>> +                dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm +
>> +                        '<field name="' + modelField.name + '" tooltip="' +
>> +                        (modelField.getIsPk() ? "* " : " ") +
>> +                        modelField.getType() + " (${type.getJavaType()} - ${type.getSqlType()})" +
>> +                        '"/>'
>>               }
>> -            Collection pkNames = []
>> -            Iterator iter = modelEntity.getPksIterator()
>> -            while (iter != null && iter.hasNext()) {
>> -                ModelField curField = (ModelField) iter.next()
>> -                pkNames.add(curField.getName())
>> -            }
>> -            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo)
>> -            resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1)
>> -
>> -            arraySize = resultEli.getResultsSizeAfterPartialList()
>> -            if (arraySize < highIndex) {
>> -                highIndex = arraySize
>> -            }
>> -
>> -            resultEli.close()
>> -        } catch (GenericEntityException e) {
>> -            Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy")
>> -            try {
>> -                // only rollback the transaction if we started one...
>> -                TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
>> -            } catch (GenericEntityException e2) {
>> -                Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy")
>> -            }
>> -            // after rolling back, rethrow the exception
>> -            throw e
>> -        } finally {
>> -            // only commit the transaction if we started one... this will throw an exception if it fails
>> -            TransactionUtil.commit(beganTransaction)
>> -        }
>>       }
>> -}
>> -context.highIndex = highIndex
>> -context.arraySize = arraySize
>> -context.resultPartialList = resultPartialList
>> -
>> -viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
>> -context.viewIndexLast = viewIndexLast
>> -
>> -List fieldList = []
>> -fieldIterator = modelEntity.getFieldsIterator()
>> -while (fieldIterator.hasNext()) {
>> -    ModelField field = fieldIterator.next()
>> -    ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType())
>> -
>> -    Map fieldMap = [:]
>> -    fieldMap.put("name", field.getName())
>> -    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
>> -    fieldMap.put("javaType", type.getJavaType())
>> -    fieldMap.put("sqlType", type.getSqlType())
>> -    fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""))
>> -
>> -    fieldList.add(fieldMap)
>> -}
>> -context.fieldList = fieldList
>> -context.columnCount = fieldList.size()+2
>> -
>> -List records = []
>> -if (resultPartialList != null) {
>> -    Iterator resultPartialIter = resultPartialList.iterator()
>> -    while (resultPartialIter.hasNext()) {
>> -        Map record = [:]
>> -
>> -        GenericValue value = (GenericValue)resultPartialIter.next()
>> -        String findString = "entityName=" + entityName
>> -        Iterator pkIterator = modelEntity.getPksIterator()
>> -        while (pkIterator.hasNext()) {
>> -            ModelField pkField = pkIterator.next()
>> -            ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType())
>> -            findString += "&" + pkField.getName() + "=" + value.get(pkField.getName())
>> -        }
>> -        record.put("findString", findString)
>> +    dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm + '</form></forms>'
>> +    Document dynamicAutoEntityFieldSearchFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldSearchForm, true, true)
>> +    Map<String, ModelForm> modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldSearchFormXml, entityModelReader,
>> dispatcher.getDispatchContext(), null)
>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
>> +        modelForm = entry.getValue()
>> +    }
>>   -        record.put("fields", value)
>> -        records.add(record)
>> +    MacroFormRenderer renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
>> +    FormRenderer dynamicAutoEntitySearchFormRenderer = new FormRenderer(modelForm, renderer)
>> +    Writer writer = new StringWriter()
>> +    dynamicAutoEntitySearchFormRenderer.render(writer, context)
>> +    context.dynamicAutoEntitySearchForm = writer
>> +
>> +    //prepare the result list from performFind
>> +    String dynamicAutoEntityFieldListForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>> +            '<form name="ListGeneric" type="list" target="FindGeneric" list-name="listIt" ' +
>> +            '  odd-row-style="alternate-row" default-table-style="basic-table light-grid hover-bar">' +
>> +            '<actions><service service-name="performFind">' +
>> +            '<field-map field-name="inputFields" from-field="parameters"/>' +
>> +            '<field-map field-name="entityName" value="' + entityName + '"/>' +
>> +            '</service></actions>' +
>> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="display"/>' +
>> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
>> +            '<field name="viewGeneric" title=" "><hyperlink target="ViewGeneric" description="view">' +
>> +            '    <auto-parameters-entity entity-name="' + entityName + '"/>' +
>> +            '    <parameter param-name="entityName" value="' + entityName + '"/>' +
>> +            '</hyperlink></field>' +
>> +            '<sort-order><sort-field name="viewGeneric"/></sort-order>' +
>> +            '</form></forms>'
>> +    //Debug.logInfo(dynamicAutoEntityFieldForm, "")
>> +    Document dynamicAutoEntityFieldListFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldListForm, true, true)
>> +    modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldListFormXml, entityModelReader, dispatcher.getDispatchContext(), null)
>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
>> +        modelForm = entry.getValue()
>>       }
>> -}
>> -context.records = records
>> -context.lowCount = lowIndex
>> -context.highCount = lowIndex + records.size() - 1
>> -context.total = arraySize
>> +    renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
>> +    FormRenderer dynamicAutoEntityListFormRenderer = new FormRenderer(modelForm, renderer)
>> +    Writer writerList = new StringWriter()
>> +    dynamicAutoEntityListFormRenderer.render(writerList, context)
>> +    context.dynamicAutoEntityListForm = writerList
>> +}
>> \ No newline at end of file
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl Fri Feb 17 17:00:31 2017
>> @@ -83,7 +83,7 @@ under the License.
>>                   <#if entity.entityPermissionView == 'Y'>
>>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsReln}</a>
>>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsFind}</a>
>> -                  <a
>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>>                   </#if>
>>                 <#else>
>>                   <#if entity.entityPermissionCreate == 'Y'>
>> @@ -92,7 +92,7 @@ under the License.
>>                   <#if entity.entityPermissionView == 'Y'>
>>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'
>> title='${uiLabelMap.WebtoolsViewRelations}'>${uiLabelMap.WebtoolsReln}</a>
>>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'
>> title='${uiLabelMap.WebtoolsFindRecord}'>${uiLabelMap.WebtoolsFind}</a>
>> -                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>>                   </#if>
>>                 </#if>
>>               </td>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl Fri Feb 17 17:00:31 2017
>> @@ -63,7 +63,7 @@ under the License.
>>                               </div>
>> <div>${entity.title}&nbsp;
>>                                   <#if !forstatic>
>> -                                    <a target='main'
>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>> +                                    <a target='main'
>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>>                                   </#if>
>>                                   <#if !forstatic>
>>                                       <a target='main'
>> href="<@ofbizUrl>ArtifactInfo?name=${entity.entityName}&amp;type=entity</@ofbizUrl>">[${uiLabelMap.WebtoolsArtifactInfo}]</a>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl Fri Feb 17 17:00:31 2017
>> @@ -16,27 +16,6 @@ KIND, either express or implied.  See th
>>   specific language governing permissions and limitations
>>   under the License.
>>   -->
>> -        <form method="post" action="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>">
>> -          <input type="hidden" name="find" value="true"/>
>> -          <input type="hidden" name="searchOptions_collapsed" value="true"/>
>> -          <table class="basic-table" cellspacing="0">
>> -            <tr class="header-row-2">
>> - <td>${uiLabelMap.WebtoolsFieldName}</td>
>> -              <td>${uiLabelMap.WebtoolsPk}</td>
>> - <td>${uiLabelMap.WebtoolsFieldType}</td>
>> -              <td>&nbsp;</td>
>> -            </tr>
>> -            <#list fieldList as field>
>> -                <tr>
>> -                    <td>${field.name}</td>
>> -                    <td><#if field.isPk == 'Y'>*</#if></td>
>> - <td>${field.javaType},&nbsp;${field.sqlType}</td>
>> -                    <td><input type="text" name="${field.name}" value="${field.param}" size="40"/></td>
>> -                </tr>
>> -            </#list>
>> -                <tr>
>> -                    <td colspan="3"><h3>${uiLabelMap.WebtoolsToFindAll} ${entityName}, ${uiLabelMap.WebtoolsLeaveAllEntriesBlank}</h3></td>
>> -                    <td><input type="submit" value="${uiLabelMap.CommonFind}"/></td>
>> -                </tr>
>> -            </table>
>> -        </form>
>> +    <#if entityName?has_content>
>> +        ${dynamicAutoEntitySearchForm?string}
>> +    </#if>
>> \ No newline at end of file
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl Fri Feb 17 17:00:31 2017
>> @@ -16,42 +16,8 @@ KIND, either express or implied.  See th
>>   specific language governing permissions and limitations
>>   under the License.
>>   -->
>> -        <#if (arraySize > 0)>
>> -            <#assign
>> commonUrl="FindGeneric?${curFindString}&amp;searchOptions_collapsed=${(parameters.searchOptions_collapsed)?default(\"false\")}&amp;"/>
>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex
>> commonDisplaying=commonDisplaying/>
>> -        </#if>
>> -          <table class="basic-table hover-bar" cellspacing="0">
>> -            <tr class="header-row-2">
>> -                <td>&nbsp;</td>
>> -                <#list fieldList as field>
>> -                    <td>${field.name}</td>
>> -                </#list>
>> -            </tr>
>> -            <#if resultPartialList?has_content>
>> -                <#assign alt_row = false>
>> -                <#list records as record>
>> -                    <tr<#if alt_row> class="alternate-row"</#if>>
>> -                        <td class="button-col">
>> -                            <a href='<@ofbizUrl>ViewGeneric?${record.findString}</@ofbizUrl>'>${uiLabelMap.CommonView}</a>
>> -                        <#if hasDeletePermission == 'Y'>
>> -                            <a onclick="return confirm ('${uiLabelMap.WebtoolsConfirmDelete}')"
>> href='<@ofbizUrl>UpdateGeneric?${record.findString}&amp;UPDATE_MODE=DELETE</@ofbizUrl>'>${uiLabelMap.CommonDelete}</a>
>> -                        </#if>
>> -                        </td>
>> -                        <#list fieldList as field>
>> - <td>${Static["org.apache.ofbiz.base.util.UtilFormatOut"].makeString(record.fields.get(field.name))}</td>
>> -                            <#-- <td>${record.fields.get(field.name)!?string}</td> -->
>> -                        </#list>
>> -                    </tr>
>> -                    <#assign alt_row = !alt_row>
>> -                </#list>
>> -            <#else>
>> -                <tr>
>> -                    <td colspan="${columnCount}">
>> - <h2>${uiLabelMap.WebtoolsNoEntityRecordsFound} ${entityName}.</h2>
>> -                    </td>
>> -                </tr>
>> -            </#if>
>> -        </table>
>> -        <#if (arraySize > 0)>
>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex />
>> -        </#if>
>> +    <#if entityName?has_content>
>> +        ${dynamicAutoEntityListForm?string}
>> +    <#else>
>> + ${uiLabelMap['genericWebEvent.entity_name_not_specified']}
>> +    </#if>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl Fri Feb 17 17:00:31 2017
>> @@ -50,7 +50,7 @@ function ShowTab(lname) {
>>       <h2>${uiLabelMap.WebtoolsWithPk}: ${findByPk}</h2>
>>       <br />
>>       <div class="button-bar">
>> -      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>> +      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>         <#if enableEdit = "false">
>>           <#if hasCreatePermission>
>>             <a href='<@ofbizUrl>ViewGeneric?entityName=${entityName}&amp;enableEdit=true</@ofbizUrl>' class="buttontext
>> create">${uiLabelMap.CommonCreateNew}</a>
>> @@ -228,7 +228,7 @@ function ShowTab(lname) {
>>               <div class="screenlet-title-bar">
>>                 <ul>
>>                   <li class="h3">${uiLabelMap.WebtoolsRelatedEntity}: ${relation.title}${relation.relatedTable} (${relation.type})</li>
>> -                <li><a
>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>> +                <li><a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>>                   <#if relation.valueRelated?has_content>
>>                     <li><a href="<@ofbizUrl>ViewGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonView}</a></li>
>>                   </#if>
>> @@ -257,7 +257,7 @@ function ShowTab(lname) {
>>                 <#if "one" = relation.type>
>> <b>${uiLabelMap.WebtoolsNoValueFoundFor}</b> ${relation.title}${relation.relatedTable}.
>>                 <#else>
>> -              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>"
>> class="buttontext">${uiLabelMap.CommonFind}</a>
>> +              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonFind}</a>
>>                 </#if>
>>               </#if>
>>             </div>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl Fri Feb 17 17:00:31 2017
>> @@ -29,7 +29,7 @@ under the License.
>>           <h2>${uiLabelMap.WebtoolsForEntity}: ${entityName}</h2>
>>           <br />
>>           <div class="button-bar">
>> -            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>"
>> class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>> +            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>           </div>
>>           <br />
>>           <table class="basic-table hover-bar" cellspacing="0">
>> @@ -44,7 +44,7 @@ under the License.
>>               <#list relations as relation>
>>                   <tr<#if alt_row> class="alternate-row"</#if>>
>>                       <td>${relation.title}</td>
>> -                    <td class="button-col"><a
>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${relation.relEntityName}</a></td>
>> +                    <td class="button-col"><a
>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}</@ofbizUrl>'>${relation.relEntityName}</a></td>
>>                       <td>${relation.type}</td>
>>                       <td>${relation.fkName}</td>
>>                       <td>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml Fri Feb 17 17:00:31 2017
>> @@ -194,6 +194,7 @@ under the License.
>>                   <if-has-permission permission="ENTITY_MAINT"/>
>>               </condition>
>>               <actions>
>> +                <property-map resource="WebtoolsErrorUiLabels" map-name="uiLabelMap"/>
>>                   <script location="component://webtools/groovyScripts/entity/FindGeneric.groovy"/>
>>                   <property-map resource="CommonUiLabels" map-name="uiLabelMap"/>
>>                   <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap"/>
>> @@ -209,10 +210,10 @@ under the License.
>>                                   <container style="button-bar button-style-1">
>>                                       <link target="entitymaint" text="${uiLabelMap.WebtoolsBackToEntityList}"/>
>>                                       <link target="ViewRelations" text="${uiLabelMap.WebtoolsViewRelations}">
>> -                                        <parameter param-name="entityName" from-field="entityName"/>
>> +                                        <parameter param-name="entityName"/>
>>                                       </link>
>>                                       <link target="ViewGeneric" text="${uiLabelMap.CommonCreateNew}" style="create">
>> -                                        <parameter param-name="entityName" from-field="entityName"/>
>> +                                        <parameter param-name="entityName"/>
>>                                           <parameter param-name="enableEdit" value="true"/>
>>                                       </link>
>>                                   </container>
>>
>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>> ==============================================================================
>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml (original)
>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml Fri Feb 17 17:00:31 2017
>> @@ -242,7 +242,7 @@ under the License.
>>           <menu-item name="all" title="${uiLabelMap.WebtoolsAll}">
>>               <link target="FindGeneric">
>>                   <parameter param-name="entityName"/>
>> -                <parameter param-name="find" value="true"/>
>> +                <parameter param-name="noConditionFind" value="Y"/>
>>               </link>
>>           </menu-item>
>>       </menu>
>>
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1783427 - in /ofbiz/ofbiz-framework/trunk/framework/webtools: groovyScripts/entity/ template/entity/ widget/

Nicolas Malin-2
Sorry Jacques for the latency (I'm on vacation with my familly ;) )

My apologies, I forget to recheck my svn config although I notified that
before this commit.

Thanks for the remark, I will care about that now

Nicolas


Le 18/02/2017 à 14:50, Jacques Le Roux a écrit :

> Nicolas,
>
> OK Forget it, viewing your patch at OFBIZ-9217 I saw some properties
> set. But when you committed I saw no properties and wondered
>
> But all the files you committed already existed, had the properties
> already set. So in both cases it's OK.
>
> Anyway with the *svn:auto-props* set on the OFBiz "repo"
> http://svn.apache.org/viewvc/ofbiz/ we no longer have to worry about
> that. Just that for the rest (no *auto-props) *it's better to have the
> svn config ready and I suppose you have it has the patch shows
>
> Jacques
>
>
> Le 18/02/2017 à 10:17, Jacques Le Roux a écrit :
>> Hi Nicolas,
>>
>> Not totally sure, but it seems it would be good if you could put the
>> svn config file in the right place.
>>
>> This to possibly avoid all those false changes below. If you did,
>> forget it, it's something else and I don't know what). Else see the
>> committers wiki page for more...
>>
>> Thanks
>>
>> Jacques
>>
>>
>> Le 17/02/2017 à 18:00, [hidden email] a écrit :
>>> Author: nmalin
>>> Date: Fri Feb 17 17:00:31 2017
>>> New Revision: 1783427
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1783427&view=rev
>>> Log:
>>> Improved: Improve FindGeneric entity screen with xml form (OFBIZ-9217)
>>> Replace the current groovy and ftl form rendering by a dynamic call
>>> to screen xml with build the xml form by analyse the entity
>>> The find operation is now realize by the perfomFind service
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>>
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>> Fri Feb 17 17:00:31 2017
>>> @@ -17,240 +17,92 @@
>>>    * under the License.
>>>    */
>>>   -import org.apache.ofbiz.base.util.UtilMisc
>>> -import org.apache.ofbiz.entity.Delegator
>>> -import org.apache.ofbiz.entity.GenericValue
>>> +import org.apache.ofbiz.base.util.Debug
>>> +import org.apache.ofbiz.base.util.UtilValidate
>>> +import org.apache.ofbiz.base.util.UtilProperties
>>> +import org.apache.ofbiz.base.util.UtilXml
>>>   import org.apache.ofbiz.entity.GenericEntityException
>>> -import org.apache.ofbiz.security.Security
>>> -import org.apache.ofbiz.entity.model.ModelReader
>>>   import org.apache.ofbiz.entity.model.ModelEntity
>>> -import org.apache.ofbiz.entity.model.ModelViewEntity
>>> -import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
>>> -import org.apache.ofbiz.entity.model.ModelField
>>>   import org.apache.ofbiz.entity.model.ModelFieldType
>>> -import org.apache.ofbiz.entity.GenericEntity
>>> -import org.apache.ofbiz.base.util.UtilFormatOut
>>> -import org.apache.ofbiz.base.util.UtilProperties
>>> -import org.apache.ofbiz.entity.condition.EntityExpr
>>> -import org.apache.ofbiz.entity.condition.EntityCondition
>>> -import org.apache.ofbiz.entity.condition.EntityConditionList
>>> -import org.apache.ofbiz.entity.condition.EntityFieldMap
>>> -import org.apache.ofbiz.entity.condition.EntityOperator
>>> -import org.apache.ofbiz.entity.transaction.TransactionUtil
>>> -import org.apache.ofbiz.entity.util.EntityFindOptions
>>> -import org.apache.ofbiz.entity.util.EntityListIterator
>>> -import org.apache.ofbiz.entity.util.EntityUtilProperties
>>> -import org.apache.ofbiz.base.util.Debug
>>> -import java.sql.Timestamp
>>> -import java.sql.Date
>>> -import java.sql.Time
>>> -
>>> -entityName = parameters.entityName
>>> -
>>> -ModelReader reader = delegator.getModelReader()
>>> -ModelEntity modelEntity = reader.getModelEntity(entityName)
>>> -
>>> -groupByFields = []
>>> -functionFields = []
>>> -
>>> -if (modelEntity instanceof ModelViewEntity) {
>>> -    aliases = modelEntity.getAliasesCopy()
>>> -    for (ModelAlias alias : aliases) {
>>> -        if (alias.getGroupBy()) {
>>> -            groupByFields.add(alias.getName())
>>> -        } else if (alias.getFunction()) {
>>> -            functionFields.add(alias.getName())
>>> -        }
>>> -    }
>>> -}
>>> -
>>> -context.entityName = modelEntity.getEntityName()
>>> -context.plainTableName = modelEntity.getPlainTableName()
>>> -
>>> -String hasViewPermission =
>>> (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) ||
>>> security.hasEntityPermission(modelEntity.getPlainTableName(),
>>> "_VIEW", session)) == true ? "Y" : "N"
>>> -String hasCreatePermission =
>>> (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) ||
>>> security.hasEntityPermission(modelEntity.getPlainTableName(),
>>> "_CREATE", session)) == true ? "Y" : "N"
>>> -String hasUpdatePermission =
>>> (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) ||
>>> security.hasEntityPermission(modelEntity.getPlainTableName(),
>>> "_UPDATE", session)) == true ? "Y" : "N"
>>> -String hasDeletePermission =
>>> (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) ||
>>> security.hasEntityPermission(modelEntity.getPlainTableName(),
>>> "_DELETE", session)) == true ? "Y" : "N"
>>> -
>>> -context.hasViewPermission = hasViewPermission
>>> -context.hasCreatePermission = hasCreatePermission
>>> -context.hasUpdatePermission = hasUpdatePermission
>>> -context.hasDeletePermission = hasDeletePermission
>>> -
>>> -String find = parameters.find
>>> -if (find == null) {
>>> -    find = "false"
>>> -}
>>> -
>>> -String curFindString = "entityName=" + entityName + "&find=" + find
>>> -
>>> -GenericEntity findByEntity = delegator.makeValue(entityName)
>>> -List errMsgList = []
>>> -Iterator fieldIterator = modelEntity.getFieldsIterator()
>>> -while (fieldIterator.hasNext()) {
>>> -    ModelField field = fieldIterator.next()
>>> -    String fval = parameters.get(field.getName())
>>> -    if (fval != null) {
>>> -        if (fval.length() > 0) {
>>> -            curFindString = curFindString + "&" + field.getName() +
>>> "=" + fval
>>> -            try {
>>> -                findByEntity.setString(field.getName(), fval)
>>> -            } catch (NumberFormatException nfe) {
>>> -                Debug.logError(nfe, "Caught an exception : " +
>>> nfe.toString(), "FindGeneric.groovy")
>>> -                errMsgList.add("Entered value is non-numeric for
>>> numeric field: " + field.getName())
>>> -            }
>>> -        }
>>> -    }
>>> -}
>>> -if (errMsgList) {
>>> -    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
>>> -}
>>> -
>>> -curFindString = UtilFormatOut.encodeQuery(curFindString)
>>> -context.curFindString = curFindString
>>> -
>>> -try {
>>> -    viewIndex =
>>> Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
>>> -} catch (NumberFormatException nfe) {
>>> -    viewIndex = 0
>>> -}
>>> -
>>> -context.viewIndexFirst = 0
>>> -context.viewIndex = viewIndex
>>> -context.viewIndexPrevious = viewIndex-1
>>> -context.viewIndexNext = viewIndex+1
>>> +import org.apache.ofbiz.entity.model.ModelReader
>>> +import org.apache.ofbiz.widget.model.FormFactory
>>> +import org.apache.ofbiz.widget.model.ModelForm
>>> +import org.apache.ofbiz.widget.renderer.FormRenderer
>>> +import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
>>> +import org.w3c.dom.Document
>>>   +ModelEntity modelEntity = null
>>>   try {
>>> -    viewSize =
>>> Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
>>> -} catch (NumberFormatException nfe) {
>>> -    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget",
>>> "widget.form.defaultViewSize", 0)).intValue()
>>> -}
>>> -
>>> -context.viewSize = viewSize
>>> -
>>> -int lowIndex = viewIndex*viewSize+1
>>> -int highIndex = (viewIndex+1)*viewSize
>>> -context.lowIndex = lowIndex
>>> -
>>> -int arraySize = 0
>>> -List resultPartialList = null
>>> -
>>> -if ("true".equals(find)) {
>>> -    //EntityCondition condition =
>>> EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
>>> -
>>> -    // small variation to support LIKE if a wildcard (%) is found
>>> in a String
>>> -    conditionList = []
>>> -    findByKeySet = findByEntity.keySet()
>>> -    fbksIter = findByKeySet.iterator()
>>> -    while (fbksIter.hasNext()) {
>>> -        findByKey = fbksIter.next()
>>> -        if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
>>> - conditionList.add(EntityCondition.makeCondition(findByKey,
>>> EntityOperator.LIKE, findByEntity.getString(findByKey)))
>>> -        } else {
>>> - conditionList.add(EntityCondition.makeCondition(findByKey,
>>> EntityOperator.EQUALS, findByEntity.get(findByKey)))
>>> -        }
>>> -    }
>>> -    condition = EntityCondition.makeCondition(conditionList,
>>> EntityOperator.AND)
>>> -
>>> -    if ((highIndex - lowIndex + 1) > 0) {
>>> -        boolean beganTransaction = false
>>> -        try {
>>> -            beganTransaction = TransactionUtil.begin()
>>> -
>>> -            EntityFindOptions efo = new EntityFindOptions()
>>> -            efo.setMaxRows(highIndex)
>>> - efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
>>> -            EntityListIterator resultEli = null
>>> -            fieldsToSelect = null
>>> -
>>> -            if (groupByFields || functionFields) {
>>> -                fieldsToSelect = [] as Set
>>> -
>>> -                for (String groupByField : groupByFields) {
>>> -                    fieldsToSelect.add(groupByField)
>>> -                }
>>> -
>>> -                for (String functionField : functionFields) {
>>> -                    fieldsToSelect.add(functionField)
>>> -                }
>>> +    modelEntity = delegator.getModelEntity(parameters.entityName)
>>> +} catch(GenericEntityException e) {
>>> +    Debug.logError("The entityName " + parameters.entityName + " is
>>> not found", "FindGeneric.groovy")
>>> +}
>>> +
>>> +if (modelEntity) {
>>> +    entityName = modelEntity.entityName
>>> +    context.entityName = entityName
>>> +    ModelReader entityModelReader = delegator.getModelReader()
>>> +    //create the search form with auto-fields-entity
>>> +    String dynamicAutoEntityFieldSearchForm = '<?xml version="1.0"
>>> encoding="UTF-8"?><forms
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns="http://ofbiz.apache.org/Widget-Form"
>>> xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form 
>>> http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>>> +            '<form name="FindGeneric" type="single"
>>> target="FindGeneric">' +
>>> +            '<auto-fields-entity entity-name="' + entityName + '"
>>> default-field-type="find"/>' +
>>> +            '<field name="noConditionFind"><hidden
>>> value="Y"/></field>' +
>>> +            '<field name="searchOptions_collapsed" ><hidden
>>> value="true"/></field>' +
>>> +            '<field name="entityName"><hidden value="' + entityName
>>> + '"/></field>' +
>>> +            '<field name="searchButton" title="' +
>>> UtilProperties.getMessage("CommonUiLabels",
>>> "FormFieldTitle_searchButton", locale) + '"><submit/></field>'
>>> +
>>> +    //call modelEntity to complete information on the field type
>>> +    modelEntity.getFieldsUnmodifiable().each {
>>> +        modelField ->
>>> +            if (!
>>> modelEntity.getAutomaticFieldNames().contains(modelField.name)) {
>>> +                ModelFieldType type =
>>> delegator.getEntityFieldType(modelEntity, modelField.getType())
>>> +                dynamicAutoEntityFieldSearchForm =
>>> dynamicAutoEntityFieldSearchForm +
>>> +                        '<field name="' + modelField.name + '"
>>> tooltip="' +
>>> +                        (modelField.getIsPk() ? "* " : " ") +
>>> +                        modelField.getType() + "
>>> (${type.getJavaType()} - ${type.getSqlType()})" +
>>> +                        '"/>'
>>>               }
>>> -            Collection pkNames = []
>>> -            Iterator iter = modelEntity.getPksIterator()
>>> -            while (iter != null && iter.hasNext()) {
>>> -                ModelField curField = (ModelField) iter.next()
>>> -                pkNames.add(curField.getName())
>>> -            }
>>> -            resultEli = delegator.find(entityName, condition, null,
>>> fieldsToSelect, pkNames, efo)
>>> -            resultPartialList = resultEli.getPartialList(lowIndex,
>>> highIndex - lowIndex + 1)
>>> -
>>> -            arraySize = resultEli.getResultsSizeAfterPartialList()
>>> -            if (arraySize < highIndex) {
>>> -                highIndex = arraySize
>>> -            }
>>> -
>>> -            resultEli.close()
>>> -        } catch (GenericEntityException e) {
>>> -            Debug.logError(e, "Failure in operation, rolling back
>>> transaction", "FindGeneric.groovy")
>>> -            try {
>>> -                // only rollback the transaction if we started one...
>>> -                TransactionUtil.rollback(beganTransaction, "Error
>>> looking up entity values in WebTools Entity Data Maintenance", e)
>>> -            } catch (GenericEntityException e2) {
>>> -                Debug.logError(e2, "Could not rollback transaction:
>>> " + e2.toString(), "FindGeneric.groovy")
>>> -            }
>>> -            // after rolling back, rethrow the exception
>>> -            throw e
>>> -        } finally {
>>> -            // only commit the transaction if we started one...
>>> this will throw an exception if it fails
>>> -            TransactionUtil.commit(beganTransaction)
>>> -        }
>>>       }
>>> -}
>>> -context.highIndex = highIndex
>>> -context.arraySize = arraySize
>>> -context.resultPartialList = resultPartialList
>>> -
>>> -viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
>>> -context.viewIndexLast = viewIndexLast
>>> -
>>> -List fieldList = []
>>> -fieldIterator = modelEntity.getFieldsIterator()
>>> -while (fieldIterator.hasNext()) {
>>> -    ModelField field = fieldIterator.next()
>>> -    ModelFieldType type = delegator.getEntityFieldType(modelEntity,
>>> field.getType())
>>> -
>>> -    Map fieldMap = [:]
>>> -    fieldMap.put("name", field.getName())
>>> -    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
>>> -    fieldMap.put("javaType", type.getJavaType())
>>> -    fieldMap.put("sqlType", type.getSqlType())
>>> -    fieldMap.put("param", (parameters.get(field.getName()) != null
>>> ? parameters.get(field.getName()) : ""))
>>> -
>>> -    fieldList.add(fieldMap)
>>> -}
>>> -context.fieldList = fieldList
>>> -context.columnCount = fieldList.size()+2
>>> -
>>> -List records = []
>>> -if (resultPartialList != null) {
>>> -    Iterator resultPartialIter = resultPartialList.iterator()
>>> -    while (resultPartialIter.hasNext()) {
>>> -        Map record = [:]
>>> -
>>> -        GenericValue value = (GenericValue)resultPartialIter.next()
>>> -        String findString = "entityName=" + entityName
>>> -        Iterator pkIterator = modelEntity.getPksIterator()
>>> -        while (pkIterator.hasNext()) {
>>> -            ModelField pkField = pkIterator.next()
>>> -            ModelFieldType type =
>>> delegator.getEntityFieldType(modelEntity, pkField.getType())
>>> -            findString += "&" + pkField.getName() + "=" +
>>> value.get(pkField.getName())
>>> -        }
>>> -        record.put("findString", findString)
>>> +    dynamicAutoEntityFieldSearchForm =
>>> dynamicAutoEntityFieldSearchForm + '</form></forms>'
>>> +    Document dynamicAutoEntityFieldSearchFormXml =
>>> UtilXml.readXmlDocument(dynamicAutoEntityFieldSearchForm, true, true)
>>> +    Map<String, ModelForm> modelFormMap =
>>> FormFactory.readFormDocument(dynamicAutoEntityFieldSearchFormXml,
>>> entityModelReader, dispatcher.getDispatchContext(), null)
>>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>>> +        Map.Entry<String, ModelForm> entry =
>>> modelFormMap.entrySet().iterator().next()
>>> +        modelForm = entry.getValue()
>>> +    }
>>>   -        record.put("fields", value)
>>> -        records.add(record)
>>> +    MacroFormRenderer renderer = new
>>> MacroFormRenderer(UtilProperties.getPropertyValue("widget",
>>> "screen.formrenderer"), request, response)
>>> +    FormRenderer dynamicAutoEntitySearchFormRenderer = new
>>> FormRenderer(modelForm, renderer)
>>> +    Writer writer = new StringWriter()
>>> +    dynamicAutoEntitySearchFormRenderer.render(writer, context)
>>> +    context.dynamicAutoEntitySearchForm = writer
>>> +
>>> +    //prepare the result list from performFind
>>> +    String dynamicAutoEntityFieldListForm = '<?xml version="1.0"
>>> encoding="UTF-8"?><forms
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns="http://ofbiz.apache.org/Widget-Form"
>>> xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form 
>>> http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>>> +            '<form name="ListGeneric" type="list"
>>> target="FindGeneric" list-name="listIt" ' +
>>> +            '  odd-row-style="alternate-row"
>>> default-table-style="basic-table light-grid hover-bar">' +
>>> +            '<actions><service service-name="performFind">' +
>>> +            '<field-map field-name="inputFields"
>>> from-field="parameters"/>' +
>>> +            '<field-map field-name="entityName" value="' +
>>> entityName + '"/>' +
>>> +            '</service></actions>' +
>>> +            '<auto-fields-entity entity-name="' + entityName + '"
>>> default-field-type="display"/>' +
>>> +            '<field name="entityName"><hidden value="' + entityName
>>> + '"/></field>' +
>>> +            '<field name="viewGeneric" title=" "><hyperlink
>>> target="ViewGeneric" description="view">' +
>>> +            '    <auto-parameters-entity entity-name="' +
>>> entityName + '"/>' +
>>> +            '    <parameter param-name="entityName" value="' +
>>> entityName + '"/>' +
>>> +            '</hyperlink></field>' +
>>> +            '<sort-order><sort-field
>>> name="viewGeneric"/></sort-order>' +
>>> +            '</form></forms>'
>>> +    //Debug.logInfo(dynamicAutoEntityFieldForm, "")
>>> +    Document dynamicAutoEntityFieldListFormXml =
>>> UtilXml.readXmlDocument(dynamicAutoEntityFieldListForm, true, true)
>>> +    modelFormMap =
>>> FormFactory.readFormDocument(dynamicAutoEntityFieldListFormXml,
>>> entityModelReader, dispatcher.getDispatchContext(), null)
>>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>>> +        Map.Entry<String, ModelForm> entry =
>>> modelFormMap.entrySet().iterator().next()
>>> +        modelForm = entry.getValue()
>>>       }
>>> -}
>>> -context.records = records
>>> -context.lowCount = lowIndex
>>> -context.highCount = lowIndex + records.size() - 1
>>> -context.total = arraySize
>>> +    renderer = new
>>> MacroFormRenderer(UtilProperties.getPropertyValue("widget",
>>> "screen.formrenderer"), request, response)
>>> +    FormRenderer dynamicAutoEntityListFormRenderer = new
>>> FormRenderer(modelForm, renderer)
>>> +    Writer writerList = new StringWriter()
>>> +    dynamicAutoEntityListFormRenderer.render(writerList, context)
>>> +    context.dynamicAutoEntityListForm = writerList
>>> +}
>>> \ No newline at end of file
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -83,7 +83,7 @@ under the License.
>>>                   <#if entity.entityPermissionView == 'Y'>
>>>                     <a
>>> href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsReln}</a>
>>>                     <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsFind}</a>
>>> -                  <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>>> +                  <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>>>                   </#if>
>>>                 <#else>
>>>                   <#if entity.entityPermissionCreate == 'Y'>
>>> @@ -92,7 +92,7 @@ under the License.
>>>                   <#if entity.entityPermissionView == 'Y'>
>>>                     <a
>>> href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'
>>> title='${uiLabelMap.WebtoolsViewRelations}'>${uiLabelMap.WebtoolsReln}</a>
>>>
>>>                     <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'
>>> title='${uiLabelMap.WebtoolsFindRecord}'>${uiLabelMap.WebtoolsFind}</a>
>>> -                  <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>>>
>>> +                  <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>>>
>>>                   </#if>
>>>                 </#if>
>>>               </td>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -63,7 +63,7 @@ under the License.
>>>                               </div>
>>> <div>${entity.title}&nbsp;
>>>                                   <#if !forstatic>
>>> -                                    <a target='main'
>>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>>> +                                    <a target='main'
>>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>>>                                   </#if>
>>>                                   <#if !forstatic>
>>>                                       <a target='main'
>>> href="<@ofbizUrl>ArtifactInfo?name=${entity.entityName}&amp;type=entity</@ofbizUrl>">[${uiLabelMap.WebtoolsArtifactInfo}]</a>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -16,27 +16,6 @@ KIND, either express or implied.  See th
>>>   specific language governing permissions and limitations
>>>   under the License.
>>>   -->
>>> -        <form method="post"
>>> action="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>">
>>> -          <input type="hidden" name="find" value="true"/>
>>> -          <input type="hidden" name="searchOptions_collapsed"
>>> value="true"/>
>>> -          <table class="basic-table" cellspacing="0">
>>> -            <tr class="header-row-2">
>>> - <td>${uiLabelMap.WebtoolsFieldName}</td>
>>> -              <td>${uiLabelMap.WebtoolsPk}</td>
>>> - <td>${uiLabelMap.WebtoolsFieldType}</td>
>>> -              <td>&nbsp;</td>
>>> -            </tr>
>>> -            <#list fieldList as field>
>>> -                <tr>
>>> -                    <td>${field.name}</td>
>>> -                    <td><#if field.isPk == 'Y'>*</#if></td>
>>> - <td>${field.javaType},&nbsp;${field.sqlType}</td>
>>> -                    <td><input type="text" name="${field.name}"
>>> value="${field.param}" size="40"/></td>
>>> -                </tr>
>>> -            </#list>
>>> -                <tr>
>>> -                    <td
>>> colspan="3"><h3>${uiLabelMap.WebtoolsToFindAll} ${entityName},
>>> ${uiLabelMap.WebtoolsLeaveAllEntriesBlank}</h3></td>
>>> -                    <td><input type="submit"
>>> value="${uiLabelMap.CommonFind}"/></td>
>>> -                </tr>
>>> -            </table>
>>> -        </form>
>>> +    <#if entityName?has_content>
>>> +        ${dynamicAutoEntitySearchForm?string}
>>> +    </#if>
>>> \ No newline at end of file
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -16,42 +16,8 @@ KIND, either express or implied.  See th
>>>   specific language governing permissions and limitations
>>>   under the License.
>>>   -->
>>> -        <#if (arraySize > 0)>
>>> -            <#assign
>>> commonUrl="FindGeneric?${curFindString}&amp;searchOptions_collapsed=${(parameters.searchOptions_collapsed)?default(\"false\")}&amp;"/>
>>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl
>>> listSize=arraySize viewSize=viewSize viewIndex=viewIndex
>>> highIndex=highIndex commonDisplaying=commonDisplaying/>
>>> -        </#if>
>>> -          <table class="basic-table hover-bar" cellspacing="0">
>>> -            <tr class="header-row-2">
>>> -                <td>&nbsp;</td>
>>> -                <#list fieldList as field>
>>> -                    <td>${field.name}</td>
>>> -                </#list>
>>> -            </tr>
>>> -            <#if resultPartialList?has_content>
>>> -                <#assign alt_row = false>
>>> -                <#list records as record>
>>> -                    <tr<#if alt_row> class="alternate-row"</#if>>
>>> -                        <td class="button-col">
>>> -                            <a
>>> href='<@ofbizUrl>ViewGeneric?${record.findString}</@ofbizUrl>'>${uiLabelMap.CommonView}</a>
>>> -                        <#if hasDeletePermission == 'Y'>
>>> -                            <a onclick="return confirm
>>> ('${uiLabelMap.WebtoolsConfirmDelete}')"
>>> href='<@ofbizUrl>UpdateGeneric?${record.findString}&amp;UPDATE_MODE=DELETE</@ofbizUrl>'>${uiLabelMap.CommonDelete}</a>
>>> -                        </#if>
>>> -                        </td>
>>> -                        <#list fieldList as field>
>>> -
>>> <td>${Static["org.apache.ofbiz.base.util.UtilFormatOut"].makeString(record.fields.get(field.name))}</td>
>>> -                            <#--
>>> <td>${record.fields.get(field.name)!?string}</td> -->
>>> -                        </#list>
>>> -                    </tr>
>>> -                    <#assign alt_row = !alt_row>
>>> -                </#list>
>>> -            <#else>
>>> -                <tr>
>>> -                    <td colspan="${columnCount}">
>>> - <h2>${uiLabelMap.WebtoolsNoEntityRecordsFound} ${entityName}.</h2>
>>> -                    </td>
>>> -                </tr>
>>> -            </#if>
>>> -        </table>
>>> -        <#if (arraySize > 0)>
>>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl
>>> listSize=arraySize viewSize=viewSize viewIndex=viewIndex
>>> highIndex=highIndex />
>>> -        </#if>
>>> +    <#if entityName?has_content>
>>> +        ${dynamicAutoEntityListForm?string}
>>> +    <#else>
>>> + ${uiLabelMap['genericWebEvent.entity_name_not_specified']}
>>> +    </#if>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -50,7 +50,7 @@ function ShowTab(lname) {
>>>       <h2>${uiLabelMap.WebtoolsWithPk}: ${findByPk}</h2>
>>>       <br />
>>>       <div class="button-bar">
>>> -      <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>> +      <a
>>> href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>         <#if enableEdit = "false">
>>>           <#if hasCreatePermission>
>>>             <a
>>> href='<@ofbizUrl>ViewGeneric?entityName=${entityName}&amp;enableEdit=true</@ofbizUrl>'
>>> class="buttontext create">${uiLabelMap.CommonCreateNew}</a>
>>> @@ -228,7 +228,7 @@ function ShowTab(lname) {
>>>               <div class="screenlet-title-bar">
>>>                 <ul>
>>>                   <li
>>> class="h3">${uiLabelMap.WebtoolsRelatedEntity}:
>>> ${relation.title}${relation.relatedTable} (${relation.type})</li>
>>> -                <li><a
>>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>>> +                <li><a
>>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>>>                   <#if relation.valueRelated?has_content>
>>>                     <li><a
>>> href="<@ofbizUrl>ViewGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonView}</a></li>
>>>                   </#if>
>>> @@ -257,7 +257,7 @@ function ShowTab(lname) {
>>>                 <#if "one" = relation.type>
>>> <b>${uiLabelMap.WebtoolsNoValueFoundFor}</b>
>>> ${relation.title}${relation.relatedTable}.
>>>                 <#else>
>>> -              <a
>>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>"
>>> class="buttontext">${uiLabelMap.CommonFind}</a>
>>> +              <a
>>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>"
>>> class="buttontext">${uiLabelMap.CommonFind}</a>
>>>                 </#if>
>>>               </#if>
>>>             </div>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>> Fri Feb 17 17:00:31 2017
>>> @@ -29,7 +29,7 @@ under the License.
>>>           <h2>${uiLabelMap.WebtoolsForEntity}: ${entityName}</h2>
>>>           <br />
>>>           <div class="button-bar">
>>> -            <a
>>> href="<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>"
>>> class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>> +            <a
>>> href="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>"
>>> class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>           </div>
>>>           <br />
>>>           <table class="basic-table hover-bar" cellspacing="0">
>>> @@ -44,7 +44,7 @@ under the License.
>>>               <#list relations as relation>
>>>                   <tr<#if alt_row> class="alternate-row"</#if>>
>>>                       <td>${relation.title}</td>
>>> -                    <td class="button-col"><a
>>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${relation.relEntityName}</a></td>
>>> +                    <td class="button-col"><a
>>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}</@ofbizUrl>'>${relation.relEntityName}</a></td>
>>>                       <td>${relation.type}</td>
>>>                       <td>${relation.fkName}</td>
>>>                       <td>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> ---
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>> (original)
>>> +++
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>> Fri Feb 17 17:00:31 2017
>>> @@ -194,6 +194,7 @@ under the License.
>>>                   <if-has-permission permission="ENTITY_MAINT"/>
>>>               </condition>
>>>               <actions>
>>> +                <property-map resource="WebtoolsErrorUiLabels"
>>> map-name="uiLabelMap"/>
>>>                   <script
>>> location="component://webtools/groovyScripts/entity/FindGeneric.groovy"/>
>>>                   <property-map resource="CommonUiLabels"
>>> map-name="uiLabelMap"/>
>>>                   <property-map resource="WebtoolsUiLabels"
>>> map-name="uiLabelMap"/>
>>> @@ -209,10 +210,10 @@ under the License.
>>>                                   <container style="button-bar
>>> button-style-1">
>>>                                       <link target="entitymaint"
>>> text="${uiLabelMap.WebtoolsBackToEntityList}"/>
>>>                                       <link target="ViewRelations"
>>> text="${uiLabelMap.WebtoolsViewRelations}">
>>> -                                        <parameter
>>> param-name="entityName" from-field="entityName"/>
>>> +                                        <parameter
>>> param-name="entityName"/>
>>>                                       </link>
>>>                                       <link target="ViewGeneric"
>>> text="${uiLabelMap.CommonCreateNew}" style="create">
>>> -                                        <parameter
>>> param-name="entityName" from-field="entityName"/>
>>> +                                        <parameter
>>> param-name="entityName"/>
>>>                                           <parameter
>>> param-name="enableEdit" value="true"/>
>>>                                       </link>
>>>                                   </container>
>>>
>>> Modified:
>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>>> ==============================================================================
>>>
>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>> (original)
>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>> Fri Feb 17 17:00:31 2017
>>> @@ -242,7 +242,7 @@ under the License.
>>>           <menu-item name="all" title="${uiLabelMap.WebtoolsAll}">
>>>               <link target="FindGeneric">
>>>                   <parameter param-name="entityName"/>
>>> -                <parameter param-name="find" value="true"/>
>>> +                <parameter param-name="noConditionFind" value="Y"/>
>>>               </link>
>>>           </menu-item>
>>>       </menu>
>>>
>>>
>>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1783427 - in /ofbiz/ofbiz-framework/trunk/framework/webtools: groovyScripts/entity/ template/entity/ widget/

Jacques Le Roux
Administrator
Thanks Nicolas

Jacques


Le 27/02/2017 à 08:44, Nicolas Malin a écrit :

> Sorry Jacques for the latency (I'm on vacation with my familly ;) )
>
> My apologies, I forget to recheck my svn config although I notified that before this commit.
>
> Thanks for the remark, I will care about that now
>
> Nicolas
>
>
> Le 18/02/2017 à 14:50, Jacques Le Roux a écrit :
>> Nicolas,
>>
>> OK Forget it, viewing your patch at OFBIZ-9217 I saw some properties set. But when you committed I saw no properties and wondered
>>
>> But all the files you committed already existed, had the properties already set. So in both cases it's OK.
>>
>> Anyway with the *svn:auto-props* set on the OFBiz "repo" http://svn.apache.org/viewvc/ofbiz/ we no longer have to worry about that. Just that for
>> the rest (no *auto-props) *it's better to have the svn config ready and I suppose you have it has the patch shows
>>
>> Jacques
>>
>>
>> Le 18/02/2017 à 10:17, Jacques Le Roux a écrit :
>>> Hi Nicolas,
>>>
>>> Not totally sure, but it seems it would be good if you could put the svn config file in the right place.
>>>
>>> This to possibly avoid all those false changes below. If you did, forget it, it's something else and I don't know what). Else see the committers
>>> wiki page for more...
>>>
>>> Thanks
>>>
>>> Jacques
>>>
>>>
>>> Le 17/02/2017 à 18:00, [hidden email] a écrit :
>>>> Author: nmalin
>>>> Date: Fri Feb 17 17:00:31 2017
>>>> New Revision: 1783427
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1783427&view=rev
>>>> Log:
>>>> Improved: Improve FindGeneric entity screen with xml form (OFBIZ-9217)
>>>> Replace the current groovy and ftl form rendering by a dynamic call to screen xml with build the xml form by analyse the entity
>>>> The find operation is now realize by the perfomFind service
>>>>
>>>> Modified:
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>>> ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy Fri Feb 17 17:00:31 2017
>>>> @@ -17,240 +17,92 @@
>>>>    * under the License.
>>>>    */
>>>>   -import org.apache.ofbiz.base.util.UtilMisc
>>>> -import org.apache.ofbiz.entity.Delegator
>>>> -import org.apache.ofbiz.entity.GenericValue
>>>> +import org.apache.ofbiz.base.util.Debug
>>>> +import org.apache.ofbiz.base.util.UtilValidate
>>>> +import org.apache.ofbiz.base.util.UtilProperties
>>>> +import org.apache.ofbiz.base.util.UtilXml
>>>>   import org.apache.ofbiz.entity.GenericEntityException
>>>> -import org.apache.ofbiz.security.Security
>>>> -import org.apache.ofbiz.entity.model.ModelReader
>>>>   import org.apache.ofbiz.entity.model.ModelEntity
>>>> -import org.apache.ofbiz.entity.model.ModelViewEntity
>>>> -import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
>>>> -import org.apache.ofbiz.entity.model.ModelField
>>>>   import org.apache.ofbiz.entity.model.ModelFieldType
>>>> -import org.apache.ofbiz.entity.GenericEntity
>>>> -import org.apache.ofbiz.base.util.UtilFormatOut
>>>> -import org.apache.ofbiz.base.util.UtilProperties
>>>> -import org.apache.ofbiz.entity.condition.EntityExpr
>>>> -import org.apache.ofbiz.entity.condition.EntityCondition
>>>> -import org.apache.ofbiz.entity.condition.EntityConditionList
>>>> -import org.apache.ofbiz.entity.condition.EntityFieldMap
>>>> -import org.apache.ofbiz.entity.condition.EntityOperator
>>>> -import org.apache.ofbiz.entity.transaction.TransactionUtil
>>>> -import org.apache.ofbiz.entity.util.EntityFindOptions
>>>> -import org.apache.ofbiz.entity.util.EntityListIterator
>>>> -import org.apache.ofbiz.entity.util.EntityUtilProperties
>>>> -import org.apache.ofbiz.base.util.Debug
>>>> -import java.sql.Timestamp
>>>> -import java.sql.Date
>>>> -import java.sql.Time
>>>> -
>>>> -entityName = parameters.entityName
>>>> -
>>>> -ModelReader reader = delegator.getModelReader()
>>>> -ModelEntity modelEntity = reader.getModelEntity(entityName)
>>>> -
>>>> -groupByFields = []
>>>> -functionFields = []
>>>> -
>>>> -if (modelEntity instanceof ModelViewEntity) {
>>>> -    aliases = modelEntity.getAliasesCopy()
>>>> -    for (ModelAlias alias : aliases) {
>>>> -        if (alias.getGroupBy()) {
>>>> -            groupByFields.add(alias.getName())
>>>> -        } else if (alias.getFunction()) {
>>>> -            functionFields.add(alias.getName())
>>>> -        }
>>>> -    }
>>>> -}
>>>> -
>>>> -context.entityName = modelEntity.getEntityName()
>>>> -context.plainTableName = modelEntity.getPlainTableName()
>>>> -
>>>> -String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) ||
>>>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N"
>>>> -String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) ||
>>>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N"
>>>> -String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) ||
>>>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N"
>>>> -String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) ||
>>>> security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N"
>>>> -
>>>> -context.hasViewPermission = hasViewPermission
>>>> -context.hasCreatePermission = hasCreatePermission
>>>> -context.hasUpdatePermission = hasUpdatePermission
>>>> -context.hasDeletePermission = hasDeletePermission
>>>> -
>>>> -String find = parameters.find
>>>> -if (find == null) {
>>>> -    find = "false"
>>>> -}
>>>> -
>>>> -String curFindString = "entityName=" + entityName + "&find=" + find
>>>> -
>>>> -GenericEntity findByEntity = delegator.makeValue(entityName)
>>>> -List errMsgList = []
>>>> -Iterator fieldIterator = modelEntity.getFieldsIterator()
>>>> -while (fieldIterator.hasNext()) {
>>>> -    ModelField field = fieldIterator.next()
>>>> -    String fval = parameters.get(field.getName())
>>>> -    if (fval != null) {
>>>> -        if (fval.length() > 0) {
>>>> -            curFindString = curFindString + "&" + field.getName() + "=" + fval
>>>> -            try {
>>>> -                findByEntity.setString(field.getName(), fval)
>>>> -            } catch (NumberFormatException nfe) {
>>>> -                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy")
>>>> -                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
>>>> -            }
>>>> -        }
>>>> -    }
>>>> -}
>>>> -if (errMsgList) {
>>>> -    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
>>>> -}
>>>> -
>>>> -curFindString = UtilFormatOut.encodeQuery(curFindString)
>>>> -context.curFindString = curFindString
>>>> -
>>>> -try {
>>>> -    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
>>>> -} catch (NumberFormatException nfe) {
>>>> -    viewIndex = 0
>>>> -}
>>>> -
>>>> -context.viewIndexFirst = 0
>>>> -context.viewIndex = viewIndex
>>>> -context.viewIndexPrevious = viewIndex-1
>>>> -context.viewIndexNext = viewIndex+1
>>>> +import org.apache.ofbiz.entity.model.ModelReader
>>>> +import org.apache.ofbiz.widget.model.FormFactory
>>>> +import org.apache.ofbiz.widget.model.ModelForm
>>>> +import org.apache.ofbiz.widget.renderer.FormRenderer
>>>> +import org.apache.ofbiz.widget.renderer.macro.MacroFormRenderer
>>>> +import org.w3c.dom.Document
>>>>   +ModelEntity modelEntity = null
>>>>   try {
>>>> -    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
>>>> -} catch (NumberFormatException nfe) {
>>>> -    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue()
>>>> -}
>>>> -
>>>> -context.viewSize = viewSize
>>>> -
>>>> -int lowIndex = viewIndex*viewSize+1
>>>> -int highIndex = (viewIndex+1)*viewSize
>>>> -context.lowIndex = lowIndex
>>>> -
>>>> -int arraySize = 0
>>>> -List resultPartialList = null
>>>> -
>>>> -if ("true".equals(find)) {
>>>> -    //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
>>>> -
>>>> -    // small variation to support LIKE if a wildcard (%) is found in a String
>>>> -    conditionList = []
>>>> -    findByKeySet = findByEntity.keySet()
>>>> -    fbksIter = findByKeySet.iterator()
>>>> -    while (fbksIter.hasNext()) {
>>>> -        findByKey = fbksIter.next()
>>>> -        if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
>>>> - conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)))
>>>> -        } else {
>>>> - conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)))
>>>> -        }
>>>> -    }
>>>> -    condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
>>>> -
>>>> -    if ((highIndex - lowIndex + 1) > 0) {
>>>> -        boolean beganTransaction = false
>>>> -        try {
>>>> -            beganTransaction = TransactionUtil.begin()
>>>> -
>>>> -            EntityFindOptions efo = new EntityFindOptions()
>>>> -            efo.setMaxRows(highIndex)
>>>> - efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
>>>> -            EntityListIterator resultEli = null
>>>> -            fieldsToSelect = null
>>>> -
>>>> -            if (groupByFields || functionFields) {
>>>> -                fieldsToSelect = [] as Set
>>>> -
>>>> -                for (String groupByField : groupByFields) {
>>>> -                    fieldsToSelect.add(groupByField)
>>>> -                }
>>>> -
>>>> -                for (String functionField : functionFields) {
>>>> -                    fieldsToSelect.add(functionField)
>>>> -                }
>>>> +    modelEntity = delegator.getModelEntity(parameters.entityName)
>>>> +} catch(GenericEntityException e) {
>>>> +    Debug.logError("The entityName " + parameters.entityName + " is not found", "FindGeneric.groovy")
>>>> +}
>>>> +
>>>> +if (modelEntity) {
>>>> +    entityName = modelEntity.entityName
>>>> +    context.entityName = entityName
>>>> +    ModelReader entityModelReader = delegator.getModelReader()
>>>> +    //create the search form with auto-fields-entity
>>>> +    String dynamicAutoEntityFieldSearchForm = '<?xml version="1.0" encoding="UTF-8"?><forms
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form"
>>>> xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>>>> +            '<form name="FindGeneric" type="single" target="FindGeneric">' +
>>>> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="find"/>' +
>>>> +            '<field name="noConditionFind"><hidden value="Y"/></field>' +
>>>> +            '<field name="searchOptions_collapsed" ><hidden value="true"/></field>' +
>>>> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
>>>> +            '<field name="searchButton" title="' + UtilProperties.getMessage("CommonUiLabels", "FormFieldTitle_searchButton", locale) +
>>>> '"><submit/></field>'
>>>> +
>>>> +    //call modelEntity to complete information on the field type
>>>> +    modelEntity.getFieldsUnmodifiable().each {
>>>> +        modelField ->
>>>> +            if (! modelEntity.getAutomaticFieldNames().contains(modelField.name)) {
>>>> +                ModelFieldType type = delegator.getEntityFieldType(modelEntity, modelField.getType())
>>>> +                dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm +
>>>> +                        '<field name="' + modelField.name + '" tooltip="' +
>>>> +                        (modelField.getIsPk() ? "* " : " ") +
>>>> +                        modelField.getType() + " (${type.getJavaType()} - ${type.getSqlType()})" +
>>>> +                        '"/>'
>>>>               }
>>>> -            Collection pkNames = []
>>>> -            Iterator iter = modelEntity.getPksIterator()
>>>> -            while (iter != null && iter.hasNext()) {
>>>> -                ModelField curField = (ModelField) iter.next()
>>>> -                pkNames.add(curField.getName())
>>>> -            }
>>>> -            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo)
>>>> -            resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1)
>>>> -
>>>> -            arraySize = resultEli.getResultsSizeAfterPartialList()
>>>> -            if (arraySize < highIndex) {
>>>> -                highIndex = arraySize
>>>> -            }
>>>> -
>>>> -            resultEli.close()
>>>> -        } catch (GenericEntityException e) {
>>>> -            Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy")
>>>> -            try {
>>>> -                // only rollback the transaction if we started one...
>>>> -                TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
>>>> -            } catch (GenericEntityException e2) {
>>>> -                Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy")
>>>> -            }
>>>> -            // after rolling back, rethrow the exception
>>>> -            throw e
>>>> -        } finally {
>>>> -            // only commit the transaction if we started one... this will throw an exception if it fails
>>>> -            TransactionUtil.commit(beganTransaction)
>>>> -        }
>>>>       }
>>>> -}
>>>> -context.highIndex = highIndex
>>>> -context.arraySize = arraySize
>>>> -context.resultPartialList = resultPartialList
>>>> -
>>>> -viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
>>>> -context.viewIndexLast = viewIndexLast
>>>> -
>>>> -List fieldList = []
>>>> -fieldIterator = modelEntity.getFieldsIterator()
>>>> -while (fieldIterator.hasNext()) {
>>>> -    ModelField field = fieldIterator.next()
>>>> -    ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType())
>>>> -
>>>> -    Map fieldMap = [:]
>>>> -    fieldMap.put("name", field.getName())
>>>> -    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
>>>> -    fieldMap.put("javaType", type.getJavaType())
>>>> -    fieldMap.put("sqlType", type.getSqlType())
>>>> -    fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""))
>>>> -
>>>> -    fieldList.add(fieldMap)
>>>> -}
>>>> -context.fieldList = fieldList
>>>> -context.columnCount = fieldList.size()+2
>>>> -
>>>> -List records = []
>>>> -if (resultPartialList != null) {
>>>> -    Iterator resultPartialIter = resultPartialList.iterator()
>>>> -    while (resultPartialIter.hasNext()) {
>>>> -        Map record = [:]
>>>> -
>>>> -        GenericValue value = (GenericValue)resultPartialIter.next()
>>>> -        String findString = "entityName=" + entityName
>>>> -        Iterator pkIterator = modelEntity.getPksIterator()
>>>> -        while (pkIterator.hasNext()) {
>>>> -            ModelField pkField = pkIterator.next()
>>>> -            ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType())
>>>> -            findString += "&" + pkField.getName() + "=" + value.get(pkField.getName())
>>>> -        }
>>>> -        record.put("findString", findString)
>>>> +    dynamicAutoEntityFieldSearchForm = dynamicAutoEntityFieldSearchForm + '</form></forms>'
>>>> +    Document dynamicAutoEntityFieldSearchFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldSearchForm, true, true)
>>>> +    Map<String, ModelForm> modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldSearchFormXml, entityModelReader,
>>>> dispatcher.getDispatchContext(), null)
>>>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>>>> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
>>>> +        modelForm = entry.getValue()
>>>> +    }
>>>>   -        record.put("fields", value)
>>>> -        records.add(record)
>>>> +    MacroFormRenderer renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
>>>> +    FormRenderer dynamicAutoEntitySearchFormRenderer = new FormRenderer(modelForm, renderer)
>>>> +    Writer writer = new StringWriter()
>>>> +    dynamicAutoEntitySearchFormRenderer.render(writer, context)
>>>> +    context.dynamicAutoEntitySearchForm = writer
>>>> +
>>>> +    //prepare the result list from performFind
>>>> +    String dynamicAutoEntityFieldListForm = '<?xml version="1.0" encoding="UTF-8"?><forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form 
>>>> http://ofbiz.apache.org/dtds/widget-form.xsd">' +
>>>> +            '<form name="ListGeneric" type="list" target="FindGeneric" list-name="listIt" ' +
>>>> +            '  odd-row-style="alternate-row" default-table-style="basic-table light-grid hover-bar">' +
>>>> +            '<actions><service service-name="performFind">' +
>>>> +            '<field-map field-name="inputFields" from-field="parameters"/>' +
>>>> +            '<field-map field-name="entityName" value="' + entityName + '"/>' +
>>>> +            '</service></actions>' +
>>>> +            '<auto-fields-entity entity-name="' + entityName + '" default-field-type="display"/>' +
>>>> +            '<field name="entityName"><hidden value="' + entityName + '"/></field>' +
>>>> +            '<field name="viewGeneric" title=" "><hyperlink target="ViewGeneric" description="view">' +
>>>> +            '    <auto-parameters-entity entity-name="' + entityName + '"/>' +
>>>> +            '    <parameter param-name="entityName" value="' + entityName + '"/>' +
>>>> +            '</hyperlink></field>' +
>>>> +            '<sort-order><sort-field name="viewGeneric"/></sort-order>' +
>>>> +            '</form></forms>'
>>>> +    //Debug.logInfo(dynamicAutoEntityFieldForm, "")
>>>> +    Document dynamicAutoEntityFieldListFormXml = UtilXml.readXmlDocument(dynamicAutoEntityFieldListForm, true, true)
>>>> +    modelFormMap = FormFactory.readFormDocument(dynamicAutoEntityFieldListFormXml, entityModelReader, dispatcher.getDispatchContext(), null)
>>>> +    if (UtilValidate.isNotEmpty(modelFormMap)) {
>>>> +        Map.Entry<String, ModelForm> entry = modelFormMap.entrySet().iterator().next()
>>>> +        modelForm = entry.getValue()
>>>>       }
>>>> -}
>>>> -context.records = records
>>>> -context.lowCount = lowIndex
>>>> -context.highCount = lowIndex + records.size() - 1
>>>> -context.total = arraySize
>>>> +    renderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", "screen.formrenderer"), request, response)
>>>> +    FormRenderer dynamicAutoEntityListFormRenderer = new FormRenderer(modelForm, renderer)
>>>> +    Writer writerList = new StringWriter()
>>>> +    dynamicAutoEntityListFormRenderer.render(writerList, context)
>>>> +    context.dynamicAutoEntityListForm = writerList
>>>> +}
>>>> \ No newline at end of file
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityMaint.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -83,7 +83,7 @@ under the License.
>>>>                   <#if entity.entityPermissionView == 'Y'>
>>>>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsReln}</a>
>>>>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'>${uiLabelMap.WebtoolsFind}</a>
>>>> -                  <a
>>>> href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>>>> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'>${uiLabelMap.WebtoolsAll}</a>
>>>>                   </#if>
>>>>                 <#else>
>>>>                   <#if entity.entityPermissionCreate == 'Y'>
>>>> @@ -92,7 +92,7 @@ under the License.
>>>>                   <#if entity.entityPermissionView == 'Y'>
>>>>                     <a href='<@ofbizUrl>ViewRelations?entityName=${entity.entityName}</@ofbizUrl>'
>>>> title='${uiLabelMap.WebtoolsViewRelations}'>${uiLabelMap.WebtoolsReln}</a>
>>>>                     <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}</@ofbizUrl>'
>>>> title='${uiLabelMap.WebtoolsFindRecord}'>${uiLabelMap.WebtoolsFind}</a>
>>>> -                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>>>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>>>> +                  <a href='<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>>>> title='${uiLabelMap.WebtoolsFindAllRecords}'>${uiLabelMap.WebtoolsAll}</a>
>>>>                   </#if>
>>>>                 </#if>
>>>>               </td>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/EntityRefMain.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -63,7 +63,7 @@ under the License.
>>>>                               </div>
>>>> <div>${entity.title}&nbsp;
>>>>                                   <#if !forstatic>
>>>> -                                    <a target='main'
>>>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>>>> +                                    <a target='main'
>>>> href="<@ofbizUrl>FindGeneric?entityName=${entity.entityName}&amp;noConditionFind=Y</@ofbizUrl>">[${uiLabelMap.WebtoolsViewData}]</a>
>>>>                                   </#if>
>>>>                                   <#if !forstatic>
>>>>                                       <a target='main'
>>>> href="<@ofbizUrl>ArtifactInfo?name=${entity.entityName}&amp;type=entity</@ofbizUrl>">[${uiLabelMap.WebtoolsArtifactInfo}]</a>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/FindGeneric.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -16,27 +16,6 @@ KIND, either express or implied.  See th
>>>>   specific language governing permissions and limitations
>>>>   under the License.
>>>>   -->
>>>> -        <form method="post" action="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>">
>>>> -          <input type="hidden" name="find" value="true"/>
>>>> -          <input type="hidden" name="searchOptions_collapsed" value="true"/>
>>>> -          <table class="basic-table" cellspacing="0">
>>>> -            <tr class="header-row-2">
>>>> - <td>${uiLabelMap.WebtoolsFieldName}</td>
>>>> -              <td>${uiLabelMap.WebtoolsPk}</td>
>>>> - <td>${uiLabelMap.WebtoolsFieldType}</td>
>>>> -              <td>&nbsp;</td>
>>>> -            </tr>
>>>> -            <#list fieldList as field>
>>>> -                <tr>
>>>> -                    <td>${field.name}</td>
>>>> -                    <td><#if field.isPk == 'Y'>*</#if></td>
>>>> - <td>${field.javaType},&nbsp;${field.sqlType}</td>
>>>> -                    <td><input type="text" name="${field.name}" value="${field.param}" size="40"/></td>
>>>> -                </tr>
>>>> -            </#list>
>>>> -                <tr>
>>>> -                    <td colspan="3"><h3>${uiLabelMap.WebtoolsToFindAll} ${entityName}, ${uiLabelMap.WebtoolsLeaveAllEntriesBlank}</h3></td>
>>>> -                    <td><input type="submit" value="${uiLabelMap.CommonFind}"/></td>
>>>> -                </tr>
>>>> -            </table>
>>>> -        </form>
>>>> +    <#if entityName?has_content>
>>>> +        ${dynamicAutoEntitySearchForm?string}
>>>> +    </#if>
>>>> \ No newline at end of file
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ListGeneric.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -16,42 +16,8 @@ KIND, either express or implied.  See th
>>>>   specific language governing permissions and limitations
>>>>   under the License.
>>>>   -->
>>>> -        <#if (arraySize > 0)>
>>>> -            <#assign
>>>> commonUrl="FindGeneric?${curFindString}&amp;searchOptions_collapsed=${(parameters.searchOptions_collapsed)?default(\"false\")}&amp;"/>
>>>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex
>>>> commonDisplaying=commonDisplaying/>
>>>> -        </#if>
>>>> -          <table class="basic-table hover-bar" cellspacing="0">
>>>> -            <tr class="header-row-2">
>>>> -                <td>&nbsp;</td>
>>>> -                <#list fieldList as field>
>>>> -                    <td>${field.name}</td>
>>>> -                </#list>
>>>> -            </tr>
>>>> -            <#if resultPartialList?has_content>
>>>> -                <#assign alt_row = false>
>>>> -                <#list records as record>
>>>> -                    <tr<#if alt_row> class="alternate-row"</#if>>
>>>> -                        <td class="button-col">
>>>> -                            <a href='<@ofbizUrl>ViewGeneric?${record.findString}</@ofbizUrl>'>${uiLabelMap.CommonView}</a>
>>>> -                        <#if hasDeletePermission == 'Y'>
>>>> -                            <a onclick="return confirm ('${uiLabelMap.WebtoolsConfirmDelete}')"
>>>> href='<@ofbizUrl>UpdateGeneric?${record.findString}&amp;UPDATE_MODE=DELETE</@ofbizUrl>'>${uiLabelMap.CommonDelete}</a>
>>>> -                        </#if>
>>>> -                        </td>
>>>> -                        <#list fieldList as field>
>>>> - <td>${Static["org.apache.ofbiz.base.util.UtilFormatOut"].makeString(record.fields.get(field.name))}</td>
>>>> -                            <#-- <td>${record.fields.get(field.name)!?string}</td> -->
>>>> -                        </#list>
>>>> -                    </tr>
>>>> -                    <#assign alt_row = !alt_row>
>>>> -                </#list>
>>>> -            <#else>
>>>> -                <tr>
>>>> -                    <td colspan="${columnCount}">
>>>> - <h2>${uiLabelMap.WebtoolsNoEntityRecordsFound} ${entityName}.</h2>
>>>> -                    </td>
>>>> -                </tr>
>>>> -            </#if>
>>>> -        </table>
>>>> -        <#if (arraySize > 0)>
>>>> -            <@htmlTemplate.nextPrev commonUrl=commonUrl listSize=arraySize viewSize=viewSize viewIndex=viewIndex highIndex=highIndex />
>>>> -        </#if>
>>>> +    <#if entityName?has_content>
>>>> +        ${dynamicAutoEntityListForm?string}
>>>> +    <#else>
>>>> + ${uiLabelMap['genericWebEvent.entity_name_not_specified']}
>>>> +    </#if>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewGeneric.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -50,7 +50,7 @@ function ShowTab(lname) {
>>>>       <h2>${uiLabelMap.WebtoolsWithPk}: ${findByPk}</h2>
>>>>       <br />
>>>>       <div class="button-bar">
>>>> -      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'
>>>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>> +      <a href='<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;noConditionFind=Y</@ofbizUrl>'
>>>> class="buttontext">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>>         <#if enableEdit = "false">
>>>>           <#if hasCreatePermission>
>>>>             <a href='<@ofbizUrl>ViewGeneric?entityName=${entityName}&amp;enableEdit=true</@ofbizUrl>' class="buttontext
>>>> create">${uiLabelMap.CommonCreateNew}</a>
>>>> @@ -228,7 +228,7 @@ function ShowTab(lname) {
>>>>               <div class="screenlet-title-bar">
>>>>                 <ul>
>>>>                   <li class="h3">${uiLabelMap.WebtoolsRelatedEntity}: ${relation.title}${relation.relatedTable} (${relation.type})</li>
>>>> -                <li><a
>>>> href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>>>> +                <li><a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonFind}</a></li>
>>>>                   <#if relation.valueRelated?has_content>
>>>>                     <li><a href="<@ofbizUrl>ViewGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>">${uiLabelMap.CommonView}</a></li>
>>>>                   </#if>
>>>> @@ -257,7 +257,7 @@ function ShowTab(lname) {
>>>>                 <#if "one" = relation.type>
>>>> <b>${uiLabelMap.WebtoolsNoValueFoundFor}</b> ${relation.title}${relation.relatedTable}.
>>>>                 <#else>
>>>> -              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}&amp;find=true</@ofbizUrl>"
>>>> class="buttontext">${uiLabelMap.CommonFind}</a>
>>>> +              <a href="<@ofbizUrl>FindGeneric?${relation.encodeRelatedEntityFindString}</@ofbizUrl>"
>>>> class="buttontext">${uiLabelMap.CommonFind}</a>
>>>>                 </#if>
>>>>               </#if>
>>>>             </div>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/template/entity/ViewRelations.ftl Fri Feb 17 17:00:31 2017
>>>> @@ -29,7 +29,7 @@ under the License.
>>>>           <h2>${uiLabelMap.WebtoolsForEntity}: ${entityName}</h2>
>>>>           <br />
>>>>           <div class="button-bar">
>>>> -            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>"
>>>> class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>> +            <a href="<@ofbizUrl>FindGeneric?entityName=${entityName}</@ofbizUrl>" class="smallSubmit">${uiLabelMap.WebtoolsBackToFindScreen}</a>
>>>>           </div>
>>>>           <br />
>>>>           <table class="basic-table hover-bar" cellspacing="0">
>>>> @@ -44,7 +44,7 @@ under the License.
>>>>               <#list relations as relation>
>>>>                   <tr<#if alt_row> class="alternate-row"</#if>>
>>>>                       <td>${relation.title}</td>
>>>> -                    <td class="button-col"><a
>>>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}&amp;find=true&amp;VIEW_SIZE=50&amp;VIEW_INDEX=0</@ofbizUrl>'>${relation.relEntityName}</a></td>
>>>> +                    <td class="button-col"><a
>>>> href='<@ofbizUrl>FindGeneric?entityName=${relation.relEntityName}</@ofbizUrl>'>${relation.relEntityName}</a></td>
>>>>                       <td>${relation.type}</td>
>>>> <td>${relation.fkName}</td>
>>>>                       <td>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/EntityScreens.xml Fri Feb 17 17:00:31 2017
>>>> @@ -194,6 +194,7 @@ under the License.
>>>>                   <if-has-permission permission="ENTITY_MAINT"/>
>>>>               </condition>
>>>>               <actions>
>>>> +                <property-map resource="WebtoolsErrorUiLabels" map-name="uiLabelMap"/>
>>>>                   <script location="component://webtools/groovyScripts/entity/FindGeneric.groovy"/>
>>>>                   <property-map resource="CommonUiLabels" map-name="uiLabelMap"/>
>>>>                   <property-map resource="WebtoolsUiLabels" map-name="uiLabelMap"/>
>>>> @@ -209,10 +210,10 @@ under the License.
>>>>                                   <container style="button-bar button-style-1">
>>>>                                       <link target="entitymaint" text="${uiLabelMap.WebtoolsBackToEntityList}"/>
>>>>                                       <link target="ViewRelations" text="${uiLabelMap.WebtoolsViewRelations}">
>>>> -                                        <parameter param-name="entityName" from-field="entityName"/>
>>>> +                                        <parameter param-name="entityName"/>
>>>>                                       </link>
>>>>                                       <link target="ViewGeneric" text="${uiLabelMap.CommonCreateNew}" style="create">
>>>> -                                        <parameter param-name="entityName" from-field="entityName"/>
>>>> +                                        <parameter param-name="entityName"/>
>>>>                                           <parameter param-name="enableEdit" value="true"/>
>>>>                                       </link>
>>>>                                   </container>
>>>>
>>>> Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml?rev=1783427&r1=1783426&r2=1783427&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml (original)
>>>> +++ ofbiz/ofbiz-framework/trunk/framework/webtools/widget/Menus.xml Fri Feb 17 17:00:31 2017
>>>> @@ -242,7 +242,7 @@ under the License.
>>>>           <menu-item name="all" title="${uiLabelMap.WebtoolsAll}">
>>>>               <link target="FindGeneric">
>>>>                   <parameter param-name="entityName"/>
>>>> -                <parameter param-name="find" value="true"/>
>>>> +                <parameter param-name="noConditionFind" value="Y"/>
>>>>               </link>
>>>>           </menu-item>
>>>>       </menu>
>>>>
>>>>
>>>>
>>>
>>
>>
>
>
>