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