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 50957d6..bc63ece 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" .
-                 "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".
@@ -312,8 +320,16 @@ function compose_Header($color, $mailbox) {
         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".
index 61d6dfe..9f4038d 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');
 
+// 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);
index 7444328..17e14fc 100644 (file)
@@ -310,6 +310,16 @@ function load_optpage_data_display() {
     );
 
     $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"),
         'type'    => SMOPT_TYPE_BOOLEAN,