From 6f00c13b2ad04b4149999f3440ea6bad139f303d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sat, 27 Apr 2002 09:47:11 +0000 Subject: [PATCH] Better fix against bug #547384 (Marker Color can't equal Pointer Color) --- ChangeLog | 4 +- libraries/display_tbl.lib.php3 | 116 +++++++++++++++------------------ libraries/functions.js | 40 ++++++++---- 3 files changed, 81 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2044d81cc..86525e11c 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2002-04-27 Loïc Chapeaux * Documentation.html: xhtml fixes. + * libraries/display_tbl.lib.php3; libraries/functions.js: better fix + against bug #547384 (Marker Color can't equal Pointer Color). 2002-04-26 Loïc Chapeaux * ## created 2.2.7 branch into the CVS tree ## @@ -20,7 +22,7 @@ $Source$ 2002-04-26 Marc Delisle * tbl_qbe.php3: automatic joints from Relation table, thanks to Mike Beck (mike.beck at ibmiller.de) - (experimental: some things remain to be tested) + (experimental: some things remain to be tested) * Documentation.html: example for automatic joints * tbl_qbe.php3, tbl_printview.php3, libraries/display_tbl.lib.php3, Documentation.html: rename fields in the relation table diff --git a/libraries/display_tbl.lib.php3 b/libraries/display_tbl.lib.php3 index 1b346134e..125c4291b 100644 --- a/libraries/display_tbl.lib.php3 +++ b/libraries/display_tbl.lib.php3 @@ -722,7 +722,7 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ ' . "\n"; for ($foo_i = 0; $foo_i < $vertical_display['emptypre']; $foo_i++) { @@ -764,29 +764,17 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ echo '' . "\n"; } // end if - $bgcolor = ($foo % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; + $bgcolor = ($row_no % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; if ($disp_direction == 'horizontal') { // loic1: pointer code part $on_mouse = ''; if ($GLOBALS['cfg']['BrowsePointerColor'] != '') { - $on_mouse = ' onmouseover="'; - if ($GLOBALS['cfg']['BrowsePointerColor'] == $GLOBALS['cfg']['BrowsePointerColor']) { - $on_mouse .= 'if (typeof(row' . $row_no . '_marked) == \'undefined\') { row' . $row_no . '_marked = false; }; '; - } - $on_mouse .= 'setPointer(this, \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"' - . ' onmouseout="'; - if ($GLOBALS['cfg']['BrowsePointerColor'] == $GLOBALS['cfg']['BrowsePointerColor']) { - $on_mouse .= 'if (!row' . $row_no . '_marked) '; - } - $on_mouse .= 'setPointer(this, \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');"'; + $on_mouse = ' onmouseover="setPointer(this, ' . $row_no . ', \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"' + . ' onmouseout="setPointer(this, ' . $row_no . ', \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"'; } if ($GLOBALS['cfg']['BrowseMarkerColor'] != '') { - $on_mouse .= ' onmousedown="setPointer(this, \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\');'; - if ($GLOBALS['cfg']['BrowsePointerColor'] == $GLOBALS['cfg']['BrowsePointerColor']) { - $on_mouse .= 'if (row' . $row_no . '_marked) { row' . $row_no . '_marked = false; } else { row' . $row_no . '_marked = true; }'; - } - $on_mouse .= '"'; + $on_mouse .= ' onmousedown="setPointer(this, ' . $row_no . ', \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfg']['BrowsePointerColor'] . '\', \'' . $GLOBALS['cfg']['BrowseMarkerColor'] . '\')"'; } ?> > @@ -931,22 +919,22 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ if ($meta->numeric == 1) { if (!isset($row[$meta->name]) || (function_exists('is_null') && is_null($row[$pointer]))) { - $vertical_display['data'][$foo][$i] = ' NULL' . "\n"; + $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { - $vertical_display['data'][$foo][$i] = ' '; + $vertical_display['data'][$row_no][$i] = ' '; if (isset($map[$meta->name])) { - $vertical_display['data'][$foo][$i] .= '' - . $row[$pointer] . ''; + $vertical_display['data'][$row_no][$i] .= '' + . $row[$pointer] . ''; } else { - $vertical_display['data'][$foo][$i] .= $row[$pointer]; + $vertical_display['data'][$row_no][$i] .= $row[$pointer]; } - $vertical_display['data'][$foo][$i] .= '' . "\n"; + $vertical_display['data'][$row_no][$i] .= '' . "\n"; } else { - $vertical_display['data'][$foo][$i] = '  ' . "\n"; + $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } } else if ($GLOBALS['cfg']['ShowBlob'] == FALSE && eregi('BLOB', $meta->type)) { // loic1 : mysql_fetch_fields returns BLOB in place of TEXT @@ -955,11 +943,11 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // fields. $field_flags = mysql_field_flags($dt_result, $i); if (eregi('BINARY', $field_flags)) { - $vertical_display['data'][$foo][$i] = ' [BLOB]' . "\n"; + $vertical_display['data'][$row_no][$i] = ' [BLOB]' . "\n"; } else { if (!isset($row[$meta->name]) || (function_exists('is_null') && is_null($row[$pointer]))) { - $vertical_display['data'][$foo][$i] = ' NULL' . "\n"; + $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { if (strlen($row[$pointer]) > $GLOBALS['cfg']['LimitChars'] && ($dontlimitchars != 1)) { $row[$pointer] = substr($row[$pointer], 0, $GLOBALS['cfg']['LimitChars']) . '...'; @@ -969,15 +957,15 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $row[$pointer] = htmlspecialchars($row[$pointer]); $row[$pointer] = str_replace("\011", '    ', str_replace(' ', '  ', $row[$pointer])); $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); - $vertical_display['data'][$foo][$i] = ' ' . $row[$pointer] . '' . "\n"; + $vertical_display['data'][$row_no][$i] = ' ' . $row[$pointer] . '' . "\n"; } else { - $vertical_display['data'][$foo][$i] = '  ' . "\n"; + $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } } } else { if (!isset($row[$meta->name]) || (function_exists('is_null') && is_null($row[$pointer]))) { - $vertical_display['data'][$foo][$i] = ' NULL' . "\n"; + $vertical_display['data'][$row_no][$i] = ' NULL' . "\n"; } else if ($row[$pointer] != '') { // loic1: support blanks in the key $relation_id = $row[$pointer]; @@ -1004,32 +992,32 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ $row[$pointer] = str_replace("\011", '    ', str_replace(' ', '  ', $row[$pointer])); $row[$pointer] = ereg_replace("((\015\012)|(\015)|(\012))", '
', $row[$pointer]); } - $vertical_display['data'][$foo][$i] = ' '; + $vertical_display['data'][$row_no][$i] = ' '; if (isset($map[$meta->name])) { - $vertical_display['data'][$foo][$i] .= '' - . $row[$pointer] . ''; + $vertical_display['data'][$row_no][$i] .= '' + . $row[$pointer] . ''; } else { - $vertical_display['data'][$foo][$i] .= $row[$pointer]; + $vertical_display['data'][$row_no][$i] .= $row[$pointer]; } - $vertical_display['data'][$foo][$i] .= ' ' . "\n"; + $vertical_display['data'][$row_no][$i] .= ' ' . "\n"; } else { - $vertical_display['data'][$foo][$i] = '  ' . "\n"; + $vertical_display['data'][$row_no][$i] = '  ' . "\n"; } } // lem9: output stored cell if ($disp_direction == 'horizontal') { - echo $vertical_display['data'][$foo][$i]; + echo $vertical_display['data'][$row_no][$i]; } - if (isset($vertical_display['rowdata'][$i][$foo])) { - $vertical_display['rowdata'][$i][$foo] .= $vertical_display['data'][$foo][$i]; + if (isset($vertical_display['rowdata'][$i][$row_no])) { + $vertical_display['rowdata'][$i][$row_no] .= $vertical_display['data'][$row_no][$i]; } else { - $vertical_display['rowdata'][$i][$foo] = $vertical_display['data'][$foo][$i]; + $vertical_display['rowdata'][$i][$row_no] = $vertical_display['data'][$row_no][$i]; } } // end for (2) @@ -1065,33 +1053,33 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){ // 4. Gather links of del_urls and edit_urls in an array for later // output - if (!isset($vertical_display['edit'][$foo])) { - $vertical_display['edit'][$foo] = ''; - $vertical_display['delete'][$foo] = ''; + if (!isset($vertical_display['edit'][$row_no])) { + $vertical_display['edit'][$row_no] = ''; + $vertical_display['delete'][$row_no] = ''; } if (isset($edit_url)) { - $vertical_display['edit'][$foo] .= ' ' . "\n" - . ' ' . "\n" - . ' ' . $edit_str . '' . "\n" - . ' ' . "\n"; + $vertical_display['edit'][$row_no] .= ' ' . "\n" + . ' ' . "\n" + . ' ' . $edit_str . '' . "\n" + . ' ' . "\n"; } if (isset($del_url)) { - $vertical_display['delete'][$foo] .= ' ' . "\n" - . ' ' . "\n" + . ' ' . "\n" - . ' ' . "\n"; + $vertical_display['delete'][$row_no] .= '>' . "\n" + . ' ' . $del_str . '' . "\n" + . ' ' . "\n"; } echo (($disp_direction == 'horizontal') ? "\n" : ''); - $foo++; - } // end for + $row_no++; + } // end while return TRUE; } // end of the 'PMA_displayTableBody()' function diff --git a/libraries/functions.js b/libraries/functions.js index e41df0f13..37641a090 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -297,18 +297,25 @@ function checkTransmitDump(theForm, theAction) } // end of the 'checkTransmitDump()' function +/** + * This array is used to remember mark status of rows in browse mode + */ +var marked_row = new Array; + + /** * Sets/unsets the pointer and marker in browse mode * - * @param object the table row - * @param string the action calling this script (over, out or click) - * @param string the default background color - * @param string the color to use for mouseover - * @param string the color to use for marking a row + * @param object the table row + * @param interger the row number + * @param string the action calling this script (over, out or click) + * @param string the default background color + * @param string the color to use for mouseover + * @param string the color to use for marking a row * * @return boolean whether pointer is set or not */ -function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor) +function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor) { var theCells = null; @@ -353,27 +360,32 @@ function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMark if (currentColor == '' || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) { if (theAction == 'over' && thePointerColor != '') { - newColor = thePointerColor; + newColor = thePointerColor; } else if (theAction == 'click' && theMarkColor != '') { - newColor = theMarkColor; + newColor = theMarkColor; } } // 4.1.2 Current color is the pointer one - else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) { + else if (currentColor.toLowerCase() == thePointerColor.toLowerCase() + && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) { if (theAction == 'out') { - newColor = theDefaultColor; + newColor = theDefaultColor; } else if (theAction == 'click' && theMarkColor != '') { - newColor = theMarkColor; + newColor = theMarkColor; + marked_row[theRowNum] = true; } } // 4.1.3 Current color is the marker one else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) { if (theAction == 'click') { - newColor = (thePointerColor != '') - ? thePointerColor - : theDefaultColor; + newColor = (thePointerColor != '') + ? thePointerColor + : theDefaultColor; + marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]) + ? true + : null; } } // end 4