Commit | Line | Data |
---|---|---|
0337d704 | 1 | {**************************************************************************} |
2 | {* *} | |
5ddeb07c | 3 | {* Copyright (C) 2003-2007 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[ | |
a7c28fff FB |
26 | function update() |
27 | { | |
28 | var val = document.forms.prof_annu['medal_sel'].value; | |
29 | if (val == '' || document.getElementById('medal_' + val) != null) { | |
30 | document.getElementById('medal_add').display.style = 'none'; | |
31 | } else { | |
32 | document.getElementById('medal_add').display.style = ''; | |
33 | } | |
34 | } | |
35 | ||
d02b8359 | 36 | var valid = new array(); |
0337d704 | 37 | function medal_add() |
38 | { | |
39 | var selid = document.forms.prof_annu.medal_sel.selectedIndex; | |
40 | document.forms.prof_annu.medal_id.value = document.forms.prof_annu.medal_sel.options[selid].value; | |
20d7932b | 41 | document.forms.prof_annu.grade_id.value = document.forms.prof_annu.grade_sel.value; |
0337d704 | 42 | document.forms.prof_annu.medal_op.value = "ajouter"; |
43 | document.forms.prof_annu.submit(); | |
44 | } | |
45 | ||
46 | function medal_del( id ) | |
47 | { | |
48 | document.forms.prof_annu.medal_id.value = id; | |
49 | document.forms.prof_annu.medal_op.value = "retirer"; | |
50 | document.forms.prof_annu.submit(); | |
51 | } | |
3f428576 | 52 | |
53 | function medal_cancel(stamp) | |
54 | { | |
55 | document.forms.prof_annu.medal_id.value = stamp; | |
56 | document.forms.prof_annu.medal_op.value = "annuler"; | |
57 | document.forms.prof_annu.submit(); | |
58 | } | |
20d7932b | 59 | var subgrades = new array(); |
60 | function getoption( select_input, j) | |
61 | { | |
62 | if (!document.all) | |
63 | { | |
64 | return select_input.options[j]; | |
65 | } | |
66 | else | |
67 | { | |
68 | return j; | |
69 | } | |
70 | } | |
71 | function medal_grades( sel_medal ) | |
72 | { | |
73 | var subg = subgrades[sel_medal.selectedIndex]; | |
74 | document.getElementById("grade_sel_div").style.display = subg?"inline":"none"; | |
75 | if (!subg) return; | |
76 | var select = document.getElementById("grade_sel"); | |
77 | while (select.length > 1) | |
78 | { | |
79 | select.remove(1); | |
80 | } | |
81 | ||
82 | for (i=0; i < subg.length; i++) | |
83 | { | |
84 | var dmc = document.createElement("option"); | |
85 | dmc.text= subg[i][1]; | |
86 | dmc.value = subg[i][0]; | |
87 | select.add(dmc,getoption(select,i)); | |
88 | } | |
b59b41d6 | 89 | var vide = document.createElement("option"); |
90 | vide.text = ""; | |
91 | vide.value = 0; | |
92 | select.add(vide,getoption(select,0)); | |
20d7932b | 93 | select.remove(subg.length+1); |
94 | } | |
0337d704 | 95 | //]]> |
0337d704 | 96 | {/literal} |
20d7932b | 97 | {foreach from=$medal_list key=type item=list} |
98 | {foreach from=$list item=m}{if $grades[$m.id]|@count} | |
99 | subgrades[{$m.id}] = new array({$grades[$m.id]|@count}); | |
100 | i = 0; | |
101 | {foreach from=$grades[$m.id] item=g} | |
102 | subgrades[{$m.id}][i] = [{$g.gid},"{$g.text}"]; | |
103 | i++; | |
104 | {/foreach} | |
105 | {/if}{/foreach} | |
106 | {/foreach} | |
107 | ||
108 | </script> | |
0337d704 | 109 | |
a7c28fff FB |
110 | <table class="bicol"> |
111 | <tr> | |
112 | <th> | |
113 | Médailles, Décorations, Prix, ... | |
114 | </th> | |
115 | </tr> | |
116 | <tr> | |
117 | <td> | |
118 | <div class="flags"> | |
119 | <div class="vert" style="float: left"> | |
120 | <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} /> | |
121 | </div> | |
122 | <div class="texte"> | |
123 | ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique | |
124 | </div> | |
125 | </div> | |
126 | <div style="clear: both; margin-top: 0.2em"> | |
127 | <select name="medal_sel" onchange="update()"> | |
0337d704 | 128 | <option value=''></option> |
129 | {foreach from=$medal_list key=type item=list} | |
a7c28fff | 130 | <optgroup label="{$trad[$type]}..."> |
0337d704 | 131 | {foreach from=$list item=m} |
132 | <option value="{$m.id}">{$m.text}</option> | |
133 | {/foreach} | |
134 | </optgroup> | |
135 | {/foreach} | |
136 | </select> | |
a7c28fff FB |
137 | <span id="medal_add"> |
138 | <a href="javascript:add();">{icon name=add title="Ajouter cette médaille"}</a> | |
0337d704 | 139 | </span> |
a7c28fff FB |
140 | </div> |
141 | {foreach from=$medals item=medal key=id} | |
142 | {include file="profile/deco.medal.tpl" medal=$medal id=$id} | |
143 | {/foreach} | |
144 | </td> | |
145 | </tr> | |
146 | </table> | |
147 | ||
148 | <script type="text/javascript"> | |
149 | update(); | |
150 | </script> | |
0337d704 | 151 | |
a7de4ef7 | 152 | {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} |