Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…

…ndow.

Have fun, surely needs some debugging. :)
  • Loading branch information...
commit 4d878ae9419cd24cc8701909cb93f51802dc8017 1 parent bee0503
Garvin Hicking authored
7 ChangeLog
View
@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$
$Source$
+2003-02-27 Garvin Hicking <me@supergarv.de>
+ * libraries/common.lib.php3, tbl_properties_links.php3, db_details_links.php3,
+ querywindow.php3: Integrated Manuzhais patch for Lightweight Tabs.
+ * querywindow.php3, tbl_query_box.php3, config.inc.php3, header.inc.php3, index.php3,
+ libraries/config_import.lib.php3: Added (optional) DB-based SQL-history with
+ purging on login, made querywindow tabbed, improved Querywindow-compatibility.
+
2003-02-26 Garvin Hicking <me@supergarv.de>
* lang/german-*: better grammar. ;)
* libraries/display_tbl.lib.php3: Fixed transformation-link variable
17 config.inc.php3
View
@@ -183,6 +183,7 @@ $cfg['UseDbSearch'] = TRUE; // whether to enable the "database searc
// Left frame setup
$cfg['LeftFrameLight'] = TRUE; // use a select-based menu and display only the
// current tables in the left frame.
+$cfg['LightTabs'] = FALSE; // use lightweight, graphically less intense menu-tabs
$cfg['ShowTooltip'] = TRUE; // display table comment as tooltip in left frame
$cfg['ShowTooltipAliasDB'] = FALSE; // if ShowToolTip is enabled, this defines that table/db comments
$cfg['ShowTooltipAliasTB'] = FALSE; // are shown (in the left menu and db_details_structure) instead of
@@ -373,8 +374,8 @@ $cfg['ModifyDeleteAtRight'] = FALSE; // show edit/delete links on right s
// (or at the bottom with vertical browse)
$cfg['DefaultDisplay'] = 'horizontal'; // default display direction
// (horizontal|vertical|horizontalflipped)
-$cfg['HeaderFlipType'] = 'css'; // table-header rotation via faking or css? (css|fake)
-$cfg['ShowBrowseComments'] = TRUE; // shows stored relation-comments in 'browse' mode.
+$cfg['HeaderFlipType'] = 'css'; // table-header rotation via faking or css? (css|fake)
+$cfg['ShowBrowseComments'] = TRUE; // shows stored relation-comments in 'browse' mode.
$cfg['ShowPropertyComments']= TRUE; // shows stored relation-comments in 'table property' mode.
$cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate)
@@ -382,9 +383,15 @@ $cfg['QueryFrame'] = TRUE; // displays a new frame where a link
$cfg['QueryFrameJS'] = TRUE; // whether to use JavaScript functions for opening a new window for SQL commands.
// if set to 'false', the target of the querybox is always the right frame.
$cfg['QueryFrameDebug'] = FALSE; // display JS debugging link (DEVELOPERS only)
-$cfg['QueryWindowWidth'] = 750; // Width of Query window
-$cfg['QueryWindowHeight'] = 300; // Height of Query window
-
+$cfg['QueryWindowWidth'] = 750; // Width of Query window
+$cfg['QueryWindowHeight'] = 300; // Height of Query window
+$cfg['QueryHistoryDB'] = FALSE; // Set to TRUE if you want DB-based query history.
+ // If FALSE, this utilizes JS-routines to display
+ // query history (lost by window close)
+$cfg['QueryWindowDefTab'] = 'sql'; // which tab to display in the querywindow on startup
+ // (sql|files|history|full)
+$cfg['QueryHistoryMax'] = 25; // When using DB-based query history, how many entries
+ // should be kept?
$cfg['BrowseMIME'] = TRUE; // Use MIME-Types (stored in column comments table) for
/**
20 db_details_links.php3
View
@@ -58,11 +58,15 @@ else {
/**
* Displays tab links
*/
-?>
-<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
+
+if ($cfg['LightTabs']) {
+ echo '&nbsp;';
+} else {
+ echo '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
<tr>
- <td width="8">&nbsp;</td>
-<?php
+ <td width="8">&nbsp;</td>';
+}
+
echo PMA_printTab($strStructure, 'db_details_structure.php3', $url_query);
echo PMA_printTab($strSQL, 'db_details.php3', $url_query . '&amp;db_query_force=1');
echo PMA_printTab($strExport, $lnk3, $arg3);
@@ -79,8 +83,12 @@ if ($lnk5) {
echo PMA_printTab($strDrop, $lnk5, $arg5, $att5);
} // end if
echo "\n";
+
+if (!$cfg['LightTabs']) {
+ echo '</tr></table>';
+} else {
+ echo '<br />';
+}
?>
- </tr>
-</table>
<br />
7 index.php3
View
@@ -41,6 +41,13 @@ if (isset($lightm_db)) {
$url_query = PMA_generate_common_url(isset($db) ? $db : '');
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
+
+require('./libraries/relation.lib.php3');
+$cfgRelation = PMA_getRelationsParam();
+
+if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
+ PMA_purgeHistory($cfg['Server']['user']);
+}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
41 libraries/common.lib.php3
View
@@ -1542,16 +1542,18 @@ if (typeof(document.getElementById) != 'undefined'
* @param string main link file, e.g. "test.php3"
* @param string link arguments
* @param string link attributes
+ * @param string include '?' even though no attributes are set. Can be set empty, should be '?'.
+ * @param boolean force display TAB as active
*
* @return string two table cells, the first beeing a separator, the second the tab itself
*
* @access public
*/
- function PMA_printTab($text, $link, $args = '', $attr = '') {
- global $PHP_SELF;
+ function PMA_printTab($text, $link, $args = '', $attr = '', $sep = '?', $active = false) {
+ global $PHP_SELF, $cfg;
global $db_details_links_count_tabs;
- if (basename($PHP_SELF) == $link
+ if ((basename($PHP_SELF) == $link || $active)
&& ($text != $GLOBALS['strEmpty'] && $text != $GLOBALS['strDrop'])) {
$bgcolor = 'silver';
} else {
@@ -1563,19 +1565,30 @@ if (typeof(document.getElementById) != 'undefined'
$attr = ' ' . $attr;
}
- $out = "\n" . ' '
- . '<td bgcolor="' . $bgcolor . '" align="center" width="64" nowrap="nowrap" class="tab">'
- . "\n" . ' ';
- if (strlen($link) > 0) {
- $out .= '<a href="' . $link . '?' . $args . '"' . $attr . '>'
- . '<b>' . $text . '</b></a>';
+ if ($cfg['LightTabs']) {
+ $out = '';
+ if (strlen($link) > 0) {
+ $out .= '<a href="' . $link . $sep . $args . '"' . $attr . '>'
+ . '<b>' . $text . '</b></a>';
+ } else {
+ $out .= '<b>' . $text . '</b>';
+ }
+ $out = '[ ' . $out . ' ]&nbsp;&nbsp;&nbsp;';
} else {
- $out .= '<b>' . $text . '</b>';
+ $out = "\n" . ' '
+ . '<td bgcolor="' . $bgcolor . '" align="center" width="64" nowrap="nowrap" class="tab">'
+ . "\n" . ' ';
+ if (strlen($link) > 0) {
+ $out .= '<a href="' . $link . $sep . $args . '"' . $attr . '>'
+ . '<b>' . $text . '</b></a>';
+ } else {
+ $out .= '<b>' . $text . '</b>';
+ }
+ $out .= "\n" . ' '
+ . '</td>'
+ . "\n" . ' '
+ . '<td width="8">&nbsp;</td>';
}
- $out .= "\n" . ' '
- . '</td>'
- . "\n" . ' '
- . '<td width="8">&nbsp;</td>';
return $out;
} // end of the 'PMA_printTab()' function
36 libraries/config_import.lib.php3
View
@@ -228,6 +228,15 @@ if (!defined('PMA_CONFIG_IMPORT_LIB_INCLUDED')) {
$cfg['LeftFrameLight'] = TRUE;
}
}
+
+ if (!isset($cfg['LightTabs'])) {
+ if (isset($cfgLightTabs)) {
+ $cfg['LightTabs'] = $cfgLightTabs;
+ unset($cfgLightTabs);
+ } else {
+ $cfg['LightTabs'] = FALSE;
+ }
+ }
if (!isset($cfg['ShowTooltip'])) {
if (isset($cfgShowTooltip)) {
@@ -698,6 +707,33 @@ if (!defined('PMA_CONFIG_IMPORT_LIB_INCLUDED')) {
}
}
+ if (!isset($cfg['QueryHistoryMax'])) {
+ if (isset($cfgQueryHistoryMax)) {
+ $cfg['QueryHistoryMax'] = $cfgQueryHistoryMax;
+ unset($cfgQueryHistoryMax);
+ } else {
+ $cfg['QueryHistoryMax'] = 25;
+ }
+ }
+
+ if (!isset($cfg['QueryHistoryDB'])) {
+ if (isset($cfgQueryHistoryDB)) {
+ $cfg['QueryHistoryDB'] = $cfgQueryHistoryDB;
+ unset($cfgQueryHistoryDB);
+ } else {
+ $cfg['QueryHistoryDB'] = FALSE;
+ }
+ }
+
+ if (!isset($cfg['QueryWindowDefTab'])) {
+ if (isset($cfgQueryWindowDefTab)) {
+ $cfg['QueryWindowDefTab'] = $cfgQueryWindowDefTab;
+ unset($cfgQueryWindowDefTab);
+ } else {
+ $cfg['QueryWindowDefTab'] = 'sql';
+ }
+ }
+
if (!isset($cfg['BrowseMIME'])) {
if (isset($cfgBrowseMIME)) {
$cfg['BrowseMIME'] = $cfgBrowseMIME;
91 libraries/relation.lib.php3
View
@@ -364,7 +364,7 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
$col = ($table != '' ? $row['column_name'] : $i);
if (strlen($row['comment']) > 0) {
- $comment[$col] = $row['comment'];
+ $comment[$col] = $row['comment'];
}
} // end while
@@ -395,8 +395,8 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
* @param string the name of the db
* @param string the name of the table
* @param string the name of the column
- * @param string the value of the column
- * @param string (optional) if a column is renamed, this is the name of the former key which will get deleted
+ * @param string the value of the column
+ * @param string (optional) if a column is renamed, this is the name of the former key which will get deleted
*
* @return boolean true, if comment-query was made.
*
@@ -455,5 +455,90 @@ if (!defined('PMA_RELATION_LIB_INCLUDED')){
return false;
}
} // end of 'PMA_setComment()' function
+
+/**
+ * Set a SQL history entry
+ *
+ * @param string the name of the db
+ * @param string the name of the table
+ * @param string the username
+ * @param string the sql query
+ *
+ * @return boolean true
+ *
+ * @access public
+ */
+ function PMA_setHistory($db, $table, $username, $sqlquery) {
+ global $cfgRelation;
+
+ $hist_rs = PMA_query_as_cu('INSERT INTO ' . PMA_backquote($cfgRelation['history']) . ' ('
+ . PMA_backquote('username') . ','
+ . PMA_backquote('db') . ','
+ . PMA_backquote('table') . ','
+ . PMA_backquote('timevalue') . ','
+ . PMA_backquote('sqlquery')
+ . ') VALUES ('
+ . '\'' . PMA_sqlAddslashes($username) . '\','
+ . '\'' . PMA_sqlAddslashes($db) . '\','
+ . '\'' . PMA_sqlAddslashes($table) . '\','
+ . 'NOW(),'
+ . '\'' . PMA_handleSlashes($sqlquery) . '\')');
+ return true;
+ } // end of 'PMA_setHistory()' function
+
+/**
+ * Gets a SQL history entry
+ *
+ * @param string the username
+ *
+ * @return array list of history items
+ *
+ * @access public
+ */
+ function PMA_getHistory($username) {
+ global $cfgRelation;
+
+ $hist_rs = PMA_query_as_cu('SELECT '
+ . PMA_backquote('db') . ','
+ . PMA_backquote('table') . ','
+ . PMA_backquote('sqlquery')
+ . ' FROM ' . PMA_backquote($cfgRelation['history']) . ' WHERE username = \'' . PMA_handleSlashes($username) . '\' ORDER BY timevalue DESC');
+
+ $history = array();
+
+ while ($row = @PMA_mysql_fetch_array($hist_rs)) {
+ $history[] = $row;
+ }
+
+ return $history;
+
+ } // end of 'PMA_getHistory()' function
+
+/**
+ * Set a SQL history entry
+ *
+ * @param string the name of the db
+ * @param string the name of the table
+ * @param string the username
+ * @param string the sql query
+ *
+ * @return boolean true
+ *
+ * @access public
+ */
+ function PMA_purgeHistory($username) {
+ global $cfgRelation, $cfg;
+
+ $purge_rs = PMA_query_as_cu('SELECT timevalue FROM ' . PMA_backquote($cfgRelation['history']) . ' WHERE username = \'' . PMA_handleSlashes($username) . '\' ORDER BY timevalue DESC LIMIT ' . $cfg['QueryHistoryMax'] . ', 1');
+ $i = 0;
+ $row = @PMA_mysql_fetch_array($purge_rs);
+
+ if (is_array($row) && $row[0] > 0) {
+ $maxtime = $row[0];
+ $remove_rs = PMA_query_as_cu('DELETE FROM ' . PMA_backquote($cfgRelation['history']) . ' WHERE timevalue <= ' . $maxtime);
+ }
+
+ return true;
+ } // end of 'PMA_purgeHistory()' function
} // $__PMA_RELATION_LIB__
?>
104 querywindow.php3
View
@@ -52,7 +52,6 @@ header('Pragma: no-cache'); // HTTP/1.0
// Define the charset to be used
header('Content-Type: text/html; charset=' . $charset);
-
/**
* Displays the frame
*/
@@ -77,6 +76,21 @@ PMA_setFontSizes();
.child {font-family: <?php echo $left_font_family; ?>; font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: <?php echo $font_smaller; ?>; color: #333399; text-decoration: none}
.tblItem:hover {color: #FF0000; text-decoration: underline}
+ td.tab {
+ border-top: 1px solid #999;
+ border-right: 1px solid #666;
+ border-left: 1px solid #999;
+ border-bottom: none;
+ border-radius: 2px;
+ -moz-border-radius: 2px;
+ }
+ table.tabs {
+ border-top: none;
+ border-right: none;
+ border-left: none;
+ border-bottom: 1px solid #666;
+ }
+
//-->
</style>
@@ -105,6 +119,12 @@ function query_auto_commit() {
document.sqlform.submit();
}
+function query_tab_commit(tab) {
+ document.querywindow.querydisplay_tab.value = tab;
+ document.querywindow.submit();
+ return false;
+}
+
// js form validation stuff
var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
@@ -119,6 +139,31 @@ var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '
<body bgcolor="<?php echo ($cfg['QueryFrameJS'] ? $cfg['LeftBgColor'] : $cfg['RightBgColor']); ?>">
<?php
+$querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']);
+
+if ($cfg['LightTabs']) {
+ echo '&nbsp;';
+} else {
+ echo '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
+ <tr>
+ <td width="8">&nbsp;</td>';
+}
+echo "\n";
+echo PMA_printTab($strSQL, '#', '', 'onClick="javascript:query_tab_commit(\'sql\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'sql' ? TRUE : FALSE));
+echo PMA_printTab($strImportFiles, '#', '', 'onClick="javascript:query_tab_commit(\'files\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'files' ? TRUE : FALSE));
+echo PMA_printTab($strQuerySQLHistory, '#', '', 'onClick="javascript:query_tab_commit(\'history\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'history' ? TRUE : FALSE));
+echo PMA_printTab($strAll, '#', '', 'onClick="javascript:query_tab_commit(\'full\');return false;"', '', (isset($querydisplay_tab) && $querydisplay_tab == 'full' ? TRUE : FALSE));
+
+if (!$cfg['LightTabs']) {
+ echo '</tr></table>';
+} else {
+ echo '<br />';
+}
+
+?>
+<br />
+
+<?php
// Hidden forms and query frame interaction stuff
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
@@ -127,11 +172,15 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
$dup_sql = array();
if (isset($query_history_latest) && isset($query_history_latest_db) && $query_history_latest != '' && $query_history_latest_db != '') {
+ if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
+ PMA_setHistory((isset($query_history_latest_db) ? $query_history_latest_db : ''), (isset($query_history_latest_table) ? $query_history_latest_table : ''), $cfg['Server']['user'], $query_history_latest);
+ }
+
$input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_history_latest . '" />';
$input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_latest_db) . '" />';
$input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '" />';
- $sql_history[] = '<li><a href="#" onClick="document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_history_latest) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_latest_db) . '] ' . urldecode($query_history_latest) . '</a></li>' . "\n";
+ $sql_history[] = '<li><a href="#" onClick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_history_latest) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_latest_db) . '] ' . urldecode($query_history_latest) . '</a></li>' . "\n";
$sql_query = urldecode($query_history_latest);
$db = $query_history_latest_db;
@@ -140,21 +189,38 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
$dup_sql[$query_history_latest] = true;
}
- if (isset($query_history) && is_array($query_history)) {
- $current_index = count($query_history);
- @reset($query_history);
- while(list($query_no, $query_sql) = each($query_history)) {
- if (!isset($dup_sql[$query_sql])) {
+ if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
- $input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_sql . '" />';
- $input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_db[$query_no]) . '" />';
- $input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '" />';
-
- $sql_history[] = '<li><a href="#" onClick="document.querywindow.query_history_latest.value = \'' . $query_sql . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_db[$query_no]) . '] ' . urldecode($query_sql) . '</a></li>' . "\n";
- $dup_sql[$query_sql] = true;
+ $temp_history = PMA_getHistory($cfg['Server']['user']);
+ if (is_array($temp_history) && count($temp_history) > 0) {
+ @reset($temp_history);
+ while(@list($history_nr, $history_array) = @each($temp_history)) {
+ if (!isset($dup_sql[$history_array['sqlquery']])) {
+ $sql_history[] = '<li><a href="#" onClick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($history_array['sqlquery']) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($history_array['db']) . '] ' . urldecode($history_array['sqlquery']) . '</a></li>' . "\n";
+ $dup_sql[$history_array['sqlquery']] = true;
+ }
}
}
- }
+
+ } else {
+
+ if (isset($query_history) && is_array($query_history)) {
+ $current_index = count($query_history);
+ @reset($query_history);
+ while(list($query_no, $query_sql) = each($query_history)) {
+ if (!isset($dup_sql[$query_sql])) {
+
+ $input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_sql . '" />';
+ $input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_db[$query_no]) . '" />';
+ $input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '" />';
+
+ $sql_history[] = '<li><a href="#" onClick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_sql) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_db[$query_no]) . '] ' . urldecode($query_sql) . '</a></li>' . "\n";
+ $dup_sql[$query_sql] = true;
+ } // end if check if this item exists
+ } // end while print history
+ } // end if history exists
+
+ } // end if DB-based history
}
$url_query = PMA_generate_common_url(isset($db) ? $db : '', isset($table) ? $table : '');
@@ -163,6 +229,7 @@ if (!isset($goto)) {
}
require './libraries/bookmark.lib.php3';
+$is_inside_querywindow = TRUE;
require './tbl_query_box.php3';
// Hidden forms and query frame interaction stuff
@@ -175,10 +242,10 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
<?php
}
- if (isset($sql_history) && is_array($sql_history) && count($sql_history) > 0) {
+ if (isset($sql_history) && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full') && is_array($sql_history) && count($sql_history) > 0) {
?>
<li>
- <div style="margin-bottom: 10px"><?php echo $strQuerySQLHistory . ' :<br><ul>' . implode('', $sql_history) . '</ul>'; ?></div>
+ <div style="margin-bottom: 10px"><?php echo $strQuerySQLHistory . ':<br><ul>' . implode('', $sql_history) . '</ul>'; ?></div>
</li>
<?php
}
@@ -190,8 +257,8 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
echo implode("\n", $input_query_history);
}
?>
- <input type="hidden" name="db" value="<?php (isset($db) && $db != '' ? $db : ''); ?>" />
- <input type="hidden" name="table" value="<?php (isset($table) && $table != '' ? $table : ''); ?>" />
+ <input type="hidden" name="db" value="<?php echo (isset($db) && $db != '' ? $db : ''); ?>" />
+ <input type="hidden" name="table" value="<?php echo (isset($table) && $table != '' ? $table : ''); ?>" />
<input type="hidden" name="query_history_latest" value="" />
<input type="hidden" name="query_history_latest_db" value="" />
@@ -200,6 +267,7 @@ if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
<input type="hidden" name="previous_db" value="<?php echo htmlspecialchars($db); ?>" />
<input type="hidden" name="auto_commit" value="false" />
+ <input type="hidden" name="querydisplay_tab" value="<?php echo $querydisplay_tab; ?>" />
</form>
<?php
}
24 tbl_properties_links.php3
View
@@ -54,11 +54,15 @@ $att7 = 'class="drop" onclick="return confirmLink(this, \'DROP TABLE ' . PMA_jsF
/**
* Displays links
*/
-?>
-<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
+
+if ($cfg['LightTabs']) {
+ echo '&nbsp;';
+} else {
+ echo '<table border="0" cellspacing="0" cellpadding="3" width="100%" class="tabs">
<tr>
- <td width="8">&nbsp;</td>
-<?php
+ <td width="8">&nbsp;</td>';
+}
+
echo PMA_printTab($strStructure, 'tbl_properties_structure.php3', $url_query);
echo PMA_printTab($strBrowse, $lnk2, $arg2);
echo PMA_printTab($strSQL, 'tbl_properties.php3', $url_query);
@@ -72,8 +76,12 @@ if (PMA_MYSQL_INT_VERSION >= 32322) {
echo PMA_printTab($strEmpty, $lnk6, $arg6, $att6);
echo PMA_printTab($strDrop, 'sql.php3', $arg7, $att7);
echo "\n";
-?>
- </tr>
-</table>
-<br />
+
+if (!$cfg['LightTabs']) {
+ echo '</tr></table>';
+} else {
+ echo '<br />';
+}
+
+?><br />
97 tbl_query_box.php3
View
@@ -81,9 +81,6 @@ if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$d
}
?>
- <!-- Query box and bookmark support -->
- <li>
- <a name="querybox"></a>
<form method="post" target="phpmain" action="read_dump.php3"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
onsubmit="return checkSqlQuery(this)" name="sqlform">
<input type="hidden" name="is_js_confirmed" value="0" />
@@ -92,14 +89,22 @@ if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] || ($cfg['QueryFrameJS'] && !$d
<input type="hidden" name="goto" value="<?php echo $goto; ?>" />
<input type="hidden" name="zero_rows" value="<?php echo $strSuccess; ?>" />
<input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? urlencode($query_to_display) : ''); ?>" />
+
+<?php
+if (!isset($is_inside_querywindow) ||
+ (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
+?>
+ <!-- Query box and bookmark support -->
+ <li>
+ <a name="querybox"></a>
<?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . $queryframe_db_list . ' ' . PMA_showMySQLDocu('Reference', 'SELECT') . '&nbsp;&nbsp;&nbsp;' . $strFields . ':' . "\n"; ?>
<select name="dummy" size="1">
<?php
-echo "\n";
-for ($i = 0 ; $i < $fields_cnt; $i++) {
- echo ' '
- . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
-}
+ echo "\n";
+ for ($i = 0 ; $i < $fields_cnt; $i++) {
+ echo ' '
+ . '<option value="' . urlencode($fields_list[$i]) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
+ }
?>
</select>
<input type="button" name="insert" value="<?php echo($strInsert); ?>" onclick="sqlform.sql_query.value = sqlform.sql_query.value + sqlform.dummy.value" />
@@ -112,9 +117,17 @@ for ($i = 0 ; $i < $fields_cnt; $i++) {
<label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
</div>
<?php
+} else {
+?>
+ <input type="hidden" name="sql_query" value="" />
+ <input type="hidden" name="show_query" value="1" />
+<?php
+}
+
// loic1: displays import dump feature only if file upload available
-if ($is_upload) {
- echo ' <i>' . $strOr . '</i> ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
+if ($is_upload && (!isset($is_inside_querywindow) ||
+ (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))) {
+ echo ' ' . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? '<i>' . $strOr . '</i>' : '') . ' ' . $strLocationTextfile . '&nbsp;:<br />' . "\n";
?>
<div style="margin-bottom: 5px">
<input type="file" name="sql_file" class="textfield" /><br />
@@ -166,37 +179,53 @@ if (function_exists('PMA_set_enc_form')) {
}
// Bookmark Support
-if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
- if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
- echo " <i>$strOr</i> $strBookmarkQuery&nbsp;:<br />\n";
- echo ' <div style="margin-bottom: 5px">' . "\n";
- echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
- echo ' <option value=""></option>' . "\n";
- while (list($key, $value) = each($bookmark_list)) {
- echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
+$bookmark_go = FALSE;
+if (!isset($is_inside_querywindow) ||
+ (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full'))) {
+ if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
+ if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
+ echo " " . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? "<i>$strOr</i>" : '') . " $strBookmarkQuery&nbsp;:<br />\n";
+
+ echo ' <div style="margin-bottom: 5px">' . "\n";
+ echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
+ echo ' <option value=""></option>' . "\n";
+ while (list($key, $value) = each($bookmark_list)) {
+ echo ' <option value="' . $value . '">' . htmlentities($key) . '</option>' . "\n";
+ }
+ echo ' </select>' . "\n";
+ echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
+ echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
+ echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
+ echo ' <br />' . "\n";
+ echo ' </div>' . "\n";
+ $bookmark_go = TRUE;
}
- echo ' </select>' . "\n";
- echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
- echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
- echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
- echo ' <br />' . "\n";
- echo ' </div>' . "\n";
}
}
+
+if (!isset($is_inside_querywindow) || (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'sql' || $querydisplay_tab == 'full' || ($querydisplay_tab == 'history' && $bookmark_go)))) {
?>
<input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
- </form>
</li>
-
<?php
-// loic1: displays import dump feature only if file upload available
-if ($is_upload && isset($db) && isset($table)) {
- ?>
- <!-- Insert a text file -->
- <li>
- <div style="margin-bottom: 10px"><a href="ldi_table.php3?<?php echo $url_query; ?>"><?php echo $strInsertTextfiles; ?></a></div>
- </li>
- <?php
+}
+
+if (!isset($is_inside_querywindow) ||
+ (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full'))) {
+
+ // loic1: displays import dump feature only if file upload available
+ $ldi_target = 'ldi_table.php3?' . $url_query;
+
+ if ($is_upload && isset($db) && isset($table)) {
+ ?>
+ <!-- Insert a text file -->
+ <br /><br />
+ <li>
+ <div style="margin-bottom: 10px"><a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.top.frames.phpmain.location.href = \'' . $ldi_target . '\'; return false;"' : ''); ?>><?php echo $strInsertTextfiles; ?></a></div>
+ </li>
+ <?php
+ }
}
echo "\n";
?>
+</form>
Please sign in to comment.
Something went wrong with that request. Please try again.