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