From 3fc434f86c460a6fd91583d624e06cd8a0fa5bd2 Mon Sep 17 00:00:00 2001 From: Adrian Crum Date: Wed, 22 Jun 2011 14:39:06 +0000 Subject: [PATCH] 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 --- .../widget/templates/htmlFormMacroLibrary.ftl | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/framework/widget/templates/htmlFormMacroLibrary.ftl b/framework/widget/templates/htmlFormMacroLibrary.ftl index 7f49fb710f..45c1e503ca 100644 --- a/framework/widget/templates/htmlFormMacroLibrary.ftl +++ b/framework/widget/templates/htmlFormMacroLibrary.ftl @@ -548,20 +548,20 @@ ${item.description} 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)> + + +<#if (!ajaxUrl?has_content) && ajaxEnabled> + <#local ajaxUrl = requestAttributes._REQUEST_HANDLER_.makeLink(request, response, fieldFormName)/> + <#local ajaxUrl = id + "," + ajaxUrl + ",ajaxLookup=Y" /> + +<#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 ajaxEnabled?has_content && ajaxEnabled>