From ac987a56a67a53a01b7db77a02fdd9c9241b4549 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Mon, 24 Jun 2002 10:28:24 +0000 Subject: [PATCH] r2l by Yoav git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2995 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/addrbook_search.php | 101 +++++++++++--------- src/addressbook.php | 207 +++++++++++++++++++++++----------------- 2 files changed, 175 insertions(+), 133 deletions(-) diff --git a/src/addrbook_search.php b/src/addrbook_search.php index 8051122a..0f9b4bac 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -17,6 +17,7 @@ require_once('../src/validate.php'); require_once('../functions/strings.php'); +require_once('../functions/html.php'); /* Function to include JavaScript code */ function insert_javascript() { @@ -93,40 +94,44 @@ function display_result($res, $includesource = true) { insert_javascript(); $line = 0; - echo '' . - '\n"; + echo "\n"; while (list($undef, $row) = each($res)) { - echo '\n"; + echo "\n"; $line++; } - echo '
 ' . - ' ' . _("Name") . - ' ' . _("E-mail") . - ' ' . _("Info"); + echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) . + html_tag( 'tr', '', '', $color[9] ) . + html_tag( 'th', ' ', 'left' ) . + html_tag( 'th', ' ' . _("Name"), 'left' ) . + html_tag( 'th', ' ' . _("E-mail"), 'left' ) . + html_tag( 'th', ' ' . _("Info"), 'left' ); if ($includesource) { - echo ' ' . _("Source"); + echo html_tag( 'th', ' ' . _("Source"), 'left', 'width="10%"' ); } - echo "
' . + $tr_bgcolor = ''; + if ($line % 2) { $tr_bgcolor = $color[0]; } + echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) . + html_tag( 'td', 'To | " . 'Cc | " . 'Bcc" . - ' ' . - $row['name'] . '' . + "'" . $row['email'] . "');\">Bcc", + 'center', '', 'valign="top" width="5%" nowrap' ) . + html_tag( 'td', ' ' . $row['name'], 'left', '', 'valign="top" nowrap' ) . + html_tag( 'td', ' ' . '" . $row['email'] . '' . - '' . $row['label']; + "'" . $row['email'] . "');\">" . $row['email'] . '' + , 'left', '', 'valign="top"' ) . + html_tag( 'td', $row['label'], 'left', '', 'valign="top" nowrap' ); if ($includesource) { - echo ' ' . $row['source']; + echo html_tag( 'td', ' ' . $row['source'], 'left', '', 'valign="top" nowrap' ); } - echo "
'; + echo ''; } /* ================= End of functions ================= */ @@ -156,9 +161,10 @@ if ($show == 'form' && !isset($listall)) { /* Empty search */ if (empty($query) && empty($show) && empty($listall)) { - echo '


' . - _("No persons matching your search was found") . - "

