Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-08-15 14:40:09 +02:00
commit b405a4ef73
3 changed files with 101 additions and 22 deletions

View File

@ -1992,7 +1992,7 @@ $(document).ready(function() {
**/
$("#alterTableOrderby.ajax").live('submit', function(event) {
event.preventDefault();
$form = $(this);
var $form = $(this);
PMA_prepareForAjaxRequest($form);
/*variables which stores the common attributes*/
@ -2010,9 +2010,9 @@ $(document).ready(function() {
$("#result_query .notice").remove();
$("#result_query").prepend((data.message));
} else {
$temp_div = $("<div id='temp_div'></div>")
var $temp_div = $("<div id='temp_div'></div>")
$temp_div.html(data.error);
$error = $temp_div.find("code").addClass("error");
var $error = $temp_div.find("code").addClass("error");
PMA_ajaxShowMessage($error);
}
}) // end $.post()
@ -2023,7 +2023,7 @@ $(document).ready(function() {
**/
$("#copyTable.ajax input[name='submit_copy']").live('click', function(event) {
event.preventDefault();
$form = $("#copyTable");
var $form = $("#copyTable");
if($form.find("input[name='switch_to_new']").attr('checked')) {
$form.append('<input type="hidden" name="submit_copy" value="Go" />');
$form.removeClass('ajax');
@ -2052,15 +2052,53 @@ $(document).ready(function() {
window.parent.frame_navigation.location.reload();
}
} else {
$temp_div = $("<div id='temp_div'></div>")
var $temp_div = $("<div id='temp_div'></div>");
$temp_div.html(data.error);
$error = $temp_div.find("code").addClass("error");
var $error = $temp_div.find("code").addClass("error");
PMA_ajaxShowMessage($error);
}
}) // end $.post()
}
});//end of copyTable ajax submit
/**
*Ajax events for actions in the "Table maintenance"
**/
$("#tbl_maintenance.ajax li a.maintain_action").live('click', function(event) {
event.preventDefault();
var $link = $(this);
var href = $link.attr("href");
href = href.split('?');
if ($("#sqlqueryresults").length != 0) {
$("#sqlqueryresults").remove();
}
if ($("#result_query").length != 0) {
$("#result_query").remove();
}
//variables which stores the common attributes
$.post(href[0], href[1]+"&ajax_request=true", function(data) {
if (data.success == undefined) {
var $temp_div = $("<div id='temp_div'></div>");
$temp_div.html(data);
var $success = $temp_div.find("#result_query .success");
PMA_ajaxShowMessage($success);
$("<div id='sqlqueryresults' class='ajax'></div>").insertAfter("#topmenucontainer");
$("#sqlqueryresults").html(data);
PMA_init_slider();
$("#sqlqueryresults").children("fieldset").remove();
} else if (data.success == true ) {
PMA_ajaxShowMessage(data.message);
$("<div id='sqlqueryresults' class='ajax'></div>").insertAfter("#topmenucontainer");
$("#sqlqueryresults").html(data.sql_query);
} else {
var $temp_div = $("<div id='temp_div'></div>");
$temp_div.html(data.error);
var $error = $temp_div.find("code").addClass("error");
PMA_ajaxShowMessage($error);
}
}) // end $.post()
});//end of table maintanance ajax click
}, 'top.frame_content'); //end $(document).ready for 'Table operations'
@ -2983,7 +3021,7 @@ $(document).ready(function() {
$("#drop_tbl_anchor").live('click', function(event) {
event.preventDefault();
//context is top.frame_content, so we need to use window.parent.db to access the db var
//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
*/
@ -3011,10 +3049,10 @@ $(document).ready(function() {
* @see $cfg['AjaxEnable']
*/
$(document).ready(function() {
$("#truncate_tbl_anchor").live('click', function(event) {
$("#truncate_tbl_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
//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
*/
@ -3024,13 +3062,26 @@ $(document).ready(function() {
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$.get(url, {'is_js_confirmed': '1', 'ajax_request': true}, function(data) {
//Database deleted successfully, refresh both the frames
window.parent.refreshNavigation();
window.parent.refreshMain();
if ($("#sqlqueryresults").length != 0) {
$("#sqlqueryresults").remove();
}
if ($("#result_query").length != 0) {
$("#result_query").remove();
}
if (data.success == true) {
PMA_ajaxShowMessage(data.message);
$("<div id='sqlqueryresults'></div>").insertAfter("#topmenucontainer");
$("#sqlqueryresults").html(data.sql_query);
} else {
var $temp_div = $("<div id='temp_div'></div>")
$temp_div.html(data.error);
var $error = $temp_div.find("code").addClass("error");
PMA_ajaxShowMessage($error);
}
}) // end $.get()
}); // end $.PMA_confirm()
}); //end of Drop Table Ajax action
}) // end of $(document).ready() for Drop Table
}); //end of Truncate Table Ajax action
}) // end of $(document).ready() for Truncate Table
/**
* Attach CodeMirror2 editor to SQL edit area.

28
sql.php
View File

@ -767,6 +767,34 @@ else {
PMA_ajaxResponse(NULL, true, $extra_data);
}
if (isset($_REQUEST['ajax_request']) && isset($_REQUEST['table_maintenance'])) {
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
// Gets the list of fields properties
if (isset($result) && $result) {
$fields_meta = PMA_DBI_get_fields_meta($result);
$fields_cnt = count($fields_meta);
}
if (empty($disp_mode)) {
// see the "PMA_setDisplayMode()" function in
// libraries/display_tbl.lib.php
$disp_mode = 'urdr111101';
}
// hide edit and delete links for information_schema
if ($db == 'information_schema') {
$disp_mode = 'nnnn110111';
}
$message = PMA_Message::success($message);
echo PMA_showMessage($message, $GLOBALS['sql_query'], 'success');
PMA_displayTable($result, $disp_mode, $analyzed_sql);
exit();
}
// Displays the headers
if (isset($show_query)) {
unset($show_query);

View File

@ -593,7 +593,7 @@ if (isset($possible_row_formats[$tbl_type])) {
<fieldset>
<legend><?php echo __('Table maintenance'); ?></legend>
<ul>
<ul id="tbl_maintenance" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>>
<?php
// Note: BERKELEY (BDB) is no longer supported, starting with MySQL 5.1
if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
@ -604,7 +604,7 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
'table_maintenance' => 'Go',
));
?>
<li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Check table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?>
</li>
@ -614,7 +614,7 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
$this_url_params = array_merge($url_params,
array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' ENGINE = InnoDB'));
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Defragment table'); ?></a>
<?php echo PMA_showMySQLDocu('Table_types', 'InnoDB_File_Defragmenting'); ?>
</li>
@ -627,7 +627,7 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
'table_maintenance' => 'Go',
));
?>
<li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Analyze table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?>
</li>
@ -640,7 +640,7 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
'table_maintenance' => 'Go',
));
?>
<li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Repair table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?>
</li>
@ -653,7 +653,7 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
'table_maintenance' => 'Go',
));
?>
<li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Optimize table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?>
</li>
@ -668,7 +668,7 @@ $this_url_params = array_merge($url_params,
'reload' => 1,
));
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<li><a class='maintain_action' href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Flush the table (FLUSH)'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'FLUSH'); ?>
</li>
@ -692,7 +692,7 @@ if (! $tbl_is_view && ! (isset($db_is_information_schema) && $db_is_information_
'message_to_show' => sprintf(__('Table %s has been emptied'), htmlspecialchars($table)),
));
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="truncate_tbl_anchor"' : ''); ?>>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="truncate_tbl_anchor" class="ajax"' : ''); ?>>
<?php echo __('Empty the table (TRUNCATE)'); ?></a>
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'TRUNCATE_TABLE'); ?>
</li>