107 lines
3.8 KiB
HTML
Executable File
107 lines
3.8 KiB
HTML
Executable File
{if $printTemplate}
|
|
{* this is the grid template *}
|
|
<table class="basicTable">
|
|
<tr><td valign='top'>
|
|
<table class="Header" >
|
|
<tr>
|
|
<th>{$form->label}
|
|
</th>
|
|
</tr>
|
|
</table>
|
|
<table class='Record' name="{$form->name}" id="{$form->name}">
|
|
<tr>
|
|
<td>#</td>
|
|
{foreach from=$form->fields item=field}
|
|
<td class='FormTitle'>{$field->label}</td>
|
|
{/foreach}
|
|
</tr>
|
|
{literal}
|
|
{section name=row loop=$form_rows}
|
|
{if ($smarty.section.row.index==0)}
|
|
<tr id="firstRow_{$form_name}">
|
|
{else}
|
|
<tr>
|
|
{/if}
|
|
<td class='FormField'> {$smarty.section.row.index+1} </td>
|
|
{/literal}
|
|
{foreach from=$form->fields item=field}
|
|
<td class='FormField'>{$field->field}</td>
|
|
{/foreach}
|
|
{if ($form->deleteRow) }
|
|
<td><input type="button" onclick="form_{$form->owner->id}.getElementByName('{$form->name}').deleteGridRow('[{literal}{$smarty.section.row.index+1}{/literal}]');return false;" value="delete"/></td>
|
|
{/if}
|
|
{if ($form->editRow)}
|
|
<td>edit</td>
|
|
{/if}
|
|
{literal}
|
|
</tr>
|
|
{/section}
|
|
{* TOTALIZABLE ROW *}
|
|
<tr>
|
|
<td></td>
|
|
{/literal}
|
|
{foreach from=$form->fields item=field}
|
|
<td class='FormField'>
|
|
{if isset($field->function) && $field->function!=='' }
|
|
{if $field->function=='sum'}
|
|
Σ = <span id="form[SYS_GRID_AGGREGATE_{$form->name}__{$field->name}]">0</span><input type="hidden" name="form[SYS_GRID_AGGREGATE_{$form->name}_{$field->name}]" id="form[SYS_GRID_AGGREGATE_{$form->name}_{$field->name}]" value="0" />
|
|
{elseif $field->function=='avg'}
|
|
<span style="position:absolute">¯</span>X = <span id="form[SYS_GRID_AGGREGATE_{$form->name}__{$field->name}]">0</span><input type="hidden" name="form[SYS_GRID_AGGREGATE_{$form->name}_{$field->name}]" id="form[SYS_GRID_AGGREGATE_{$form->name}_{$field->name}]" value="0" />
|
|
{/if}
|
|
{/if}
|
|
</td>
|
|
{/foreach}
|
|
{literal}
|
|
</tr>
|
|
{/literal}
|
|
</table>
|
|
{if ($form->addRow) }
|
|
<table class='Record' >
|
|
<tr>
|
|
<td><input type="button" value="Insert" onclick="form_{$form->owner->id}.getElementByName('{$form->name}').addGridRow();return false;"/></td>
|
|
</tr>
|
|
</table>
|
|
{/if}
|
|
</td></tr>
|
|
</table>
|
|
{/if}
|
|
{if $printJSFile}
|
|
function grid_{$form->id}(myGrid)
|
|
{literal}{{/literal}
|
|
{* setFunctions: Define the aggregate functions *}
|
|
{php}$this->assign('firstfield', true);{/php}
|
|
myGrid.setFunctions([
|
|
{foreach from=$form->fields item=field name=foreachField}
|
|
{if isset($field->function)&& $field->function!==''}
|
|
{if !$firstfield},{/if}
|
|
{literal}{{/literal}sFieldName: '{$field->name}', sFunction: '{$field->function}'{literal}}{/literal}
|
|
{php}$this->assign('firstfield', false);{/php}
|
|
{/if}
|
|
{/foreach}
|
|
]);
|
|
{* setFormulas: Define the customs formulas *}
|
|
{php}$this->assign('firstfield', true);{/php}
|
|
myGrid.setFormulas([
|
|
{foreach from=$form->fields item=field name=foreachField}
|
|
{if isset($field->formula)}
|
|
{foreach from=$field->dependentOf() item=dependentOf name=foreachDependent}
|
|
{if !$firstfield},{/if}
|
|
{literal}{{/literal} sDependentOf: '{$dependentOf}', sFieldName: '{$field->name}', sFormula: '{$field->formula}'{literal}}{/literal}
|
|
{php}$this->assign('firstfield', false);{/php}
|
|
{/foreach}
|
|
{/if}
|
|
{/foreach}
|
|
]);
|
|
{* setFields: Define the controles's javascript *}
|
|
{php}$this->assign('firstfield', true);{/php}
|
|
myGrid.setFields([
|
|
{foreach from=$form->fields item=field name=foreachField}
|
|
{if !$firstfield},{/if}
|
|
{literal}{{/literal}sFieldName: '{$field->name}', sType: '{$field->type}', oProperties:{$field->getAttributes()}, oEvents:{$field->getEvents()}{literal}}{/literal}
|
|
{php}$this->assign('firstfield', false);{/php}
|
|
{/foreach}
|
|
]);
|
|
{literal}}{/literal}
|
|
{/if}
|
|
{if $printJavaScript}
|
|
{/if} |