\n\n", + echo html_tag( 'p', '
' . + _("No persons matching your search was found"), + 'center' ) . + "\n\n", exit; } @@ -169,11 +175,12 @@ $abook = addressbook_init(); if ($show == 'form' && empty($listall)) { echo '
' . "\n" . - '' . - '
' . "\n" . - ' ' . _("Search for") . "\n" . - ' \n"; + html_tag( 'table', '', '', '', 'border="0" width="100%" height="100%"' ) . + html_tag( 'tr' ) . + html_tag( 'td', ' ' . _("Search for") . "\n", 'left', '', 'nowrap valign="middle" width="10%"' ) . + html_tag( 'td', '', 'left', '', '' ) . + '\n"; /* List all backends to allow the user to choose where to search */ if ($abook->numbackends > 1) { @@ -188,13 +195,18 @@ if ($show == 'form' && empty($listall)) { echo '' . "\n"; } - echo '
'. - '' . - ' | ' . "\n" . - ' | ' . "\n" . - '
' . "\n"; + echo '' . + html_tag( 'tr', + html_tag( 'td', '', 'left' ) . + html_tag( 'td', + '' . + ' | ' . "\n" . + ' | ' . "\n" , + 'left' ) + ) . + '' . "\n"; } else { /* Show personal addressbook */ @@ -210,10 +222,10 @@ if ($show == 'form' && empty($listall)) { usort($res,'alistcmp'); display_result($res, false); } else { - echo '

' . - sprintf(_("Unable to list addresses from %s"), - $abook->backends[$backend]->sname) . - '

' . "\n"; + echo html_tag( 'p', '' . + sprintf(_("Unable to list addresses from %s"), + $abook->backends[$backend]->sname) . '' , + 'center' ) . "\n"; } } else { $res = $abook->list_addr(); @@ -236,16 +248,19 @@ if ($show == 'form' && empty($listall)) { } if (!is_array($res)) { - echo '


' . - _("Your search failed with the following error(s)") . - ':
' . $abook->error . "

\n\n"; + echo html_tag( 'p', '
' . + _("Your search failed with the following error(s)") . + ':
' . $abook->error . "
\n" , + 'center' ) . + "\n\n"; exit; } if (sizeof($res) == 0) { - echo '


' . - _("No persons matching your search was found") . - ".

\n\n"; + echo html_tag( 'p', '
' . + _("No persons matching your search was found") . "\n" , + 'center' ) . + "\n\n"; exit; } diff --git a/src/addressbook.php b/src/addressbook.php index 2284886c..f81ae4ef 100644 --- a/src/addressbook.php +++ b/src/addressbook.php @@ -16,37 +16,40 @@ require_once('../functions/array.php'); require_once('../functions/display_messages.php'); require_once('../functions/addressbook.php'); require_once('../functions/strings.php'); +require_once('../functions/html.php'); /* Make an input field */ function adressbook_inp_field($label, $field, $name, $size, $values, $add) { global $color; - echo '' . - $label . ':' . - '' . - '' . $add . '' . "\n"; + $td_str .= '">' . $add . ''; + return html_tag( 'tr' , + html_tag( 'td', $label . ':', 'right', $color[4]) . + html_tag( 'td', $td_str, 'left', $color[4]) + ) + . "\n"; } /* Output form to add and modify address data */ function address_form($name, $submittext, $values = array()) { global $color; - - echo '' ."\n"; - - adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, - '' . _("Must be unique") . ''); - adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, ''); - adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, ''); - adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, ''); - adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, ''); - - echo '' . - "\n
' . "\n" . - '
\n"; + echo html_tag( 'table', + adressbook_inp_field(_("Nickname"), 'nickname', $name, 15, $values, + '' . _("Must be unique") . '') . + adressbook_inp_field(_("E-mail address"), 'email', $name, 45, $values, '') . + adressbook_inp_field(_("First name"), 'firstname', $name, 45, $values, '') . + adressbook_inp_field(_("Last name"), 'lastname', $name, 45, $values, '') . + adressbook_inp_field(_("Additional info"), 'label', $name, 45, $values, '') . + html_tag( 'tr', + html_tag( 'td', + '', + 'center', $color[4], 'colspan="2"') + ) + , 'center', '', 'border="0" cellpadding="1" cols="2" width="90%"') ."\n"; } @@ -162,11 +165,13 @@ if($REQUEST_METHOD == 'POST') { /* Display the "new address" form */ echo '
' . "\n" . - '' . "\n" . - '\n
' . "\n" . '' . - _("Update address") . - "\n
\n"; + html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', + "\n". '' . _("Update address") . '' ."\n", + 'center', $color[0] ) + ), + 'center', '', 'width="100%" cols="1"' ) . address_form("editaddr", _("Update address"), $olddata); echo '\n" . @@ -185,20 +190,25 @@ if($REQUEST_METHOD == 'POST') { /* Handle error messages */ if (!$r) { /* Display error */ - echo '' . - "\n" . '\n
' . "\n" . - '
' . _("ERROR") . ": " . $abook->error . - '' . "\n
\n"; + echo html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', + "\n". '
' . _("ERROR") . ': ' . $abook->error . '' ."\n", + 'center' ) + ), + 'center', '', 'width="100%" cols="1"' ); /* Display the "new address" form again */ echo '' . "\n" . - '' . - "\n" . '\n
' . "\n" . '' . - _("Update address") . - "\n
\n"; + html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', + "\n". '
' . _("Update address") . '' ."\n", + 'center', $color[0] ) + ), + 'center', '', 'width="100%" cols="1"' ) . address_form("editaddr", _("Update address"), $newdata); echo '\n" . @@ -234,10 +244,14 @@ if($REQUEST_METHOD == 'POST') { /* Display error messages */ if (!empty($formerror)) { - echo '' . "\n" . - '\n
' . "\n" . '
' . - '' . _("ERROR") . ': ' . $formerror . - '' . "\n
\n"; + echo html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', + "\n". '
' . _("ERROR") . ': ' . $formerror . '' ."\n", + 'center' ) + ), + 'center', '', 'width="100%" cols="1"' ); } @@ -254,8 +268,7 @@ if ($showaddrlist) { $prevbackend = -1; $headerprinted = false; - echo '

' . - _("Add address") . "

\n"; + echo html_tag( 'p', '' . _("Add address") . '', 'center' ) . "\n"; /* List addresses */ if (count($alist) > 0) { @@ -265,26 +278,34 @@ if ($showaddrlist) { /* New table header for each backend */ if($prevbackend != $row['backend']) { if($prevbackend < 0) { - echo '' . "\n" . - '\n" . - '\n\n" . - '' . - ' 
' . "\n"; + echo html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', + '\n" . + '\n", + 'center', '', 'colspan="5"' ) + ) . + html_tag( 'tr', + html_tag( 'td', ' 
', 'center', '', 'colspan="5"' ) + ) , + 'center' ); } - echo '' . "\n" . - '\n
' . "\n" . - '' . $row['source'] . - "\n
\n" . - '' . - '\n"; + echo html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', "\n" . '' . $row['source'] . '' . "\n", 'center', $color[0] ) + ) , + 'center', '', 'width="95%" cols="1"' ) ."\n" + . html_tag( 'table', '', 'center', '', 'cols="5" border="0" cellpadding="1" cellspacing="0" width="90%"' ) . + html_tag( 'tr', "\n" . + html_tag( 'th', ' ', '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%"' ) , + '', $color[9] ) . "\n"; $line = 0; $headerprinted = true; @@ -300,49 +321,55 @@ if ($showaddrlist) { } /* Print one row */ - echo '' . - '' . - '', - ''."\n", - '' . - "\n"; + $tr_bgcolor = ''; + if ($line % 2) { $tr_bgcolor = $color[0]; } + echo html_tag( 'tr', '') . + html_tag( 'td', + '' . + '' , + 'center', '', 'valign="top" width="1%"' ) . + 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' ) . ' '; + if ($compose_new_win == '1') { + echo ''; + } + else { + echo ''; + } + echo $row['email'] . ' '."\n". + html_tag( 'td', ' ' . $row['label'] . ' ', 'left', '', 'valign="top" width="1%"' ) . + "\n"; $line++; } /* End of list. Close table. */ if ($headerprinted) { - echo '
 ' . - _("Nickname") . '' . _("Name") . - '' . _("E-mail") . - '' . _("Info") . "
' . - ' ' . $row['nickname'] . - '  ' . $row['name'] . - '  '; - if ($compose_new_win == '1') { - echo ''; - } - else { - echo ''; - } - echo $row['email'] . '  ' . $row['label'] . ' 
' . "\n" . - '\n" . - '\n" . '
'; + echo html_tag( 'tr', + html_tag( 'td', + '\n" . + '\n", + 'center', '', 'colspan="5"' ) + ); } - echo '
'; + echo ''; } } /* end of addresslist */ /* Display the "new address" form */ echo '' . "\n" . - '
' . "\n" . - '' . "\n" . - '\n" . - "
' . "\n" . '', - sprintf(_("Add to %s"), $abook->localbackendname) . - "\n
\n"; + '' . "\n" . + html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', "\n". '' . sprintf(_("Add to %s"), $abook->localbackendname) . '' . "\n", + 'center', $color[0] + ) + ) + , 'center', '', 'width="100%" cols="1"' ) ."\n"; address_form('addaddr', _("Add address"), $defdata); echo '
'; -- 2.25.1