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