migrate events submission
[platal.git] / templates / table-editor.tpl
CommitLineData
0337d704 1{**************************************************************************}
2{* *}
50a40a33 3{* Copyright (C) 2003-2006 Polytechnique.org *}
0337d704 4{* http://opensource.polytechnique.org/ *}
5{* *}
6{* This program is free software; you can redistribute it and/or modify *}
7{* it under the terms of the GNU General Public License as published by *}
8{* the Free Software Foundation; either version 2 of the License, or *}
9{* (at your option) any later version. *}
10{* *}
11{* This program is distributed in the hope that it will be useful, *}
12{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
13{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
14{* GNU General Public License for more details. *}
15{* *}
16{* You should have received a copy of the GNU General Public License *}
17{* along with this program; if not, write to the Free Software *}
18{* Foundation, Inc., *}
19{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
20{* *}
21{**************************************************************************}
22
23
24
25<h1>{$title}</h1>
26
27{if !$doedit}
28{if !$readonly}
29
30{literal}
31<script type="text/javascript">
32 <!--
33 function del( myid ) {
34 if (confirm ("You are about to delete this entry. Do you want to proceed?")) {
35 document.forms.operations.action.value = "del";
36 document.forms.operations.{/literal}{$prefix}{literal}id.value = myid;
37 document.forms.operations.submit();
38 return true;
39 }
40 }
41 function edit( myid ) {
42 document.forms.operations.action.value = "edit";
43 document.forms.operations.{/literal}{$prefix}{literal}id.value = myid;
44 document.forms.operations.submit();
45 return true;
46 }
47 // -->
48</script>
49{/literal}
50{/if}
51
52<form method="post" action="{$smarty.server.PHP_SELF}" id="operations">
53 <div>
54 <input type="hidden" name="action" value="" />
55 <input type="hidden" name="{$prefix}id" value="" />
56 </div>
57</form>
58
59<table class="bicol">
60<tr>
61 {if $idsum}<th>id</th>{/if}
62 {foreach from=$vars item=myval}
63 {if $myval.sum}<th>{$myval.desc}</th>{/if}
64 {/foreach}
65 {if !$hideactions}
66 <th>action</th>
67 {/if}
68</tr>
69{if !$readonly}
70<tr class="impair">
71 <td colspan="{$ncols}"><strong>nouvelle entrée</strong></td>
72 <td class="action">
73 <a href="javascript:edit('');">create</a>
74 </td>
75</tr>
76{/if}
77{foreach from=$rows item=myrow}{assign var="myarr" value=$myrow[1]}
78<tr class="{cycle values="pair,impair"}">
79 {if $idsum}<td>{$myrow[0]}</td>{/if}
80{foreach from=$vars key=mykey item=myval}
81{if $myval.sum}
82 <td>
83 {if $myval.type=="timestamp"}
84 <span class="smaller">{$myarr.$mykey|date_format:"%x %X"}</span>
85 {elseif $myval.type=="set" and $myval.trans}
86 {$myval.trans[$myval.value]}
87 {elseif $myval.type=="ext"}
88 {extval table=$table field=$mykey value=$myarr.$mykey vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield}
89 {else}
90 {$myarr.$mykey}
91 {/if}
92 </td>
93{/if}
94{/foreach}
95 {if !$hideactions}
96 <td class="action">
97 {if !$readonly}
98 <a href="javascript:edit('{$myrow[0]}');">edit</a>
99 <a href="javascript:del('{$myrow[0]}');">delete</a>
100 {/if}
101 {foreach from=$myrow[2] item=myaction}
102 {a lnk=$myaction}
103 {/foreach}
104 </td>
105 {/if}
106</tr>
107{/foreach}
108</table>
109
110{if ($p_prev > -1) || ($p_next > -1)}
111<p class="pagenavigation">
112{if $p_prev > -1}<a href="?start={$p_prev}">{$msg_previous_page}</a>&nbsp;{/if}
113{if $p_next > -1}<a href="?start={$p_next}">{$msg_next_page}</a>{/if}
114</p>
115{/if}
116
117{else}
118
119<form method="post" action="{$smarty.server.PHP_SELF}">
120 <table class="bicol">
121 <tr class="impair">
122 <th colspan="2">
123 <input type="hidden" name="action" value="update" />
124 {if $id!=''}
125 modification de l'entrée
126 <input type="hidden" name="{$prefix}id" value="{$id}" />
127 {else}
128 nouvelle entrée
129 {/if}
130 </th>
131 </tr>
132 {foreach from=$vars key=mykey item=myval}
133 <tr class="{cycle values="pair,impair"}">
134 <td>
135 <strong>{$myval.desc}</strong>
136 {if $myval.type=="password"}<br /><em>(blank=no change)</em>{/if}
137 </td>
138 <td>
139 {if $myval.edit}
140 {if $myval.type=="textarea"}
141 <textarea name="{$prefix}{$mykey}" rows="10" cols="70">{$myval.value}</textarea>
142 {elseif $myval.type=="set"}
143 {if $myval.trans}
144 {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.trans[$myval.value] trans=$myval.trans}
145 {else}
146 {flags table=$table field=$mykey name="$prefix$mykey" selected=$myval.value}
147 {/if}
148 {elseif $myval.type=="ext"}
149 {extval table=$table field=$mykey name="$prefix$mykey" vtable=$myval.vtable vjoinid=$myval.vjoinid vfield=$myval.vfield selected=$myval.value}
150 {elseif $myval.type=="timestamp"}
151 <input type="text" name="{$prefix}{$mykey}" value="{$myval.value|date_format:"%x %X"}" />
152 {elseif $myval.type=="password"}
153 <input type="password" name="{$prefix}{$mykey}" size="40" />
154 {else}
155 <input type="{$myval.type}" name="{$prefix}{$mykey}" size="40" value="{$myval.value}" />
156 {/if}
157 {else}
ff5e5034 158 {$myval.value}
0337d704 159 {/if}
160 </td>
161 </tr>
162 {/foreach}
163 </table>
164
165 <p class="center">
166 <input type="submit" value="enregistrer" />
167 </p>
168
169</form>
170
171<p>
172<a href="{$smarty.server.PHP_SELF}">back</a>
173</p>
174
175{/if}
176
177
178{* vim:set et sw=2 sts=2 sws=2: *}