Be nice to plugins who want to add to the onClick... add a semicolon at the end.
[squirrelmail.git] / functions / mailbox_display.php
index 9e0b1c9332a2a46e8e724260aee1032953b2eaac..c77ee33438adbcc4f962ea8285df6b19806d1f37 100644 (file)
@@ -99,7 +99,8 @@ function printMessageInfo($aMsg) {
         $show_recipient_instead,    /* show recipient name instead of default identity */
         $use_icons,                 /* indicates to use icons or text markers */
         $icon_theme,                /* icons theming */
-        $javascript_on;
+        $javascript_on,
+        $fancy_index_highlite;
 
     $color_string = $color[4];
 
@@ -309,10 +310,18 @@ function printMessageInfo($aMsg) {
 
     // this stuff does the auto row highlighting on mouseover
     //
-    if ($javascript_on) {
+    if ($javascript_on && $fancy_index_highlite) {
+
         $mouseoverColor = $color[5];
+
+        // set this to an empty string to turn off extra 
+        // highlighting of checked rows
+        //
+        //$clickedColor = '';
         $clickedColor = $color[2];
+
         $row_extra .= ' onmouseover="setPointer(this, ' . $t . ', \'over\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');" onmouseout="setPointer(this, ' . $t . ', \'out\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');" onmousedown="setPointer(this, ' . $t . ', \'click\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');"';
+
     }
 
 
@@ -322,8 +331,9 @@ function printMessageInfo($aMsg) {
     // this does the auto-checking of the checkbox no matter 
     // where on the row you click
     //
-    if ($javascript_on)
-        $javascript_auto_click = ' onMouseDown="if (document.getElementById(msg[' . $t . '])) { document.getElementById(msg[' . $t . ']).checked = (document.getElementById(msg[' . $t . ']).checked ? false : true); }"';
+    $javascript_auto_click = '';
+    if ($javascript_on && $fancy_index_highlite)
+        $javascript_auto_click = ' onMouseDown="row_click(\'msg[' . $t . ']\')"';
 
 
     if (sizeof($index_order)) {
@@ -337,7 +347,7 @@ function printMessageInfo($aMsg) {
         // care of this; just skip it
         //
         $show_label_columns = array();
-        if (!$javascript_on) {
+        if (!($javascript_on && $fancy_index_highlite)) {
             $get_next_two = 0;
             $last_order_part = 0;
             $last_last_order_part = 0;
@@ -409,6 +419,15 @@ function printMessageInfo($aMsg) {
                 $td_str .= '<a href="read_body.php?mailbox='.$urlMailbox
                         .  '&amp;passed_id='. $iId
                         .  '&amp;startMessage='.$start_msg.$searchstr.'"';
+
+                // don't highlight the row or check the checkbox 
+                // when clicking subject link (when fancy highlighting is on)
+                //
+                // parentNode property is DOM Level 1
+                //
+                if ($javascript_on && $fancy_index_highlite)
+                    $td_str .= ' onClick="row_click(\'msg[' . $t . ']\'); setPointer(this.parentNode.parentNode, ' . $t . ', \'click\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');"';
+
                 $td_str .= ' ' .concat_hook_function('subject_link', array($start_msg, $searchstr));
                 if ($subject != $sSubject) {
                     $title = get_html_translation_table(HTML_SPECIALCHARS);