Skip to content

Commit

Permalink
Started fixing server-side reloading of the querywindow
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent bc3d599 commit 7232467
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
8 changes: 8 additions & 0 deletions js/ajax.js
Expand Up @@ -158,6 +158,14 @@ var AJAX = {
if (data._reloadNavigation) {
PMA_reloadNavigation();
}
if (data._reloadQuerywindow) {
var params = data._reloadQuerywindow;
reload_querywindow(
params.db,
params.table,
params.sql_query
);
}

if (data._title) {
$('title').replaceWith(data._title);
Expand Down
15 changes: 0 additions & 15 deletions libraries/Footer.class.php
Expand Up @@ -87,21 +87,6 @@ private function _addDefaultScripts()
});"
);

// set current db, table and sql query in the querywindow
$query = '';
if (isset($GLOBALS['sql_query']) && strlen($GLOBALS['sql_query']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
$query = PMA_escapeJsString($GLOBALS['sql_query']);
}
$this->_scripts->addCode(
"if (window.parent.reload_querywindow) {
window.parent.reload_querywindow(
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "',
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "',
'" . $query . "'
);
}"
);

if (! empty($GLOBALS['focus_querywindow'])) {
// set focus to the querywindow
$this->_scripts->addCode(
Expand Down
21 changes: 19 additions & 2 deletions libraries/Response.class.php
Expand Up @@ -300,8 +300,25 @@ private function _ajaxResponse()
if (strlen($errors)) {
$this->addJSON('_errors', $errors);
}
if (empty($GLOBALS['error_message']) && ! empty($GLOBALS['reload'])) {
$this->addJSON('_reloadNavigation', 1);
if (empty($GLOBALS['error_message'])) {
// set current db, table and sql query in the querywindow
$query = '';
if (isset($GLOBALS['sql_query'])
&& strlen($GLOBALS['sql_query']) < $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
) {
$query = PMA_escapeJsString($GLOBALS['sql_query']);
}
$this->addJSON(
'_reloadQuerywindow',
array(
'db' => PMA_ifSetOr($GLOBALS['db'], ''),
'table' => PMA_ifSetOr($GLOBALS['table'], ''),
'sql_query' => $query
)
);
if (! empty($GLOBALS['reload'])) {
$this->addJSON('_reloadNavigation', 1);
}
}
}

Expand Down

0 comments on commit 7232467

Please sign in to comment.