From 508e918941009544a3992b8ac6815671b93880ca Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Tue, 9 Apr 2013 18:27:17 -0400 Subject: [PATCH] Standardise contact and hub display. Contacts and hubs are very similar, having roles, addresses and entity-specific attributes. Use similar functions and layout when showing them both. --- lib/contact.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/contact.php b/lib/contact.php index 166fd97..ccc932c 100644 --- a/lib/contact.php +++ b/lib/contact.php @@ -44,8 +44,9 @@ exit; } - function show_contact_summary(&$contact) { - echo "
\nContact " . $contact->getLink(); + function show_contact_summary(&$contact, $editing = false) { + if ($editing) echo "

Contact: " . htmlspecialchars($contact->getDisplayname()) . ""; + else echo "
\nContact " . $contact->getStrongLink(); $role = $contact->getRole(); $role_string = get_contact_role_string($contact); if ($role_string) echo " $role_string"; @@ -57,6 +58,8 @@ } $area = get_contact_area($contact); echo " in " . $area->getLink(); + $city = get_contact_city($contact); + echo ", " . $city->getLink(get_city_displayname($city)); } function show_contacts($offset, $per_page, $address_ids) { @@ -422,18 +425,7 @@ if (! $contact) return; echo "

\n"; - echo "

Contact: " . $contact->getDisplayname() . ""; - $role = $contact->getRole(); - $role_string = get_contact_role_string($contact); - if ($role_string) echo " $role_string"; - if ($role & $GLOBALS['ROLE_DONOR']) printf(" Donations", urlencode($contact->getDisplayname()), $contact->getId()); - if ($role & $GLOBALS['ROLE_REQUESTER']) printf(" Referred", urlencode($contact->getDisplayname()), $contact->getId()); - if ($role & $GLOBALS['ROLE_BENEFICIARY']) printf(" Orders", urlencode($contact->getDisplayname()), $contact->getId()); - if (check_admin(1)) { - echo " " . $contact->getDeleteLink(); - } - $city = get_contact_city($contact); - if ($city) echo " in " . $city->getLink(get_city_displayname($city)); + show_contact_summary($contact, true); echo ": "; echo "\n

"; -- 2.7.4