code using it, that wraps most of the OFBiz integration with FreeMarker. This is the list of the main modifications: * simplified and cleaned up the public methods of FreeMarkerWorker, used to retrieve and render Freemarker templates and changed client code accordingly to use them * removed unused methods in FreeMarkerWorker and made some others private * improved the integration code in FreeMarkerWorker to better use the Freemarker API and specifically to leverage the various TemplateLoaders and the Freemarker caching mechanism; it is now possible to switch the OFBiz legacy template caching mechanism to use the Freemarker one instead * improved the implementation of Freemarker template rendering from strings (used by DataResourceWorker): it now leverages the Freemarker's StringTemplateLoader that provides the ability to cache the strings, retrieved from DataResources records, based on the timestamp of the last modification * moved freemarkerImports.properties from "widget" to "base" component, and changed its content (and the content of the associated templates AutoImportTemplate.ftl and HtmlTemplate.ftl) to remove the dependency from base to widget&common; some resources of "widget" and "common" are still referenced from AutoImportTemplate.ftl (that is in "base") but even if they are soft dependencies: if they are missing the system will load properly without any error or warning; before this change it was impossible to use, or unit test, FreeMarkerWorker before the "widget" and "common" components were loaded by the system, now it is possible * created a new class for unit tests for FreeMarkerWorker, named FreeMarkerWorkerTests: at the moment it contains just one simple unit test but more should be implemented * refactored WebToolsServices.entityImport(...) to leverage the FreeMarkerWorker.renderTemplate(...) method to run the Freemarker template, rather than dealing with the Freemarker API directly; this is now possible thanks to the cleanups and improvements done in the FreeMarkerWorker class; this same approach should be implemented for a few other similar integration points (mostly in the "content" component); this is a TODO item * moved the encodeDoubleQuotes(...) method from FreeMarkerWorker to MacroFormRenderer and made it private since this is the only calss using it and its logic is not related to FreeMarker git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1762227 13f79535-47bb-0310-9956-ffa450edef68
68 lines
4.1 KiB
Plaintext
68 lines
4.1 KiB
Plaintext
<#--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<#macro lookupField className="" alert="" name="" value="" size="20" maxlength="20" id="" event="" action="" readonly="" autocomplete="" descriptionFieldName="" formName="" fieldFormName="" targetParameterIter="" imgSrc="" ajaxUrl="" ajaxEnabled="" presentation="layer" width="" height="" position="topleft" fadeBackground="true" clearText="" showDescription="" initiallyCollapsed="" tabindex="">
|
|
<#if (!ajaxEnabled?has_content)>
|
|
<#assign javascriptEnabled = Static["org.apache.ofbiz.base.util.UtilHttp"].isJavaScriptEnabled(request) />
|
|
<#if (javascriptEnabled)>
|
|
<#local ajaxEnabled = true>
|
|
</#if>
|
|
</#if>
|
|
<#if (!id?has_content)>
|
|
<#local id = Static["org.apache.ofbiz.base.util.UtilHttp"].getNextUniqueId(request) />
|
|
</#if>
|
|
<#if "true" == readonly>
|
|
<#local readonly = true/>
|
|
<#else>
|
|
<#local readonly = false />
|
|
</#if>
|
|
<#if userPreferences.VISUAL_THEME == "BIZZNESS_TIME">
|
|
<#local position = "center" />
|
|
</#if>
|
|
<@renderLookupField name formName fieldFormName className alert value size maxlength id event action readonly autocomplete descriptionFieldName targetParameterIter imgSrc ajaxUrl ajaxEnabled presentation width height position fadeBackground clearText showDescription initiallyCollapsed tabindex/>
|
|
</#macro>
|
|
|
|
<#macro nextPrev commonUrl="" ajaxEnabled=false javaScriptEnabled=false paginateStyle="nav-pager" paginateFirstStyle="nav-first" viewIndex=0 highIndex=0 listSize=0 viewSize=1 ajaxFirstUrl="" firstUrl="" paginateFirstLabel="" paginatePreviousStyle="nav-previous" ajaxPreviousUrl="" previousUrl="" paginatePreviousLabel="" pageLabel="" ajaxSelectUrl="" selectUrl="" ajaxSelectSizeUrl="" selectSizeUrl="" commonDisplaying="" paginateNextStyle="nav-next" ajaxNextUrl="" nextUrl="" paginateNextLabel="" paginateLastStyle="nav-last" ajaxLastUrl="" lastUrl="" paginateLastLabel="" paginateViewSizeLabel="" >
|
|
<#local javaScriptEnabled = javaScriptEnabled />
|
|
<#if (!javaScriptEnabled)>
|
|
<#local javaScriptEnabled = Static["org.apache.ofbiz.base.util.UtilHttp"].isJavaScriptEnabled(request) />
|
|
</#if>
|
|
<#if (commonUrl?has_content)>
|
|
<#if (!firstUrl?has_content)>
|
|
<#local firstUrl=commonUrl+"VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndexFirst}"/>
|
|
</#if>
|
|
<#if (!previousUrl?has_content)>
|
|
<#local previousUrl=commonUrl+"VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndexPrevious}"/>
|
|
</#if>
|
|
<#if (!nextUrl?has_content)>
|
|
<#local nextUrl=commonUrl+"VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndexNext}"/>
|
|
</#if>
|
|
<#if (!lastUrl?has_content)>
|
|
<#local lastUrl=commonUrl+"VIEW_SIZE=${viewSize}&VIEW_INDEX=${viewIndexLast}"/>
|
|
</#if>
|
|
<#if (!selectUrl?has_content)>
|
|
<#local selectUrl=commonUrl+"VIEW_SIZE=${viewSize}&VIEW_INDEX="/>
|
|
</#if>
|
|
<#if (!selectSizeUrl?has_content)>
|
|
<#local selectSizeUrl=commonUrl+"VIEW_SIZE='+this.value+'&VIEW_INDEX=0"/>
|
|
</#if>
|
|
</#if>
|
|
<@renderNextPrev paginateStyle paginateFirstStyle viewIndex highIndex listSize viewSize ajaxEnabled javaScriptEnabled ajaxFirstUrl firstUrl uiLabelMap.CommonFirst paginatePreviousStyle ajaxPreviousUrl previousUrl uiLabelMap.CommonPrevious uiLabelMap.CommonPage ajaxSelectUrl selectUrl ajaxSelectSizeUrl selectSizeUrl commonDisplaying paginateNextStyle ajaxNextUrl nextUrl uiLabelMap.CommonNext paginateLastStyle ajaxLastUrl lastUrl uiLabelMap.CommonLast uiLabelMap.CommonItemsPerPage/>
|
|
</#macro>
|