[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA2-1317-g5464b54

Marc Delisle lem9 at users.sourceforge.net
Sat Jan 22 15:51:06 CET 2011


The branch, master has been updated
       via  5464b54e17015ed4ca8c015597e4760a538dd866 (commit)
      from  3a739c1beec1d300bf0d54d8b7f3136f1775fcee (commit)


- Log -----------------------------------------------------------------
commit 5464b54e17015ed4ca8c015597e4760a538dd866
Author: Marc Delisle <marc at infomarc.info>
Date:   Sat Jan 22 09:50:12 2011 -0500

    Start implementing conditional Ajax (in results page)

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

Summary of changes:
 js/sql.js                     |   28 ++++++++++++++++++----------
 libraries/common.lib.php      |    7 +++++--
 libraries/config.default.php  |    7 +++++++
 libraries/display_tbl.lib.php |    4 ++--
 sql.php                       |   12 ++++++++----
 5 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/js/sql.js b/js/sql.js
index 43b3af7..e83cee8 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -172,11 +172,11 @@ $(document).ready(function() {
 
     /**
      * Trigger the appendAnchor event to prepare the first table for inline edit
-     *
+     * (see $GLOBALS['cfg']['AjaxEnable'])
      * @memberOf    jQuery
      * @name        sqlqueryresults_trigger
      */
-    $("#sqlqueryresults").trigger('appendAnchor');
+    $("#sqlqueryresults.ajax").trigger('appendAnchor');
 
     /**
      * Append the "Show/Hide query box" message to the query input form
@@ -264,11 +264,12 @@ $(document).ready(function() {
 
     /**
      * Paginate when we click any of the navigation buttons
+     * (only if the element has the ajax class, see $cfg['AjaxEnable'])
      * @memberOf    jQuery
      * @name        paginate_nav_button_click
      * @uses        PMA_ajaxShowMessage()
      */
-    $("input[name=navig]").live('click', function(event) {
+    $("input[name=navig].ajax").live('click', function(event) {
         /** @lends jQuery */
         event.preventDefault();
 
@@ -293,15 +294,22 @@ $(document).ready(function() {
      * @name        paginate_dropdown_change
      */
     $("#pageselector").live('change', function(event) {
-        event.preventDefault();
-
-        PMA_ajaxShowMessage();
         var $the_form = $(this).parent("form");
 
-        $.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
-            $("#sqlqueryresults").html(data);
-            $("#sqlqueryresults").trigger('appendAnchor');
-        }) // end $.post()
+        // see $cfg['AjaxEnable']
+        if ($(this).hasClass('ajax')) {
+            event.preventDefault();
+
+            PMA_ajaxShowMessage();
+
+            $.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
+                $("#sqlqueryresults").html(data);
+                $("#sqlqueryresults").trigger('appendAnchor');
+            }) // end $.post()
+        } else {
+            $the_form.submit();
+        }
+
     })// end Paginate results with Page Selector
 
     /**
diff --git a/libraries/common.lib.php b/libraries/common.lib.php
index 3976431..711627f 100644
--- a/libraries/common.lib.php
+++ b/libraries/common.lib.php
@@ -2201,8 +2201,11 @@ function PMA_pageselector($rows, $pageNow = 1, $nbTotalPage = 1,
     $pageNowMinusRange = ($pageNow - $range);
     $pageNowPlusRange = ($pageNow + $range);
 
-    $gotopage = $prompt
-              . ' <select id="pageselector" name="pos" >' . "\n";
+    $gotopage = $prompt . ' <select id="pageselector" ';
+    if ($GLOBALS['cfg']['AjaxEnable']) {
+        $gotopage .= ' class="ajax"';
+    }
+    $gotopage .= ' name="pos" >' . "\n";
     if ($nbTotalPage < $showAll) {
         $pages = range(1, $nbTotalPage);
     } else {
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 028c14b..a544caf 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -488,6 +488,13 @@ $cfg['ServerDefault'] = 1;
  * Other core phpMyAdmin settings
  */
 /**
+ * whether Ajax behavior is active 
+ *
+ * @global boolean $cfg['AjaxEnable']
+ */
+$cfg['AjaxEnable'] = true;
+
+/**
  * maximum number of db's displayed in left frame and database list
  *
  * @global integer $cfg['MaxDbList']
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php
index 53c610b..c2c8518 100644
--- a/libraries/display_tbl.lib.php
+++ b/libraries/display_tbl.lib.php
@@ -228,7 +228,7 @@ function PMA_displayTableNavigationOneButton($caption, $title, $pos, $html_sql_q
         <input type="hidden" name="pos" value="<?php echo $pos; ?>" />
         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
         <?php echo $input_for_real_end; ?>
-        <input type="submit" name="navig" value="<?php echo $caption_output; ?>"<?php echo $title_output . $onclick; ?> />
+        <input type="submit" name="navig" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : '' ); ?> value="<?php echo $caption_output; ?>"<?php echo $title_output . $onclick; ?> />
     </form>
 </td>
 <?php
@@ -303,7 +303,7 @@ onsubmit="return (checkFormElementInRange(this, 'session_max_rows', '<?php echo
         <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
         <input type="hidden" name="sql_query" value="<?php echo $html_sql_query; ?>" />
         <input type="hidden" name="goto" value="<?php echo $goto; ?>" />
-        <input type="submit" name="navig" value="<?php echo __('Show'); ?> :" />
+        <input type="submit" name="navig" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''); ?> value="<?php echo __('Show'); ?> :" />
         <input type="text" name="session_max_rows" size="3" value="<?php echo (($_SESSION['tmp_user_values']['max_rows'] != 'all') ? $_SESSION['tmp_user_values']['max_rows'] : $GLOBALS['cfg']['MaxRows']); ?>" class="textfield" onfocus="this.select()" />
         <?php echo __('row(s) starting from row #') . "\n"; ?>
         <input type="text" name="pos" size="6" value="<?php echo (($pos_next >= $unlim_num_rows) ? 0 : $pos_next); ?>" class="textfield" onfocus="this.select()" />
diff --git a/sql.php b/sql.php
index fa07398..8a05298 100644
--- a/sql.php
+++ b/sql.php
@@ -730,7 +730,7 @@ if (0 == $num_rows || $is_affected) {
 else {
     //If we are retrieving the full value of a truncated field or the original
     // value of a transformed field, show it here and exit
-    if( $GLOBALS['inline_edit'] == true) {
+    if( $GLOBALS['inline_edit'] == true && $GLOBALS['cfg']['AjaxEnable']) {
         $row = PMA_DBI_fetch_row($result);
         $extra_data = array();
         $extra_data['value'] = $row[0];
@@ -750,7 +750,7 @@ else {
 
         unset($message);
 
-        if( $GLOBALS['is_ajax_request'] != true) {
+        if( ! $GLOBALS['is_ajax_request'] || ! $GLOBALS['cfg']['AjaxEnable']) {
             if (strlen($table)) {
                 require './libraries/tbl_common.php';
                 $url_query .= '&goto=tbl_sql.php&back=tbl_sql.php';
@@ -781,9 +781,13 @@ else {
         $fields_cnt  = count($fields_meta);
     }
 
-    if( $GLOBALS['is_ajax_request'] != true ) {
+    if( ! $GLOBALS['is_ajax_request']) {
         //begin the sqlqueryresults div here. container div
-        echo '<div id="sqlqueryresults">';
+        echo '<div id="sqlqueryresults"';
+        if ($GLOBALS['cfg']['AjaxEnable']) {
+            echo ' class="ajax"';
+        }
+        echo '>';
     }
 
     // Display previous update query (from tbl_replace)


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list