From 4bc99c18ecbbb7bb7d0fac4592fcc63e3c568798 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 26 Oct 2008 12:29:38 +0000 Subject: We now have a functional but very ugly addressbook. --- forum/utils/addressbook.php | 134 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 115 insertions(+), 19 deletions(-) (limited to 'forum/utils/addressbook.php') diff --git a/forum/utils/addressbook.php b/forum/utils/addressbook.php index 43477dd..29b0fb0 100644 --- a/forum/utils/addressbook.php +++ b/forum/utils/addressbook.php @@ -1,41 +1,137 @@ +
+ + Name:
+ Address:
+ City:
+ Country:
+ Phone:
+ Phone2:
+ Email:
+ Email2:
+ URL:
+ URL2:
+ Essential: >
+ Notes:
+
+ +
+add($contact); +if($action == "addgroup" && $gid) { + $contactgroup = new ContactGroup($gid, $name); + $contacts->add($contactgroup); $contacts->write(); -} elseif($name) { - // Add - $cid = $contacts->getNextCID(); + $gid = 0; +} + +elseif($action == "addcontact" && $gid && $cid) { $contact = new Contact($cid, $name, $address, + $city, + $country, $phone, $phone2, $email, - $url); - $contacts->add($contact); + $email2, + $url, + $url2, + $essential, + $notes); + $contactgroup = $contacts->getContactGroup($gid); + $contactgroup->add($contact); + $contacts->write(); + $cid = 0; +} + +elseif($action =="editcontact" && $cid) { + $contact = $contacts->getContact($cid); + form($contact->cid, + "?mode=addressbook&action=updatecontact".$gid, + "Update contact", + $contact->name, + $contact->address, + $contact->city, + $contact->country, + $contact->phone, + $contact->phone2, + $contact->email, + $contact->email2, + $contact->url, + $contact->url2, + $contact->essential, + $contact->notes); +} + +elseif($action == "updatecontact" && $cid) { + $contact = $contacts->getContact($cid); + + $contact->name = $name; + $contact->address = $address; + $contact->city = $city; + $contact->country = $country; + $contact->phone = $phone; + $contact->phone2 = $phone2; + $contact->email = $email; + $contact->email2 = $email2; + $contact->url = $url; + $contact->url2 = $url2; + $contact->essential = $essential; + $contact->notes = $notes; + $contacts->write(); + + $contact->show(); } -if($cid) { +elseif($cid) { $contact = $contacts->getContact($cid); $contact->show(); -} else { - $contacts->show(); +} + +elseif($gid) { + $contactgroup = $contacts->getContactGroup($gid); + $contactgroup->show(); - // TODO: Editorbox for adding new contact + form($contacts->getNextCID(), + "?mode=addressbook&action=addcontact&gid=".$gid, + "Add contact"); +} else { + $contacts->show(); + if($current_user->uid == 0) { +?> +
+ + Name: + +
+ \ No newline at end of file -- cgit v1.2.3