sqgetGlobalVar('backend', $backend, SQ_POST);
sqgetGlobalVar('doedit', $doedit, SQ_POST);
+/* Get sorting order */
+$abook_sort_order = get_abook_sort();
+
/**
* Make an input field
* @param string $label
* Add new address *
**************************************************/
if (isset($addaddr)) {
- foreach( $addaddr as $k => $adr ) {
- $addaddr[$k] = strip_tags( $adr );
+ if (isset($backend)) {
+ $r = $abook->add($addaddr, $backend);
+ } else {
+ $r = $abook->add($addaddr, $abook->localbackend);
}
- if (isset($backend)) {
- $r = $abook->add($addaddr, $backend);
- } else {
- $r = $abook->add($addaddr, $abook->localbackend);
- }
/* Handle error messages */
if (!$r) {
html_tag( 'tr', "\n" .
html_tag( 'th', ' ', '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" .
+ show_abook_sort_button($abook_sort_order, _("sort by nickname"), 0, 1)
+ , '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" .
+ show_abook_sort_button($abook_sort_order, _("sort by name"), 2, 3)
+ , '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" .
+ show_abook_sort_button($abook_sort_order, _("sort by email"), 4, 5)
+ , '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",
+ show_abook_sort_button($abook_sort_order, _("sort by info"), 6, 7)
+ , 'left', '', 'width="1%"' ) . "\n",
'', $color[9] ) . "\n";
}
/* Check if this user is selected */
$selected = in_array($row['backend'] . ':' . $row['nickname'], $defselected);
- /* Print one row */
- $tr_bgcolor = '';
- if ($line % 2) { $tr_bgcolor = $color[0]; }
+ /* Print one row, with alternating color */
+ if ($line % 2) {
+ $tr_bgcolor = $color[12];
+ } else {
+ $tr_bgcolor = $color[4];
+ }
if ($squirrelmail_language == 'ja_JP')
{
- echo html_tag( 'tr', '', '', $tr_bgcolor) .
- html_tag( 'td',
+ echo html_tag( 'tr', '', '', $tr_bgcolor);
+ if ($abook->backends[$row['backend']]->writeable) {
+ echo html_tag( 'td',
'<small>' .
addCheckBox('sel[]', $selected, $row['backend'].':'.$row['nickname']).
'</small>' ,
- 'center', '', 'valign="top" width="1%"' ) .
- html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ 'center', '', 'valign="top" width="1%"' );
+ } else {
+ echo html_tag( 'td',
+ ' ' ,
+ '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' ) . ' ';
} else {
- echo html_tag( 'tr', '', '', $tr_bgcolor) .
- html_tag( 'td',
+ echo html_tag( 'tr', '', '', $tr_bgcolor);
+ if ($abook->backends[$row['backend']]->writeable) {
+ echo html_tag( 'td',
'<small>' .
'<input type=checkbox ' . $selected . ' name="sel[]" value="' .
$row['backend'] . ':' . $row['nickname'] . '" /></small>' ,
- 'center', '', 'valign="top" width="1%"' ) .
- html_tag( 'td', ' ' . $row['nickname'] . ' ', 'left', '', 'valign="top" width="1%" nowrap' ) .
+ 'center', '', 'valign="top" width="1%"' );
+ } else {
+ echo html_tag( 'td',
+ ' ' ,
+ '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' ) . ' ';
}
do_hook('addressbook_bottom');
?>
-</body></html>
\ No newline at end of file
+</body></html>