diff --git a/ChangeLog b/ChangeLog index 4a4ef4b7c..aceb11aee 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ $Source$ 2005-11-16 Marc Delisle * tbl_properties_links.php: missing menu tabs + * Documentation.html, config.default.php, footer.inc.php, + querywindow.php, tbl_query_box.php, libraries/common.lib.php, + libraries/left_header.inc.php, libraries/sql_query_form.lib.php: + new Query Window behavior 2005-11-16 Sebastian Mendel * added missing themes/darkblue_orange/img/error.ico diff --git a/Documentation.html b/Documentation.html index 8d8ef8c72..3c1cf932d 100755 --- a/Documentation.html +++ b/Documentation.html @@ -838,8 +838,8 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON <pma_db>.* TO 'pma'@'localhost'; you want to have on hold. On every login, this list gets cut to the maximum amount.

- The query history is only available if you use the JavaScript-based query window, - see $cfg['QueryFrame']. + The query history is only available if JavaScript is enabled in your + browser.

To allow the usage of this functionality: @@ -1739,8 +1739,7 @@ Defaults to FALSE (drop-down).


-
$cfg['QueryFrame'] boolean
- $cfg['QueryFrameJS'] boolean
+
$cfg['EditInWindow'] boolean
$cfg['QueryWindowWidth'] integer
$cfg['QueryWindowHeight'] integer
$cfg['QueryHistoryDB'] boolean
@@ -1748,19 +1747,23 @@ Defaults to FALSE (drop-down).
$cfg['QueryHistoryMax'] integer
- All those variables affect the query box feature. When - $cfg['QueryFrame'] is set to true, a link or icon is displayed - on the left panel. Clicking on it opens the query box, a direct - interface to enter SQL queries. + All those variables affect the query window feature. A SQL link + or icon is always displayed on the left panel. If JavaScript is enabled in + your browser, a click on this opens a distinct query window, which is + a direct interface to enter SQL queries. Otherwise, the right panel + changes to display a query box.

- When $cfg['QueryFrameJS'] is set to true, clicking on that link opens - the query box, a new custom sized browser window - ($cfg['QueryWindowWidth'], $cfg['QueryWindowWidth'] - both integers - for the size in pixels). - Also, a click on [Edit] from the results page (in the "Showing - Rows" section) opens the query box and puts the current query - inside it. If set to false, clicking on the link only opens the SQL - input in the main frame. + The size of this query window can be customized with + $cfg['QueryWindowWidth'] and $cfg['QueryWindowWidth'] + - both integers for the size in pixels. Note that normally, those + parameters will be modified in layout.inc.php for the + theme you are using. +

+ If $cfg['EditInWindow'] is set to true, a click on [Edit] + from the results page (in the "Showing Rows" section) + opens the query window and puts the current query + inside it. If set to false, clicking on the link puts the SQL + query in the right panel's query box.

