[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-6507-g5560ad5

Marc Delisle lem9 at users.sourceforge.net
Sun Jul 3 12:24:49 CEST 2011


The branch, master has been updated
       via  5560ad53e07d56e6686964de288d487df02a6153 (commit)
       via  56883ec0c593cd96e47a3e7bf46ec4e293e3a93f (commit)
       via  311804dd728a13e4cd5ce13f303f7b690e7b1aa8 (commit)
       via  05519a2bcaf8afea90c2405b9cb9257f24ce41ba (commit)
       via  232b2a72c69f0f0baf74b2c26a4f446cf0ae707d (commit)
       via  71bb5415d8317764b10ec2424f2cc1bccb5f86d2 (commit)
       via  d33590a544319dfcd395a94210a378c44a8f3e52 (commit)
       via  0cb77d14bad36196664f953d62e247193e1eb30d (commit)
       via  2c57318f1b61448cc55fb282efa30a88c9b9f5aa (commit)
       via  f48271b74b2d475bb158aa05322ce1ac59d303de (commit)
       via  3345899ca2c0b537740f0480d7adbf9fbadee47d (commit)
       via  0c87f7c6b6c478757aa4d7b96fa85ccf1428937a (commit)
       via  bc049c6311f3c8e9357b1b7252754a7673ddaa29 (commit)
       via  6104ef1ba478e68476963c41b4951baa1a7fc9c7 (commit)
       via  045499bd7533da31f262c5e5de739e31d9f08985 (commit)
      from  12fcc270f2d0cc7df3a94a131e2f234b0ee8414c (commit)


- Log -----------------------------------------------------------------
commit 5560ad53e07d56e6686964de288d487df02a6153
Author: Marc Delisle <marc at infomarc.info>
Date:   Sun Jul 3 06:24:29 2011 -0400

    ChangeLog entries for new features

commit 56883ec0c593cd96e47a3e7bf46ec4e293e3a93f
Merge: 311804dd728a13e4cd5ce13f303f7b690e7b1aa8 12fcc270f2d0cc7df3a94a131e2f234b0ee8414c
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sun Jul 3 10:52:56 2011 +0530

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

commit 311804dd728a13e4cd5ce13f303f7b690e7b1aa8
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sun Jul 3 10:52:16 2011 +0530

    Removed the modification for the multi row Export in Table Browse

commit 05519a2bcaf8afea90c2405b9cb9257f24ce41ba
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jul 2 21:17:37 2011 +0530

    Changed the link name in show hide indexes

commit 232b2a72c69f0f0baf74b2c26a4f446cf0ae707d
Merge: 71bb5415d8317764b10ec2424f2cc1bccb5f86d2 a45a11f4e84c19dfa9e4ce0c2e25fc0e9dd8c01f
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jul 2 15:19:45 2011 +0530

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

commit 71bb5415d8317764b10ec2424f2cc1bccb5f86d2
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jul 2 15:16:00 2011 +0530

    Added show hide option for index table in table structure

commit d33590a544319dfcd395a94210a378c44a8f3e52
Merge: 0cb77d14bad36196664f953d62e247193e1eb30d 9fde1b5b23c00a1c9be499122f5d46d4d9b257f3
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 1 23:50:58 2011 +0530

    Resolved conflicts

commit 0cb77d14bad36196664f953d62e247193e1eb30d
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jul 1 23:39:23 2011 +0530

    Ajaxify Index edit in table structure

commit 2c57318f1b61448cc55fb282efa30a88c9b9f5aa
Merge: f48271b74b2d475bb158aa05322ce1ac59d303de 3c55511e5c81d479575f9527a0e5b2267440c872
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sun Jun 26 23:30:26 2011 +0530

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

commit f48271b74b2d475bb158aa05322ce1ac59d303de
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sun Jun 26 23:28:34 2011 +0530

    Fixed bugs in show error message ine multi row change in table structure

commit 3345899ca2c0b537740f0480d7adbf9fbadee47d
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jun 25 21:26:56 2011 +0530

    Fixed bugs in multi column change in table structure

commit 0c87f7c6b6c478757aa4d7b96fa85ccf1428937a
Merge: bc049c6311f3c8e9357b1b7252754a7673ddaa29 5403fc13ced5e245632ba1b4f237ff5f1a52785f
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jun 25 16:58:39 2011 +0530

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

commit bc049c6311f3c8e9357b1b7252754a7673ddaa29
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Sat Jun 25 16:57:54 2011 +0530

    Ajaxified the multi column change in table structure

commit 6104ef1ba478e68476963c41b4951baa1a7fc9c7
Merge: 045499bd7533da31f262c5e5de739e31d9f08985 0a6f2823bd46fc3f486c0b1ef557c1e1284626ba
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jun 24 14:57:34 2011 +0530

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

commit 045499bd7533da31f262c5e5de739e31d9f08985
Author: Thilanka Kaushalya <lgtkaushalya at gmail.com>
Date:   Fri Jun 24 14:54:46 2011 +0530

    Ajaxify the multi row export in table

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

Summary of changes:
 ChangeLog                 |    4 +-
 js/messages.php           |    2 +
 js/sql.js                 |   10 ++--
 js/tbl_structure.js       |  142 +++++++++++++++++++++++++++++++++++++++++++++
 libraries/Index.class.php |   10 ++-
 tbl_indexes.php           |   12 +++-
 tbl_structure.php         |    5 +-
 7 files changed, 171 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ae70fb7..bd8ab2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,7 +25,9 @@ phpMyAdmin - ChangeLog
 + [display] More options for browsing GIS data
 + [interface] Support for spatial indexes
 + [display] GIS data visualization
-+ AJAX for table structure multiple-columns change
++ AJAX for table structure multiple-column change
++ AJAX for table structure index edit
++ Show/hide indexes in table structure
 
 3.4.4.0 (not yet released)
 - bug #3323060 [parser] SQL parser breaks AJAX requests if query has unclosed quotes
diff --git a/js/messages.php b/js/messages.php
index 7851a19..b8ac2ba 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -110,6 +110,8 @@ $js_messages['strNo'] = __('No');
 
 /* For db_stucture.js */
 $js_messages['strInsertTable'] = __('Insert Table');
+$js_messages['strHideIndexes'] = __('Hide indexes');
+$js_messages['strShowIndexes'] = __('Show indexes');
 
 /* For db_search.js */
 $js_messages['strSearching'] = __('Searching');
diff --git a/js/sql.js b/js/sql.js
index 14f4c05..48fb65f 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -1163,7 +1163,7 @@ $(document).ready(function() {
         }) // end $.post()
     }) // end insert table button "Go"
 
