Release plat/al core v1.1.13
[platal.git] / templates / table-editor.tpl
CommitLineData
7cb40d85
FB
1{**************************************************************************}
2{* *}
e92ecb8c 3{* Copyright (C) 2003-2011 Polytechnique.org *}
7cb40d85
FB
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>
b2eec295 36 {foreach from=$t->vars item=myval key=myvar}{if $myval.display_list}
7cb40d85
FB
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>
7b64cc74 43{if !$readonly and !$deleteonly}
7cb40d85
FB
44<tr class="impair">
45 <td colspan="{$t->nbfields}">
46 <strong>
47 Nouvelles entrées&nbsp;: <a href="{$t->pl}/new">Manuellement</a> &bull; <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>
52 </td>
53</tr>
54{/if}
55{iterate from=$list item=myrow}
56<tr class="{cycle values="pair,impair"}">
b2eec295 57{foreach from=$t->vars item=myval}{if $myval.display_list}
7cb40d85
FB
58 <td>
59 {assign var="myfield" value=$myval.Field}
60 {if $myfield eq $t->idfield}
61 {assign var="idval" value=$myrow.$myfield}
62 {/if}
80c3b579
SJ
63 {if $t->idfield2 && $myfield eq $t->idfield2}
64 {assign var="idval2" value=$myrow.$myfield}
65 {/if}
7cb40d85
FB
66 {if $myval.Type eq 'timestamp'}
67 <span class="smaller">{$myrow.$myfield|date_format:"%x %X"}</span>
68 {elseif $myval.Type eq 'checkbox'}
69 <input type="checkbox" disabled="disabled"{if $myrow.$myfield} checked="checked"{/if}/>
70 {elseif $myval.Type eq 'ip_address'}
71 {$myrow.$myfield|uint_to_ip}
f6cfa61b
AL
72 {elseif $myval.url}
73 <a href="{$platal->ns}{$myval.url}{$myrow.$myfield}">{$myrow.$myfield}</a>
7cb40d85
FB
74 {else}
75 {$myrow.$myfield}
76 {/if}
77 </td>
78{/if}{/foreach}
79 {if !$hideactions}
80 <td class="action">
a315ff72 81 {if !$readonly and !$deleteonly and !$addonly}
7cb40d85 82 <a href="{$t->pl}/edit/{$idval}">{icon name=page_edit title='éditer'}</a>
7b64cc74 83 {/if}
f6cfa61b 84 {if !$readonly and !$addonly}
80c3b579 85 <a href="{$t->pl}/delete/{$idval}{if t($idval2)}/{$idval2}{/if}?token={xsrf_token}">{icon name=delete title='supprimer'}</a>
7cb40d85
FB
86 {/if}
87 </td>
88 {/if}
89</tr>
90{/iterate}
91</table>
92
93{if ($p_prev > -1) || ($p_next > -1)}
94<p class="pagenavigation">
95{if $p_prev > -1}<a href="{$platal->path}?start={$p_prev}">{$msg_previous_page}</a>&nbsp;{/if}
96{if $p_next > -1}<a href="{$platal->path}?start={$p_next}">{$msg_next_page}</a>{/if}
97</p>
98{/if}
99
100{elseif $massadd}
101{include core=csv-importer.tpl}
102
103<p>
104<a href="{$t->pl}">back</a>
105</p>
106
107{else}
108
109<form method="post" action="{$t->pl}/update/{$id}">
110 {xsrf_token_field}
111 <table class="bicol">
112 <tr class="impair">
113 <th colspan="2">
4744b162 114 {if $id !== null}
ef138fdc 115 modification de l'entrée
7cb40d85
FB
116 {else}
117 nouvelle entrée
118 {/if}
119 </th>
120 </tr>
b2eec295 121 {foreach from=$t->vars item=myval}{assign var="myfield" value=$myval.Field}{if (($myfield neq $t->idfield) or ($t->idfield_editable)) and $myval.display_item}
7cb40d85
FB
122 <tr class="{cycle values="pair,impair"}">
123 <td>
124 <strong>{$myval.desc}</strong>
125 </td>
126 <td>
127 {if $myval.Type eq 'set'}
128 <select name="{$myfield}[]" multiple="multiple">
129 {foreach from=$myval.List item=option}
130 <option value="{$option}" {if $entry.$myfield.$option}selected="selected"{/if}>{$option}</option>
131 {/foreach}
132 </select>
133 {elseif $myval.Type eq 'enum'}
134 <select name="{$myfield}">
135 {foreach from=$myval.List item=option}
136 <option value="{$option}" {if $entry.$myfield eq $option}selected="selected"{/if}>{$option}</option>
137 {/foreach}
138 </select>
139 {elseif ($myval.Type eq 'textarea') or ($myval.Type eq 'varchar200')}
140 <textarea name="{$myfield}" rows="{if $myval.Type eq 'varchar200'}3{else}10{/if}" cols="70">{$entry.$myfield}</textarea>
141 {elseif ($myval.Type eq 'checkbox')}
142 <input type="checkbox" name="{$myfield}" value="{$myval.Value}"{if $entry.$myfield} checked="checked"{/if}/>
143 {else}
144 <input type="text" name="{$myfield}" value="{$entry.$myfield}" {if $myval.Size}size="{$myval.Size}" maxlength="{$myval.Maxlength}"{/if}/>
145 {if $myval.Type eq 'timestamp'}<em>jj/mm/aaaa hh:mm:ss</em>{/if}
146 {if $myval.Type eq 'date'}<em>jj/mm/aaaa</em>{/if}
147 {if $myval.Type eq 'time'}<em>hh:mm:ss</em>{/if}
148 {/if}
149 </td>
150 </tr>
151 {/if}{/foreach}
152 </table>
153
154 <p class="center">
155 <input type="submit" value="enregistrer" />
156 </p>
157
158</form>
159
160<p>
161<a href="{$t->pl}">back</a>
162</p>
163
164{/if}
165
166
fa7ffd66 167{* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *}