Arrange templates by module
[platal.git] / templates / profile / deco.tpl
CommitLineData
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 }
20d7932b 41 var subgrades = new array();
42 function getoption( select_input, j)
43 {
44 if (!document.all)
45 {
46 return select_input.options[j];
47 }
48 else
49 {
50 return j;
51 }
52 }
53 function medal_grades( sel_medal )
54 {
55 var subg = subgrades[sel_medal.selectedIndex];
56 document.getElementById("grade_sel_div").style.display = subg?"inline":"none";
57 if (!subg) return;
58 var select = document.getElementById("grade_sel");
59 while (select.length > 1)
60 {
61 select.remove(1);
62 }
63
64 for (i=0; i < subg.length; i++)
65 {
66 var dmc = document.createElement("option");
67 dmc.text= subg[i][1];
68 dmc.value = subg[i][0];
69 select.add(dmc,getoption(select,i));
70 }
b59b41d6 71 var vide = document.createElement("option");
72 vide.text = "";
73 vide.value = 0;
74 select.add(vide,getoption(select,0));
20d7932b 75 select.remove(subg.length+1);
76 }
0337d704 77 //]]>
0337d704 78{/literal}
20d7932b 79{foreach from=$medal_list key=type item=list}
80 {foreach from=$list item=m}{if $grades[$m.id]|@count}
81 subgrades[{$m.id}] = new array({$grades[$m.id]|@count});
82 i = 0;
83 {foreach from=$grades[$m.id] item=g}
84 subgrades[{$m.id}][i] = [{$g.gid},"{$g.text}"];
85 i++;
86 {/foreach}
87 {/if}{/foreach}
88{/foreach}
89
90</script>
0337d704 91
20d7932b 92{if $smarty.request.medal_op eq "ajouter"}
93<div class="erreur">
94 Ta demande a bien été prise en compte, elle sera validée prochainement par un administrateur.
95</div>
96{/if}
0337d704 97<div class="blocunite_tab">
98 <input type="hidden" value="" name="medal_op" />
99 <input type="hidden" value="" name="medal_id" />
20d7932b 100 <input type="hidden" value="" name="grade_id" />
0337d704 101 <table class="bicol" cellspacing="0" cellpadding="0">
102 <tr>
103 <th colspan="3">
104 Médailles, Décorations, Prix, ...
105 </th>
106 </tr>
107 <tr>
108 <td colspan="3" class="pflags">
109 <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
110 <tr>
111 <td class="vert">
112 <input type="checkbox" name="medals_pub"{if $medals_pub eq 'public'} checked="checked"{/if} />
113 </td>
114 <td class="texte">
115 ces informations sont normalement publiques (JO, ...) mais tu peux choisir de les associer a ta fiche publique
116 </td>
117 </tr>
118 </table>
119 </td>
120 </tr>
121 {foreach from=$medals item=m}
122 <tr>
123 <td class="colg">
7b2413f6 124 <img src='images/medals/{$m.img}' width="32" alt="{$m.medal}" title="{$m.medal}" />
0337d704 125 </td>
126 <td class="colm">
127 <span class="valeur">{$m.medal}</span><br />
128 {if $grades[$m.id]|@count}
0337d704 129 {foreach from=$grades[$m.id] item=g}
20d7932b 130 {if $g.gid eq $m.gid}{$g.text}{/if}
0337d704 131 {/foreach}
0337d704 132 {/if}
133 </td>
134 <td class="cold">
135 <span class="lien">
136 <a href="javascript:medal_del({$m.id});">retirer</a>
137 </span>
138 </td>
139 </tr>
140 {/foreach}
141 <tr>
142 <td class="colg">
143 &nbsp;
144 </td>
145 <td class="colm">
20d7932b 146 <select name="medal_sel" onchange="medal_grades(this)">
0337d704 147 <option value=''></option>
148 {foreach from=$medal_list key=type item=list}
149 <optgroup label="{$trad[$type]}">
150 {foreach from=$list item=m}
151 <option value="{$m.id}">{$m.text}</option>
152 {/foreach}
153 </optgroup>
154 {/foreach}
155 </select>
20d7932b 156 <div id="grade_sel_div" style="display:none"><br/>
157 <select name="grade_sel" id="grade_sel">
158 <option value="0"></option>
159 </select>
160 </div>
0337d704 161 </td>
162 <td class="cold">
163 <span class="lien">
164 <a href="javascript:medal_add();">ajouter</a>
165 </span>
166 </td>
167 </tr>
168 </table>
169</div>
170
171{* vim:set et sw=2 sts=2 sws=2: *}