Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-07-22 20:40:21 +02:00
commit a286091e3c
6 changed files with 87 additions and 3 deletions

View File

@ -39,6 +39,7 @@ phpMyAdmin - ChangeLog
+ [interface] Improved support for events
+ [interface] Improved support for triggers
+ [interface] Improved server monitoring
+ AJAX for table Structure column Add
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes

View File

@ -1836,12 +1836,12 @@ $(document).ready(function() {
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
/**
* jQuery coding for 'Change Table'. Used on tbl_structure.php *
* jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php *
* Attach Ajax Event handlers for Change Table
*/
$(document).ready(function() {
/**
*Ajax action for submitting the column change form
*Ajax action for submitting the "Column Change" and "Add Column" form
**/
$("#append_fields_form input[name=do_save_data]").live('click', function(event) {
event.preventDefault();
@ -1876,16 +1876,20 @@ $(document).ready(function() {
$("#result_query").prepend((data.message));
if ($("#change_column_dialog").length > 0) {
$("#change_column_dialog").dialog("close").remove();
} else if ($("#add_columns").length > 0) {
$("#add_columns").dialog("close").remove();
}
/*Reload the field form*/
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
$("#fieldsForm").remove();
$("#addColumns").remove();
var $temp_div = $("<div id='temp_div'><div>").append(form_data);
if ($("#sqlqueryresults").length != 0) {
$temp_div.find("#fieldsForm").insertAfter("#sqlqueryresults");
} else {
$temp_div.find("#fieldsForm").insertAfter(".error");
}
$temp_div.find("#addColumns").insertBefore("iframe.IE_hack");
/*Call the function to display the more options in table*/
displayMoreTableOpts();
});
@ -2107,6 +2111,10 @@ $(document).ready(function() {
$("#popup_background").css({"opacity":"0.7"});
$("#popup_background").fadeIn("fast");
$("#enum_editor").fadeIn("fast");
/**Replacing the column name in the enum editor header*/
var column_name = $("#append_fields_form").find("input[id=field_0_1]").attr("value");
var h3_text = $("#enum_editor h3").html();
$("#enum_editor h3").html(h3_text.split('"')[0]+'"'+column_name+'"');
// Get the values
var values = $(this).parent().prev("input").attr("value").split(",");

View File

@ -207,6 +207,9 @@ $js_messages['strShowSearchCriteria'] = __('Show search criteria');
/* For tbl_change.js */
$js_messages['strIgnore'] = __('Ignore');
/* For tbl_structure.js */
$js_messages['strAddColumns'] = __('Add columns');
/* Designer (pmd/scripts/move.js) */
$js_messages['strSelectReferencedKey'] = __('Select referenced key');
$js_messages['strSelectForeignKey'] = __('Select Foreign Key');

View File

@ -336,6 +336,70 @@ $(document).ready(function() {
});
} //end show/hide table index
/**
*Ajax event handler for Add column(s)
**/
$("#addColumns.ajax input[value=Go]").live('click', function(event){
event.preventDefault();
/*Remove the hidden dialogs if there are*/
if ($('#add_columns').length != 0) {
$('#add_columns').remove();
}
var $div = $('<div id="add_columns"></div>');
var $form = $("#addColumns");
/**
* @var button_options Object that stores the options passed to jQueryUI
* dialog
*/
var button_options = {};
// in the following function we need to use $(this)
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
var button_options_error = {};
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
var $msgbox = PMA_ajaxShowMessage();
$.get( $form.attr('action') , $form.serialize()+"&ajax_request=true" , function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
$div
.append(data.error)
.dialog({
title: PMA_messages['strAddColumns'],
height: 230,
width: 900,
open: PMA_verifyTypeOfAllColumns,
modal: true,
buttons : button_options_error
})// end dialog options
} else {
$div
.append(data)
.dialog({
title: PMA_messages['strAddColumns'],
height: 600,
width: 900,
open: PMA_verifyTypeOfAllColumns,
modal: true,
buttons : button_options
})
//Remove the top menu container from the dialog
.find("#topmenucontainer").hide()
; // end dialog options
$div = $("#add_columns");
/*changed the z-index of the enum editor to allow the edit*/
$("#enum_editor").css("z-index", "1100");
PMA_convertFootnotesToTooltips($div);
}
PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()
});
}) // end $(document).ready()
@ -396,6 +460,8 @@ function changeColumns(action,url) {
$("#append_fields_form input[name=do_save_data]").addClass("ajax");
/*changed the z-index of the enum editor to allow the edit*/
$("#enum_editor").css("z-index", "1100");
$div = $("#change_column_dialog");
PMA_convertFootnotesToTooltips($div);
}
PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()

View File

@ -184,6 +184,12 @@ if (isset($_REQUEST['do_save_data'])) {
// Go back to the structure sub-page
$message = PMA_Message::success(__('Table %1$s has been altered successfully'));
$message->addParam($table);
if( $GLOBALS['is_ajax_request'] == true) {
$extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
PMA_ajaxResponse($message, $message->isSuccess(),$extra_data);
}
$active_page = 'tbl_structure.php';
require './tbl_structure.php';
} else {

View File

@ -668,7 +668,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
?>
<br />
<form method="post" action="tbl_addfield.php"
<form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>
onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)">
<?php
echo PMA_generate_common_hidden_inputs($db, $table);