From 9a1cb88385e06f1ce1514a367d6b1bbfd3780e44 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Thu, 30 Aug 2007 22:16:41 +0200 Subject: [PATCH] Finish the addresses page Signed-off-by: Florent Bruneau --- htdocs/css/keynote.css | 5 +++++ modules/profile/addresses.inc.php | 12 +++++++++++- templates/profile/adresses.address.tpl | 12 +++++++++++- templates/profile/adresses.tpl | 22 +++++++++++++++++++--- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/htdocs/css/keynote.css b/htdocs/css/keynote.css index 3c1a22c..8261843 100644 --- a/htdocs/css/keynote.css +++ b/htdocs/css/keynote.css @@ -216,6 +216,11 @@ td.action { } td.action a { padding: 0px 2px 0px 2px; } +th.grayed { + background: url('../images/skins/keynote_bg_lighter.png') #848495 top left repeat-x fixed; + font-style: italic; +} + /******************************************************************************* 4 Tableau de choix de skins [ Styles pour les tableaux de types de ceux des skins ] diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php index c94e119..4243527 100644 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@ -93,7 +93,17 @@ class ProfileAddress unset($value[$key]); } } - $success = true; + $current = 0; + foreach ($value as $key=>&$adr) { + if (@$adr['current']) { + $current++; + } + } + if (!$init && $current != 1 && count($value) > 0) { + $success = false; + } else { + $success = true; + } foreach ($value as $key=>&$adr) { $this->geolocAddress($adr, $s); $this->cleanAddress($page, $adr); diff --git a/templates/profile/adresses.address.tpl b/templates/profile/adresses.address.tpl index 949ac66..5b49c91 100644 --- a/templates/profile/adresses.address.tpl +++ b/templates/profile/adresses.address.tpl @@ -27,7 +27,17 @@ {assign var=adid value="addresses_$i"} - +
+ + + + +
diff --git a/templates/profile/adresses.tpl b/templates/profile/adresses.tpl index 237ba56..833d716 100644 --- a/templates/profile/adresses.tpl +++ b/templates/profile/adresses.tpl @@ -28,6 +28,12 @@ function removeObject(id, pref) document.forms.prof_annu[pref + "[removed]"].value = "1"; } +function restoreObject(id, pref) +{ + document.getElementById(id).style.display = ''; + document.forms.prof_annu[pref + "[removed]"].value = "0"; +} + function getAddressElement(adrid, adelement) { return document.forms.prof_annu["addresses[" + adrid + "][" + adelement + "]"]; @@ -67,6 +73,16 @@ function removeAddress(id, pref) { removeObject(id, pref); checkCurrentAddress(null); + if (document.forms.prof_annu[pref + '[datemaj]'].value != '') { + document.getElementById(id + '_grayed').style.display = ''; + } +} + +function restoreAddress(id, pref) +{ + document.getElementById(id + '_grayed').style.display = 'none'; + checkCurrentAddress(null); + restoreObject(id, pref); } function addAddress() @@ -75,8 +91,8 @@ function addAddress() while (getAddressElement(i, 'pub') != null) { i++; } - $("#add_adr").before('
'); - Ajax.update_html('addresses_' + i, 'profile/ajax/address/' + i, checkCurrentAddress); + $("#add_adr").before('
'); + Ajax.update_html('addresses_' + i + '_cont', 'profile/ajax/address/' + i, checkCurrentAddress); } function addTel(id) @@ -95,7 +111,7 @@ function addTel(id) //]]> {foreach key=i item=adr from=$addresses} -
+
{include file="profile/adresses.address.tpl" i=$i adr=$adr}
{/foreach} -- 2.1.4