67d954325fb0fad948628b925a26ded78a23bf48
[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   function updateSubLink(cb)
82   {
83     var href = cb.value ? cb.value : "http://www.polytechnique.net";
84     document.getElementById("groupesx_sub").href = href;
85   }
86
87   //]]>
88 </script>
89 {/literal}
90
91 <table class="bicol" style="margin-bottom: 1em" summary="Profil: Informations Polytechniciennes">
92   <tr>
93     <th colspan="2">
94       Informations polytechniciennes
95     </th>
96   </tr>
97   <tr>
98     <td colspan="2" class="flags">
99       <span class="rouge"><input type="checkbox" name="accesX" checked="checked" disabled="disabled" /></span>
100       <span class="texte">privé</span>
101     </td>
102   </tr>
103   <tr class="top">
104     <td class="titre" style="width: 30%">
105       <script type="text/javascript">printTitle("Section")</script>
106     </td>
107     <td>
108       <select name="section">
109         {select_db_table table="sections" valeur=$section}
110       </select>
111     </td>
112   </tr>
113   <!-- Binets -->
114   <tr id="binets">
115     <td class="titre">
116       <script type="text/javascript">printTitle("Binet(s)")</script>
117     </td>
118     <td>
119       <select name="binets_sel" onchange="update('binets')">
120         {select_db_table table="binets_def" valeur=0 champ="text" pad='1'}
121       </select>
122       <a id="binets_add" href="javascript:add('binets')">{icon name="add" title="Ajouter ce binet"}</a>
123     </td>
124   </tr>
125   {foreach item=text key=bid from=$binets}
126   <tr id="binets_{$bid}">
127     <td>
128       <input type="hidden" name="binets[{$bid}]" value="{$text}" />
129     </td>
130     <td>
131       <div style="float: left; width: 70%">
132         {$text}
133       </div>
134       <a href="javascript:remove('binets', {$bid})">{icon name="cross" title="Supprimer ce binet"}</a>
135     </td>
136   </tr>
137   {/foreach}
138 </table>
139 <table class="bicol" style="margin-bottom: 1em">
140   <tr>
141     <th colspan="2">Groupes et institutions X</th>
142   </tr>
143   <tr>
144     <td colspan="2">
145       <p>
146         La gestion des annuaires des groupes X est réalisée grâce à
147         <a href="http://www.polytechnique.net">Polytechnique.net</a>. Pour faire apparaître un groupe sur ta fiche
148         il faut que soit inscrit dans ce groupe sur l'annuaire sur Polytechnique.net.
149       </p>
150       <p>
151         Tu es actuellement inscrit aux groupes X suivants&nbsp;:
152       </p>
153     </td>
154   </tr>
155   {iterate from=$mygroups item=group}
156   <tr>
157     <td class="titre">
158       {if $group.pub neq 'public'}{icon name=error title="Liste de membres a accès restreint"}{/if}
159       {if $group.perms eq 'admin'}{icon name=wrench title="Tu es administrateur du groupe"}{/if}
160       {if $group.site}<a href="{$group.site}">{else}<a href="http://www.polytechnique.net/{$group.diminutif}">{/if}
161       {$group.nom}
162       </a>
163     </td>
164     <td style="text-align: right; width: 30%">
165       <a href="{if $group.unsub_url}{$group.unsub_url}{else}http://www.polytechnique.net/{$group.diminutif}/unsubscribe{/if}">
166         {icon name=cross title="Demander désinscription"} Demander ta désinscription
167       </a>
168     </td>
169   </tr>
170   {/iterate}
171   <tr>
172     <td colspan="2" class="smaller">
173       <div class="titre">Signification des symboles&nbsp;:</div>
174       {icon name=error} L'annuaire du groupe est à visibilité restreinte et ce groupe n'apparaîtra pas sur ta fiche<br />
175       {icon name=wrench} Tu es administrateur du groupe
176     </td>
177   </tr>
178   <tr class="pair">
179     <td colspan="2">
180       <p>
181         Tu peux demander ton inscription aux groupes X qui t'intéressent. Voici la liste de ceux disponibles actuellement
182         sur Polytechnique.net et qui autorisent les demandes d'inscription&nbsp;:
183       </p>
184     </td>
185   <tr class="pair">
186     <td>
187       {assign var=groupcat value=""}
188       {assign var=ingroup value=false}
189       <select name="groupesx_sub" onchange="updateSubLink(this)">
190         {iterate from=$listgroups item=group}
191         {if $group.dom neq $groupcat}
192           {if $ingroup}
193           </optgroup>
194           {assign var=ingroup value=false}
195           {/if}
196           {if $group.dom}
197           <optgroup label="{$group.dom}">
198           {assign var=ingroup value=true}
199           {assign var=groupcat value="`$group.dom`"}
200           {/if}
201         {/if}
202         <option value="{if $group.sub_url}{$group.sub_url}{else}http://www.polytechnique.net/{$group.diminutif}/subscribe{/if}">
203           {$group.nom}
204         </option>
205         {/iterate}
206         {if $ingroup}</optgroup>{/if}
207       </select>
208     </td>
209     <td style="text-align: right">
210       <a href="http://www.polytechnique.net" id="groupesx_sub">
211         {icon name="add" title="Demander ton inscription"} Demander ton inscription
212       </a>
213     </td>
214   </tr>
215 </table>
216
217 <script type="text/javascript">
218 update('binets');
219 updateSubLink(document.forms.prof_annu.groupesx_sub);
220 </script>
221
222 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}