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