0337d704 |
1 | {**************************************************************************} |
2 | {* *} |
5ddeb07c |
3 | {* Copyright (C) 2003-2007 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 | |
0337d704 |
24 | <h1>{$title}</h1> |
25 | |
e7ae7df9 |
26 | {if $list} |
de61dbcf |
27 | <script type="text/javascript"> |
28 | {literal} |
29 | function redirect(a) { |
30 | document.location = a; |
31 | } |
32 | {/literal} |
33 | </script> |
0337d704 |
34 | <table class="bicol"> |
35 | <tr> |
a3828787 |
36 | {foreach from=$t->vars item=myval key=myvar}{if $myval.display} |
2ce6d1a6 |
37 | <th style="cursor:pointer" onclick="redirect('{$t->pl}/sort{if $t->sortfield eq $myvar && !$t->sortdesc}desc{/if}/{$myvar}')">{$myval.desc}{if $t->sortfield eq $myvar}{if $t->sortdesc}{icon name="bullet_arrow_down"}{else}{icon name="bullet_arrow_up"}{/if}{/if}</th> |
e7ae7df9 |
38 | {/if}{/foreach} |
0337d704 |
39 | {if !$hideactions} |
40 | <th>action</th> |
41 | {/if} |
42 | </tr> |
43 | {if !$readonly} |
44 | <tr class="impair"> |
a6613b2e |
45 | <td colspan="{$t->nbfields}"> |
46 | <strong> |
47 | Nouvelles entrées : <a href="{$t->pl}/new">Manuellement</a> • <a href="{$t->pl}/massadd">Depuis un CSV</a> |
48 | </strong> |
49 | </td> |
50 | <td class="right"> |
51 | <a href="{$t->pl}/new">{icon name=add title='nouvelle entrée'}</a> |
0337d704 |
52 | </td> |
53 | </tr> |
54 | {/if} |
e7ae7df9 |
55 | {iterate from=$list item=myrow} |
0337d704 |
56 | <tr class="{cycle values="pair,impair"}"> |
e7ae7df9 |
57 | {foreach from=$t->vars item=myval}{if $myval.display} |
0337d704 |
58 | <td> |
e7ae7df9 |
59 | {assign var="myfield" value=$myval.Field} |
60 | {if $myfield eq $t->idfield} |
61 | {assign var="idval" value=$myrow.$myfield} |
62 | {/if} |
63 | {if $myval.Type eq 'timestamp'} |
64 | <span class="smaller">{$myrow.$myfield|date_format:"%x %X"}</span> |
5d617d8d |
65 | {elseif $myval.Type eq 'checkbox'} |
66 | <input type="checkbox" disabled="disabled"{if $myrow.$myfield} checked="checked"{/if}/> |
e7ae7df9 |
67 | {else} |
68 | {$myrow.$myfield} |
69 | {/if} |
0337d704 |
70 | </td> |
e7ae7df9 |
71 | {/if}{/foreach} |
0337d704 |
72 | {if !$hideactions} |
73 | <td class="action"> |
74 | {if !$readonly} |
9e570fe0 |
75 | <a href="{$t->pl}/edit/{$idval}">{icon name=page_edit title='éditer'}</a> |
e7ae7df9 |
76 | <a href="{$t->pl}/delete/{$idval}">{icon name=delete title='supprimer'}</a> |
0337d704 |
77 | {/if} |
0337d704 |
78 | </td> |
79 | {/if} |
80 | </tr> |
e7ae7df9 |
81 | {/iterate} |
0337d704 |
82 | </table> |
83 | |
84 | {if ($p_prev > -1) || ($p_next > -1)} |
85 | <p class="pagenavigation"> |
c4271d38 |
86 | {if $p_prev > -1}<a href="{$platal->path}?start={$p_prev}">{$msg_previous_page}</a> {/if} |
87 | {if $p_next > -1}<a href="{$platal->path}?start={$p_next}">{$msg_next_page}</a>{/if} |
0337d704 |
88 | </p> |
89 | {/if} |
90 | |
a6613b2e |
91 | {elseif $massadd} |
92 | {include file="include/csv-importer.tpl"} |
93 | |
94 | <p> |
95 | <a href="{$t->pl}">back</a> |
96 | </p> |
97 | |
0337d704 |
98 | {else} |
99 | |
e7ae7df9 |
100 | <form method="post" action="{$t->pl}/update/{$id}"> |
0337d704 |
101 | <table class="bicol"> |
102 | <tr class="impair"> |
103 | <th colspan="2"> |
e7ae7df9 |
104 | {if $id} |
105 | modification de l'entrée |
0337d704 |
106 | {else} |
e7ae7df9 |
107 | nouvelle entrée |
0337d704 |
108 | {/if} |
109 | </th> |
110 | </tr> |
e7ae7df9 |
111 | {foreach from=$t->vars item=myval}{assign var="myfield" value=$myval.Field}{if ($myfield neq $t->idfield) or ($t->idfield_editable)} |
0337d704 |
112 | <tr class="{cycle values="pair,impair"}"> |
113 | <td> |
114 | <strong>{$myval.desc}</strong> |
0337d704 |
115 | </td> |
116 | <td> |
e7ae7df9 |
117 | {if $myval.Type eq 'set'} |
118 | <select name="{$myfield}[]" multiple="multiple"> |
119 | {foreach from=$myval.List item=option} |
120 | <option value="{$option}" {if $entry.$myfield.$option}selected="selected"{/if}>{$option}</option> |
121 | {/foreach} |
122 | </select> |
123 | {elseif $myval.Type eq 'enum'} |
124 | <select name="{$myfield}"> |
125 | {foreach from=$myval.List item=option} |
233961da |
126 | <option value="{$option}" {if $entry.$myfield eq $option}selected="selected"{/if}>{$option}</option> |
e7ae7df9 |
127 | {/foreach} |
128 | </select> |
129 | {elseif ($myval.Type eq 'textarea') or ($myval.Type eq 'varchar200')} |
130 | <textarea name="{$myfield}" rows="{if $myval.Type eq 'varchar200'}3{else}10{/if}" cols="70">{$entry.$myfield}</textarea> |
5d617d8d |
131 | {elseif ($myval.Type eq 'checkbox')} |
132 | <input type="checkbox" name="{$myfield}" value="{$myval.Value}"{if $entry.$myfield} checked="checked"{/if}/> |
0337d704 |
133 | {else} |
e7ae7df9 |
134 | <input type="text" name="{$myfield}" value="{$entry.$myfield}" {if $myval.Size}size="{$myval.Size}" maxlength="{$myval.Maxlength}"{/if}/> |
135 | {if $myval.Type eq 'timestamp'}<em>jj/mm/aaaa hh:mm:ss</em>{/if} |
b9cd8008 |
136 | {if $myval.Type eq 'date'}<em>jj/mm/aaaa</em>{/if} |
e7ae7df9 |
137 | {if $myval.Type eq 'time'}<em>hh:mm:ss</em>{/if} |
0337d704 |
138 | {/if} |
139 | </td> |
140 | </tr> |
e7ae7df9 |
141 | {/if}{/foreach} |
0337d704 |
142 | </table> |
143 | |
144 | <p class="center"> |
145 | <input type="submit" value="enregistrer" /> |
146 | </p> |
147 | |
148 | </form> |
149 | |
150 | <p> |
e7ae7df9 |
151 | <a href="{$t->pl}">back</a> |
0337d704 |
152 | </p> |
153 | |
154 | {/if} |
155 | |
156 | |
157 | {* vim:set et sw=2 sts=2 sws=2: *} |