Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
51fe1fa951
272
js/makegrid.js
272
js/makegrid.js
@ -19,22 +19,22 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* Constant
|
||||
***********/
|
||||
minColWidth: 15,
|
||||
|
||||
|
||||
|
||||
|
||||
/***********
|
||||
* Variables, assigned with default value, changed later
|
||||
***********/
|
||||
actionSpan: 5, // number of colspan in Actions header in a table
|
||||
tableCreateTime: null, // table creation time, used for saving column order and visibility to server, only available in "Browse tab"
|
||||
|
||||
|
||||
// Column reordering variables
|
||||
colOrder: new Array(), // array of column order
|
||||
|
||||
|
||||
// Column visibility variables
|
||||
colVisib: new Array(), // array of column visibility
|
||||
showAllColText: '', // string, text for "show all" button under column visibility list
|
||||
visibleHeadersCount: 0, // number of visible data headers
|
||||
|
||||
|
||||
// Table hint variables
|
||||
qtip: null, // qtip API
|
||||
reorderHint: '', // string, hint for column reordering
|
||||
@ -45,7 +45,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
showSortHint: false,
|
||||
showMarkHint: false,
|
||||
showColVisibHint: false,
|
||||
|
||||
|
||||
// Grid editing
|
||||
isCellEditActive: false, // true if current focus is in edit cell
|
||||
isEditCellTextEditable: false, // true if current edit cell is editable in the text input box (not textarea)
|
||||
@ -60,14 +60,14 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
lastXHR : null, // last XHR object used in AJAX request
|
||||
isSaving: false, // true when currently saving edited data, used to handle double posting caused by pressing ENTER in grid edit text box in Chrome browser
|
||||
alertNonUnique: '', // string, alert shown when saving edited nonunique table
|
||||
|
||||
|
||||
// Common hidden inputs
|
||||
token: null,
|
||||
server: null,
|
||||
db: null,
|
||||
table: null,
|
||||
|
||||
|
||||
|
||||
|
||||
/************
|
||||
* Functions
|
||||
************/
|
||||
@ -93,7 +93,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.hideEditCell();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Start to reorder column. Called when clicking on table header.
|
||||
*
|
||||
@ -113,10 +113,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cPointer).css({
|
||||
top: objPos.top
|
||||
});
|
||||
|
||||
|
||||
// get the column index, zero-based
|
||||
var n = g.getHeaderIdx(obj);
|
||||
|
||||
|
||||
g.colReorder = {
|
||||
x0: e.pageX,
|
||||
y0: e.pageY,
|
||||
@ -133,7 +133,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.hideEditCell();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Handle mousemove event when dragging.
|
||||
*
|
||||
@ -151,7 +151,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cCpy)
|
||||
.css('left', g.colReorder.objLeft + dx)
|
||||
.show();
|
||||
|
||||
|
||||
// pointer animation
|
||||
var hoveredCol = g.getHoveredCol(e);
|
||||
if (hoveredCol) {
|
||||
@ -175,7 +175,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Stop the dragging action.
|
||||
*
|
||||
@ -191,7 +191,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var n = g.colRsz.n;
|
||||
// do the resizing
|
||||
g.resize(n, nw);
|
||||
|
||||
|
||||
g.reposRsz();
|
||||
g.reposDrop();
|
||||
g.colRsz = false;
|
||||
@ -210,7 +210,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
g.refreshRestoreButton();
|
||||
}
|
||||
|
||||
|
||||
// animate new column position
|
||||
$(g.cCpy).stop(true, true)
|
||||
.animate({
|
||||
@ -225,7 +225,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$('body').css('cursor', 'inherit');
|
||||
$('body').noSelect(false);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Resize column n to new width "nw"
|
||||
*
|
||||
@ -239,7 +239,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.css('width', nw);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Reposition column resize bars.
|
||||
*/
|
||||
@ -254,7 +254,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
$(g.cRsz).css('height', $(g.t).height());
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Shift column from index oldn to newn.
|
||||
*
|
||||
@ -277,7 +277,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
// reposition the column resize bars
|
||||
g.reposRsz();
|
||||
|
||||
|
||||
// adjust the column visibility list
|
||||
if (newn < oldn) {
|
||||
$(g.cList).find('.lDiv div:eq(' + newn + ')')
|
||||
@ -297,7 +297,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.colVisib.splice(newn, 0, tmp);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Find currently hovered table column's header (excluding actions column).
|
||||
*
|
||||
@ -316,7 +316,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
return hoveredCol;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get a zero-based index from a <th class="draggable"> tag in a table.
|
||||
*
|
||||
@ -326,7 +326,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
getHeaderIdx: function(obj) {
|
||||
return $(obj).parents('tr').find('th.draggable').index(obj);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Reposition the columns back to normal order.
|
||||
*/
|
||||
@ -348,7 +348,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
g.refreshRestoreButton();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Send column preferences (column order and visibility) to the server.
|
||||
*/
|
||||
@ -379,7 +379,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Refresh restore button state.
|
||||
* Make restore button disabled if the table is similar with initial state.
|
||||
@ -402,7 +402,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$('.restore_column').show();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Update current hint using the boolean values (showReorderHint, showSortHint, etc.).
|
||||
* It will hide the hint if all the boolean values is false.
|
||||
@ -429,23 +429,23 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
text += text.length > 0 ? '<br />' : '';
|
||||
text += g.colVisibHint;
|
||||
}
|
||||
|
||||
|
||||
// hide the hint if no text and the event is mouseenter
|
||||
g.qtip.disable(!text && e.type == 'mouseenter');
|
||||
|
||||
|
||||
g.qtip.updateContent(text, false);
|
||||
} else {
|
||||
g.hideHint();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
hideHint: function() {
|
||||
if (g.qtip) {
|
||||
g.qtip.hide();
|
||||
g.qtip.disable(true);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Toggle column's visibility.
|
||||
* After calling this function and it returns true, afterToggleCol() must be called.
|
||||
@ -479,7 +479,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This must be called if toggleCol() returns is true.
|
||||
*
|
||||
@ -491,12 +491,12 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.reposRsz();
|
||||
g.reposDrop();
|
||||
g.sendColPrefs();
|
||||
|
||||
|
||||
// check visible first row headers count
|
||||
g.visibleHeadersCount = $(g.t).find('tr:first th.draggable:visible').length;
|
||||
g.refreshRestoreButton();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Show columns' visibility list.
|
||||
*
|
||||
@ -518,7 +518,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(obj).addClass('coldrop-hover');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Hide columns' visibility list.
|
||||
*/
|
||||
@ -526,7 +526,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cList).hide();
|
||||
$(g.cDrop).find('.coldrop-hover').removeClass('coldrop-hover');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Reposition the column visibility drop-down arrow.
|
||||
*/
|
||||
@ -541,7 +541,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Show all hidden columns.
|
||||
*/
|
||||
@ -553,7 +553,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
g.afterToggleCol();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Show edit cell, if it can be shown
|
||||
*
|
||||
@ -570,7 +570,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// reposition the cEdit element
|
||||
$(g.cEdit).css({
|
||||
top: $cell.position().top,
|
||||
left: $cell.position().left,
|
||||
left: $cell.position().left
|
||||
})
|
||||
.show()
|
||||
.find('input')
|
||||
@ -582,7 +582,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var value = $cell.is(':not(.null)') ? PMA_getCellValue(cell) : '';
|
||||
$(g.cEdit).find('input')
|
||||
.val(value);
|
||||
|
||||
|
||||
g.currentEditCell = cell;
|
||||
$(g.cEdit).find('input[type=text]').focus();
|
||||
$(g.cEdit).find('*').removeAttr('disabled');
|
||||
@ -593,7 +593,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Remove edit cell and the edit area, if it is shown.
|
||||
*
|
||||
@ -609,13 +609,13 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.saveOrPostEditedCell();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// cancel any previous request
|
||||
if (g.lastXHR != null) {
|
||||
g.lastXHR.abort();
|
||||
g.lastXHR = null;
|
||||
}
|
||||
|
||||
|
||||
if (data) {
|
||||
if (g.currentEditCell) { // save value of currently edited cell
|
||||
// replace current edited field with the new value
|
||||
@ -649,19 +649,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$this_field.find('span').html(value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// refresh the grid
|
||||
g.reposRsz();
|
||||
g.reposDrop();
|
||||
}
|
||||
|
||||
|
||||
// hide the cell editing area
|
||||
$(g.cEdit).hide();
|
||||
$(g.cEdit).find('input[type=text]').blur();
|
||||
g.isCellEditActive = false;
|
||||
g.currentEditCell = null;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Show drop-down edit area when edit cell is focused.
|
||||
*/
|
||||
@ -690,10 +690,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* @var curr_value String current value of the field (for fields that are of type enum or set).
|
||||
*/
|
||||
var curr_value = $td.find('span').text();
|
||||
|
||||
|
||||
// empty all edit area, then rebuild it based on $td classes
|
||||
$editArea.empty();
|
||||
|
||||
|
||||
// add goto link, if this cell contains a link
|
||||
if ($td.find('a').length > 0) {
|
||||
var gotoLink = document.createElement('div');
|
||||
@ -702,7 +702,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.append($td.find('a').clone());
|
||||
$editArea.append(gotoLink);
|
||||
}
|
||||
|
||||
|
||||
g.wasEditedCellNull = false;
|
||||
if ($td.is(':not(.not_null)')) {
|
||||
// append a null checkbox
|
||||
@ -713,7 +713,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$checkbox.attr('checked', true);
|
||||
g.wasEditedCellNull = true;
|
||||
}
|
||||
|
||||
|
||||
// if the select/editor is changed un-check the 'checkbox_null_<field_name>_<row_index>'.
|
||||
if ($td.is('.enum, .set')) {
|
||||
$editArea.find('select').live('change', function(e) {
|
||||
@ -734,7 +734,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$checkbox.attr('checked', false);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// if 'checkbox_null_<field_name>_<row_index>' is clicked empty the corresponding select/editor.
|
||||
$checkbox.click(function(e) {
|
||||
if ($td.is('.enum')) {
|
||||
@ -755,7 +755,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cEdit).find('input[type=text]').val('');
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if($td.is('.relation')) {
|
||||
/** @lends jQuery */
|
||||
//handle relations
|
||||
@ -763,7 +763,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
|
||||
// initialize the original data
|
||||
$td.data('original_data', null);
|
||||
|
||||
|
||||
/**
|
||||
* @var post_params Object containing parameters for the POST request
|
||||
*/
|
||||
@ -787,11 +787,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$td.data('original_data', value);
|
||||
// update the text input field, in case where the "Relational display column" is checked
|
||||
$(g.cEdit).find('input[type=text]').val(value);
|
||||
|
||||
|
||||
$editArea.append(data.dropdown);
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
}) // end $.post()
|
||||
|
||||
|
||||
$editArea.find('select').live('change', function(e) {
|
||||
$(g.cEdit).find('input[type=text]').val($(this).val());
|
||||
})
|
||||
@ -820,7 +820,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.append(data.dropdown);
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
}) // end $.post()
|
||||
|
||||
|
||||
$editArea.find('select').live('change', function(e) {
|
||||
$(g.cEdit).find('input[type=text]').val($(this).val());
|
||||
})
|
||||
@ -850,7 +850,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.append(data.select);
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
}) // end $.post()
|
||||
|
||||
|
||||
$editArea.find('select').live('change', function(e) {
|
||||
$(g.cEdit).find('input[type=text]').val($(this).val());
|
||||
})
|
||||
@ -879,7 +879,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* @var sql_query String containing the SQL query used to retrieve value of truncated/transformed data
|
||||
*/
|
||||
var sql_query = 'SELECT `' + field_name + '` FROM `' + g.table + '` WHERE ' + PMA_urldecode(where_clause);
|
||||
|
||||
|
||||
// Make the Ajax call and get the data, wrap it and insert it
|
||||
g.lastXHR = $.post('sql.php', {
|
||||
'token' : g.token,
|
||||
@ -896,7 +896,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// get the truncated data length
|
||||
g.maxTruncatedLen = $(g.currentEditCell).text().length - 3;
|
||||
}
|
||||
|
||||
|
||||
$td.data('original_data', data.value);
|
||||
$(g.cEdit).find('input[type=text]').val(data.value);
|
||||
$editArea.append('<textarea>'+data.value+'</textarea>');
|
||||
@ -925,11 +925,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$editArea.append('<div class="cell_edit_hint">' + g.cellEditHint + '</div>');
|
||||
g.isEditCellTextEditable = true;
|
||||
}
|
||||
|
||||
|
||||
$editArea.show();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Post the content of edited cell.
|
||||
*/
|
||||
@ -938,7 +938,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
return;
|
||||
}
|
||||
g.isSaving = true;
|
||||
|
||||
|
||||
/**
|
||||
* @var relation_fields Array containing the name/value pairs of relational fields
|
||||
*/
|
||||
@ -981,19 +981,19 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var me_fields_name = Array();
|
||||
var me_fields = Array();
|
||||
var me_fields_null = Array();
|
||||
|
||||
|
||||
// alert user if edited table is not unique
|
||||
if (!is_unique) {
|
||||
alert(g.alertNonUnique);
|
||||
}
|
||||
|
||||
|
||||
// loop each edited row
|
||||
$('.to_be_saved').parents('tr').each(function() {
|
||||
var $tr = $(this);
|
||||
var where_clause = $tr.find('.where_clause').val();
|
||||
full_where_clause.push(PMA_urldecode(where_clause));
|
||||
var condition_array = jQuery.parseJSON($tr.find('.condition_array').val());
|
||||
|
||||
|
||||
/**
|
||||
* multi edit variables, for current row
|
||||
* @TODO array indices are still not correct, they should be md5 of field's name
|
||||
@ -1008,7 +1008,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
* @var $this_field Object referring to the td that is being edited
|
||||
*/
|
||||
var $this_field = $(this);
|
||||
|
||||
|
||||
/**
|
||||
* @var field_name String containing the name of this field.
|
||||
* @see getFieldName()
|
||||
@ -1024,21 +1024,21 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
transformation_fields = true;
|
||||
}
|
||||
this_field_params[field_name] = $this_field.data('value');
|
||||
|
||||
|
||||
/**
|
||||
* @var is_null String capturing whether 'checkbox_null_<field_name>_<row_index>' is checked.
|
||||
*/
|
||||
var is_null = this_field_params[field_name] === null;
|
||||
|
||||
|
||||
fields_name.push(field_name);
|
||||
|
||||
|
||||
if (is_null) {
|
||||
fields_null.push('on');
|
||||
fields.push('');
|
||||
} else {
|
||||
fields_null.push('');
|
||||
fields.push($this_field.data('value'));
|
||||
|
||||
|
||||
var cell_index = $this_field.index('.to_be_saved');
|
||||
if($this_field.is(":not(.relation, .enum, .set, .bit)")) {
|
||||
if($this_field.is('.transformed')) {
|
||||
@ -1060,9 +1060,9 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}); // end of loop for every edited cells in a row
|
||||
|
||||
|
||||
// save new_clause
|
||||
var new_clause = '';
|
||||
for (var field in condition_array) {
|
||||
@ -1073,16 +1073,16 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$tr.data('new_clause', new_clause);
|
||||
// save condition_array
|
||||
$tr.find('.condition_array').val(JSON.stringify(condition_array));
|
||||
|
||||
|
||||
me_fields_name.push(fields_name);
|
||||
me_fields.push(fields);
|
||||
me_fields_null.push(fields_null);
|
||||
|
||||
|
||||
}); // end of loop for every edited rows
|
||||
|
||||
|
||||
rel_fields_list = $.param(relation_fields);
|
||||
transform_fields_list = $.param(transform_fields);
|
||||
|
||||
|
||||
// Make the Ajax post after setting all parameters
|
||||
/**
|
||||
* @var post_params Object containing parameters for the POST request
|
||||
@ -1105,7 +1105,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
'goto' : 'sql.php',
|
||||
'submit_type' : 'save'
|
||||
};
|
||||
|
||||
|
||||
if (!g.saveCellsAtOnce) {
|
||||
$(g.cEdit).find('*').attr('disabled', 'disabled');
|
||||
var $editArea = $(g.cEdit).find('.edit_area');
|
||||
@ -1114,7 +1114,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$('.save_edited').addClass('saving_edited_data')
|
||||
.find('input').attr('disabled', 'disabled'); // disable the save button
|
||||
}
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'tbl_replace.php',
|
||||
@ -1138,7 +1138,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var old_clause = $where_clause.attr('value');
|
||||
var decoded_old_clause = PMA_urldecode(old_clause);
|
||||
var decoded_new_clause = PMA_urldecode(new_clause);
|
||||
|
||||
|
||||
$where_clause.attr('value', new_clause);
|
||||
// update Edit, Copy, and Delete links also
|
||||
$(this).parent('tr').find('a').each(function() {
|
||||
@ -1158,7 +1158,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
var $checkbox = $(this);
|
||||
var checkbox_name = $checkbox.attr('name');
|
||||
var checkbox_value = $checkbox.attr('value');
|
||||
|
||||
|
||||
$checkbox.attr('name', checkbox_name.replace(old_clause, new_clause));
|
||||
$checkbox.attr('value', checkbox_value.replace(decoded_old_clause, decoded_new_clause));
|
||||
});
|
||||
@ -1171,7 +1171,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$('#sqlqueryresults').prepend(data.sql_query);
|
||||
}
|
||||
g.hideEditCell(true, data);
|
||||
|
||||
|
||||
// remove the "Save edited cells" button
|
||||
$('.save_edited').hide();
|
||||
// update saved fields
|
||||
@ -1179,7 +1179,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.removeClass('to_be_saved')
|
||||
.data('value', null)
|
||||
.data('original_data', null);
|
||||
|
||||
|
||||
g.isCellEdited = false;
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
@ -1187,7 +1187,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}) // end $.ajax()
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Save edited cell, so it can be posted later.
|
||||
*/
|
||||
@ -1251,7 +1251,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
need_to_post = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (need_to_post) {
|
||||
$(g.currentEditCell).addClass('to_be_saved')
|
||||
.data('value', this_field_params[field_name]);
|
||||
@ -1260,10 +1260,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
g.isCellEdited = true;
|
||||
}
|
||||
|
||||
|
||||
return need_to_post;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Save or post currently edited cell, depending on the "saveCellsAtOnce" configuration.
|
||||
*/
|
||||
@ -1283,7 +1283,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Initialize column resize feature.
|
||||
*/
|
||||
@ -1291,10 +1291,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
// create column resizer div
|
||||
g.cRsz = document.createElement('div');
|
||||
g.cRsz.className = 'cRsz';
|
||||
|
||||
|
||||
// get data columns in the first row of the table
|
||||
var $firstRowCols = $(g.t).find('tr:first th.draggable');
|
||||
|
||||
|
||||
// create column borders
|
||||
$firstRowCols.each(function() {
|
||||
var cb = document.createElement('div'); // column border
|
||||
@ -1305,32 +1305,32 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$(g.cRsz).append(cb);
|
||||
});
|
||||
g.reposRsz();
|
||||
|
||||
|
||||
// attach to global div
|
||||
$(g.gDiv).prepend(g.cRsz);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Initialize column reordering feature.
|
||||
*/
|
||||
initColReorder: function() {
|
||||
g.cCpy = document.createElement('div'); // column copy, to store copy of dragged column header
|
||||
g.cPointer = document.createElement('div'); // column pointer, used when reordering column
|
||||
|
||||
|
||||
// adjust g.cCpy
|
||||
g.cCpy.className = 'cCpy';
|
||||
$(g.cCpy).hide();
|
||||
|
||||
|
||||
// adjust g.cPointer
|
||||
g.cPointer.className = 'cPointer';
|
||||
$(g.cPointer).css('visibility', 'hidden'); // set visibility to hidden instead of calling hide() to force browsers to cache the image in cPointer class
|
||||
|
||||
|
||||
// assign column reordering hint
|
||||
g.reorderHint = PMA_messages['strColOrderHint'];
|
||||
|
||||
|
||||
// get data columns in the first row of the table
|
||||
var $firstRowCols = $(g.t).find('tr:first th.draggable');
|
||||
|
||||
|
||||
// initialize column order
|
||||
$col_order = $('#col_order'); // check if column order is passed from PHP
|
||||
if ($col_order.length > 0) {
|
||||
@ -1344,7 +1344,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.colOrder.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// register events
|
||||
$(t).find('th.draggable')
|
||||
.mousedown(function(e) {
|
||||
@ -1367,41 +1367,41 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
$('.restore_column').click(function() {
|
||||
g.restoreColOrder();
|
||||
});
|
||||
|
||||
|
||||
// attach to global div
|
||||
$(g.gDiv).append(g.cPointer);
|
||||
$(g.gDiv).append(g.cCpy);
|
||||
|
||||
|
||||
// prevent default "dragstart" event when dragging a link
|
||||
$(t).find('th a').bind('dragstart', function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
// refresh the restore column button state
|
||||
g.refreshRestoreButton();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Initialize column visibility feature.
|
||||
*/
|
||||
initColVisib: function() {
|
||||
g.cDrop = document.createElement('div'); // column drop-down arrows
|
||||
g.cList = document.createElement('div'); // column visibility list
|
||||
|
||||
|
||||
// adjust g.cDrop
|
||||
g.cDrop.className = 'cDrop';
|
||||
|
||||
|
||||
// adjust g.cList
|
||||
g.cList.className = 'cList';
|
||||
$(g.cList).hide();
|
||||
|
||||
|
||||
// assign column visibility related hints
|
||||
g.colVisibHint = PMA_messages['strColVisibHint'];
|
||||
g.showAllColText = PMA_messages['strShowAllCol'];
|
||||
|
||||
|
||||
// get data columns in the first row of the table
|
||||
var $firstRowCols = $(g.t).find('tr:first th.draggable');
|
||||
|
||||
|
||||
// initialize column visibility
|
||||
$col_visib = $('#col_visib'); // check if column visibility is passed from PHP
|
||||
if ($col_visib.length > 0) {
|
||||
@ -1415,15 +1415,15 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.colVisib.push(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// get data columns in the first row of the table
|
||||
var $firstRowCols = $(t).find('tr:first th.draggable');
|
||||
|
||||
|
||||
// make sure we have more than one column
|
||||
if ($firstRowCols.length > 1) {
|
||||
var $colVisibTh = $(g.t).find('th:not(.draggable)');
|
||||
PMA_createqTip($colVisibTh);
|
||||
|
||||
|
||||
// create column visibility drop-down arrow(s)
|
||||
$colVisibTh.each(function() {
|
||||
var $th = $(this);
|
||||
@ -1445,7 +1445,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.mouseleave(function(e) {
|
||||
g.showColVisibHint = false;
|
||||
});
|
||||
|
||||
|
||||
// add column visibility control
|
||||
g.cList.innerHTML = '<div class="lDiv"></div>';
|
||||
var $listDiv = $(g.cList).find('div');
|
||||
@ -1479,41 +1479,41 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// hide column visibility list if we move outside the list
|
||||
$(t).find('td, th.draggable').mouseenter(function() {
|
||||
g.hideColList();
|
||||
});
|
||||
|
||||
|
||||
// attach to global div
|
||||
$(g.gDiv).append(g.cDrop);
|
||||
$(g.gDiv).append(g.cList);
|
||||
|
||||
|
||||
// some adjustment
|
||||
g.reposDrop();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Initialize grid editing feature.
|
||||
*/
|
||||
initGridEdit: function() {
|
||||
// create cell edit wrapper element
|
||||
g.cEdit = document.createElement('div');
|
||||
|
||||
|
||||
// adjust g.cEdit
|
||||
g.cEdit.className = 'cEdit';
|
||||
$(g.cEdit).html('<input type="text" /><div class="edit_area" />');
|
||||
$(g.cEdit).hide();
|
||||
|
||||
|
||||
// assign cell editing hint
|
||||
g.cellEditHint = PMA_messages['strCellEditHint'];
|
||||
g.saveCellWarning = PMA_messages['strSaveCellWarning'];
|
||||
g.alertNonUnique = PMA_messages['strAlertNonUnique'];
|
||||
g.gotoLinkText = PMA_messages['strGoToLink'];
|
||||
|
||||
|
||||
// initialize cell editing configuration
|
||||
g.saveCellsAtOnce = $('#save_cells_at_once').val();
|
||||
|
||||
|
||||
// register events
|
||||
$(t).find('td.data')
|
||||
.click(function(e) {
|
||||
@ -1567,60 +1567,60 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
return g.saveCellWarning;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// attach to global div
|
||||
$(g.gDiv).append(g.cEdit);
|
||||
|
||||
|
||||
// add hint for grid editing feature when hovering "Edit" link in each table row
|
||||
PMA_createqTip($(g.t).find('.edit_row_anchor a'), PMA_messages['strGridEditFeatureHint']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
* Initialize grid
|
||||
******************/
|
||||
|
||||
|
||||
// wrap all data cells, except actions cell, with span
|
||||
$(t).find('th, td:not(:has(span))')
|
||||
.wrapInner('<span />');
|
||||
|
||||
|
||||
// create grid elements
|
||||
g.gDiv = document.createElement('div'); // create global div
|
||||
|
||||
|
||||
// initialize the table variable
|
||||
g.t = t;
|
||||
|
||||
|
||||
// get data columns in the first row of the table
|
||||
var $firstRowCols = $(t).find('tr:first th.draggable');
|
||||
|
||||
|
||||
// initialize visible headers count
|
||||
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 = $(t).find('tr:first th:first').prop('colspan');
|
||||
} else {
|
||||
g.actionSpan = 0;
|
||||
}
|
||||
|
||||
|
||||
// assign table create time
|
||||
// #table_create_time will only available if we are in "Browse" tab
|
||||
g.tableCreateTime = $('#table_create_time').val();
|
||||
|
||||
|
||||
// assign the hints
|
||||
g.sortHint = PMA_messages['strSortHint'];
|
||||
g.markHint = PMA_messages['strColMarkHint'];
|
||||
|
||||
|
||||
// assign common hidden inputs
|
||||
var $common_hidden_inputs = $('.common_hidden_inputs');
|
||||
g.token = $common_hidden_inputs.find('input[name=token]').val();
|
||||
g.server = $common_hidden_inputs.find('input[name=server]').val();
|
||||
g.db = $common_hidden_inputs.find('input[name=db]').val();
|
||||
g.table = $common_hidden_inputs.find('input[name=table]').val();
|
||||
|
||||
|
||||
// add table class
|
||||
$(t).addClass('pma_table');
|
||||
|
||||
|
||||
// link the global div
|
||||
$(t).before(g.gDiv);
|
||||
$(g.gDiv).append(t);
|
||||
@ -1646,10 +1646,10 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
{
|
||||
g.initGridEdit();
|
||||
}
|
||||
|
||||
|
||||
// create qtip for each <th> with draggable class
|
||||
PMA_createqTip($(t).find('th.draggable'));
|
||||
|
||||
|
||||
// register events for hint tooltip
|
||||
$(t).find('th.draggable a')
|
||||
.attr('title', '') // hide default tooltip for sorting
|
||||
@ -1677,7 +1677,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
g.dragEnd(e);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// bind event to update currently hovered qtip API
|
||||
$(t).find('th')
|
||||
.mouseenter(function(e) {
|
||||
@ -1687,7 +1687,7 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi
|
||||
.mouseleave(function(e) {
|
||||
g.updateHint(e);
|
||||
});
|
||||
|
||||
|
||||
// some adjustment
|
||||
$(t).removeClass('data');
|
||||
$(g.gDiv).addClass('data');
|
||||
|
||||
@ -35,7 +35,7 @@ Array.min = function (array) {
|
||||
|
||||
/**
|
||||
** Checks if a string contains only numeric value
|
||||
** @param n: String (to be checked)
|
||||
** @param n: String (to be checked)
|
||||
**/
|
||||
function isNumeric(n) {
|
||||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||||
@ -43,7 +43,7 @@ function isNumeric(n) {
|
||||
|
||||
/**
|
||||
** Checks if an object is empty
|
||||
** @param n: Object (to be checked)
|
||||
** @param n: Object (to be checked)
|
||||
**/
|
||||
function isEmpty(obj) {
|
||||
var name;
|
||||
@ -59,15 +59,15 @@ function isEmpty(obj) {
|
||||
** @param type String Field type(datetime/timestamp/time/date)
|
||||
**/
|
||||
function getDate(val,type) {
|
||||
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
|
||||
}
|
||||
else if(type.toString().search(/time/i) != -1) {
|
||||
if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return Highcharts.dateFormat('%Y-%m-%e %H:%M:%S', val)
|
||||
}
|
||||
else if (type.toString().search(/time/i) != -1) {
|
||||
return Highcharts.dateFormat('%H:%M:%S', val + 19800000)
|
||||
}
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
return Highcharts.dateFormat('%Y-%m-%e', val)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,30 +76,30 @@ function getDate(val,type) {
|
||||
** @param type Sring Field type(datetime/timestamp/time/date)
|
||||
**/
|
||||
function getTimeStamp(val,type) {
|
||||
if(type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
|
||||
}
|
||||
else if(type.toString().search(/time/i) != -1) {
|
||||
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
|
||||
}
|
||||
if (type.toString().search(/datetime/i) != -1 || type.toString().search(/timestamp/i) != -1) {
|
||||
return getDateFromFormat(val,'yyyy-MM-dd HH:mm:ss', val)
|
||||
}
|
||||
else if (type.toString().search(/time/i) != -1) {
|
||||
return getDateFromFormat('1970-01-01 ' + val,'yyyy-MM-dd HH:mm:ss')
|
||||
}
|
||||
else if (type.toString().search(/date/i) != -1) {
|
||||
return getDateFromFormat(val,'yyyy-MM-dd')
|
||||
}
|
||||
return getDateFromFormat(val,'yyyy-MM-dd')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** Classifies the field type into numeric,timeseries or text
|
||||
** @param field: field type (as in database structure)
|
||||
**/
|
||||
**/
|
||||
function getType(field) {
|
||||
if(field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
|
||||
return 'numeric';
|
||||
else if(field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
|
||||
return 'time';
|
||||
else
|
||||
return 'text';
|
||||
if (field.toString().search(/int/i) != -1 || field.toString().search(/decimal/i) != -1 || field.toString().search(/year/i) != -1)
|
||||
return 'numeric';
|
||||
else if (field.toString().search(/time/i) != -1 || field.toString().search(/date/i) != -1)
|
||||
return 'time';
|
||||
else
|
||||
return 'text';
|
||||
}
|
||||
/**
|
||||
/**
|
||||
** Converts a categorical array into numeric array
|
||||
** @param array categorical values array
|
||||
**/
|
||||
@ -131,7 +131,7 @@ $(document).ready(function() {
|
||||
cache: 'false'
|
||||
});
|
||||
|
||||
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
|
||||
var cursorMode = ($("input[name='mode']:checked").val() == 'edit') ? 'crosshair' : 'pointer';
|
||||
var currentChart = null;
|
||||
var currentData = null;
|
||||
var xLabel = $('#tableid_0').val();
|
||||
@ -140,7 +140,7 @@ $(document).ready(function() {
|
||||
var yType = $('#types_1').val();
|
||||
var dataLabel = $('#dataLabel').val();
|
||||
|
||||
// Get query result
|
||||
// Get query result
|
||||
var data = jQuery.parseJSON($('#querydata').html());
|
||||
|
||||
/**
|
||||
@ -164,16 +164,16 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Input form validation
|
||||
**/
|
||||
**/
|
||||
$('#inputFormSubmitId').click(function() {
|
||||
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0)
|
||||
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
|
||||
else if (xLabel == yLabel)
|
||||
if ($('#tableid_0').get(0).selectedIndex == 0 || $('#tableid_1').get(0).selectedIndex == 0)
|
||||
PMA_ajaxShowMessage(PMA_messages['strInputNull']);
|
||||
else if (xLabel == yLabel)
|
||||
PMA_ajaxShowMessage(PMA_messages['strSameInputs']);
|
||||
});
|
||||
|
||||
/**
|
||||
** Prepare a div containing a link, otherwise it's incorrectly displayed
|
||||
** Prepare a div containing a link, otherwise it's incorrectly displayed
|
||||
** after a couple of clicks
|
||||
**/
|
||||
$('<div id="togglesearchformdiv"><a id="togglesearchformlink"></a></div>')
|
||||
@ -191,177 +191,177 @@ $(document).ready(function() {
|
||||
} else {
|
||||
$link.text(PMA_messages['strHideSearchCriteria']);
|
||||
}
|
||||
// avoid default click action
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
// avoid default click action
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
** Set dialog properties for the data display form
|
||||
**/
|
||||
$("#dataDisplay").dialog({
|
||||
autoOpen: false,
|
||||
title: 'Data point content',
|
||||
title: 'Data point content',
|
||||
modal: false, //false otherwise other dialogues like timepicker may not function properly
|
||||
height: $('#dataDisplay').height() + 80,
|
||||
width: $('#dataDisplay').width() + 80
|
||||
});
|
||||
|
||||
/*
|
||||
* Handle submit of zoom_display_form
|
||||
* Handle submit of zoom_display_form
|
||||
*/
|
||||
|
||||
|
||||
$("#submitForm").click(function(event) {
|
||||
|
||||
|
||||
//Prevent default submission of form
|
||||
event.preventDefault();
|
||||
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = new Array();//Stores the values changed from original
|
||||
|
||||
//Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = new Array();//Stores the values changed from original
|
||||
var it = 4;
|
||||
var xChange = false;
|
||||
var yChange = false;
|
||||
for (key in selectedRow) {
|
||||
if (key != 'where_clause'){
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
|
||||
if (oldVal != newVal){
|
||||
selectedRow[key] = newVal;
|
||||
newValues[key] = newVal;
|
||||
if(key == xLabel) {
|
||||
xChange = true;
|
||||
data[currentData][xLabel] = newVal;
|
||||
}
|
||||
else if(key == yLabel) {
|
||||
yChange = true;
|
||||
data[currentData][yLabel] = newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
it++
|
||||
}//End data update
|
||||
|
||||
//Update the chart series and replot
|
||||
for (key in selectedRow) {
|
||||
if (key != 'where_clause'){
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#fields_null_id_' + it).attr('checked')) ? null : $('#fieldID_' + it).val();
|
||||
if (oldVal != newVal){
|
||||
selectedRow[key] = newVal;
|
||||
newValues[key] = newVal;
|
||||
if (key == xLabel) {
|
||||
xChange = true;
|
||||
data[currentData][xLabel] = newVal;
|
||||
}
|
||||
else if (key == yLabel) {
|
||||
yChange = true;
|
||||
data[currentData][yLabel] = newVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
it++
|
||||
}//End data update
|
||||
|
||||
//Update the chart series and replot
|
||||
if (xChange || yChange) {
|
||||
var newSeries = new Array();
|
||||
newSeries[0] = new Object();
|
||||
var newSeries = new Array();
|
||||
newSeries[0] = new Object();
|
||||
newSeries[0].marker = {
|
||||
symbol: 'circle'
|
||||
};
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
|
||||
if(xChange) {
|
||||
xCord[currentData] = selectedRow[xLabel];
|
||||
if(xType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
|
||||
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
|
||||
//Logic similar to plot generation, replot only if xAxis changes or yAxis changes. Code includes a lot of checks so as to replot only when necessary
|
||||
if (xChange) {
|
||||
xCord[currentData] = selectedRow[xLabel];
|
||||
if (xType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ x : selectedRow[xLabel] });
|
||||
currentChart.xAxis[0].setExtremes(Array.min(xCord) - 6,Array.max(xCord) + 6);
|
||||
}
|
||||
else if(xType == 'time') {
|
||||
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
else if (xType == 'time') {
|
||||
currentChart.series[0].data[currentData].update({ x : getTimeStamp(selectedRow[xLabel],$('#types_0').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
if(yType != 'text')
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
$.each(data,function(key,value) {
|
||||
if (yType != 'text')
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: value[yLabel], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
i++;
|
||||
i++;
|
||||
});
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if (tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}
|
||||
currentSettings.series = newSeries;
|
||||
currentSettings.series = newSeries;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
}
|
||||
|
||||
}
|
||||
if(yChange) {
|
||||
|
||||
yCord[currentData] = selectedRow[yLabel];
|
||||
if(yType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
|
||||
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
|
||||
}
|
||||
else if(yType =='time') {
|
||||
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
if(xType != 'text' )
|
||||
}
|
||||
if (yChange) {
|
||||
|
||||
yCord[currentData] = selectedRow[yLabel];
|
||||
if (yType == 'numeric') {
|
||||
currentChart.series[0].data[currentData].update({ y : selectedRow[yLabel] });
|
||||
currentChart.yAxis[0].setExtremes(Array.min(yCord) - 6,Array.max(yCord) + 6);
|
||||
}
|
||||
else if (yType =='time') {
|
||||
currentChart.series[0].data[currentData].update({ y : getTimeStamp(selectedRow[yLabel],$('#types_1').val())});
|
||||
}
|
||||
else {
|
||||
var tempX = getCord(xCord);
|
||||
var tempY = getCord(yCord);
|
||||
var i = 0;
|
||||
newSeries[0].data = new Array();
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
$.each(data,function(key,value) {
|
||||
if (xType != 'text' )
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: value[xLabel], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
else
|
||||
else
|
||||
newSeries[0].data.push({ name: value[dataLabel], x: tempX[0][i], y: tempY[0][i], marker: {fillColor: colorCodes[i % 8]} , id: i } );
|
||||
i++;
|
||||
i++;
|
||||
});
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if (tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
currentSettings.series = newSeries;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
}
|
||||
}
|
||||
currentChart.series[0].data[currentData].select();
|
||||
currentSettings.series = newSeries;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
}
|
||||
}
|
||||
currentChart.series[0].data[currentData].select();
|
||||
}
|
||||
//End plot update
|
||||
//End plot update
|
||||
|
||||
//Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
//Generate SQL query for update
|
||||
if (!isEmpty(newValues)) {
|
||||
var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
|
||||
for (key in newValues) {
|
||||
if(key != 'where_clause') {
|
||||
sql_query += '`' + key + '`=' ;
|
||||
var value = newValues[key];
|
||||
if(!isNumeric(value) && value != null)
|
||||
sql_query += '\'' + value + '\' ,';
|
||||
else
|
||||
sql_query += value + ' ,';
|
||||
}
|
||||
}
|
||||
sql_query = sql_query.substring(0, sql_query.length - 1);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
|
||||
|
||||
//Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
for (key in newValues) {
|
||||
if (key != 'where_clause') {
|
||||
sql_query += '`' + key + '`=' ;
|
||||
var value = newValues[key];
|
||||
if (!isNumeric(value) && value != null)
|
||||
sql_query += '\'' + value + '\' ,';
|
||||
else
|
||||
sql_query += value + ' ,';
|
||||
}
|
||||
}
|
||||
sql_query = sql_query.substring(0, sql_query.length - 1);
|
||||
sql_query += ' WHERE ' + PMA_urldecode(data[currentData]['where_clause']);
|
||||
|
||||
//Post SQL query to sql.php
|
||||
$.post('sql.php', {
|
||||
'token' : window.parent.token,
|
||||
'db' : window.parent.db,
|
||||
'ajax_request' : true,
|
||||
'sql_query' : sql_query,
|
||||
'inline_edit' : false
|
||||
}, function(data) {
|
||||
if(data.success == true) {
|
||||
$('#sqlqueryresults').html(data.sql_query);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
}
|
||||
else
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
})//End $.post
|
||||
}//End database update
|
||||
$("#dataDisplay").dialog("close");
|
||||
});//End submit handler
|
||||
'inline_edit' : false
|
||||
}, function(data) {
|
||||
if (data.success == true) {
|
||||
$('#sqlqueryresults').html(data.sql_query);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
}
|
||||
else
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
})//End $.post
|
||||
}//End database update
|
||||
$("#dataDisplay").dialog("close");
|
||||
});//End submit handler
|
||||
|
||||
/*
|
||||
* Generate plot using Highcharts
|
||||
*/
|
||||
*/
|
||||
|
||||
if (data != null) {
|
||||
$('#zoom_search_form')
|
||||
@ -369,87 +369,87 @@ $(document).ready(function() {
|
||||
.hide();
|
||||
$('#togglesearchformlink')
|
||||
.text(PMA_messages['strShowSearchCriteria'])
|
||||
$('#togglesearchformdiv').show();
|
||||
$('#togglesearchformdiv').show();
|
||||
var selectedRow;
|
||||
var columnNames = new Array();
|
||||
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
|
||||
var series = new Array();
|
||||
var xCord = new Array();
|
||||
var yCord = new Array();
|
||||
var xCat = new Array();
|
||||
var yCat = new Array();
|
||||
var tempX, tempY;
|
||||
var it = 0;
|
||||
var columnNames = new Array();
|
||||
var colorCodes = ['#FF0000','#00FFFF','#0000FF','#0000A0','#FF0080','#800080','#FFFF00','#00FF00','#FF00FF'];
|
||||
var series = new Array();
|
||||
var xCord = new Array();
|
||||
var yCord = new Array();
|
||||
var xCat = new Array();
|
||||
var yCat = new Array();
|
||||
var tempX, tempY;
|
||||
var it = 0;
|
||||
|
||||
// Set the basic plot settings
|
||||
var currentSettings = {
|
||||
chart: {
|
||||
renderTo: 'querychart',
|
||||
type: 'scatter',
|
||||
zoomType: 'xy',
|
||||
width:$('#resizer').width() -3,
|
||||
height:$('#resizer').height()-20
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
renderTo: 'querychart',
|
||||
type: 'scatter',
|
||||
zoomType: 'xy',
|
||||
width:$('#resizer').width() -3,
|
||||
height:$('#resizer').height()-20
|
||||
},
|
||||
exporting: { enabled: false },
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
exporting: { enabled: false },
|
||||
label: { text: $('#dataLabel').val() },
|
||||
plotOptions: {
|
||||
series: {
|
||||
allowPointSelect: true,
|
||||
plotOptions: {
|
||||
series: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
showInLegend: false,
|
||||
showInLegend: false,
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
enabled: false
|
||||
},
|
||||
point: {
|
||||
point: {
|
||||
events: {
|
||||
click: function() {
|
||||
var id = this.id;
|
||||
var fid = 4;
|
||||
currentData = id;
|
||||
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
|
||||
var post_params = {
|
||||
var id = this.id;
|
||||
var fid = 4;
|
||||
currentData = id;
|
||||
// Make AJAX request to tbl_zoom_select.php for getting the complete row info
|
||||
var post_params = {
|
||||
'ajax_request' : true,
|
||||
'get_data_row' : true,
|
||||
'db' : window.parent.db,
|
||||
'table' : window.parent.table,
|
||||
'where_clause' : data[id]['where_clause'],
|
||||
'token' : window.parent.token,
|
||||
'token' : window.parent.token
|
||||
}
|
||||
$.post('tbl_zoom_select.php', post_params, function(data) {
|
||||
// Row is contained in data.row_info, now fill the displayResultForm with row values
|
||||
for ( key in data.row_info) {
|
||||
if (data.row_info[key] == null)
|
||||
$('#fields_null_id_' + fid).attr('checked', true);
|
||||
else
|
||||
$('#fieldID_' + fid).val(data.row_info[key]);
|
||||
fid++;
|
||||
}
|
||||
selectedRow = new Object();
|
||||
selectedRow = data.row_info;
|
||||
// Row is contained in data.row_info, now fill the displayResultForm with row values
|
||||
for ( key in data.row_info) {
|
||||
if (data.row_info[key] == null)
|
||||
$('#fields_null_id_' + fid).attr('checked', true);
|
||||
else
|
||||
$('#fieldID_' + fid).val(data.row_info[key]);
|
||||
fid++;
|
||||
}
|
||||
selectedRow = new Object();
|
||||
selectedRow = data.row_info;
|
||||
});
|
||||
|
||||
$("#dataDisplay").dialog("open");
|
||||
},
|
||||
$("#dataDisplay").dialog("open");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return this.point.name;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return this.point.name;
|
||||
}
|
||||
},
|
||||
title: { text: 'Query Results' },
|
||||
xAxis: {
|
||||
title: { text: $('#tableid_0').val() },
|
||||
xAxis: {
|
||||
title: { text: $('#tableid_0').val() }
|
||||
},
|
||||
yAxis: {
|
||||
min: null,
|
||||
title: { text: $('#tableid_1').val() },
|
||||
},
|
||||
min: null,
|
||||
title: { text: $('#tableid_1').val() }
|
||||
}
|
||||
}
|
||||
|
||||
$('#resizer').resizable({
|
||||
@ -461,145 +461,145 @@ $(document).ready(function() {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Classify types as either numeric,time,text
|
||||
xType = getType(xType);
|
||||
yType = getType(yType);
|
||||
|
||||
//Set the axis type based on the field
|
||||
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
|
||||
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
|
||||
// Classify types as either numeric,time,text
|
||||
xType = getType(xType);
|
||||
yType = getType(yType);
|
||||
|
||||
//Set the axis type based on the field
|
||||
currentSettings.xAxis.type = (xType == 'time') ? 'datetime' : 'linear';
|
||||
currentSettings.yAxis.type = (yType == 'time') ? 'datetime' : 'linear';
|
||||
|
||||
// Formulate series data for plot
|
||||
series[0] = new Object();
|
||||
series[0].data = new Array();
|
||||
series[0].marker = {
|
||||
series[0].marker = {
|
||||
symbol: 'circle'
|
||||
};
|
||||
if (xType != 'text' && yType != 'text') {
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
if (xType != 'text' && yType != 'text') {
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
series[0].data.push({ name: value[dataLabel], x: xVal, y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
it++;
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
it++;
|
||||
});
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
if (xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
}
|
||||
if (yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType !='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
|
||||
tempX = getCord(xCord);
|
||||
$.each(data,function(key,value) {
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
|
||||
else if (xType =='text' && yType !='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
|
||||
tempX = getCord(xCord);
|
||||
$.each(data,function(key,value) {
|
||||
var yVal = (yType == 'numeric') ? value[yLabel] : getTimeStamp(value[yLabel],$('#types_1').val());
|
||||
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: yVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if (tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}
|
||||
if(yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
if (yType == 'numeric') {
|
||||
currentSettings.yAxis.max = Array.max(yCord) + 6
|
||||
currentSettings.yAxis.min = Array.min(yCord) - 6
|
||||
}
|
||||
xCord = tempX[2];
|
||||
}
|
||||
|
||||
else if (xType !='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
else {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_1').val());
|
||||
}}
|
||||
}
|
||||
xCord = tempX[2];
|
||||
}
|
||||
|
||||
else if (xType !='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
var xVal = (xType == 'numeric') ? value[xLabel] : getTimeStamp(value[xLabel],$('#types_0').val());
|
||||
series[0].data.push({ name: value[dataLabel], y: tempY[0][it], x: xVal, marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
if(xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
if (xType == 'numeric') {
|
||||
currentSettings.xAxis.max = Array.max(xCord) + 6
|
||||
currentSettings.xAxis.min = Array.min(xCord) - 6
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
else {
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
return getDate(this.value, $('#types_0').val());
|
||||
}}
|
||||
}
|
||||
yCord = tempY[2];
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempX = getCord(xCord);
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if (tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
yCord = tempY[2];
|
||||
}
|
||||
|
||||
else if (xType =='text' && yType =='text') {
|
||||
$.each(data,function(key,value) {
|
||||
xCord.push(value[xLabel]);
|
||||
yCord.push(value[yLabel]);
|
||||
});
|
||||
tempX = getCord(xCord);
|
||||
tempY = getCord(yCord);
|
||||
$.each(data,function(key,value) {
|
||||
series[0].data.push({ name: value[dataLabel], x: tempX[0][it], y: tempY[0][it], marker: {fillColor: colorCodes[it % 8]} , id: it } );
|
||||
it++;
|
||||
it++;
|
||||
});
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if(tempX[1][this.value] && tempX[1][this.value].length > 10)
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if(tempY[1][this.value] && tempY[1][this.value].length > 10)
|
||||
return tempY[1][this.value].substring(0,10)
|
||||
else
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
currentSettings.xAxis.labels = { formatter : function() {
|
||||
if (tempX[1][this.value] && tempX[1][this.value].length > 10) {
|
||||
return tempX[1][this.value].substring(0,10)
|
||||
} else {
|
||||
return tempX[1][this.value];
|
||||
}
|
||||
}};
|
||||
currentSettings.yAxis.labels = { formatter : function() {
|
||||
if (tempY[1][this.value] && tempY[1][this.value].length > 10) {
|
||||
return tempY[1][this.value].substring(0,10);
|
||||
} else {
|
||||
return tempY[1][this.value];
|
||||
}
|
||||
}};
|
||||
xCord = tempX[2];
|
||||
yCord = tempY[2];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
currentSettings.series = series;
|
||||
currentSettings.series = series;
|
||||
currentChart = PMA_createChart(currentSettings);
|
||||
scrollToChart();
|
||||
scrollToChart();
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,6 +4,7 @@ set -e
|
||||
|
||||
for file in `find js -name '*.js' -not -name '*min.js'` ; do
|
||||
mkdir -p sources/`dirname $file`
|
||||
mv $file sources/$file
|
||||
java -jar ./scripts/google-javascript-compiler/compiler.jar --js sources/$file --js_output_file $file
|
||||
java -jar ./scripts/google-javascript-compiler/compiler.jar --js $file --js_output_file $file.tmp
|
||||
cp -a $file sources/$file
|
||||
mv $file.tmp $file
|
||||
done
|
||||
|
||||
@ -697,7 +697,7 @@ echo __('Runtime Information');
|
||||
<?php echo __('Refresh'); ?>
|
||||
</a>
|
||||
<span class="refreshList" style="display:none;">
|
||||
<label for="trafficChartRefresh"><?php echo __('Refresh rate: '); ?></label>
|
||||
<label for="id_trafficChartRefresh"><?php echo __('Refresh rate: '); ?></label>
|
||||
<?php refreshList('trafficChartRefresh'); ?>
|
||||
</span>
|
||||
|
||||
@ -719,7 +719,7 @@ echo __('Runtime Information');
|
||||
<?php echo __('Refresh'); ?>
|
||||
</a>
|
||||
<span class="refreshList" style="display:none;">
|
||||
<label for="queryChartRefresh"><?php echo __('Refresh rate: '); ?></label>
|
||||
<label for="id_queryChartRefresh"><?php echo __('Refresh rate: '); ?></label>
|
||||
<?php refreshList('queryChartRefresh'); ?>
|
||||
</span>
|
||||
<a class="tabChart livequeriesLink" href="#">
|
||||
@ -744,7 +744,7 @@ echo __('Runtime Information');
|
||||
<input name="filterText" type="text" id="filterText" style="vertical-align: baseline;" />
|
||||
</div>
|
||||
<div class="formelement">
|
||||
<input type="checkbox" name="filterAlert" id="filterAlert">
|
||||
<input type="checkbox" name="filterAlert" id="filterAlert" />
|
||||
<label for="filterAlert"><?php echo __('Show only alert values'); ?></label>
|
||||
</div>
|
||||
<div class="formelement">
|
||||
@ -761,7 +761,7 @@ echo __('Runtime Information');
|
||||
</select>
|
||||
</div>
|
||||
<div class="formelement">
|
||||
<input type="checkbox" name="dontFormat" id="dontFormat">
|
||||
<input type="checkbox" name="dontFormat" id="dontFormat" />
|
||||
<label for="dontFormat"><?php echo __('Show unformatted values'); ?></label>
|
||||
</div>
|
||||
</fieldset>
|
||||
@ -836,16 +836,16 @@ function printQueryStatistics()
|
||||
echo sprintf(__('Questions since startup: %s'), PMA_formatNumber($total_queries, 0)) . ' ';
|
||||
echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
|
||||
?>
|
||||
<br>
|
||||
<br />
|
||||
<span>
|
||||
<?php
|
||||
echo 'ø ' . __('per hour') . ': ';
|
||||
echo PMA_formatNumber($total_queries * $hour_factor, 0);
|
||||
echo '<br>';
|
||||
echo '<br />';
|
||||
|
||||
echo 'ø ' . __('per minute') . ': ';
|
||||
echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
|
||||
echo '<br>';
|
||||
echo '<br />';
|
||||
|
||||
if ($total_queries / $server_status['Uptime'] >= 1) {
|
||||
echo 'ø ' . __('per second') . ': ';
|
||||
@ -874,6 +874,7 @@ function printQueryStatistics()
|
||||
/* l10n: # = Amount of queries */
|
||||
echo __('#');
|
||||
?>
|
||||
</th>
|
||||
<th>ø <?php echo __('per hour'); ?></th>
|
||||
<th>%</th>
|
||||
</tr>
|
||||
@ -899,11 +900,11 @@ function printQueryStatistics()
|
||||
?>
|
||||
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
|
||||
<th class="name"><?php echo htmlspecialchars($name); ?></th>
|
||||
<td class="value"><?php echo PMA_formatNumber($value, 5, 0, true); ?></td>
|
||||
<td class="value"><?php echo htmlspecialchars(PMA_formatNumber($value, 5, 0, true)); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($value * $hour_factor, 4, 1, true); ?></td>
|
||||
htmlspecialchars(PMA_formatNumber($value * $hour_factor, 4, 1, true)); ?></td>
|
||||
<td class="value"><?php echo
|
||||
PMA_formatNumber($value * $perc_factor, 0, 2); ?>%</td>
|
||||
htmlspecialchars(PMA_formatNumber($value * $perc_factor, 0, 2)); ?>%</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -1382,15 +1383,15 @@ function printVariablesTable()
|
||||
}
|
||||
}
|
||||
if ('%' === substr($name, -1, 1)) {
|
||||
echo PMA_formatNumber($value, 0, 2) . ' %';
|
||||
echo htmlspecialchars(PMA_formatNumber($value, 0, 2)) . ' %';
|
||||
} elseif (strpos($name, 'Uptime')!==FALSE) {
|
||||
echo PMA_timespanFormat($value);
|
||||
echo htmlspecialchars(PMA_timespanFormat($value));
|
||||
} elseif (is_numeric($value) && $value == (int) $value && $value > 1000) {
|
||||
echo PMA_formatNumber($value, 3, 1);
|
||||
echo htmlspecialchars(PMA_formatNumber($value, 3, 1));
|
||||
} elseif (is_numeric($value) && $value == (int) $value) {
|
||||
echo PMA_formatNumber($value, 3, 0);
|
||||
echo htmlspecialchars(PMA_formatNumber($value, 3, 0));
|
||||
} elseif (is_numeric($value)) {
|
||||
echo PMA_formatNumber($value, 3, 1);
|
||||
echo htmlspecialchars(PMA_formatNumber($value, 3, 1));
|
||||
} else {
|
||||
echo htmlspecialchars($value);
|
||||
}
|
||||
@ -1455,13 +1456,13 @@ function printMonitor()
|
||||
<img src="themes/dot.gif" class="icon ic_b_chart" alt="" />
|
||||
<?php echo __('Add chart'); ?>
|
||||
</a>
|
||||
<a href="#rearrangeCharts"><img class="icon ic_b_tblops" src="themes/dot.gif" width="16" height="16" alt=""> <?php echo __('Rearrange/edit charts'); ?></a>
|
||||
<a href="#rearrangeCharts"><img class="icon ic_b_tblops" src="themes/dot.gif" width="16" height="16" alt="" /><?php echo __('Rearrange/edit charts'); ?></a>
|
||||
<div class="clearfloat paddingtop"></div>
|
||||
<div class="floatleft">
|
||||
<?php
|
||||
echo __('Refresh rate') . '<br />';
|
||||
refreshList('gridChartRefresh', 5, Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200));
|
||||
?><br>
|
||||
?><br />
|
||||
</div>
|
||||
<div class="floatleft">
|
||||
<?php echo __('Chart columns'); ?> <br />
|
||||
@ -1489,7 +1490,7 @@ function printMonitor()
|
||||
<?php echo __('The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to \'TABLE\' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%'); ?>
|
||||
<?php if(PMA_MYSQL_INT_VERSION < 50106) { ?>
|
||||
<p>
|
||||
<img class="icon ic_s_attention" src="themes/dot.gif" alt="">
|
||||
<img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
|
||||
<?php
|
||||
echo __('Unfortunately your Database server does not support logging to table, which is a requirement for analyzing the database logs with phpMyAdmin. Logging to table is supported by MySQL 5.1.6 and onwards. You may still use the server charting features however.');
|
||||
?>
|
||||
@ -1498,7 +1499,7 @@ function printMonitor()
|
||||
} else {
|
||||
?>
|
||||
<p></p>
|
||||
<img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading">
|
||||
<img class="ajaxIcon" src="<?php echo $GLOBALS['pmaThemeImage']; ?>ajax_clock_small.gif" alt="Loading" />
|
||||
<div class="ajaxContent"></div>
|
||||
<div class="monitorUse" style="display:none;">
|
||||
<p></p>
|
||||
@ -1512,13 +1513,12 @@ function printMonitor()
|
||||
echo '</p>';
|
||||
?>
|
||||
<p>
|
||||
<img class="icon ic_s_attention" src="themes/dot.gif" alt="">
|
||||
<img class="icon ic_s_attention" src="themes/dot.gif" alt="" />
|
||||
<?php
|
||||
echo '<strong>';
|
||||
echo __('Please note:');
|
||||
echo '</strong><p>';
|
||||
echo '</strong><br />';
|
||||
echo __('Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.');
|
||||
echo '</p>';
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
@ -1529,14 +1529,14 @@ function printMonitor()
|
||||
<div id="tabGridVariables">
|
||||
<p><input type="text" name="chartTitle" value="<?php echo __('Chart Title'); ?>" /></p>
|
||||
|
||||
<input type="radio" name="chartType" value="preset" id="chartPreset">
|
||||
<input type="radio" name="chartType" value="preset" id="chartPreset" />
|
||||
<label for="chartPreset"><?php echo __('Preset chart'); ?></label>
|
||||
<select name="presetCharts"></select><br/>
|
||||
|
||||
<input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked">
|
||||
<input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked" />
|
||||
<label for="chartStatusVar"><?php echo __('Status variable(s)'); ?></label><br/>
|
||||
<div id="chartVariableSettings">
|
||||
<label for="chartSeries"><?php echo __('Select series:'); ?></label><br>
|
||||
<label for="chartSeries"><?php echo __('Select series:'); ?></label><br />
|
||||
<select id="chartSeries" name="varChartList" size="1">
|
||||
<option><?php echo __('Commonly monitored'); ?></option>
|
||||
<option>Processes</option>
|
||||
@ -1552,24 +1552,24 @@ function printMonitor()
|
||||
<option>Open_tables</option>
|
||||
<option>Select_full_join</option>
|
||||
<option>Slow_queries</option>
|
||||
</select><br>
|
||||
</select><br />
|
||||
<label for="variableInput"><?php echo __('or type variable name:'); ?> </label>
|
||||
<input type="text" name="variableInput" id="variableInput" />
|
||||
<p></p>
|
||||
<input type="checkbox" name="differentialValue" id="differentialValue" value="differential" checked="checked" />
|
||||
<label for="differentialValue"><?php echo __('Display as differential value'); ?></label><br>
|
||||
<label for="differentialValue"><?php echo __('Display as differential value'); ?></label><br />
|
||||
<input type="checkbox" id="useDivisor" name="useDivisor" value="1" />
|
||||
<label for="useDivisor"><?php echo __('Apply a divisor'); ?></label>
|
||||
<span class="divisorInput" style="display:none;">
|
||||
<input type="text" name="valueDivisor" size="4" value="1">
|
||||
<input type="text" name="valueDivisor" size="4" value="1" />
|
||||
(<a href="#kibDivisor"><?php echo __('KiB'); ?></a>, <a href="#mibDivisor"><?php echo __('MiB'); ?></a>)
|
||||
</span><br>
|
||||
</span><br />
|
||||
|
||||
<input type="checkbox" id="useUnit" name="useUnit" value="1" />
|
||||
<label for="useUnit"><?php echo __('Append unit to data values'); ?></label>
|
||||
|
||||
<span class="unitInput" style="display:none;">
|
||||
<input type="text" name="valueUnit" size="4" value="">
|
||||
<input type="text" name="valueUnit" size="4" value="" />
|
||||
</span>
|
||||
<p>
|
||||
<a href="#submitAddSeries"><b><?php echo __('Add this series'); ?></b></a>
|
||||
@ -1643,7 +1643,7 @@ function printMonitor()
|
||||
function refreshList($name, $defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20, 40, 60, 120, 300, 600))
|
||||
{
|
||||
?>
|
||||
<select name="<?php echo $name; ?>">
|
||||
<select name="<?php echo $name; ?>" id="id_<?php echo $name; ?>">
|
||||
<?php
|
||||
foreach ($refreshRates as $rate) {
|
||||
$selected = ($rate == $defaultRate)?' selected="selected"':'';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user