[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_9RC1-25267-g0d7b3a5

Rouslan Placella roccivic at users.sourceforge.net
Mon Dec 19 21:18:26 CET 2011


The branch, master has been updated
       via  0d7b3a5877dc71a0e43759a4bbba6f24ab1f0292 (commit)
      from  8b064f07906057aeeb465dd94e74ef1cc36be453 (commit)


- Log -----------------------------------------------------------------
commit 0d7b3a5877dc71a0e43759a4bbba6f24ab1f0292
Author: Rouslan Placella <rouslan at placella.com>
Date:   Mon Dec 19 20:16:54 2011 +0000

    Globally prevent AJAX requests from being cached

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

Summary of changes:
 js/db_search.js         |    8 --------
 js/functions.js         |   15 ++++++++++++++-
 js/server_privileges.js |   11 -----------
 js/server_variables.js  |    4 ----
 js/sql.js               |    9 ---------
 js/tbl_select.js        |    9 ---------
 js/tbl_zoom_plot.js     |    9 ---------
 7 files changed, 14 insertions(+), 51 deletions(-)

diff --git a/js/db_search.js b/js/db_search.js
index d787290..4cb1396 100644
--- a/js/db_search.js
+++ b/js/db_search.js
@@ -95,14 +95,6 @@ function deleteResult(result_path, msg, ajaxEnable)
 }
 
 $(document).ready(function() {
-    /**
-     * Set a parameter for all Ajax queries made on this page.
-     * Don't let the web server serve cached pages
-     */
-    $.ajaxSetup({
-        cache: 'false'
-    });
-
     /** Hide the table link in the initial search result */
     var icon = PMA_getImage('s_tbl.png', '', {'id': 'table-image'}).toString();
     $("#table-info").prepend(icon).hide();
diff --git a/js/functions.js b/js/functions.js
index 82d238a..c9574a1 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1,6 +1,6 @@
 /* vim: set expandtab sw=4 ts=4 sts=4: */
 /**
- * general function, usally for data manipulation pages
+ * general function, usually for data manipulation pages
  *
  */
 
@@ -44,6 +44,19 @@ function getWindowSize(wnd) {
 }
 
 /**
+ * Make sure that ajax requests will not be cached
+ * by appending a random variable to their parameters
+ */
+$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
+    var nocache = new Date().getTime() + "" + Math.floor(Math.random() * 1000000);
+    if (typeof options.data == "string") {
+        options.data += "&_nocache=" + nocache;
+    } else if (typeof options.data == "object") {
+        options.data = $.extend(originalOptions.data, {'_nocache':nocache});
+    }
+});
+
+/**
  * Add a hidden field to the form to indicate that this will be an
  * Ajax request (only if this hidden field does not exist)
  *
diff --git a/js/server_privileges.js b/js/server_privileges.js
index db8239d..6d425a6 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -139,17 +139,6 @@ function appendNewUser(new_user_string, new_user_initial, new_user_initial_strin
  */
 
 $(document).ready(function() {
-    /** @lends jQuery */
-
-    /**
-     * Set a parameter for all Ajax queries made on this page.  Some queries
-     * are affected by cache settings on the server side, and hence, show stale
-     * data.  Don't let the web server serve cached pages
-     */
-    $.ajaxSetup({
-        cache: 'false'
-    });
-
     /**
      * AJAX event handler for 'Add a New User'
      *
diff --git a/js/server_variables.js b/js/server_variables.js
index 3a14c0b..ef453f0 100644
--- a/js/server_variables.js
+++ b/js/server_variables.js
@@ -8,10 +8,6 @@ $(function() {
     saveLink = '<a href="#" class="saveLink">' + PMA_getImage('b_save.png') + ' ' + PMA_messages['strSave'] + '</a> ';
     cancelLink = '<a href="#" class="cancelLink">' + PMA_getImage('b_close.png') + ' ' + PMA_messages['strCancel'] + '</a> ';
 
-    $.ajaxSetup({
-        cache:false
-    });
-
     /* Variable editing */
     if (is_superuser) {
         $('table.data tbody tr td:nth-child(2)').hover(
diff --git a/js/sql.js b/js/sql.js
index 90ea43a..dd8a65d 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -72,15 +72,6 @@ function getFieldName($this_field)
  * @memberOf    jQuery
  */
 $(document).ready(function() {
-
-    /**
-     * Set a parameter for all Ajax queries made on this page.  Don't let the
-     * web server serve cached pages
-     */
-    $.ajaxSetup({
-        cache: 'false'
-    });
-
     /* Hides the bookmarkoptions checkboxes when the bookmark label is empty */
     $('input#bkm_label').keyup(function() {
         $('input#id_bkm_all_users, input#id_bkm_replace')
diff --git a/js/tbl_select.js b/js/tbl_select.js
index acd8b1f..ac700f0 100644
--- a/js/tbl_select.js
+++ b/js/tbl_select.js
@@ -13,15 +13,6 @@
  * Table Search
  */
 $(document).ready(function() {
-
-    /**
-     * Set a parameter for all Ajax queries made on this page.  Don't let the
-     * web server serve cached pages
-     */
-    $.ajaxSetup({
-        cache: 'false'
-    });
-
     /**
      * Prepare a div containing a link, otherwise it's incorrectly displayed 
      * after a couple of clicks
diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js
index 521fc84..63428d2 100644
--- a/js/tbl_zoom_plot.js
+++ b/js/tbl_zoom_plot.js
@@ -167,15 +167,6 @@ function includePan(currentChart) {
 }
 
 $(document).ready(function() {
-
-   /**
-    ** Set a parameter for all Ajax queries made on this page.  Don't let the
-    ** web server serve cached pages
-    **/
-    $.ajaxSetup({
-        cache: 'false'
-    });
-
     var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
     var currentChart = null;
     var currentData = null;


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list