* Specified image width and height (solves a weird display funkiness in IE
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 16 May 2001 17:56:52 +0000 (17:56 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 16 May 2001 17:56:52 +0000 (17:56 +0000)
  for a split second when the page is loading).
* Ripped out code and made a separate function

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1369 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php

index 9f0aa2b2578921a33b384c6744fcf9e1493eb5da..862b6b5f9424b9e1c3b51ac43f9e1d7fda940826 100644 (file)
          session_unregister("msgs");
          if (($sort == 0) || ($sort == 1))
             $msort = array_cleave ($msgs, 'TIME_STAMP');
          session_unregister("msgs");
          if (($sort == 0) || ($sort == 1))
             $msort = array_cleave ($msgs, 'TIME_STAMP');
-         if (($sort == 2) || ($sort == 3))
+         elseif (($sort == 2) || ($sort == 3))
             $msort = array_cleave ($msgs, 'FROM-SORT');
             $msort = array_cleave ($msgs, 'FROM-SORT');
-         if (($sort == 4) || ($sort == 5))
+         elseif (($sort == 4) || ($sort == 5))
             $msort = array_cleave ($msgs, 'SUBJECT-SORT');
             $msort = array_cleave ($msgs, 'SUBJECT-SORT');
-         if ($sort == 6)
+         else // ($sort == 6)
             $msort = $msgs;
 
          if ($sort < 6) {
             $msort = $msgs;
 
          if ($sort < 6) {
-            if($sort % 2) {
+            if ($sort % 2) {
                asort($msort);
             } else {
                arsort($msort);
                asort($msort);
             } else {
                arsort($msort);
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
 
       $urlMailbox=urlencode($mailbox);
       echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
 
       $urlMailbox=urlencode($mailbox);
+      
+      $upPointer = '<IMG SRC="../images/up_pointer.gif" HEIGHT=10 WIDTH=12 BORDER=0>';
+      $downPointer = '<IMG SRC="../images/down_pointer.gif" HEIGHT=10 WIDTH=12 BORDER=0>';
+      $noPointer = '<IMG SRC="../images/sort_none" WIDTH=12 HEIGHT=10 BORDER=0>';
 
       // Print the headers
       for ($i=1; $i <= count($index_order); $i++) {
 
       // Print the headers
       for ($i=1; $i <= count($index_order); $i++) {
                   echo '   <TD WIDTH="25%"><B>'. _("To") .'</B>';
                else
                     echo '   <TD WIDTH="25%"><B>'. _("From") .'</B>';
                   echo '   <TD WIDTH="25%"><B>'. _("To") .'</B>';
                else
                     echo '   <TD WIDTH="25%"><B>'. _("From") .'</B>';
-         
-               if ($sort == 2)
-                  echo "   <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort == 3)
-                  echo "   <A HREF=\"right_main.php?newsort=2&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort != -1)
-                  echo "   <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
-               echo "</TD>";
+              ShowSortButton($sort, $urlMailbox, 2, 3);
+               echo "</TD>\n";
                break;
                
             case 3: # date
                echo '   <TD NOWRAP WIDTH="5%"><B>'. _("Date") .'</B>';
                break;
                
             case 3: # date
                echo '   <TD NOWRAP WIDTH="5%"><B>'. _("Date") .'</B>';
-               if ($sort == 0)
-                  echo " <A HREF=\"right_main.php?newsort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort == 1)
-                  echo " <A HREF=\"right_main.php?newsort=6&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort == 6)
-                  echo " <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort != -1)
-                  echo " <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
-               echo '</TD>';
+              ShowSortButton($sort, $urlMailbox, 0, 1);
+               echo "</TD>\n";
                break;
                
             case 4: # subject
                break;
                
             case 4: # subject
-               echo '   <TD><B>'. _("Subject") ."</B>\n";
-               if ($sort == 4)
-                 echo "    <A HREF=\"right_main.php?newsort=5&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort == 5)
-                  echo "   <A HREF=\"right_main.php?newsort=4&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
-               elseif ($sort != -1)
-                  echo "   <A HREF=\"right_main.php?newsort=5&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
-               echo "</TD>";
+               echo '   <TD><B>'. _("Subject") .'</B> ';
+              ShowSortButton($sort, $urlMailbox, 4, 5);
+               echo "</TD>\n";
                break;
                
             case 6: # size 
                break;
                
             case 6: # size 
       echo "</TR>\n";
    }
    
       echo "</TR>\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;
+      } else {
+         $img = 'down_pointer.gif';
+        $which = 6;
+      }
+      echo ' <a href="right_main.php?newsort=' . $which . 
+        '&startMessage=1&mailbox=' . $mailbox . '"><IMG SRC="../images/' .
+        $img . '" BORDER=0 WIDTH=12 HEIGHT=10></a>';
+   }
+   
    function ShowSelectAllLink($startMessage, $sort)
    {
        global $checkall, $PHP_SELF, $what, $where, $mailbox;
    function ShowSelectAllLink($startMessage, $sort)
    {
        global $checkall, $PHP_SELF, $what, $where, $mailbox;