diff --git a/ChangeLog b/ChangeLog index 4ae25e9a61..0889f7bc5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,11 @@ phpMyAdmin - ChangeLog + Shift/click support in database Structure + 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 ++ AJAX for table Structure column Change ++ [interface] Improved support for events ++ [interface] Improved support for triggers 3.4.4.0 (not yet released) - bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes @@ -42,6 +47,7 @@ phpMyAdmin - ChangeLog - bug #3353649 [interface] "Create an index on X columns" form not validated - bug #3350790 [interface] JS error in Table->Structure->Index->Edit - bug #3353811 [interface] Info message has "error" class +- bug #3357837 [interface] TABbing through a NULL field in the inline mode resets NULL 3.4.3.1 (2011-07-02) - [security] Fixed possible session manipulation in swekey authentication, see PMASA-2011-5 diff --git a/Documentation.html b/Documentation.html index 29054a28ba..6a8d5dcd16 100644 --- a/Documentation.html +++ b/Documentation.html @@ -2143,7 +2143,7 @@ setfacl -d -m "g:www-data:rwx" tmp identify what they mean. -
first_timestamp, which is used for first timestamp column
in table.LIKE by default instead of
- LIKE %...%, to avoid unintended performance problems
- in case of huge tables.';
- $output .= PMA_SQP_formatHtml(PMA_SQP_parse(implode($queries)));
- $output .= '';
- // Display results
- if ($result) {
- $output .= "";
- } else {
- $notice = __('MySQL returned an empty result set (i.e. zero rows).');
- $output .= PMA_message::notice($notice)->getDisplay();
- }
- } else {
- $output = '';
- $message = PMA_message::error(sprintf(__('The following query has failed: "%s"'), $query) . '
- * addEvent(window, 'load', PMA_initPage);
- *
- * @param object or id
- * @param string event type (load, mouseover, focus, ...)
- * @param function to be attached
- */
-function addEvent(obj, type, fn)
-{
- if (obj.attachEvent) {
- obj['e' + type + fn] = fn;
- obj[type + fn] = function() {obj['e' + type + fn](window.event);}
- obj.attachEvent('on' + type, obj[type + fn]);
- } else {
- obj.addEventListener(type, fn, false);
- }
-}
-
-/**
- * detach/remove a function from an object event
- *
- * @param object or id
- * @param event type (load, mouseover, focus, ...)
- * @param function naem of function to be attached
- */
-function removeEvent(obj, type, fn)
-{
- if (obj.detachEvent) {
- obj.detachEvent('on' + type, obj[type + fn]);
- obj[type + fn] = null;
- } else {
- obj.removeEventListener(type, fn, false);
- }
-}
-
-/**
- * get DOM elements by html class
- *
- * @param string class_name - name of class
- * @param node node - search only sub nodes of this node (optional)
- * @param string tag - search only these tags (optional)
- */
-function getElementsByClassName(class_name, node, tag)
-{
- var classElements = new Array();
-
- if (node == null) {
- node = document;
- }
- if (tag == null) {
- tag = '*';
- }
-
- var j = 0, teststr;
- var els = node.getElementsByTagName(tag);
- var elsLen = els.length;
-
- for (i = 0; i < elsLen; i++) {
- if (els[i].className.indexOf(class_name) != -1) {
- teststr = "," + els[i].className.split(" ").join(",") + ",";
- if (teststr.indexOf("," + class_name + ",") != -1) {
- classElements[j] = els[i];
- j++;
- }
- }
- }
- return classElements;
-}
-
/**
* sets current selected db
*
diff --git a/js/db_structure.js b/js/db_structure.js
index ad55341b60..b1c2ff05a7 100644
--- a/js/db_structure.js
+++ b/js/db_structure.js
@@ -61,12 +61,12 @@ $(document).ready(function() {
$("td.insert_table a.ajax").live('click', function(event){
event.preventDefault();
currrent_insert_table = $(this);
- var url = $(this).attr("href");
- if (url.substring(0, 15) == "tbl_change.php?") {
- url = url.substring(15);
+ var $url = $(this).attr("href");
+ if ($url.substring(0, 15) == "tbl_change.php?") {
+ $url = $url.substring(15);
}
- var div = $('');
+ var $div = $('');
var target = "tbl_change.php";
/**
@@ -75,38 +75,43 @@ $(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( target , url+"&ajax_request=true" , function(data) {
+ $.get( target , $url+"&ajax_request=true" , function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
- div
+ $div
.append(data.error)
.dialog({
title: PMA_messages['strInsertTable'],
height: 230,
width: 900,
+ modal: true,
open: PMA_verifyTypeOfAllColumns,
buttons : button_options_error
})// end dialog options
} else {
- div
- .append(data)
- .dialog({
- title: PMA_messages['strInsertTable'],
- height: 600,
- width: 900,
- open: PMA_verifyTypeOfAllColumns,
- buttons : button_options
- })
+ var $dialog = $div
+ .append(data)
+ .dialog({
+ title: PMA_messages['strInsertTable'],
+ height: 600,
+ width: 900,
+ modal: true,
+ open: PMA_verifyTypeOfAllColumns,
+ buttons : button_options
+ });// end dialog options
//Remove the top menu container from the dialog
- .find("#topmenucontainer").hide()
- ; // end dialog options
+ $dialog.find("#topmenucontainer").hide();
+ //Adding the datetime pikers for the dialog
+ $dialog.find('.datefield, .datetimefield').each(function () {
+ PMA_addDatepicker($(this));
+ });
$(".insertRowTable").addClass("ajax");
$("#buttonYes").addClass("ajax");
}
diff --git a/js/functions.js b/js/functions.js
index 1841caf0ad..cbdef19dea 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1827,6 +1827,76 @@ $(document).ready(function() {
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
+/**
+ * jQuery coding for 'Change Table'. Used on tbl_structure.php *
+ * Attach Ajax Event handlers for Change Table
+ */
+$(document).ready(function() {
+ /**
+ *Ajax action for submitting the column change form
+ **/
+ $("#append_fields_form input[name=do_save_data]").live('click', function(event) {
+ event.preventDefault();
+ /**
+ * @var the_form object referring to the export form
+ */
+ var $form = $("#append_fields_form");
+
+ /*
+ * First validate the form; if there is a problem, avoid submitting it
+ *
+ * checkTableEditForm() needs a pure element and not a jQuery object,
+ * this is why we pass $form[0] as a parameter (the jQuery object
+ * is actually an array of DOM elements)
+ */
+ if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) {
+ // OK, form passed validation step
+ if ($form.hasClass('ajax')) {
+ PMA_prepareForAjaxRequest($form);
+ //User wants to submit the form
+ $.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) {
+ if ($("#sqlqueryresults").length != 0) {
+ $("#sqlqueryresults").remove();
+ } else if ($(".error").length != 0) {
+ $(".error").remove();
+ }
+ if (data.success == true) {
+ PMA_ajaxShowMessage(data.message);
+ $("").insertAfter("#topmenucontainer");
+ $("#sqlqueryresults").html(data.sql_query);
+ $("#result_query .notice").remove();
+ $("#result_query").prepend((data.message));
+ if ($("#change_column_dialog").length > 0) {
+ $("#change_column_dialog").dialog("close").remove();
+ }
+ /*Reload the field form*/
+ $.post($("#fieldsForm").attr('action'), $("#fieldsForm").serialize()+"&ajax_request=true", function(form_data) {
+ $("#fieldsForm").remove();
+ var $temp_div = $("