diff --git a/js/makegrid.js b/js/makegrid.js index 82fe8684b6..bb998957da 100644 --- a/js/makegrid.js +++ b/js/makegrid.js @@ -9,7 +9,7 @@ alignment: 'horizontal', // 3 possibilities: vertical, horizontal, horizontalflipped actionSpan: 5, colOrder: new Array(), // array of column order - tableCreateTime: null, // table creation time + tableCreateTime: null, // table creation time, only available in "Browse tab" hintShown: false, // true if hint balloon is shown, used by updateHint() method reorderHint: '', // string, hint for column reordering sortHint: '', // string, hint for column sorting @@ -163,7 +163,9 @@ this.colMov.objLeft = objPos.left; this.colMov.n = this.colMov.newn; // send request to server to remember the column order - this.sendColOrder(); + if (this.tableCreateTime) { + this.sendColOrder(); + } this.refreshRestoreButton(); } @@ -293,8 +295,10 @@ this.shiftCol(i, j + 1); } } - // send request to server to remember the column order - this.sendColOrder(); + if (this.tableCreateTime) { + // send request to server to remember the column order + this.sendColOrder(); + } this.refreshRestoreButton(); }, @@ -427,6 +431,7 @@ } // assign table create time + // #table_create_time will only available if we are in "Browse" tab g.tableCreateTime = $('#table_create_time').val(); // assign column reorder & column sort hint diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 712fa448c9..ae76194dd3 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1375,12 +1375,14 @@ class PMA_Table if ($property == self::PROP_COLUMN_ORDER) { $curr_create_time = self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME'); if (isset($table_create_time) && - $table_create_time < $curr_create_time) { + $table_create_time > $curr_create_time) { + $this->uiprefs['CREATE_TIME'] = $curr_create_time; + } else { + // there is no $table_create_time, or // supplied $table_create_time is older than current create time, // so don't save return false; } - $this->uiprefs['CREATE_TIME'] = $curr_create_time; } // save the value $this->uiprefs[$property] = $value; diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index aea4e4b7ba..d2fb33b724 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -184,6 +184,20 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total) } // end of the 'PMA_setDisplayMode()' function +/** + * Return true if we are currently browsing a table from the browse tab + * + * @return boolean + */ +function PMA_isBrowsing() +{ + return basename($GLOBALS['PMA_PHP_SELF']) == 'sql.php' + && ! ($is_count || $is_export || $is_func || $is_analyse) + && isset($analyzed_sql[0]['queryflags']['select_from']) + && count($analyzed_sql[0]['table_ref']) == 1; +} + + /** * Displays a navigation button * @@ -377,15 +391,17 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di