From 7b1d7b42ccfb966de28a396b88420cecb84edb3b Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 4 Aug 2005 14:47:31 +0000 Subject: [PATCH] patch #1246245, tree in databases selector --- ChangeLog | 4 ++++ config.inc.php | 2 ++ footer.inc.php | 3 ++- libraries/common.lib.php | 2 +- libraries/config_import.lib.php | 8 ++++++++ queryframe.php | 22 +++++++++++++++++++++- 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea825838e..1612e6907 100755 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,10 @@ $Source$ thanks to Sebastian Mendel * Documentation.html: patch #1169308, FAQ 1.17a improved, thanks to Isaac Bennetch + * queryframe.php, footer.inc.php, config.inc.php, Documentation.html, + libraries/common.lib.php, /config_import.lib.php: + patch #1246245, tree subgroups for databases (in selector), + thanks to Edward Rudd - urkle 2005-08-02 Marc Delisle * server_privileges.php: patch #1249363, remove unneeded wordwrap(), diff --git a/config.inc.php b/config.inc.php index 4870985ba..4d5e7669e 100644 --- a/config.inc.php +++ b/config.inc.php @@ -228,6 +228,8 @@ $cfg['AllowArbitraryServer'] = FALSE; // allow login to any user entered ser // Left frame setup $cfg['LeftFrameLight'] = TRUE; // use a select-based menu and display only the // current tables in the left frame. +$cfg['LeftFrameDBTree'] = TRUE; // turn the select-based light menu into a tree +$cfg['LeftFrameDBSeparator'] = '_'; // the separator to sub-tree the select-based light menu tree $cfg['LeftFrameTableSeparator']= '__'; // Which string will be used to generate table prefixes // to split/nest tables into multiple categories $cfg['LeftFrameTableLevel'] = '1'; // How many sublevels should be displayed when splitting diff --git a/footer.inc.php b/footer.inc.php index 427972656..b0e764793 100644 --- a/footer.inc.php +++ b/footer.inc.php @@ -58,7 +58,8 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) { if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) { selidx = parent.frames.queryframe.document.left.lightm_db.selectedIndex; if (parent.frames.queryframe.document.left.lightm_db.options[selidx].value == "" && forceQueryFrameReload == false) { - parent.frames.queryframe.document.left.lightm_db.options[selidx].text = ""; + parent.frames.queryframe.document.left.lightm_db.options[selidx].text = + parent.frames.queryframe.document.left.lightm_db.options[selidx].text.replace(/(.*)\([0-9]+\)/,'$1'); } else { parent.frames.queryframe.location.reload(); setTimeout("dbBoxSetup();",2000); diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 71805d448..f4a32941d 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -145,7 +145,7 @@ if (isset($cfg['FileRevision'])) { } else { $cfg['FileRevision'] = array(1, 1); } -if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 61)) { +if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 62)) { require_once('./libraries/config_import.lib.php'); } diff --git a/libraries/config_import.lib.php b/libraries/config_import.lib.php index ea614b90a..4beead360 100644 --- a/libraries/config_import.lib.php +++ b/libraries/config_import.lib.php @@ -308,6 +308,14 @@ if (!isset($cfg['LeftFrameLight'])) { } } +if (!isset($cfg['LeftFrameDBTree'])) { + $cfg['LeftFrameDBTree'] = TRUE; +} + +if (!isset($cfg['LeftFrameDBSeparator'])) { + $cfg['LeftFrameDBSeparator'] = '_'; +} + if (!isset($cfg['LeftFrameTableSeparator'])) { $cfg['LeftFrameTableSeparator'] = '__'; } diff --git a/queryframe.php b/queryframe.php index a468ef334..a46fc03bf 100644 --- a/queryframe.php +++ b/queryframe.php @@ -300,7 +300,7 @@ if ($num_dbs > 1) { $i++; } } - + $parent = ''; // Gets the tables list per database for ($i = 0; $i < $num_dbs; $i++) { $db = $dblist[$i]; @@ -360,6 +360,26 @@ if ($num_dbs > 1) { $selected = ''; } // end if... else... + if ($cfg['LeftFrameDBTree']) { + $parts = explode($cfg['LeftFrameDBSeparator'],$db,2); + if (count($parts) == 1) { + if (!empty($parent)) { + echo ' ' + . ''."\n"; + $parent = ''; + } + } else { + if ($parent != $parts[0]) { + if (!empty($parent)) { + echo ' ' + . ''."\n"; + } + echo ' ' + . ''."\n"; + $parent = $parts[0]; + } + } + } if (!empty($num_tables)) { echo ' ' . '