Merge branch 'master' of github.com:phpmyadmin/phpmyadmin

This commit is contained in:
Michal Čihař 2012-04-26 13:11:40 +02:00
commit 26b7fa19ea
20 changed files with 109 additions and 77 deletions

View File

@ -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

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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';

View File

@ -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
*/

View File

@ -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 = $('<div/>').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
*

View File

@ -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);

View File

@ -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 "<span class='create_view$ajax_class'>";
echo PMA_linkOrButton(
'view_create.php' . $url_query,
PMA_getIcon('b_views.png', __('Create view'), true),
'', true, true, ''
) . "\n";
) . "</span>\n";
}
if ($header_shown) {
echo '</fieldset><br />';

View File

@ -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'];

View File

@ -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',

View File

@ -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;
/**

View File

@ -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';

View File

@ -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';

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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']

View File

@ -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 .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';

View File

@ -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) {

View File

@ -2589,6 +2589,7 @@ fieldset .disabled-field td {
.rte_table td {
vertical-align: middle;
padding: 0.2em;
}
.rte_table tr td:nth-child(1) {

View File

@ -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("<i>$sql_query</i><br /><br />" . 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;
<form method="post" action="view_create.php">
<?php echo PMA_generate_common_hidden_inputs($url_params); ?>
<fieldset>
<legend>CREATE VIEW</legend>
<table>
<legend><?php echo __('Create view') . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_VIEW'); ?></legend>
<table class="rte_table">
<tr><td><label for="or_replace">OR REPLACE</label></td>
<td><input type="checkbox" name="view[or_replace]" id="or_replace"
<?php if ($view['or_replace']) { ?>
@ -135,20 +143,21 @@ $url_params['reload'] = 1;
value="<?php echo htmlspecialchars($view['name']); ?>" />
</td>
</tr>
<tr><td><?php echo __('Column names'); ?></td>
<td><input type="text" maxlength="100" size="50" name="view[column_names]"
onfocus="this.select()"
value="<?php echo htmlspecialchars($view['column_names']); ?>" />
</td>
</tr>
<tr><td>AS</td>
<td>
<textarea name="view[as]" rows="<?php echo $cfg['TextareaRows']; ?>"
cols="<?php echo $cfg['TextareaCols']; ?>"
dir="<?php echo $text_dir; ?>" onfocus="this.select();"
><?php echo htmlspecialchars($view['as']); ?></textarea>
dir="<?php echo $text_dir; ?>"<?php
if ($GLOBALS['cfg']['TextareaAutoSelect'] || true) {
echo ' onclick="selectContent(this, sql_box_locked, true)"';
}
?>><?php echo htmlspecialchars($view['as']); ?></textarea>
</td>
</tr>
<tr><td>WITH</td>
@ -161,17 +170,28 @@ $url_params['reload'] = 1;
}
echo ' id="view_with_' . str_replace(' ', '_', htmlspecialchars($option)) . '"';
echo ' value="' . htmlspecialchars($option) . '" />';
echo '<label for="view_with_' . str_replace(' ', '_', htmlspecialchars($option)) . '">';
echo htmlspecialchars($option) . '</label>&nbsp;';
echo '<label for="view_with_' . str_replace(' ', '_', htmlspecialchars($option)) . '">&nbsp;';
echo htmlspecialchars($option) . '</label><br />';
}
?>
</td>
</tr>
</table>
</fieldset>
<?php
if ($GLOBALS['is_ajax_request'] != true) {
?>
<fieldset class="tblFooters">
<input type="submit" name="createview" value="<?php echo __('Go'); ?>" />
</fieldset>
<?php
} else {
?>
<input type="hidden" name="createview" value="1" />
<input type="hidden" name="ajax_request" value="1" />
<?php
}
?>
</form>
</div>
<?php