(OFBIZ-9846) Replaced inline js from renderFormClose macro to external js in OfbizUtils.js Done following: Used custom data attributes: data-focus-field to define focus field for the form. Used attribute selector to find elements and set focus on the particular field. Added "requireValidation" class to all the forms with required fields. Used the class selector to find such forms & attached Validator plugin to it. Steps to verify: At add ProdCatalog page: https://localhost:8443/catalog/control/EditProdCatalog Dialogs: New Example dialog on Find Example page Go to Find Example page https://localhost:8443/example/control/FindExample Click on New Example button Validations should work in dialog on form submit. Additional Changes: Link for dialog in HtmlMenuMacroLibrary still had the inline code. Replaced the code with external js code. Validations on forms rendered with renderSubmitField macro from HtmlFormMacroLibrary.ftl seems not working https://demo-trunk.ofbiz.apache.org/partymgr/control/NewEmployee, will create a separate ticket for it. jleroux: I agree about NewEmployee issue As mentionned Aditya themes/rainbowstone/template/HtmlMenuMacroLibrary.ftl was redundant, removed I also removed commented out code in rainbowstone HtmlMenuMacroLibrary.ftl (left by Aditya while working on the issue I guess) Thanks: Aditya git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1832307 13f79535-47bb-0310-9956-ffa450edef68
330 lines
17 KiB
Plaintext
330 lines
17 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 renderScreenBegin>
|
|
<!DOCTYPE html>
|
|
</#macro>
|
|
|
|
<#macro renderScreenEnd>
|
|
</#macro>
|
|
|
|
<#macro renderSectionBegin boundaryComment>
|
|
<#if boundaryComment?has_content>
|
|
<!-- ${boundaryComment} -->
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderSectionEnd boundaryComment>
|
|
<#if boundaryComment?has_content>
|
|
<!-- ${boundaryComment} -->
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderContainerBegin id autoUpdateInterval style="" autoUpdateLink="">
|
|
<#if autoUpdateLink?has_content>
|
|
<script type="text/javascript">ajaxUpdateAreaPeriodic('${id}', '${autoUpdateLink}', '', '${autoUpdateInterval}');</script>
|
|
</#if>
|
|
<div<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>>
|
|
</#macro>
|
|
<#macro renderContainerEnd></div></#macro>
|
|
<#macro renderContentBegin enableEditValue editContainerStyle editRequest=""><#if editRequest?has_content && "true" == enableEditValue><div class=${editContainerStyle}></#if></#macro>
|
|
<#macro renderContentBody></#macro>
|
|
<#macro renderContentEnd editMode editContainerStyle enableEditValue editRequest="" urlString="" >
|
|
<#if editRequest?? && "true" == enableEditValue>
|
|
<#if urlString??><a href="${urlString}">${editMode}</a><#rt/></#if>
|
|
<#if editContainerStyle??></div><#rt/></#if>
|
|
</#if>
|
|
</#macro>
|
|
<#macro renderSubContentBegin editContainerStyle enableEditValue editRequest=""><#if editRequest?? && "true" == enableEditValue><div class="${editContainerStyle}"></#if></#macro>
|
|
<#macro renderSubContentBody></#macro>
|
|
<#macro renderSubContentEnd editMode editContainerStyle enableEditValue editRequest="" urlString="">
|
|
<#if editRequest?? && "true" == enableEditValue>
|
|
<#if urlString??><a href="${urlString}">${editMode}</a><#rt/></#if>
|
|
<#if editContainerStyle??></div><#rt/></#if>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderHorizontalSeparator id="" style=""><hr<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>/></#macro>
|
|
|
|
<#macro renderLabel text id="" style="">
|
|
<#if text?has_content>
|
|
<#-- If a label widget has one of the h1-h6 styles, then it is considered block level element.
|
|
Otherwise it is considered an inline element. -->
|
|
<#assign idText = ""/>
|
|
<#if id?has_content><#assign idText = " id=\"${id}\""/></#if>
|
|
<#if style?has_content>
|
|
<#if style=="h1">
|
|
<h1${idText}>${text}</h1>
|
|
<#elseif style=="h2">
|
|
<h2${idText}>${text}</h2>
|
|
<#elseif style=="h3">
|
|
<h3${idText}>${text}</h3>
|
|
<#elseif style=="h4">
|
|
<h4${idText}>${text}</h4>
|
|
<#elseif style=="h5">
|
|
<h5${idText}>${text}</h5>
|
|
<#elseif style=="h6">
|
|
<h6${idText}>${text}</h6>
|
|
<#else>
|
|
<span${idText} class="${style}">${text}</span>
|
|
</#if>
|
|
<#else>
|
|
<span${idText}>${text}</span>
|
|
</#if>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderLink parameterList target uniqueItemName linkType actionUrl linkUrl targetWindow="" id="" style="" name="" text="" imgStr="" height="600" width="800">
|
|
<#if "layered-modal" != linkType>
|
|
<#if "hidden-form" == linkType>
|
|
<form method="post" action="${actionUrl}" <#if targetWindow?has_content>target="${targetWindow}"</#if> onsubmit="javascript:submitFormDisableSubmits(this)" name="${uniqueItemName}"><#rt/>
|
|
<#list parameterList as parameter>
|
|
<input name="${parameter.name}" value="${parameter.value}" type="hidden"/><#rt/>
|
|
</#list>
|
|
</form><#rt/>
|
|
</#if>
|
|
<a
|
|
<#if id?has_content>id="${id}"</#if>
|
|
<#if style?has_content>class="${style}"</#if>
|
|
<#if name?has_content>name="${name}"</#if>
|
|
<#if targetWindow?has_content>target="${targetWindow}"</#if>
|
|
href="<#if "hidden-form"==linkType>javascript:document.${uniqueItemName}.submit()<#else>${linkUrl}</#if>"><#rt/>
|
|
<#if imgStr?has_content>${imgStr}</#if><#if text?has_content>${text}</#if>
|
|
</a>
|
|
<#else>
|
|
<#local params = "{ 'presentation': 'layer'">
|
|
<#if parameterList?has_content>
|
|
<#list parameterList as parameter>
|
|
<#local params += ",'${parameter.name}': '${parameter.value}'">
|
|
</#list>
|
|
</#if>
|
|
<#local params += " }">
|
|
<a href="javascript:void(0);" id="${uniqueItemName}_link"
|
|
data-dialog-params="${params}"
|
|
data-dialog-width="${width}"
|
|
data-dialog-height="${height}"
|
|
data-dialog-url="${target}"
|
|
<#if text?has_content>data-dialog-title="${text}"</#if>
|
|
<#if style?has_content>class="${style}"</#if>>
|
|
<#if text?has_content>${text}</#if></a>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderImage src id style wid hgt border alt urlString>
|
|
<#if src?has_content>
|
|
<img <#if id?has_content>id="${id}"</#if><#if style?has_content> class="${style}"</#if><#if wid?has_content> width="${wid}"</#if><#if hgt?has_content> height="${hgt}"</#if><#if border?has_content> border="${border}"</#if> alt="<#if alt?has_content>${alt}</#if>" src="${urlString}" />
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderContentFrame fullUrl width height border=""><iframe src="${fullUrl}" width="${width}" height="${height}" <#if border?has_content>border="${border}"</#if> /></#macro>
|
|
<#macro renderScreenletBegin collapsible saveCollapsed collapsibleAreaId expandToolTip collapseToolTip fullUrlString padded menuString showMore collapsed javaScriptEnabled id="" title="">
|
|
<div class="screenlet"<#if id?has_content> id="${id}"</#if>><#rt/>
|
|
<#if showMore>
|
|
<div class="screenlet-title-bar"><ul><#if title?has_content><li class="h3">${title}</li></#if>
|
|
<#if collapsible>
|
|
<li class="<#rt/>
|
|
<#if collapsed>
|
|
collapsed"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if expandToolTip?has_content> title="${expandToolTip}"</#if>
|
|
<#else>
|
|
expanded"><a <#if javaScriptEnabled>onclick="javascript:toggleScreenlet(this, '${collapsibleAreaId}', '${saveCollapsed?string}', '${expandToolTip}', '${collapseToolTip}');"<#else>href="${fullUrlString}"</#if><#if collapseToolTip?has_content> title="${collapseToolTip}"</#if>
|
|
</#if>
|
|
> </a></li>
|
|
</#if>
|
|
<#--
|
|
<#if !collapsed>
|
|
${menuString}
|
|
</#if>
|
|
-->
|
|
${menuString}
|
|
</ul><br class="clear" /></div>
|
|
</#if>
|
|
<div <#if collapsibleAreaId?has_content> id="${collapsibleAreaId}" <#if collapsed> style="display: none;"</#if></#if><#if padded> class="screenlet-body"<#else> class="screenlet-body no-padding"</#if>>
|
|
</#macro>
|
|
<#macro renderScreenletSubWidget></#macro>
|
|
<#macro renderScreenletEnd></div></div></#macro>
|
|
<#macro renderScreenletPaginateMenu lowIndex actualPageSize ofLabel listSize paginateLastStyle paginateLastLabel paginateNextStyle paginateNextLabel paginatePreviousLabel paginateFirstLabel firstLinkUrl="" lastLinkUrl="" nextLinkUrl="" previousLinkUrl="" paginatePreviousStyle="" paginateFirstStyle="">
|
|
<li class="${paginateLastStyle}<#if !lastLinkUrl?has_content> disabled</#if>"><#if lastLinkUrl?has_content><a href="${lastLinkUrl}">${paginateLastLabel}</a><#else>${paginateLastLabel}</#if></li>
|
|
<li class="${paginateNextStyle}<#if !nextLinkUrl?has_content> disabled</#if>"><#if nextLinkUrl?has_content><a href="${nextLinkUrl}">${paginateNextLabel}</a><#else>${paginateNextLabel}</#if></li>
|
|
<#if (listSize?number > 0) ><li>${lowIndex?number + 1} - ${lowIndex?number + actualPageSize?number} ${ofLabel} ${listSize}</li><#rt/></#if>
|
|
<li class="${paginatePreviousStyle?default("nav-previous")}<#if !previousLinkUrl?has_content> disabled</#if>"><#if previousLinkUrl?has_content><a href="${previousLinkUrl}">${paginatePreviousLabel}</a><#else>${paginatePreviousLabel}</#if></li>
|
|
<li class="${paginateFirstStyle?default("nav-first")}<#if !firstLinkUrl?has_content> disabled</#if>"><#if firstLinkUrl?has_content><a href="${firstLinkUrl}">${paginateFirstLabel}</a><#else>${paginateFirstLabel}</#if></li>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPageBegin originalPortalPageId portalPageId confMode="false" addColumnLabel="Add column" addColumnHint="Add a new column to this portal">
|
|
<#if "true" == confMode>
|
|
<a class="buttontext" href="javascript:document.addColumn_${portalPageId}.submit()" title="${addColumnHint}">${addColumnLabel}</a> <b>PortalPageId: ${portalPageId}</b>
|
|
<form method="post" action="addPortalPageColumn" name="addColumn_${portalPageId}">
|
|
<input name="portalPageId" value="${portalPageId}" type="hidden"/>
|
|
</form>
|
|
</#if>
|
|
<table width="100%">
|
|
<tr>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPageEnd>
|
|
</tr>
|
|
</table>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPageColumnBegin originalPortalPageId portalPageId columnSeqId confMode="false" width="auto" delColumnLabel="Delete column" delColumnHint="Delete this column" addPortletLabel="Add portlet" addPortletHint="Add a new portlet to this column" colWidthLabel="Col. width:" setColumnSizeHint="Set column size">
|
|
<#assign columnKey = portalPageId+columnSeqId>
|
|
<#assign columnKeyFields = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="columnSeqId" value="' + columnSeqId + '" type="hidden"/>'>
|
|
<script type="text/javascript">
|
|
if (typeof SORTABLE_COLUMN_LIST != "undefined") {
|
|
if (SORTABLE_COLUMN_LIST == null) {
|
|
SORTABLE_COLUMN_LIST = "#portalColumn_${columnSeqId}";
|
|
} else {
|
|
SORTABLE_COLUMN_LIST += ", #portalColumn_${columnSeqId}";
|
|
}
|
|
}
|
|
</script>
|
|
<td class="portal-column<#if "true" == confMode>-config</#if> connectedSortable" style="vertical-align: top; <#if width?has_content> width:${width};</#if>" id="portalColumn_${columnSeqId}">
|
|
<#if "true" == confMode>
|
|
<div class="portal-column-config-title-bar">
|
|
<ul>
|
|
<li>
|
|
<form method="post" action="deletePortalPageColumn" name="delColumn_${columnKey}">
|
|
${columnKeyFields}
|
|
</form>
|
|
<a class="buttontext" href="javascript:document.delColumn_${columnKey}.submit()" title="${delColumnHint}">${delColumnLabel}</a>
|
|
</li>
|
|
<li>
|
|
<form method="post" action="addPortlet" name="addPortlet_${columnKey}">
|
|
${columnKeyFields}
|
|
</form>
|
|
<a class="buttontext" href="javascript:document.addPortlet_${columnKey}.submit()" title="${addPortletHint}">${addPortletLabel}</a>
|
|
</li>
|
|
<li>
|
|
<form method="post" action="editPortalPageColumnWidth" name="setColumnSize_${columnKey}">
|
|
${columnKeyFields}
|
|
</form>
|
|
<a class="buttontext" href="javascript:document.setColumnSize_${columnKey}.submit()" title="${setColumnSizeHint}">${colWidthLabel}: ${width}</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<br class="clear"/>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPageColumnEnd>
|
|
</td>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPagePortletBegin originalPortalPageId portalPageId portalPortletId portletSeqId prevPortletId="" prevPortletSeqId="" nextPortletId="" nextPortletSeqId="" columnSeqId="" prevColumnSeqId="" nextColumnSeqId="" confMode="false" delPortletHint="Remove this portlet" editAttribute="false" editAttributeHint="Edit portlet parameters">
|
|
<#assign portletKey = portalPageId+portalPortletId+portletSeqId>
|
|
<#assign portletKeyFields = '<input name="portalPageId" value="' + portalPageId + '" type="hidden"/><input name="portalPortletId" value="' + portalPortletId + '" type="hidden"/><input name="portletSeqId" value="' + portletSeqId + '" type="hidden"/>'>
|
|
<div id="PP_${portletKey}" name="portalPortlet" class="noClass" portalPageId="${portalPageId}" portalPortletId="${portalPortletId}" columnSeqId="${columnSeqId}" portletSeqId="${portletSeqId}">
|
|
<#if "true" == confMode>
|
|
<div class="portlet-config" id="PPCFG_${portletKey}">
|
|
<div class="portlet-config-title-bar">
|
|
<ul>
|
|
<li class="title">Portlet : [${portalPortletId}]</li>
|
|
<li class="remove">
|
|
<form method="post" action="deletePortalPagePortlet" name="delPortlet_${portletKey}">
|
|
${portletKeyFields}
|
|
</form>
|
|
<a href="javascript:document.delPortlet_${portletKey}.submit()" title="${delPortletHint}"> </a>
|
|
</li>
|
|
<#if "true" == editAttribute>
|
|
<li class="edit">
|
|
<form method="post" action="editPortalPortletAttributes" name="editPortlet_${portletKey}">
|
|
${portletKeyFields}
|
|
</form>
|
|
<a href="javascript:document.editPortlet_${portletKey}.submit()" title="${editAttributeHint}"> </a>
|
|
</li>
|
|
</#if>
|
|
<#if prevColumnSeqId?has_content>
|
|
<li class="move-left">
|
|
<form method="post" action="updatePortletSeqDragDrop" name="movePortletLeft_${portletKey}">
|
|
<input name="o_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="o_portalPortletId" value="${portalPortletId}" type="hidden"/>
|
|
<input name="o_portletSeqId" value="${portletSeqId}" type="hidden"/>
|
|
<input name="destinationColumn" value="${prevColumnSeqId}" type="hidden"/>
|
|
<input name="mode" value="DRAGDROPBOTTOM" type="hidden"/>
|
|
</form>
|
|
<a href="javascript:document.movePortletLeft_${portletKey}.submit()"> </a></li>
|
|
</#if>
|
|
<#if nextColumnSeqId?has_content>
|
|
<li class="move-right">
|
|
<form method="post" action="updatePortletSeqDragDrop" name="movePortletRight_${portletKey}">
|
|
<input name="o_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="o_portalPortletId" value="${portalPortletId}" type="hidden"/>
|
|
<input name="o_portletSeqId" value="${portletSeqId}" type="hidden"/>
|
|
<input name="destinationColumn" value="${nextColumnSeqId}" type="hidden"/>
|
|
<input name="mode" value="DRAGDROPBOTTOM" type="hidden"/>
|
|
</form>
|
|
<a href="javascript:document.movePortletRight_${portletKey}.submit()"> </a></li>
|
|
</#if>
|
|
<#if prevPortletId?has_content>
|
|
<li class="move-up">
|
|
<form method="post" action="updatePortletSeqDragDrop" name="movePortletUp_${portletKey}">
|
|
<input name="o_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="o_portalPortletId" value="${portalPortletId}" type="hidden"/>
|
|
<input name="o_portletSeqId" value="${portletSeqId}" type="hidden"/>
|
|
<input name="d_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="d_portalPortletId" value="${prevPortletId}" type="hidden"/>
|
|
<input name="d_portletSeqId" value="${prevPortletSeqId}" type="hidden"/>
|
|
<input name="mode" value="DRAGDROPBEFORE" type="hidden"/>
|
|
</form>
|
|
<a href="javascript:document.movePortletUp_${portletKey}.submit()"> </a></li>
|
|
</#if>
|
|
<#if nextPortletId?has_content>
|
|
<li class="move-down">
|
|
<form method="post" action="updatePortletSeqDragDrop" name="movePortletDown_${portletKey}">
|
|
<input name="o_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="o_portalPortletId" value="${portalPortletId}" type="hidden"/>
|
|
<input name="o_portletSeqId" value="${portletSeqId}" type="hidden"/>
|
|
<input name="d_portalPageId" value="${portalPageId}" type="hidden"/>
|
|
<input name="d_portalPortletId" value="${nextPortletId}" type="hidden"/>
|
|
<input name="d_portletSeqId" value="${nextPortletSeqId}" type="hidden"/>
|
|
<input name="mode" value="DRAGDROPAFTER" type="hidden"/>
|
|
</form>
|
|
<a href="javascript:document.movePortletDown_${portletKey}.submit()"> </a></li>
|
|
</#if>
|
|
</ul>
|
|
<br class="clear"/>
|
|
</div>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderPortalPagePortletEnd confMode="false">
|
|
</div>
|
|
<#if "true" == confMode>
|
|
</div>
|
|
</#if>
|
|
</#macro>
|
|
|
|
<#macro renderColumnContainerBegin id="" style="">
|
|
<table cellspacing="0"<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>>
|
|
<tr>
|
|
</#macro>
|
|
|
|
<#macro renderColumnContainerEnd>
|
|
</tr>
|
|
</table>
|
|
</#macro>
|
|
|
|
<#macro renderColumnBegin id="" style="">
|
|
<td<#if id?has_content> id="${id}"</#if><#if style?has_content> class="${style}"</#if>>
|
|
</#macro>
|
|
|
|
<#macro renderColumnEnd>
|
|
</td>
|
|
</#macro>
|