blob: 722d40a2ec3815da5cb428c1a561371974524303 [file] [log] [blame]
<!--
#* 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 used for rendering field errors *#
#macro(writeErrors $form)
#* Render javascript validation result *#
#if ($form.javaScriptValidation)
<tr style="display:none" id="${form.id}-errorsTr">
<td width='100%'>
<div class="errors" id="${form.id}-errorsDiv"></div>
</td>
</tr>
#end
#if ($form.error)
<tr style="${form.errorsStyle}">
<td class="tf_error"> $form.error </td>
</tr>
#end
#* Render field errors *#
#foreach ($errorField in $form.errorFields)
<tr>
<td style="${form.errorsStyle}" class="tf_error">
<a class="error" href="#"
onclick="onShowTab($form.getTabSheetNumber($errorField.name));Click.setFocus('$errorField.id');"
> $errorField.error </a>
</td>
</tr>
#end
#end
<script type="text/javascript">
function onShowTab(index) {
var numberTabs = ${form.tabSheets.size()};
for (var i = 1; i < (numberTabs + 1); i++) {
var tabTitle = document.getElementById('tab-title-' + i);
tabTitle.style.backgroundColor = "";
tabTitle.style.borderBottom = "";
var tabSheet = document.getElementById('tab-sheet-' + i);
tabSheet.style.display = "none";
}
var tabTitle = document.getElementById('tab-title-' + index);
tabTitle.style.backgroundColor = "${form.backgroundColor}";
tabTitle.style.borderBottom = "0px";
var tabSheet = document.getElementById('tab-sheet-' + index);
tabSheet.style.display = "block";
}
</script>
$form.startTag()
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
#* Render form errors at the top position *#
#if ($form.errorsPosition == "top")
#writeErrors($form)
#end
<tr><td style="height:0.5em;">&#160;</td></tr>
#* Render tab titles *#
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="tf_separator"> &#160;&#160; </td>
#foreach ($tabSheet in $form.tabSheets)
<td id="tab-title-${velocityCount}"
#if ($velocityCount == $form.displayTab)
style="border-bottom:0px;background-color:${form.backgroundColor};"
#end
class="tf_tab">
<a href="#"
class="tb_label"
style="color:#404040;font-weight:bold;text-decoration:none;"
onclick="onShowTab(${velocityCount})"
>${tabSheet.label}</a>
</td>
<td class="tf_separator"> &#160; </td>
#end
<td class="tf_separator" style="width:100%"> &#160; </td>
</tr>
</tbody>
</table>
</td>
</tr>
#* Render tab sheets *#
<tr>
<td class="tf_sheet"
width="${form.tabWidth};"
height="${form.tabHeight};"
style="background-color:${form.backgroundColor};">
#foreach ($tabSheet in $form.tabSheets)
<div id="tab-sheet-${velocityCount}"
#if ($velocityCount == $form.displayTab) style="display:block;" #else style="display:none;" #end
class="tf_sheet">
${tabSheet}
</div>
#end
</td>
</tr>
#* Render form errors at the middle position *#
#if ($form.errorsPosition == "middle")
#writeErrors($form)
#end
<tr><td style="height:0.5em;">&#160;</td></tr>
#* Render buttons *#
<tr>
<td class="buttons" align="${form.buttonAlign}" style="${form.buttonStyle}">
#foreach ($button in $form.buttonList)
$button
#end
</td>
</tr>
#* Render form errors at the bottom position *#
#if ($form.errorsPosition == "bottom")
<tr><td style="height:0.5em;">&#160;</td></tr>
#writeErrors($form)
#end
</tbody>
</table>
$form.endTag()