[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_7_1-22978-g0ded8da

Rouslan Placella roccivic at users.sourceforge.net
Sat Nov 19 20:44:27 CET 2011


The branch, master has been updated
       via  0ded8da4858a92bcda776e7db4b973eaa815adaf (commit)
       via  1d322a8ada55b4c9233109f4189fa59066f660cd (commit)
       via  fc22faa6e1850e386b10d7cbc08188fed2c1aadd (commit)
       via  0ac1b5f7c2fbc007abed7ecc015f42e42d2dbc78 (commit)
       via  f607d8a93cc2391e34000173b8eef13e1af8de61 (commit)
       via  93ab45ced3678ee30256dd7634192d5f63cbd597 (commit)
       via  a97eeae7adff3a6a058ed3dd8cae994e0dd8d859 (commit)
       via  5cb7a002f3c64a4e618687ce189c8828ff751940 (commit)
       via  46fbe36b6b0f6589054939419005895c5c4b51de (commit)
       via  f8e6631dfdcf9363399e49c248bf439f3001b1e6 (commit)
       via  863819cbdd759614d4097710b995858d9b4fac0f (commit)
      from  c2a8246bc882bd6194e02aea61ff12878136c83a (commit)


- Log -----------------------------------------------------------------
commit 0ded8da4858a92bcda776e7db4b973eaa815adaf
Author: Rouslan Placella <rouslan at placella.com>
Date:   Tue Nov 15 18:26:06 2011 +0000

    Ajax error messages should not automatically disappear

commit 1d322a8ada55b4c9233109f4189fa59066f660cd
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Nov 14 21:57:38 2011 +0000

    Changelog entry for "Improved index editor"

commit fc22faa6e1850e386b10d7cbc08188fed2c1aadd
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Nov 14 20:45:26 2011 +0000

    Improved index editor

commit 0ac1b5f7c2fbc007abed7ecc015f42e42d2dbc78
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Nov 14 20:39:54 2011 +0000

    We can't specify a height for an element that might grow or shrink

commit f607d8a93cc2391e34000173b8eef13e1af8de61
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Oct 31 13:37:43 2011 +0000

    table structure: Do not send #topmenucontainer in ajax requests

commit 93ab45ced3678ee30256dd7634192d5f63cbd597
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Oct 31 13:36:05 2011 +0000

    table structure: ajax error messages should not timeout

commit a97eeae7adff3a6a058ed3dd8cae994e0dd8d859
Author: Rouslan Placella <rouslan at placella.com>
Date:   Fri Oct 28 21:26:12 2011 +0100

    Ajaxified "Create index" dialog

commit 5cb7a002f3c64a4e618687ce189c8828ff751940
Author: Rouslan Placella <rouslan at placella.com>
Date:   Fri Oct 28 17:49:08 2011 +0100

    tbl_structure: Improved handling of "Drop Index" functionality with JavaScript enabled

commit 46fbe36b6b0f6589054939419005895c5c4b51de
Author: Rouslan Placella <rouslan at placella.com>
Date:   Fri Oct 28 17:48:14 2011 +0100

    Wrapped the "Indexes" and "Information" sections from tbl_structure.php in fieldsets

commit f8e6631dfdcf9363399e49c248bf439f3001b1e6
Author: Rouslan Placella <rouslan at placella.com>
Date:   Fri Oct 28 17:16:52 2011 +0100

    "No index" or "duplicate indexes" on a column are not errors

commit 863819cbdd759614d4097710b995858d9b4fac0f
Author: Rouslan Placella <rouslan at placella.com>
Date:   Fri Oct 28 17:13:31 2011 +0100

    tbl_structure.php ignored $cfg['InitialSlidersState'] for the Indexes

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

Summary of changes:
 ChangeLog                               |    1 +
 js/functions.js                         |    2 +-
 js/messages.php                         |    3 +
 js/tbl_structure.js                     |  267 +++++++++++++++----------------
 libraries/Index.class.php               |   29 ++--
 tbl_alter.php                           |    4 +-
 tbl_indexes.php                         |   69 +++++---
 tbl_structure.php                       |   31 ++--
 themes/original/css/theme_right.css.php |   42 +++++
 themes/pmahomme/css/theme_right.css.php |   42 +++++
 10 files changed, 298 insertions(+), 192 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 39086e6..38cfe69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@ phpMyAdmin - ChangeLog
 + rfe #3406797 [navi] Stick table tools to top of page on scroll
 + rfe #1632106 [interface] Improved error handling
 + patch #3432835 [interface] Add useful intermediate pages to pageselector
++ [interface] Improved index editor
 
 3.4.8.0 (not yet released)
 - bug #3425230 [interface] enum data split at space char (more space to edit)
diff --git a/js/functions.js b/js/functions.js
index 4377a1d..d96f15e 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -3079,7 +3079,7 @@ function PMA_init_slider()
         }
         $this.addClass('slider_init_done');
 
