Improved the "mark row" feature so it can be used with the "pointer" one
This commit is contained in:
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2002-03-23 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
* config.inc.php3, lines 189-192; Documentation.html, lines 853-866;
|
||||
libraries/common.lib.php3, lines 127-129;
|
||||
libraries/display_tbl.lib.php3, lines 771-779;
|
||||
libraries/functions.js, lines 300-398: improved the "mark row" feature so
|
||||
it can be used with the "pointer" one.
|
||||
|
||||
2002-03-22 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* finnish, norwegian updates
|
||||
* ### 2.2.5 released ###
|
||||
|
@@ -850,18 +850,18 @@
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
<dt><b>$cfgBrowsePointerColor </b>string [HTML color]</dt>
|
||||
<dt>
|
||||
<b>$cfgBrowsePointerColor </b>string [HTML color]<br />
|
||||
<b>$cfgBrowseMarkerColor </b>string [HTML color]
|
||||
</dt>
|
||||
<dd>
|
||||
The color (HTML) used for the pointer in browse mode (does not work
|
||||
with NS4).
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
<dt><b>$cfgBrowseMarkRow </b>boolean</dt>
|
||||
<dd>
|
||||
If the value is 1, you can visually mark rows with the color in
|
||||
<tt>$cfgBrowsePointerColor</tt>, by clicking on them. Works on browsers
|
||||
that support 'onmousedown'.
|
||||
The colors (HTML) used for the pointer and the marker in browse mode
|
||||
(does not work with NS4).<br />
|
||||
The former feature enlights the row you're mouse is passing over and
|
||||
the latter lets you visually mark/unmark rows by clicking on
|
||||
them.<br />
|
||||
You can disable both of these features by emptying the convenient
|
||||
directive.
|
||||
<br /><br />
|
||||
</dd>
|
||||
|
||||
|
@@ -186,10 +186,9 @@ $cfgBgcolorOne = '#CCCCCC'; // table data row colour
|
||||
$cfgBgcolorTwo = '#DDDDDD'; // table data row colour, alternate
|
||||
$cfgBrowsePointerColor = '#CCFFCC'; // color of the pointer in browse mode
|
||||
// (blank for no pointer)
|
||||
$cfgBrowseMarkRow = 0; // if set to 1,
|
||||
// and $cfgBrowsePointerColor has a
|
||||
// value, you can click on rows to
|
||||
// visually mark them with this color
|
||||
$cfgBrowseMarkerColor = '#FFCC99'; // color of the marker (visually marks row
|
||||
// by clicking on it) in browse mode
|
||||
// (blank for no marker)
|
||||
$cfgTextareaCols = 40; // textarea size (columns) in edit mode
|
||||
$cfgTextareaRows = 7; // textarea size (rows) in edit mode
|
||||
$cfgLimitChars = 50; // max field data length in browse mode
|
||||
|
@@ -124,8 +124,8 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
if (!isset($cfgBrowsePointerColor)) {
|
||||
$cfgBrowsePointerColor = '';
|
||||
}
|
||||
if (!isset($cfgBrowseMarkRow)) {
|
||||
$cfgBrowseMarkRow = 0;
|
||||
if (!isset($cfgBrowseMarkerColor)) {
|
||||
$cfgBrowseMarkerColor = '';
|
||||
}
|
||||
if (!isset($cfgTextareaCols)) {
|
||||
$cfgTextareaCols = 40;
|
||||
@@ -552,8 +552,8 @@ if (!defined('PMA_COMMON_LIB_INCLUDED')){
|
||||
|
||||
// 'only_db' is empty for the current user...
|
||||
else {
|
||||
// ... first checks whether the "safe_show_database"
|
||||
// is on or not (if MYSQL supports this)
|
||||
// ... first checks whether the "safe_show_database" is on or not
|
||||
// (if MYSQL supports this)
|
||||
if (defined('PMA_MYSQL_INT_VERSION') &&
|
||||
PMA_MYSQL_INT_VERSION >= 32330) {
|
||||
$local_query = 'SHOW VARIABLES LIKE \'safe_show_database\'';
|
||||
|
@@ -768,12 +768,13 @@ if (!defined('PMA_DISPLAY_TBL_LIB_INCLUDED')){
|
||||
|
||||
if ($disp_direction == 'horizontal') {
|
||||
// loic1: pointer code part
|
||||
if ($GLOBALS['cfgBrowsePointerColor'] == '') {
|
||||
$on_mouse = '';
|
||||
} else if ($GLOBALS['cfgBrowseMarkRow'] == '1') {
|
||||
$on_mouse = ' onmousedown="setPointer(this, \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $bgcolor . '\')"';
|
||||
} else {
|
||||
$on_mouse = ' onmouseover="setPointer(this, \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $bgcolor . '\')" onmouseout="setPointer(this, \'' . $bgcolor . '\', \'' . $bgcolor . '\')"';
|
||||
if ($GLOBALS['cfgBrowsePointerColor'] != '') {
|
||||
$on_mouse = ' onmouseover="setPointer(this, \'over\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"'
|
||||
. ' onmouseout="setPointer(this, \'out\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"';
|
||||
}
|
||||
if ($GLOBALS['cfgBrowseMarkerColor'] != '') {
|
||||
$on_mouse .= ' onmousedown="setPointer(this, \'click\', \'' . $bgcolor . '\', \'' . $GLOBALS['cfgBrowsePointerColor'] . '\', \'' . $GLOBALS['cfgBrowseMarkerColor'] . '\')"';
|
||||
}
|
||||
?>
|
||||
<tr<?php echo $on_mouse; ?>>
|
||||
|
@@ -298,27 +298,28 @@ function checkTransmitDump(theForm, theAction)
|
||||
|
||||
|
||||
/**
|
||||
* The global array below will be used inside the "setPointer()" function
|
||||
*/
|
||||
var markedRow = new Array();
|
||||
|
||||
|
||||
/**
|
||||
* Sets/unsets the pointer in browse mode
|
||||
* Sets/unsets the pointer and marker in browse mode
|
||||
*
|
||||
* @param object the table row
|
||||
* @param object the color to use for this row
|
||||
* @param object the background color
|
||||
* @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, thePointerColor, theNormalBgColor)
|
||||
function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
|
||||
{
|
||||
var theCells = null;
|
||||
|
||||
if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
|
||||
// 1. Pointer and mark feature are disabled or the browser can't get the
|
||||
// row -> exits
|
||||
if ((thePointerColor == '' && theMarkColor == '')
|
||||
|| typeof(theRow.style) == 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 2. Gets the current row and exits if the browser can't get it
|
||||
if (typeof(document.getElementsByTagName) != 'undefined') {
|
||||
theCells = theRow.getElementsByTagName('td');
|
||||
}
|
||||
@@ -329,29 +330,69 @@ function setPointer(theRow, thePointerColor, theNormalBgColor)
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. Gets the current color...
|
||||
var rowCellsCnt = theCells.length;
|
||||
var domDetect = null;
|
||||
var currentColor = null;
|
||||
var newColor = null;
|
||||
// Opera does not return valid values with "getAttribute"
|
||||
// 3.1 ... with DOM compatible browsers except Opera that does not return
|
||||
// valid values with "getAttribute"
|
||||
if (typeof(window.opera) == 'undefined'
|
||||
&& typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
|
||||
&& typeof(theCells[0].getAttribute) != 'undefined') {
|
||||
currentColor = theCells[0].getAttribute('bgcolor');
|
||||
newColor = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
|
||||
? theNormalBgColor
|
||||
: thePointerColor;
|
||||
for (var c = 0; c < rowCellsCnt; c++) {
|
||||
domDetect = true;
|
||||
}
|
||||
// 3.2 ... with other browsers
|
||||
else {
|
||||
currentColor = theCells[0].style.backgroundColor;
|
||||
domDetect = false;
|
||||
} // end 3
|
||||
|
||||
// 4. Defines the new color
|
||||
// 4.1 Current color is the default one
|
||||
if (currentColor == ''
|
||||
|| currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
|
||||
if (theAction == 'over' && thePointerColor != '') {
|
||||
newColor = thePointerColor;
|
||||
}
|
||||
else if (theAction == 'click' && theMarkColor != '') {
|
||||
newColor = theMarkColor;
|
||||
}
|
||||
}
|
||||
// 4.1.2 Current color is the pointer one
|
||||
else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
|
||||
if (theAction == 'out') {
|
||||
newColor = theDefaultColor;
|
||||
}
|
||||
else if (theAction == 'click' && theMarkColor != '') {
|
||||
newColor = theMarkColor;
|
||||
}
|
||||
}
|
||||
// 4.1.3 Current color is the marker one
|
||||
else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
|
||||
if (theAction == 'click') {
|
||||
newColor = (thePointerColor != '')
|
||||
? thePointerColor
|
||||
: theDefaultColor;
|
||||
}
|
||||
} // end 4
|
||||
|
||||
// 5. Sets the new color...
|
||||
if (newColor) {
|
||||
var c = null;
|
||||
// 5.1 ... with DOM compatible browsers except Opera
|
||||
if (domDetect) {
|
||||
for (c = 0; c < rowCellsCnt; c++) {
|
||||
theCells[c].setAttribute('bgcolor', newColor, 0);
|
||||
} // end for
|
||||
}
|
||||
// 5.2 ... with other browsers
|
||||
else {
|
||||
currentColor = theCells[0].style.backgroundColor;
|
||||
newColor = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
|
||||
? theNormalBgColor
|
||||
: thePointerColor;
|
||||
for (var c = 0; c < rowCellsCnt; c++) {
|
||||
for (c = 0; c < rowCellsCnt; c++) {
|
||||
theCells[c].style.backgroundColor = newColor;
|
||||
}
|
||||
}
|
||||
} // end 5
|
||||
|
||||
return true;
|
||||
} // end of the 'setPointer()' function
|
||||
|
Reference in New Issue
Block a user