RFE #1433382 visulal feat. request for left bar

This commit is contained in:
Sebastian Mendel
2006-02-20 13:29:06 +00:00
parent 6e2ee9e001
commit 3d83605027
3 changed files with 117 additions and 31 deletions

View File

@@ -13,6 +13,8 @@ $Source$
- RFE #1434196 More significant digits in /status - RFE #1434196 More significant digits in /status
- replaced number_format() with PMA_formatNumber() - replaced number_format() with PMA_formatNumber()
- coding standards - coding standards
* js/querywindow.js, css/phpmyadmin.css.php:
- RFE #1433382 visulal feat. request for left bar
2006-02-19 Marc Delisle <lem9@users.sourceforge.net> 2006-02-19 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: re-establish previous error reporting mode * libraries/common.lib.php: re-establish previous error reporting mode

View File

@@ -692,6 +692,20 @@ li#li_flush_privileges {
<?php <?php
} // end styles 2.7.1 } // end styles 2.7.1
if ( $_SESSION['PMA_Theme']->checkVersion( '2.9' ) ) {
?>
/********************/
/* NEW in PMA 2.9 */
/********************/
<?php if ( $GLOBALS['cfg']['BrowseMarkerColor'] ) { ?>
div#left_tableList li.marked {
background-color: <?php echo $GLOBALS['cfg']['BrowseMarkerColor']; ?>;
}
<?php } ?>
<?php
} // end styles 2.9
$_SESSION['PMA_Theme']->loadCss( $_REQUEST['js_frame'] ); $_SESSION['PMA_Theme']->loadCss( $_REQUEST['js_frame'] );
?> ?>

View File

