Jacou's comments
[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     update(cat);
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>'
69              + '    <div style="float: left; width: 70%">'
70              +        text
71              + '    </div>'
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);
78     update(cat);
79   }
80
81   //]]>
82 </script>
83 {/literal}
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">
98     <td class="titre" style="width: 30%">
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 -->
108   <tr id="binets">
109     <td class="titre">
110       <script type="text/javascript">printTitle("Binet(s)")</script>
111     </td>
112     <td>
113       <select name="binets_sel" onchange="update('binets')">
114         {select_db_table table="binets_def" valeur=0 champ="text" pad='1'}
115       </select>
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>
125       <div style="float: left; width: 70%">
126         {$text}
127       </div>
128       <a href="javascript:remove('binets', {$bid})">{icon name="cross" title="Supprimer ce binet"}</a>
129     </td>
130   </tr>
131   {/foreach}
132   <!-- Groupes X -->
133   <tr id="groupesx">
134     <td class="titre">Groupe(s) X</td>
135     <td>
136       <select name="groupesx_sel" onchange="update('groupesx')">
137         {select_db_table table="groupesx_def" valeur=0 champ="text" pad='1'}
138       </select>
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>
148       <div style="float: left; width: 70%">
149         {$text}
150       </div>
151       <a href="javascript:remove('groupesx', {$bid})">{icon name="cross" title="Supprimer ce groupe X"}</a>
152     </td>
153   </tr>
154   {/foreach}
155 </table>
156
157 <script type="text/javascript">
158 update('groupesx');
159 update('binets');
160 </script>
161
162 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}