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