From a140c3b190aaaac82df43129f0b2e298360bb030 Mon Sep 17 00:00:00 2001 From: stevetruckstuff Date: Mon, 14 Aug 2006 16:12:12 +0000 Subject: [PATCH] Account for extra fields in address book more correctly. Also account for no global address book. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11585 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/addressbook.php | 3 +-- templates/default/addressbook_list.tpl | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/addressbook.php b/src/addressbook.php index 8b5c68b3..42f5d2dd 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -26,7 +26,6 @@ require_once(SM_PATH . 'functions/forms.php'); /** lets get the global vars we may need */ /* From the address form */ -//sqgetGlobalVar('change_abook', $change_abook, SQ_POST); sqgetGlobalVar('addaddr', $addaddr, SQ_POST); sqgetGlobalVar('editaddr', $editaddr, SQ_POST); sqgetGlobalVar('deladdr', $deladdr, SQ_POST); @@ -79,7 +78,6 @@ $defselected = array(); $form_url = 'addressbook.php'; /* Handle user's actions */ -//if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'POST' && !isset($change_abook)) { if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'POST') { /************************************************** @@ -277,6 +275,7 @@ if ($showaddrlist) { $oTemplate->assign('addresses', $addresses); $oTemplate->assign('current_backend', $current_backend); $oTemplate->assign('backends', $list_backends); + $oTemplate->assign('abook_has_extra_field', $abook->add_extra_field); $oTemplate->display('addressbook_list.tpl'); diff --git a/templates/default/addressbook_list.tpl b/templates/default/addressbook_list.tpl index 45616471..0907b71d 100644 --- a/templates/default/addressbook_list.tpl +++ b/templates/default/addressbook_list.tpl @@ -8,6 +8,8 @@ * $current_backend - integer containing backend currently displayed. * $abook_select - string containing HTML to display the address book * selection drop down + * $abook_has_extra_field - boolean TRUE if the address book contains an + * additional field. FALSE otherwise. * $backends - array containing all available backends for selection. * This will be empty if only 1 backend is available! * $addresses - array of addresses in the address book. Each element @@ -46,7 +48,6 @@ extract($t); #echo dump_array($addresses).'
'; /** Begin template **/ $source = $addresses[$current_backend]; -$abook_has_extra_field = isset($source['Addresses'][0]) && !is_null($source['Addresses'][0]['Extra']); $colspan = $abook_has_extra_field ? 6 : 5; ?>
@@ -62,14 +63,22 @@ $colspan = $abook_has_extra_field ? 6 : 5; name="deladdr" id="deladdr" /> class="abookSwitch"> + 0) { + ?> + name="change_abook" id="change_abook" /> + -- 2.25.1