[turba] [patch] Honoring default addressbook in Turba

Etienne Goyer etienne.goyer@linuxquebec.com
Mon Nov 4 21:53:24 2002


---------------------- multipart/mixed attachment
Hi,

This is a small patch I wrote to make Turba honor a default addressbook.
This make addobject.php, browse.php, search.php and advanced.php have a
specific source in the AddressBook drop-down menu as 'selected'.  I
choose to use the one defined in IMP as add_source because this is the
one that imp/contacts.php show by default and it make the UI more
consistent.  However, it may be better to move this prefs in Turba (let's
say 'default_source') as that would make a lot more sense.  

Let me know what you think, I would be willing to make
corrections/adjustements as necessary.

Thanks for considering my patch.

-- 
Etienne Goyer                    Linux Québec Technologies Inc.
http://www.LinuxQuebec.com       etienne.goyer@linuxquebec.com
PGP Pub Key: http://www.LinuxQuebec.com/pubkeys/eg.key 
Fingerprint: F569 0394 098A FC70 B572  5D20 3129 3D86 8FD5 C853 

---------------------- multipart/mixed attachment
--- addobject.php.orig	2002-11-04 14:23:27.000000000 -0500
+++ addobject.php	2002-11-04 14:28:24.000000000 -0500
@@ -27,7 +27,12 @@
     $count = 0;
     foreach ($cfgSources as $key => $curSource) {
         if (empty($curSource['readonly']) || (isset($curSource['admin']) && in_array(Auth::getAuth(), $curSource['admin']))) {
-            $options .= '<option value="' . $key . '">' . $curSource['title'] . '</option>';
+            if (strcmp($key, $prefs->getValue('add_source')) == 0) {
+                $selected = ' selected="selected"';
+            } else {
+                $selected = '';
+            }
+            $options .= '<option value="' . $key . '"'. $selected . '>' . $curSource['title'] . '</option>';
             $source = $key;
             $count++;
         }

---------------------- multipart/mixed attachment
--- advanced.php.orig	2002-11-04 13:42:20.000000000 -0500
+++ advanced.php	2002-11-04 13:43:20.000000000 -0500
@@ -39,7 +39,7 @@
 $source = Horde::getFormData('source');
 if (!isset($source) && isset($cfgSources) && is_array($cfgSources) && count($cfgSources) > 0) {
     reset($cfgSources);
-    $source = key($cfgSources);
+    $source = $prefs->getValue('add_source');
 }
 
 /* Build the directory sources select widget. */

---------------------- multipart/mixed attachment
--- browse.php.orig	2002-11-04 14:11:41.000000000 -0500
+++ browse.php	2002-11-04 14:16:21.000000000 -0500
@@ -40,7 +40,12 @@
     $source_count = 0;
     foreach ($cfgSources as $key => $curSource) {
         if (!empty($curSource['export'])) {
-            $source_options .= '<option value="' . $key . '">' . $curSource['title'] . '</option>';
+            if(strcmp($key, $prefs->getValue('add_source')) == 0) {
+                $selected = ' selected="selected"';
+            } else {
+                $selected = '';
+            }
+            $source_options .= '<option value="' . $key . '"' . $selected . '>' . $curSource['title'] . '</option>';
             $source = $key;
             $source_count++;
         }

---------------------- multipart/mixed attachment
--- search.php.orig	2002-11-04 12:47:58.000000000 -0500
+++ search.php	2002-11-04 13:05:12.000000000 -0500
@@ -37,7 +37,7 @@
 $source = Horde::getFormData('source');
 if (!isset($source) && isset($cfgSources) && is_array($cfgSources) && count($cfgSources) > 0) {
     reset($cfgSources);
-    $source = key($cfgSources);
+    $source = $prefs->getValue('add_source');
 }
 
 $criteria = Horde::getFormData('criteria');

---------------------- multipart/mixed attachment--


More information about the turba mailing list