* Word Wrapping works good
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Dec 1999 14:50:25 +0000 (14:50 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 4 Dec 1999 14:50:25 +0000 (14:50 +0000)
* Added "Message List" link to read_body.php
* beginnings of Compose

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

config/config.php
functions/mailbox.php
functions/mailbox_display.php
functions/page_header.php
functions/strings.php
src/compose.php [new file with mode: 0644]
src/folders.php
src/read_body.php

index 166587e3315979d8e79e6e5b58eed79a5c230cf5..87b93b17c6cec1114eb365ff71900b8a3605f7ec 100644 (file)
@@ -51,7 +51,4 @@ $special_folders[1] = $trash_folder;
 $special_folders[2] = "INBOX.Sent";
 $special_folders[3] = "INBOX.Drafts";
 $special_folders[4] = "INBOX.Templates";
 $special_folders[2] = "INBOX.Sent";
 $special_folders[3] = "INBOX.Drafts";
 $special_folders[4] = "INBOX.Templates";
-
-/** This is the max chars before a line wrap on plain text messages */
-$wrap_max = 80;
 ?>
 ?>
index 846e1a60b39ea7313a5e49ef802e88d4ed5a92d5..44ea499de34d6f33af0f8cc70fba90cb7691e57c 100644 (file)
          $line = str_replace(">", "&gt;", $line);
       }
 
          $line = str_replace(">", "&gt;", $line);
       }
 
-//      $line = wordWrap($line);
+      $wrap_at = 80; // Make this configurable int the config file some time
+      if (strlen($line) - 2 >= $wrap_at) // -2 because of the ^^ at the beginning
+         $line = wordWrap($line, $wrap_at);
       $line = str_replace(" ", "&nbsp;", $line);
       $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
 
       $line = str_replace(" ", "&nbsp;", $line);
       $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
 
index c82891a08baab6fdffbb52c4643c98413abdbd53..d039cbc1e708dd81755bc1a6a7d387fb8bd233d5 100644 (file)
@@ -8,7 +8,7 @@
     **
     **/
 
     **
     **/
 
-   function printMessageInfo($imapConnection, $t, $i, $from, $subject, $dateString, $answered, $seen, $mailbox) {
+   function printMessageInfo($imapConnection, $t, $i, $from, $subject, $dateString, $answered, $seen, $mailbox, $sort, $startMessage) {
       $senderName = getSenderName($from);
       $urlMailbox = urlencode($mailbox);
       echo "<TR>\n";
       $senderName = getSenderName($from);
       $urlMailbox = urlencode($mailbox);
       echo "<TR>\n";
@@ -21,7 +21,7 @@
          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\"><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\"><A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$i\">$subject</A></FONT></TD>\n";
+         echo "   <TD><FONT FACE=\"Arial,Helvetica\"><A HREF=\"read_body.php?mailbox=$urlMailbox&passed_id=$i&sort=$sort&startMessage=$startMessage\">$subject</A></FONT></TD>\n";
       }
       echo "</TR>\n";
    }
       }
       echo "</TR>\n";
    }
          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 - 1;
          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 - 1;
-         printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"], $mailbox);
+         printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"], $mailbox, $sort, $startMessage);
       } else {
          for ($i = $startMessage - 1;$i <= $endMessage - 1; $i++) {
       } 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"], $mailbox);
+            printMessageInfo($imapConnection, $t, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE_STRING"], $msgs[$i]["FLAG_ANSWERED"], $msgs[$i]["FLAG_SEEN"], $mailbox, $sort, $startMessage);
             $t++;
          }
       }
             $t++;
          }
       }
index d871768ef7cdead0b94831d56288e22113d0cfca..83f1fc80a9d8ce9ad77105f9d9e19090c9f57624 100644 (file)
@@ -19,7 +19,7 @@
       echo "   </TR></TABLE>\n";
       echo "<TABLE BGCOLOR=FFFFFF BORDER=0 COLS=2 WIDTH=100% CELLSPACING=0 CELLPADDING=2><TR>";
       echo "      <TD ALIGN=left WIDTH=70%>";
       echo "   </TR></TABLE>\n";
       echo "<TABLE BGCOLOR=FFFFFF BORDER=0 COLS=2 WIDTH=100% CELLSPACING=0 CELLPADDING=2><TR>";
       echo "      <TD ALIGN=left WIDTH=70%>";
-      echo "         <FONT FACE=\"Arial,Helvetica\">Compose</FONT>&nbsp&nbsp";
+      echo "         <FONT FACE=\"Arial,Helvetica\"><A HREF=\"compose.php\">Compose</A></FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\">Addresses</FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\"><A HREF=\"folders.php\">Folders</A></FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\">Options</FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\">Addresses</FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\"><A HREF=\"folders.php\">Folders</A></FONT>&nbsp&nbsp";
       echo "         <FONT FACE=\"Arial,Helvetica\">Options</FONT>&nbsp&nbsp";
index 175910475cbee3e90909893107d1647ffad4a683..422c012472c967fb9b7f01169f62b0ccab1e8620 100644 (file)
       return strrev($data);
    }
 
       return strrev($data);
    }
 
