was->were fix
[squirrelmail.git] / src / addressbook.php
index c1f230759ccf2e764e1d341a030843d1600841c4..04adee2c3387ddfc58015fc58c5e48df8dd31797 100644 (file)
@@ -8,11 +8,14 @@
  *
  * Manage personal address book.
  *
- * $Id$
+ * @version $Id$
  * @package squirrelmail
  */
 
-/** Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
 define('SM_PATH','../');
 
 /** SquirrelMail required files. */
@@ -351,7 +354,7 @@ if ($showaddrlist) {
 
     /* List addresses */
     if (count($alist) > 0) {
-        echo '<FORM ACTION="' . $form_url . '" METHOD="POST">' . "\n";
+        echo '<form action="' . $form_url . '" method="post">' . "\n";
         while(list($undef,$row) = each($alist)) {
     
             /* New table header for each backend */
@@ -360,36 +363,61 @@ if ($showaddrlist) {
                     echo html_tag( 'table',
                                     html_tag( 'tr',
                                           html_tag( 'td',
-                                                     '<INPUT TYPE=submit NAME=editaddr VALUE="' . 
-                                                     _("Edit selected") . "\">\n" .
-                                                     '<INPUT TYPE=submit NAME=deladdr VALUE="' .
-                                                     _("Delete selected") . "\">\n",
+                                                     '<input type=submit name=editaddr value="' . 
+                                                     _("Edit selected") . "\" />\n" .
+                                                     '<input type=submit name=deladdr value="' .
+                                                     _("Delete selected") . "\" />\n",
                                           'center', '', 'colspan="5"' )
                                     ) .
                                     html_tag( 'tr',
                                           html_tag( 'td', '&nbsp;<br>', 'center', '', 'colspan="5"' )
                                     ) ,
                              'center' );
-                }
-    
-                echo html_tag( 'table',
-                                html_tag( 'tr',
-                                    html_tag( 'td', "\n" . '<strong>' . $row['source'] . '</strong>' . "\n", 'center', $color[0] )
-                                ) ,
-                        'center', '', 'width="95%"' ) ."\n"
-                . html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cellspacing="0" width="90%"' ) .
-                      html_tag( 'tr', "\n" .
-                          html_tag( 'th', '&nbsp;', 'left', '', 'width="1%"' ) .
-                          html_tag( 'th', _("Nickname"), 'left', '', 'width="1%"' ) .
-                          html_tag( 'th', _("Name"), 'left', '', 'width="1%"' ) .
-                          html_tag( 'th', _("E-mail"), 'left', '', 'width="1%"' ) .
-                          html_tag( 'th', _("Info"), 'left', '', 'width="1%"' ) ,
+                   echo "\n<!-- start of address book table -->\n" .
+                         html_tag( 'table', '', 'center', '', 'border="0" cellpadding="1" cellspacing="0" width="90%"' ) .
+                         html_tag( 'tr', "\n" .
+                            html_tag( 'th', '&nbsp;', 'left', '', 'width="1%"' ) . "\n" .
+                            html_tag( 'th', _("Nickname") .
+                                         " <a href=\"$form_url?abook_sort=nickname\">".
+                                         "<img src=\"../images/sort_none.png\" border=\"0\" width=\"12\" height=\"10\" alt=\"sort by nickname\" title=\"" .
+                                         _("Click here to change the sorting of the address list") . 
+                                         "\" /></a>", 'left', '', 'width="1%"' ) . "\n" .
+                            html_tag( 'th', _("Name") . 
+                                         " <a href=\"$form_url?abook_sort=name\">" .
+                                         "<img src=\"../images/sort_none.png\" border=\"0\" width=\"12\" height=\"10\" " .
+                                         "alt=\"sort by name\" title=\"" .
+                                         _("Click here to change the sorting of the address list") . 
+                                         "\" /></a>", 'left', '', 'width="1%"' ) . "\n" .
+                            html_tag( 'th', _("E-mail") . 
+                                         " <a href=\"$form_url?abook_sort=email\">" .
+                                         "<img src=\"../images/sort_none.png\" border=\"0\" width=\"12\" height=\"10\" " .
+                                         "alt=\"sort by email\" title=\"" .
+                                         _("Click here to change the sorting of the address list") . 
+                                         "\" /></a>", 'left', '', 'width="1%"' ) . "\n" .
+                            html_tag( 'th', _("Info") .
+                                         " <a href=\"$form_url?abook_sort=label\">" .
+                                         "<img src=\"../images/sort_none.png\" border=\"0\" width=\"12\" height=\"10\" " .
+                                         "alt=\"sort by info\" title=\"" .
+                                         _("Click here to change the sorting of the address list") . 
+                                         "\" /></a>", 'left', '', 'width="1%"' ) . "\n",
                       '', $color[9] ) . "\n";
-    
+                }
+
+               // Separate different backends with <hr />
+                if($prevbackend > 0) {
+                    echo  html_tag( 'tr',
+                        html_tag( 'td', "<hr />", 'center', '' ,'colspan="5"' )
+                      );
+               }
+               // Print backend name
+                echo  html_tag( 'tr',
+                        html_tag( 'td', "\n" . '<strong>' . $row['source'] . '</strong>' . "\n", 'center', $color[0] ,'colspan="5"' )
+                      );
+
                 $line = 0;
                 $headerprinted = true;
             } /* End of header */
-    
+
             $prevbackend = $row['backend'];
     
             /* Check if this user is selected */
@@ -402,9 +430,9 @@ if ($showaddrlist) {
                 {
             echo html_tag( 'tr', '', '', $tr_bgcolor) .
                 html_tag( 'td',
-                          '<SMALL>' .
+                          '<small>' .
                          addCheckBox('sel[]', $selected, $row['backend'].':'.$row['nickname']).
-                          '</SMALL>' ,
+                          '</small>' ,
                           'center', '', 'valign="top" width="1%"' ) .
                 html_tag( 'td', '&nbsp;' . $row['nickname'] . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap' ) . 
                 html_tag( 'td', '&nbsp;' . $row['lastname'] . ' ' . $row['firstname'] . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap' ) .
@@ -412,9 +440,9 @@ if ($showaddrlist) {
                 } else {
             echo html_tag( 'tr', '', '', $tr_bgcolor) .
             html_tag( 'td',
-                '<SMALL>' .
-                '<INPUT TYPE=checkbox ' . $selected . ' NAME="sel[]" VALUE="' .
-                $row['backend'] . ':' . $row['nickname'] . '"></SMALL>' ,
+                '<small>' .
+                '<input type=checkbox ' . $selected . ' name="sel[]" value="' .
+                $row['backend'] . ':' . $row['nickname'] . '" /></small>' ,
                 'center', '', 'valign="top" width="1%"' ) .
             html_tag( 'td', '&nbsp;' . $row['nickname'] . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap' ) .
             html_tag( 'td', '&nbsp;' . $row['name'] . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap' ) .
@@ -428,26 +456,30 @@ if ($showaddrlist) {
             "</tr>\n";
             $line++;
         }
-    
-        /* End of list. Close table. */
+       echo "</table>" .
+           "\n<!-- end of address book table -->\n";
+
+        /* End of list. Add edit/delete select buttons */
         if ($headerprinted) {
-            echo html_tag( 'tr',
+            echo html_tag( 'table',
+                   html_tag( 'tr',
                         html_tag( 'td',
-                                '<INPUT TYPE="submit" NAME="editaddr" VALUE="' . _("Edit selected") .
-                                "\">\n" .
-                                '<INPUT TYPE="submit" NAME="deladdr" VALUE="' . _("Delete selected") .
-                                "\">\n",
+                                '<input type="submit" name="editaddr" value="' . _("Edit selected") .
+                                "\" />\n" .
+                                '<input type="submit" name="deladdr" value="' . _("Delete selected") .
+                                "\" />\n",
                          'center', '', 'colspan="5"' )
-                    );
+                    ),
+               'center' );
         }
-        echo '</table></FORM>';
+        echo "</form>\n";
     }
 } /* end of addresslist */
 
 
 /* Display the "new address" form */
 echo '<a name="AddAddress"></a>' . "\n" .
-    '<FORM ACTION="' . $form_url . '" NAME=f_add METHOD="POST">' . "\n" .
+    '<form action="' . $form_url . '" name="f_add" method="post">' . "\n" .
     html_tag( 'table',  
         html_tag( 'tr',
             html_tag( 'td', "\n". '<strong>' . _("Add to address book") . '</strong>' . "\n",
@@ -456,10 +488,10 @@ echo '<a name="AddAddress"></a>' . "\n" .
         )
     , 'center', '', 'width="100%"' ) ."\n";
 address_form('addaddr', _("Add address"), $defdata);
-echo '</FORM>';
+echo "</form>\n";
 
 /* Add hook for anything that wants on the bottom */
 do_hook('addressbook_bottom');
 ?>
 
-</BODY></HTML>
+</body></html>
\ No newline at end of file