Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pootle server 2011-07-08 22:40:24 +02:00
commit e2bbf40462
5 changed files with 68 additions and 50 deletions

View File

@ -34,6 +34,7 @@ phpMyAdmin - ChangeLog
+ Show/hide column in table Browse
- bug #3353856 [AJAX] AJAX dialogs use wrong font-size
- bug #3354356 [interface] Timepicker does not work in AJAX dialogs
+ AJAX for table Structure Indexes Edit
3.4.4.0 (not yet released)
- bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes

View File

@ -2152,9 +2152,45 @@ function displayMoreTableOpts() {
}
});
}
}
$(document).ready(initTooltips);
/**
* Ensures indexes names are valid according to their type and, for a primary
* key, lock index name to 'PRIMARY'
* @param string form_id Variable which parses the form name as
* the input
* @return boolean false if there is no index form, true else
*/
function checkIndexName(form_id)
{
if ($("#"+form_id).length == 0) {
return false;
}
// Gets the elements pointers
var $the_idx_name = $("#input_index_name");
var $the_idx_type = $("#select_index_type");
// Index is a primary key
if ($the_idx_type.find("option:selected").attr("value") == 'PRIMARY') {
$the_idx_name.attr("value", 'PRIMARY');
$the_idx_name.attr("disabled", true);
}
// Other cases
else {
if ($the_idx_name.attr("value") == 'PRIMARY') {
$the_idx_name.attr("value", '');
}
$the_idx_name.attr("disabled", false);
}
return true;
} // end of the 'checkIndexName()' function
/* Displays tooltips */
function initTooltips() {
// Hide the footnotes from the footer (which are displayed for

View File

@ -4,45 +4,6 @@
*
*/
/**
* Ensures indexes names are valid according to their type and, for a primary
* key, lock index name to 'PRIMARY'
*
* @return boolean false if there is no index form, true else
*/
function checkIndexName()
{
if (typeof(document.forms['index_frm']) == 'undefined') {
return false;
}
// Gets the elements pointers
var the_idx_name = document.forms['index_frm'].elements['index[Key_name]'];
var the_idx_type = document.forms['index_frm'].elements['index[Index_type]'];
// Index is a primary key
if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) {
document.forms['index_frm'].elements['index[Key_name]'].value = 'PRIMARY';
if (typeof(the_idx_name.disabled) != 'undefined') {
document.forms['index_frm'].elements['index[Key_name]'].disabled = true;
}
}
// Other cases
else {
if (the_idx_name.value == 'PRIMARY') {
document.forms['index_frm'].elements['index[Key_name]'].value = '';
}
if (typeof(the_idx_name.disabled) != 'undefined') {
document.forms['index_frm'].elements['index[Key_name]'].disabled = false;
}
}
return true;
} // end of the 'checkIndexName()' function
onload = checkIndexName;
/**
* Hides/shows the inputs and submits appropriately depending
* on whether the index type chosen is 'SPATIAL' or not.
@ -56,7 +17,7 @@ function checkIndexType()
/**
* @var Object Table header for the size column.
*/
$size_header = $('thead tr th:nth-child(2)');
$size_header = $('#index_columns thead tr th:nth-child(2)');
/**
* @var Object Inputs to specify the columns for the index.
*/
@ -132,7 +93,12 @@ function checkIndexType()
*/
$(document).ready(function() {
checkIndexType();
$('#select_index_type').bind('change', checkIndexType);
checkIndexName("index_frm");
$('#select_index_type').live('change', function(event){
event.preventDefault();
checkIndexType();
checkIndexName("index_frm");
});
});
/**#@- */

View File

@ -179,6 +179,7 @@ $(document).ready(function() {
height: 230,
width: 900,
open: PMA_verifyTypeOfAllColumns,
modal: true,
buttons : button_options_error
})// end dialog options
} else {
@ -189,6 +190,7 @@ $(document).ready(function() {
height: 600,
width: 900,
open: PMA_verifyTypeOfAllColumns,
modal: true,
buttons : button_options
})
//Remove the top menu container from the dialog
@ -269,10 +271,10 @@ $(document).ready(function() {
*/
var button_options = {};
// in the following function we need to use $(this)
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
var button_options_error = {};
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
var $msgbox = PMA_ajaxShowMessage();
$.get( "tbl_indexes.php" , url , function(data) {
@ -285,6 +287,7 @@ $(document).ready(function() {
height: 230,
width: 900,
open: PMA_verifyTypeOfAllColumns,
modal: true,
buttons : button_options_error
})// end dialog options
} else {
@ -295,16 +298,18 @@ $(document).ready(function() {
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
checkIndexName("index_frm");
}
PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()
});
/**
*Ajax action for submiting the index form
**/
@ -337,8 +342,14 @@ $(document).ready(function() {
}
} else {
var temp_div = $("<div id='temp_div'><div>").append(data.error);
var error = $(temp_div).find(".error code").addClass("error");
if(data.error != undefined) {
var temp_div = $("<div id='temp_div'><div>").append(data.error);
if($(temp_div).find(".error code").length != 0) {
var error = $(temp_div).find(".error code").addClass("error");
} else {
var error = temp_div;
}
}
PMA_ajaxShowMessage(error);
}
@ -360,7 +371,7 @@ $(document).ready(function() {
$.post($form.attr('action'), $form.serialize()+"&add_fields=Go", function(data) {
$("#index_columns").remove();
var temp_div = $("<div id='temp_div'><div>").append(data);
$(temp_div).find("#index_columns").insertAfter("#index_frm fieldset .error");
$(temp_div).find("#index_columns").appendTo("#index_edit_fields");
}) // end $.post()
}) // end insert table button "Go"
@ -390,6 +401,6 @@ $(document).ready(function() {
return false;
});
} //end show/hide table index
}) // end $(document).ready()

View File

@ -108,6 +108,10 @@ if (isset($_REQUEST['do_save_data'])) {
require './tbl_structure.php';
exit;
} else {
if( $GLOBALS['is_ajax_request'] == true) {
$extra_data['error'] = $error;
PMA_ajaxResponse($error,false);
}
$error->display();
}
} // end builds the new index
@ -158,7 +162,7 @@ if (isset($_REQUEST['create_index'])) {
echo PMA_generate_common_hidden_inputs($form_params);
?>
<fieldset>
<fieldset id="index_edit_fields">
<legend>
<?php
if (isset($_REQUEST['create_index'])) {
@ -179,7 +183,7 @@ PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b>
<div class="formelement">
<label for="select_index_type"><?php echo __('Index type:'); ?></label>
<select name="index[Index_type]" id="select_index_type" onchange="return checkIndexName()">
<select name="index[Index_type]" id="select_index_type" >
<?php echo $index->generateIndexSelector(); ?>
</select>
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>