[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_3_8-10853-gd9d5abe

Marc Delisle lem9 at users.sourceforge.net
Sun Nov 14 14:08:22 CET 2010


The branch, master has been updated
       via  d9d5abee089ee2570220a04a0aa8e664ab4334dd (commit)
      from  5a72c4ea7dd375d38cd01c4cf02b31f57b29f15c (commit)


- Log -----------------------------------------------------------------
commit d9d5abee089ee2570220a04a0aa8e664ab4334dd
Author: Marc Delisle <marc at infomarc.info>
Date:   Sun Nov 14 08:08:14 2010 -0500

    adjust totals when dropping a table

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

Summary of changes:
 js/db_structure.js |   58 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/js/db_structure.js b/js/db_structure.js
index f74cc26..03aa8e1 100644
--- a/js/db_structure.js
+++ b/js/db_structure.js
@@ -17,6 +17,39 @@
  * Drop Table
  *
  */
+
+/**
+ * Adjust number of rows and total size in the summary
+ * when emptying or dropping a table
+ *
+ * @param jQuery object     $this_anchor
+ */
+function PMA_adjustTotals($this_anchor) {
+    var $parent_tr = $this_anchor.closest('tr');
+    var $rows_td = $parent_tr.find('.tbl_rows');
+    var $size_td = $parent_tr.find('.tbl_size');
+    var num_rows = parseInt($rows_td.text());
+    // set number of rows to 0
+    // (not really needed in case we are dropping the table)
+    $rows_td.text('0');
+    // set size to unknown (not sure how to get the exact
+    // value here, as an empty InnoDB table would have a size) 
+    $size_td.text('-');
+
+    // try to compute a new total row number
+    if (! isNaN(num_rows)) {
+        $total_rows_td = $('#tbl_summary_row').find('.tbl_rows');
+        var total_rows = parseInt($total_rows_td.text());
+        if (! isNaN(total_rows)) {
+            $total_rows_td.text(total_rows - num_rows);
+        }
+    }
+
+    // prefix total size with "~"
+    var $total_size_td = $('#tbl_summary_row').find('.tbl_size');
+    $total_size_td.text($total_size_td.text().replace(/^/,'~'));
+}
+
 $(document).ready(function() {
 
     /**
@@ -53,28 +86,7 @@ $(document).ready(function() {
                     //Fetch inner span of this anchor
                     //and replace the icon with its disabled version
                     var span = $this_anchor.html().replace(/b_empty.png/, 'bd_empty.png');
-                    var $parent_tr = $this_anchor.closest('tr');
-                    var $rows_td = $parent_tr.find('.tbl_rows');
-                    var $size_td = $parent_tr.find('.tbl_size');
-                    var num_rows = parseInt($rows_td.text());
-                    // set number of rows to 0
-                    $rows_td.text('0');
-                    // set size to unknown (not sure how to get the exact
-                    // value here, as an empty InnoDB table would have a size) 
-                    $size_td.text('-');
-
-                    // try to compute a new total row number
-                    if (! isNaN(num_rows)) {
-                        $total_rows_td = $('#tbl_summary_row').find('.tbl_rows');
-                        var total_rows = parseInt($total_rows_td.text());
-                        if (! isNaN(total_rows)) {
-                            $total_rows_td.text(total_rows - num_rows);
-                        }
-                    }
-
-                    // prefix total size with "~"
-                    var $total_size_td = $('#tbl_summary_row').find('.tbl_size');
-                    $total_size_td.text($total_size_td.text().replace(/^/,'~'));
+                    PMA_adjustTotals($this_anchor);
 
                     //To disable further attempts to truncate the table,
                     //replace the a element with its inner span (modified)
@@ -120,7 +132,7 @@ $(document).ready(function() {
             $.get(url, {'is_js_confirmed' : 1, 'ajax_request' : true}, function(data) {
                 if (data.success == true) {
                     PMA_ajaxShowMessage(data.message);
-                    //need to find a better solution here.  The icon should be replaced
+                    PMA_adjustTotals($this_anchor);
                     $curr_row.hide("medium").remove();
 
                     if (window.parent && window.parent.frame_navigation) {


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list