The usage of the JavaScript query window is recommended if you have a JavaScript enabled browser. Basic functions are used to exchange quite diff --git a/config.default.php b/config.default.php index 8b33f5c08..e3fd7b2a6 100644 --- a/config.default.php +++ b/config.default.php @@ -480,9 +480,7 @@ $cfg['ShowBrowseComments'] = TRUE; // shows stored relation-comments in $cfg['ShowPropertyComments']= TRUE; // shows stored relation-comments in 'table property' mode. $cfg['RepeatCells'] = 100; // repeat header names every X cells? (0 = deactivate) -$cfg['QueryFrame'] = TRUE; // displays a link or icon in the left frame to open the querybox, and activates the querybox when clicking on [Edit] on the results page. -$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['EditInWindow'] = TRUE; // Set to TRUE if Edit link should open the query to edit in the query window (assuming Javascript is enabled), and to FALSE if we should edit in the right panel $cfg['QueryWindowWidth'] = 550; // Width of Query window $cfg['QueryWindowHeight'] = 310; // Height of Query window $cfg['QueryHistoryDB'] = FALSE; // Set to TRUE if you want DB-based query history. diff --git a/footer.inc.php b/footer.inc.php index e62256fda..a4da9f181 100644 --- a/footer.inc.php +++ b/footer.inc.php @@ -16,8 +16,7 @@ require_once('./libraries/relation.lib.php'); // for PMA_setHistory() * Query window */ -// If query window is wanted and open, update with latest selected db/table. -if ( $GLOBALS['cfg']['QueryFrame'] && $GLOBALS['cfg']['QueryFrameJS'] ) { +// If query window is open, update with latest selected db/table. ?> ', '' . "\n"; } // end if ($GLOBALS['cfg']['Server']['auth_type'] != 'config' - if ( $GLOBALS['cfg']['QueryFrame'] ) { - $anchor = 'querywindow.php?' . PMA_generate_common_url( $db, $table ); + $anchor = 'querywindow.php?' . PMA_generate_common_url( $db, $table ); - if ($GLOBALS['cfg']['MainPageIconic']) { - $query_frame_link_text = - '' . $strQueryFrame . ''; - } else { - echo '
' . "\n"; - $query_frame_link_text = $strQueryFrame; - } + if ($GLOBALS['cfg']['MainPageIconic']) { + $query_frame_link_text = + '' . $strQueryFrame . ''; + } else { + echo '
' . "\n"; + $query_frame_link_text = $strQueryFrame; + } echo '' . $query_frame_link_text . '' . "\n"; - } // end if ($GLOBALS['cfg']['QueryFrame']) } // end if ($server != 0) if ($GLOBALS['cfg']['MainPageIconic']) { diff --git a/libraries/sql_query_form.lib.php b/libraries/sql_query_form.lib.php index eac2b8e06..4983e0070 100644 --- a/libraries/sql_query_form.lib.php +++ b/libraries/sql_query_form.lib.php @@ -29,8 +29,6 @@ require_once('./libraries/file_listing.php'); // used for file listing * @uses $GLOBALS['sql_query'] from grab_globals.lib.php * @uses $GLOBALS['cfg']['DefaultQueryTable'] * @uses $GLOBALS['cfg']['DefaultQueryDatabase'] - * @uses $GLOBALS['cfg']['QueryFrame'] - * @uses $GLOBALS['cfg']['QueryFrameJS'] * @uses $GLOBALS['cfg']['Servers'] * @uses $GLOBALS['cfg']['DefaultTabDatabase'] * @uses $GLOBALS['cfg']['DefaultQueryDatabase'] @@ -73,11 +71,6 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) { $query = empty( $GLOBALS['sql_query'] ) ? '' : $GLOBALS['sql_query']; } - // we dont need to check booth variables each time - if ( false == $GLOBALS['cfg']['QueryFrame'] ) { - $GLOBALS['cfg']['QueryFrameJS'] = false; - } - // set enctype to multipart for file uploads if ( $GLOBALS['is_upload'] ) { $enctype = ' enctype="multipart/form-data"'; @@ -106,7 +99,7 @@ function PMA_sqlQueryForm( $query = true, $display_tab = false ) { // start output - if ( $GLOBALS['cfg']['QueryFrameJS'] && $is_querywindow ) { + if ( $is_querywindow ) { ?>
- bgcolor=""> + bgcolor="">
$query_history_latest_db, - 'table' => isset($query_history_latest_table) ? $query_history_latest_table : '', - ); - - $_sql_history[$query_history_latest] = array( - 'db' => $query_history_latest_db, - 'table' => isset( $query_history_latest_table ) ? $query_history_latest_table : '', - ); - - $sql_query = urldecode($query_history_latest); - $db = $query_history_latest_db; - $table = $query_history_latest_table; - } elseif ( ! empty( $query_history_latest ) ) { - $sql_query = urldecode($query_history_latest); - } - - if (isset($sql_query)) { - $show_query = 1; - } +if ( ! empty( $query_history_latest ) && ! empty( $query_history_latest_db ) ) { if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) { + PMA_setHistory((isset($query_history_latest_db) ? $query_history_latest_db : ''), + (isset($query_history_latest_table) ? $query_history_latest_table : ''), + $GLOBALS['cfg']['Server']['user'], + $query_history_latest ); + } - $temp_history = PMA_getHistory( $GLOBALS['cfg']['Server']['user'] ); - if (is_array($temp_history) && count($temp_history) > 0) { - foreach ($temp_history AS $history_nr => $history_array) { - if ( ! isset( $_sql_history[$history_array['sqlquery']] ) ) { - $_sql_history[$history_array['sqlquery']] = array( - 'db' => $history_array['db'], - 'table' => isset( $history_array['table'] ) ? $history_array['table'] : '', - ); - } + $_input_query_history[$query_history_latest] = array( + 'db' => $query_history_latest_db, + 'table' => isset($query_history_latest_table) ? $query_history_latest_table : '', + ); + + $_sql_history[$query_history_latest] = array( + 'db' => $query_history_latest_db, + 'table' => isset( $query_history_latest_table ) ? $query_history_latest_table : '', + ); + + $sql_query = urldecode($query_history_latest); + $db = $query_history_latest_db; + $table = $query_history_latest_table; +} elseif ( ! empty( $query_history_latest ) ) { + $sql_query = urldecode($query_history_latest); +} + +if (isset($sql_query)) { + $show_query = 1; +} + +if ( $GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork'] ) { + + $temp_history = PMA_getHistory( $GLOBALS['cfg']['Server']['user'] ); + if (is_array($temp_history) && count($temp_history) > 0) { + foreach ($temp_history AS $history_nr => $history_array) { + if ( ! isset( $_sql_history[$history_array['sqlquery']] ) ) { + $_sql_history[$history_array['sqlquery']] = array( + 'db' => $history_array['db'], + 'table' => isset( $history_array['table'] ) ? $history_array['table'] : '', + ); } } + } - } else { +} else { - if (isset($query_history) && is_array($query_history)) { - $current_index = count($query_history); - foreach ($query_history AS $query_no => $query_sql) { - if ( ! isset( $_input_query_history[$query_sql] ) ) { - $_input_query_history[$query_sql] = array( - 'db' => $query_history_db, - 'table' => isset($query_history_table) ? $query_history_table : '', - ); - $_sql_history[$query_sql] = array( - 'db' => $query_history_db[$query_no], - 'table' => isset( $query_history_table[$query_no] ) ? $query_history_table[$query_no] : '', - ); - } // end if check if this item exists - } // end while print history - } // end if history exists - - } // end if DB-based history -} + if (isset($query_history) && is_array($query_history)) { + $current_index = count($query_history); + foreach ($query_history AS $query_no => $query_sql) { + if ( ! isset( $_input_query_history[$query_sql] ) ) { + $_input_query_history[$query_sql] = array( + 'db' => $query_history_db, + 'table' => isset($query_history_table) ? $query_history_table : '', + ); + $_sql_history[$query_sql] = array( + 'db' => $query_history_db[$query_no], + 'table' => isset( $query_history_table[$query_no] ) ? $query_history_table[$query_no] : '', + ); + } // 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 : ''); if (!isset($goto)) { @@ -237,8 +234,7 @@ if (!isset($goto)) { require_once './libraries/bookmark.lib.php'; -// in case of javascript disabled in queryframe ... -if ( $GLOBALS['cfg']['QueryFrame'] && ! $GLOBALS['cfg']['QueryFrameJS'] ) { +if (isset($no_js) && $no_js) { // ... we redirect to appropriate query sql page // works only full if $db and $table is also stored/grabbed from $_COOKIE if ( ! empty( $table ) ) { @@ -266,26 +262,25 @@ unset( $sql_query ); PMA_sqlQueryForm( $query_to_display, $querydisplay_tab ); // Hidden forms and query frame interaction stuff -if ( $GLOBALS['cfg']['QueryFrame'] && $GLOBALS['cfg']['QueryFrameJS'] ) { - if (isset($auto_commit) && $auto_commit == 'true') { - ?> +if (isset($auto_commit) && $auto_commit == 'true') { +?> - 0 - && ( $querydisplay_tab == 'history' || $querydisplay_tab == 'full' ) ) { - $tab = isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full'; - echo $strQuerySQLHistory . ':
' . "\n" - .'' . "\n"; + echo '' . "\n"; } - ?> + unset( $tab, $_sql_history, $sql, $query ); + echo '' . "\n"; +} +?> - $history ) { - echo '' . "\n"; - echo '' . "\n"; - echo '' . "\n"; - } - unset( $_input_query_history, $sql, $history ); - ?> + $history ) { + echo '' . "\n"; + echo '' . "\n"; + echo '' . "\n"; +} +unset( $_input_query_history, $sql, $history ); +?> @@ -362,7 +357,6 @@ if ( $GLOBALS['cfg']['QueryFrame'] && $GLOBALS['cfg']['QueryFrameJS'] ) {
diff --git a/tbl_query_box.php b/tbl_query_box.php index e18e11dba..46123f43f 100644 --- a/tbl_query_box.php +++ b/tbl_query_box.php @@ -15,18 +15,11 @@ require_once('./libraries/common.lib.php'); require_once('./libraries/bookmark.lib.php'); require_once './libraries/sql_query_form.lib.php'; -// we dont need to check booth variables each time -if ( false == $cfg['QueryFrame'] ) { - $cfg['QueryFrameJS'] = false; -} - if ( empty( $querydisplay_tab ) ) { $querydisplay_tab = ''; } -// in case of javascript disabled in queryframe ... -if ( $GLOBALS['cfg']['QueryFrame'] && ! $GLOBALS['cfg']['QueryFrameJS'] - && $is_inside_querywindow ) { +if ( $is_inside_querywindow ) { // ... we redirect to appropriate query sql page // works only full if $db and $table is also stored/grabbed from $_COOKIE if ( ! empty( $table ) ) {