Oops, uncommited file for [1101]
[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
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">
e7ae7df9 45 <td colspan="{$t->nbfields}"><strong>nouvelle entrée</strong></td>
0337d704 46 <td class="action">
e7ae7df9 47 <a href="{$t->pl}/new">créer{icon name=add title='nouvelle entrée'}</a>
0337d704 48 </td>
49</tr>
50{/if}
e7ae7df9 51{iterate from=$list item=myrow}
0337d704 52<tr class="{cycle values="pair,impair"}">
e7ae7df9 53{foreach from=$t->vars item=myval}{if $myval.display}
0337d704 54 <td>
e7ae7df9 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 {else}
62 {$myrow.$myfield}
63 {/if}
0337d704 64 </td>
e7ae7df9 65{/if}{/foreach}
0337d704 66 {if !$hideactions}
67 <td class="action">
68 {if !$readonly}
9e570fe0 69 <a href="{$t->pl}/edit/{$idval}">{icon name=page_edit title='éditer'}</a>
e7ae7df9 70 <a href="{$t->pl}/delete/{$idval}">{icon name=delete title='supprimer'}</a>
0337d704 71 {/if}
0337d704 72 </td>
73 {/if}
74</tr>
e7ae7df9 75{/iterate}
0337d704 76</table>
77
78{if ($p_prev > -1) || ($p_next > -1)}
79<p class="pagenavigation">
c4271d38 80{if $p_prev > -1}<a href="{$platal->path}?start={$p_prev}">{$msg_previous_page}</a>&nbsp;{/if}
81{if $p_next > -1}<a href="{$platal->path}?start={$p_next}">{$msg_next_page}</a>{/if}
0337d704 82</p>
83{/if}
84
85{else}
86
e7ae7df9 87<form method="post" action="{$t->pl}/update/{$id}">
0337d704 88 <table class="bicol">
89 <tr class="impair">
90 <th colspan="2">
e7ae7df9 91 {if $id}
92 modification de l'entrée
0337d704 93 {else}
e7ae7df9 94 nouvelle entrée
0337d704 95 {/if}
96 </th>
97 </tr>
e7ae7df9 98 {foreach from=$t->vars item=myval}{assign var="myfield" value=$myval.Field}{if ($myfield neq $t->idfield) or ($t->idfield_editable)}
0337d704 99 <tr class="{cycle values="pair,impair"}">
100 <td>
101 <strong>{$myval.desc}</strong>
0337d704 102 </td>
103 <td>
e7ae7df9 104 {if $myval.Type eq 'set'}
105 <select name="{$myfield}[]" multiple="multiple">
106 {foreach from=$myval.List item=option}
107 <option value="{$option}" {if $entry.$myfield.$option}selected="selected"{/if}>{$option}</option>
108 {/foreach}
109 </select>
110 {elseif $myval.Type eq 'enum'}
111 <select name="{$myfield}">
112 {foreach from=$myval.List item=option}
233961da 113 <option value="{$option}" {if $entry.$myfield eq $option}selected="selected"{/if}>{$option}</option>
e7ae7df9 114 {/foreach}
115 </select>
116 {elseif ($myval.Type eq 'textarea') or ($myval.Type eq 'varchar200')}
117 <textarea name="{$myfield}" rows="{if $myval.Type eq 'varchar200'}3{else}10{/if}" cols="70">{$entry.$myfield}</textarea>
0337d704 118 {else}
e7ae7df9 119 <input type="text" name="{$myfield}" value="{$entry.$myfield}" {if $myval.Size}size="{$myval.Size}" maxlength="{$myval.Maxlength}"{/if}/>
120 {if $myval.Type eq 'timestamp'}<em>jj/mm/aaaa hh:mm:ss</em>{/if}
b9cd8008 121 {if $myval.Type eq 'date'}<em>jj/mm/aaaa</em>{/if}
e7ae7df9 122 {if $myval.Type eq 'time'}<em>hh:mm:ss</em>{/if}
0337d704 123 {/if}
124 </td>
125 </tr>
e7ae7df9 126 {/if}{/foreach}
0337d704 127 </table>
128
129 <p class="center">
130 <input type="submit" value="enregistrer" />
131 </p>
132
133</form>
134
135<p>
e7ae7df9 136<a href="{$t->pl}">back</a>
0337d704 137</p>
138
139{/if}
140
141
142{* vim:set et sw=2 sts=2 sws=2: *}