* fixed so bottom delete button works
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 24 Nov 1999 16:57:46 +0000 (16:57 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 24 Nov 1999 16:57:46 +0000 (16:57 +0000)
* if only one message in mailbox, it now shows correctly
* If no messages in mailbox, displays correctly

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

functions/mailbox_display.php
src/right_main.php

index 27ff6da..16826bf 100644 (file)
 
       echo "<TR>\n";
       if ($seen == false) {
-         echo "   <TD><FONT FACE=\"Arial,Helvetica\"><B><input type=checkbox name=\"msg[$t]\" value=$i></B></FONT></TD>\n";
+         echo "   <TD><FONT FACE=\"Arial,Helvetica\"><nobr><B><input type=checkbox name=\"msg[$t]\" value=$i></B></nobr></FONT></TD>\n";
          echo "   <TD><FONT FACE=\"Arial,Helvetica\"><B>$senderName</B></FONT></TD>\n";
          echo "   <TD><CENTER><B><FONT FACE=\"Arial,Helvetica\">$dateString</FONT></B></CENTER></TD>\n";
          echo "   <TD><FONT FACE=\"Arial,Helvetica\"><B>$subject</B></FONT></TD>\n";
       } else {
-         echo "   <TD><FONT FACE=\"Arial,Helvetica\"><input type=checkbox name=\"msg[$t]\" value=$i></FONT></TD>\n";
+         echo "   <TD><FONT FACE=\"Arial,Helvetica\"><nobr><input type=checkbox name=\"msg[$t]\" value=$i></nobr></FONT></TD>\n";
          echo "   <TD><FONT FACE=\"Arial,Helvetica\">$senderName</FONT></TD>\n";
          echo "   <TD><FONT FACE=\"Arial,Helvetica\"><CENTER>$dateString</CENTER></FONT></TD>\n";
          echo "   <TD><FONT FACE=\"Arial,Helvetica\">$subject</FONT></TD>\n";
       $numMessagesOld = $numMessages;
       $numMessages = $i - 1;
 
-      if ($sort == 0)
-         $msgs = ary_sort($msgs, "TIME_STAMP", -1);
-      else
-         $msgs = ary_sort($msgs, "TIME_STAMP", 1);
+      // There's gotta be messages in the array for it to sort them.
+      if ($numMessages > 0) {
+         if ($sort == 0)
+            $msgs = ary_sort($msgs, "TIME_STAMP", -1);
+         else
+            $msgs = ary_sort($msgs, "TIME_STAMP", 1);
+      }
 
       if ($startMessage + 24 < $numMessages) {
          $endMessage = $startMessage + 24;
 
       // loop through and display the info for each message.
       $t = 0; // $t is used for the checkbox number
-      for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) {
+      if ($numMessages == 0) { // if there's no messages in this folder
+         echo "<TR><TD BGCOLOR=FFFFFF COLSPAN=4><CENTER><BR><B>THIS FOLDER IS EMPTY</B><BR>&nbsp</CENTER></TD></TR>";
+      } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
+         $i = $startMessage;
          printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]);
-         $t++;
+      } else {
+         for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) {
+            printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"]);
+            $t++;
+         }
       }
-      echo "</FORM></TABLE>\n";
-      echo "</TD></TR>\n";
+      echo "</TABLE>";
 
       /** The "DELETE" button */
       echo "<TR><TD BGCOLOR=DCDCDC>";
-      echo "<FORM name=messageList method=post action=\"move_messages.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\">";
       echo "<INPUT TYPE=SUBMIT VALUE=\"Delete\"> selected messages";
       echo "</TD></TR>";
 
+      echo "</FORM></TABLE>\n";
+      echo "</TD></TR>\n";
+
       echo "<TR BGCOLOR=FFFFFF><TD>";
       if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
          echo "<A HREF=\"right_main.php?sort=$sort&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Previous</FONT></A>\n";
index cbc699f..5c86e14 100644 (file)
@@ -81,6 +81,7 @@
    showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort);
 
    // close the connection
+   fputs($imapConnection, "1 logout\n");
    fclose($imapConnection);
 ?>
 </FONT>