Um die Benutzung des Template Systems mal ein wenig zu foerdern.
[kivitendo-erp.git] / templates / webpages / generic / cov_selection_master.html
1 [%- USE HTML %]
2 <body[% IF onload %] onload="[% onload %]"[% END %]>
3
4  <form method="post">
5
6   <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
7   <input type="hidden" name="input_id" value="[% HTML.escape(input_id) %]">
8   <input type="hidden" name="is_vendor" value="[% HTML.escape(is_vendor) %]">
9   <input type="hidden" name="allow_both" value="[% HTML.escape(allow_both) %]">
10   <input type="hidden" name="action_on_cov_selected" value="[% HTML.escape(action_on_cov_selected) %]">
11
12   <table width="100%">
13    <tr>
14     <th class="listtop">[% title %]</th>
15    </tr>
16    <tr height="5"></tr>
17
18    <tr>
19     <td>
20      [%- IF !is_vendor %]
21       <translate>Please select a customer from the list below.</translate>
22      [%- ELSE %]
23       <translate>Please select a vendor from the list below.</translate>
24      [%- END %]
25     </td>
26    </tr>
27
28    <tr>
29     <td>
30
31      <table>
32       <tr class="listheading">
33        <th class="listheading">&nbsp;</th>
34        [%- FOREACH row = HEADER %]
35         <th nowrap class="listheading"><a href="[% HTML.escape(row.callback) %]">[% row.column_title %]</a></th>
36        [%- END %]
37       </tr>
38
39       [%- FOREACH row = COVS %]
40        <tr class="listrow[% loop.count % 2 %]">
41         <td valign="top"><button type="button" onclick="cov_selected('[% loop.count %]')">Auswahl</button></td>
42         <td valign="top"><input type="hidden" id="id_[% loop.count %]" name="id_[% loop.count %]" value="[% HTML.escape(row.id) %]">
43          <input type="hidden" id="name_[% loop.count %]" name="name_[% loop.count %]" value="[% HTML.escape(row.name) %]">
44          <input type="hidden" id="customer_is_vendor_[% loop.count %]" name="customer_is_vendor_[% loop.count %]" value="[% HTML.escape(row.customer_is_vendor) %]">
45          [% HTML.escape(row.name) %]</td>
46         <td valign="top">[% HTML.escape(row.address) %]</td>
47         <td valign="top">[% HTML.escape(row.contact) %]</td>
48        </tr>
49       [% END %]
50      </table>
51
52     </td>
53    </tr>
54   </table>
55
56  </form>
57
58  <script type="text/javascript">
59   <!--
60       function cov_selected(selected) {
61         var name = document.getElementsByName("name_" + selected)[0].value
62         var id = document.getElementsByName("id_" + selected)[0].value
63         var customer_is_vendor = document.getElementsByName("customer_is_vendor_" + selected)[0].value
64         var cov_name = document.forms[0].input_name.value;
65         window.opener.document.getElementsByName(cov_name)[0].value = name;
66         if (document.forms[0].input_id.value != "") {
67           window.opener.document.getElementsByName(document.forms[0].input_id.value)[0].value = id;
68         }
69
70         var cov_is_vendor = cov_name + "_is_vendor";
71         var input = window.opener.document.getElementsByName(cov_is_vendor)[0];
72         if (input) {
73           input.value = customer_is_vendor;
74         }
75
76         var prefix = "";
77         if (cov_name.substr(0, 2) == "f_") {
78           prefix = "f_";
79           cov_name = cov_name.substr(2);
80         }
81         cov_name = prefix + "old_" + cov_name;
82         var input = window.opener.document.getElementsByName(cov_name)[0];
83         if (input) {
84           input.value = name;
85         }
86         cov_name = prefix + "old" + cov_name;
87         input = window.opener.document.getElementsByName(cov_name)[0];
88         if (input) {
89           input.value = name;
90         }
91
92         if (document.forms[0].action_on_cov_selected.value != "") {
93           window.opener.document.getElementsByName("action")[0].value = document.forms[0].action_on_cov_selected.value;
94           window.opener.document.forms[0].submit();
95         }
96
97         self.close();
98       }
99       //-->
100  </script>
101
102 </body>
103 </html>