").append(data);
var $error = $temp_div.find(".error code").addClass("error");
@@ -668,7 +691,7 @@ $(function() {
/**
* Reload fields table
*/
-function reloadFieldForm() {
+function reloadFieldForm(message) {
$.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
var $temp_div = $("
").append(form_data);
$("#fieldsForm").replaceWith($temp_div.find("#fieldsForm"));
@@ -679,6 +702,9 @@ function reloadFieldForm() {
$table_clone = false;
$("div.replace_in_more").hide(); // fix "more" dropdown
moreOptsMenuResize();
+ setTimeout(function() {
+ PMA_ajaxShowMessage(message);
+ }, 500);
});
}
diff --git a/libraries/export/htmlword.php b/libraries/export/htmlword.php
index d3b0940cfd..97bc7bc7d4 100644
--- a/libraries/export/htmlword.php
+++ b/libraries/export/htmlword.php
@@ -201,10 +201,20 @@ if (isset($plugin_list)) {
$schema_insert .= '
' . __('Default') . ' | ';
$schema_insert .= '';
+ /**
+ * Get the unique keys in the table
+ */
+ $unique_keys = array();
+ $keys = PMA_DBI_get_table_indexes($db, $table);
+ foreach ($keys as $key) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
+ }
+ }
$columns = PMA_DBI_get_columns($db, $view);
foreach ($columns as $column) {
- $schema_insert .= PMA_formatOneColumnDefinition($column);
+ $schema_insert .= PMA_formatOneColumnDefinition($column, $unique_keys);
$schema_insert .= '';
}
@@ -295,8 +305,18 @@ if (isset($plugin_list)) {
$schema_insert .= '';
$columns = PMA_DBI_get_columns($db, $table);
+ /**
+ * Get the unique keys in the table
+ */
+ $unique_keys = array();
+ $keys = PMA_DBI_get_table_indexes($db, $table);
+ foreach ($keys as $key) {
+ if ($key['Non_unique'] == 0) {
+ $unique_keys[] = $key['Column_name'];
+ }
+ }
foreach ($columns as $column) {
- $schema_insert .= PMA_formatOneColumnDefinition($column);
+ $schema_insert .= PMA_formatOneColumnDefinition($column, $unique_keys);
$field_name = $column['Field'];
if ($do_relation && $have_rel) {
@@ -407,28 +427,15 @@ if (isset($plugin_list)) {
* Formats the definition for one column
*
* @param array $column info about this column
+ * @param array $unique_keys unique keys of the table
*
* @return string Formatted column definition
*
* @access public
*/
function PMA_formatOneColumnDefinition(
- $column
+ $column, $unique_keys
) {
- /**
- * Get the unique keys in the table
- */
- $unique_keys = array();
- $keys = PMA_DBI_get_table_indexes($db, $table);
- foreach ($keys as $key) {
- if ($key['Non_unique'] == 0) {
- $unique_keys[] = $key['Column_name'];
- }
- }
-
- /**
- * Formats the definition
- */
$definition = '';
$extracted_columnspec = PMA_extractColumnSpec($column['Type']);
$type = htmlspecialchars($extracted_columnspec['print_type']);
diff --git a/libraries/export/texytext.php b/libraries/export/texytext.php
index 0017a96bf1..5982482bae 100644
--- a/libraries/export/texytext.php
+++ b/libraries/export/texytext.php
@@ -177,7 +177,7 @@ if (isset($plugin_list)) {
* Get the unique keys in the table
*/
$unique_keys = array();
- $keys = PMA_DBI_get_table_indexes($db, $table);
+ $keys = PMA_DBI_get_table_indexes($db, $view);
foreach ($keys as $key) {
if ($key['Non_unique'] == 0) {
$unique_keys[] = $key['Column_name'];
@@ -202,39 +202,11 @@ if (isset($plugin_list)) {
$text_output .= '|' . __('Default');
$text_output .= "\n|------\n";
- $columns = PMA_DBI_get_columns($db, $table);
+ $columns = PMA_DBI_get_columns($db, $view);
foreach ($columns as $column) {
-
- $extracted_columnspec = PMA_extractColumnSpec($column['Type']);
- $type = $extracted_columnspec['print_type'];
- if (empty($type)) {
- $type = ' ';
- }
-
- if (! isset($column['Default'])) {
- if ($column['Null'] != 'NO') {
- $column['Default'] = 'NULL';
- }
- }
-
- $fmt_pre = '';
- $fmt_post = '';
- if (in_array($column['Field'], $unique_keys)) {
- $fmt_pre = '**' . $fmt_pre;
- $fmt_post = $fmt_post . '**';
- }
- if ($column['Key']=='PRI') {
- $fmt_pre = '//' . $fmt_pre;
- $fmt_post = $fmt_post . '//';
- }
- $text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
- $text_output .= '|' . htmlspecialchars($type);
- $text_output .= '|' . (($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
- $text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
-
- $field_name = $column['Field'];
+ $text_output .= PMA_formatOneColumnDefinition($column, $unique_keys);
$text_output .= "\n";
- } // end while
+ } // end foreach
return $text_output;
}
@@ -333,34 +305,7 @@ if (isset($plugin_list)) {
$columns = PMA_DBI_get_columns($db, $table);
foreach ($columns as $column) {
-
- $extracted_columnspec = PMA_extractColumnSpec($column['Type']);
- $type = $extracted_columnspec['print_type'];
- if (empty($type)) {
- $type = ' ';
- }
-
- if (! isset($column['Default'])) {
- if ($column['Null'] != 'NO') {
- $column['Default'] = 'NULL';
- }
- }
-
- $fmt_pre = '';
- $fmt_post = '';
- if (in_array($column['Field'], $unique_keys)) {
- $fmt_pre = '**' . $fmt_pre;
- $fmt_post = $fmt_post . '**';
- }
- if ($column['Key']=='PRI') {
- $fmt_pre = '//' . $fmt_pre;
- $fmt_post = $fmt_post . '//';
- }
- $text_output .= '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
- $text_output .= '|' . htmlspecialchars($type);
- $text_output .= '|' . (($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
- $text_output .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
-
+ $text_output .= PMA_formatOneColumnDefinition($column, $unique_keys);
$field_name = $column['Field'];
if ($do_relation && $have_rel) {
@@ -374,7 +319,7 @@ if (isset($plugin_list)) {
}
$text_output .= "\n";
- } // end while
+ } // end foreach
return $text_output;
} // end of the 'PMA_getTableDef()' function
@@ -465,5 +410,46 @@ if (isset($plugin_list)) {
return PMA_exportOutputHandler($dump);
}
+ /**
+ * Formats the definition for one column
+ *
+ * @param array $column info about this column
+ * @param array $unique_keys unique keys for this table
+ *
+ * @return string Formatted column definition
+ *
+ * @access public
+ */
+ function PMA_formatOneColumnDefinition(
+ $column, $unique_keys
+ ) {
+ $extracted_columnspec = PMA_extractColumnSpec($column['Type']);
+ $type = $extracted_columnspec['print_type'];
+ if (empty($type)) {
+ $type = ' ';
+ }
+
+ if (! isset($column['Default'])) {
+ if ($column['Null'] != 'NO') {
+ $column['Default'] = 'NULL';
+ }
+ }
+
+ $fmt_pre = '';
+ $fmt_post = '';
+ if (in_array($column['Field'], $unique_keys)) {
+ $fmt_pre = '**' . $fmt_pre;
+ $fmt_post = $fmt_post . '**';
+ }
+ if ($column['Key']=='PRI') {
+ $fmt_pre = '//' . $fmt_pre;
+ $fmt_post = $fmt_post . '//';
+ }
+ $definition = '|' . $fmt_pre . htmlspecialchars($column['Field']) . $fmt_post;
+ $definition .= '|' . htmlspecialchars($type);
+ $definition .= '|' . (($column['Null'] == '' || $column['Null'] == 'NO') ? __('No') : __('Yes'));
+ $definition .= '|' . htmlspecialchars(isset($column['Default']) ? $column['Default'] : '');
+ return $definition;
+ }
}
?>
diff --git a/tbl_alter.php b/tbl_alter.php
index 219e820f09..7c658b332b 100644
--- a/tbl_alter.php
+++ b/tbl_alter.php
@@ -39,7 +39,7 @@ $err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
/**
* Moving columns
*/
-if (isset($_REQUEST['move_columns'])
+if (isset($_REQUEST['move_columns'])
&& is_array($_REQUEST['move_columns'])
&& $GLOBALS['is_ajax_request']) {
/*
@@ -127,7 +127,13 @@ if (isset($_REQUEST['move_columns'])
if ($tmp_error) {
PMA_ajaxResponse(PMA_Message::error($tmp_error), false);
}
- PMA_ajaxResponse(PMA_Message::success(__('The columns have been moved successfully.')), true);
+ PMA_ajaxResponse(
+ PMA_Message::success(__('The columns have been moved successfully.')),
+ true,
+ array(
+ 'columns' => $column_names
+ )
+ );
}
/**
diff --git a/tbl_create.php b/tbl_create.php
index 978c83a742..588dbeb675 100644
--- a/tbl_create.php
+++ b/tbl_create.php
@@ -108,7 +108,9 @@ if (isset($_REQUEST['do_save_data'])) {
? $_REQUEST['field_comments'][$i]
: '',
$field_primary,
- $i
+ $i,
+ '',
+ ''
);
$query .= ', ';