1 {**************************************************************************}
3 {* Copyright (C) 2003-2007 Polytechnique.org *}
4 {* http://opensource.polytechnique.org/ *}
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. *}
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. *}
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 *}
21 {**************************************************************************}
23 <script type="text/javascript">//<![CDATA[
25 function removeObject(id, pref)
27 document.getElementById(id).style.display = "none";
28 document.forms.prof_annu[pref + "[removed]"].value = "1";
31 function getAddressElement(adrid, adelement)
33 return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"];
36 function checkCurrentAddress(newCurrent)
38 var hasCurrent = false;
40 while (getAddressElement(i, 'pub') != null) {
41 var radio = getAddressElement(i, 'current');
42 var removed = getAddressElement(i, 'removed');
43 if (removed.value == "1" && radio.checked) {
44 radio.checked = false;
45 } else if (radio.checked && radio != newCurrent) {
46 radio.checked = false;
47 } else if (radio.checked) {
54 while (getAddressElement(i, 'pub') != null) {
55 var radio = getAddressElement(i, 'current');
56 var removed = getAddressElement(i, 'removed');
57 if (removed.value != "1") {
66 function removeAddress(id, pref)
68 removeObject(id, pref);
69 checkCurrentAddress(null);
75 while (getAddressElement(i, 'pub') != null) {
78 $("#add_adr").before('<div id="addresses_' + i + '"></div>');
79 Ajax.update_html('addresses_' + i, 'profile/ajax/address/' + i, checkCurrentAddress);
85 var adid = 'addresses_' + id;
86 var tel = adid + '_tel_';
87 while (document.getElementById(tel + i) != null) {
90 $('#' + adid + '_add_tel').before('<div id="' + tel + i + '" style="clear: both"></div>');
91 Ajax.update_html(tel + i, 'profile/ajax/tel/' + id + '/' + i);
97 {foreach key=i item=adr from=$addresses}
98 <div id="{"addresses_$i"}">
99 {include file="profile/adresses.address.tpl" i=$i adr=$adr}
102 {if $addresses|@count eq 0}
103 <div id="addresses_0">
104 {include file="profile/adresses.address.tpl" i=0 adr=0}
108 <div id="add_adr" class="center">
109 <a href="javascript:addAddress()">
110 {icon name=add title="Ajouter une adresse"} Ajouter une adresse
114 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}