Preference that lets the whiners set cursor focus as needed when replying. :)
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 2 Oct 2003 01:43:20 +0000 (01:43 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 2 Oct 2003 01:43:20 +0000 (01:43 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5823 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/page_header.php
include/load_prefs.php
include/options/display.php

index 50957d603e9444bbdec6e1614667b22b212f9719..bc63eced428808b71ddc765b81c0d652ed2e24f7 100644 (file)
@@ -153,8 +153,16 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
         case 'src/compose.php':
             $js = '<script language="JavaScript" type="text/javascript">' .
                  "\n<!--\n" .
         case 'src/compose.php':
             $js = '<script language="JavaScript" type="text/javascript">' .
                  "\n<!--\n" .
-                 "function checkForm() {\n".
-                    "var f = document.forms.length;\n".
+             "function checkForm() {\n";
+
+            global $action, $reply_focus;
+            if (strpos($action, 'reply') !== FALSE && $reply_focus)
+            {
+                if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n";
+                else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n";
+            }
+            else
+                $js .= "var f = document.forms.length;\n".
                     "var i = 0;\n".
                     "var pos = -1;\n".
                     "while( pos == -1 && i < f ) {\n".
                     "var i = 0;\n".
                     "var pos = -1;\n".
                     "while( pos == -1 && i < f ) {\n".
@@ -312,8 +320,16 @@ function compose_Header($color, $mailbox) {
         default:
             $js = '<script language="JavaScript" type="text/javascript">' .
                  "\n<!--\n" .
         default:
             $js = '<script language="JavaScript" type="text/javascript">' .
                  "\n<!--\n" .
-                 "function checkForm() {\n".
-                    "var f = document.forms.length;\n".
+             "function checkForm() {\n";
+
+            global $action, $reply_focus;
+            if (strpos($action, 'reply') !== FALSE && $reply_focus)
+            {
+                if ($reply_focus == 'select') $js .= "document.forms['compose'].body.select();}\n";
+                else if ($reply_focus == 'focus') $js .= "document.forms['compose'].body.focus();}\n";
+            }
+            else
+                $js .= "var f = document.forms.length;\n".
                     "var i = 0;\n".
                     "var pos = -1;\n".
                     "while( pos == -1 && i < f ) {\n".
                     "var i = 0;\n".
                     "var pos = -1;\n".
                     "while( pos == -1 && i < f ) {\n".
index 61d6dfe51403cdeb9f01a2bda98343ccfb48df9e..9f4038d96bf0a6416d528f2dca53051e2ef710fa 100644 (file)
@@ -155,6 +155,12 @@ $reply_citation_style =
 $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
 $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
 
 $reply_citation_start = getPref($data_dir, $username, 'reply_citation_start');
 $reply_citation_end = getPref($data_dir, $username, 'reply_citation_end');
 
+// who is using those darn block comments?  poo!
+
+// Load preference for cursor behavior for replies
+//
+$reply_focus = getPref($data_dir, $username, 'reply_focus', '');
+
 /* left refresh rate, strtolower makes 1.0.6 prefs compatible */
 $left_refresh = getPref($data_dir, $username, 'left_refresh', SMPREF_NONE );
 $left_refresh = strtolower($left_refresh);
 /* left refresh rate, strtolower makes 1.0.6 prefs compatible */
 $left_refresh = getPref($data_dir, $username, 'left_refresh', SMPREF_NONE );
 $left_refresh = strtolower($left_refresh);
index 744432887f8b08276eb36258db2c9ca8698f7062..17e14fc32482bfec95ab3f15918574832beaba08 100644 (file)
@@ -309,6 +309,16 @@ function load_optpage_data_display() {
         'refresh' => SMOPT_REFRESH_NONE
     );
 
         'refresh' => SMOPT_REFRESH_NONE
     );
 
+    $optvals[SMOPT_GRP_MESSAGE][] = array(
+        'name'    => 'reply_focus',
+        'caption' => _("Cursor Position when Replying"),
+        'type'    => SMOPT_TYPE_STRLIST,
+        'refresh' => SMOPT_REFRESH_NONE,
+        'posvals' => array('' => _("To: field"),
+                           'focus' => _("Focus in body"),
+                           'select' => _("Select body"))
+    );
+
     $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'strip_sigs',
         'caption' => _("Strip signature when replying"),
     $optvals[SMOPT_GRP_MESSAGE][] = array(
         'name'    => 'strip_sigs',
         'caption' => _("Strip signature when replying"),