-        var $wrapper = $('<div>', {'class': 'slide-wrapper'}).css('height', $this.outerHeight(true));
+        var $wrapper = $('<div>', {'class': 'slide-wrapper'});
         $wrapper.toggle($this.is(':visible'));
         $('<a>', {href: '#'+this.id})
             .text(this.title)
diff --git a/js/messages.php b/js/messages.php
index 5b6257b..5a75ece 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -45,6 +45,9 @@ $js_messages['strBLOBRepositoryDisableAreYouSure'] = sprintf(__('Are you sure yo
 /* For indexes */
 $js_messages['strFormEmpty'] = __('Missing value in the form!');
 $js_messages['strNotNumber'] = __('This is not a number!');
+$js_messages['strAddIndex'] = __('Add Index');
+$js_messages['strEditIndex'] = __('Edit Index');
+$js_messages['strAddToIndex'] = __('Add %d column(s) to index');
 
 /* Charts */
 /* l10n: Default description for the y-Axis of Charts */
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index 8bbd8bb..f02572f 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -18,7 +18,6 @@
  *
  */
 $(document).ready(function() {
-
     /**
      * Attach Event Handler for 'Drop Column'
      *
@@ -56,7 +55,7 @@ $(document).ready(function() {
                     $(curr_row).hide("medium").remove();
                 }
                 else {
-                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
+                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
                 }
             }) // end $.get()
         }); // end $.PMA_confirm()
@@ -98,7 +97,7 @@ $(document).ready(function() {
                     }
                 }
                 else {
-                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
+                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
                 }
             }) // end $.get()
         }) // end $.PMA_confirm()
@@ -137,17 +136,30 @@ $(document).ready(function() {
             $.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) {
                 if(data.success == true) {
                     PMA_ajaxShowMessage(data.message);
-                    $rows_to_hide.hide("medium").remove();
+                    var $table_ref = $rows_to_hide.closest('table');
+                    if ($rows_to_hide.length == $table_ref.find('tbody > tr').length) {
+                        // We are about to remove all rows from the table
+                        $table_ref.hide('medium', function() {
+                            $('.no_indexes_defined').show('medium');
+                            $rows_to_hide.remove();
+                        });
+                        $table_ref.siblings('div.notice').hide('medium');
+                    } else {
+                        // We are removing some of the rows only
+                        $rows_to_hide.hide("medium", function () {
+                            $(this).remove();
+                        });
+                    }
                 }
                 else {
-                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error);
+                    PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false);
                 }
             }) // end $.get()
         }) // end $.PMA_confirm()
     }) //end Drop Primary Key/Index
 
     /**
-     *Ajax event handler for muti column change
+     *Ajax event handler for multi column change
     **/
     $("#fieldsForm.ajax .mult_submit[value=change]").live('click', function(event){
         event.preventDefault();
@@ -184,13 +196,29 @@ $(document).ready(function() {
     /**
      *Ajax event handler for index edit
     **/
-    $("#table_index tbody tr td.edit_index.ajax").live('click', function(event){
+    $("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").live('click', function(event){
         event.preventDefault();
-        var url = $(this).find("a").attr("href");
-        if (url.substring(0, 16) == "tbl_indexes.php?") {
-            url = url.substring(16, url.length );
+        if ($(this).find("a").length == 0) {
+            // Add index
+            var valid = checkFormElementInRange(
+                $(this).closest('form')[0],
+                'added_fields',
+                'Column count has to be larger than zero.'
+            );
+            if (! valid) {
+                return;
+            }
+            var url = $(this).closest('form').serialize();
+            var title = PMA_messages['strAddIndex'];
+        } else {
+            // Edit index
+            var url = $(this).find("a").attr("href");
+            if (url.substring(0, 16) == "tbl_indexes.php?") {
+                url = url.substring(16, url.length );
+            }
+            var title = PMA_messages['strEditIndex'];
         }
-        url = url + "&ajax_request=true";
+        url += "&ajax_request=true";
 
         /*Remove the hidden dialogs if there are*/
         if ($('#edit_index_dialog').length != 0) {
@@ -199,142 +227,111 @@ $(document).ready(function() {
         var $div = $('<div id="edit_index_dialog"></div>');
 
         /**
-         *  @var    button_options  Object that stores the options passed to jQueryUI
-         *                          dialog
+         * @var button_options Object that stores the options
+         *                     passed to jQueryUI dialog
          */
         var button_options = {};
-        // in the following function we need to use $(this)
-        button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
-
-        var button_options_error = {};
-        button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
+        button_options[PMA_messages['strGo']] = function() {
+            /**
+             *  @var    the_form    object referring to the export form
+             */
+            var $form = $("#index_frm");
+            PMA_prepareForAjaxRequest($form);
+            //User wants to submit the form
+            $.post($form.attr('action'), $form.serialize()+"&do_save_data=1", function(data) {
+                if ($("#sqlqueryresults").length != 0) {
+                    $("#sqlqueryresults").remove();
+                }
+                if (data.success == true) {
+                    PMA_ajaxShowMessage(data.message);
+                    $("<div id='sqlqueryresults'></div>").insertAfter("#floating_menubar");
+                    $("#sqlqueryresults").html(data.sql_query);
+                    $("#result_query .notice").remove();
+                    $("#result_query").prepend(data.message);
+
+                    /*Reload the field form*/
+                    $("#table_index").remove();
+                    var $temp_div = $("<div id='temp_div'><div>").append(data.index_table);
+                    $temp_div.find("#table_index").insertAfter("#index_header");
+                    if ($("#edit_index_dialog").length > 0) {
+                        $("#edit_index_dialog").dialog("close");
+                    }
+                } else 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, false);
+                }
+            }) // end $.post()
+        }
+        button_options[PMA_messages['strCancel']] = function() {
+            $(this).dialog('close');
+        }
         var $msgbox = PMA_ajaxShowMessage();
-
-        $.get( "tbl_indexes.php" , url ,  function(data) {
-            //in the case of an error, show the error message returned.
-            if (data.success != undefined && data.success == false) {
-                $div
-                .append(data.error)
-                .dialog({
-                    title: PMA_messages['strEdit'],
-                    height: 230,
-                    width: 900,
-                    open: PMA_verifyColumnsProperties,
-                    modal: true,
-                    buttons : button_options_error
-                })// end dialog options
+        $.get("tbl_indexes.php", url, function(data) {
+            if (data.error) {
+                //in the case of an error, show the error message returned.
+                PMA_ajaxShowMessage(data.error, false);
             } else {
+                PMA_ajaxRemoveMessage($msgbox);
+                // Show dialog if the request was successful
                 $div
                 .append(data)
                 .dialog({
-                    title: PMA_messages['strEdit'],
-                    height: 600,
-                    width: 900,
+                    title: title,
+                    width: 450,
                     open: PMA_verifyColumnsProperties,
                     modal: true,
-                    buttons : button_options
-                })
-                //Remove the top menu container from the dialog
-                .find("#topmenucontainer").hide()
-                ; // end dialog options
+                    buttons: button_options,
+                    close: function () {
+                        $(this).remove();
+                    }
+                });
                 checkIndexType();
                 checkIndexName("index_frm");
+                PMA_convertFootnotesToTooltips($div);
+                // Add a slider for selecting how many columns to add to the index
+                $div.find('.slider').slider({
+                   animate: true,
+                   value: 1,
+                   min: 1,
+                   max: 16,
+                   slide: function( event, ui ) {
+                        $(this).closest('fieldset').find('input[type=submit]').val(
+                            PMA_messages['strAddToIndex'].replace(/%d/, ui.value)
+                        );
+                   }
+			    });
+                // Focus the slider, otherwise it looks nearly transparent
+                $('.ui-slider-handle').addClass('ui-state-focus');
             }
-            PMA_ajaxRemoveMessage($msgbox);
         }) // end $.get()
     });
 
     /**
-     *Ajax action for submiting the index form
-    **/
-    $("#index_frm.ajax input[name=do_save_data]").live('click', function(event) {
-        event.preventDefault();
-        /**
-         *  @var    the_form    object referring to the export form
-         */
-        var $form = $("#index_frm");
-
-        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();
-            }
-            if (data.success == true) {
-                PMA_ajaxShowMessage(data.message);
-                $("<div id='sqlqueryresults'></div>").insertAfter("#floating_menubar");
-                $("#sqlqueryresults").html(data.sql_query);
-                $("#result_query .notice").remove();
-                $("#result_query").prepend((data.message));
-
-                /*Reload the field form*/
-                $("#table_index").remove();
-                var $temp_div = $("<div id='temp_div'><div>").append(data.index_table);
-                $temp_div.find("#table_index").insertAfter("#index_header");
-                if ($("#edit_index_dialog").length > 0) {
-                    $("#edit_index_dialog").dialog("close").remove();
-                }
-
-            } else {
-                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);
-            }
-
-        }) // end $.post()
-    }) // end insert table button "do_save_data"
-
-    /**
-     *Ajax action for submiting the index form for add more columns
-    **/
-    $("#index_frm.ajax input[name=add_fields]").live('click', function(event) {
+     * Handler for adding more columns to an index in the editor
+     */
+    $('#index_frm input[type=submit]').live('click', function(event) {
         event.preventDefault();
-        /**
-         *  @var    the_form    object referring to the export form
-         */
-        var $form = $("#index_frm");
-
-        PMA_prepareForAjaxRequest($form);
-        //User wants to submit the form
-        $.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").appendTo("#index_edit_fields");
-        }) // end $.post()
-    }) // end insert table button "Go"
-
-    /**Add the show/hide index table option if the index is available*/
-    if ($("#index_div.ajax").find("#table_index").length != 0) {
-        /**
-         *Prepare a div containing a link for toggle the index table
-         */
-        $('<div id="toggletableindexdiv"><a id="toggletableindexlink"></a></div>')
-        .insertAfter('#index_div')
-        /** don't show it until we have index table on-screen */
-        .show();
-
-        /** Changing the displayed text according to the hide/show criteria in table index*/
-
-        $('#toggletableindexlink')
-        .html(PMA_messages['strHideIndexes'])
-        .bind('click', function() {
-             var $link = $(this);
-             $('#index_div').slideToggle();
-             if ($link.text() == PMA_messages['strHideIndexes']) {
-                 $link.text(PMA_messages['strShowIndexes']);
-             } else {
-                 $link.text(PMA_messages['strHideIndexes']);
-             }
-             /** avoid default click action */
-             return false;
-        });
-    } //end show/hide table index
+        var rows_to_add = $(this)
+            .closest('fieldset')
+            .find('.slider')
+            .slider('value');
+        while (rows_to_add--) {
+            var $newrow = $('#index_columns')
+                .find('tbody > tr:first')
+                .clone()
+                .appendTo(
+                    $('#index_columns').find('tbody')
+                );
+            $newrow.find(':input').each(function() {
+                $(this).val('');
+            });
+        }
+    });
 
     /**
      *Ajax event handler for Add column(s)
@@ -385,10 +382,7 @@ $(document).ready(function() {
                     open: PMA_verifyColumnsProperties,
                     modal: true,
                     buttons : button_options
-                })
-                //Remove the top menu container from the dialog
-                .find("#topmenucontainer").hide()
-                ; // end dialog options
+                }); // end dialog options
 
                 $div = $("#add_columns");
                 /*changed the z-index of the enum editor to allow the edit*/
@@ -454,10 +448,7 @@ function changeColumns(action,url)
                 modal: true,
                 open: PMA_verifyColumnsProperties,
                 buttons : button_options
-            })
-            //Remove the top menu container from the dialog
-            .find("#topmenucontainer").hide()
-            ; // end dialog options
+            }); // end dialog options
             $("#append_fields_form input[name=do_save_data]").addClass("ajax");
             /*changed the z-index of the enum editor to allow the edit*/
             $("#enum_editor").css("z-index", "1100");
diff --git a/libraries/Index.class.php b/libraries/Index.class.php
index d790df9..6c6f8ba 100644
--- a/libraries/Index.class.php
+++ b/libraries/Index.class.php
@@ -414,15 +414,23 @@ class PMA_Index
     {
         $indexes = PMA_Index::getFromTable($table, $schema);
 
-        if (count($indexes) < 1) {
-            return PMA_Message::error(__('No index defined!'))->getDisplay();
-        }
-
-        $r = '';
+        $no_indexes_class = count($indexes) > 0 ? ' hide' : '';
+        $no_indexes  = "<div class='no_indexes_defined$no_indexes_class'>";
+        $no_indexes .= PMA_Message::notice(__('No index defined!'))->getDisplay();
+        $no_indexes .= '</div>';
 
-        $r .= '<h2 id="index_header">' . __('Indexes') . ': ';
+        $r  = '<fieldset>';
+        $r .= '<legend id="index_header">' . __('Indexes');
         $r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure');
-        $r .= '</h2>';
+        $r .= '</legend>';
+        $r .= $no_indexes;
+        if (count($indexes) < 1) {
+            $r .= '</fieldset>';
+            return $r;
+        }
+        if (! $print_mode) {
+            $r .= PMA_Index::findDuplicates($table, $schema);
+        }
         $r .= '<table id="table_index">';
         $r .= '<thead>';
         $r .= '<tr>';
@@ -512,10 +520,7 @@ class PMA_Index
         } // end while
         $r .= '</tbody>';
         $r .= '</table>';
-
-        if (! $print_mode) {
-            $r .= PMA_Index::findDuplicates($table, $schema);
-        }
+        $r .= '</fieldset>';
 
         return $r;
     }
@@ -565,7 +570,7 @@ class PMA_Index
                 // did not find any difference
                 // so it makes no sense to have this two equal indexes
 
-                $message = PMA_Message::error(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'));
+                $message = PMA_Message::notice(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.'));
                 $message->addParam($each_index->getName());
                 $message->addParam($while_index->getName());
                 $output .= $message->getDisplay();
diff --git a/tbl_alter.php b/tbl_alter.php
index aace316..8efee90 100644
--- a/tbl_alter.php
+++ b/tbl_alter.php
@@ -156,7 +156,9 @@ if (isset($_REQUEST['do_save_data'])) {
  * $selected comes from multi_submits.inc.php
  */
 if ($abort == false) {
-    include_once './libraries/tbl_links.inc.php';
+    if ($_REQUEST['ajax_request'] != true) {
+        include_once './libraries/tbl_links.inc.php';
+    }
 
     if (! isset($selected)) {
         PMA_checkParameters(array('field'));
diff --git a/tbl_indexes.php b/tbl_indexes.php
index f06a751..3a1a863 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -123,9 +123,10 @@ if (isset($_REQUEST['do_save_data'])) {
 
 // Displays headers (if needed)
 $GLOBALS['js_include'][] = 'indexes.js';
-
 require_once './libraries/tbl_info.inc.php';
-require_once './libraries/tbl_links.inc.php';
+if ($GLOBALS['is_ajax_request'] != true) {
+    require_once './libraries/tbl_links.inc.php';
+}
 
 if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
     // coming already from form
@@ -163,34 +164,43 @@ if (isset($_REQUEST['create_index'])) {
 echo PMA_generate_common_hidden_inputs($form_params);
 ?>
 <fieldset id="index_edit_fields">
+<?php
+if ($GLOBALS['is_ajax_request'] != true) {
+?>
     <legend>
 <?php
-if (isset($_REQUEST['create_index'])) {
-    echo __('Create an index');
-} else {
-    echo __('Modify an index');
-}
+    if (isset($_REQUEST['create_index'])) {
+        echo __('Add index');
+    } else {
+        echo __('Edit index');
+    }
 ?>
     </legend>
 <?php
-PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
+}
 ?>
-<div class="formelement">
+<div>
+<table class='index_info'>
+<tr><td>
+<strong>
 <label for="input_index_name"><?php echo __('Index name:'); ?></label>
+</strong>
+<?php echo PMA_showhint(PMA_Message::notice(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))); ?>
+</td><td>
 <input type="text" name="index[Key_name]" id="input_index_name" size="25"
     value="<?php echo htmlspecialchars($index->getName()); ?>" onfocus="this.select()" />
-</div>
-
-<div class="formelement">
+</td></tr><tr><td>
+<strong>
 <label for="select_index_type"><?php echo __('Index type:'); ?></label>
+</strong>
+<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
+</td><td>
 <select name="index[Index_type]" id="select_index_type" >
     <?php echo $index->generateIndexSelector(); ?>
 </select>
-<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
+</td></tr></table>
 </div>
 
-<br class="clearfloat" /><br />
-
 <table id="index_columns">
 <thead>
 <tr><th><?php echo __('Column'); ?></th>
@@ -206,7 +216,7 @@ $spatial_types = array(
 );
 foreach ($index->getColumns() as $column) {
     ?>
-<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
+<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> noclick">
     <td><select name="index[columns][names][]">
             <option value="">-- <?php echo __('Ignore'); ?> --</option>
     <?php
@@ -233,7 +243,7 @@ foreach ($index->getColumns() as $column) {
 } // end foreach $edited_index_info['Sequences']
 for ($i = 0; $i < $add_fields; $i++) {
     ?>
-<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
+<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?> noclick">
     <td><select name="index[columns][names][]">
             <option value="">-- <?php echo __('Ignore'); ?> --</option>
     <?php
@@ -256,21 +266,30 @@ for ($i = 0; $i < $add_fields; $i++) {
 </tbody>
 </table>
 </fieldset>
-
 <fieldset class="tblFooters">
+<?php
+    if ($GLOBALS['is_ajax_request'] != true) {
+?>
     <input type="submit" name="do_save_data" value="<?php echo __('Save'); ?>" />
     <span id="addMoreColumns">
 <?php
 echo __('Or') . ' ';
-echo sprintf(__('Add to index  %s column(s)'),
-        '<input type="text" name="added_fields" size="2" value="1"'
-    .' onfocus="this.select()" />') . "\n";
-echo '<input type="submit" name="add_fields" value="' . __('Go') . '"'
-    .' onclick="return checkFormElementInRange(this.form,'
-    ." 'added_fields', '" . PMA_jsFormat(__('Column count has to be larger than zero.')) . "', 1"
-    .')" />' . "\n";
+printf(
+    __('Add to index  %s column(s)') . "\n",
+    '<input type="text" name="added_fields" size="2" value="1" />'
+);
+echo '<input type="submit" name="add_fields" value="' . __('Go') . '" />' . "\n";
 ?>
     </span>
+<?php
+    } else {
+        $btn_value = sprintf(__('Add %d column(s) to index'), 1);
+        echo '<div class="slider"></div>';
+        echo '<div class="add_fields">';
+        echo '<input type="submit" value="' . $btn_value . '" />';
+        echo '</div>';
+    }
+?>
 </fieldset>
 </form>
 <?php
diff --git a/tbl_structure.php b/tbl_structure.php
index 754dea1..9de9d5a 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -689,26 +689,25 @@ if (count($fields) > 20) {
  */
 
 if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' !=  $tbl_type) {
+    PMA_generate_slider_effect('indexes', __('Indexes'));
     /**
      * Display indexes
      */
     echo PMA_Index::getView($table, $db);
     ?>
+        <fieldset class="tblFooters" style="text-align: left;">
+            <form action="./tbl_indexes.php" method="post">
+                <?php
+                echo PMA_generate_common_hidden_inputs($db, $table);
+                echo sprintf(__('Create an index on  %s columns'),
+                    '<input type="text" size="2" name="added_fields" value="1" />');
+                ?>
+                <input type="hidden" name="create_index" value="1" />
+                <input class="add_index<?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' ajax' : '');?>" type="submit" value="<?php echo __('Go'); ?>" />
+            </form>
+        </fieldset>
+    </div>
 </div>
-<form action="./tbl_indexes.php" method="post"
-    onsubmit="return checkFormElementInRange(this, 'added_fields',
-        '<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',
-        1)">
-<fieldset>
-    <?php
-    echo PMA_generate_common_hidden_inputs($db, $table);
-    echo sprintf(__('Create an index on  %s columns'),
-        '<input type="text" size="2" name="added_fields" value="1" />');
-    ?>
-    <input type="submit" name="create_index" value="<?php echo __('Go'); ?>" />
-</fieldset>
-</form>
-<br />
     <?php
 }
 
@@ -756,6 +755,8 @@ if ($cfg['ShowStats']) {
     $odd_row = false;
     ?>
 
+    <fieldset>
+    <legend><?php echo __('Information'); ?></legend>
     <a name="showusage"></a>
     <?php if (! $tbl_is_view && ! $db_is_information_schema) { ?>
     <table id="tablespaceusage" class="data">
@@ -933,7 +934,7 @@ if ($cfg['ShowStats']) {
     ?>
     </tbody>
     </table>
-
+    </fieldset>
     <!-- close tablestatistics div -->
     </div>
 
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index 289d5c4..eab4ec1 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -1736,6 +1736,48 @@ td.more_opts {
     white-space: nowrap;
 }
 
+/**
+ * Indexes
+ */
+#index_frm .index_info input,
+#index_frm .index_info select {
+    width: 100%;
+    box-sizing:         border-box;
+    -ms-box-sizing:     border-box;
+    -moz-box-sizing:    border-box;
+    -webkit-box-sizing: border-box;
+}
+
+#index_frm .slider {
+    width: 10em;
+    margin: 0.6em;
+    float: <?php echo $left; ?>;
+}
+
+#index_frm .add_fields {
+    float: <?php echo $left; ?>;
+}
+
+#index_frm .add_fields input {
+    margin-<?php echo $left; ?>: 1em;
+}
+
+#index_frm input {
+    margin: 0;
+}
+
+#index_frm td {
+    vertical-align: middle;
+}
+
+table#index_columns {
+    width: 100%;
+}
+
+table#index_columns select {
+    width: 100%;
+}
+
 iframe.IE_hack {
     z-index: 1;
     position: absolute;
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index a2b594b..aa0f27b 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -2119,6 +2119,48 @@ td.more_opts {
     white-space: nowrap;
 }
 
+/**
+ * Indexes
+ */
+#index_frm .index_info input,
+#index_frm .index_info select {
+    width: 100%;
+    box-sizing:         border-box;
+    -ms-box-sizing:     border-box;
+    -moz-box-sizing:    border-box;
+    -webkit-box-sizing: border-box;
+}
+
+#index_frm .slider {
+    width: 10em;
+    margin: 0.6em;
+    float: <?php echo $left; ?>;
+}
+
+#index_frm .add_fields {
+    float: <?php echo $left; ?>;
+}
+
+#index_frm .add_fields input {
+    margin-<?php echo $left; ?>: 1em;
+}
+
+#index_frm input {
+    margin: 0;
+}
+
+#index_frm td {
+    vertical-align: middle;
+}
+
+table#index_columns {
+    width: 100%;
+}
+
+table#index_columns select {
+    width: 100%;
+}
+
 iframe.IE_hack {
     z-index: 1;
     position: absolute;


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list