More work on the renderLookupField Freemarker macro: Improved documentation, provide default values for optional parameters, jQuery bug fix.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1138485 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian Crum
2011-06-22 14:39:06 +00:00
parent e94051396b
commit 3fc434f86c
@@ -548,20 +548,20 @@ ${item.description}</span>
Description: Renders a text input field as a lookup field.
Parameter: name, String, required - The name of the lookup field.
Parameter: formName, String, required - The name of the form that contains the lookup field.
Parameter: fieldFormName, String, required - Contains the lookup window form name.
Parameter: className, String, optional - The CSS class name for the lookup field.
Parameter: alert, String, optional - If "true" then the "alert" CSS class will be added to the lookup field.
Parameter: name, String, required - The name of the lookup field.
Parameter: value, String, optional - The value of the lookup field.
Parameter: value, Object, optional - The value of the lookup field.
Parameter: size, String, optional - The size of the lookup field.
Parameter: maxlength, String or Integer, optional - The max length of the lookup field.
Parameter: id, String or Integer, optional - The ID of the lookup field.
Parameter: id, String, optional - The ID of the lookup field.
Parameter: event, String, optional - The lookup field event that invokes "action". If the event parameter is not empty, then the action parameter must be specified as well.
Parameter: action, String, optional - The action that is invoked on "event". If action parameter is not empty, then the event parameter must be specified as well.
Parameter: readonly, boolean, optional - If true, the lookup field is made read-only.
Parameter: autocomplete, String, optional - If not empty, autocomplete is turned off for the lookup field.
Parameter: descriptionFieldName, String, optional - If not empty and the presentation parameter contains "window", specifies an alternate input field for updating.
Parameter: formName, String, required - The name of the form that contains the lookup field.
Parameter: fieldFormName, String, optional - Contains the lookup window form name, used only when the presentation parameter contains "window".
Parameter: targetParameterIter, List, optional - Contains a list of form field names whose values will be passed to the lookup window.
Parameter: imgSrc, Not used.
Parameter: ajaxUrl, String, optional - Contains the Ajax URL, used only when the ajaxEnabled parameter contains true.
@@ -576,7 +576,22 @@ Parameter: showDescription, String, optional - ? (contains "true" or "false").
Parameter: initiallyCollapsed, Not used.
Parameter: lastViewName, String, optional - If the ajaxEnabled parameter is true, the contents of lastViewName will be appended to the Ajax URL.
-->
<#macro renderLookupField className alert name value size maxlength id event action readonly autocomplete descriptionFieldName formName fieldFormName targetParameterIter imgSrc ajaxUrl ajaxEnabled presentation width height position fadeBackground clearText showDescription initiallyCollapsed lastViewName="main" >
<#macro renderLookupField name formName fieldFormName className="" alert="false" value="" size="" maxlength="" id="" event="" action="" readonly=false autocomplete="" descriptionFieldName="" targetParameterIter="" imgSrc="" ajaxUrl="" ajaxEnabled=javaScriptEnabled presentation="layer" width="" height="" position="" fadeBackground="true" clearText="" showDescription="" initiallyCollapsed="" lastViewName="main" >
<#if Static["org.ofbiz.widget.ModelWidget"].widgetBoundaryCommentsEnabled(context)>
<!-- @renderLookupField -->
</#if>
<#if (!ajaxUrl?has_content) && ajaxEnabled>
<#local ajaxUrl = requestAttributes._REQUEST_HANDLER_.makeLink(request, response, fieldFormName)/>
<#local ajaxUrl = id + "," + ajaxUrl + ",ajaxLookup=Y" />
</#if>
<#if (!showDescription?has_content)>
<#local showDescriptionProp = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("widget.properties", "widget.lookup.showDescription", "N")>
<#if "Y" == showDescriptionProp>
<#local showDescription = "true" />
<#else>
<#local showDescription = "false" />
</#if>
</#if>
<#if ajaxEnabled?has_content && ajaxEnabled>
<script type="text/javascript">
jQuery(document).ready(function(){
@@ -619,7 +634,7 @@ Parameter: lastViewName, String, optional - If the ajaxEnabled parameter is true
</#if>
<script type="text/javascript">
jQuery(document).ready(function(){
new ConstructLookup("${fieldFormName}", "${id}", document.${formName?html}.${name?html}, <#if descriptionFieldName?has_content>document.${formName?html}.${descriptionFieldName}<#else>null</#if>, "${formName?html}", "${width}", "${height}", "${position}", "${fadeBackground}", <#if ajaxEnabled?has_content && ajaxEnabled>"${ajaxUrl}", "${showDescription}"<#else>"", ""</#if>, "${presentation!}", "${defaultMinLength!2}", "${defaultDelay!300}"<#rt/>
new ConstructLookup("${fieldFormName}", "${id}", document.${formName?html}.${name?html}, <#if descriptionFieldName?has_content>document.${formName?html}.${descriptionFieldName}<#else>null</#if>, "${formName?html}", "${width}", "${height}", "${position}", "${fadeBackground}", <#if ajaxEnabled?has_content && ajaxEnabled>"${ajaxUrl}", ${showDescription}<#else>"", ""</#if>, "${presentation!}", "${defaultMinLength!2}", "${defaultDelay!300}"<#rt/>
<#if targetParameterIter?has_content>
<#assign isFirst = true>
<#lt/>, [<#rt/>