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 restoreObject(id, pref)
33 document.getElementById(id).style.display = '';
34 document.forms.prof_annu[pref + "[removed]"].value = "0";
37 function getAddressElement(adrid, adelement)
39 return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"];
42 function checkCurrentAddress(newCurrent)
44 var hasCurrent = false;
46 while (getAddressElement(i, 'pub') != null) {
47 var radio = getAddressElement(i, 'current');
48 var removed = getAddressElement(i, 'removed');
49 if (removed.value == "1" && radio.checked) {
50 radio.checked = false;
51 } else if (radio.checked && radio != newCurrent) {
52 radio.checked = false;
53 } else if (radio.checked) {
60 while (getAddressElement(i, 'pub') != null) {
61 var radio = getAddressElement(i, 'current');
62 var removed = getAddressElement(i, 'removed');
63 if (removed.value != "1") {
72 function removeAddress(id, pref)
74 removeObject(id, pref);
75 checkCurrentAddress(null);
76 if (document.forms.prof_annu[pref + '[datemaj]'].value != '') {
77 document.getElementById(id + '_grayed').style.display = '';
81 function restoreAddress(id, pref)
83 document.getElementById(id + '_grayed').style.display = 'none';
84 checkCurrentAddress(null);
85 restoreObject(id, pref);
91 while (getAddressElement(i, 'pub') != null) {
94 $("#add_adr").before('<div id="addresses_' + i + '_cont"></div>');
95 Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress);
101 var adid = 'addresses_' + id;
102 var tel = adid + '_tel_';
103 while (document.getElementById(tel + i) != null) {
106 $('#' + adid + '_add_tel').before('<div id="' + tel + i + '" style="clear: both"></div>');
107 Ajax.update_html(tel + i, 'profile/ajax/tel/' + id + '/' + i);
110 function validGeoloc(id, pref)
112 document.getElementById(id + '_geoloc').style.display = 'none';
113 document.getElementById(id + '_geoloc_error').style.display = 'none';
114 document.getElementById(id + '_geoloc_valid').style.display = 'none';
115 document.forms.prof_annu[pref + "[parsevalid]"].value = "1";
116 document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value;
117 attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
118 function() { document.forms.prof_annu[pref + "[text]"].blur(); });
119 document.forms.prof_annu[pref + "[text]"].className = '';
122 function validAddress(id, pref)
124 document.getElementById(id + '_geoloc').style.display = 'none';
125 document.getElementById(id + '_geoloc_error').style.display = 'none';
126 document.getElementById(id + '_geoloc_valid').style.display = 'none';
127 document.forms.prof_annu[pref + "[parsevalid]"].value = "0";
128 attachEvent(document.forms.prof_annu[pref + "[text]"], "click",
129 function() { document.forms.prof_annu[pref + "[text]"].blur(); });
130 document.forms.prof_annu[pref + "[text]"].className = '';
136 {foreach key=i item=adr from=$addresses}
137 <div id="{"addresses_`$i`_cont"}">
138 {include file="profile/adresses.address.tpl" i=$i adr=$adr}
141 {if $addresses|@count eq 0}
142 <div id="addresses_0_cont">
143 {include file="profile/adresses.address.tpl" i=0 adr=0}
147 <div id="add_adr" class="center">
148 <a href="javascript:addAddress()">
149 {icon name=add title="Ajouter une adresse"} Ajouter une adresse
153 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}