2006 => 2007 Happy New Year\!
[platal.git] / templates / profile / deco.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2007 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 {*  Foundation, Inc.,                                                     *}
19 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
20 {*                                                                        *}
21 {**************************************************************************}
22
23
24 {literal}
25 <script type="text/javascript">//<![CDATA[
26   var valid = new array();
27   function medal_add()
28   {
29     var selid = document.forms.prof_annu.medal_sel.selectedIndex;
30     document.forms.prof_annu.medal_id.value = document.forms.prof_annu.medal_sel.options[selid].value;
31     document.forms.prof_annu.grade_id.value = document.forms.prof_annu.grade_sel.value;
32     document.forms.prof_annu.medal_op.value = "ajouter";
33     document.forms.prof_annu.submit();
34   }
35
36   function medal_del( id )
37   {
38     document.forms.prof_annu.medal_id.value = id;
39     document.forms.prof_annu.medal_op.value = "retirer";
40     document.forms.prof_annu.submit();
41   }
42
43   function medal_cancel(stamp)
44   {
45     document.forms.prof_annu.medal_id.value = stamp;
46     document.forms.prof_annu.medal_op.value = "annuler";
47     document.forms.prof_annu.submit();
48   }
49   var subgrades = new array();
50   function getoption( select_input, j)
51   {
52     if (!document.all)
53     {
54       return select_input.options[j];
55     }
56     else
57     {
58       return j;
59     }
60   }
61   function medal_grades( sel_medal )
62   {
63     var subg = subgrades[sel_medal.selectedIndex];
64     document.getElementById("grade_sel_div").style.display = subg?"inline":"none";
65     if (!subg) return;
66     var select = document.getElementById("grade_sel");
67     while (select.length > 1)
68     {
69       select.remove(1);
70     }
71
72     for (i=0; i < subg.length; i++)
73     {
74       var dmc = document.createElement("option");
75       dmc.text= subg[i][1];
76       dmc.value = subg[i][0];
77       select.add(dmc,getoption(select,i));
78     }
79     var vide = document.createElement("option");
80     vide.text = "";
81     vide.value = 0;
82     select.add(vide,getoption(select,0));
83     select.remove(subg.length+1);
84   }
85   //]]>
86 {/literal}
87 {foreach from=$medal_list key=type item=list}
88   {foreach from=$list item=m}{if $grades[$m.id]|@count}
89     subgrades[{$m.id}] = new array({$grades[$m.id]|@count});
90     i = 0;
91     {foreach from=$grades[$m.id] item=g}
92       subgrades[{$m.id}][i] = [{$g.gid},"{$g.text}"];
93       i++;
94     {/foreach}
95   {/if}{/foreach}
96 {/foreach}
97
98 </script>
99
100 {if $smarty.request.medal_op eq "ajouter"}
101 <div class="erreur">
102         Ta demande a bien été prise en compte, elle sera validée prochainement par un administrateur.
103 </div>
104 {/if}
105 <div class="blocunite_tab">
106   <input type="hidden" value="" name="medal_op" />
107   <input type="hidden" value="" name="medal_id" />
108   <input type="hidden" value="" name="grade_id" />
109   <table class="bicol" cellspacing="0" cellpadding="0">
110     <tr>
111       <th colspan="3">
112         Médailles, Décorations, Prix, ...
113       </th>
114     </tr>
115     <tr>
116       <td colspan="3" class="pflags">
117         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
118           <tr>
119             <td class="vert">
120               <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
121             </td>
122             <td class="texte">
123               ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique
124             </td>
125           </tr>
126         </table>
127       </td>
128     </tr>
129     {foreach from=$medals item=m}
130     <tr>
131       <td class="colg">
132         <img src='images/medals/{$m.img}' width="32" alt="{$m.medal}" title="{$m.medal}" />
133       </td>
134       <td class="colm">
135         <span class="valeur">{$m.medal}</span><br />
136         {if $grades[$m.id]|@count}
137           {foreach from=$grades[$m.id] item=g}
138             {if $g.gid eq $m.gid}{$g.text}{/if}
139           {/foreach}
140         {/if}
141       </td>
142       <td class="cold">
143         <span class="lien">
144           <a href="javascript:medal_del({$m.id});">retirer</a>
145         </span>
146       </td>
147     </tr>
148     {/foreach}
149     {foreach from=$medals_valid item=v}
150     <tr>
151       <td class="colg">
152         <img
153           {foreach from=$medal_list item=list}
154             {foreach from=$list item=m}
155             {if $m.id eq $v->mid}src="images/medals/{$m.img}"{/if}
156             {/foreach}
157           {/foreach}
158         title="Validation" alt="Validation" width="32" />
159       <td class="colm">
160         <span class="valeur">
161           {foreach from=$medal_list item=list}
162             {foreach from=$list item=m}
163             {if $m.id eq $v->mid}{$m.text}&nbsp;<em>(en attente de validation)</em>{/if}
164             {/foreach}
165           {/foreach}
166         </span><br />
167         {foreach from=$grades key=mid item=grd}
168           {if $mid eq $v->mid}
169           {foreach from=$grd item=g}
170             {if $g.gid eq $v->gid}{$g.text}{/if}
171           {/foreach}
172           {/if}
173         {/foreach}
174       </td>
175       <td class="cold">
176         <span class="lien">
177           <a href="javascript:medal_cancel({$v->stamp});">annuler</a>
178         </span>
179       </tr>
180     </tr>
181     {/foreach}
182     <tr>
183       <td class="colg">
184         &nbsp;
185       </td>
186       <td class="colm">
187         <select name="medal_sel" onchange="medal_grades(this)">
188           <option value=''></option>
189           {foreach from=$medal_list key=type item=list}
190           <optgroup label="{$trad[$type]}">
191             {foreach from=$list item=m}
192             <option value="{$m.id}">{$m.text}</option>
193             {/foreach}
194           </optgroup>
195           {/foreach}
196         </select>
197         <div id="grade_sel_div" style="display:none"><br/>
198           <select name="grade_sel" id="grade_sel">
199             <option value="0"></option>
200           </select>
201         </div>
202       </td>
203       <td class="cold">
204         <span class="lien">
205           <a href="javascript:medal_add();">ajouter</a>
206         </span>
207       </td>
208     </tr>
209   </table>
210 </div>
211
212 {* vim:set et sw=2 sts=2 sws=2: *}