[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_2-3861-g79f28d8

Marc Delisle lem9 at users.sourceforge.net
Thu Jun 16 22:18:33 CEST 2011


The branch, master has been updated
       via  79f28d8dbbcfe0e42847d2bfa3bb5a9003f5f470 (commit)
       via  d90bad9a8b324e4a9ae8cc0c6f401a74a488604b (commit)
      from  4338b70d9fdec523d93af791ba34817431e20154 (commit)


- Log -----------------------------------------------------------------
commit 79f28d8dbbcfe0e42847d2bfa3bb5a9003f5f470
Author: Marc Delisle <marc at infomarc.info>
Date:   Thu Jun 16 16:16:09 2011 -0400

    ChangeLog entry for patch

commit d90bad9a8b324e4a9ae8cc0c6f401a74a488604b
Author: Rouslan Placella <rouslan at placella.com>
Date:   Thu Jun 16 16:15:12 2011 -0400

    Patch #3316969 PMA_ajaxShowMessage() does not respect timeout

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

Summary of changes:
 ChangeLog       |    1 +
 js/functions.js |   96 ++++++++++++++++++++++---------------------------------
 2 files changed, 39 insertions(+), 58 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b69dd20..edbb3ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@ phpMyAdmin - ChangeLog
 + rfe #939233 [interface] Flexible column width
 + [interface] Mouse-based column reordering in query results
 + AJAX for Insert to a table from database Structure page
+- Patch #3316969 PMA_ajaxShowMessage() does not respect timeout
 
 3.4.3.0 (not yet released)
 - bug #3311170 [sync] Missing helper icons in Synchronize
diff --git a/js/functions.js b/js/functions.js
index 1b09f63..3418e51 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -15,10 +15,9 @@ var sql_box_locked = false;
 var only_once_elements = new Array();
 
 /**
- * @var ajax_message_init   boolean boolean that stores status of
- *      notification for PMA_ajaxShowNotification
+ * @var   int   ajax_message_count   Number of AJAX messages shown since page load
  */
-var ajax_message_init = false;
+var ajax_message_count = 0;
 
 /**
  * @var codemirror_editor object containing CodeMirror editor
@@ -1244,83 +1243,64 @@ $(document).ready(function(){
  *                              optional, defaults to 'Loading...'
  * @param   var     timeout     number of milliseconds for the message to be visible
  *                              optional, defaults to 5000
- * @return  jQuery object       jQuery Element that holds the message div 
+ * @return  jQuery object       jQuery Element that holds the message div
  */
-
 function PMA_ajaxShowMessage(message, timeout) {
 
-    //Handle the case when a empty data.message is passed.  We don't want the empty message
-    if(message == '') {
+    //Handle the case when a empty data.message is passed. We don't want the empty message
+    if (message == '') {
         return true;
+    } else if (! message) {
+        // If the message is undefined, show the default
+        message = PMA_messages['strLoading'];
     }
 
     /**
-     * @var msg String containing the message that has to be displayed
-     * @default PMA_messages['strLoading']
+     * @var timeout Number of milliseconds for which the message will be visible
+     * @default 5000 ms
      */
-    if(!message) {
-        var msg = PMA_messages['strLoading'];
+    if (! timeout) {
+        timeout = 5000;
     }
-    else {
-        var msg = message;
+
+    // Create a parent element for the AJAX messages, if necessary
+    if ($('#loading_parent').length == 0) {
+        $('<div id="loading_parent"></div>')
+        .insertBefore("#serverinfo");
     }
 
+    // Update message count to create distinct message elements every time
+    ajax_message_count++;
+
+    // Remove all old messages, if any
+    $(".ajax_notification[id^=ajax_message_num]").remove();
+
     /**
-     * @var timeout Number of milliseconds for which {@link msg} will be visible
-     * @default 5000 ms
+     * @var    $retval    a jQuery object containing the reference
+     *                    to the created AJAX message
      */
-    if(!timeout) {
-        var to = 5000;
-    }
-    else {
-        var to = timeout;
-    }
-
-    if( !ajax_message_init) {
-        //For the first time this function is called, append a new div
-        $(function(){
-            $('<div id="loading_parent"></div>')
-            .insertBefore("#serverinfo");
-
-            $('<span id="loading" class="ajax_notification"></span>')
-            .appendTo("#loading_parent")
-            .html(msg)
-            .fadeIn('medium')
-            .delay(to)
-            .fadeOut('medium', function(){
-                $(this)
-                .html("") //Clear the message
-                .hide();
-            });
-        }, 'top.frame_content');
-        ajax_message_init = true;
-    }
-    else {
-        //Otherwise, just show the div again after inserting the message
-        $("#loading")
-        .stop(true, true)
-        .html(msg)
+    var $retval = $('<span class="ajax_notification" id="ajax_message_num_' + ajax_message_count + '"></span>')
+        .hide()
+        .appendTo("#loading_parent")
+        .html(message)
         .fadeIn('medium')
-        .delay(to)
+        .delay(timeout)
         .fadeOut('medium', function() {
-            $(this)
-            .html("")
-            .hide();
-        })
-    }
+            $(this).remove();
+        });
 
-    return $("#loading");
+    return $retval;
 }
 
 /**
  * Removes the message shown for an Ajax operation when it's completed
  */
 function PMA_ajaxRemoveMessage($this_msgbox) {
-    $this_msgbox
-     .stop(true, true)
-     .fadeOut('medium', function() {
-        $this_msgbox.hide();
-     });
+    if ($this_msgbox != 'undefined' && $this_msgbox instanceof jQuery) {
+        $this_msgbox
+        .stop(true, true)
+        .fadeOut('medium');
+    }
 }
 
 /**


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list