FS#28 - step 1: more flexible member list visibility on Xnet
[platal.git] / templates / profile / groups.tpl
CommitLineData
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[
92412b28
FB
26 var gdt = new Date();
27 var year = gdt.getYear();
28 if (year < 1000) {
29 year += 1900;
30 }
0337d704 31
92412b28 32 var oldMate = year >= {/literal}{$smarty.session.promo_sortie}{literal};
0337d704 33
92412b28 34 function printTitle(text)
0337d704 35 {
92412b28
FB
36 if (oldMate) {
37 document.write("ex-" + text);
38 } else {
39 document.write(text);
40 }
41 }
0337d704 42
92412b28 43 function update(type)
0337d704 44 {
57b73804
FB
45 var val = document.forms.prof_annu[type + '_sel'].value;
46 if (val == '0' || document.getElementById(type + '_' + val) != null) {
92412b28
FB
47 document.getElementById(type + '_add').style.display = 'none';
48 } else {
49 document.getElementById(type + '_add').style.display = '';
50 }
51 }
0337d704 52
57b73804
FB
53 function remove(cat, id)
54 {
55 $('#' + cat + '_' + id).remove();
b545e664 56 update(cat);
57b73804
FB
57 }
58
59 function add(cat)
60 {
61 var cb = document.forms.prof_annu[cat + '_sel'];
62 var id = cb.value;
63 var text = cb.options[cb.selectedIndex].text;
64 var html = '<tr id="' + cat + '_' + id + '">'
65 + ' <td>'
66 + ' <input type="hidden" name="' + cat + '[' + id + ']" value="' + text + '" />'
67 + ' </td>'
68 + ' <td>'
b545e664
FB
69 + ' <div style="float: left; width: 70%">'
70 + text
71 + ' </div>'
57b73804
FB
72 + ' <a href="javascript:remove(\'' + cat + '\', ' + id + ')">'
73 + ' <img src="images/icons/cross.gif" alt="cross" title="Supprimer ce groupe" />'
74 + ' </a>'
75 + ' </td>'
76 + '</tr>';
77 $('#' + cat).after(html);
b545e664 78 update(cat);
57b73804
FB
79 }
80
0337d704 81 //]]>
82</script>
83{/literal}
92412b28
FB
84
85<table class="bicol" summary="Profil: Informations Polytechniciennes">
86 <tr>
87 <th colspan="2">
88 Informations polytechniciennes
89 </th>
90 </tr>
91 <tr>
92 <td colspan="2" class="flags">
93 <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
94 <span class="texte">privé</span>
95 </td>
96 </tr>
97 <tr class="top">
3950bc21 98 <td class="titre" style="width: 30%">
92412b28
FB
99 <script type="text/javascript">printTitle("Section")</script>
100 </td>
101 <td>
102 <select name="section">
103 {select_db_table table="sections" valeur=$section}
104 </select>
105 </td>
106 </tr>
107 <!-- Binets -->
57b73804 108 <tr id="binets">
92412b28
FB
109 <td class="titre">
110 <script type="text/javascript">printTitle("Binet(s)")</script>
111 </td>
112 <td>
57b73804 113 <select name="binets_sel" onchange="update('binets')">
92412b28
FB
114 {select_db_table table="binets_def" valeur=0 champ="text" pad='1'}
115 </select>
57b73804
FB
116 <a id="binets_add" href="javascript:add('binets')">{icon name="add" title="Ajouter ce binet"}</a>
117 </td>
118 </tr>
119 {foreach item=text key=bid from=$binets}
120 <tr id="binets_{$bid}">
121 <td>
122 <input type="hidden" name="binets[{$bid}]" value="{$text}" />
123 </td>
124 <td>
b545e664
FB
125 <div style="float: left; width: 70%">
126 {$text}
127 </div>
57b73804 128 <a href="javascript:remove('binets', {$bid})">{icon name="cross" title="Supprimer ce binet"}</a>
92412b28
FB
129 </td>
130 </tr>
57b73804 131 {/foreach}
92412b28 132 <!-- Groupes X -->
57b73804 133 <tr id="groupesx">
92412b28
FB
134 <td class="titre">Groupe(s) X</td>
135 <td>
57b73804 136 <select name="groupesx_sel" onchange="update('groupesx')">
92412b28
FB
137 {select_db_table table="groupesx_def" valeur=0 champ="text" pad='1'}
138 </select>
57b73804
FB
139 <a id="groupesx_add" href="javascript:add('groupesx')">{icon name="add" title="Ajouter ce groupe X"}</a>
140 </td>
141 </tr>
142 {foreach item=text key=bid from=$groupesx}
143 <tr id="groupesx_{$bid}">
144 <td>
145 <input type="hidden" name="groupesx[{$bid}]" value="{$text}" />
146 </td>
147 <td>
b545e664
FB
148 <div style="float: left; width: 70%">
149 {$text}
150 </div>
57b73804 151 <a href="javascript:remove('groupesx', {$bid})">{icon name="cross" title="Supprimer ce groupe X"}</a>
92412b28
FB
152 </td>
153 </tr>
57b73804 154 {/foreach}
92412b28
FB
155</table>
156
157<script type="text/javascript">
57b73804
FB
158update('groupesx');
159update('binets');
92412b28 160</script>
0337d704 161
a7de4ef7 162{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}