diff options
author | chriskl | 2003-12-15 07:59:22 +0000 |
---|---|---|
committer | chriskl | 2003-12-15 07:59:22 +0000 |
commit | aef102943db37fca76280ec69a8ffd6780847831 (patch) | |
tree | e498750cea5d81ae7a246a69b638542c22b5f86f | |
parent | a61bea3f657c6cd4c11d8918911fd7a2311fd5f8 (diff) |
update from bryan encina that makes the pop-up SQL and Find feature default to the current database. added bryan to the CREDITS list
-rw-r--r-- | CREDITS | 2 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | browser.php | 16 | ||||
-rw-r--r-- | links.js | 14 | ||||
-rw-r--r-- | sqledit.php | 4 | ||||
-rwxr-xr-x | topbar.php | 7 |
6 files changed, 35 insertions, 9 deletions
@@ -42,3 +42,5 @@ Contributors - Mark Gibson (Pop-up SQL window) - Nicola Soranzo - Oliver Meyer & Sven Kiera (Table icons link to browse table) +- Bryan Encina (SQL window improvements, bug fixes) + @@ -8,6 +8,7 @@ Features * Database dump feature, which uses pg_dump * Large speed improvements by reducing number of database connections and using external style sheet. +* SQL pop-up window now defaults to the current database Bugs * Object browser fixed for databases with no schemas diff --git a/browser.php b/browser.php index ee3ab85e..fbf60e60 100644 --- a/browser.php +++ b/browser.php @@ -5,7 +5,7 @@ * if you click on a database it shows a list of database objects in that * database. * - * $Id: browser.php,v 1.29 2003/12/10 16:03:29 chriskl Exp $ + * $Id: browser.php,v 1.30 2003/12/15 07:59:22 chriskl Exp $ */ // Include application functions @@ -15,7 +15,7 @@ include_once('classes/HTML_TreeMenu/TreeMenu.php'); // Output header - $misc->printHeader('', "<script src=\"classes/HTML_TreeMenu/TreeMenu.js\" type=\"text/javascript\"></script>"); + $misc->printHeader('', "<script src=\"classes/HTML_TreeMenu/TreeMenu.js\" type=\"text/javascript\"></script>\n<script src=\"links.js\" type=\"text/javascript\"></script>"); $misc->printBody('browser'); // Construct expanding tree @@ -186,9 +186,13 @@ while (!$databases->EOF) { // If database is selected, show folder, otherwise show document if (isset($_REQUEST['database']) && $_REQUEST['database'] == $databases->f[$data->dbFields['dbname']]) { + // Very ugly hack to work around the fact that the PEAR HTML_Tree can't have links with embedded + // apostrophes create the get string we need to append + $jsLink = '?database=' . addslashes(htmlspecialchars(urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID)); + $jsLink = "javascript:updateLinks(' + \"'{$jsLink}'\" + ')"; $db_node = &new HTML_TreeNode(array( 'text' => addslashes($misc->printVal($databases->f[$data->dbFields['dbname']])), - 'link' => addslashes(htmlspecialchars('database.php?database=' . urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID)), + 'link' => $jsLink, 'icon' => "../../../images/themes/{$conf['theme']}/database.png", 'expandedIcon' => "../../../images/themes/{$conf['theme']}/database.png", 'expanded' => true, @@ -266,9 +270,13 @@ $root->addItem($db_node); } else { + // Very ugly hack to work around the fact that the PEAR HTML_Tree can't have links with embedded + // apostrophes create the get string we need to append + $jsLink = '?database=' . addslashes(htmlspecialchars(urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID)); + $jsLink = "javascript:updateLinks(' + \"'{$jsLink}'\" + ')"; $db_node = &new HTML_TreeNode(array( 'text' => addslashes($misc->printVal($databases->f[$data->dbFields['dbname']])), - 'link' => addslashes(htmlspecialchars("{$_SERVER['PHP_SELF']}?database=" . urlencode($databases->f[$data->dbFields['dbname']]) . '&' . SID)), + 'link' => $jsLink, 'icon' => "../../../images/themes/{$conf['theme']}/database.png", 'expandedIcon' => "../../../images/themes/{$conf['theme']}/database.png", 'expanded' => false, diff --git a/links.js b/links.js new file mode 100644 index 00000000..cc7c3537 --- /dev/null +++ b/links.js @@ -0,0 +1,14 @@ +/** + * Function for updating browser frame and topbar frame so that sqledit window + * pops up with properly selected database. + * + * $Id: links.js,v 1.1 2003/12/15 07:59:22 chriskl Exp $ + */ +function updateLinks(getVars) { + var topbarLink = 'topbar.php' + getVars + var browserLink = 'browser.php' + getVars + + parent.frames.topbar.location = topbarLink; + parent.frames.browser.location = browserLink; +} + diff --git a/sqledit.php b/sqledit.php index 18af9871..f87b9ced 100644 --- a/sqledit.php +++ b/sqledit.php @@ -3,7 +3,7 @@ /** * Alternative SQL editing window * - * $Id: sqledit.php,v 1.8 2003/12/10 16:03:29 chriskl Exp $ + * $Id: sqledit.php,v 1.9 2003/12/15 07:59:22 chriskl Exp $ */ // Include application functions @@ -27,7 +27,7 @@ while (!$databases->EOF) { $dbname = $databases->f[$data->dbFields['dbname']]; echo "<option value=\"", htmlspecialchars($dbname), "\"", - (isset($_REQUEST['database']) && $dbname == $_REQUEST['database']) ? ' selected="selected"' : '', ">", + ((isset($_REQUEST['database']) && $dbname == $_REQUEST['database']) || (isset($_REQUEST['seldatabase']) && $dbname == $_REQUEST['seldatabase'])) ? ' selected="selected"' : '', ">", htmlspecialchars($dbname), "</option>\n"; $databases->moveNext(); } @@ -3,7 +3,7 @@ /** * Top menu for phpPgAdmin * - * $Id: topbar.php,v 1.18 2003/09/17 09:03:15 chriskl Exp $ + * $Id: topbar.php,v 1.19 2003/12/15 07:59:22 chriskl Exp $ */ // Include application functions @@ -11,6 +11,7 @@ $misc->printHeader(); $misc->printBody('topbar'); + $dbselected = isset($_REQUEST['database']) ? '&seldatabase=' . $_REQUEST['database'] : ''; ?> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="topbar"> <tr> @@ -38,8 +39,8 @@ <?php if ($conf['show_reports']) : ?> <a class="toplink" href="reports.php" target="detail"><?php echo $lang['strreports'] ?></a> | <?php endif; ?> - <a class="toplink" href="sqledit.php" target="sqledit" onclick="window.open('sqledit.php?action=sql&<?php echo SID ?>','sqledit','toolbar=no,width=600,height=400,resizable=yes,scrollbars=no').focus(); return false;"><?php echo $lang['strsql'] ?></a> | - <a class="toplink" href="sqledit.php" target="sqledit" onclick="window.open('sqledit.php?action=find&<?php echo SID ?>','sqledit','toolbar=no,width=600,height=400,resizable=yes,scrollbars=no').focus(); return false;"><?php echo $lang['strfind'] ?></a> | + <a class="toplink" href="sqledit.php" target="sqledit" onclick="window.open('sqledit.php?action=sql<?php echo $dbselected ?>&<?php echo SID ?>','sqledit','toolbar=no,width=600,height=400,resizable=yes,scrollbars=no').focus(); return false;"><?php echo $lang['strsql'] ?></a> | + <a class="toplink" href="sqledit.php" target="sqledit" onclick="window.open('sqledit.php?action=find<?php echo $dbselected ?>&<?php echo SID ?>','sqledit','toolbar=no,width=600,height=400,resizable=yes,scrollbars=no').focus(); return false;"><?php echo $lang['strfind'] ?></a> | <a class="toplink" href="logout.php" target="_parent"><?php echo $lang['strlogout'] ?></a> </td> </tr> |