[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_1-8272-g0131d16

Marc Delisle lem9 at users.sourceforge.net
Wed Jul 13 15:08:09 CEST 2011


The branch, master has been updated
       via  0131d16548e5bc32d7619d43c97272a5a2c1474f (commit)
       via  010f19912460c8e3b925ff7b19f7e2f37361a339 (commit)
       via  954d39b305e2b3e8082a2ff484b06a176052bf4f (commit)
       via  ecade8433a19f6600e7202494f7acc6584f913ce (commit)
       via  991deb415ba369d87b2a816feb0180660329b332 (commit)
       via  7c4e0114e9d88120b6446eef88b3b9ad2203622c (commit)
       via  63c7cee5d96d8c25b2181192451790cc6f8103cd (commit)
       via  9ec2daa4c61c701553dc49d2256730ce9f841e34 (commit)
       via  705bdd73565d43ea40b7e9ed7259e867d7503b42 (commit)
       via  dbf06b6a1ba2ea901351718aad8c1f92de286daa (commit)
      from  d2d2c3c9959f865a6340474d3f9bdab03101f82c (commit)


- Log -----------------------------------------------------------------
commit 0131d16548e5bc32d7619d43c97272a5a2c1474f
Merge: d2d2c3c9959f865a6340474d3f9bdab03101f82c 010f19912460c8e3b925ff7b19f7e2f37361a339
Author: Marc Delisle <marc at infomarc.info>
Date:   Wed Jul 13 09:04:51 2011 -0400

    Merge commit '010f19912460c8e3b925ff7b19f7e2f37361a339'

commit 010f19912460c8e3b925ff7b19f7e2f37361a339
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Mon Jul 11 15:15:24 2011 +0800

    Remove vertical support for inline edit

commit 954d39b305e2b3e8082a2ff484b06a176052bf4f
Merge: 991deb415ba369d87b2a816feb0180660329b332 ecade8433a19f6600e7202494f7acc6584f913ce
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Mon Jul 11 09:52:37 2011 +0800

    Merge branch 'hidecol' into aris

commit ecade8433a19f6600e7202494f7acc6584f913ce
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Mon Jul 11 09:52:02 2011 +0800

    Show/hide column: fix bug - use .text instead of .html to handle special column name

commit 991deb415ba369d87b2a816feb0180660329b332
Merge: 9ec2daa4c61c701553dc49d2256730ce9f841e34 7c4e0114e9d88120b6446eef88b3b9ad2203622c
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Sun Jul 10 10:06:33 2011 +0800

    Fix merge conflict with bug fix for show/hide column feature

commit 7c4e0114e9d88120b6446eef88b3b9ad2203622c
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Sun Jul 10 10:04:06 2011 +0800

    Show/hide column: fix bug - clickable area in column visibility checkbox list not span correctly if columns have short names

commit 63c7cee5d96d8c25b2181192451790cc6f8103cd
Merge: dbf06b6a1ba2ea901351718aad8c1f92de286daa c8ba421d379c15cd6bac620a77be50513e7da710
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Sun Jul 10 09:59:51 2011 +0800

    Merge remote-tracking branch 'origin/master' into hidecol

commit 9ec2daa4c61c701553dc49d2256730ce9f841e34
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Fri Jul 8 15:41:09 2011 +0800

    Remove vertical support for column resizing/reordering

commit 705bdd73565d43ea40b7e9ed7259e867d7503b42
Merge: c8ba421d379c15cd6bac620a77be50513e7da710 dbf06b6a1ba2ea901351718aad8c1f92de286daa
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Fri Jul 8 15:22:34 2011 +0800

    Merge branch 'hidecol' into aris

commit dbf06b6a1ba2ea901351718aad8c1f92de286daa
Author: Aris Feryanto <aris_feryanto at yahoo.com>
Date:   Fri Jul 8 15:22:27 2011 +0800

    Show/hide column: fix bug - hint is still shown when we can't toggle column visibility (i.e., when there is only 1 column available)

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

Summary of changes:
 js/functions.js                         |    2 +-
 js/makegrid.js                          |  283 +++++++++++--------------------
 js/sql.js                               |  249 ++++++----------------------
 themes/original/css/theme_right.css.php |   16 +--
 themes/original/img/col_pointer_ver.png |  Bin 128 -> 0 bytes
 themes/pmahomme/css/theme_right.css.php |   16 +--
 themes/pmahomme/img/col_pointer_ver.png |  Bin 138 -> 0 bytes
 7 files changed, 154 insertions(+), 412 deletions(-)
 delete mode 100644 themes/original/img/col_pointer_ver.png
 delete mode 100644 themes/pmahomme/img/col_pointer_ver.png

diff --git a/js/functions.js b/js/functions.js
index 1b874ca..04fe9e3 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -2389,7 +2389,7 @@ $(function() {
  * Get the row number from the classlist (for example, row_1)
  */
 function PMA_getRowNumber(classlist) {
-    return parseInt(classlist.split(/row_/)[1]);
+    return parseInt(classlist.split(/\s+row_/)[1]);
 }
 
 /**
diff --git a/js/makegrid.js b/js/makegrid.js
index 11bfa09..970ed59 100644
--- a/js/makegrid.js
+++ b/js/makegrid.js
@@ -6,7 +6,6 @@
             minColWidth: 15,
             
             // variables, assigned with default value, changed later
-            alignment: 'horizontal',    // 3 possibilities: vertical, horizontal, horizontalflipped
             actionSpan: 5,
             colOrder: new Array(),      // array of column order
             colVisib: new Array(),      // array of column visibility
@@ -32,9 +31,7 @@
                     n: n,
                     obj: obj,
                     objLeft: $(obj).position().left,
-                    objWidth: this.alignment != 'vertical' ?
-                              $(this.t).find('th.draggable:visible:eq(' + n + ') span').outerWidth() :
-                              $(this.t).find('tr:first td:eq(' + n + ') span').outerWidth()
+                    objWidth: $(this.t).find('th.draggable:visible:eq(' + n + ') span').outerWidth()
                 };
                 $('body').css('cursor', 'col-resize');
                 $('body').noSelect();
@@ -44,27 +41,15 @@
                 // prepare the cCpy and cPointer from the dragged column
                 $(this.cCpy).text($(obj).text());
                 var objPos = $(obj).position();
-                if (this.alignment != 'vertical') {
-                    $(this.cCpy).css({
-                        top: objPos.top + 20,
-                        left: objPos.left,
-                        height: $(obj).height(),
-                        width: $(obj).width()
-                    });
-                    $(this.cPointer).css({
-                        top: objPos.top
-                    });
-                } else {    // vertical alignment
-                    $(this.cCpy).css({
-                        top: objPos.top,
-                        left: objPos.left + 30,
-                        height: $(obj).height(),
-                        width: $(obj).width()
-                    });
-                    $(this.cPointer).css({
-                        top: objPos.top
-                    });
-                }
+                $(this.cCpy).css({
+                    top: objPos.top + 20,
+                    left: objPos.left,
+                    height: $(obj).height(),
+                    width: $(obj).width()
+                });
+                $(this.cPointer).css({
+                    top: objPos.top
+                });
                 
                 // get the column index, zero-based
                 var n = this.getHeaderIdx(obj);
@@ -90,17 +75,10 @@
                         $(this.colRsz.obj).css('left', this.colRsz.objLeft + dx + 'px');
                 } else if (this.colMov) {
                     // dragged column animation
-                    if (this.alignment != 'vertical') {
-                        var dx = e.pageX - this.colMov.x0;
-                        $(this.cCpy)
-                            .css('left', this.colMov.objLeft + dx)
-                            .show();
-                    } else {    // vertical alignment
-                        var dy = e.pageY - this.colMov.y0;
-                        $(this.cCpy)
-                            .css('top', this.colMov.objTop + dy)
-                            .show();
-                    }
+                    var dx = e.pageX - this.colMov.x0;
+                    $(this.cCpy)
+                        .css('left', this.colMov.objLeft + dx)
+                        .show();
                     
                     // pointer animation
                     var hoveredCol = this.getHoveredCol(e);
@@ -110,25 +88,14 @@
                         if (newn != this.colMov.n) {
                             // show the column pointer in the right place
                             var colPos = $(hoveredCol).position();
-                            if (this.alignment != 'vertical') {
-                                var newleft = newn < this.colMov.n ?
-                                              colPos.left :
-                                              colPos.left + $(hoveredCol).outerWidth();
-                                $(this.cPointer)
-                                    .css({
-                                        left: newleft,
-                                        visibility: 'visible'
-                                    });
-                            } else {    // vertical alignment
-                                var newtop = newn < this.colMov.n ?
-                                              colPos.top :
-                                              colPos.top + $(hoveredCol).outerHeight();
-                                $(this.cPointer)
-                                    .css({
-                                        top: newtop,
-                                        visibility: 'visible'
-                                    });
-                            }
+                            var newleft = newn < this.colMov.n ?
+                                          colPos.left :
+                                          colPos.left + $(hoveredCol).outerWidth();
+                            $(this.cPointer)
+                                .css({
+                                    left: newleft,
+                                    visibility: 'visible'
+                                });
                         } else {
                             // no movement to other column, hide the column pointer
                             $(this.cPointer).css('visibility', 'hidden');
@@ -187,18 +154,11 @@
              * Resize column n to new width "nw"
              */
             resize: function(n, nw) {
-                if (this.alignment != 'vertical') {
-                    $(this.t).find('tr').each(function() {
-                        $(this).find('th.draggable:visible:eq(' + n + ') span,' +
-                                     'td:visible:eq(' + (g.actionSpan + n) + ') span')
-                               .css('width', nw);
-                    });
-                } else {    // vertical alignment
-                    $(this.t).find('tr').each(function() {
-                        $(this).find('td:eq(' + n + ') span')
-                               .css('width', nw);
-                    });
-                }
+                $(this.t).find('tr').each(function() {
+                    $(this).find('th.draggable:visible:eq(' + n + ') span,' +
+                                 'td:visible:eq(' + (g.actionSpan + n) + ') span')
+                           .css('width', nw);
+                });
             },
             
             /**
@@ -206,9 +166,7 @@
              */
             reposRsz: function() {
                 $(this.cRsz).find('div').hide();
-                $firstRowCols = this.alignment != 'vertical' ?
-                                $(this.t).find('tr:first th.draggable:visible') :
-                                $(this.t).find('tr:first td');
+                $firstRowCols = $(this.t).find('tr:first th.draggable:visible');
                 for (var n = 0; n < $firstRowCols.length; n++) {
                     $this = $($firstRowCols[n]);
                     $cb = $(g.cRsz).find('div:eq(' + n + ')');   // column border
@@ -222,40 +180,29 @@
              * Shift column from index oldn to newn.
              */
             shiftCol: function(oldn, newn) {
-                if (this.alignment != 'vertical') {
-                    $(this.t).find('tr').each(function() {
-                        if (newn < oldn) {
-                            $(this).find('th.draggable:eq(' + newn + '),' +
-                                         'td:eq(' + (g.actionSpan + newn) + ')')
-                                   .before($(this).find('th.draggable:eq(' + oldn + '),' +
-                                                        'td:eq(' + (g.actionSpan + oldn) + ')'));
-                        } else {
-                            $(this).find('th.draggable:eq(' + newn + '),' +
-                                         'td:eq(' + (g.actionSpan + newn) + ')')
-                                   .after($(this).find('th.draggable:eq(' + oldn + '),' +
-                                                       'td:eq(' + (g.actionSpan + oldn) + ')'));
-                        }
-                    });
-                    // reposition the column resize bars
-                    this.reposRsz();
-                    
-                } else {    // vertical alignment
-                    // shift rows
+                $(this.t).find('tr').each(function() {
                     if (newn < oldn) {
-                        $(this.t).find('tr:eq(' + (g.actionSpan + newn) + ')')
-                                 .before($(this.t).find('tr:eq(' + (g.actionSpan + oldn) + ')'));
+                        $(this).find('th.draggable:eq(' + newn + '),' +
+                                     'td:eq(' + (g.actionSpan + newn) + ')')
+                               .before($(this).find('th.draggable:eq(' + oldn + '),' +
+                                                    'td:eq(' + (g.actionSpan + oldn) + ')'));
                     } else {
-                        $(this.t).find('tr:eq(' + (g.actionSpan + newn) + ')')
-                                 .after($(this.t).find('tr:eq(' + (g.actionSpan + oldn) + ')'));
+                        $(this).find('th.draggable:eq(' + newn + '),' +
+                                     'td:eq(' + (g.actionSpan + newn) + ')')
+                               .after($(this).find('th.draggable:eq(' + oldn + '),' +
+                                                   'td:eq(' + (g.actionSpan + oldn) + ')'));
                     }
-                }
+                });
+                // reposition the column resize bars
+                this.reposRsz();
+                    
                 // adjust the column visibility list
                 if (newn < oldn) {
-                    $(g.cList).find('tr:eq(' + newn + ')')
-                              .before($(g.cList).find('tr:eq(' + oldn + ')'));
+                    $(g.cList).find('.lDiv div:eq(' + newn + ')')
+                              .before($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
                 } else {
-                    $(g.cList).find('tr:eq(' + newn + ')')
-                              .after($(g.cList).find('tr:eq(' + oldn + ')'));
+                    $(g.cList).find('.lDiv div:eq(' + newn + ')')
+                              .after($(g.cList).find('.lDiv div:eq(' + oldn + ')'));
                 }
                 // adjust the colOrder
                 var tmp = this.colOrder[oldn];
@@ -274,23 +221,13 @@
             getHoveredCol: function(e) {
                 var hoveredCol;
                 $headers = $(this.t).find('th.draggable:visible');
-                if (this.alignment != 'vertical') {
-                    $headers.each(function() {
-                        var left = $(this).offset().left;
-                        var right = left + $(this).outerWidth();
-                        if (left <= e.pageX && e.pageX <= right) {
-                            hoveredCol = this;
-                        }
-                    });
-                } else {    // vertical alignment
-                    $headers.each(function() {
-                        var top = $(this).offset().top;
-                        var bottom = top + $(this).height();
-                        if (top <= e.pageY && e.pageY <= bottom) {
-                            hoveredCol = this;
-                        }
-                    });
-                }
+                $headers.each(function() {
+                    var left = $(this).offset().left;
+                    var right = left + $(this).outerWidth();
+                    if (left <= e.pageX && e.pageX <= right) {
+                        hoveredCol = this;
+                    }
+                });
                 return hoveredCol;
             },
             
@@ -298,15 +235,7 @@
              * Get a zero-based index from a <th class="draggable"> tag in a table.
              */
             getHeaderIdx: function(obj) {
-                var n;
-                if (this.alignment != 'vertical') {
-                    n = $(obj).parents('tr').find('th.draggable').index(obj);
-                } else {
-                    var column_idx = $(obj).index();
-                    var $th_in_same_column = $(this.t).find('th.draggable:nth-child(' + (column_idx + 1) + ')');
-                    n = $th_in_same_column.index(obj);
-                }
-                return n;
+                return $(obj).parents('tr').find('th.draggable').index(obj);
             },
             
             /**
@@ -453,36 +382,26 @@
                 if (this.colVisib[n]) {
                     // can hide if more than one column is visible
                     if (this.visibleHeadersCount > 1) {
-                        if (this.alignment != 'vertical') {
-                            $(this.t).find('tr').each(function() {
-                                $(this).find('th.draggable:eq(' + n + '),' +
-                                             'td:eq(' + (g.actionSpan + n) + ')')
-                                       .hide();
-                            });
-                        } else {    // vertical alignment
-                            $(this.t).find('tr:eq(' + (g.actionSpan + n) + ')')
-                                .hide();
-                        }
+                        $(this.t).find('tr').each(function() {
+                            $(this).find('th.draggable:eq(' + n + '),' +
+                                         'td:eq(' + (g.actionSpan + n) + ')')
+                                   .hide();
+                        });
                         this.colVisib[n] = 0;
-                        $(this.cList).find('tr:eq(' + n + ') input').removeAttr('checked');
+                        $(this.cList).find('.lDiv div:eq(' + n + ') input').removeAttr('checked');
                     } else {
                         // cannot hide, force the checkbox to stay checked
-                        $(this.cList).find('tr:eq(' + n + ') input').attr('checked', 'checked');
+                        $(this.cList).find('.lDiv div:eq(' + n + ') input').attr('checked', 'checked');
                         return false;
                     }
                 } else {    // column n is not visible
-                    if (this.alignment != 'vertical') {
-                        $(this.t).find('tr').each(function() {
-                            $(this).find('th.draggable:eq(' + n + '),' +
-                                         'td:eq(' + (g.actionSpan + n) + ')')
-                                   .show();
-                        });
-                    } else {    // vertical alignment
-                        $(this.t).find('tr:eq(' + (g.actionSpan + n) + ')')
-                            .show();
-                    }
+                    $(this.t).find('tr').each(function() {
+                        $(this).find('th.draggable:eq(' + n + '),' +
+                                     'td:eq(' + (g.actionSpan + n) + ')')
+                               .show();
+                    });
                     this.colVisib[n] = 1;
-                    $(this.cList).find('tr:eq(' + n + ') input').attr('checked', 'checked');
+                    $(this.cList).find('.lDiv div:eq(' + n + ') input').attr('checked', 'checked');
                 }
                 return true;
             },
@@ -500,9 +419,7 @@
                 this.sendColPrefs();
                 
                 // check visible first row headers count
-                this.visibleHeadersCount = this.alignment != 'vertical' ?
-                                           $(this.t).find('tr:first th.draggable:visible').length :
-                                           $(this.t).find('th.draggable:nth-child(1):visible').length;
+                this.visibleHeadersCount = $(this.t).find('tr:first th.draggable:visible').length;
                 this.refreshRestoreButton();
             },
             
@@ -574,15 +491,12 @@
         g.cDrop = document.createElement('div');    // column drop-down arrows
         g.cList = document.createElement('div');    // column visibility list
         
-        // assign the table alignment
-        g.alignment = $("#top_direction_dropdown").val();
-        
         // adjust g.cCpy
         g.cCpy.className = 'cCpy';
         $(g.cCpy).hide();
         
         // adjust g.cPoint
-        g.cPointer.className = g.alignment != 'vertical' ? 'cPointer' : 'cPointerVer';
+        g.cPointer.className = 'cPointer';
         $(g.cPointer).css('visibility', 'hidden');
         
         // adjust g.dHint
@@ -601,23 +515,14 @@
         g.t = t;
         
         // get first row data columns
-        var $firstRowCols = g.alignment != 'vertical' ?
-                            $(t).find('tr:first th.draggable') :
-                            $(t).find('tr:first td');
-        
-        // get first row of data headers (first column of data headers, in vertical mode)
-        var $firstRowHeaders = g.alignment != 'vertical' ?
-                               $(t).find('tr:first th.draggable') :
-                               $(t).find('th.draggable:nth-child(1)');
+        var $firstRowCols = $(t).find('tr:first th.draggable');
         
         // initialize g.visibleHeadersCount
-        g.visibleHeadersCount = $firstRowHeaders.filter(':visible').length;
+        g.visibleHeadersCount = $firstRowCols.filter(':visible').length;
         
         // assign first column (actions) span
         if (! $(t).find('tr:first th:first').hasClass('draggable')) {  // action header exist
-            g.actionSpan = g.alignment != 'vertical' ?
-                           $(t).find('tr:first th:first').prop('colspan') :
-                           $(t).find('tr:first th:first').prop('rowspan');
+            g.actionSpan = $(t).find('tr:first th:first').prop('colspan');
         } else {
             g.actionSpan = 0;
         }
@@ -642,7 +547,7 @@
             }
         } else {
             g.colOrder = new Array();
-            for (var i = 0; i < $firstRowHeaders.length; i++) {
+            for (var i = 0; i < $firstRowCols.length; i++) {
                 g.colOrder.push(i);
             }
         }
@@ -656,12 +561,12 @@
             }
         } else {
             g.colVisib = new Array();
-            for (var i = 0; i < $firstRowHeaders.length; i++) {
+            for (var i = 0; i < $firstRowCols.length; i++) {
                 g.colVisib.push(1);
             }
         }
         
-        if ($firstRowHeaders.length > 1) {
+        if ($firstRowCols.length > 1) {
             // create column drop-down arrow(s)
             $(t).find('th:not(.draggable)').each(function() {
                 var cd = document.createElement('div'); // column drop-down arrow
@@ -682,16 +587,16 @@
             });
             
             // add column visibility control
-            g.cList.innerHTML = '<table cellpadding="0" cellspacing="0"><tbody></tbody></table>';
-            var $tbody = $(g.cList).find('tbody');
-            for (var i = 0; i < $firstRowHeaders.length; i++) {
-                var currHeader = $firstRowHeaders[i];
-                var tr = document.createElement('tr');
-                $(tr).html('<td><input type="checkbox" ' + (g.colVisib[i] ? 'checked="checked" ' : '') + '/></td>' +
-                           '<td>' + $(currHeader).text() + '</td>');
-                $tbody.append(tr);
+            g.cList.innerHTML = '<div class="lDiv"></div>';
+            var $listDiv = $(g.cList).find('div');
+            for (var i = 0; i < $firstRowCols.length; i++) {
+                var currHeader = $firstRowCols[i];
+                var listElmt = document.createElement('div');
+                $(listElmt).text($(currHeader).text())
+                    .prepend('<input type="checkbox" ' + (g.colVisib[i] ? 'checked="checked" ' : '') + '/>');
+                $listDiv.append(listElmt);
                 // add event on click
-                $(tr).click(function() {
+                $(listElmt).click(function() {
                     if ( g.toggleCol($(this).index()) ) {
                         g.afterToggleCol();
                     }
@@ -706,7 +611,7 @@
                 g.showAllColumns();
             });
             // prepend "show all column" button at top if the list is too long
-            if ($firstRowHeaders.length > 10) {
+            if ($firstRowCols.length > 10) {
                 var clone = showAll.cloneNode(true);
                 $(g.cList).prepend(clone);
                 $(clone).click(function() {
@@ -749,15 +654,17 @@
                     g.showHint(e);
                 });
         }
-        $(t).find('th:not(.draggable)')
-            .mouseenter(function(e) {
-                g.showColVisibHint = true;
-                g.showHint(e);
-            })
-            .mouseleave(function(e) {
-                g.showColVisibHint = false;
-                g.showHint(e);
-            });
+        if ($firstRowCols.length > 1) {
+            $(t).find('th:not(.draggable)')
+                .mouseenter(function(e) {
+                    g.showColVisibHint = true;
+                    g.showHint(e);
+                })
+                .mouseleave(function(e) {
+                    g.showColVisibHint = false;
+                    g.showHint(e);
+                });
+        }
         $(t).find('th.draggable a')
             .attr('title', '')          // hide default tooltip for sorting
             .mouseenter(function(e) {
diff --git a/js/sql.js b/js/sql.js
index 9b54bb9..ab38420 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -28,28 +28,18 @@ function PMA_urlencode(str) {
  * for inline editing
  *
  * @param   $this_field  jQuery object that points to the current field's tr
- * @param   disp_mode    string
  */
-function getFieldName($this_field, disp_mode) {
-
-    if(disp_mode == 'vertical') {
-        var field_name = $this_field.siblings('th').find('a').text();
-        // happens when just one row (headings contain no a)
-        if ("" == field_name) {
-            field_name = $this_field.siblings('th').text();
-        }
-    }
-    else {
-        var this_field_index = $this_field.index();
-        // ltr or rtl direction does not impact how the DOM was generated
-        // check if the action column in the left exist
-        var leftActionExist = !$('#table_results').find('th:first').hasClass('draggable');
-        // 5 columns to account for the checkbox, edit, appended inline edit, copy and delete anchors but index is zero-based so substract 4
-        var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ') a').text();
-        // happens when just one row (headings contain no a)
-        if ("" == field_name) {
-            field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ')').text();
-        }
+function getFieldName($this_field) {
+
+    var this_field_index = $this_field.index();
+    // ltr or rtl direction does not impact how the DOM was generated
+    // check if the action column in the left exist
+    var leftActionExist = !$('#table_results').find('th:first').hasClass('draggable');
+    // 5 columns to account for the checkbox, edit, appended inline edit, copy and delete anchors but index is zero-based so substract 4
+    var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ') a').text();
+    // happens when just one row (headings contain no a)
+    if ("" == field_name) {
+        field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ')').text();
     }
 
     field_name = $.trim(field_name);
@@ -63,49 +53,9 @@ function getFieldName($this_field, disp_mode) {
  *
  */
 function appendInlineAnchor() {
+    // TODO: remove two lines below if vertical display mode has been completely removed
     var disp_mode = $("#top_direction_dropdown").val();
-
-    if (disp_mode == 'vertical') {
-        // there can be one or two tr containing this class, depending
-        // on the RowActionLinks cfg parameter
-        $('#table_results tr')
-            .find('.edit_row_anchor')
-            .removeClass('edit_row_anchor')
-            .parent().each(function() {
-            var $this_tr = $(this);
-            var $cloned_tr = $this_tr.clone();
-
-            var $img_object = $cloned_tr.find('img:first').attr('title', PMA_messages['strInlineEdit']);
-            if ($img_object.length != 0) {
-                var img_src = $img_object.attr('src').replace(/b_edit/,'b_inline_edit');
-                $img_object.attr('src', img_src);
-            }
-
-            $cloned_tr.find('td')
-             .addClass('inline_edit_anchor')
-             .find('a').attr('href', '#');
-            var $edit_span = $cloned_tr.find('span:contains("' + PMA_messages['strEdit'] + '")');
-            var $span = $cloned_tr.find('a').find('span');
-            if ($edit_span.length > 0) {
-                $span.text(' ' + PMA_messages['strInlineEdit']);
-                $span.prepend($img_object);
-            } else {
-                $span.text('');
-                $span.append($img_object);
-            }
-
-            $cloned_tr.insertAfter($this_tr);
-        });
-
-        $('#resultsForm').find('tbody').find('th').each(function() {
-            var $this_th = $(this);
-            if ($this_th.attr('rowspan') == 4) {
-                $this_th.attr('rowspan', '5');
-            }
-        });
-    }
-    else {
-        // horizontal mode
+    if (disp_mode != 'vertical') {
         $('.edit_row_anchor').each(function() {
 
             var $this_td = $(this);
@@ -195,23 +145,6 @@ $(document).ready(function() {
     }).trigger('keyup');
     
     /**
-     * current value of the direction in which the table is displayed
-     * @type    String
-     * @fieldOf jQuery
-     * @name    disp_mode
-     */
-    var disp_mode = $("#top_direction_dropdown").val();
-
-    /**
-     * Update value of {@link jQuery.disp_mode} everytime the direction dropdown changes value
-     * @memberOf    jQuery
-     * @name        direction_dropdown_change
-     */
-    $("#top_direction_dropdown, #bottom_direction_dropdown").live('change', function(event) {
-        disp_mode = $(this).val();
-    })
-
-    /**
      * Attach the {@link appendInlineAnchor} function to a custom event, which
      * will be triggered manually everytime the table of results is reloaded
      * @memberOf    jQuery
@@ -536,95 +469,39 @@ $(document).ready(function() {
         // Add hide icon and/or text.
         $edit_td.children('span.nowrap').append($('<br /><br />')).append($hide_a);
 
-        if (disp_mode != 'vertical') {
-            $('#table_results tbody tr td span a#hide').click(function() {
-                var $this_hide = $(this).parents('td');
-
-                var $this_span = $this_hide.find('span');
-                $this_span.find('a, br').remove();
-                $this_span.append($data_a.clone());
-
-                $this_hide.removeClass("inline_edit_active hover").addClass("inline_edit_anchor");
-                $this_hide.parent().removeClass("hover noclick");
-                $this_hide.siblings().removeClass("hover");
-
-                var $input_siblings = $this_hide.parent('tr').find('.inline_edit');
-                var txt = '';
-                $input_siblings.each(function() {
-                    var $this_hide_siblings = $(this);
-                    txt = $this_hide_siblings.data('original_data');
-                    if($this_hide_siblings.children('span').children().length != 0) {
-                        $this_hide_siblings.children('span').empty();
-                        $this_hide_siblings.children('span').append(txt);
-                    }
-                });
-                $(this).prev().prev().remove();
-                $(this).prev().remove();
-                $(this).remove();
-                
-                // refresh the grid
-                $("#sqlqueryresults").trigger('refreshgrid');
-            });
-        } else {
-            var txt = '';
-            var rows = $edit_td.parent().siblings().length;
-
-            $('#table_results tbody tr td span a#hide').click(function() {
-                var $hide_a = $(this);
-                var $this_hide = $(this).parents('td');
-                var pos = $this_hide.index();
-
-                var $this_span = $hide_a.parent();
-                $this_span.find('a, br').remove();
-                $this_span.append($data_a.clone());
+        $('#table_results tbody tr td span a#hide').click(function() {
+            var $this_hide = $(this).parents('td');
 
-                var $this_row = $this_span.parents('tr');
-                // changing inline_edit_active to inline_edit_anchor
-                $this_hide.removeClass("inline_edit_active").addClass("inline_edit_anchor");
+            var $this_span = $this_hide.find('span');
+            $this_span.find('a, br').remove();
+            $this_span.append($data_a.clone());
 
-                // removing marked and hover classes.
-                $this_row.parent('tbody').find('tr').find("td:eq(" + pos + ")").removeClass("marked hover");
+            $this_hide.removeClass("inline_edit_active hover").addClass("inline_edit_anchor");
+            $this_hide.parent().removeClass("hover noclick");
+            $this_hide.siblings().removeClass("hover");
 
-                for( var i = 0; i <= rows + 2; i++){
-                    if( $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").hasClass("inline_edit") == false) {
-                        continue;
-                    }
-                    $this_row_siblings = $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")");
-                    txt = $this_row_siblings.data('original_data');
-                    $this_row_siblings.children('span').empty();
-                    $this_row_siblings.children('span').append(txt);
+            var $input_siblings = $this_hide.parent('tr').find('.inline_edit');
+            var txt = '';
+            $input_siblings.each(function() {
+                var $this_hide_siblings = $(this);
+                txt = $this_hide_siblings.data('original_data');
+                if($this_hide_siblings.children('span').children().length != 0) {
+                    $this_hide_siblings.children('span').empty();
+                    $this_hide_siblings.children('span').append(txt);
                 }
-                $(this).prev().remove();
-                $(this).prev().remove();
-                $(this).remove();
-                
-                // refresh the grid
-                $("#sqlqueryresults").trigger('refreshgrid');
             });
-        }
+            $(this).prev().prev().remove();
+            $(this).prev().remove();
+            $(this).remove();
+            
+            // refresh the grid
+            $("#sqlqueryresults").trigger('refreshgrid');
+        });
 
         // Initialize some variables
-        if(disp_mode == 'vertical') {
-            /**
-             * @var this_row_index  Index of the current <td> in the parent <tr>
-             *                      Current <td> is the inline edit anchor.
-             */
-            var this_row_index = $edit_td.index();
-            /**
-             * @var $input_siblings  Object referring to all inline editable events from same row
-             */
-            var $input_siblings = $edit_td.parents('tbody').find('tr').find('.inline_edit:nth('+this_row_index+')');
-            /**
-             * @var where_clause    String containing the WHERE clause to select this row
-             */
-            var where_clause = $edit_td.parents('tbody').find('tr').find('.where_clause:nth('+this_row_index+')').val();
-        }
-        // horizontal mode
-        else {
-            var this_row_index = $edit_td.parent().index();
-            var $input_siblings = $edit_td.parent('tr').find('.inline_edit');
-            var where_clause = $edit_td.parent('tr').find('.where_clause').val();
-        }
+        var this_row_index = $edit_td.parent().index();
+        var $input_siblings = $edit_td.parent('tr').find('.inline_edit');
+        var where_clause = $edit_td.parent('tr').find('.where_clause').val();
 
         $input_siblings.each(function() {
             /** @lends jQuery */
@@ -648,7 +525,7 @@ $(document).ready(function() {
              * @var field_name  String containing the name of this field.
              * @see getFieldName()
              */
-            var field_name = getFieldName($this_field, disp_mode);
+            var field_name = getFieldName($this_field);
             /**
              * @var relation_curr_value String current value of the field (for fields that are foreign keyed).
              */
@@ -859,24 +736,8 @@ $(document).ready(function() {
         var $test_element = ''; // to test the presence of a element
 
         // Initialize variables
-        if(disp_mode == 'vertical') {
-            /**
-             * @var this_td_index  Index of the current <td> in the parent <tr>
-             *                      Current <td> is the inline edit anchor.
-             */
-            var this_td_index = $this_td.index();
-            /**
-             * @var $input_siblings  Object referring to all inline editable events from same row
-             */
-            var $input_siblings = $this_td.parents('tbody').find('tr').find('.inline_edit:nth('+this_td_index+')');
-            /**
-             * @var where_clause    String containing the WHERE clause to select this row
-             */
-            var where_clause = $this_td.parents('tbody').find('tr').find('.where_clause:nth('+this_td_index+')').val();
-        } else {
-            var $input_siblings = $this_td.parent('tr').find('.inline_edit');
-            var where_clause = $this_td.parent('tr').find('.where_clause').val();
-        }
+        var $input_siblings = $this_td.parent('tr').find('.inline_edit');
+        var where_clause = $this_td.parent('tr').find('.where_clause').val();
 
         /**
          * @var nonunique   Boolean, whether this row is unique or not
@@ -927,7 +788,7 @@ $(document).ready(function() {
              * @var field_name  String containing the name of this field.
              * @see getFieldName()
              */
-            var field_name = getFieldName($this_field, disp_mode);
+            var field_name = getFieldName($this_field);
 
             /**
              * @var this_field_params   Array temporary storage for the name/value of current field
@@ -1027,7 +888,6 @@ $(document).ready(function() {
              */
             var post_params = {'ajax_request' : true,
                             'sql_query' : sql_query,
-                            'disp_direction' : disp_mode,
                             'token' : window.parent.token,
                             'db' : window.parent.db,
                             'table' : window.parent.table,
@@ -1044,19 +904,14 @@ $(document).ready(function() {
             $.post('tbl_replace.php', post_params, function(data) {
                 if(data.success == true) {
                     PMA_ajaxShowMessage(data.message);
-                    if(disp_mode == 'vertical') {
-                        $this_td.parents('tbody').find('tr').find('.where_clause:nth(' + this_td_index + ')').attr('value', new_clause);
-                    }
-                    else {
-                        $this_td.parent('tr').find('.where_clause').attr('value', new_clause);
-                    }
+                    $this_td.parent('tr').find('.where_clause').attr('value', new_clause);
                     // remove possible previous feedback message
                     $('#result_query').remove();
                     if (typeof data.sql_query != 'undefined') {
                         // display feedback
                         $('#sqlqueryresults').prepend(data.sql_query);
                     }
-                    PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data, disp_mode);
+                    PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data);
                 } else {
                     PMA_ajaxShowMessage(data.error);
                 };
@@ -1064,7 +919,7 @@ $(document).ready(function() {
         } else {
             // no posting was done but still need to display the row
             // in its previous format
-            PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, '', disp_mode);
+            PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, '');
         }
     }) // End After editing, clicking again should post data
 
@@ -1229,7 +1084,7 @@ $(document).ready(function() {
  * (when called in the situation where no posting was done, the data
  * parameter is empty)
  */
-function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data, disp_mode) {
+function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, data) {
 
     // deleting the hide button. remove <br><br><a> tags
     $del_hide.find('a, br').remove();
@@ -1241,11 +1096,7 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
 
     // removing hover, marked and noclick classes
     $this_td.parent('tr').removeClass('noclick');
-    if(disp_mode != 'vertical') {
-        $this_td.parent('tr').removeClass('hover').find('td').removeClass('hover');
-    } else {
-        $this_td.parents('tbody').find('tr').find('td:eq(' + $this_td.index() + ')').removeClass('marked hover');
-    }
+    $this_td.parent('tr').removeClass('hover').find('td').removeClass('hover');
 
     $input_siblings.each(function() {
         // Inline edit post has been successful.
@@ -1265,7 +1116,7 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
                 var new_html = $this_sibling.find('textarea').val();
 
                 if($this_sibling.is('.transformed')) {
-                    var field_name = getFieldName($this_sibling, disp_mode);
+                    var field_name = getFieldName($this_sibling);
                     if (typeof data.transformations != 'undefined') {
                         $.each(data.transformations, function(key, value) {
                             if(key == field_name) {
@@ -1294,7 +1145,7 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
                 }
 
                 if($this_sibling.is('.relation')) {
-                    var field_name = getFieldName($this_sibling, disp_mode);
+                    var field_name = getFieldName($this_sibling);
                     if (typeof data.relations != 'undefined') {
                         $.each(data.relations, function(key, value) {
                             if(key == field_name) {
diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php
index c18e003..5445d88 100644
--- a/themes/original/css/theme_right.css.php
+++ b/themes/original/css/theme_right.css.php
@@ -2163,15 +2163,6 @@ span.mysql-number {
     width: 10px;
 }
 
-.cPointerVer {  /* cPointer with vertical display mode */
-    background: url(<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>col_pointer_ver.png);
-    height: 10px;
-    margin-left: -5px;
-    margin-top: -5px;   /* must be minus half of its height */
-    position: absolute;
-    width: 20px;
-}
-
 .dHint {
     background: #333;
     border:1px solid #000;
@@ -2233,15 +2224,16 @@ span.mysql-number {
     position: absolute;
 }
 
-.cList table {
+.cList .lDiv div {
+    padding: 0.2em 0.5em 0.2em 0.2em;
 }
 
-.cList table tr:hover {
+.cList .lDiv div:hover {
     background: #DDD;
     cursor: pointer;
 }
 
-.cList table td input {
+.cList .lDiv div input {
     cursor: pointer;
 }
 
diff --git a/themes/original/img/col_pointer_ver.png b/themes/original/img/col_pointer_ver.png
deleted file mode 100644
index 4607912..0000000
Binary files a/themes/original/img/col_pointer_ver.png and /dev/null differ
diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php
index f6d523c..a224e14 100644
--- a/themes/pmahomme/css/theme_right.css.php
+++ b/themes/pmahomme/css/theme_right.css.php
@@ -2534,15 +2534,6 @@ span.mysql-number {
     width: 10px;
 }
 
-.cPointerVer {  /* cPointer with vertical display mode */
-    background: url(./themes/pmahomme/img/col_pointer_ver.png);
-    height: 10px;
-    margin-left: -5px;
-    margin-top: -5px;   /* must be minus half of its height */
-    position: absolute;
-    width: 20px;
-}
-
 .dHint {
     background: #333;
     border:1px solid #000;
@@ -2603,15 +2594,16 @@ span.mysql-number {
     box-shadow: 0 0.2em 0.5em #333;
 }
 
-.cList table {
+.cList .lDiv div {
+    padding: 0.2em 0.5em 0.2em 0.2em;
 }
 
-.cList table tr:hover {
+.cList .lDiv div:hover {
     background: #DDD;
     cursor: pointer;
 }
 
-.cList table td input {
+.cList .lDiv div input {
     cursor: pointer;
 }
 
diff --git a/themes/pmahomme/img/col_pointer_ver.png b/themes/pmahomme/img/col_pointer_ver.png
deleted file mode 100644
index 8964754..0000000
Binary files a/themes/pmahomme/img/col_pointer_ver.png and /dev/null differ


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list