From: tokul Date: Sun, 14 Nov 2004 17:39:30 +0000 (+0000) Subject: removing obsolate global abook comments. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6ad2bbe2b31a6cc3ba8231e798e2a8fe254fdb31;p=squirrelmail.git removing obsolate global abook comments. enhancing list_writeable_backends function git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8374 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/addressbook.php b/functions/addressbook.php index fc3174f4..71441f39 100644 --- a/functions/addressbook.php +++ b/functions/addressbook.php @@ -1,35 +1,17 @@ in main directory) - - If you don't want a global site-wide addressbook, comment these - two lines out. (They are disabled by default.) - - The global addressbook is unmodifiable by anyone. You must actually - use a shell script or whatnot to modify the contents. - - global $data_dir, $address_book_global_filename; - $address_book_global_filename = "$data_dir/global.abook"; - -*/ - global $addrbook_dsn, $addrbook_global_dsn; /** @@ -253,28 +235,40 @@ function address_form($name, $submittext, $values = array()) { } } +/** + * Provides list of writeable backends. + * Works only when address is added ($name='addaddr') + * @param string $name name of form + * @return string html formated backend field (select or hidden) + */ function list_writable_backends($name) { global $color, $abook; if ( $name != 'addaddr' ) { return; } + $writeable_abook = 1; if ( $abook->numbackends > 1 ) { - $ret = '"; - return html_tag( 'tr', - html_tag( 'td', _("Add to:"),'right', $color[4] ) . - html_tag( 'td', $ret, 'left', $color[4] )) . "\n"; - } else { - return html_tag( 'tr', - html_tag( 'td', - addHidden('backend', '1'), - 'center', $color[4], 'colspan="2"')) . "\n"; + if (count($writeable_abooks)>1) { + // we have more than one writeable backend + $ret=addSelect('backend',$writeable_abooks,null,true); + return html_tag( 'tr', + html_tag( 'td', _("Add to:"),'right', $color[4] ) . + html_tag( 'td', $ret, 'left', $color[4] )) . "\n"; + } } + // Only one backend exists or is writeable. + return html_tag( 'tr', + html_tag( 'td', + addHidden('backend', $writeable_abook), + 'center', $color[4], 'colspan="2"')) . "\n"; } /**