Rewrite and integration of js/common.js
This commit is contained in:
parent
eedf07e915
commit
7356b407ad
11
js/ajax.js
11
js/ajax.js
@ -160,13 +160,19 @@ var AJAX = {
|
||||
}
|
||||
if (data._reloadQuerywindow) {
|
||||
var params = data._reloadQuerywindow;
|
||||
reload_querywindow(
|
||||
PMA_querywindow.reload(
|
||||
params.db,
|
||||
params.table,
|
||||
params.sql_query
|
||||
);
|
||||
}
|
||||
|
||||
if (data._focusQuerywindow) {
|
||||
PMA_querywindow.focus(
|
||||
data._focusQuerywindow
|
||||
);
|
||||
}
|
||||
|
||||
if (data._title) {
|
||||
$('title').replaceWith(data._title);
|
||||
}
|
||||
@ -197,6 +203,9 @@ var AJAX = {
|
||||
AJAX.scriptHandler.load(data._scripts, 1);
|
||||
}
|
||||
|
||||
if (data._params) {
|
||||
PMA_commonParams.setAll(data._params);
|
||||
}
|
||||
$('#pma_errors').remove();
|
||||
if (data._errors) {
|
||||
$('<div/>', {id:'pma_errors'})
|
||||
|
||||
533
js/common.js
533
js/common.js
@ -1,269 +1,292 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* common functions used for communicating between main, navigation and querywindow
|
||||
* Functionality for communicating with the querywindow
|
||||
*/
|
||||
$(function () {
|
||||
/**
|
||||
* Event handler for click on the open query window link
|
||||
* in the top menu of the navigation panel
|
||||
*/
|
||||
$('#pma_open_querywindow').click(function (event) {
|
||||
event.preventDefault();
|
||||
PMA_querywindow.focus();
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Holds common parameters such as server, db, table, etc
|
||||
*
|
||||
* The content for this is normally loaded from Header.class.php or
|
||||
* Response.class.php and executed by ajax.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* holds the browser query window
|
||||
*/
|
||||
var querywindow = '';
|
||||
|
||||
/**
|
||||
* holds the query to be load from a new query window
|
||||
*/
|
||||
var query_to_load = '';
|
||||
|
||||
/**
|
||||
* sets current selected db
|
||||
*
|
||||
* @param string db name
|
||||
*/
|
||||
function setDb(new_db)
|
||||
{
|
||||
//alert('setDb(' + new_db + ')');
|
||||
if (new_db != db) {
|
||||
// db has changed
|
||||
//alert( new_db + '(' + new_db.length + ') : ' + db );
|
||||
|
||||
var old_db = db;
|
||||
db = new_db;
|
||||
|
||||
// the db name as an id exists only when LeftFrameLight is false
|
||||
if (window.frame_navigation.document.getElementById(db) == null) {
|
||||
// happens when LeftFrameLight is true
|
||||
// db is unknown, reload complete left frame
|
||||
refreshNavigation();
|
||||
}
|
||||
|
||||
// TODO: add code to expand db in lightview mode
|
||||
|
||||
// refresh querywindow
|
||||
refreshQuerywindow();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current selected table (called from navigation.php)
|
||||
*
|
||||
* @param string table name
|
||||
*/
|
||||
function setTable(new_table)
|
||||
{
|
||||
//alert('setTable(' + new_table + ')');
|
||||
if (new_table != table) {
|
||||
// table has changed
|
||||
//alert( new_table + '(' + new_table.length + ') : ' + table );
|
||||
|
||||
table = new_table;
|
||||
|
||||
if (window.frame_navigation.document.getElementById(db + '.' + table) == null
|
||||
&& table != '') {
|
||||
// table is unknown, reload complete left frame
|
||||
refreshNavigation();
|
||||
|
||||
}
|
||||
// TODO: add code to expand table in lightview mode
|
||||
|
||||
// refresh querywindow
|
||||
refreshQuerywindow();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reloads main frame
|
||||
*
|
||||
* @param string url name of page to be loaded
|
||||
*/
|
||||
function refreshMain(url)
|
||||
{
|
||||
console.log('Call to deprecate function refreshMain() ignored');
|
||||
}
|
||||
|
||||
/**
|
||||
* reloads navigation frame
|
||||
* TODO: drop this function
|
||||
*
|
||||
* @param boolean force force reloading
|
||||
*/
|
||||
function refreshNavigation(force)
|
||||
{
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets current selected server, table and db (called from the footer)
|
||||
*/
|
||||
function setAll( new_lang, new_collation_connection, new_server, new_db, new_table, new_token )
|
||||
{
|
||||
if (new_server != server || new_lang != lang
|
||||
|| new_collation_connection != collation_connection) {
|
||||
// something important has changed
|
||||
server = new_server;
|
||||
db = new_db;
|
||||
table = new_table;
|
||||
collation_connection = new_collation_connection;
|
||||
lang = new_lang;
|
||||
token = new_token;
|
||||
refreshNavigation();
|
||||
} else if (new_db != db || new_table != table) {
|
||||
// save new db and table
|
||||
var old_db = db;
|
||||
var old_table = table;
|
||||
db = new_db;
|
||||
table = new_table;
|
||||
|
||||
if (window.frame_navigation.document.getElementById(db) == null
|
||||
&& window.frame_navigation.document.getElementById(db + '.' + table) == null ) {
|
||||
// table or db is unknown, reload complete left frame
|
||||
refreshNavigation();
|
||||
}
|
||||
|
||||
// TODO: add code to expand db in lightview mode
|
||||
|
||||
// refresh querywindow
|
||||
refreshQuerywindow();
|
||||
}
|
||||
}
|
||||
|
||||
function reload_querywindow(db, table, sql_query)
|
||||
{
|
||||
if ( ! querywindow.closed && querywindow.location ) {
|
||||
if ( ! querywindow.document.sqlform.LockFromUpdate
|
||||
|| ! querywindow.document.sqlform.LockFromUpdate.checked ) {
|
||||
querywindow.document.getElementById('hiddenqueryform').db.value = db;
|
||||
querywindow.document.getElementById('hiddenqueryform').table.value = table;
|
||||
|
||||
if (sql_query) {
|
||||
querywindow.document.getElementById('hiddenqueryform').sql_query.value = sql_query;
|
||||
var PMA_commonParams = (function () {
|
||||
/**
|
||||
* @var hash params An associative array of key value pairs
|
||||
* @access private
|
||||
*/
|
||||
var params = {};
|
||||
// The returned object is the public part of the module
|
||||
return {
|
||||
/**
|
||||
* Saves all the key value pair that
|
||||
* are provided in the input array
|
||||
*
|
||||
* @param hash obj The input array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
setAll: function (obj) {
|
||||
var reload = false;
|
||||
for (var i in obj) {
|
||||
if (params[i] !== undefined && params[i] !== obj[i]) {
|
||||
reload = true;
|
||||
}
|
||||
params[i] = obj[i];
|
||||
}
|
||||
|
||||
querywindow.document.getElementById('hiddenqueryform').submit();
|
||||
if (reload) {
|
||||
PMA_querywindow.refresh();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Retrieves a value given its key
|
||||
* Returns empty string for undefined values
|
||||
*
|
||||
* @param string name The key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
get: function (name) {
|
||||
return params[name] || '';
|
||||
},
|
||||
/**
|
||||
* Saves a single key value pair
|
||||
*
|
||||
* @param string name The key
|
||||
* @param string value The value
|
||||
*
|
||||
* @return self For chainability
|
||||
*/
|
||||
set: function (name, value) {
|
||||
if (params[name] !== undefined && params[name] !== value) {
|
||||
PMA_querywindow.refresh();
|
||||
PMA_reloadNavigation();
|
||||
}
|
||||
params[name] = value;
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* Returns the url query string using the saved parameters
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
getUrlQuery: function () {
|
||||
return $.sprintf(
|
||||
'?%s&db=%s&table=%s',
|
||||
this.get('common_query'),
|
||||
encodeURIComponent(this.get('db')),
|
||||
encodeURIComponent(this.get('table'))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* brings query window to front and inserts query to be edited
|
||||
*/
|
||||
function focus_querywindow(sql_query)
|
||||
{
|
||||
/* if ( querywindow && !querywindow.closed && querywindow.location) { */
|
||||
if ( !querywindow || querywindow.closed || !querywindow.location) {
|
||||
// we need first to open the window and cannot pass the query with it
|
||||
// as we dont know if the query exceeds max url length
|
||||
query_to_load = sql_query;
|
||||
open_querywindow();
|
||||
insertQuery(0);
|
||||
} else {
|
||||
//var querywindow = querywindow;
|
||||
if ( querywindow.document.getElementById('hiddenqueryform').querydisplay_tab != 'sql' ) {
|
||||
querywindow.document.getElementById('hiddenqueryform').querydisplay_tab.value = "sql";
|
||||
querywindow.document.getElementById('hiddenqueryform').sql_query.value = sql_query;
|
||||
querywindow.document.getElementById('hiddenqueryform').submit();
|
||||
querywindow.focus();
|
||||
} else {
|
||||
querywindow.focus();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* inserts query string into query window textarea
|
||||
* called from script tag in querywindow
|
||||
*/
|
||||
function insertQuery()
|
||||
{
|
||||
if (query_to_load != '' && querywindow.document && querywindow.document.getElementById && querywindow.document.getElementById('sqlquery')) {
|
||||
querywindow.document.getElementById('sqlquery').value = query_to_load;
|
||||
query_to_load = '';
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function open_querywindow( url )
|
||||
{
|
||||
if ( ! url ) {
|
||||
url = 'querywindow.php?' + common_query + '&db=' + encodeURIComponent(db) + '&table=' + encodeURIComponent(table);
|
||||
}
|
||||
|
||||
if (!querywindow.closed && querywindow.location) {
|
||||
goTo( url, 'query' );
|
||||
querywindow.focus();
|
||||
} else {
|
||||
querywindow = window.open( url + '&init=1', '',
|
||||
'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
|
||||
'scrollbars=yes,resizable=yes,' +
|
||||
'width=' + querywindow_width + ',' +
|
||||
'height=' + querywindow_height );
|
||||
}
|
||||
|
||||
if ( ! querywindow.opener ) {
|
||||
querywindow.opener = window.window;
|
||||
}
|
||||
|
||||
if ( window.focus ) {
|
||||
querywindow.focus();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function refreshQuerywindow( url )
|
||||
{
|
||||
|
||||
if ( ! querywindow.closed && querywindow.location ) {
|
||||
if ( ! querywindow.document.sqlform.LockFromUpdate
|
||||
|| ! querywindow.document.sqlform.LockFromUpdate.checked ) {
|
||||
open_querywindow( url )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* opens new url in target frame, with default being left frame
|
||||
* valid is 'main' and 'querywindow' all others leads to 'left'
|
||||
* Holds common parameters such as server, db, table, etc
|
||||
*
|
||||
* @param string targeturl new url to load
|
||||
* @param string target frame where to load the new url
|
||||
* The content for this is normally loaded from Header.class.php or
|
||||
* Response.class.php and executed by ajax.js
|
||||
*/
|
||||
function goTo(targeturl, target)
|
||||
{
|
||||
//alert(targeturl);
|
||||
if ( target == 'main' ) {
|
||||
target = window.frame_content;
|
||||
} else if ( target == 'query' ) {
|
||||
target = querywindow;
|
||||
//return open_querywindow( targeturl );
|
||||
} else if ( ! target ) {
|
||||
target = window.frame_navigation;
|
||||
}
|
||||
|
||||
if ( target ) {
|
||||
if ( target.location.href == targeturl ) {
|
||||
return true;
|
||||
} else if ( target.location.href == pma_absolute_uri + targeturl ) {
|
||||
return true;
|
||||
var PMA_commonActions = {
|
||||
/**
|
||||
* Saves the database name when it's changed
|
||||
* and reloads the query window, if necessary
|
||||
*
|
||||
* @param string new_db The name of the new database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
setDb: function (new_db) {
|
||||
if (new_db != PMA_commonParams.get('db')) {
|
||||
PMA_commonParams.set('db', new_db);
|
||||
PMA_querywindow.refresh();
|
||||
}
|
||||
|
||||
if ( safari_browser ) {
|
||||
target.location.href = targeturl;
|
||||
} else {
|
||||
target.location.replace(targeturl);
|
||||
},
|
||||
/**
|
||||
* Opens a database in the main part of the page
|
||||
*
|
||||
* @param string new_db The name of the new database
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
openDb: function (new_db) {
|
||||
PMA_commonParams
|
||||
.set('db', new_db)
|
||||
.set('table', '');
|
||||
PMA_querywindow.refresh();
|
||||
this.refreshMain(
|
||||
PMA_commonParams.get('opendb_url')
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Refreshes the main frame
|
||||
*
|
||||
* @param mixed url Undefined to refresh to the same page
|
||||
* String to go to a different page, e.g: 'index.php'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
refreshMain: function (url) {
|
||||
if (! url) {
|
||||
url = $('#selflink a').attr('href');
|
||||
url = url.substring(0, url.indexOf('?'));
|
||||
}
|
||||
url += PMA_commonParams.getUrlQuery();
|
||||
$('<a />', {href: url}).click();
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// opens selected db in main frame
|
||||
function openDb(new_db)
|
||||
{
|
||||
//alert('opendb(' + new_db + ')');
|
||||
setDb(new_db);
|
||||
setTable('');
|
||||
refreshMain(opendb_url);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Common functions used for communicating with the querywindow
|
||||
*/
|
||||
var PMA_querywindow = (function ($, window) {
|
||||
/**
|
||||
* @var Object querywindow Reference to the window
|
||||
* object of the querywindow
|
||||
* @access private
|
||||
*/
|
||||
var querywindow = {};
|
||||
/**
|
||||
* @var string queryToLoad Stores the SQL query that is to be displayed
|
||||
* in the querywindow when it is ready
|
||||
* @access private
|
||||
*/
|
||||
var queryToLoad = '';
|
||||
// The returned object is the public part of the module
|
||||
return {
|
||||
/**
|
||||
* Opens the query window
|
||||
*
|
||||
* @param mixed url Undefined to open the default page
|
||||
* String to go to a different
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
open: function (url) {
|
||||
if (! url) {
|
||||
url = 'querywindow.php' + PMA_commonParams.getUrlQuery();
|
||||
}
|
||||
if (! querywindow.closed && querywindow.location) {
|
||||
var href = querywindow.location.href;
|
||||
if (href != url
|
||||
&& href != PMA_commonParams.get('pma_absolute_uri') + url
|
||||
) {
|
||||
if (PMA_commonParams.get('safari_browser')) {
|
||||
querywindow.location.href = targeturl;
|
||||
} else {
|
||||
querywindow.location.replace(targeturl);
|
||||
}
|
||||
querywindow.focus();
|
||||
}
|
||||
} else {
|
||||
querywindow = window.open(
|
||||
url + '&init=1',
|
||||
'',
|
||||
'toolbar=0,location=0,directories=0,status=1,'
|
||||
+ 'menubar=0,scrollbars=yes,resizable=yes,'
|
||||
+ 'width=' + PMA_commonParams.get('querywindow_width') + ','
|
||||
+ 'height=' + PMA_commonParams.get('querywindow_height')
|
||||
);
|
||||
}
|
||||
if (! querywindow.opener) {
|
||||
querywindow.opener = window.window;
|
||||
}
|
||||
if (window.focus) {
|
||||
querywindow.focus();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Opens, if necessary, focuses the query window
|
||||
* and displays an SQL query.
|
||||
*
|
||||
* @param string sql_query The SQL query to display in
|
||||
* the query window
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
focus: function (sql_query) {
|
||||
if (! querywindow || querywindow.closed || ! querywindow.location) {
|
||||
// we need first to open the window and cannot pass the query with it
|
||||
// as we dont know if the query exceeds max url length
|
||||
queryToLoad = sql_query;
|
||||
this.open();
|
||||
this.showQuery();
|
||||
} else {
|
||||
//var querywindow = querywindow;
|
||||
var hiddenqueryform = querywindow
|
||||
.document
|
||||
.getElementById('hiddenqueryform');
|
||||
if (hiddenqueryform.querydisplay_tab != 'sql' ) {
|
||||
hiddenqueryform.querydisplay_tab.value = "sql";
|
||||
hiddenqueryform.sql_query.value = sql_query;
|
||||
$(hiddenqueryform).addClass('disableAjax');
|
||||
hiddenqueryform.submit();
|
||||
querywindow.focus();
|
||||
} else {
|
||||
querywindow.focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Displays the stored SQL query in the SQL form of the query window
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
showQuery: function () {
|
||||
var $sqlBox = $('#sqlquery', querywindow);
|
||||
if (queryToLoad != '' && $sqlBox.length) {
|
||||
$sqlBox.val(queryToLoad);
|
||||
queryToLoad = '';
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Refreshes the query window given a url
|
||||
*
|
||||
* @param string url Where to go to
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
refresh: function (url) {
|
||||
if (! querywindow.closed && querywindow.location) {
|
||||
var $form = $(querywindow.document).find('#sqlqueryform');
|
||||
if ($form.find('#checkbox_lock:checked').length == 0) {
|
||||
PMA_querywindow.open(url);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Reloads the query window given the details
|
||||
* of a db, a table and an sql_query
|
||||
*
|
||||
* @param string db The name of the database
|
||||
* @param string table The name of the table
|
||||
* @param string sql_query The SQL query to be displayed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
reload: function (db, table, sql_query) {
|
||||
if (! querywindow.closed && querywindow.location) {
|
||||
var $form = $(querywindow.document).find('#sqlqueryform');
|
||||
if ($form.find('#checkbox_lock:checked').length == 0) {
|
||||
var $hiddenform = $(querywindow.document)
|
||||
.find('#hiddenqueryform');
|
||||
$hiddenform.find('input[name=db]').val(db);
|
||||
$hiddenform.find('input[name=table]').val(table);
|
||||
if (sql_query) {
|
||||
$hiddenform.find('input[name=sql_query]').val(sql_query);
|
||||
}
|
||||
$hiddenform.addClass('disableAjax').submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery, window);
|
||||
|
||||
@ -39,7 +39,7 @@ AJAX.registerOnload('db_operations.js', function() {
|
||||
|
||||
var $form = $(this);
|
||||
|
||||
var question = escapeHtml('CREATE DATABASE ' + $('#new_db_name').val() + ' / DROP DATABASE ' + window.parent.db);
|
||||
var question = escapeHtml('CREATE DATABASE ' + $('#new_db_name').val() + ' / DROP DATABASE ' + PMA_commonParams.get('db'));
|
||||
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
/**
|
||||
@ -47,36 +47,36 @@ AJAX.registerOnload('db_operations.js', function() {
|
||||
*/
|
||||
var button_options = {};
|
||||
button_options[PMA_messages['strYes']] = function() {
|
||||
$(this).dialog("close").remove();
|
||||
window.parent.refreshMain();
|
||||
PMA_reloadNavigation();
|
||||
};
|
||||
button_options[PMA_messages['strNo']] = function() { $(this).dialog("close").remove(); }
|
||||
$(this).dialog("close").remove();
|
||||
PMA_commonActions.refreshMain();
|
||||
PMA_reloadNavigation();
|
||||
};
|
||||
button_options[PMA_messages['strNo']] = function() {
|
||||
$(this).dialog("close").remove();
|
||||
}
|
||||
|
||||
$form.PMA_confirm(question, $form.attr('action'), function(url) {
|
||||
PMA_ajaxShowMessage(PMA_messages['strRenamingDatabases'], false);
|
||||
|
||||
$.get(url, $("#rename_db_form").serialize() + '&is_js_confirmed=1', function(data) {
|
||||
if(data.success == true) {
|
||||
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
PMA_commonParams.set('db', data.newname);
|
||||
|
||||
window.parent.db = data.newname;
|
||||
|
||||
$("#floating_menubar")
|
||||
.next('div')
|
||||
.remove()
|
||||
.end()
|
||||
.after(data.sql_query);
|
||||
$("#page_content")
|
||||
.find('#result_query')
|
||||
.remove();
|
||||
$("#page_content")
|
||||
.prepend(data.sql_query);
|
||||
|
||||
//Remove the empty notice div generated due to a NULL query passed to PMA_Util::getMessage()
|
||||
var $notice_class = $("#floating_menubar").next("div").find('.notice');
|
||||
var $notice_class = $('#result_query').find('.notice');
|
||||
if ($notice_class.text() == '') {
|
||||
$notice_class.remove();
|
||||
}
|
||||
|
||||
$("<span>" + PMA_messages['strReloadDatabase'] + "?</span>").dialog({
|
||||
buttons: button_options
|
||||
buttons: button_options,
|
||||
modal: true
|
||||
}) //end dialog options
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
@ -104,9 +104,10 @@ AJAX.registerOnload('db_operations.js', function() {
|
||||
$('div.success, div.error').fadeOut();
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
PMA_commonParams.set('db', data.newname);
|
||||
if( $("#checkbox_switch").is(":checked")) {
|
||||
window.parent.db = data.newname;
|
||||
window.parent.refreshMain();
|
||||
PMA_commonParams.set('db', data.newname);
|
||||
PMA_commonActions.refreshMain();
|
||||
PMA_reloadNavigation();
|
||||
} else {
|
||||
PMA_reloadNavigation();
|
||||
|
||||
@ -53,9 +53,6 @@ function loadResult(result_path, table_name, link, ajaxEnable)
|
||||
scrollTop: $("#browse-results").offset().top
|
||||
}, 1000);
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
// because under db_search, window.parent.table is not defined yet,
|
||||
// we assign it manually from #table-link
|
||||
window.parent.table = $('#table-link').text().trim();
|
||||
PMA_makegrid($('#table_results')[0], true, true, true, true);
|
||||
}).show();
|
||||
} else {
|
||||
|
||||
@ -397,10 +397,6 @@ AJAX.registerOnload('db_structure.js', function() {
|
||||
toggleRowColors($curr_row.next());
|
||||
$curr_row.hide("medium").remove();
|
||||
PMA_adjustTotals();
|
||||
|
||||
if (window.parent && window.parent.frame_navigation) {
|
||||
window.parent.frame_navigation.location.reload();
|
||||
}
|
||||
PMA_reloadNavigation();
|
||||
} else {
|
||||
PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
|
||||
|
||||
@ -1945,9 +1945,9 @@ AJAX.registerOnload('functions.js', function() {
|
||||
var tables_table = $("#tablesForm").find("tbody").not("#tbl_summary_row");
|
||||
// this is the first table created in this db
|
||||
if (tables_table.length == 0) {
|
||||
if (window.parent && window.parent.frame_content) {
|
||||
window.parent.frame_content.location.reload();
|
||||
}
|
||||
PMA_commonActions.refreshMain(
|
||||
PMA_commonParams.get('opendb_url')
|
||||
);
|
||||
} else {
|
||||
/**
|
||||
* @var curr_last_row Object referring to the last <tr> element in {@link tables_table}
|
||||
@ -2169,25 +2169,24 @@ AJAX.registerTeardown('functions.js', function() {
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
$("#drop_db_anchor.ajax").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
//context is top.frame_content, so we need to use window.parent.db to access the db var
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question =
|
||||
PMA_messages.strDropDatabaseStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, 'DROP DATABASE ' + escapeHtml(window.parent.db));
|
||||
|
||||
var question = PMA_messages.strDropDatabaseStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'DROP DATABASE ' + escapeHtml(PMA_commonParams.get('db'))
|
||||
);
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$.get(url, {'is_js_confirmed': '1', 'ajax_request': true}, function(data) {
|
||||
//Database deleted successfully, refresh both the frames
|
||||
PMA_reloadNavigation();
|
||||
window.parent.refreshMain();
|
||||
}); // end $.get()
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop Database Ajax action
|
||||
PMA_commonParams.set('db', '');
|
||||
PMA_commonActions.refreshMain('index.php');
|
||||
});
|
||||
});
|
||||
});
|
||||
}); // end of $() for Drop Database
|
||||
|
||||
/**
|
||||
@ -3311,14 +3310,14 @@ AJAX.registerTeardown('functions.js', function() {
|
||||
AJAX.registerOnload('functions.js', function() {
|
||||
$("#drop_tbl_anchor.ajax").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
//context is top.frame_content, so we need to use window.parent.table to access the table var
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question =
|
||||
PMA_messages.strDropTableStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, 'DROP TABLE ' + window.parent.table);
|
||||
var question = PMA_messages.strDropTableStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'DROP TABLE ' + PMA_commonParams.get('table')
|
||||
);
|
||||
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
|
||||
|
||||
@ -3328,7 +3327,10 @@ AJAX.registerOnload('functions.js', function() {
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
// Table deleted successfully, refresh both the frames
|
||||
PMA_reloadNavigation();
|
||||
window.parent.refreshMain();
|
||||
PMA_commonParams.set('table', '');
|
||||
PMA_commonActions.refreshMain(
|
||||
PMA_commonParams.get('opendb_url')
|
||||
);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
}
|
||||
@ -3338,17 +3340,15 @@ AJAX.registerOnload('functions.js', function() {
|
||||
|
||||
$("#truncate_tbl_anchor.ajax").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
//context is top.frame_content, so we need to use window.parent.table to access the table var
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question =
|
||||
PMA_messages.strTruncateTableStrongWarning + ' '
|
||||
+ $.sprintf(PMA_messages.strDoYouReally, 'TRUNCATE ' + window.parent.table);
|
||||
|
||||
var question = PMA_messages.strTruncateTableStrongWarning + ' ';
|
||||
question += $.sprintf(
|
||||
PMA_messages.strDoYouReally,
|
||||
'TRUNCATE ' + PMA_commonParams.get('table')
|
||||
);
|
||||
$(this).PMA_confirm(question, $(this).attr('href'), function(url) {
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$.get(url, {'is_js_confirmed': '1', 'ajax_request': true}, function(data) {
|
||||
if ($("#sqlqueryresults").length != 0) {
|
||||
|
||||
@ -610,12 +610,14 @@ function New_relation()
|
||||
|
||||
function Start_table_new()
|
||||
{
|
||||
window.location.href = 'tbl_create.php?server=' + server + '&db=' + db + '&token=' + token;
|
||||
PMA_commonParams.set('table', '');
|
||||
PMA_commonActions.refreshMain('tbl_create.php');
|
||||
}
|
||||
|
||||
function Start_tab_upd(table)
|
||||
{
|
||||
window.location.href = 'tbl_structure.php?server=' + server + '&db=' + db + '&token=' + token + '&table=' + table;
|
||||
PMA_commonParams.set('table', table);
|
||||
PMA_commonActions.refreshMain('tbl_structure.php');
|
||||
}
|
||||
//--------------------------- hide tables --------------------------------------
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ function PMA_querywindowCommit(tab)
|
||||
{
|
||||
var $hiddenqueryform = $('#hiddenqueryform');
|
||||
$hiddenqueryform.find("input[name='querydisplay_tab']").val(tab);
|
||||
$hiddenqueryform.submit();
|
||||
$hiddenqueryform.addClass('disableAjax').submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -20,28 +20,6 @@ function PMA_querywindowSetFocus()
|
||||
$('#sqlquery').focus();
|
||||
}
|
||||
|
||||
function PMA_querywindowResize()
|
||||
{
|
||||
var $el = $(this)[0];
|
||||
var $querywindowcontainer = $('#querywindowcontainer');
|
||||
|
||||
// for Gecko
|
||||
if (typeof($el.sizeToContent) == 'function') {
|
||||
$el.sizeToContent();
|
||||
//self.scrollbars.visible = false;
|
||||
// give some more space ... to prevent 'fli(pp/ck)ing'
|
||||
$el.resizeBy(10, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
// for IE, Opera
|
||||
if ($querywindowcontainer.length) {
|
||||
// get content size
|
||||
var newWidth = $querywindowcontainer.width();
|
||||
var newHeight = $querywindowcontainer.height();
|
||||
|
||||
// set size to contentsize
|
||||
// plus some offset for scrollbars, borders, statusbar, menus ...
|
||||
$el.resizeTo(newWidth + 45, newHeight + 75);
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
$('#topmenucontainer').css('padding', 0);
|
||||
});
|
||||
|
||||
@ -116,7 +116,7 @@ AJAX.registerOnload('tbl_structure.js', function() {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$(this).remove();
|
||||
if (typeof data.reload != 'undefined') {
|
||||
window.parent.frame_content.location.reload();
|
||||
PMA_commonActions.refreshMain();
|
||||
}
|
||||
PMA_reloadNavigation();
|
||||
} else {
|
||||
|
||||
@ -148,11 +148,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
$.post('tbl_zoom_select.php',{
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'db' : PMA_commonParams('db'),
|
||||
'table' : PMA_commonParams('table'),
|
||||
'field' : $('#tableid_0').val(),
|
||||
'it' : 0,
|
||||
'token' : window.parent.token
|
||||
'token' : PMA_commonParams('token')
|
||||
},function(data) {
|
||||
$('#tableFieldsId tr:eq(1) td:eq(0)').html(data.field_type);
|
||||
$('#tableFieldsId tr:eq(1) td:eq(1)').html(data.field_collation);
|
||||
@ -172,11 +172,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
$.post('tbl_zoom_select.php',{
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'db' : PMA_commonParams('db'),
|
||||
'table' : PMA_commonParams('table'),
|
||||
'field' : $('#tableid_1').val(),
|
||||
'it' : 1,
|
||||
'token' : window.parent.token
|
||||
'token' : PMA_commonParams('token')
|
||||
},function(data) {
|
||||
$('#tableFieldsId tr:eq(3) td:eq(0)').html(data.field_type);
|
||||
$('#tableFieldsId tr:eq(3) td:eq(1)').html(data.field_collation);
|
||||
@ -195,11 +195,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
$.post('tbl_zoom_select.php',{
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'db' : PMA_commonParams('db'),
|
||||
'table' : PMA_commonParams('table'),
|
||||
'field' : $('#tableid_2').val(),
|
||||
'it' : 2,
|
||||
'token' : window.parent.token
|
||||
'token' : PMA_commonParams('token')
|
||||
},function(data) {
|
||||
$('#tableFieldsId tr:eq(6) td:eq(0)').html(data.field_type);
|
||||
$('#tableFieldsId tr:eq(6) td:eq(1)').html(data.field_collation);
|
||||
@ -216,11 +216,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
$.post('tbl_zoom_select.php',{
|
||||
'ajax_request' : true,
|
||||
'change_tbl_info' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'db' : PMA_commonParams('db'),
|
||||
'table' : PMA_commonParams('table'),
|
||||
'field' : $('#tableid_3').val(),
|
||||
'it' : 3,
|
||||
'token' : window.parent.token
|
||||
'token' : PMA_commonParams('token')
|
||||
},function(data) {
|
||||
$('#tableFieldsId tr:eq(8) td:eq(0)').html(data.field_type);
|
||||
$('#tableFieldsId tr:eq(8) td:eq(1)').html(data.field_collation);
|
||||
@ -308,7 +308,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
|
||||
//Update the chart series and replot
|
||||
if (xChange || yChange) {
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes.
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes.
|
||||
//Code includes a lot of checks so as to replot only when necessary
|
||||
if (xChange) {
|
||||
xCord[searchedDataKey] = selectedRow[xLabel];
|
||||
@ -316,7 +316,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
if (xType == 'numeric') {
|
||||
series[0][searchedDataKey][0] = selectedRow[xLabel];
|
||||
} else if (xType == 'time') {
|
||||
series[0][searchedDataKey][0] =
|
||||
series[0][searchedDataKey][0] =
|
||||
getTimeStamp(selectedRow[xLabel], $('#types_0').val());
|
||||
} else {
|
||||
// todo: text values
|
||||
@ -332,7 +332,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
if (yType == 'numeric') {
|
||||
series[0][searchedDataKey][1] = selectedRow[yLabel];
|
||||
} else if (yType == 'time') {
|
||||
series[0][searchedDataKey][1] =
|
||||
series[0][searchedDataKey][1] =
|
||||
getTimeStamp(selectedRow[yLabel], $('#types_1').val());
|
||||
} else {
|
||||
// todo: text values
|
||||
@ -345,7 +345,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
|
||||
//Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
|
||||
var sql_query = 'UPDATE `' + PMA_commonParams('table') + '` SET ';
|
||||
for (key in newValues) {
|
||||
sql_query += '`' + key + '`=' ;
|
||||
var value = newValues[key];
|
||||
@ -380,8 +380,8 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
|
||||
//Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
'token' : window.parent.token,
|
||||
'db' : window.parent.db,
|
||||
'token' : PMA_commonParams('token')
|
||||
'db' : PMA_commonParams('db'),
|
||||
'ajax_request' : true,
|
||||
'sql_query' : sql_query,
|
||||
'inline_edit' : false
|
||||
@ -425,7 +425,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
|
||||
|
||||
/*
|
||||
* Generate plot using jqplot
|
||||
* Generate plot using jqplot
|
||||
*/
|
||||
|
||||
if (searchedData != null) {
|
||||
@ -460,11 +460,11 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
axes: {
|
||||
xaxis: {
|
||||
label: $('#tableid_0').val(),
|
||||
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
|
||||
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
|
||||
},
|
||||
yaxis: {
|
||||
label: $('#tableid_1').val(),
|
||||
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
|
||||
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
|
||||
}
|
||||
},
|
||||
highlighter: {
|
||||
@ -497,7 +497,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
originalXType = $('#types_0').val();
|
||||
if (originalXType == 'date') {
|
||||
format = '%Y-%m-%d';
|
||||
}
|
||||
}
|
||||
// todo: does not seem to work
|
||||
//else if (originalXType == 'time') {
|
||||
// format = '%H:%M';
|
||||
@ -507,7 +507,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
$.extend(options.axes.xaxis, {
|
||||
renderer:$.jqplot.DateAxisRenderer,
|
||||
tickOptions: {
|
||||
formatString: format
|
||||
formatString: format
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -515,15 +515,15 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
originalYType = $('#types_1').val();
|
||||
if (originalYType == 'date') {
|
||||
format = '%Y-%m-%d';
|
||||
}
|
||||
}
|
||||
$.extend(options.axes.yaxis, {
|
||||
renderer:$.jqplot.DateAxisRenderer,
|
||||
tickOptions: {
|
||||
formatString: format
|
||||
formatString: format
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$.each(searchedData, function(key, value) {
|
||||
if (xType == 'numeric') {
|
||||
var xVal = parseFloat(value[xLabel]);
|
||||
@ -538,8 +538,8 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
var yVal = getTimeStamp(value[yLabel], originalYType);
|
||||
}
|
||||
series[0].push([
|
||||
xVal,
|
||||
yVal,
|
||||
xVal,
|
||||
yVal,
|
||||
// extra Y values
|
||||
value[dataLabel], // for highlighter
|
||||
// (may set an undefined value)
|
||||
@ -548,7 +548,7 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
]);
|
||||
});
|
||||
|
||||
// under IE 8, the initial display is mangled; after a manual
|
||||
// under IE 8, the initial display is mangled; after a manual
|
||||
// resizing, it's ok
|
||||
// under IE 9, everything is fine
|
||||
currentChart = $.jqplot('querychart', series, options);
|
||||
@ -574,14 +574,14 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function() {
|
||||
var post_params = {
|
||||
'ajax_request' : true,
|
||||
'get_data_row' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'db' : PMA_commonParams('db'),
|
||||
'table' : PMA_commonParams('table'),
|
||||
'where_clause' : data[3],
|
||||
'token' : window.parent.token
|
||||
'token' : PMA_commonParams('token')
|
||||
};
|
||||
|
||||
$.post('tbl_zoom_select.php', post_params, function(data) {
|
||||
// Row is contained in data.row_info,
|
||||
// Row is contained in data.row_info,
|
||||
// now fill the displayResultForm with row values
|
||||
for (key in data.row_info) {
|
||||
$field = $('#edit_fieldID_' + field_id);
|
||||
|
||||
@ -60,61 +60,6 @@ class PMA_Footer
|
||||
$this->_isEnabled = true;
|
||||
$this->_scripts = new PMA_Scripts();
|
||||
$this->_isMinimal = false;
|
||||
$this->_addDefaultScripts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads common scripts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _addDefaultScripts()
|
||||
{
|
||||
if (empty($GLOBALS['error_message'])) {
|
||||
$this->_scripts->addCode(
|
||||
"$(function() {
|
||||
// updates current settings
|
||||
if (window.parent.setAll) {
|
||||
window.parent.setAll(
|
||||
'" . PMA_escapeJsString($GLOBALS['lang']) . "',
|
||||
'" . PMA_escapeJsString($GLOBALS['collation_connection']) . "',
|
||||
'" . PMA_escapeJsString($GLOBALS['server']) . "',
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['db'], '')) . "',
|
||||
'" . PMA_escapeJsString(PMA_ifSetOr($GLOBALS['table'], '')) . "',
|
||||
'" . PMA_escapeJsString($_SESSION[' PMA_token ']) . "'
|
||||
);
|
||||
}
|
||||
});"
|
||||
);
|
||||
|
||||
if (! empty($GLOBALS['focus_querywindow'])) {
|
||||
// set focus to the querywindow
|
||||
$this->_scripts->addCode(
|
||||
"if (parent.querywindow && !parent.querywindow.closed
|
||||
&& parent.querywindow.location
|
||||
) {
|
||||
self.focus();
|
||||
}"
|
||||
);
|
||||
}
|
||||
$this->_scripts->addCode(
|
||||
"if (window.parent.frame_content) {
|
||||
// reset content frame name, as querywindow needs
|
||||
// to set a unique name before submitting form data,
|
||||
// and navigation frame needs the original name
|
||||
if (typeof(window.parent.frame_content.name) != 'undefined'
|
||||
&& window.parent.frame_content.name != 'frame_content') {
|
||||
window.parent.frame_content.name = 'frame_content';
|
||||
}
|
||||
if (typeof(window.parent.frame_content.id) != 'undefined'
|
||||
&& window.parent.frame_content.id != 'frame_content') {
|
||||
window.parent.frame_content.id = 'frame_content';
|
||||
}
|
||||
//window.parent.frame_content.setAttribute('name', 'frame_content');
|
||||
//window.parent.frame_content.setAttribute('id', 'frame_content');
|
||||
}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -101,6 +101,10 @@ class PMA_Header
|
||||
* @var bool
|
||||
*/
|
||||
private $_headerIsSent;
|
||||
/**
|
||||
* @var object A reference to the common functions object
|
||||
*/
|
||||
private $_commonFunctions;
|
||||
|
||||
/**
|
||||
* Creates a new class instance
|
||||
@ -109,6 +113,7 @@ class PMA_Header
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_commonFunctions = PMA_commonFunctions::getInstance();
|
||||
$this->_isEnabled = true;
|
||||
$this->_isAjax = false;
|
||||
$this->_bodyId = '';
|
||||
@ -175,6 +180,43 @@ class PMA_Header
|
||||
$this->_scripts->addFile('functions.js');
|
||||
$this->_scripts->addFile('navigation.js');
|
||||
$this->_scripts->addFile('indexes.js');
|
||||
$this->_scripts->addFile('common.js');
|
||||
$this->_scripts->addCode($this->getJsParamsCode());
|
||||
}
|
||||
|
||||
public function getJsParams()
|
||||
{
|
||||
return array(
|
||||
'common_query' => PMA_generate_common_url('', '', '&'),
|
||||
'opendb_url' => $GLOBALS['cfg']['DefaultTabDatabase'],
|
||||
'safari_browser' => PMA_USR_BROWSER_AGENT == 'SAFARI' ? 'true' : 'false',
|
||||
'querywindow_height' => $GLOBALS['cfg']['QueryWindowHeight'],
|
||||
'querywindow_width' => $GLOBALS['cfg']['QueryWindowWidth'],
|
||||
'collation_connection' => $GLOBALS['collation_connection'],
|
||||
'lang' => $GLOBALS['lang'],
|
||||
'server' => $GLOBALS['server'],
|
||||
'table' => $GLOBALS['table'],
|
||||
'db' => $GLOBALS['db'],
|
||||
'token' => $_SESSION[' PMA_token '],
|
||||
'text_dir' => $GLOBALS['text_dir'],
|
||||
'pma_absolute_uri' => $GLOBALS['cfg']['PmaAbsoluteUri'],
|
||||
'pma_text_default_tab' => $this->_commonFunctions->getTitleForTarget(
|
||||
$GLOBALS['cfg']['DefaultTabTable']
|
||||
),
|
||||
'pma_text_left_default_tab' => $this->_commonFunctions->getTitleForTarget(
|
||||
$GLOBALS['cfg']['NavigationTreeDefaultTabTable']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function getJsParamsCode()
|
||||
{
|
||||
$params = $this->getJsParams();
|
||||
foreach ($params as $key => $value) {
|
||||
$params[$key] = $key . ':"' . PMA_escapeJsString($value) . '"';
|
||||
}
|
||||
return 'PMA_commonParams.setAll({' . implode(',', $params) . '});';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -394,7 +394,7 @@ class PMA_List_Database extends PMA_List
|
||||
}
|
||||
|
||||
$return = '<select name="db" id="lightm_db" lang="en" dir="ltr"'
|
||||
. ' onchange="if (this.value != \'\') window.parent.openDb(this.value);">' . "\n"
|
||||
. ' onchange="if (this.value != \'\') PMA_commonActions.openDb(this.value);">' . "\n"
|
||||
. '<option value="" dir="' . htmlspecialchars($GLOBALS['text_dir']) . '">'
|
||||
. '(' . __('Databases') . ') ...</option>' . "\n";
|
||||
foreach ($this->getGroupedDetails($offset, $count) as $group => $dbs) {
|
||||
|
||||
@ -294,7 +294,14 @@ class PMA_Response
|
||||
$this->addJSON('_title', $this->getHeader()->getTitleTag());
|
||||
$this->addJSON('_menu', $this->getHeader()->getMenu()->getDisplay());
|
||||
$this->addJSON('_scripts', $this->getHeader()->getScripts()->getFiles());
|
||||
$url = basename(PMA_getenv('SCRIPT_NAME')) . '?' . PMA_generate_common_url();
|
||||
$url = basename(PMA_getenv('SCRIPT_NAME')) . PMA_generate_common_url(
|
||||
array(
|
||||
'db' => $GLOBALS['db'],
|
||||
'table' => $GLOBALS['table'],
|
||||
'server' => $GLOBALS['server']
|
||||
),
|
||||
'unencoded'
|
||||
);
|
||||
$this->addJSON('_selflink', $url);
|
||||
$errors = $this->_footer->getErrorMessages();
|
||||
if (strlen($errors)) {
|
||||
@ -316,9 +323,13 @@ class PMA_Response
|
||||
'sql_query' => $query
|
||||
)
|
||||
);
|
||||
if (! empty($GLOBALS['focus_querywindow'])) {
|
||||
$this->addJSON('_focusQuerywindow', $query);
|
||||
}
|
||||
if (! empty($GLOBALS['reload'])) {
|
||||
$this->addJSON('_reloadNavigation', 1);
|
||||
}
|
||||
$this->addJSON('_params', $this->getHeader()->getJsParams());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -225,7 +225,7 @@ class PMA_Scripts
|
||||
$retval .= $this->_code;
|
||||
foreach ($this->_events as $js_event) {
|
||||
$retval .= sprintf(
|
||||
"$(window.parent).bind('%s', %s);\n",
|
||||
"$(window).bind('%s', %s);\n",
|
||||
$js_event['event'],
|
||||
$js_event['function']
|
||||
);
|
||||
|
||||
@ -1193,7 +1193,7 @@ class PMA_Util
|
||||
// to edit it (unless it's enormous, see linkOrButton() )
|
||||
if (! empty($cfg['SQLQuery']['Edit'])) {
|
||||
if ($cfg['EditInWindow'] == true) {
|
||||
$onclick = 'window.parent.focus_querywindow(\''
|
||||
$onclick = 'PMA_querywindow.focus(\''
|
||||
. PMA_jsFormat($sql_query, false) . '\'); return false;';
|
||||
} else {
|
||||
$onclick = '';
|
||||
|
||||
@ -161,7 +161,7 @@ function PMA_buildHtmlForDb(
|
||||
if ($is_superuser && !PMA_DRIZZLE) {
|
||||
$out .= '<td class="tool">'
|
||||
. '<a onclick="'
|
||||
. 'if (window.parent.setDb) window.parent.setDb(\''
|
||||
. 'PMA_commonActions.setDb(\''
|
||||
. PMA_jsFormat($current['SCHEMA_NAME']) . '\');'
|
||||
. '" href="server_privileges.php?' . $url_query
|
||||
. '&checkprivs=' . urlencode($current['SCHEMA_NAME'])
|
||||
|
||||
@ -211,7 +211,8 @@ class PMA_NavigationHeader
|
||||
__('Query window'),
|
||||
$showIcon,
|
||||
'b_selboard.png',
|
||||
'pma_open_querywindow'
|
||||
'pma_open_querywindow',
|
||||
true
|
||||
);
|
||||
}
|
||||
$retval .= $this->_getLink(
|
||||
|
||||
@ -144,9 +144,7 @@ function PMA_sqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
if (window.opener) {
|
||||
window.opener.parent.insertQuery();
|
||||
}
|
||||
PMA_querywindow.showQuery();
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
@ -127,9 +127,6 @@ $scripts->addFile('querywindow.js');
|
||||
if (PMA_isValid($_REQUEST['auto_commit'], 'identical', 'true')) {
|
||||
$scripts->addEvent('load', 'PMA_queryAutoCommit');
|
||||
}
|
||||
if (PMA_isValid($_REQUEST['init'])) {
|
||||
$scripts->addEvent('load', 'PMA_querywindowResize');
|
||||
}
|
||||
// always set focus to the textarea
|
||||
if ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full') {
|
||||
$scripts->addEvent('load', 'PMA_querywindowSetFocus');
|
||||
|
||||
@ -131,7 +131,7 @@ class PMA_Scripts_test extends PHPUnit_Framework_TestCase
|
||||
$this->assertRegExp(
|
||||
'@<script src="js/common.js\\?ts=[0-9]*" type="text/javascript"></script>
|
||||
<script type="text/javascript">// <!\\[CDATA\\[
|
||||
\\$\\(window.parent\\).bind\\(\'onClick\', doSomething\\);
|
||||
\\$\\(window\\).bind\\(\'onClick\', doSomething\\);
|
||||
// ]]></script>@',
|
||||
$this->object->getDisplay()
|
||||
);
|
||||
|
||||
@ -154,7 +154,7 @@ class PMA_build_html_for_db_test extends PHPUnit_Framework_TestCase
|
||||
),
|
||||
)
|
||||
),
|
||||
'<td class="tool"><input type="checkbox" name="selected_dbs[]" class="checkall" title="pma" value="pma" /></td><td class="name"> <a onclick="if (window.parent.openDb && window.parent.openDb(\'pma\')) return false;" href="index.php?target=main.php&db=pma" title="Jump to database" target="_parent"> pma</a></td><td class="tool" style="text-align: center;"><span class="nowrap"><img src="theme/s_cancel.png" title="Not replicated" alt="Not replicated" /></span></td><td class="tool"><a onclick="if (window.parent.setDb) window.parent.setDb(\'`pma`\');" href="server_privileges.php?target=main.php&checkprivs=pma" title="Check privileges for database "pma"."> <span class="nowrap"><img src="theme/s_rights.png" title="Check Privileges" alt="Check Privileges" /></span></a></td>'
|
||||
'<td class="tool"><input type="checkbox" name="selected_dbs[]" class="checkall" title="pma" value="pma" /></td><td class="name"> <a onclick="PMA_commonActions.openDb(\'pma\'); return false;" href="index.php?target=main.php&db=pma" title="Jump to database" target="_parent"> pma</a></td><td class="tool" style="text-align: center;"><span class="nowrap"><img src="theme/s_cancel.png" title="Not replicated" alt="Not replicated" /></span></td><td class="tool"><a onclick="PMA_commonActions.setDb(\'pma\');" href="server_privileges.php?target=main.php&checkprivs=pma" title="Check privileges for database "pma"."> <span class="nowrap"><img src="theme/s_rights.png" title="Check Privileges" alt="Check Privileges" /></span></a></td>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -42,18 +42,13 @@ class PMA_showMessage_test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['sql_query'] = "SELECT * FROM tblPatient ";
|
||||
|
||||
$this->expectOutputString(
|
||||
"<script type=\"text/javascript\">
|
||||
//<![CDATA[
|
||||
if (window.parent.updateTableTitle) window.parent.updateTableTitle('db.tbl', ' ()');
|
||||
//]]>
|
||||
</script>
|
||||
<div id=\"result_query\" align=\"\">
|
||||
"<div id=\"result_query\" align=\"\">
|
||||
<div class=\"notice\">msg</div><code class=\"sql\"><span class=\"syntax\"><span class=\"inner_sql\"><a href=\"./url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.0%2Fen%2Fselect.html&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" target=\"mysql_doc\"><span class=\"syntax_alpha syntax_alpha_reservedWord\">SELECT</span></a> <span class=\"syntax_punct\">*</span> <br /><span class=\"syntax_alpha syntax_alpha_reservedWord\">FROM</span> <span class=\"syntax_alpha syntax_alpha_identifier\">tblPatient</span></span></span></code><div class=\"tools\"><form action=\"sql.php\" method=\"post\"><input type=\"hidden\" name=\"db\" value=\"db\" /><input type=\"hidden\" name=\"table\" value=\"tbl\" /><input type=\"hidden\" name=\"server\" value=\"server\" /><input type=\"hidden\" name=\"lang\" value=\"en\" /><input type=\"hidden\" name=\"token\" value=\"647a62ad301bf9025e3b13bc7caa02cb\" /><input type=\"hidden\" name=\"sql_query\" value=\"SELECT * FROM tblPatient \" /></form><script type=\"text/javascript\">
|
||||
//<![CDATA[
|
||||
$('.tools form').last().after('[<a href=\"#\" title=\"Inline edit of this query\" class=\"inline_edit_sql\">Inline</a>]');
|
||||
//]]>
|
||||
</script> [
|
||||
<a href=\"tbl_sql.php?db=db&table=tbl&sql_query=SELECT+%2A+FROM+tblPatient+&show_query=1&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb#querybox\" onclick=\"window.parent.focus_querywindow('SELECT * FROM tblPatient '); return false;\">Edit</a>
|
||||
<a href=\"tbl_sql.php?db=db&table=tbl&sql_query=SELECT+%2A+FROM+tblPatient+&show_query=1&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb#querybox\" onclick=\"PMA_querywindow.focus('SELECT * FROM tblPatient '); return false;\">Edit</a>
|
||||
] [
|
||||
<a href=\"import.php?db=db&table=tbl&sql_query=EXPLAIN+SELECT+%2A+FROM+tblPatient+&server=server&lang=en&token=647a62ad301bf9025e3b13bc7caa02cb\" >Explain SQL</a>
|
||||
] [
|
||||
|
||||
@ -259,7 +259,7 @@ echo sprintf(
|
||||
</code>
|
||||
<div class="tools">
|
||||
[
|
||||
<a href="tbl_sql.php?db=test;table=test;sql_query=SELECT+%2A+FROM+%60test%60;show_query=1;token=266edabf70fa6368498d89b4054d01bf#querybox" onclick="window.parent.focus_querywindow('SELECT * FROM `test`'); return false;">Bearbeiten</a>
|
||||
<a href="tbl_sql.php?db=test;table=test;sql_query=SELECT+%2A+FROM+%60test%60;show_query=1;token=266edabf70fa6368498d89b4054d01bf#querybox" onclick="PMA_querywindow.focus('SELECT * FROM `test`'); return false;">Bearbeiten</a>
|
||||
] [
|
||||
<a href="import.php?db=test;table=test;sql_query=EXPLAIN+SELECT+%2A+FROM+%60test%60;token=266edabf70fa6368498d89b4054d01bf" >SQL erklären</a>
|
||||
] [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user