@@ -3,23 +3,25 @@ var querywindow = '';
/** /**
* sets current selected db * sets current selected db
* *
* @param string db name * @param string db name
*/ */
function setDb( new_db ) { function setDb( new_db ) {
//alert('setDb(' + new_db + ')'); //alert('setDb(' + new_db + ')');
if ( new_db != db ) { if ( new_db != db ) {
// db has changed // db has changed
//alert( new_db + '(' + new_db.length + ') : ' + db ); //alert( new_db + '(' + new_db.length + ') : ' + db );
db = new_db; if ( window.frames[0].document.getElementById(new_db) == null ) {
if ( window.frames[0].document.getElementById( db ) == null ) {
// db is unknown, reload complete left frame // db is unknown, reload complete left frame
refreshLeft(); refreshLeft();
} else {
unmarkDbTable(db);
markDbTable(new_db);
} }
db = new_db;
// TODO: add code to expand db in lightview mode // TODO: add code to expand db in lightview mode
// refresh querywindow // refresh querywindow
refreshQuerywindow(); refreshQuerywindow();
} }
@@ -28,23 +30,24 @@ function setDb( new_db ) {
/** /**
* sets current selected table (called from left.php) * sets current selected table (called from left.php)
* *
* @param string table name * @param string table name
*/ */
function setTable( new_table ) { function setTable( new_table ) {
//alert('setTable(' + new_table + ')'); //alert('setTable(' + new_table + ')');
if ( new_table != table ) { if ( new_table != table ) {
// table has changed // table has changed
//alert( new_table + '(' + new_table.length + ') : ' + table ); //alert( new_table + '(' + new_table.length + ') : ' + table );
table = new_table; table = new_table;
if ( window.frames[0].document.getElementById( db + '.' + table ) == null ) { if ( window.frames[0].document.getElementById( db + '.' + table ) == null
&& table != '' ) {
// table is unknown, reload complete left frame // table is unknown, reload complete left frame
refreshLeft(); refreshLeft();
} }
// TODO: add code to expand table in lightview mode // TODO: add code to expand table in lightview mode
// refresh querywindow // refresh querywindow
refreshQuerywindow(); refreshQuerywindow();
} }
@@ -58,23 +61,86 @@ function refreshMain( url ) {
url = 'main.php'; url = 'main.php';
} }
} }
goTo( url + '?&server=' + server + goTo( url + '?&server=' + server +
'&db=' + db + '&db=' + db +
'&table=' + table + '&table=' + table +
'&lang=' + lang + '&lang=' + lang +
'&collation_connection=' + collation_connection, '&collation_connection=' + collation_connection,
'main' ); 'main' );
} }
function refreshLeft() { function refreshLeft() {
goTo('left.php?&server=' + server + goTo('left.php?&server=' + server +
'&db=' + db + '&db=' + db +
'&table=' + table + '&table=' + table +
'&lang=' + lang + '&lang=' + lang +
'&collation_connection=' + collation_connection '&collation_connection=' + collation_connection
); );
} }
/**
* adds class to element
*/
function addClass(element, classname)
{
if (element != null) {
element.className += ' ' + classname;
//alert('set class: ' + classname + ', now: ' + element.className);
}
}
/**
* removes class from element
*/
function removeClass(element, classname)
{
if (element != null) {
element.className = element.className.replace(' ' + classname, '');
// if there is no other class anem there is no leading space
element.className = element.className.replace(classname, '');
//alert('removed class: ' + classname + ', now: ' + element.className);
}
}
function unmarkDbTable(db, table)
{
var element_reference = window.frames[0].document.getElementById(db);
if (element_reference != null) {
//alert('remove from: ' + db);
removeClass(element_reference.parentNode, 'marked');
}
element_reference = window.frames[0].document.getElementById(db + '.' + table);
if (element_reference != null) {
//alert('remove from: ' + db + '.' + table);
removeClass(element_reference.parentNode, 'marked');
}
}
function markDbTable(db, table)
{
var element_reference = window.frames[0].document.getElementById(db);
if (element_reference != null) {
addClass(element_reference.parentNode, 'marked');
// scrolldown
element_reference.focus();
// opera marks the text, we dont want this ...
element_reference.blur();
}
element_reference = window.frames[0].document.getElementById(db + '.' + table);
if (element_reference != null) {
addClass(element_reference.parentNode, 'marked');
// scrolldown
element_reference.focus();
// opera marks the text, we dont want this ...
element_reference.blur();
}
// return to main frame ...
window.frames[1].focus();
}
/** /**
* sets current selected server, table and db (called from libraries/footer.inc.php) * sets current selected server, table and db (called from libraries/footer.inc.php)
*/ */
@@ -89,20 +155,24 @@ function setAll( new_lang, new_collation_connection, new_server, new_db, new_tab
collation_connection = new_collation_connection; collation_connection = new_collation_connection;
lang = new_lang; lang = new_lang;
refreshLeft(); refreshLeft();
} } else if ( new_db != db || new_table != table ) {
else if ( new_db != db || new_table != table ) {
// save new db and table // save new db and table
db = new_db; var old_db = db;
table = new_table; var old_table = table;
db = new_db;
table = new_table;
if ( window.frames[0].document.getElementById( db ) == null if ( window.frames[0].document.getElementById( db ) == null
&& window.frames[0].document.getElementById( db + '.' + table ) == null ) { && window.frames[0].document.getElementById( db + '.' + table ) == null ) {
// table or db is unknown, reload complete left frame // table or db is unknown, reload complete left frame
refreshLeft(); refreshLeft();
} else {
unmarkDbTable(old_db, old_table);
markDbTable(db, table);
} }
// TODO: add code to expand db in lightview mode // TODO: add code to expand db in lightview mode
// refresh querywindow // refresh querywindow
refreshQuerywindow(); refreshQuerywindow();
} }
@@ -116,7 +186,7 @@ function reload_querywindow( db, table, sql_query ) {
querywindow.document.querywindow.query_history_latest_db.value = db; querywindow.document.querywindow.query_history_latest_db.value = db;
querywindow.document.querywindow.table.value = table; querywindow.document.querywindow.table.value = table;
querywindow.document.querywindow.query_history_latest_table.value = table; querywindow.document.querywindow.query_history_latest_table.value = table;
if ( sql_query ) { if ( sql_query ) {
querywindow.document.querywindow.query_history_latest.value = sql_query; querywindow.document.querywindow.query_history_latest.value = sql_query;
} }
@@ -128,7 +198,7 @@ function reload_querywindow( db, table, sql_query ) {
function focus_querywindow( sql_query ) { function focus_querywindow( sql_query ) {
if ( querywindow && !querywindow.closed && querywindow.location) { if ( querywindow && !querywindow.closed && querywindow.location) {
var querywindow = querywindow; //var querywindow = querywindow;
if ( querywindow.document.querywindow.querydisplay_tab != 'sql' ) { if ( querywindow.document.querywindow.querydisplay_tab != 'sql' ) {
querywindow.document.querywindow.querydisplay_tab.value = "sql"; querywindow.document.querywindow.querydisplay_tab.value = "sql";
querywindow.document.querywindow.query_history_latest.value = sql_query; querywindow.document.querywindow.query_history_latest.value = sql_query;
@@ -212,7 +282,7 @@ function goTo( targeturl, target ) {
} else if ( target.location.href == pma_absolute_uri + targeturl ) { } else if ( target.location.href == pma_absolute_uri + targeturl ) {
return true; return true;
} }
if ( safari_browser ) { if ( safari_browser ) {
target.location.href = targeturl; target.location.href = targeturl;
} else { } else {
@@ -241,6 +311,6 @@ function updateTableTitle( table_link_id, new_title ) {
left.getElementById('browse_' + table_link_id).title = new_title; left.getElementById('browse_' + table_link_id).title = new_title;
return true; return true;
} }
return false; return false;
} }