Merge branch 'colresize' into aris
This commit is contained in:
commit
467e6beaf7
114
js/makegrid.js
114
js/makegrid.js
@ -8,9 +8,14 @@
|
||||
// variables, assigned with default value, changed later
|
||||
alignment: 'horizontal', // 3 possibilities: vertical, horizontal, horizontalflipped
|
||||
actionSpan: 5,
|
||||
colOrder: new Array(),
|
||||
tableCreateTime: null,
|
||||
hintShown: false,
|
||||
colOrder: new Array(), // array of column order
|
||||
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
|
||||
showReorderHint: false, // boolean, used by showHint() method
|
||||
showSortHint: false, // boolean, used by showHint() method
|
||||
hintIsHiding: false, // true when hint is still shown, but hide() already called
|
||||
|
||||
// functions
|
||||
dragStartRsz: function(e, obj) { // start column resize
|
||||
@ -67,7 +72,7 @@
|
||||
objLeft: objPos.left
|
||||
};
|
||||
$('body').css('cursor', 'move');
|
||||
this.hideDraggableHint();
|
||||
this.hideHint();
|
||||
$('body').noSelect();
|
||||
},
|
||||
|
||||
@ -159,7 +164,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();
|
||||
}
|
||||
|
||||
@ -289,8 +296,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();
|
||||
},
|
||||
|
||||
@ -331,41 +340,62 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* Show draggable hint.
|
||||
* Show hint with the text supplied.
|
||||
*/
|
||||
showDraggableHint: function(e) {
|
||||
if (!this.colMov) { // if not dragging
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.css({
|
||||
top: e.pageY - 10,
|
||||
left: e.pageX + 15
|
||||
})
|
||||
.show('fast');
|
||||
this.hintShown = true;
|
||||
showHint: function(e) {
|
||||
if (!this.colRsz && !this.colMov) { // if not resizing or dragging
|
||||
var text = '';
|
||||
if (this.showReorderHint) {
|
||||
text += this.reorderHint;
|
||||
}
|
||||
if (this.showSortHint) {
|
||||
text += this.showReorderHint ? '<br />' : '';
|
||||
text += this.sortHint;
|
||||
}
|
||||
|
||||
// hide the hint if no text
|
||||
if (!text) {
|
||||
this.hideHint();
|
||||
return;
|
||||
}
|
||||
|
||||
$(this.dHint).html(text);
|
||||
if (!this.hintShown || this.hintIsHiding) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.css({
|
||||
top: e.pageY,
|
||||
left: e.pageX + 15
|
||||
})
|
||||
.show('fast');
|
||||
this.hintShown = true;
|
||||
this.hintIsHiding = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide draggable hint.
|
||||
* Hide the hint.
|
||||
*/
|
||||
hideDraggableHint: function() {
|
||||
hideHint: function() {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.hide(150, function() {
|
||||
.hide(300, function() {
|
||||
g.hintShown = false;
|
||||
g.hintIsHiding = false;
|
||||
});
|
||||
this.hintIsHiding = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the draggable hint position.
|
||||
* Update hint position.
|
||||
*/
|
||||
updateDraggableHint: function(e) {
|
||||
updateHint: function(e) {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint).css({
|
||||
top: e.pageY - 10,
|
||||
top: e.pageY,
|
||||
left: e.pageX + 15
|
||||
});
|
||||
}
|
||||
@ -391,7 +421,6 @@
|
||||
|
||||
// adjust g.dHint
|
||||
g.dHint.className = 'dHint';
|
||||
$(g.dHint).html($('#col_order_hint').val());
|
||||
$(g.dHint).hide();
|
||||
|
||||
// chain table and grid together
|
||||
@ -413,8 +442,16 @@
|
||||
}
|
||||
|
||||
// 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
|
||||
g.reorderHint = $('#col_order_hint').val();
|
||||
g.sortHint = $('#sort_hint').val();
|
||||
|
||||
// determine whether to show the column reordering hint or not
|
||||
g.showReorderHint = $firstRowCols.length > 1;
|
||||
|
||||
// initialize column order
|
||||
$col_order = $('#col_order');
|
||||
if ($col_order.length > 0) {
|
||||
@ -447,20 +484,31 @@
|
||||
.wrapInner('<span />');
|
||||
|
||||
// register events
|
||||
$(t).find('th.draggable')
|
||||
.mousedown(function(e) {
|
||||
g.dragStartMove(e, this);
|
||||
})
|
||||
// show/hide draggable column
|
||||
if ($firstRowCols.length > 1) {
|
||||
$(t).find('th.draggable')
|
||||
.mousedown(function(e) {
|
||||
g.dragStartMove(e, this);
|
||||
})
|
||||
// show/hide draggable column
|
||||
.mouseenter(function(e) {
|
||||
g.showHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.hideHint();
|
||||
});
|
||||
}
|
||||
$(t).find('th.draggable a')
|
||||
.mouseenter(function(e) {
|
||||
g.showDraggableHint(e);
|
||||
g.showSortHint = true;
|
||||
g.showHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.hideDraggableHint();
|
||||
g.showSortHint = false;
|
||||
g.showHint(e);
|
||||
});
|
||||
$(document).mousemove(function(e) {
|
||||
g.dragMove(e);
|
||||
g.updateDraggableHint(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
$(document).mouseup(function(e) {
|
||||
g.dragEnd(e);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -184,6 +184,24 @@ 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()
|
||||
{
|
||||
// global variables set from sql.php
|
||||
global $is_count, $is_export, $is_func, $is_analyze;
|
||||
global $analyzed_sql;
|
||||
|
||||
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,17 +395,21 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
<td>
|
||||
<input class="restore_column" type="submit" value="<?php echo __('Restore column order'); ?>" />
|
||||
<?php
|
||||
// generate the column order, if it is set
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if ($col_order) {
|
||||
echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
|
||||
if (PMA_isBrowsing()) {
|
||||
// generate the column order, if it is set
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if ($col_order) {
|
||||
echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
|
||||
}
|
||||
// generate table create time
|
||||
echo '<input id="table_create_time" type="hidden" value="' .
|
||||
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'CREATE_TIME') . '" />';
|
||||
}
|
||||
// generate table create time
|
||||
echo '<input id="table_create_time" type="hidden" value="' .
|
||||
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'CREATE_TIME') . '" />';
|
||||
// generate text for draggable column hint
|
||||
echo '<input id="col_order_hint" type="hidden" value="' . __('Drag to reorder') . '" />';
|
||||
// generate text for sortable column hint
|
||||
echo '<input id="sort_hint" type="hidden" value="' . __('Click to sort') . '" />';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -751,9 +773,13 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
}
|
||||
}
|
||||
|
||||
// prepare to get the column order, if there is
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if (PMA_isBrowsing()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
// assign $i with appropriate column order
|
||||
@ -884,7 +910,6 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
&& $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
|
||||
$order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
|
||||
}
|
||||
$order_link_params['title'] = __('Sort');
|
||||
$order_link_content = ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name));
|
||||
$order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true);
|
||||
|
||||
@ -1314,9 +1339,13 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
|
||||
// 2. Displays the rows' values
|
||||
|
||||
// prepare to get the column order, if there is
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if (PMA_isBrowsing()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; ++$j) {
|
||||
// assign $i with appropriate column order
|
||||
@ -1688,9 +1717,13 @@ function PMA_displayVerticalTable()
|
||||
echo '</tr>' . "\n";
|
||||
} // end if
|
||||
|
||||
// prepare to get the column order, if there is
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if (PMA_isBrowsing()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
// Displays data
|
||||
foreach ($vertical_display['desc'] AS $j => $val) {
|
||||
|
||||
3
sql.php
3
sql.php
@ -153,6 +153,9 @@ if(isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
|
||||
PMA_ajaxResponse(NULL, true, $extra_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check ajax request to set the column order
|
||||
*/
|
||||
if(isset($_REQUEST['set_col_order']) && $_REQUEST['set_col_order'] == true) {
|
||||
$pmatable = new PMA_Table($table, $db);
|
||||
$retval = $pmatable->setUiProp(PMA_Table::PROP_COLUMN_ORDER, $_REQUEST['col_order'], $_REQUEST['table_create_time']);
|
||||
|
||||
@ -1915,15 +1915,14 @@ span.mysql-number {
|
||||
background: #333;
|
||||
border:1px solid #000;
|
||||
color: #FFF;
|
||||
font-size: 8pt;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
height: 14px;
|
||||
margin-top: -1em;
|
||||
opacity: 0.8;
|
||||
overflow: hidden;
|
||||
padding: 5px 10px;
|
||||
padding: 0.5em 1em;
|
||||
position: absolute;
|
||||
text-shadow: -1px -1px #000;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 0.3em;
|
||||
-webkit-border-radius: 0.3em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
@ -2237,12 +2237,12 @@ span.mysql-number {
|
||||
position: absolute;
|
||||
text-shadow: -1px -1px #000;
|
||||
|
||||
-moz-box-shadow: 0 0 8px #000;
|
||||
-webkit-box-shadow: 0 0 8px #000;
|
||||
box-shadow: 0 0 8px #000;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0 0 0.7em #000;
|
||||
-webkit-box-shadow: 0 0 0.7em #000;
|
||||
box-shadow: 0 0 0.7em #000;
|
||||
-moz-border-radius: 0.3em;
|
||||
-webkit-border-radius: 0.3em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
.cPointer {
|
||||
@ -2267,15 +2267,14 @@ span.mysql-number {
|
||||
background: #333;
|
||||
border:1px solid #000;
|
||||
color: #FFF;
|
||||
font-size: 8pt;
|
||||
font-size: 0.8em;
|
||||
font-weight: bold;
|
||||
height: 14px;
|
||||
margin-top: -1em;
|
||||
opacity: 0.8;
|
||||
overflow: hidden;
|
||||
padding: 5px 10px;
|
||||
padding: 0.5em 1em;
|
||||
position: absolute;
|
||||
text-shadow: -1px -1px #000;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 0.3em;
|
||||
-webkit-border-radius: 0.3em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user