summaryrefslogtreecommitdiff
path: root/forum/utils
diff options
context:
space:
mode:
authordeva <deva>2008-10-26 13:24:26 +0000
committerdeva <deva>2008-10-26 13:24:26 +0000
commit648878fb3a0430506c3b0f5a92bc7699b7ceb3ed (patch)
treef247d42bea2569cbd0b1fa39f557b106a512a4bb /forum/utils
parent1d91956f828b9dd53bb760b4289ea55d3ec3fd49 (diff)
Hide unused fields when showing a contact. Add number of contacts in groups and number of hidden contacts.
Diffstat (limited to 'forum/utils')
-rw-r--r--forum/utils/addressbook.php5
-rw-r--r--forum/utils/contacts.php40
2 files changed, 30 insertions, 15 deletions
diff --git a/forum/utils/addressbook.php b/forum/utils/addressbook.php
index c3c5d65..fb34156 100644
--- a/forum/utils/addressbook.php
+++ b/forum/utils/addressbook.php
@@ -5,6 +5,7 @@ function form($cid,
$posturl,
$buttontext,
$name = "",
+ $co = "",
$address = "",
$city = "",
$country = "",
@@ -21,6 +22,7 @@ function form($cid,
<form method="post" action="<?php echo $posturl; ?>">
<input type="hidden" name="cid" value="<?php echo $cid;?>">
Name: <input name="name" value="<?php echo $name;?>"><br/>
+ c/o: <input name="co" value="<?php echo $co;?>"><br/>
Address: <input name="address" value="<?php echo $address;?>"><br/>
City: <input name="city" value="<?php echo $city;?>"><br/>
Country: <input name="country" value="<?php echo $country;?>"><br/>
@@ -51,6 +53,7 @@ if($action == "addgroup" && $gid) {
elseif($action == "addcontact" && $gid && $cid) {
$contact = new Contact($cid,
$name,
+ $co,
$address,
$city,
$country,
@@ -74,6 +77,7 @@ elseif($action =="editcontact" && $cid) {
"?mode=addressbook&amp;action=updatecontact".$gid,
"Update contact",
$contact->name,
+ $contact->co,
$contact->address,
$contact->city,
$contact->country,
@@ -91,6 +95,7 @@ elseif($action == "updatecontact" && $cid) {
$contact = $contacts->getContact($cid);
$contact->name = $name;
+ $contact->co = $co;
$contact->address = $address;
$contact->city = $city;
$contact->country = $country;
diff --git a/forum/utils/contacts.php b/forum/utils/contacts.php
index bd59d16..a83e3f5 100644
--- a/forum/utils/contacts.php
+++ b/forum/utils/contacts.php
@@ -6,6 +6,7 @@ include_once($UTIL_DIR . "/parser.php");
class Contact {
public $cid;
public $name;
+ public $co;
public $address;
public $city;
public $country;
@@ -20,7 +21,8 @@ class Contact {
public function write($fp) {
fwrite($fp, " <contact cid=\"" . convert_xml($this->cid, ENT_QUOTES, "UTF-8") . "\"\n");
- fwrite($fp, " name=\"" . convert_xml($this->name, ENT_QUOTES, "UTF-8") . "\"\n");
+ fwrite($fp, " name=\"" . convert_xml($this->name, ENT_QUOTES, "UTF-8") . "\"\n");
+ fwrite($fp, " co=\"" . convert_xml($this->co, ENT_QUOTES, "UTF-8") . "\"\n");
fwrite($fp, " address=\"" . convert_xml($this->address, ENT_QUOTES, "UTF-8") . "\"\n");
fwrite($fp, " city=\"" . convert_xml($this->city, ENT_QUOTES, "UTF-8") . "\"\n");
fwrite($fp, " country=\"" . convert_xml($this->country, ENT_QUOTES, "UTF-8") . "\"\n");
@@ -38,18 +40,19 @@ class Contact {
public function show()
{
echo "<p>\n";
- // echo "\tcid: " . $this->cid . "<br/>";
- echo "\tname: " . $this->name . "<br/>";
- echo "\taddress: " . $this->address . "<br/>";
- echo "\tcity: " . $this->city . "<br/>";
- echo "\tcountry: " . $this->country . "<br/>";
- echo "\tphone: " . $this->phone . "<br/>";
- echo "\tphone2: " . $this->phone2 . "<br/>";
- echo "\temail: <a href=\"mailto:" . $this->email . "\">" . $this->email . "</a><br/>";
- echo "\temail2: <a href=\"mailto:" . $this->email2 . "\">" . $this->email2 . "</a><br/>";
- echo "\turl: <a href=\"" . $this->url . "\">" . $this->url . "</a><br/>";
- echo "\turl2: <a href=\"" . $this->url2 . "\">" . $this->url2 . "</a><br/>";
- echo "\tnotes: " . parse($this->notes) . "<br/>";
+ // echo "\tcid: " . $this->cid . "<br/>\n";
+ echo "\tName: " . $this->name . "<br/>\n";
+ if($this->co) echo "\tc/o: " . $this->co . "<br/>\n";
+ if($this->address) echo "\tAddress: " . $this->address . "<br/>\n";
+ if($this->city) echo "\tCity: " . $this->city . "<br/>\n";
+ if($this->country) echo "\tCountry: " . $this->country . "<br/>\n";
+ if($this->phone) echo "\tPhone: " . $this->phone . "<br/>\n";
+ if($this->phone2) echo "\tPhone2: " . $this->phone2 . "<br/>\n";
+ if($this->email) echo "\tEmail: <a href=\"mailto:" . $this->email . "\">" . $this->email . "</a><br/>\n";
+ if($this->email2) echo "\tEmail2: <a href=\"mailto:" . $this->email2 . "\">" . $this->email2 . "</a><br/>\n";
+ if($this->url) echo "\tURL: <a href=\"" . $this->url . "\">" . $this->url . "</a><br/>\n";
+ if($this->url2) echo "\tURL2: <a href=\"" . $this->url2 . "\">" . $this->url2 . "</a><br/>\n";
+ if($this->notes) echo "\tNotes: <br/>\n" . parse($this->notes) . "<br/>\n";
echo "\t<a href=\"?mode=addressbook&amp;action=editcontact&amp;cid=" . $this->cid . "\">Edit</a>\n";
echo "</p>\n";
}
@@ -59,10 +62,11 @@ class Contact {
echo "<div class=\"contact\"><a href=\"?mode=addressbook&amp;cid=" . $this->cid . "\">" . $this->name . "</a></div>";
}
- function Contact($cid, $name, $address, $city, $country, $phone, $phone2, $email, $email2, $url, $url2, $essential, $notes)
+ function Contact($cid, $name, $co, $address, $city, $country, $phone, $phone2, $email, $email2, $url, $url2, $essential, $notes)
{
$this->cid = $cid;
$this->name = $name;
+ $this->co = $co;
$this->address = $address;
$this->city = $city;
$this->country = $country;
@@ -126,8 +130,13 @@ class ContactGroup {
public function showshort()
{
+ $ness = 0;
+ foreach($this->contacts as $contact) {
+ if($contact->essential) $ness += 1;
+ }
+
echo " <div class=\"contactgroup\">\n";
- echo " <div class=\"title\"><a href=\"?mode=addressbook&amp;gid=" . $this->gid . "\">" . $this->name . "</a></div>\n";
+ echo " <div class=\"title\"><a href=\"?mode=addressbook&amp;gid=" . $this->gid . "\">" . $this->name . "</a> - ".sizeof($this->contacts)." contacts (". sprintf("%d", sizeof($this->contacts) - $ness)." hidden)</div>\n";
echo " <div class=\"contacts\">\n";
foreach($this->contacts as $contact) {
if($contact->essential) $contact->showshort();
@@ -229,6 +238,7 @@ class Contacts {
foreach ($contacts as $c) {
$contact = new Contact($c->getAttribute('cid'),
$c->getAttribute('name'),
+ $c->getAttribute('co'),
$c->getAttribute('address'),
$c->getAttribute('city'),
$c->getAttribute('country'),