[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-7514-g65c8f65

Marc Delisle lem9 at users.sourceforge.net
Fri Jul 8 22:31:36 CEST 2011


The branch, master has been updated
       via  65c8f659e0adc68e698d9d9be13a1092cb716d7a (commit)
       via  f2f8c394cd80730ebf52e34580af3dd265046178 (commit)
       via  f778dfc5af9756e6ab438a279d3ec1d60af57add (commit)
       via  526c72652fefca7025614552f5f5ad80d912462c (commit)
       via  ddb776901307b33bd0d2efc378ba1472fb3f4f36 (commit)
       via  41873b93e2ae56e641b0648eedce804c5682f7c7 (commit)
       via  499dbe1ae67057fa869942697df9b7a5f385f608 (commit)
       via  a9ccc35b38a6750fad16c87742f9606ad677a53c (commit)
       via  ba6e1fc87926290eedb5e5005b99cc570524a865 (commit)
       via  4dfac4da814ebb2a1767a8b6e4ab79ebab9736eb (commit)
       via  37641b3404be795d894852829045da1f5db3fa17 (commit)
      from  5ce96bccbe217ae0e2c52cdb6624eabf8fc2f6af (commit)


- Log -----------------------------------------------------------------
commit 65c8f659e0adc68e698d9d9be13a1092cb716d7a
Author: Marc Delisle <marc at infomarc.info>
Date:   Fri Jul 8 16:31:06 2011 -0400

    ChangeLog entry for table Structure Index Edit

commit f2f8c394cd80730ebf52e34580af3dd265046178
Merge: 5ce96bccbe217ae0e2c52cdb6624eabf8fc2f6af f778dfc5af9756e6ab438a279d3ec1d60af57add
Author: Marc Delisle <marc at infomarc.info>
Date:   Fri Jul 8 16:28:20 2011 -0400

    Merge commit 'f778dfc5af9756e6ab438a279d3ec1d60af57add'

commit f778dfc5af9756e6ab438a279d3ec1d60af57add
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 8 21:09:13 2011 +0530

    Fixed the variable names in checkIndexName function

commit 526c72652fefca7025614552f5f5ad80d912462c
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 8 15:35:28 2011 +0530

    Fixed bugs in index edit in table structure

commit ddb776901307b33bd0d2efc378ba1472fb3f4f36
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 8 14:04:57 2011 +0530

    Fixed bugs od index edit in table structure

commit 41873b93e2ae56e641b0648eedce804c5682f7c7
Merge: 499dbe1ae67057fa869942697df9b7a5f385f608 c8ba421d379c15cd6bac620a77be50513e7da710
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 8 09:29:30 2011 +0530

    Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

commit 499dbe1ae67057fa869942697df9b7a5f385f608
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 8 09:27:10 2011 +0530

    Fixed bugs in checkIndexName

commit a9ccc35b38a6750fad16c87742f9606ad677a53c
Merge: ba6e1fc87926290eedb5e5005b99cc570524a865 5140c38db0125b627cdb49a5a91a938735469707
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Thu Jul 7 23:53:23 2011 +0530

    Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

commit ba6e1fc87926290eedb5e5005b99cc570524a865
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Thu Jul 7 23:52:22 2011 +0530

    Moved checkIndexName function to functions js file and rewrite it using jquery

commit 4dfac4da814ebb2a1767a8b6e4ab79ebab9736eb
Merge: 37641b3404be795d894852829045da1f5db3fa17 9e34ccf57cfc97c3cac6d7f9ceecd6e1cc89e10d
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Wed Jul 6 19:56:58 2011 +0530

    Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin

commit 37641b3404be795d894852829045da1f5db3fa17
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Wed Jul 6 19:55:57 2011 +0530

    Fixed bugs in index edit

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    1 +
 js/functions.js     |   36 ++++++++++++++++++++++++++++++++++++
 js/indexes.js       |   48 +++++++-----------------------------------------
 js/tbl_structure.js |   25 ++++++++++++++++++-------
 tbl_indexes.php     |    8 ++++++--
 5 files changed, 68 insertions(+), 50 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4df55e5..b03cafb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/js/functions.js b/js/functions.js
index 9cdb44e..ae5cdba 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -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
diff --git a/js/indexes.js b/js/indexes.js
index ef6f877..abbf4d8 100644
--- a/js/indexes.js
+++ b/js/indexes.js
@@ -5,45 +5,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");
+    });
 });
 
 /**#@- */
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index d4ef1cd..49e3fe0 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -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()
diff --git a/tbl_indexes.php b/tbl_indexes.php
index 7e9bec6..39205f2 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -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'); ?>


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list