Improves the comment/edition box opener in admin/validate
[platal.git] / templates / admin / valider.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2008 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
19 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
20 {*                                                                        *}
21 {**************************************************************************}
22
23 {javascript name="jquery"}
24 <script type="text/javascript">//<![CDATA[
25 {literal}
26 function toggleField(name, id, obj) {
27   $("#" + name + "_" + id).toggle();
28 }
29 {/literal}
30 //]]></script>
31
32 <h1>Validation</h1>
33
34
35 {if $vit->total()}
36
37 {counter print=false start=0 assign=hidden}
38
39 {iterate item=valid from=$vit}
40 {assign var=type value=$valid->type}
41 {if !$hide_requests[$type]}
42 <br />
43 <table class="bicol">
44   <tr>
45     <th colspan="2"><a id="valid{$valid->id()}"></a>{$valid->type}</th>
46   </tr>
47   <tr>
48     <td class="titre" style="width: 20%">Demandeur&nbsp;:</td>
49     <td>
50       <a href="profile/{$valid->bestalias}" class="popup2">
51         {$valid->prenom} {$valid->nom} (X{$valid->promo})
52       </a>
53     </td>
54   </tr>
55   <tr>
56     <td class="titre" style="width: 20%">Date de demande&nbsp;:</td>
57     <td>
58       {$valid->stamp|date_format}
59     </td>
60   </tr>
61   {include file=$valid->formu()}
62   {if $valid->editor()}
63   <tr onclick="toggleField('edit', '{$valid->id()}')" style="cursor: pointer">
64     <th colspan="2">
65       {if $preview_id neq $valid->id()}
66       <div style="float: left">
67         {icon name="add"}
68       </div>
69       {/if}
70       Éditer
71     </th>
72   </tr>
73   <tr {if $preview_id neq $valid->id()}style="display: none"{/if} id="edit_{$valid->id()}">
74     <td colspan="2" class="center">
75       <form enctype="multipart/form-data" action="{$platal->pl_self(0)}/edit/{$valid->id()}#valid{$valid->id()}" method="post">
76         <div>
77           {include file=$valid->editor()}
78           <input type="hidden" name="uid"    value="{$valid->uid}" />
79           <input type="hidden" name="type"   value="{$valid->type}" />
80           <input type="hidden" name="stamp"  value="{$valid->stamp}" />
81           <br />
82           <input type="submit" name="edit"   value="Éditer" />
83         </div>
84       </form>
85     </td>
86   </tr>
87   {/if}
88   <tr onclick="toggleField('comment', '{$valid->id()}')" style="cursor: pointer">
89     <th colspan='2'>
90       {if $valid->comments|@count eq 0}
91       <div style="float: left">
92         {icon name="add"}
93       </div>
94       {/if}
95       Commentaires
96     </th>
97   </tr>
98   {foreach from=$valid->comments item=c}
99   <tr class="{cycle values="impair,pair"}">
100     <td class="titre">
101       <a href="profile/{$c[0]}" class="popup2">{$c[0]}</a>
102     </td>
103     <td>{$c[1]|nl2br}</td>
104   </tr>
105   {/foreach}
106   <tr {if $valid->comments|@count eq 0}style="display: none"{/if} id="comment_{$valid->id()}">
107     <td colspan='2' class='center'>
108       <form action="admin/validate" method="post">
109         <div>
110           <input type="hidden" name="uid"    value="{$valid->uid}" />
111           <input type="hidden" name="type"   value="{$valid->type}" />
112           <input type="hidden" name="stamp"  value="{$valid->stamp}" />
113           <input type="hidden" name="formid" value="{0|rand:65535}" />
114           <textarea rows="3" cols="50" name="comm"></textarea>
115           <br />
116           <input type="submit" name="hold"   value="Commenter" />
117         </div>
118       </form>
119     </td>
120   </tr>
121   <tr>
122     <th colspan='2'>
123       {if $preview_id neq $valid->id()}
124       <div style="float: left">
125         {icon name="null"}
126       </div>
127       {/if}
128       Réponse
129     </th>
130   </tr>
131   <tr>
132     <td colspan='2' {popup caption="Règles de validation" text=$valid->ruleText()}>
133       <form action="admin/validate" method="post">
134         <div>
135           Réponse préremplie&nbsp;:
136           <select onchange="this.form.comm.value=this.value">
137             <option value=""></option>
138             {foreach from=$valid->answers() item=automatic_answer}
139               <option value="{$automatic_answer.answer}">{$automatic_answer.title}</option>
140             {/foreach}
141           </select>
142           <a href="admin/validate/answers">{icon name="page_edit" title="Éditer les réponses automatiques"}</a>
143         </div>
144         <div class='center'>
145           Ajouté dans l'email&nbsp;:<br />
146           <textarea rows="5" cols="50" name="comm"></textarea><br />
147
148           <input type="hidden" name="uid"    value="{$valid->uid}" />
149           <input type="hidden" name="type"   value="{$valid->type}" />
150           <input type="hidden" name="stamp"  value="{$valid->stamp}" />
151           <input type="submit" name="accept" value="Accepter" />
152           {if $valid->refuse}<input type="submit" name="refuse" value="Refuser" />{/if}
153           <input type="submit" name="delete" value="Supprimer" />
154         </div>
155       </form>
156     </td>
157   </tr>
158 </table>
159 {else}
160 {counter print=false assign=hidden}
161 {/if}
162 {/iterate}
163
164 {if $hidden}
165 <p>{$hidden} validation{if $hidden > 1}s ont été masquées{else} a été masquée{/if}.</p>
166 {/if}
167
168 {else}
169
170 <p>Rien à valider</p>
171
172 {/if}
173
174 <p>
175   Afficher seulement les validation suivantes&nbsp;:
176 </p>
177
178 <form action="admin/validate" method="post">
179   {foreach from=$categories item=type}
180     <div style="float:left;width:33%"><input type="checkbox" name="{$type}" id="hide_{$type}"{if !$hide_requests[$type]} checked="checked"{/if}/>
181     <label for="hide_{$type}">{$type}</label></div>
182   {/foreach}
183   <div class="center" style="clear:left"><input type="submit" name="hide" value="Valider" /></div>
184 </form>
185
186 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}