";
-
- echo "\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";
+ }
}
- 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)
- || ($mailbox == $draft_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;
- }
+
+ /* 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 " \n";
- }
-
- /*******************************************************************/
- /* 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.gif';
- $which = $Up;
- } elseif ($sort == $Up) {
- $img = 'up_pointer.gif';
- $which = $Down;
- } else {
- $img = 'down_pointer.gif';
- $which = 6;
+
+ /* 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;
}
-
- /* Now that we have everything figured out, show the actual button. */
- echo ' ';
- }
-
- function ShowSelectAllLink($startMessage, $sort) {
- global $checkall, $PHP_SELF, $what, $where, $mailbox;
-
- 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;
+
+ /* And last, print the forth quarter page links. */
+ if (($q4_pgs == 0) && ($cur_pg < $tot_pgs)) {
+ $pg_str .= "...$spc";
+ } else {
+ 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;
+ }
}
-
- if ($ent_strlen <= 55)
- return $subject;
-
- return substr($subject, 0, $trim_val) . '...';
- }
-
-?>
\ No newline at end of file
+ } else if ($PG_SHOWNUM == 999999) {
+ $pg_str = "" ._("Paginate") . '' . $spc;
+ }
+
+ /* If necessary, compute the 'show all' string. */
+ if (($prv_str != '') || ($nxt_str != '')) {
+ $all_str = "" . _("Show All") . '';
+ }
+
+ /* Last but not least, get the value for the toggle all link. */
+ $tgl_str = get_selectall_link($start_msg, $sort);
+
+ /* Put all the pieces of the paginator string together. */
+ /**
+ * Hairy code... But let's leave it like it is since I am not certain
+ * a different approach would be any easier to read. ;)
+ */
+ $result = '';
+ $result .= ($prv_str != '' ? $prv_str . $spc . $sep . $spc : '');
+ $result .= ($nxt_str != '' ? $nxt_str . $spc . $sep . $spc : '');
+ $result .= ($pg_str != '' ? $pg_str : '');
+ $result .= ($all_str != '' ? $sep . $spc . $all_str . $spc : '');
+ $result .= ($result != '' ? $sep . $spc . $tgl_str: $tgl_str);
+
+ /* If the resulting string is blank, return a non-breaking space. */
+ if ($result == '') {
+ $result = ' ';
+ }
+
+ /* Return our final magical paginator string. */
+ return ($result);
+}
+
+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);
+}
+
+?>
|