[dev] [framework-patch] vcard display: hide multiple addressbooks
Francois Marier
francois at nit.ca
Fri Jul 30 11:42:18 PDT 2004
This patch for the framework hides the addressbook selector in the
vcard display page when there is only one addressbook available.
Francois
-------------- next part --------------
diff -rpuN -X ../ignorelist ../build/framework/MIME/MIME/Viewer/vcard.php framework/MIME/MIME/Viewer/vcard.php
--- ../build/framework/MIME/MIME/Viewer/vcard.php Wed Jun 9 15:00:24 2004
+++ framework/MIME/MIME/Viewer/vcard.php Fri Jul 30 14:05:40 2004
@@ -69,12 +69,21 @@ class MIME_Viewer_vcard extends MIME_Vie
foreach ($_GET as $key => $val) {
$html .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
}
- $html .= '<input type="submit" class="button" name="import" value="' . _("Add to my address book:") . '" />';
- $html .= '<select name="source">';
- foreach ($registry->call('contacts/sources', array(true)) as $key => $label) {
- $selected = ($key == $prefs->getValue('add_source')) ? ' selected="selected"' : '';
- $html .= '<option value="' . htmlspecialchars($key) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>';
+
+ $sources = $registry->call('contacts/sources', array(true));
+ if (count($sources) > 1) {
+ $html .= '<input type="submit" class="button" name="import" value="' . _("Add to address book:") . '" />';
+ $html .= '<select name="source">';
+ foreach ($sources as $key => $label) {
+ $selected = ($key == $prefs->getValue('add_source')) ? ' selected="selected"' : '';
+ $html .= '<option value="' . htmlspecialchars($key) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>';
+ }
+ } else {
+ $html .= '<input type="submit" class="button" name="import" value="' . _("Add to my address book") . '" />';
+ $source = array_keys($sources);
+ $html .= '<input type="hidden" name="source" value="' . htmlspecialchars($source[0]) . '" />';
}
+
$html .= '</form></td></tr><tr><td> </td></tr>';
}
More information about the dev
mailing list