Merge branch 'master' into uat live-2013-06-25 uat-2013-06-25
authorIain Patterson <me@iain.cx>
Tue, 25 Jun 2013 10:32:27 +0000 (06:32 -0400)
committerIain Patterson <me@iain.cx>
Tue, 25 Jun 2013 10:32:27 +0000 (06:32 -0400)
lib/contact.php
lib/header.php
www/.htaccess
www/login.php [new symlink]
www/style.css

index 25aab58..b680982 100644 (file)
     }
     else echo "none";
     echo "</p>\n";
+
+    $address_ids = array();
+    $q = new AddressQuery;
+    $addresses = $q->filterByLine("%$search%")->find();
+    foreach ($addresses as $address) $address_ids[] = $address->getId();
+    $q = new AddressQuery;
+    $addresses = $q->filterByPostcode("%$search%")->find();
+    foreach ($addresses as $address) $address_ids[] = $address->getId();
+
+    $q = new ContactQuery;
+    $contacts = $q->filterByAddressId($address_ids)->find();
+    echo "<p>Contacts in address '" . htmlspecialchars($search) . "':";
+    if (count($contacts)) {
+      foreach ($contacts as $contact) show_contact_summary($contact);
+    }
+    else echo "none";
+    echo "</p>\n";
   }
 
   function show_city_contacts($offset, $per_page, $city_name, $city_id = null) {
       }
     }
     else if ($parameters[0] == "search") {
-      search_contacts(0, 10, $parameters[1]);
+      search_contacts(0, 10, urldecode($parameters[1]));
     }
   }
   list($name, $id, $args) = parse_parameters($parameters);
index 8f9624a..75cd167 100644 (file)
@@ -5,7 +5,7 @@
 <body>
 
 <p id="header">
-<strong> <?php if ($username) echo "<em>$username</em>@"; echo "$charity"; ?></strong>
+<?php if ($username) { ?>
 <a href="/city">Cities</a>
 /
 <a href="/area">Areas</a>
 <a href="/hub">Hubs</a>
 /
 <a href="/donation">Donations</a>
+
+<strong><em><?php echo $username; ?></em>@<?php echo $charity; ?></strong>
+<a href="/logout" class="smaller">logout</a>
+<?php } else echo "<strong>$charity</strong>"; ?>
 </p>
 
 <div id="main">
index cab738c..e56e28a 100644 (file)
@@ -1,4 +1,5 @@
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !/style\.css$
 RewriteCond %{REQUEST_FILENAME} !/logo\.png$
+RewriteCond %{REQUEST_FILENAME} !/login\.php$
 RewriteRule ^(.+) index.php [L]
diff --git a/www/login.php b/www/login.php
new file mode 120000 (symlink)
index 0000000..0012f7d
--- /dev/null
@@ -0,0 +1 @@
+index.php
\ No newline at end of file
index 932a1e9..203ea50 100644 (file)
@@ -91,3 +91,7 @@ a.delete {
 .small {
   font-size: 75%;
 }
+
+.smaller {
+  font-size: 25%;
+}