From: indiri69 Date: Tue, 6 Jul 2004 23:59:58 +0000 (+0000) Subject: Remove the multiple lines of 'No Messages Found' when searching multiple folders X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a73ae1c2bfcd01e8db6ffc16692f3a81b56994aa;p=squirrelmail.git Remove the multiple lines of 'No Messages Found' when searching multiple folders git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7753 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/src/search.php b/src/search.php index c2196472..911ad35f 100644 --- a/src/search.php +++ b/src/search.php @@ -862,58 +862,54 @@ function asearch_print_form_basic($imapConnection, &$boxes, $mailbox_array, $bio function asearch_print_mailbox_msgs($imapConnection, &$aMailbox, $color) { - if (fetchMessageHeaders($imapConnection, $aMailbox)) { - /** - * A mailbox can contain different sets with uid's. Default, for normal - * message list view we use '0' as setindex and for search a different - * setindex. - */ - $iSetIndx = $aMailbox['SETINDEX']; + /** + * A mailbox can contain different sets with uid's. Default, for normal + * message list view we use '0' as setindex and for search a different + * setindex. + */ + $iSetIndx = $aMailbox['SETINDEX']; - $mailbox_display = asearch_get_mailbox_display($aMailbox['NAME']); - $mailbox_title = '' . _("Folder:") . ' '. $mailbox_display . ' '; + $mailbox_display = asearch_get_mailbox_display($aMailbox['NAME']); + $mailbox_title = '' . _("Folder:") . ' '. $mailbox_display . ' '; - /** - * UIDSET contains the array with uid's returned by a search - */ - $cnt = count($aMailbox['UIDSET'][$iSetIndx]); + /** + * UIDSET contains the array with uid's returned by a search + */ + $cnt = count($aMailbox['UIDSET'][$iSetIndx]); - $iLimit = ($aMailbox['SHOWALL'][$iSetIndx]) ? $cnt : $aMailbox['LIMIT']; - $iEnd = ($aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS']) ? - $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $cnt; + $iLimit = ($aMailbox['SHOWALL'][$iSetIndx]) ? $cnt : $aMailbox['LIMIT']; + $iEnd = ($aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS']) ? + $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $cnt; - $paginator_str = get_paginator_str($aMailbox['NAME'], $aMailbox['PAGEOFFSET'], - $cnt, $aMailbox['LIMIT'], $aMailbox['SHOWALL'][$iSetIndx]); + $paginator_str = get_paginator_str($aMailbox['NAME'], $aMailbox['PAGEOFFSET'], + $cnt, $aMailbox['LIMIT'], $aMailbox['SHOWALL'][$iSetIndx]); - $msg_cnt_str = get_msgcnt_str($aMailbox['PAGEOFFSET'], $iEnd,$cnt); + $msg_cnt_str = get_msgcnt_str($aMailbox['PAGEOFFSET'], $iEnd,$cnt); - echo ''; + echo '
'; - echo ''; + echo ''; - echo ''; + echo ''; - echo ''; + echo '
'; - mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $mailbox_title . " $paginator_str"); - echo '
'; + mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $mailbox_title . " $paginator_str"); + echo '
'; - echo ' '; - echo ' '; + echo '
'; + echo '
'; + echo ' '; + echo ' '; - echo '
'; - echo ' '; - echo ' '; - echo '
'; - printHeader($aMailbox); - displayMessageArray($imapConnection, $aMailbox); - echo '
'; - echo '
'; - mail_message_listing_end($cnt, '', $msg_cnt_str); - echo '
'; + echo ' '; + echo '
'; + printHeader($aMailbox); + displayMessageArray($imapConnection, $aMailbox); + echo '
'; + echo '
'; + mail_message_listing_end($cnt, '', $msg_cnt_str); + echo ''; - echo ''; - } else { - echo '
' . html_tag('div', asearch_get_error_display($color, _("No Messages Found")), 'center') . "\n"; - } + echo ''; } /** @@ -1398,6 +1394,7 @@ if (!$search_silent) { do_hook('search_after_form'); if ($submit == $search_button_text) { + $msgsfound = false; echo html_tag('table', '', 'center', $color[9], 'width="100%" cellpadding="1" cellspacing="0" border="0"'); echo html_tag('tr', html_tag('td', asearch_get_title_display($color, _("Search Results")), 'center', $color[5])); echo html_tag('tr', html_tag('td', asearch_get_query_display($color, $mailbox_array, $biop_array, $unop_array, $where_array, $what_array, $exclude_array, $sub_array), 'center', $color[4])); @@ -1450,7 +1447,6 @@ if ($submit == $search_button_text) { $aMailboxPref[MBX_PREF_AUTO_EXPUNGE] = (bool) $auto_expunge; $aMailboxPref[MBX_PREF_INTERNALDATE] = (bool) getPref($data_dir, $username, 'internal_date_sort'); - echo '
'; $aConfig['search'] = $search['search']; $aConfig['charset'] = $search['charset']; $aConfig['setindex'] = 1; // $what $where = 'search' @@ -1464,16 +1460,24 @@ if ($submit == $search_button_text) { handleMessageListForm($imapConnection,$aMailbox); } } - asearch_print_mailbox_msgs($imapConnection, $aMailbox, $color); + if (fetchMessageHeaders($imapConnection, $aMailbox)) { + $msgsfound = true; + echo '
'; + asearch_print_mailbox_msgs($imapConnection, $aMailbox, $color); + flush(); + } /* add the mailbox to the cache */ $mailbox_cache[$aMailbox['NAME']] = $aMailbox; } } + if(!$msgsfound) { + echo '
' . html_tag('div', asearch_get_error_display($color, _("No Messages Found")), 'center') . "\n"; + } } do_hook('search_bottom'); sqimap_logout($imapConnection); echo ''; sqsession_register($mailbox_cache,'mailbox_cache'); -?> \ No newline at end of file +?>