diff --git a/ChangeLog b/ChangeLog
index ee13a5828d..6b7337d532 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,7 @@ phpMyAdmin - ChangeLog
- Patch #3500882 Fixing checkbox behaviour while editing identical rows
+ rfe #3441722 [interface] Display description of datatypes
+ rfe #3517835 [structure] Move columns easily
++ Ajaxified "Create View" functionality
3.5.2.0 (not yet released)
- bug #3521416 [interface] JS error when editing index
diff --git a/db_events.php b/db_events.php
index 35702ee547..84deaade94 100644
--- a/db_events.php
+++ b/db_events.php
@@ -19,11 +19,6 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/events.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
/**
* Include all other files
*/
diff --git a/db_routines.php b/db_routines.php
index 13f33f1561..c665b23bac 100644
--- a/db_routines.php
+++ b/db_routines.php
@@ -25,11 +25,6 @@ $GLOBALS['js_include'][] = 'jquery/timepicker.js';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/routines.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
/**
* Include all other files
*/
diff --git a/db_sql.php b/db_sql.php
index a0526dff58..c4b5c84111 100644
--- a/db_sql.php
+++ b/db_sql.php
@@ -17,11 +17,6 @@ $GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
require 'libraries/db_common.inc.php';
require_once 'libraries/sql_query_form.lib.php';
diff --git a/db_triggers.php b/db_triggers.php
index ec29205833..d94ea90d69 100644
--- a/db_triggers.php
+++ b/db_triggers.php
@@ -18,11 +18,6 @@ require_once 'libraries/common.lib.php';
$GLOBALS['js_include'][] = 'rte/common.js';
$GLOBALS['js_include'][] = 'rte/triggers.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
/**
* Include all other files
*/
diff --git a/js/functions.js b/js/functions.js
index f19ff17e04..e1a225c6da 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -3719,6 +3719,68 @@ $(function () {
}
});
+/**
+ * Ajaxification for the "Create View" action
+ */
+$(document).ready(function () {
+ $('span.create_view.ajax a').live('click', function (e) {
+ e.preventDefault();
+ var $msg = PMA_ajaxShowMessage();
+ var syntaxHighlighter = null;
+ $.get($(this).attr('href') + '&ajax_request=1', function (data) {
+ PMA_ajaxRemoveMessage($msg);
+ var buttonOptions = {};
+ buttonOptions[PMA_messages['strGo']] = function () {
+ if (typeof CodeMirror !== 'undefined') {
+ syntaxHighlighter.save();
+ }
+ $msg = PMA_ajaxShowMessage();
+ $.get('view_create.php', $('#createViewDialog').find('form').serialize(), function (data) {
+ PMA_ajaxRemoveMessage($msg);
+ if (data.success === true) {
+ $('#createViewDialog').dialog("close");
+ $('#result_query').html(data.message);
+ } else {
+ PMA_ajaxShowMessage(data.error, false);
+ }
+ });
+ };
+ buttonOptions[PMA_messages['strClose']] = function () {
+ $(this).dialog("close");
+ };
+ var $dialog = $('
').attr('id', 'createViewDialog').append(data).dialog({
+ width: 500,
+ minWidth: 300,
+ maxWidth: 620,
+ modal: true,
+ buttons: buttonOptions,
+ title: $('legend', $(data)).html(),
+ close: function () {
+ $(this).remove();
+ }
+ });
+ $dialog.find('legend').remove();
+ // Attach syntax highlited editor
+ if (typeof CodeMirror !== 'undefined') {
+ var $elm = $dialog.find('textarea');
+ var opts = {lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql"};
+ syntaxHighlighter = CodeMirror.fromTextArea($elm[0], opts);
+ }
+ $('input:visible[type=text]', $dialog).first().focus();
+ });
+ });
+ /**
+ * Attach Ajax event handlers for input fields in the editor
+ * and used to submit the Ajax request when the ENTER key is pressed.
+ */
+ $('#createViewDialog').find('input, select').live('keydown', function (e) {
+ if (e.which === 13) { // 13 is the ENTER key
+ e.preventDefault();
+ $(this).closest('.ui-dialog').find('.ui-button:first').click();
+ }
+ }); // end $.live()
+});
+
/**
* Toggles row colors of a set of 'tr' elements starting from a given element
*
diff --git a/js/server_status.js b/js/server_status.js
index 2a19f42993..196cbeb47f 100644
--- a/js/server_status.js
+++ b/js/server_status.js
@@ -159,9 +159,6 @@ $(function() {
'js/jquery/timepicker.js',
'js/jquery/jquery.json-2.2.js',
'js/jquery/jquery.sortableTable.js'];
- if (cfg_CodemirrorEnable) {
- scripts.push('js/codemirror/lib/codemirror.js', 'js/codemirror/mode/mysql/mysql.js');
- }
scripts.push('js/server_status_monitor.js');
loadJavascript(scripts);
}, 50);
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php
index 1dec0e57ab..13a5cf43f0 100644
--- a/libraries/display_tbl.lib.php
+++ b/libraries/display_tbl.lib.php
@@ -2703,11 +2703,13 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql)
$header_shown = true;
}
if (!PMA_DRIZZLE && !isset($analyzed_sql[0]['queryflags']['procedure'])) {
+ $ajax_class = $GLOBALS['cfg']['AjaxEnable'] ? ' ajax' : '';
+ echo "";
echo PMA_linkOrButton(
'view_create.php' . $url_query,
PMA_getIcon('b_views.png', __('Create view'), true),
'', true, true, ''
- ) . "\n";
+ ) . "\n";
}
if ($header_shown) {
echo '
';
diff --git a/libraries/header_scripts.inc.php b/libraries/header_scripts.inc.php
index df533226a7..1711761ca7 100644
--- a/libraries/header_scripts.inc.php
+++ b/libraries/header_scripts.inc.php
@@ -36,6 +36,11 @@ $is_superuser = function_exists('PMA_isSuperuser') && PMA_isSuperuser();
$GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'jquery/jquery.qtip-1.0.0-rc3.js';
+if ($GLOBALS['cfg']['CodemirrorEnable']) {
+ $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+ $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
+}
+
$params = array('lang' => $GLOBALS['lang']);
if (isset($GLOBALS['db'])) {
$params['db'] = $GLOBALS['db'];
diff --git a/querywindow.php b/querywindow.php
index 2f8a0dc178..dfccd95323 100644
--- a/querywindow.php
+++ b/querywindow.php
@@ -121,11 +121,6 @@ $sql_query = '';
$js_include[] = 'common.js';
$js_include[] = 'querywindow.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
if (PMA_isValid($_REQUEST['auto_commit'], 'identical', 'true')) {
$js_events[] = array(
'event' => 'load',
diff --git a/server_privileges.php b/server_privileges.php
index 5d0aa9eb7c..f265af4261 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -16,10 +16,6 @@ require_once 'libraries/common.inc.php';
$GLOBALS['js_include'][] = 'server_privileges.js';
$GLOBALS['js_include'][] = 'functions.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
$_add_user_error = false;
/**
diff --git a/server_sql.php b/server_sql.php
index c3842c3fec..538759066d 100644
--- a/server_sql.php
+++ b/server_sql.php
@@ -17,11 +17,6 @@ $GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
require_once 'libraries/server_common.inc.php';
require_once 'libraries/sql_query_form.lib.php';
diff --git a/server_status.php b/server_status.php
index 3f3675890d..93c3283c76 100644
--- a/server_status.php
+++ b/server_status.php
@@ -430,8 +430,6 @@ if (PMA_DRIZZLE) {
* JS Includes
*/
-// needed to decide whether to load codemirror.js in server_status.js
-PMA_AddJSVar('cfg_CodemirrorEnable', $GLOBALS['cfg']['CodemirrorEnable'] ? 1 : 0);
$GLOBALS['js_include'][] = 'server_status.js';
$GLOBALS['js_include'][] = 'jquery/jquery.tablesorter.js';
diff --git a/sql.php b/sql.php
index 5355dd6ea0..0dc0673b4f 100644
--- a/sql.php
+++ b/sql.php
@@ -21,12 +21,6 @@ $GLOBALS['js_include'][] = 'tbl_structure.js';
$GLOBALS['js_include'][] = 'indexes.js';
$GLOBALS['js_include'][] = 'gis_data_editor.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
-
/**
* Sets globals from $_POST
*/
diff --git a/tbl_export.php b/tbl_export.php
index c2f171f6a2..6dc545f203 100644
--- a/tbl_export.php
+++ b/tbl_export.php
@@ -12,11 +12,6 @@ require_once 'libraries/common.inc.php';
$GLOBALS['js_include'][] = 'export.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
/**
* Gets tables informations and displays top links
*/
diff --git a/tbl_replace.php b/tbl_replace.php
index 4eb563bb5d..f7e0f9e263 100644
--- a/tbl_replace.php
+++ b/tbl_replace.php
@@ -30,11 +30,6 @@ $GLOBALS['js_include'][] = 'makegrid.js';
// Needed for generation of Inline Edit anchors
$GLOBALS['js_include'][] = 'sql.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
if (isset($_REQUEST['insert_rows'])
&& is_numeric($_REQUEST['insert_rows'])
&& $_REQUEST['insert_rows'] != $cfg['InsertRows']
diff --git a/tbl_sql.php b/tbl_sql.php
index a4a595a33d..bc0123f1b4 100644
--- a/tbl_sql.php
+++ b/tbl_sql.php
@@ -17,11 +17,6 @@ $GLOBALS['js_include'][] = 'functions.js';
$GLOBALS['js_include'][] = 'makegrid.js';
$GLOBALS['js_include'][] = 'sql.js';
-if ($GLOBALS['cfg']['CodemirrorEnable']) {
- $GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
- $GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
-}
-
require 'libraries/tbl_common.php';
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 6f1838bb6c..dd4b26eab0 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -2099,7 +2099,8 @@ fieldset .disabled-field td {
}
.rte_table td {
- vertical-align: middle;
+ vertical-align: middle;
+ padding: 0.2em;
}
.rte_table tr td:nth-child(1) {
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index 7a5409dce7..427dc707e5 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -2589,6 +2589,7 @@ fieldset .disabled-field td {
.rte_table td {
vertical-align: middle;
+ padding: 0.2em;
}
.rte_table tr td:nth-child(1) {
diff --git a/view_create.php b/view_create.php
index 17b414229c..f5caece158 100644
--- a/view_create.php
+++ b/view_create.php
@@ -63,11 +63,19 @@ if (isset($_REQUEST['createview'])) {
}
if (PMA_DBI_try_query($sql_query)) {
- $message = PMA_Message::success();
- include './' . $cfg['DefaultTabDatabase'];
- exit();
+ if ($GLOBALS['is_ajax_request'] != true) {
+ $message = PMA_Message::success();
+ include './' . $cfg['DefaultTabDatabase'];
+ exit();
+ } else {
+ PMA_ajaxResponse(PMA_showMessage(PMA_Message::success(), $sql_query), 1);
+ }
} else {
- $message = PMA_Message::rawError(PMA_DBI_getError());
+ if ($GLOBALS['is_ajax_request'] != true) {
+ $message = PMA_Message::rawError(PMA_DBI_getError());
+ } else {
+ PMA_ajaxResponse(PMA_Message::error("$sql_query
" . PMA_DBI_getError()), 0);
+ }
}
}
@@ -90,8 +98,9 @@ if (PMA_isValid($_REQUEST['view'], 'array')) {
* We use db links because a VIEW is not necessarily on a single table
*/
$num_tables = 0;
-require_once './libraries/db_links.inc.php';
-
+if ($GLOBALS['is_ajax_request'] != true) {
+ require_once './libraries/db_links.inc.php';
+}
$url_params['db'] = $GLOBALS['db'];
$url_params['reload'] = 1;
@@ -104,9 +113,8 @@ $url_params['reload'] = 1;