import of Diogenes 0.9.18
[diogenes.git] / include / diogenes / templates / table-editor.tpl
CommitLineData
6855525e
JL
1{if !$doedit}
2{if !$readonly}
3{literal}
4<script language="javascript" type="text/javascript">
5 <!--
6 function del( myid ) {
7 if (confirm ("{/literal}{$msg_confirm_delete}{literal}")) {
8 document.operations.action.value = "del";
9 document.operations.{/literal}{$prefix}{literal}id.value = myid;
10 document.operations.submit();
11 return true;
12 }
13 }
14 function edit( myid ) {
15 document.operations.action.value = "edit";
16 document.operations.{/literal}{$prefix}{literal}id.value = myid;
17 document.operations.submit();
18 return true;
19 }
20 // -->
21</script>
22{/literal}
23{/if}
24
25<form method="post" action="{$smarty.server.PHP_SELF}" name="operations">
26<input type="hidden" name="action" value="" />
27<input type="hidden" name="{$prefix}id" value="" />
28</form>
29
30<table class="{$table_class}"{if $table_style} style="{$table_style}"{/if}>
31<tr>
32 {if $idsum}<th>{$msg_id}</th>{/if}
33 {foreach from=$vars item=myval}
34 {if $myval.sum}<th>{$myval.desc}</th>{/if}
35 {/foreach}
36{if !$hideactions}
37 <th>{$msg_action}</th>
38{/if}
39</tr>
40{if !$readonly}
41<tr>
42 <td colspan="{$ncols}"><strong>{$msg_new_entry}</strong></td>
43 <td>
44 <a class="action" href="javascript:edit('');">{$msg_create}</a>
45 </td>
46</tr>
47{/if}
48{counter start=1 assign=cnt print=0}
49{foreach from=$rows item=myrow}{assign var="myarr" value=$myrow[1]}
50<tr{if $cnt % 2} class="odd"{/if}>
51{if $idsum} <td>{$myrow[0]}</td>{/if}
52{foreach from=$vars key=mykey item=myval}
53{if $myval.sum}
54 <td>
55 {if $myval.type=="timestamp"}
56 <small>{$myarr.$mykey|date_format:"%Y-%m-%d %H:%M:%S"}</small>
57 {elseif $myval.type=="set" and $myval.trans}
58 {$myval.trans[$myval.value]}
59 {elseif $myval.type=="ext"}
60 {extval table=$table field=$mykey value=$myarr.$mykey vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield}
61 {else}
62 {$myarr.$mykey}
63 {/if}
64 </td>
65{/if}
66{/foreach}
67{if !$hideactions}
68 <td>
69{if !$readonly}
70 <a class="action" href="javascript:edit('{$myrow[0]}');">{$msg_edit}</a>
71 <a class="action" href="javascript:del('{$myrow[0]}');">{$msg_delete}</a>
72{/if}
73{foreach from=$myrow[2] item=myaction}
74 {a class="action" lnk=$myaction}
75{/foreach}
76 </td>
77{/if}
78</tr>
79{counter}
80{/foreach}
81</table>
82
83{if ($p_prev > -1) || ($p_next > -1)}
84<p class="pagenavigation">
85{if $p_prev > -1}<a href="?start={$p_prev}">{$msg_previous_page}</a>&nbsp;{/if}
86{if $p_next > -1}<a href="?start={$p_next}">{$msg_next_page}</a>{/if}
87</p>
88{/if}
89
90{else}
91
92<form method="post" action="{$smarty.server.PHP_SELF}">
93<input type="hidden" name="action" value="update">
94{if $id!=''}
95<input type="hidden" name="{$prefix}id" value="{$id}">
96{/if}
97<table class="light">
98<tr>
99 <th colspan="2">
100 {if $id!=''}{$msg_existing_entry} {$id}
101 {else}{$msg_new_entry}{/if}
102 </th>
103</tr>
104{foreach from=$vars key=mykey item=myval}
105{if $myval.show}
106<tr>
107 <td>
108 <strong>{$myval.desc}</strong>
109 {if $myval.type=="password"}<br /><em>{$msg_no_change}</em>{/if}
110 </td>
111 <td>
112{if $myval.edit}
113{if $myval.type=="textarea"}
114 <textarea name="{$prefix}{$mykey}" rows="10" cols="70">{$myval.value|escape}</textarea>
115{elseif $myval.type=="set"}
116 {if $myval.trans}
117 {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.trans[$myval.value] trans=$myval.trans}
118 {else}
119 {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.value}
120 {/if}
121{elseif $myval.type=="ext"}
122 {extval table=$table field=$mykey name="$prefix$mykey" vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield selected=$myval.value}
123{elseif $myval.type=="timestamp"}
124 <input type="text" name="{$prefix}{$mykey}" value="{$myval.value|date_format:"%Y-%m-%d %H:%M:%S"}" />
125{elseif $myval.type=="password"}
126 <input type="password" name="{$prefix}{$mykey}" size="40" />
127{else}
128 <input type="{$myval.type}" name="{$prefix}{$mykey}" size="40" value="{$myval.value|escape}" />
129{/if}
130{else}
131 {$myval.value|escape}
132{/if}
133 </td>
134</tr>
135{/if}
136{/foreach}
137</table>
138
139<p class="center">
140 <input type="submit" value="{$msg_submit}" />
141</p>
142
143</form>
144
145<p>
146 <a href="{$smarty.server.PHP_SELF}">{$msg_back}</a>
147</p>
148
149{/if}