-/**
+/**$("#buttonYes.ajax").live('click'
  * Click action for #buttonYes button in ajax dialog insertForm
  */
     $("#buttonYes.ajax").live('click', function(event){
@@ -1370,22 +1370,22 @@ $(document).ready(function() {
     $("#sqlqueryresults").trigger('makegrid');
 });
 
-/* 
+/*
  * Profiling Chart
  */
 function createProfilingChart() {
     if($('#profilingchart').length==0) return;
-    
+
     var cdata = new Array();
     $.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) {
         cdata.push([key,parseFloat(value)]);
     });
-    
+
     // Prevent the user from seeing the JSON code
     $('div#profilingchart').html('').show();
 
     PMA_createChart({
-        chart: { 
+        chart: {
             renderTo: 'profilingchart',
             backgroundColor: $('#sqlqueryresults fieldset').css('background-color')
         },
diff --git a/js/tbl_structure.js b/js/tbl_structure.js
index d1a2676..d4ef1cd 100644
--- a/js/tbl_structure.js
+++ b/js/tbl_structure.js
@@ -250,4 +250,146 @@ $(document).ready(function() {
         }) // end $.post()
     }) // end insert table button "do_save_data"
 
+    /**
+     *Ajax event handler for index edit
+    **/
+    $("#table_index tbody tr td.edit_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 );
+        }
+        url = url + "&ajax_request=true";
+
+        var div = $('<div id="edit_index_dialog"></div>');
+
+        /**
+         *  @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).parent().dialog('close').remove();}
+
+        var button_options_error = {};
+        button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
+        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_verifyTypeOfAllColumns,
+                    buttons : button_options_error
+                })// end dialog options
+            } else {
+                div
+                .append(data)
+                .dialog({
+                    title: PMA_messages['strEdit'],
+                    height: 600,
+                    width: 900,
+                    open: PMA_verifyTypeOfAllColumns,
+                    buttons : button_options
+                })
+                //Remove the top menu container from the dialog
+                .find("#topmenucontainer").hide()
+                ; // end dialog options
+            }
+            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("#topmenucontainer");
+                $("#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 {
+                var temp_div = $("<div id='temp_div'><div>").append(data.error);
+                var error = $(temp_div).find(".error code").addClass("error");
+                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) {
+        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").insertAfter("#index_frm fieldset .error");
+        }) // 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
+
+
 }) // end $(document).ready()
diff --git a/libraries/Index.class.php b/libraries/Index.class.php
index 9992e1c..1800aee 100644
--- a/libraries/Index.class.php
+++ b/libraries/Index.class.php
@@ -419,10 +419,10 @@ class PMA_Index
 
         $r = '';
 
-        $r .= '<h2>' . __('Indexes') . ': ';
+        $r .= '<h2 id="index_header">' . __('Indexes') . ': ';
         $r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure');
         $r .= '</h2>';
-        $r .= '<table>';
+        $r .= '<table id="table_index">';
         $r .= '<thead>';
         $r .= '<tr>';
         if (! $print_mode) {
@@ -450,7 +450,11 @@ class PMA_Index
             if (! $print_mode) {
                 $this_params = $GLOBALS['url_params'];
                 $this_params['index'] = $index->getName();
-                $r .= '<td ' . $row_span . '>'
+                $r .= '<td class="edit_index ';
+                if ($GLOBALS['cfg']['AjaxEnable']) {
+                    $r .= 'ajax" ';
+                }
+                $r .= '" ' . $row_span . '>'
                    . '    <a href="tbl_indexes.php' . PMA_generate_common_url($this_params)
                    . '">' . PMA_getIcon('b_edit.png', __('Edit')) . '</a>'
                    . '</td>' . "\n";
diff --git a/tbl_indexes.php b/tbl_indexes.php
index e366047..995ee24 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -97,7 +97,13 @@ if (isset($_REQUEST['do_save_data'])) {
         PMA_DBI_query($sql_query);
         $message = PMA_Message::success(__('Table %1$s has been altered successfully'));
         $message->addParam($table);
-
+        
+        if( $GLOBALS['is_ajax_request'] == true) {
+            $extra_data['index_table'] = PMA_Index::getView($table, $db);
+            $extra_data['sql_query'] = PMA_showMessage(NULL, $sql_query);
+            PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
+        }
+        
         $active_page = 'tbl_structure.php';
         require './tbl_structure.php';
         exit;
@@ -133,7 +139,7 @@ if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
 // end preparing form values
 ?>
 
-<form action="./tbl_indexes.php" method="post" name="index_frm"
+<form action="./tbl_indexes.php" method="post" name="index_frm" id="index_frm" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?>
     onsubmit="if (typeof(this.elements['index'].disabled) != 'undefined') {
         this.elements['index'].disabled = false}">
 <?php
@@ -183,7 +189,7 @@ if (isset($_REQUEST['create_index'])) {
 PMA_Message::error(__('("PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!)'))->display();
 ?>
 
-<table>
+<table id="index_columns">
 <thead>
 <tr><th><?php echo __('Column'); ?></th>
     <th><?php echo __('Size'); ?></th>
diff --git a/tbl_structure.php b/tbl_structure.php
index 081b4b5..10cc8d3 100644
--- a/tbl_structure.php
+++ b/tbl_structure.php
@@ -14,7 +14,7 @@ require_once './libraries/mysql_charsets.lib.php';
 
 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
 $GLOBALS['js_include'][] = 'tbl_structure.js';
-
+$GLOBALS['js_include'][] = 'indexes.js';
 /**
  * handle multiple field commands if required
  *
@@ -699,6 +699,7 @@ if (! $tbl_is_view && ! $db_is_information_schema) {
 </form>
 <iframe class="IE_hack" scrolling="no"></iframe>
 <hr />
+<div id="index_div" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?> >
     <?php
 }
 
@@ -720,7 +721,7 @@ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' !=  $tbl_type) {
      */
     echo PMA_Index::getView($table, $db);
     ?>
-<br />
+</div>
 <form action="./tbl_indexes.php" method="post"
     onsubmit="return checkFormElementInRange(this, 'idx_num_fields',
         '<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list