diff --git a/js/makegrid.js b/js/makegrid.js index 91fa8a50b4..1fd07c1309 100644 --- a/js/makegrid.js +++ b/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 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 ? '
' : ''; 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__'. 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__' 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('
' + g.cellEditHint + '
'); }) // 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('
' + g.cellEditHint + '
'); }) // 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('
' + g.cellEditHint + '
'); }) // 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(''); @@ -925,11 +925,11 @@ function PMA_makegrid(t, enableResize, enableReorder, enableVisib, enableGridEdi $editArea.append('
' + g.cellEditHint + '
'); 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__' 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 = '
'; 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('
'); $(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(''); - + // 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 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'); diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index b9c0d75364..796b543ba2 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -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 **/ $('
') @@ -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(); } }); diff --git a/scripts/compress-js b/scripts/compress-js index ea43782eae..445cae49fb 100755 --- a/scripts/compress-js +++ b/scripts/compress-js @@ -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 diff --git a/server_status.php b/server_status.php index 1add0b6932..9eb493c493 100644 --- a/server_status.php +++ b/server_status.php @@ -697,7 +697,7 @@ echo __('Runtime Information'); @@ -719,7 +719,7 @@ echo __('Runtime Information'); @@ -744,7 +744,7 @@ echo __('Runtime Information');
- +
@@ -761,7 +761,7 @@ echo __('Runtime Information');
- +
@@ -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'); ?> -
+
'; + echo '
'; echo 'ø ' . __('per minute') . ': '; echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0); - echo '
'; + echo '
'; if ($total_queries / $server_status['Uptime'] >= 1) { echo 'ø ' . __('per second') . ': '; @@ -874,6 +874,7 @@ function printQueryStatistics() /* l10n: # = Amount of queries */ echo __('#'); ?> + ø % @@ -899,11 +900,11 @@ function printQueryStatistics() ?> - + + htmlspecialchars(PMA_formatNumber($value * $hour_factor, 4, 1, true)); ?> % + htmlspecialchars(PMA_formatNumber($value * $perc_factor, 0, 2)); ?>% 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()
- +
'; refreshList('gridChartRefresh', 5, Array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)); - ?>
+ ?>

@@ -1489,7 +1490,7 @@ function printMonitor()

- + @@ -1498,7 +1499,7 @@ function printMonitor() } else { ?>

- Loading + Loading
@@ -1529,14 +1529,14 @@ function printMonitor()

- +
- +
-
+

+

-
+

+

@@ -1643,7 +1643,7 @@ function printMonitor() function refreshList($name, $defaultRate=5, $refreshRates=Array(1, 2, 5, 10, 20, 40, 60, 120, 300, 600)) { ?> -