use same width as other tables on src/addressbook.php
[squirrelmail.git] / src / addressbook.php
index 4a0706f0e134b6fdb30a7826adda687d9e862438..de712e846d9665d98e4a0a612ac4c0dce4b2584c 100644 (file)
@@ -3,13 +3,14 @@
 /**
  * addressbook.php
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Manage personal address book.
  *
  * @version $Id$
  * @package squirrelmail
+ * @subpackage addressbook
  */
 
 /**
@@ -44,9 +45,15 @@ sqgetGlobalVar('doedit',    $doedit,    SQ_POST);
 /* Get sorting order */
 $abook_sort_order = get_abook_sort();
 
-/* Open addressbook, with error messages on but without LDAP (the *
- * second "true"). Don't need LDAP here anyway                    */
-$abook = addressbook_init(true, true);
+/* Create page header before addressbook_init in order to  display error messages correctly. */
+displayPageHeader($color, 'None');
+
+/* Open addressbook with error messages on.
+ remote backends (LDAP) are enabled because they can be used. (list_addr function)
+*/
+$abook = addressbook_init(true, false);
+
+// FIXME: do we have to stop use of address book, when localbackend is not present.
 if($abook->localbackend == 0) {
     plain_error_message(
             _("No personal address book is defined. Contact administrator."),
@@ -54,7 +61,6 @@ if($abook->localbackend == 0) {
     exit();
 }
 
-displayPageHeader($color, 'None');
 
 $defdata   = array();
 $formerror = '';
@@ -63,7 +69,6 @@ $showaddrlist = true;
 $defselected  = array();
 $form_url = 'addressbook.php';
 
-
 /* Handle user's actions */
 if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'POST') {
 
@@ -156,7 +161,7 @@ if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'P
                         $olddata = $abook->lookup($enick, $ebackend);
 
                         /* Display the "new address" form */
-                       abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$olddata);
+                        abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$olddata);
                         echo addHidden('oldnick', $olddata['nickname']).
                             addHidden('backend', $olddata['backend']).
                             addHidden('doedit', '1').
@@ -182,7 +187,7 @@ if(sqgetGlobalVar('REQUEST_METHOD', $req_method, SQ_SERVER) && $req_method == 'P
                                     'center', '', 'width="100%"' );
 
                             /* Display the "new address" form again */
-                           abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$newdata);
+                            abook_create_form($form_url,'editaddr',_("Update address"),_("Update address"),$newdata);
                             echo addHidden('oldnick', $oldnick).
                                 addHidden('backend', $backend).
                                 addHidden('doedit',  '1').
@@ -267,10 +272,10 @@ if ($showaddrlist) {
                                 html_tag( 'th', _("Nickname") .
                                     show_abook_sort_button($abook_sort_order, _("sort by nickname"), 0, 1),
                                     'left', '', 'width="1%"' ) . "\n" .
-                                html_tag( 'th', _("Name") . 
+                                html_tag( 'th', _("Name") .
                                     show_abook_sort_button($abook_sort_order, _("sort by name"), 2, 3),
                                     'left', '', 'width="1%"' ) . "\n" .
-                                html_tag( 'th', _("E-mail") . 
+                                html_tag( 'th', _("E-mail") .
                                     show_abook_sort_button($abook_sort_order, _("sort by email"), 4, 5),
                                     'left', '', 'width="1%"' ) . "\n" .
                                 html_tag( 'th', _("Info") .
@@ -319,9 +324,9 @@ if ($showaddrlist) {
                             ' ' ,
                             'center', '', 'valign="top" width="1%"' );
                 }
-                echo html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) . 
-                    html_tag( 'td', ' ' . $row['lastname'] . ' ' . $row['firstname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
-                    html_tag( 'td', '', 'left', '', 'valign="top" width="1%" nowrap' ) . ' ';
+                echo html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) .
+                    html_tag( 'td', ' ' . $row['lastname'] . ' ' . $row['firstname'] . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) .
+                    html_tag( 'td', '', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) . ' ';
             } else {
                 echo html_tag( 'tr', '', '', $tr_bgcolor);
                 if ($abook->backends[$row['backend']]->writeable) {
@@ -335,9 +340,9 @@ if ($showaddrlist) {
                             ' ' ,
                             'center', '', 'valign="top" width="1%"' );
                 }
-                echo html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
-                    html_tag( 'td', ' ' . $row['name'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
-                    html_tag( 'td', '', 'left', '', 'valign="top" width="1%" nowrap' ) . ' ';
+                echo html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) .
+                    html_tag( 'td', ' ' . $row['name'] . ' ', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) .
+                    html_tag( 'td', '', 'left', '', 'valign="top" width="1%" style="white-space: nowrap;"' ) . ' ';
             }
             $email = $abook->full_address($row);
             echo makeComposeLink('src/compose.php?send_to='.rawurlencode($email),
@@ -372,6 +377,8 @@ abook_create_form($form_url,'addaddr',_("Add to address book"),_("Add address"),
 echo "</form>\n";
 
 /* Add hook for anything that wants on the bottom */
+echo "<!-- start of addressbook_bottom hook-->\n";
 do_hook('addressbook_bottom');
+echo "\n<!-- end of addressbook_bottom hook-->\n";
 ?>
-</body></html>
+</body></html>
\ No newline at end of file