File size: 6,154 Bytes
07c3cdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{if $printTemplate}
{* this is the xmlform template *}
<form id="{$form->id}" name="{$form->id}" action="{$form->action}" method="post" encType="multipart/form-data">
<table width='{$form->width}' cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table width='100%' class="basicTable">
  <tr><td valign='top'>
{if isset($form->title) && $form->title !=='' }
   <table class="Header" >
     <tr>
      <th>{$form->title}</th>
     </tr>
   </table>
{/if}
   <table class='Record' cellspacing="0" cellpadding="0">
{foreach from=$form->fields item=field}
{if ($field->type==='title')}
     <tr>
      <td class='FormTitle' colspan="2">{$field->field}</td>
     </tr>
{elseif ($field->type==='subtitle')}
     <tr>
      <td class='FormSubTitle' colspan="2">{$field->field}</td>
     </tr>
{elseif ($field->type==='button') || ($field->type==='submit') || ($field->type==='reset')}
{elseif ($field->type==='grid')}
     <tr>
      <td class='FormField' colspan="2">{$field->field}</td>
     </tr>
{elseif ($field->type==='checkbox')}
     <tr>
      <td class='FormLabel' width="{$form->labelWidth}"></td>
      <td class='FormField'>{$field->field}</td>
     </tr>
{elseif ($field->type==='javascript')}
{elseif ($field->type==='phpvariable')}
{elseif ($field->type==='private')}
{elseif ($field->type==='hidden')}
     <tr style="display:none;">
      <td colspan="2">{$field->field}</td>
     </tr>
{elseif ($field->type==='')}
{elseif ($field->withoutLabel)}
     <tr>
      <td colspan="2">{$field->field}</td>
     </tr>
{else}
     <tr>
      <td class='FormLabel' width="{$form->labelWidth}">{$field->label}</td>
      <td class='FormField'>{$field->field}</td>
     </tr>
{/if}
{/foreach}
   </table>
  </td></tr>
</table>
</td><td width="100px" align="center" valign="bottom" style="background-image:url(file:///Z|/workflow/trunk/public_html/images/main.jpg);background-repeat:no-repeat;background-position: 100% 50%;">
  <table cellpadding="0" cellspacing="0" border="0">
  {foreach from=$form->fields item=field}
  {if ($field->type==='button') || ($field->type==='submit') || ($field->type==='reset')}
       <tr>
        <td>{$field->field}</td>
       </tr>
  {/if}
  {/foreach}
  </table>
</td></tr>
</table>
{foreach from=$form->fields item=field}
	{if ($field->type==='javascript')}
	<script type="text/javascript">
		{$field->field}
	</script>
	{/if}
{/foreach}
</form>
{/if}
{if $printJSFile}
var form_{$form->id};
var i;
function loadForm_{$form->id}(ajaxServer)
{literal}{{/literal}
swSubmitValidateForm = 1;
if (typeof(G_Form)==='undefined') return alert('form.js was not loaded');
  form_{$form->id}=new G_Form(document.getElementById('{$form->id}'),'{$form->id}');
  var myForm=form_{$form->id};
  myForm.ajaxServer=ajaxServer;
  //{$form->ajaxSubmit}
  {if isset($form->ajaxSubmit) && ($form->ajaxSubmit)}
  {literal}
    var sub = new leimnud.module.app.submit({
        form    : myForm.element
      });
    sub.sendObj = false;
  {/literal}
  {/if}
  {foreach from=$form->fields item=field key=name}
    i = myForm.aElements.length;
    {if ($field->type==='dropdown')}
      myForm.aElements[i] = new G_DropDown(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='text')}
      myForm.aElements[i] = new G_Text(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='percentage')}
      myForm.aElements[i] = new G_Percentage(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='currency')}
      myForm.aElements[i] = new G_Currency(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='textarea')}
      myForm.aElements[i] = new G_TextArea(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='date')}
      myForm.aElements[i] = new G_Date(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='hidden')}
      myForm.aElements[i] = new G_Text(myForm, myForm.element.elements['form[{$name}]'],'{$name}');
      myForm.aElements[i].setAttributes({$field->getAttributes()});
      {$field->attachEvents("myForm.aElements[i].element")}
    {elseif ($field->type==='grid')}
      myForm.aElements[i] = new G_Grid(myForm, '{$name}');
      grid_{$field->id}(myForm.aElements[i]);
      {$field->attachEvents("myForm.aElements[i].element")}
    {else}
      var element = getField("{$name}");
      {$field->attachEvents("element")}
    {/if}
  {/foreach}
  {foreach from=$form->fields item=field key=name}
    {if isset($field->dependentFields) && ($field->dependentFields!='')}
      {if ($field->type==='dropdown')}
          myForm.getElementByName('{$name}').setDependentFields('{$field->dependentFields}');
      {elseif ($field->type==='text')}
          myForm.getElementByName('{$name}').setDependentFields('{$field->dependentFields}');
      {elseif ($field->type==='percentage')}
          myForm.getElementByName('{$name}').setDependentFields('{$field->dependentFields}');
      {elseif ($field->type==='currency')}
          myForm.getElementByName('{$name}').setDependentFields('{$field->dependentFields}');
      {/if}
    {/if}
  {/foreach}
{literal}}{/literal}
{/if}
{if $printJavaScript}
leimnud.event.add(window,'load',function(){literal}{{/literal}loadForm_{$form->id}('{$form->ajaxServer}');{literal}}{/literal});
{/if}