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