Addressbook fix(es)
Marcus I. Ryan
marcus@riboflavin.net
Tue, 12 Mar 2002 11:05:31 -0600
I have two fixes:
(1) Bad logic in changeDisplay (add a .value to the listDisplay.options...)
diff -ru horde.orig/imp/templates/contacts/javascript.inc
horde/imp/templates/contacts/javascript.inc
--- horde.orig/imp/templates/contacts/javascript.inc Wed Mar 6
05:53:20 2002
+++ horde/imp/templates/contacts/javascript.inc Tue Mar 12 10:19:07 2002
@@ -6,7 +6,7 @@
function changeDisplay() {
var listDisplay = window.document.contacts.display;
- if (listDisplay.options[listDisplay.selectexIndex] != display) {
+ if (listDisplay.options[listDisplay.selectedIndex].value != display) {
display = listDisplay.options[listDisplay.selectedIndex].value;
s = window.document.contacts.search_results;
(2) Update contacts list to use IMP search_fields preference for the
current source if it's defined. Note: quick patch - you might want to
double-check logic and style.
diff -ru horde.orig/imp/contacts.php horde/imp/contacts.php
--- horde.orig/imp/contacts.php Tue Mar 5 23:23:48 2002
+++ horde/imp/contacts.php Tue Mar 12 10:46:46 2002
@@ -47,9 +47,21 @@
/* Get the search as submitted (defaults to '' which should list
everyone) */
$search = Horde::getFormData('search');
-$results = $registry->call('contacts/search',
- array('addresses' => array($search),
- 'addressbooks' => array($source)));
+$apiargs = array();
+$apiargs['addresses'] = array($search);
+$apiargs['addressbooks'] = array($source);
+$apiargs['fields'] = array();
+
+if ($search_fields_pref = $prefs->getValue('search_fields')) {
+ foreach (explode("\n", $search_fields_pref) as $s) {
+ $s = trim($s);
+ $s = explode("\t", $s);
+ if (count($s) == 0 || empty($s[0]) || $s[0] != $source) continue;
+ $apiargs['fields'][array_shift($s)] = $s;
+ }
+}
+
+$results = $registry->call('contacts/search', $apiargs);
--
Marcus I. Ryan, marcus@riboflavin.net
-----------------------------------------------------------------------
"Love is a snowmobile racing across the tundra and then suddenly it
flips over, pinning you underneath. At night, the ice weasels come."
-- Matt Groening
-----------------------------------------------------------------------