Fixed/restored reply focus functionality
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 24 Sep 2005 00:25:00 +0000 (00:25 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 24 Sep 2005 00:25:00 +0000 (00:25 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10118 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/page_header.php

index 3cd1e8bd3a0f1343b45d999cd38736037c107196..a7812b526b77302c2998cbe4c26fbbcf0bd5ad6d 100644 (file)
@@ -142,10 +142,25 @@ function displayInternalLink($path, $text, $target='') {
  * @return void
  */
 
  * @return void
  */
 
-function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = 'onload="checkForm();"') {
-    global $hide_sm_attributions, $frame_top,
+function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') {
+
+    global $reply_focus, $hide_sm_attributions, $frame_top,
            $provider_name, $provider_uri, $startMessage,
            $provider_name, $provider_uri, $startMessage,
-           $javascript_on;
+           $javascript_on, $action;
+
+    if (empty($sBodyTagJs)) {
+        if (strpos($action, 'reply') !== FALSE && $reply_focus) {
+          if ($reply_focus == 'select')
+              $sBodyTagJs = 'onload="checkForm(\'select\');"';
+          else if ($reply_focus == 'focus')
+              $sBodyTagJs = 'onload="checkForm(\'focus\');"';
+          else if ($reply_focus != 'none')
+              $sBodyTagJs = 'onload="checkForm();"';
+        }
+        else
+          $sBodyTagJs = 'onload="checkForm();"';
+    }
+
 
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION );
 
 
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION );
 
@@ -238,8 +253,24 @@ function displayPageHeader($color, $mailbox, $sHeaderJs='', $sBodyTagJs = 'onloa
  * @param string sBodyTagJs js events to be inserted in the body tag
  * @return void
  */
  * @param string sBodyTagJs js events to be inserted in the body tag
  * @return void
  */
-function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = 'onload="checkForm();"') {
-    global $javascript_on;
+function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = '') {
+
+    global $reply_focus, $javascript_on, $action;
+
+    if (empty($sBodyTagJs)) {
+        if (strpos($action, 'reply') !== FALSE && $reply_focus) {
+          if ($reply_focus == 'select')
+              $sBodyTagJs = 'onload="checkForm(\'select\');"';
+          else if ($reply_focus == 'focus')
+              $sBodyTagJs = 'onload="checkForm(\'focus\');"';
+          else if ($reply_focus != 'none')
+              $sBodyTagJs = 'onload="checkForm();"';
+        }
+        else
+          $sBodyTagJs = 'onload="checkForm();"';
+    }
+
+
     /*
      * Locate the first displayable form element (only when JavaScript on)
      */
     /*
      * Locate the first displayable form element (only when JavaScript on)
      */
@@ -260,4 +291,4 @@ function compose_Header($color, $mailbox, $sHeaderJs='', $sBodyTagJs = 'onload="
     }
     echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $sBodyTagJs>\n\n";
 }
     }
     echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $sBodyTagJs>\n\n";
 }
-?>
\ No newline at end of file
+?>