").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(",");
diff --git a/js/messages.php b/js/messages.php
index 5b91d791d9..4cfa7e7e44 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -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');
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index 69f872d8ad..897cad8ade 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -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 = $('
');
+
+ 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()
diff --git a/tbl_addfield.php b/tbl_addfield.php
index ec910fdf4b..a866fef7a9 100644
--- a/tbl_addfield.php
+++ b/tbl_addfield.php
@@ -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 {
diff --git a/tbl_structure.php b/tbl_structure.php
index afac23fc47..a4e9692311 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -668,7 +668,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
?>
-