\n"
+ . " \n"
+ . " $paginator\n";
+
+ if ($allow_thread_sort == TRUE) {
+ if ($thread_sort_messages == 1 ) {
+ $set_thread = 2;
+ $thread_name = 'Unthread View';
+ } elseif ($thread_sort_messages == 0) {
+ $set_thread = 1;
+ $thread_name = 'Thread View';
+ }
+ echo '| ' . _("$thread_name")
+ . ' ';
+ }
- $Message = '';
- if ($startMessage < $endMessage) {
- $Message = _("Viewing messages") ." $startMessage ". _("to") ." $endMessage ($numMessages " . _("total") . ")\n";
- } elseif ($startMessage == $endMessage) {
- $Message = _("Viewing message") ." $startMessage ($numMessages " . _("total") . ")\n";
+ echo " $msg_cnt_str \n"
+ . "
\n"
+ . ' '
+ . "\n"
+ . "\n";
+ do_hook('mailbox_form_before');
+ echo ' '
+ . ""
+ . '"
+ . "";
+
+ /* Print the headers. */
+ for ($i=1; $i <= count($index_order); $i++) {
+ switch ($index_order[$i]) {
+ case 1: /* checkbox */
+ case 5: /* flags */
+ echo ' ';
+ break;
+ case 2: /* from */
+ if (handleAsSent($mailbox)) {
+ echo ' ' . _("To") . ' ';
} else {
- $use = 1;
+ echo ' ' . _("From") . ' ';
}
- if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
- $More = "". _("Previous") ." | \n";
- $More .= "". _("Next") ." \n";
+ if ($thread_sort_messages != 1) {
+ ShowSortButton($sort, $mailbox, 2, 3);
}
- elseif (($nextGroup > $numMessages) && ($prevGroup >= 0)) {
- $More = "". _("Previous") ." | \n";
- $More .= ""._("Next")." \n";
+ echo " \n";
+ break;
+ case 3: /* date */
+ echo ' ' . _("Date") . ' ';
+ if ($thread_sort_messages != 1) {
+ ShowSortButton($sort, $mailbox, 0, 1);
}
- elseif (($nextGroup <= $numMessages) && ($prevGroup < 0)) {
- $More = ""._("Previous")." | \n";
- $More .= "". _("Next") ." \n";
- }
-
- if (! isset($msg))
- $msg = "";
- mail_message_listing_beginning($imapConnection,
- "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage",
- $mailbox, $sort, $Message, $More, $startMessage);
-
- $groupNum = $startMessage % ($show_num - 1);
- $real_startMessage = $startMessage;
- if ($sort == 6) {
- if ($endMessage - $startMessage < $show_num - 1) {
- $endMessage = $endMessage - $startMessage + 1;
- $startMessage = 1;
- } else if ($startMessage > $show_num) {
- $endMessage = $show_num;
- $startMessage = 1;
- }
- }
-
- $endVar = $endMessage + 1;
-
- // loop through and display the info for each message.
- $t = 0; // $t is used for the checkbox number
- if ($numMessages == 0) { // if there's no messages in this folder
- echo " ". _("THIS FOLDER IS EMPTY") ." ";
- } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
- if ($sort != 6)
- $i = $startMessage;
- else
- $i = 1;
- reset($msort);
- $k = 0;
- do {
- $key = key($msort);
- next($msort);
- $k++;
- } while (isset ($key) && ($k < $i));
- printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
- } else {
- $i = $startMessage;
-
- reset($msort);
- $k = 0;
- do {
- $key = key($msort);
- next($msort);
- $k++;
- } while (isset ($key) && ($k < $i));
-
- do {
- printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
- $key = key($msort);
- $t++;
- $i++;
- next($msort);
- } while ($i && $i < $endVar);
- }
- echo '
';
-
- echo " \n";
-
- echo "";
- echo '';
- echo "$More \n";
- if (!$startMessage) $startMessage=1;
- ShowSelectAllLink($startMessage, $sort);
-
- echo '
';
- echo ' ';
- echo '
'; /** End of message-list table */
-
- do_hook('mailbox_index_after');
- }
-
- /* Displays the standard message list header.
- * To finish the table, you need to do a "";
- * $moveURL is the URL to submit the delete/move form to
- * $mailbox is the current mailbox
- * $sort is the current sorting method (-1 for no sorting available [searches])
- * $Message is a message that is centered on top of the list
- * $More is a second line that is left aligned
- */
- function mail_message_listing_beginning($imapConnection, $moveURL,
- $mailbox = '', $sort = -1, $Message = '', $More = '', $startMessage = 1)
- {
- global $color, $index_order, $auto_expunge, $move_to_trash;
- global $checkall, $sent_folder;
- $urlMailbox = urlencode($mailbox);
- /** This is the beginning of the message list table. It wraps around all messages */
- echo '';
-
- if ($Message)
- {
- echo "$Message \n";
+ echo "\n";
+ break;
+ case 4: /* subject */
+ echo ' ' . _("Subject") . ' ';
+ if ($thread_sort_messages != 1) {
+ ShowSortButton($sort, $mailbox, 4, 5);
}
+ echo " \n";
+ break;
+ case 6: /* size */
+ echo ' ' . _("Size") . " \n";
+ break;
+ }
+ }
+ echo "\n";
+}
- echo "";
- echo '';
- echo "$More \n";
- ShowSelectAllLink($startMessage, $sort);
+/*
+ * This function shows the sort button. Isn't this a good comment?
+ */
+function ShowSortButton($sort, $mailbox, $Up, $Down) {
+ /* Figure out which image we want to use. */
+ if ($sort != $Up && $sort != $Down) {
+ $img = 'sort_none.png';
+ $which = $Up;
+ } elseif ($sort == $Up) {
+ $img = 'up_pointer.png';
+ $which = $Down;
+ } else {
+ $img = 'down_pointer.png';
+ $which = 6;
+ }
+
+ /* Now that we have everything figured out, show the actual button. */
+ echo ' ';
+}
- echo '
';
- echo ' ';
+function get_selectall_link($start_msg, $sort) {
+ global $checkall, $what, $where, $mailbox, $javascript_on;
+ global $PHP_SELF, $PG_SHOWNUM;
+
+ $result = '';
+ if ($javascript_on) {
+ $result =
+ '' . _("Toggle All")
+ . " \n";
+ } else {
+ if (strpos($PHP_SELF, "?")) {
+ $result .= "";
+
+ if (isset($checkall) && ($checkall == '1')) {
+ $result .= _("Unselect All");
+ } else {
+ $result .= _("Select All");
+ }
+
+ $result .= " \n";
+ }
- /** The delete and move options */
- echo "";
+ /* Return our final result. */
+ return ($result);
+}
- echo "\n\n\n ';
-
- echo "";
- echo "';
+ */
+
+ /* Print out the page links from the compute page quarters. */
+
+ /* Start with the first quarter. */
+ if (($q1_pgs == 0) && ($cur_pg > 1)) {
+ $pg_str .= "...$spc";
} else {
- echo "1";
+ for ($pg = 1; $pg <= $q1_pgs; ++$pg) {
+ $start = (($pg-1) * $show_num) + 1;
+ $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
+ }
+ if ($cur_pg - $q2_pgs - $q1_pgs > 1) {
+ $pg_str .= "...$spc";
+ }
+ }
+
+ /* Continue with the second quarter. */
+ for ($pg = $cur_pg - $q2_pgs; $pg < $cur_pg; ++$pg) {
+ $start = (($pg-1) * $show_num) + 1;
+ $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
}
- echo " BGCOLOR=\"$color[0]\">";
- echo "";
-
- // Print the headers
- for ($i=1; $i <= count($index_order); $i++) {
- switch ($index_order[$i]) {
- case 1: # checkbox
- case 5: # flags
- echo ' ';
- break;
-
- case 2: # from
- if ($mailbox == $sent_folder)
- echo ' '. _("To") .' ';
- else
- echo ' '. _("From") .' ';
- ShowSortButton($sort, $mailbox, 2, 3);
- echo " \n";
- break;
-
- case 3: # date
- echo ' '. _("Date") .' ';
- ShowSortButton($sort, $mailbox, 0, 1);
- echo " \n";
- break;
-
- case 4: # subject
- echo ' '. _("Subject") .' ';
- ShowSortButton($sort, $mailbox, 4, 5);
- echo " \n";
- break;
-
- case 6: # size
- echo ' ' . _("Size")." \n";
- break;
- }
+
+ /* Now print the current page. */
+ $pg_str .= $cur_pg . $spc;
+
+ /* Next comes the third quarter. */
+ for ($pg = $cur_pg + 1; $pg <= $cur_pg + $q3_pgs; ++$pg) {
+ $start = (($pg-1) * $show_num) + 1;
+ $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
}
- echo " \n";
- }
-
- function ShowSortButton($sort, $mailbox, $Up, $Down) {
- if ($sort != $Up && $sort != $Down) {
- $img = 'sort_none.gif';
- $which = $Up;
- } elseif ($sort == $Up) {
- $img = 'up_pointer.gif';
- $which = $Down;
+
+ /* And last, print the forth quarter page links. */
+ if (($q4_pgs == 0) && ($cur_pg < $tot_pgs)) {
+ $pg_str .= "...$spc";
} else {
- $img = 'down_pointer.gif';
- $which = 6;
+ if (($tot_pgs - $q4_pgs) > ($cur_pg + $q3_pgs)) {
+ $pg_str .= "...$spc";
+ }
+ for ($pg = $tot_pgs - $q4_pgs + 1; $pg <= $tot_pgs; ++$pg) {
+ $start = (($pg-1) * $show_num) + 1;
+ $pg_str .= get_paginator_link($box, $start, $use, $pg) . $spc;
+ }
}
- echo ' ';
- }
-
- function ShowSelectAllLink($startMessage, $sort)
- {
- global $checkall, $PHP_SELF, $what, $where, $mailbox;
-
- // This code is from Philippe Mingo
-
- ?>
-
-";
- if (isset($checkall) && $checkall == '1')
- echo _("Unselect All");
- else
- echo _("Select All");
-
- echo "\n \n";
- }
-
- function processSubject($subject)
- {
- // Shouldn't ever happen -- caught too many times in the IMAP functions
- if ($subject == '')
- return _("(no subject)");
-
- if (strlen($subject) <= 55)
- return $subject;
-
- $ent_strlen=strlen($subject);
- $trim_val=50;
- $ent_offset=0;
- // see if this is entities-encoded string
- // If so, Iterate through the whole string, find out
- // the real number of characters, and if more
- // than 55, substr with an updated trim value.
- while (($ent_loc = strpos($subject, '&', $ent_offset)) !== false &&
- ($ent_loc_end = strpos($subject, ';', $ent_loc)) !== false)
- {
- $trim_val += ($ent_loc_end-$ent_loc)+1;
- $ent_strlen -= $ent_loc_end-$ent_loc;
- $ent_offset = $ent_loc_end+1;
- }
-
- if ($ent_strlen <= 55)
- return $subject;
- return substr($subject, 0, $trim_val) . '...';
- }
+function processSubject($subject) {
+ /* Shouldn't ever happen -- caught too many times in the IMAP functions */
+ if ($subject == '')
+ return _("(no subject)");
+
+ if (strlen($subject) <= 55)
+ return $subject;
+
+ $ent_strlen=strlen($subject);
+ $trim_val=50;
+ $ent_offset=0;
+ /*
+ * see if this is entities-encoded string
+ * If so, Iterate through the whole string, find out
+ * the real number of characters, and if more
+ * than 55, substr with an updated trim value.
+ */
+ while ( (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) &&
+ (($ent_loc_end = strpos($subject, ';', $ent_loc)) !== false) ) {
+ $trim_val += ($ent_loc_end-$ent_loc)+1;
+ $ent_strlen -= $ent_loc_end-$ent_loc;
+ $ent_offset = $ent_loc_end+1;
+ }
+
+ if ($ent_strlen <= 55){
+ return $subject;
+ }
+
+ return substr($subject, 0, $trim_val) . '...';
+}
+
+function handleAsSent($mailbox) {
+ global $sent_folder, $draft_folder, $handleAsSent_result;
+
+ /* First check if this is the sent or draft folder. */
+ $handleAsSent_result = (($mailbox == $sent_folder)
+ || ($mailbox == $draft_folder));
+
+ /* Then check the result of the handleAsSent hook. */
+ do_hook('check_handleAsSent_result', $mailbox);
+
+ /* And return the result. */
+ return ($handleAsSent_result);
+}
?>