-   // Wraps text at $wrap_max characters
-   function wordWrap($line) {
-      $newline = $line;
-      $lastpart = $line;
-      $numlines = 0;
-      $wrap_max = 80;
-      while (strlen($lastpart) > $wrap_max) {
-         $pos = $wrap_max;
-         while ((substr($line, $pos, $pos+1) != " ") && ($pos > 0)) {
-            $pos--;
+   // Wraps text at $wrap characters
+   function wordWrap($passed, $wrap) {
+      $words = explode(" ", trim($passed));
+      $i = 0;
+      $line_len = strlen($words[$i])+1;
+      $line = "";
+      while ($i < count($words)) {
+         while ($line_len < $wrap) {
+            $line = "$line$words[$i]&nbsp;";
+            $i++;
+            $line_len = $line_len + strlen($words[$i])+1;
          }
          }
-         $before = substr($line, 0, $pos);
-         $lastpart = substr($line, $pos+1, strlen($line));
-         $newline = $before . "<BR>" . $lastpart;
-         $numlines++;
+         if ($i < count($words)) // don't <BR> the last line
+            $line = "$line<BR>";
+         $line_len = strlen($words[$i])+1;
       }
       }
-      return $newline;
+      return $line;
    }
 ?>
    }
 ?>
diff --git a/src/compose.php b/src/compose.php
new file mode 100644 (file)
index 0000000..60c4042
--- /dev/null
@@ -0,0 +1,17 @@
+<?
+   include("../config/config.php");
+   include("../functions/strings.php");
+   include("../functions/page_header.php");
+   include("../functions/imap.php");
+   include("../functions/mailbox.php");
+   include("../functions/date.php");
+
+   echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">\n";
+   $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
+   displayPageHeader($mailbox);
+
+   echo "<FORM action=\"mailto:luke@usa.om.org\" METHOD=POST>\n";
+   echo "<TEXTAREA NAME=body ROWS=20 COLS=82></TEXTAREA>";
+   echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
+   echo "</FORM>";
+?>
\ No newline at end of file
index beccf55578421156aa1155fb404e34299274173b..5dea2602666118819bb1c256dee906d101dd0087 100644 (file)
@@ -21,7 +21,7 @@
    echo "<TABLE WIDTH=70% COLS=1 ALIGN=CENTER>\n";
    echo "<TR><TD BGCOLOR=DCDCDC ALIGN=CENTER><FONT FACE=\"Arial,Helvetica\"><B>Delete Folder</B></FONT></TD></TR>";
    echo "<TR><TD BGCOLOR=FFFFFF ALIGN=CENTER>";
    echo "<TABLE WIDTH=70% COLS=1 ALIGN=CENTER>\n";
    echo "<TR><TD BGCOLOR=DCDCDC ALIGN=CENTER><FONT FACE=\"Arial,Helvetica\"><B>Delete Folder</B></FONT></TD></TR>";
    echo "<TR><TD BGCOLOR=FFFFFF ALIGN=CENTER>";
-   echo "<FORM ACTION=folders_delete.php METHOD=POST>\n";
+   echo "<FORM ACTION=folders_delete.php METHOD=SUBMIT>\n";
    echo "<SELECT NAME=mailbox><FONT FACE=\"Arial,Helvetica\">\n";
    for ($i = 0; $i < count($boxesUnformatted); $i++) {
       $use_folder = true;
    echo "<SELECT NAME=mailbox><FONT FACE=\"Arial,Helvetica\">\n";
    for ($i = 0; $i < count($boxesUnformatted); $i++) {
       $use_folder = true;
index b660fefdb1aeec9f7507a671228e16fb1682ddea..4f7e458a23aa4e99aa6a0b9452a0ee7505f876d6 100644 (file)
 //   $date = getDateString($date);
    $date = $d[0];
    $from_name = getSenderName($f[0]);
 //   $date = getDateString($date);
    $date = $d[0];
    $from_name = getSenderName($f[0]);
+   $urlMailbox = urlencode($mailbox);
 
 
-   echo "<TABLE COLS=1 WIDTH=95% BORDER=0 ALIGN=CENTER>\n";
-   echo "   <TR><TD BGCOLOR=DCDCDC>&nbsp;</TD></TR>";
-   echo "   <TR><TD BGCOLOR=FFFFFF>";
+   echo "<BR>";
+   echo "<TABLE COLS=1 WIDTH=95% BORDER=0 ALIGN=CENTER CELLPADDING=2>\n";
+   echo "   <TR><TD BGCOLOR=DCDCDC WIDTH=100%>";
+   echo "      <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A>&nbsp;&nbsp;";
+   echo "   </TD></TR>";
+   echo "   <TR><TD BGCOLOR=FFFFFF WIDTH=100%>";
    echo "   <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>\n";
    echo "      <TR>\n";
    /** subject **/
    echo "   <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>\n";
    echo "      <TR>\n";
    /** subject **/
@@ -52,7 +56,7 @@
 
    echo "   </TABLE></TD></TR>\n";
 
 
    echo "   </TABLE></TD></TR>\n";
 
-   echo "   <TR><TD BGCOLOR=FFFFFF><BR>\n";
+   echo "   <TR><TD BGCOLOR=FFFFFF WIDTH=100%><BR>\n";
    $i = 0;
    while ($i < count($body)) {
       echo "$body[$i]";
    $i = 0;
    while ($i < count($body)) {
       echo "$body[$i]";