Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5f664dc759
@ -1,4 +1,4 @@
|
||||
phpMyAdmin - ChangeLog
|
||||
phpMyAdmin - ChangeLog
|
||||
======================
|
||||
|
||||
3.5.0.0 (not yet released)
|
||||
@ -16,6 +16,10 @@
|
||||
+ Patch #3271804 for rfe #3177495, new DisableMultiTableMaintenance directive
|
||||
+ [interface] Reorganised server status page.
|
||||
+ [interface] Changed way of generating charts.
|
||||
+ rfe #939233 [interface] Flexible column width
|
||||
+ [interface] Mouse-based column reordering in query results
|
||||
+ AJAX for Insert to a table from database Structure page
|
||||
- Patch #3316969 PMA_ajaxShowMessage() does not respect timeout
|
||||
|
||||
3.4.3.0 (not yet released)
|
||||
- bug #3311170 [sync] Missing helper icons in Synchronize
|
||||
@ -26,6 +30,9 @@
|
||||
- bug #3313210 [interface] Columns class sometimes changed for nothing
|
||||
- patch #3313326 [interface] Some tooltips do not disappear
|
||||
- bug #3315720 [search] Fix search in non unicode tables
|
||||
- bug #3315741 [display] Inline query edit broken
|
||||
- patch #3317206 [privileges] Generate password option missing on new accounts
|
||||
- bug #3317293 [edit] Inline edit places HTML line breaks in edit area
|
||||
|
||||
3.4.2.0 (2011-06-07)
|
||||
- bug #3301249 [interface] Iconic table operations does not remove inline edit label
|
||||
|
||||
@ -1073,7 +1073,7 @@ ALTER TABLE `pma_column_comments`
|
||||
Without configuring the storage, you can still access the recently used tables,
|
||||
but it will disappear after you logout.<br/><br/>
|
||||
|
||||
To allow the usage of this functionality:
|
||||
To allow the usage of this functionality persistently:
|
||||
|
||||
<ul>
|
||||
<li>set up <a href="#pmadb">pmadb</a> and the phpMyAdmin configuration storage</li>
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'db_search.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
|
||||
/**
|
||||
* Gets some core libraries and send headers
|
||||
|
||||
@ -14,6 +14,7 @@ require_once './libraries/common.inc.php';
|
||||
* Runs common work
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
|
||||
require './libraries/db_common.inc.php';
|
||||
|
||||
@ -12,6 +12,7 @@ require_once './libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'db_structure.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_change.js';
|
||||
|
||||
/**
|
||||
* Prepares the tables list if the user where not redirected to this script
|
||||
@ -354,8 +355,8 @@ foreach ($tables as $keyname => $each_table) {
|
||||
<?php echo $titles['Structure']; ?></a></td>
|
||||
<td align="center"><?php echo $search_table; ?></td>
|
||||
<?php if (! $db_is_information_schema) { ?>
|
||||
<td align="center">
|
||||
<a href="tbl_change.php?<?php echo $tbl_url_query; ?>">
|
||||
<td align="center" class="insert_table">
|
||||
<a <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'class="ajax"' : ''); ?> href="tbl_change.php?<?php echo $tbl_url_query; ?>">
|
||||
<?php echo $titles['Insert']; ?></a></td>
|
||||
<td align="center"><?php echo $empty_table; ?></td>
|
||||
<td align="center">
|
||||
|
||||
@ -12,7 +12,6 @@ if(!window.console) {
|
||||
window.console.dir = function(str) {};
|
||||
}
|
||||
|
||||
// <3 IE
|
||||
if(!Array.indexOf){
|
||||
Array.prototype.indexOf = function(obj){
|
||||
for(var i=0; i<this.length; i++){
|
||||
@ -28,7 +27,7 @@ if(!Array.indexOf){
|
||||
// canvg(target, s)
|
||||
// empty parameters: replace all 'svg' elements on page with 'canvas' elements
|
||||
// target: canvas element or the id of a canvas element
|
||||
// s: svg string or url to svg file
|
||||
// s: svg string, url to svg file, or xml document
|
||||
// opts: optional hash of options
|
||||
// ignoreMouse: true => ignore mouse events
|
||||
// ignoreAnimation: true => ignore animations
|
||||
@ -75,7 +74,11 @@ if(!Array.indexOf){
|
||||
svg.opts = opts;
|
||||
|
||||
var ctx = target.getContext('2d');
|
||||
if (s.substr(0,1) == '<') {
|
||||
if (typeof(s.documentElement) != 'undefined') {
|
||||
// load from xml doc
|
||||
svg.loadXmlDoc(ctx, s);
|
||||
}
|
||||
else if (s.substr(0,1) == '<') {
|
||||
// load from xml string
|
||||
svg.loadXml(ctx, s);
|
||||
}
|
||||
@ -89,6 +92,7 @@ if(!Array.indexOf){
|
||||
var svg = { };
|
||||
|
||||
svg.FRAMERATE = 30;
|
||||
svg.MAX_VIRTUAL_PIXELS = 30000;
|
||||
|
||||
// globals
|
||||
svg.init = function(ctx) {
|
||||
@ -99,6 +103,7 @@ if(!Array.indexOf){
|
||||
svg.ctx = ctx;
|
||||
svg.ViewPort = new (function () {
|
||||
this.viewPorts = [];
|
||||
this.Clear = function() { this.viewPorts = []; }
|
||||
this.SetCurrent = function(width, height) { this.viewPorts.push({ width: width, height: height }); }
|
||||
this.RemoveCurrent = function() { this.viewPorts.pop(); }
|
||||
this.Current = function() { return this.viewPorts[this.viewPorts.length - 1]; }
|
||||
@ -551,7 +556,7 @@ if(!Array.indexOf){
|
||||
}
|
||||
}
|
||||
|
||||
var data = v.split(/\s(?=[a-z])/);
|
||||
var data = svg.trim(svg.compressSpaces(v)).split(/\s(?=[a-z])/);
|
||||
for (var i=0; i<data.length; i++) {
|
||||
var type = data[i].split('(')[0];
|
||||
var s = data[i].split('(')[1].replace(')','');
|
||||
@ -616,7 +621,7 @@ if(!Array.indexOf){
|
||||
return a;
|
||||
}
|
||||
|
||||
// get or create style
|
||||
// get or create style, crawls up node tree
|
||||
this.style = function(name, createIfNotExists) {
|
||||
var s = this.styles[name];
|
||||
if (s != null) return s;
|
||||
@ -625,6 +630,14 @@ if(!Array.indexOf){
|
||||
if (a != null && a.hasValue()) {
|
||||
return a;
|
||||
}
|
||||
|
||||
var p = this.parent;
|
||||
if (p != null) {
|
||||
var ps = p.style(name);
|
||||
if (ps != null && ps.hasValue()) {
|
||||
return ps;
|
||||
}
|
||||
}
|
||||
|
||||
s = new svg.Property(name, '');
|
||||
if (createIfNotExists == true) this.styles[name] = s;
|
||||
@ -635,6 +648,9 @@ if(!Array.indexOf){
|
||||
this.render = function(ctx) {
|
||||
// don't render display=none
|
||||
if (this.attribute('display').value == 'none') return;
|
||||
|
||||
// don't render visibility=hidden
|
||||
if (this.attribute('visibility').value == 'hidden') return;
|
||||
|
||||
ctx.save();
|
||||
this.setContext(ctx);
|
||||
@ -681,7 +697,7 @@ if(!Array.indexOf){
|
||||
}
|
||||
|
||||
// add tag styles
|
||||
var styles = svg.Styles[this.type];
|
||||
var styles = svg.Styles[node.nodeName];
|
||||
if (styles != null) {
|
||||
for (var name in styles) {
|
||||
this.styles[name] = styles[name];
|
||||
@ -698,6 +714,12 @@ if(!Array.indexOf){
|
||||
this.styles[name] = styles[name];
|
||||
}
|
||||
}
|
||||
styles = svg.Styles[node.nodeName+'.'+classes[j]];
|
||||
if (styles != null) {
|
||||
for (var name in styles) {
|
||||
this.styles[name] = styles[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -856,7 +878,7 @@ if(!Array.indexOf){
|
||||
|
||||
var width = svg.ViewPort.width();
|
||||
var height = svg.ViewPort.height();
|
||||
if (this.attribute('width').hasValue() && this.attribute('height').hasValue()) {
|
||||
if (typeof(this.root) == 'undefined' && this.attribute('width').hasValue() && this.attribute('height').hasValue()) {
|
||||
width = this.attribute('width').Length.toPixels('x');
|
||||
height = this.attribute('height').Length.toPixels('y');
|
||||
|
||||
@ -1186,9 +1208,6 @@ if(!Array.indexOf){
|
||||
pp.reset();
|
||||
|
||||
var bb = new svg.BoundingBox();
|
||||
|
||||
if(this.attribute('visibility').value=='hidden') return;
|
||||
|
||||
if (ctx != null) ctx.beginPath();
|
||||
while (!pp.isEnd()) {
|
||||
pp.nextCommand();
|
||||
@ -1469,6 +1488,37 @@ if(!Array.indexOf){
|
||||
for (var i=0; i<stopsContainer.stops.length; i++) {
|
||||
g.addColorStop(stopsContainer.stops[i].offset, stopsContainer.stops[i].color);
|
||||
}
|
||||
|
||||
if (this.attribute('gradientTransform').hasValue()) {
|
||||
// render as transformed pattern on temporary canvas
|
||||
var rootView = svg.ViewPort.viewPorts[0];
|
||||
|
||||
var rect = new svg.Element.rect();
|
||||
rect.attributes['x'] = new svg.Property('x', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
||||
rect.attributes['y'] = new svg.Property('y', -svg.MAX_VIRTUAL_PIXELS/3.0);
|
||||
rect.attributes['width'] = new svg.Property('width', svg.MAX_VIRTUAL_PIXELS);
|
||||
rect.attributes['height'] = new svg.Property('height', svg.MAX_VIRTUAL_PIXELS);
|
||||
|
||||
var group = new svg.Element.g();
|
||||
group.attributes['transform'] = new svg.Property('transform', this.attribute('gradientTransform').value);
|
||||
group.children = [ rect ];
|
||||
|
||||
var tempSvg = new svg.Element.svg();
|
||||
tempSvg.attributes['x'] = new svg.Property('x', 0);
|
||||
tempSvg.attributes['y'] = new svg.Property('y', 0);
|
||||
tempSvg.attributes['width'] = new svg.Property('width', rootView.width);
|
||||
tempSvg.attributes['height'] = new svg.Property('height', rootView.height);
|
||||
tempSvg.children = [ group ];
|
||||
|
||||
var c = document.createElement('canvas');
|
||||
c.width = rootView.width;
|
||||
c.height = rootView.height;
|
||||
var tempCtx = c.getContext('2d');
|
||||
tempCtx.fillStyle = g;
|
||||
tempSvg.render(tempCtx);
|
||||
return tempCtx.createPattern(c, 'no-repeat');
|
||||
}
|
||||
|
||||
return g;
|
||||
}
|
||||
}
|
||||
@ -1494,16 +1544,8 @@ if(!Array.indexOf){
|
||||
var y2 = (this.gradientUnits == 'objectBoundingBox'
|
||||
? bb.y() + bb.height() * this.attribute('y2').numValue()
|
||||
: this.attribute('y2').Length.toPixels('y'));
|
||||
|
||||
var p1 = new svg.Point(x1, y1);
|
||||
var p2 = new svg.Point(x2, y2);
|
||||
if (this.attribute('gradientTransform').hasValue()) {
|
||||
var transform = new svg.Transform(this.attribute('gradientTransform').value);
|
||||
transform.applyToPoint(p1);
|
||||
transform.applyToPoint(p2);
|
||||
}
|
||||
|
||||
return ctx.createLinearGradient(p1.x, p1.y, p2.x, p2.y);
|
||||
|
||||
return ctx.createLinearGradient(x1, y1, x2, y2);
|
||||
}
|
||||
}
|
||||
svg.Element.linearGradient.prototype = new svg.Element.GradientBase;
|
||||
@ -1540,22 +1582,7 @@ if(!Array.indexOf){
|
||||
? (bb.width() + bb.height()) / 2.0 * this.attribute('r').numValue()
|
||||
: this.attribute('r').Length.toPixels());
|
||||
|
||||
var c = new svg.Point(cx, cy);
|
||||
var f = new svg.Point(fx, fy);
|
||||
if (this.attribute('gradientTransform').hasValue()) {
|
||||
var transform = new svg.Transform(this.attribute('gradientTransform').value);
|
||||
transform.applyToPoint(c);
|
||||
transform.applyToPoint(f);
|
||||
|
||||
for (var i=0; i<transform.transforms.length; i++) {
|
||||
// average the scaling part of the transform, apply to radius
|
||||
var scale1 = transform.transforms[i].m[0];
|
||||
var scale2 = transform.transforms[i].m[3];
|
||||
r = r * ((scale1 + scale2) / 2.0);
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.createRadialGradient(f.x, f.y, 0, c.x, c.y, r);
|
||||
return ctx.createRadialGradient(fx, fy, 0, cx, cy, r);
|
||||
}
|
||||
}
|
||||
svg.Element.radialGradient.prototype = new svg.Element.GradientBase;
|
||||
@ -1693,6 +1720,73 @@ if(!Array.indexOf){
|
||||
}
|
||||
svg.Element.animateTransform.prototype = new svg.Element.animate;
|
||||
|
||||
// font element
|
||||
svg.Element.font = function(node) {
|
||||
this.base = svg.Element.ElementBase;
|
||||
this.base(node);
|
||||
|
||||
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
||||
|
||||
this.isRTL = false;
|
||||
this.isArabic = false;
|
||||
this.fontFace = null;
|
||||
this.missingGlyph = null;
|
||||
this.glyphs = [];
|
||||
for (var i=0; i<this.children.length; i++) {
|
||||
var child = this.children[i];
|
||||
if (child.type == 'font-face') {
|
||||
this.fontFace = child;
|
||||
if (child.style('font-family').hasValue()) {
|
||||
svg.Definitions[child.style('font-family').value] = this;
|
||||
}
|
||||
}
|
||||
else if (child.type == 'missing-glyph') this.missingGlyph = child;
|
||||
else if (child.type == 'glyph') {
|
||||
if (child.arabicForm != '') {
|
||||
this.isRTL = true;
|
||||
this.isArabic = true;
|
||||
if (typeof(this.glyphs[child.unicode]) == 'undefined') this.glyphs[child.unicode] = [];
|
||||
this.glyphs[child.unicode][child.arabicForm] = child;
|
||||
}
|
||||
else {
|
||||
this.glyphs[child.unicode] = child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
svg.Element.font.prototype = new svg.Element.ElementBase;
|
||||
|
||||
// font-face element
|
||||
svg.Element.fontface = function(node) {
|
||||
this.base = svg.Element.ElementBase;
|
||||
this.base(node);
|
||||
|
||||
this.ascent = this.attribute('ascent').value;
|
||||
this.descent = this.attribute('descent').value;
|
||||
this.unitsPerEm = this.attribute('units-per-em').numValue();
|
||||
}
|
||||
svg.Element.fontface.prototype = new svg.Element.ElementBase;
|
||||
|
||||
// missing-glyph element
|
||||
svg.Element.missingglyph = function(node) {
|
||||
this.base = svg.Element.path;
|
||||
this.base(node);
|
||||
|
||||
this.horizAdvX = 0;
|
||||
}
|
||||
svg.Element.missingglyph.prototype = new svg.Element.path;
|
||||
|
||||
// glyph element
|
||||
svg.Element.glyph = function(node) {
|
||||
this.base = svg.Element.path;
|
||||
this.base(node);
|
||||
|
||||
this.horizAdvX = this.attribute('horiz-adv-x').numValue();
|
||||
this.unicode = this.attribute('unicode').value;
|
||||
this.arabicForm = this.attribute('arabic-form').value;
|
||||
}
|
||||
svg.Element.glyph.prototype = new svg.Element.path;
|
||||
|
||||
// text element
|
||||
svg.Element.text = function(node) {
|
||||
this.base = svg.Element.RenderedElementBase;
|
||||
@ -1715,19 +1809,16 @@ if(!Array.indexOf){
|
||||
this.baseSetContext = this.setContext;
|
||||
this.setContext = function(ctx) {
|
||||
this.baseSetContext(ctx);
|
||||
if (this.attribute('text-anchor').hasValue()) {
|
||||
var textAnchor = this.attribute('text-anchor').value;
|
||||
if (this.style('text-anchor').hasValue()) {
|
||||
var textAnchor = this.style('text-anchor').value;
|
||||
ctx.textAlign = textAnchor == 'middle' ? 'center' : textAnchor;
|
||||
}
|
||||
if (this.attribute('alignment-baseline').hasValue()) ctx.textBaseline = this.attribute('alignment-baseline').value;
|
||||
}
|
||||
|
||||
this.renderChildren = function(ctx) {
|
||||
if(this.attribute('visibility').value=='hidden') return;
|
||||
|
||||
var x = this.attribute('x').Length.toPixels('x');
|
||||
var y = this.attribute('y').Length.toPixels('y');
|
||||
|
||||
for (var i=0; i<this.children.length; i++) {
|
||||
var child = this.children[i];
|
||||
|
||||
@ -1759,8 +1850,63 @@ if(!Array.indexOf){
|
||||
this.base = svg.Element.RenderedElementBase;
|
||||
this.base(node);
|
||||
|
||||
this.getGlyph = function(font, text, i) {
|
||||
var c = text[i];
|
||||
var glyph = null;
|
||||
if (font.isArabic) {
|
||||
var arabicForm = 'isolated';
|
||||
if ((i==0 || text[i-1]==' ') && i<text.length-2 && text[i+1]!=' ') arabicForm = 'terminal';
|
||||
if (i>0 && text[i-1]!=' ' && i<text.length-2 && text[i+1]!=' ') arabicForm = 'medial';
|
||||
if (i>0 && text[i-1]!=' ' && (i == text.length-1 || text[i+1]==' ')) arabicForm = 'initial';
|
||||
if (typeof(font.glyphs[c]) != 'undefined') {
|
||||
glyph = font.glyphs[c][arabicForm];
|
||||
if (glyph == null && font.glyphs[c].type == 'glyph') glyph = font.glyphs[c];
|
||||
}
|
||||
}
|
||||
else {
|
||||
glyph = font.glyphs[c];
|
||||
}
|
||||
if (glyph == null) glyph = font.missingGlyph;
|
||||
return glyph;
|
||||
}
|
||||
|
||||
this.renderChildren = function(ctx) {
|
||||
ctx.fillText(svg.compressSpaces(this.getText()), this.x, this.y);
|
||||
var customFont = this.parent.style('font-family').Definition.getDefinition();
|
||||
if (customFont != null) {
|
||||
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
||||
var fontStyle = this.parent.style('font-style').valueOrDefault(svg.Font.Parse(svg.ctx.font).fontStyle);
|
||||
var text = this.getText();
|
||||
if (customFont.isRTL) text = text.split("").reverse().join("");
|
||||
|
||||
if (this.parent.style('text-anchor').value == 'middle') {
|
||||
this.x = this.x - this.measureText(ctx) / 2.0;
|
||||
}
|
||||
|
||||
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
||||
for (var i=0; i<text.length; i++) {
|
||||
var glyph = this.getGlyph(customFont, text, i);
|
||||
var scale = fontSize / customFont.fontFace.unitsPerEm;
|
||||
ctx.translate(this.x, this.y);
|
||||
ctx.scale(scale, -scale);
|
||||
var lw = ctx.lineWidth;
|
||||
ctx.lineWidth = ctx.lineWidth * customFont.fontFace.unitsPerEm / fontSize;
|
||||
if (fontStyle == 'italic') ctx.transform(1, 0, .4, 1, 0, 0);
|
||||
glyph.render(ctx);
|
||||
if (fontStyle == 'italic') ctx.transform(1, 0, -.4, 1, 0, 0);
|
||||
ctx.lineWidth = lw;
|
||||
ctx.scale(1/scale, -1/scale);
|
||||
ctx.translate(-this.x, -this.y);
|
||||
|
||||
this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / customFont.fontFace.unitsPerEm;
|
||||
if (typeof(dx[i]) != 'undefined' && !isNaN(dx[i])) {
|
||||
this.x += dx[i];
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.strokeStyle != '') ctx.strokeText(svg.compressSpaces(this.getText()), this.x, this.y);
|
||||
if (ctx.fillStyle != '') ctx.fillText(svg.compressSpaces(this.getText()), this.x, this.y);
|
||||
}
|
||||
|
||||
this.getText = function() {
|
||||
@ -1768,6 +1914,23 @@ if(!Array.indexOf){
|
||||
}
|
||||
|
||||
this.measureText = function(ctx) {
|
||||
var customFont = this.parent.style('font-family').Definition.getDefinition();
|
||||
if (customFont != null) {
|
||||
var fontSize = this.parent.style('font-size').numValueOrDefault(svg.Font.Parse(svg.ctx.font).fontSize);
|
||||
var measure = 0;
|
||||
var text = this.getText();
|
||||
if (customFont.isRTL) text = text.split("").reverse().join("");
|
||||
var dx = svg.ToNumberArray(this.parent.attribute('dx').value);
|
||||
for (var i=0; i<text.length; i++) {
|
||||
var glyph = this.getGlyph(customFont, text, i);
|
||||
measure += (glyph.horizAdvX || customFont.horizAdvX) * fontSize / customFont.fontFace.unitsPerEm;
|
||||
if (typeof(dx[i]) != 'undefined' && !isNaN(dx[i])) {
|
||||
measure += dx[i];
|
||||
}
|
||||
}
|
||||
return measure;
|
||||
}
|
||||
|
||||
var textToMeasure = svg.compressSpaces(this.getText());
|
||||
if (!ctx.measureText) return textToMeasure.length * 10;
|
||||
return ctx.measureText(textToMeasure).width;
|
||||
@ -1780,8 +1943,9 @@ if(!Array.indexOf){
|
||||
this.base = svg.Element.TextElementBase;
|
||||
this.base(node);
|
||||
|
||||
// TEXT ELEMENT
|
||||
this.text = node.nodeType == 3 ? node.nodeValue : node.childNodes[0].nodeValue;
|
||||
this.text = node.nodeType == 3 ? node.nodeValue : // text
|
||||
node.childNodes.length > 0 ? node.childNodes[0].nodeValue : // element
|
||||
node.text;
|
||||
this.getText = function() {
|
||||
return this.text;
|
||||
}
|
||||
@ -1931,8 +2095,9 @@ if(!Array.indexOf){
|
||||
this.base = svg.Element.ElementBase;
|
||||
this.base(node);
|
||||
|
||||
var css = node.childNodes[0].nodeValue;
|
||||
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/gm, ''); // remove comments
|
||||
// text, or spaces then CDATA
|
||||
var css = node.childNodes[0].nodeValue + (node.childNodes.length > 1 ? node.childNodes[1].nodeValue : '');
|
||||
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments
|
||||
css = svg.compressSpaces(css); // replace whitespace
|
||||
var cssDefs = css.split('}');
|
||||
for (var i=0; i<cssDefs.length; i++) {
|
||||
@ -1945,14 +2110,31 @@ if(!Array.indexOf){
|
||||
if (cssClass != '') {
|
||||
var props = {};
|
||||
for (var k=0; k<cssProps.length; k++) {
|
||||
var prop = cssProps[k].split(':');
|
||||
var name = prop[0];
|
||||
var value = prop[1];
|
||||
var prop = cssProps[k].indexOf(':');
|
||||
var name = cssProps[k].substr(0, prop);
|
||||
var value = cssProps[k].substr(prop + 1, cssProps[k].length - prop);
|
||||
if (name != null && value != null) {
|
||||
props[svg.trim(prop[0])] = new svg.Property(svg.trim(prop[0]), svg.trim(prop[1]));
|
||||
props[svg.trim(name)] = new svg.Property(svg.trim(name), svg.trim(value));
|
||||
}
|
||||
}
|
||||
svg.Styles[cssClass] = props;
|
||||
if (cssClass == '@font-face') {
|
||||
var fontFamily = props['font-family'].value.replace(/"/g,'');
|
||||
var srcs = props['src'].value.split(',');
|
||||
for (var s=0; s<srcs.length; s++) {
|
||||
if (srcs[s].indexOf('format("svg")') > 0) {
|
||||
var urlStart = srcs[s].indexOf('url');
|
||||
var urlEnd = srcs[s].indexOf(')', urlStart);
|
||||
var url = srcs[s].substr(urlStart + 5, urlEnd - urlStart - 6);
|
||||
var doc = svg.parseXml(svg.ajax(url));
|
||||
var fonts = doc.getElementsByTagName('font');
|
||||
for (var f=0; f<fonts.length; f++) {
|
||||
var font = svg.CreateElement(fonts[f]);
|
||||
svg.Definitions[fontFamily] = font;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2004,6 +2186,10 @@ if(!Array.indexOf){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.render = function(ctx) {
|
||||
// NO RENDER
|
||||
}
|
||||
}
|
||||
svg.Element.clipPath.prototype = new svg.Element.ElementBase;
|
||||
|
||||
@ -2024,7 +2210,8 @@ if(!Array.indexOf){
|
||||
|
||||
// element factory
|
||||
svg.CreateElement = function(node) {
|
||||
var className = node.nodeName.replace(/^[^:]+:/,'');
|
||||
var className = node.nodeName.replace(/^[^:]+:/,''); // remove namespace
|
||||
className = className.replace(/\-/g,''); // remove dashes
|
||||
var e = null;
|
||||
if (typeof(svg.Element[className]) != 'undefined') {
|
||||
e = new svg.Element[className](node);
|
||||
@ -2044,6 +2231,10 @@ if(!Array.indexOf){
|
||||
|
||||
// load from xml
|
||||
svg.loadXml = function(ctx, xml) {
|
||||
svg.loadXmlDoc(ctx, svg.parseXml(xml));
|
||||
}
|
||||
|
||||
svg.loadXmlDoc = function(ctx, dom) {
|
||||
svg.init(ctx);
|
||||
|
||||
var mapXY = function(p) {
|
||||
@ -2070,19 +2261,24 @@ if(!Array.indexOf){
|
||||
};
|
||||
}
|
||||
|
||||
var dom = svg.parseXml(xml);
|
||||
var e = svg.CreateElement(dom.documentElement);
|
||||
e.root = true;
|
||||
|
||||
// render loop
|
||||
var isFirstRender = true;
|
||||
var draw = function() {
|
||||
svg.ViewPort.Clear();
|
||||
if (ctx.canvas.parentNode) svg.ViewPort.SetCurrent(ctx.canvas.parentNode.clientWidth, ctx.canvas.parentNode.clientHeight);
|
||||
|
||||
if (svg.opts == null || svg.opts['ignoreDimensions'] != true) {
|
||||
// set canvas size
|
||||
if (e.style('width').hasValue()) {
|
||||
ctx.canvas.width = e.style('width').Length.toPixels(ctx.canvas.parentNode.clientWidth);
|
||||
ctx.canvas.width = e.style('width').Length.toPixels('x');
|
||||
ctx.canvas.style.width = ctx.canvas.width + 'px';
|
||||
}
|
||||
if (e.style('height').hasValue()) {
|
||||
ctx.canvas.height = e.style('height').Length.toPixels(ctx.canvas.parentNode.clientHeight);
|
||||
ctx.canvas.height = e.style('height').Length.toPixels('y');
|
||||
ctx.canvas.style.height = ctx.canvas.height + 'px';
|
||||
}
|
||||
}
|
||||
svg.ViewPort.SetCurrent(ctx.canvas.clientWidth, ctx.canvas.clientHeight);
|
||||
|
||||
1093
js/canvg/flashcanvas.js
Normal file
1093
js/canvg/flashcanvas.js
Normal file
File diff suppressed because it is too large
Load Diff
BIN
js/canvg/flashcanvas.swf
Normal file
BIN
js/canvg/flashcanvas.swf
Normal file
Binary file not shown.
@ -26,7 +26,14 @@ function loadResult(result_path , table_name , link , ajaxEnable){
|
||||
/** Load the browse results to the page */
|
||||
$("#table-info").show();
|
||||
$('#table-link').attr({"href" : 'sql.php?'+link }).text(table_name);
|
||||
$('#browse-results').load(result_path + " '"+'#sqlqueryresults' + "'").show();
|
||||
$('#browse-results').load(result_path + " '"+'#sqlqueryresults' + "'", null, function() {
|
||||
// because under db_search, window.parent.table is not defined yet,
|
||||
// we assign it manually from #table-link
|
||||
window.parent.table = $('#table-link').text().trim();
|
||||
|
||||
appendInlineAnchor();
|
||||
$('#table_results').makegrid();
|
||||
}).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -173,7 +180,6 @@ $(document).ready(function() {
|
||||
if (typeof response == 'string') {
|
||||
// found results
|
||||
$("#searchresults").html(response);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
|
||||
$('#togglesearchresultlink')
|
||||
// always start with the Show message
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
/**
|
||||
* AJAX scripts for db_structure.php
|
||||
*
|
||||
*
|
||||
* Actions ajaxified here:
|
||||
* Drop Database
|
||||
* Truncate Table
|
||||
@ -33,7 +33,7 @@ function PMA_adjustTotals($this_anchor) {
|
||||
// (not really needed in case we are dropping the table)
|
||||
$rows_td.text('0');
|
||||
// set size to unknown (not sure how to get the exact
|
||||
// value here, as an empty InnoDB table would have a size)
|
||||
// value here, as an empty InnoDB table would have a size)
|
||||
$size_td.text('-');
|
||||
|
||||
// try to compute a new total row number
|
||||
@ -51,6 +51,128 @@ function PMA_adjustTotals($this_anchor) {
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
/**
|
||||
* Ajax Event handler for 'Insert Table'
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @see $cfg['AjaxEnable']
|
||||
*/
|
||||
var currrent_insert_table;
|
||||
$("td.insert_table a.ajax").live('click', function(event){
|
||||
event.preventDefault();
|
||||
currrent_insert_table = $(this);
|
||||
var url = $(this).attr("href");
|
||||
if (url.substring(0, 15) == "tbl_change.php?") {
|
||||
url = url.substring(15);
|
||||
}
|
||||
|
||||
var div = $('<div id="insert_table_dialog"></div>');
|
||||
var target = "tbl_change.php";
|
||||
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
* dialog
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( target , url+"&ajax_request=true" , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
} else {
|
||||
div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strInsertTable'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
})
|
||||
//Remove the top menu container from the dialog
|
||||
.find("#topmenucontainer").hide()
|
||||
; // end dialog options
|
||||
$(".insertRowTable").addClass("ajax");
|
||||
$("#buttonYes").addClass("ajax");
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
|
||||
});
|
||||
|
||||
$("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var the_form object referring to the insert form
|
||||
*/
|
||||
var $form = $("#insertForm");
|
||||
$("#result_query").remove();
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
//User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize() , function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
if ($("#insert_table_dialog").length > 0) {
|
||||
$("#insert_table_dialog").dialog("close").remove();
|
||||
}
|
||||
/**Update the row count at the tableForm*/
|
||||
currrent_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count);
|
||||
}) // end $.post()
|
||||
}) // end insert table button "Go"
|
||||
|
||||
$("#buttonYes.ajax").live('click', function(event){
|
||||
event.preventDefault();
|
||||
/**
|
||||
* @var the_form object referring to the insert form
|
||||
*/
|
||||
var $form = $("#insertForm");
|
||||
/**Get the submit type and the after insert type in the form*/
|
||||
var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").attr('value');
|
||||
var selected_after_insert = $("#insertForm").find("#actions_panel select[name=after_insert] option:selected").attr('value');
|
||||
$("#result_query").remove();
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
//User wants to submit the form
|
||||
$.post($form.attr('action'), $form.serialize() , function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
if (selected_submit_type == "showinsert") {
|
||||
$(data.sql_query).insertAfter("#topmenucontainer");
|
||||
$("#result_query .notice").remove();
|
||||
$("#result_query").prepend((data.message));
|
||||
}
|
||||
if (selected_after_insert == "new_insert") {
|
||||
/**Trigger the insert dialog for new_insert option*/
|
||||
currrent_insert_table.trigger('click');
|
||||
}
|
||||
|
||||
} else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
if ($("#insert_table_dialog").length > 0) {
|
||||
$("#insert_table_dialog").dialog("close").remove();
|
||||
}
|
||||
/**Update the row count at the tableForm*/
|
||||
currrent_insert_table.closest('tr').find('.value.tbl_rows').html(data.row_count);
|
||||
}) // end $.post()
|
||||
});
|
||||
|
||||
/**
|
||||
* Ajax Event handler for 'Truncate Table'
|
||||
@ -149,7 +271,7 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Ajax Event handler for 'Drop Event'
|
||||
*
|
||||
*
|
||||
* @uses $.PMA_confirm()
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @see $cfg['AjaxEnable']
|
||||
@ -188,7 +310,7 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Ajax Event handler for 'Drop Procedure'
|
||||
*
|
||||
*
|
||||
* @uses $.PMA_confirm()
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @see $cfg['AjaxEnable']
|
||||
@ -220,10 +342,10 @@ $(document).ready(function() {
|
||||
}) // end $.get()
|
||||
}) // end $.PMA_confirm()
|
||||
}) //end Drop Procedure
|
||||
|
||||
|
||||
/**
|
||||
* Ajax Event handler for 'Drop tracking'
|
||||
*
|
||||
*
|
||||
* @uses $.PMA_confirm()
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @see $cfg['AjaxEnable']
|
||||
@ -261,7 +383,7 @@ $(document).ready(function() {
|
||||
//Calculate Real End for InnoDB
|
||||
/**
|
||||
* Ajax Event handler for calculatig the real end for a InnoDB table
|
||||
*
|
||||
*
|
||||
* @uses $.PMA_confirm
|
||||
*/
|
||||
$('#real_end_input').live('click', function(event) {
|
||||
|
||||
163
js/functions.js
163
js/functions.js
@ -15,10 +15,9 @@ var sql_box_locked = false;
|
||||
var only_once_elements = new Array();
|
||||
|
||||
/**
|
||||
* @var ajax_message_init boolean boolean that stores status of
|
||||
* notification for PMA_ajaxShowNotification
|
||||
* @var int ajax_message_count Number of AJAX messages shown since page load
|
||||
*/
|
||||
var ajax_message_init = false;
|
||||
var ajax_message_count = 0;
|
||||
|
||||
/**
|
||||
* @var codemirror_editor object containing CodeMirror editor
|
||||
@ -31,7 +30,6 @@ var codemirror_editor = false;
|
||||
var chart_activeTimeouts = new Object();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add a hidden field to the form to indicate that this will be an
|
||||
* Ajax request (only if this hidden field does not exist)
|
||||
@ -659,10 +657,10 @@ $(document).ready(function() {
|
||||
* so that it works also for pages reached via AJAX)
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('tr.odd, tr.even').live('hover',function() {
|
||||
$('tr.odd, tr.even').live('hover',function(event) {
|
||||
var $tr = $(this);
|
||||
$tr.toggleClass('hover');
|
||||
$tr.children().toggleClass('hover');
|
||||
$tr.toggleClass('hover',event.type=='mouseover');
|
||||
$tr.children().toggleClass('hover',event.type=='mouseover');
|
||||
});
|
||||
})
|
||||
|
||||
@ -1151,7 +1149,7 @@ function changeMIMEType(db, table, reference, mime_type)
|
||||
* Jquery Coding for inline editing SQL_QUERY
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
$(".inline_edit_sql").click( function(){
|
||||
$(".inline_edit_sql").live('click', function(){
|
||||
var db = $(this).prev().find("input[name='db']").val();
|
||||
var table = $(this).prev().find("input[name='table']").val();
|
||||
var token = $(this).prev().find("input[name='token']").val();
|
||||
@ -1244,83 +1242,64 @@ $(document).ready(function(){
|
||||
* optional, defaults to 'Loading...'
|
||||
* @param var timeout number of milliseconds for the message to be visible
|
||||
* optional, defaults to 5000
|
||||
* @return jQuery object jQuery Element that holds the message div
|
||||
* @return jQuery object jQuery Element that holds the message div
|
||||
*/
|
||||
|
||||
function PMA_ajaxShowMessage(message, timeout) {
|
||||
|
||||
//Handle the case when a empty data.message is passed. We don't want the empty message
|
||||
if(message == '') {
|
||||
//Handle the case when a empty data.message is passed. We don't want the empty message
|
||||
if (message == '') {
|
||||
return true;
|
||||
} else if (! message) {
|
||||
// If the message is undefined, show the default
|
||||
message = PMA_messages['strLoading'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @var msg String containing the message that has to be displayed
|
||||
* @default PMA_messages['strLoading']
|
||||
*/
|
||||
if(!message) {
|
||||
var msg = PMA_messages['strLoading'];
|
||||
}
|
||||
else {
|
||||
var msg = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var timeout Number of milliseconds for which {@link msg} will be visible
|
||||
* @var timeout Number of milliseconds for which the message will be visible
|
||||
* @default 5000 ms
|
||||
*/
|
||||
if(!timeout) {
|
||||
var to = 5000;
|
||||
}
|
||||
else {
|
||||
var to = timeout;
|
||||
if (! timeout) {
|
||||
timeout = 5000;
|
||||
}
|
||||
|
||||
if( !ajax_message_init) {
|
||||
//For the first time this function is called, append a new div
|
||||
$(function(){
|
||||
$('<div id="loading_parent"></div>')
|
||||
.insertBefore("#serverinfo");
|
||||
|
||||
$('<span id="loading" class="ajax_notification"></span>')
|
||||
.appendTo("#loading_parent")
|
||||
.html(msg)
|
||||
.fadeIn('medium')
|
||||
.delay(to)
|
||||
.fadeOut('medium', function(){
|
||||
$(this)
|
||||
.html("") //Clear the message
|
||||
.hide();
|
||||
});
|
||||
}, 'top.frame_content');
|
||||
ajax_message_init = true;
|
||||
// Create a parent element for the AJAX messages, if necessary
|
||||
if ($('#loading_parent').length == 0) {
|
||||
$('<div id="loading_parent"></div>')
|
||||
.insertBefore("#serverinfo");
|
||||
}
|
||||
else {
|
||||
//Otherwise, just show the div again after inserting the message
|
||||
$("#loading")
|
||||
.stop(true, true)
|
||||
.html(msg)
|
||||
|
||||
// Update message count to create distinct message elements every time
|
||||
ajax_message_count++;
|
||||
|
||||
// Remove all old messages, if any
|
||||
$(".ajax_notification[id^=ajax_message_num]").remove();
|
||||
|
||||
/**
|
||||
* @var $retval a jQuery object containing the reference
|
||||
* to the created AJAX message
|
||||
*/
|
||||
var $retval = $('<span class="ajax_notification" id="ajax_message_num_' + ajax_message_count + '"></span>')
|
||||
.hide()
|
||||
.appendTo("#loading_parent")
|
||||
.html(message)
|
||||
.fadeIn('medium')
|
||||
.delay(to)
|
||||
.delay(timeout)
|
||||
.fadeOut('medium', function() {
|
||||
$(this)
|
||||
.html("")
|
||||
.hide();
|
||||
})
|
||||
}
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
return $("#loading");
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the message shown for an Ajax operation when it's completed
|
||||
*/
|
||||
function PMA_ajaxRemoveMessage($this_msgbox) {
|
||||
$this_msgbox
|
||||
.stop(true, true)
|
||||
.fadeOut('medium', function() {
|
||||
$this_msgbox.hide();
|
||||
});
|
||||
if ($this_msgbox != 'undefined' && $this_msgbox instanceof jQuery) {
|
||||
$this_msgbox
|
||||
.stop(true, true)
|
||||
.fadeOut('medium');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1411,31 +1390,41 @@ function PMA_createChart(passedSettings) {
|
||||
events: {
|
||||
load: function() {
|
||||
var thisChart = this;
|
||||
var lastValue=null, curValue=null;
|
||||
var numLoadedPoints=0, otherSum=0;
|
||||
var lastValue = null, curValue = null;
|
||||
var numLoadedPoints = 0, otherSum = 0;
|
||||
var diff;
|
||||
// No realtime updates for graphs that are being exported, and disabled when no callback is set
|
||||
if(thisChart.options.chart.forExport==true || !passedSettings.realtime || !passedSettings.realtime.callback) return;
|
||||
if(thisChart.options.chart.forExport == true ||
|
||||
! passedSettings.realtime ||
|
||||
! passedSettings.realtime.callback) return;
|
||||
|
||||
thisChart.options.realtime.timeoutCallBack = function() {
|
||||
$.get(passedSettings.realtime.url,{ajax_request:1, chart_data:1, type:passedSettings.realtime.type},function(data) {
|
||||
curValue = jQuery.parseJSON(data);
|
||||
//if(lastValue==null) lastValue = curValue;
|
||||
|
||||
if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
|
||||
else diff = parseInt(curValue.x - lastValue.x);
|
||||
|
||||
thisChart.xAxis[0].setExtremes(thisChart.xAxis[0].getExtremes().min+diff, thisChart.xAxis[0].getExtremes().max+diff, false);
|
||||
|
||||
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
|
||||
|
||||
lastValue = curValue;
|
||||
numLoadedPoints++;
|
||||
|
||||
// Timeout has been cleared => don't start a new timeout
|
||||
if(chart_activeTimeouts[container]==null) return;
|
||||
chart_activeTimeouts[container] = setTimeout(thisChart.options.realtime.timeoutCallBack, thisChart.options.realtime.refreshRate);
|
||||
|
||||
$.post(passedSettings.realtime.url,
|
||||
{ ajax_request: true, chart_data: 1, type: passedSettings.realtime.type },
|
||||
function(data) {
|
||||
curValue = jQuery.parseJSON(data);
|
||||
|
||||
if(lastValue==null) diff = curValue.x - thisChart.xAxis[0].getExtremes().max;
|
||||
else diff = parseInt(curValue.x - lastValue.x);
|
||||
|
||||
thisChart.xAxis[0].setExtremes(
|
||||
thisChart.xAxis[0].getExtremes().min+diff,
|
||||
thisChart.xAxis[0].getExtremes().max+diff,
|
||||
false
|
||||
);
|
||||
|
||||
passedSettings.realtime.callback(thisChart,curValue,lastValue,numLoadedPoints);
|
||||
|
||||
lastValue = curValue;
|
||||
numLoadedPoints++;
|
||||
|
||||
// Timeout has been cleared => don't start a new timeout
|
||||
if(chart_activeTimeouts[container]==null) return;
|
||||
|
||||
chart_activeTimeouts[container] = setTimeout(
|
||||
thisChart.options.realtime.timeoutCallBack,
|
||||
thisChart.options.realtime.refreshRate
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1469,8 +1458,8 @@ function PMA_createChart(passedSettings) {
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return '<b>'+ this.series.name +'</b><br/>'+
|
||||
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
|
||||
return '<b>' + this.series.name +'</b><br/>' +
|
||||
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
|
||||
Highcharts.numberFormat(this.y, 2);
|
||||
}
|
||||
},
|
||||
|
||||
@ -309,7 +309,8 @@ extend(Chart.prototype, {
|
||||
canvas=createElement('canvas');
|
||||
|
||||
$('body').append(canvas);
|
||||
$(canvas).hide();
|
||||
$(canvas).css('position','absolute');
|
||||
$(canvas).css('left','-10000px');
|
||||
|
||||
var submitData = function(chartData) {
|
||||
// merge the options
|
||||
@ -348,11 +349,19 @@ extend(Chart.prototype, {
|
||||
if(options && options.type=='image/svg+xml') {
|
||||
submitData(chart.getSVG(chartOptions));
|
||||
} else {
|
||||
if (typeof FlashCanvas != "undefined") {
|
||||
FlashCanvas.initElement(canvas);
|
||||
}
|
||||
|
||||
// Generate data uri and submit once done
|
||||
canvg(canvas, chart.getSVG(chartOptions),{
|
||||
ignoreAnimation:true,
|
||||
ignoreMouse:true,
|
||||
renderCallback:function() { submitData(canvas.toDataURL()); }
|
||||
renderCallback:function() {
|
||||
// IE8 fix: flashcanvas doesn't update the canvas immediately, thus requiring setTimeout.
|
||||
// See also http://groups.google.com/group/flashcanvas/browse_thread/thread/e36ff7a03e1bfb0a
|
||||
setTimeout(function() { submitData(canvas.toDataURL()); }, 100);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -2210,7 +2210,7 @@ SVGRenderer.prototype = {
|
||||
if (lineNo) {
|
||||
// Webkit and opera sometimes return 'normal' as the line height. In that
|
||||
// case, webkit uses offsetHeight, while Opera falls back to 18
|
||||
lineHeight = pInt(window.getComputedStyle(lastLine, null).getPropertyValue('line-height'));
|
||||
if(window.getComputedStyle) lineHeight = pInt(window.getComputedStyle(lastLine, null).getPropertyValue('line-height'));
|
||||
if (isNaN(lineHeight)) {
|
||||
lineHeight = textLineHeight || lastLine.offsetHeight || 18;
|
||||
}
|
||||
|
||||
617
js/makegrid.js
Normal file
617
js/makegrid.js
Normal file
@ -0,0 +1,617 @@
|
||||
(function ($) {
|
||||
$.grid = function(t) {
|
||||
// prepare the grid
|
||||
var g = {
|
||||
// constant
|
||||
minColWidth: 5,
|
||||
|
||||
// variables, assigned with default value, changed later
|
||||
alignment: 'horizontal', // 3 possibilities: vertical, horizontal, horizontalflipped
|
||||
actionSpan: 5,
|
||||
colOrder: new Array(), // array of column order
|
||||
tableCreateTime: null, // table creation time, only available in "Browse tab"
|
||||
hintShown: false, // true if hint balloon is shown, used by updateHint() method
|
||||
reorderHint: '', // string, hint for column reordering
|
||||
sortHint: '', // string, hint for column sorting
|
||||
markHint: '', // string, hint for column marking
|
||||
showReorderHint: false, // boolean, used by showHint() method
|
||||
showSortHint: false, // boolean, used by showHint() method
|
||||
showMarkHint: false,
|
||||
hintIsHiding: false, // true when hint is still shown, but hide() already called
|
||||
|
||||
// functions
|
||||
dragStartRsz: function(e, obj) { // start column resize
|
||||
var n = $(this.cRsz).find('div').index(obj);
|
||||
this.colRsz = {
|
||||
x0: e.pageX,
|
||||
n: n,
|
||||
obj: obj,
|
||||
objLeft: $(obj).position().left,
|
||||
objWidth: this.alignment != 'vertical' ?
|
||||
$(this.t).find('th.draggable:eq(' + n + ') span').outerWidth() :
|
||||
$(this.t).find('tr:first td:eq(' + n + ') span').outerWidth()
|
||||
};
|
||||
$('body').css('cursor', 'col-resize');
|
||||
$('body').noSelect();
|
||||
},
|
||||
|
||||
dragStartMove: function(e, obj) { // start column move
|
||||
// prepare the cCpy and cPointer from the dragged column
|
||||
$(this.cCpy).text($(obj).text());
|
||||
var objPos = $(obj).position();
|
||||
if (this.alignment != 'vertical') {
|
||||
$(this.cCpy).css({
|
||||
top: objPos.top + 20,
|
||||
left: objPos.left,
|
||||
height: $(obj).height(),
|
||||
width: $(obj).width()
|
||||
});
|
||||
$(this.cPointer).css({
|
||||
top: objPos.top
|
||||
});
|
||||
} else { // vertical alignment
|
||||
$(this.cCpy).css({
|
||||
top: objPos.top,
|
||||
left: objPos.left + 30,
|
||||
height: $(obj).height(),
|
||||
width: $(obj).width()
|
||||
});
|
||||
$(this.cPointer).css({
|
||||
top: objPos.top
|
||||
});
|
||||
}
|
||||
|
||||
// get the column index, zero-based
|
||||
var n = this.getHeaderIdx(obj);
|
||||
|
||||
this.colMov = {
|
||||
x0: e.pageX,
|
||||
y0: e.pageY,
|
||||
n: n,
|
||||
newn: n,
|
||||
obj: obj,
|
||||
objTop: objPos.top,
|
||||
objLeft: objPos.left
|
||||
};
|
||||
$('body').css('cursor', 'move');
|
||||
this.hideHint();
|
||||
$('body').noSelect();
|
||||
},
|
||||
|
||||
dragMove: function(e) {
|
||||
if (this.colRsz) {
|
||||
var dx = e.pageX - this.colRsz.x0;
|
||||
if (this.colRsz.objWidth + dx > this.minColWidth)
|
||||
$(this.colRsz.obj).css('left', this.colRsz.objLeft + dx + 'px');
|
||||
} else if (this.colMov) {
|
||||
// dragged column animation
|
||||
if (this.alignment != 'vertical') {
|
||||
var dx = e.pageX - this.colMov.x0;
|
||||
$(this.cCpy)
|
||||
.css('left', this.colMov.objLeft + dx)
|
||||
.show();
|
||||
} else { // vertical alignment
|
||||
var dy = e.pageY - this.colMov.y0;
|
||||
$(this.cCpy)
|
||||
.css('top', this.colMov.objTop + dy)
|
||||
.show();
|
||||
}
|
||||
|
||||
// pointer animation
|
||||
var hoveredCol = this.getHoveredCol(e);
|
||||
if (hoveredCol) {
|
||||
var newn = this.getHeaderIdx(hoveredCol);
|
||||
this.colMov.newn = newn;
|
||||
if (newn != this.colMov.n) {
|
||||
// show the column pointer in the right place
|
||||
var colPos = $(hoveredCol).position();
|
||||
if (this.alignment != 'vertical') {
|
||||
var newleft = newn < this.colMov.n ?
|
||||
colPos.left :
|
||||
colPos.left + $(hoveredCol).outerWidth();
|
||||
$(this.cPointer)
|
||||
.css({
|
||||
left: newleft,
|
||||
visibility: 'visible'
|
||||
});
|
||||
} else { // vertical alignment
|
||||
var newtop = newn < this.colMov.n ?
|
||||
colPos.top :
|
||||
colPos.top + $(hoveredCol).outerHeight();
|
||||
$(this.cPointer)
|
||||
.css({
|
||||
top: newtop,
|
||||
visibility: 'visible'
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// no movement to other column, hide the column pointer
|
||||
$(this.cPointer).css('visibility', 'hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dragEnd: function(e) {
|
||||
if (this.colRsz) {
|
||||
var dx = e.pageX - this.colRsz.x0;
|
||||
var nw = this.colRsz.objWidth + dx;
|
||||
if (nw < this.minColWidth) {
|
||||
nw = this.minColWidth;
|
||||
}
|
||||
var n = this.colRsz.n;
|
||||
// do the resizing
|
||||
if (this.alignment != 'vertical') {
|
||||
$(this.t).find('tr').each(function() {
|
||||
$(this).find('th.draggable:eq(' + n + ') span,' +
|
||||
'td:eq(' + (g.actionSpan + n) + ') span')
|
||||
.css('width', nw);
|
||||
});
|
||||
} else { // vertical alignment
|
||||
$(this.t).find('tr').each(function() {
|
||||
$(this).find('td:eq(' + n + ') span')
|
||||
.css('width', nw);
|
||||
});
|
||||
}
|
||||
$('body').css('cursor', 'default');
|
||||
this.reposRsz();
|
||||
this.colRsz = false;
|
||||
} else if (this.colMov) {
|
||||
// shift columns
|
||||
if (this.colMov.newn != this.colMov.n) {
|
||||
this.shiftCol(this.colMov.n, this.colMov.newn);
|
||||
// assign new position
|
||||
var objPos = $(this.colMov.obj).position();
|
||||
this.colMov.objTop = objPos.top;
|
||||
this.colMov.objLeft = objPos.left;
|
||||
this.colMov.n = this.colMov.newn;
|
||||
// send request to server to remember the column order
|
||||
if (this.tableCreateTime) {
|
||||
this.sendColOrder();
|
||||
}
|
||||
this.refreshRestoreButton();
|
||||
}
|
||||
|
||||
// animate new column position
|
||||
$(this.cCpy).stop(true, true)
|
||||
.animate({
|
||||
top: g.colMov.objTop,
|
||||
left: g.colMov.objLeft
|
||||
}, 'fast')
|
||||
.fadeOut();
|
||||
$(this.cPointer).css('visibility', 'hidden');
|
||||
|
||||
this.colMov = false;
|
||||
}
|
||||
$('body').css('cursor', 'default');
|
||||
$('body').noSelect(false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Reposition column resize bars.
|
||||
*/
|
||||
reposRsz: function() {
|
||||
$(this.cRsz).find('div').hide();
|
||||
$firstRowCols = this.alignment != 'vertical' ?
|
||||
$(this.t).find('tr:first th.draggable') :
|
||||
$(this.t).find('tr:first td');
|
||||
for (var n = 0; n < $firstRowCols.length; n++) {
|
||||
$this = $($firstRowCols[n]);
|
||||
$cb = $(g.cRsz).find('div:eq(' + n + ')'); // column border
|
||||
var pad = parseInt($this.css('padding-right'));
|
||||
$cb.css('left', Math.floor($this.position().left + $this.width() + pad))
|
||||
.show();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Shift column from index oldn to newn.
|
||||
*/
|
||||
shiftCol: function(oldn, newn) {
|
||||
if (this.alignment != 'vertical') {
|
||||
$(this.t).find('tr').each(function() {
|
||||
if (newn < oldn) {
|
||||
$(this).find('th.draggable:eq(' + newn + '),' +
|
||||
'td:eq(' + (g.actionSpan + newn) + ')')
|
||||
.before($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
'td:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
} else {
|
||||
$(this).find('th.draggable:eq(' + newn + '),' +
|
||||
'td:eq(' + (g.actionSpan + newn) + ')')
|
||||
.after($(this).find('th.draggable:eq(' + oldn + '),' +
|
||||
'td:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
}
|
||||
});
|
||||
// reposition the column resize bars
|
||||
this.reposRsz();
|
||||
|
||||
} else { // vertical alignment
|
||||
// shift rows
|
||||
if (newn < oldn) {
|
||||
$(this.t).find('tr:eq(' + (g.actionSpan + newn) + ')')
|
||||
.before($(this.t).find('tr:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
} else {
|
||||
$(this.t).find('tr:eq(' + (g.actionSpan + newn) + ')')
|
||||
.after($(this.t).find('tr:eq(' + (g.actionSpan + oldn) + ')'));
|
||||
}
|
||||
}
|
||||
// adjust the colOrder
|
||||
var tmp = this.colOrder[oldn];
|
||||
this.colOrder.splice(oldn, 1);
|
||||
this.colOrder.splice(newn, 0, tmp);
|
||||
},
|
||||
|
||||
/**
|
||||
* Find currently hovered table column's header (excluding actions column).
|
||||
* @return the hovered column's th object or undefined if no hovered column found.
|
||||
*/
|
||||
getHoveredCol: function(e) {
|
||||
var hoveredCol;
|
||||
$headers = $(this.t).find('th.draggable');
|
||||
if (this.alignment != 'vertical') {
|
||||
$headers.each(function() {
|
||||
var left = $(this).position().left;
|
||||
var right = left + $(this).outerWidth();
|
||||
if (left <= e.pageX && e.pageX <= right) {
|
||||
hoveredCol = this;
|
||||
}
|
||||
});
|
||||
} else { // vertical alignment
|
||||
$headers.each(function() {
|
||||
var top = $(this).position().top;
|
||||
var bottom = top + $(this).height();
|
||||
if (top <= e.pageY && e.pageY <= bottom) {
|
||||
hoveredCol = this;
|
||||
}
|
||||
});
|
||||
}
|
||||
return hoveredCol;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a zero-based index from a <th class="draggable"> tag in a table.
|
||||
*/
|
||||
getHeaderIdx: function(obj) {
|
||||
var n;
|
||||
if (this.alignment != 'vertical') {
|
||||
n = $(obj).parents('tr').find('th.draggable').index(obj);
|
||||
} else {
|
||||
var column_idx = $(obj).index();
|
||||
var $th_in_same_column = $(this.t).find('th.draggable:nth-child(' + (column_idx + 1) + ')');
|
||||
n = $th_in_same_column.index(obj);
|
||||
}
|
||||
return n;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reposition the table back to normal order.
|
||||
*/
|
||||
restore: function() {
|
||||
// use insertion sort, since we already have shiftCol function
|
||||
for (var i = 1; i < this.colOrder.length; i++) {
|
||||
var x = this.colOrder[i];
|
||||
var j = i - 1;
|
||||
while (j >= 0 && x < this.colOrder[j]) {
|
||||
j--;
|
||||
}
|
||||
if (j != i - 1) {
|
||||
this.shiftCol(i, j + 1);
|
||||
}
|
||||
}
|
||||
if (this.tableCreateTime) {
|
||||
// send request to server to remember the column order
|
||||
this.sendColOrder();
|
||||
}
|
||||
this.refreshRestoreButton();
|
||||
},
|
||||
|
||||
/**
|
||||
* Send column order to the server.
|
||||
*/
|
||||
sendColOrder: function() {
|
||||
$.post('sql.php', {
|
||||
ajax_request: true,
|
||||
db: window.parent.db,
|
||||
table: window.parent.table,
|
||||
token: window.parent.token,
|
||||
set_col_order: true,
|
||||
col_order: this.colOrder.toString(),
|
||||
table_create_time: this.tableCreateTime
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh restore button state.
|
||||
* Make restore button disabled if the table is similar with initial state.
|
||||
*/
|
||||
refreshRestoreButton: function() {
|
||||
// check if table state is as initial state
|
||||
var isInitial = true;
|
||||
for (var i = 0; i < this.colOrder.length; i++) {
|
||||
if (this.colOrder[i] != i) {
|
||||
isInitial = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// enable or disable restore button
|
||||
if (isInitial) {
|
||||
$('.restore_column').hide();
|
||||
} else {
|
||||
$('.restore_column').show();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Show hint with the text supplied.
|
||||
*/
|
||||
showHint: function(e) {
|
||||
if (!this.colRsz && !this.colMov) { // if not resizing or dragging
|
||||
var text = '';
|
||||
if (this.showReorderHint) {
|
||||
text += this.reorderHint;
|
||||
}
|
||||
if (this.showSortHint) {
|
||||
text += text.length > 0 ? '<br />' : '';
|
||||
text += this.sortHint;
|
||||
}
|
||||
if (this.showMarkHint) {
|
||||
text += text.length > 0 ? '<br />' : '';
|
||||
text += this.markHint;
|
||||
}
|
||||
|
||||
// hide the hint if no text
|
||||
if (!text) {
|
||||
this.hideHint();
|
||||
return;
|
||||
}
|
||||
|
||||
$(this.dHint).html(text);
|
||||
if (!this.hintShown || this.hintIsHiding) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.css({
|
||||
top: e.pageY,
|
||||
left: e.pageX + 15
|
||||
})
|
||||
.show('fast');
|
||||
this.hintShown = true;
|
||||
this.hintIsHiding = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the hint.
|
||||
*/
|
||||
hideHint: function() {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint)
|
||||
.stop(true, true)
|
||||
.hide(300, function() {
|
||||
g.hintShown = false;
|
||||
g.hintIsHiding = false;
|
||||
});
|
||||
this.hintIsHiding = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update hint position.
|
||||
*/
|
||||
updateHint: function(e) {
|
||||
if (this.hintShown) {
|
||||
$(this.dHint).css({
|
||||
top: e.pageY,
|
||||
left: e.pageX + 15
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g.gDiv = document.createElement('div'); // create global div
|
||||
g.cRsz = document.createElement('div'); // column resizer
|
||||
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
|
||||
g.dHint = document.createElement('div'); // draggable hint
|
||||
|
||||
// assign the table alignment
|
||||
g.alignment = $("#top_direction_dropdown").val();
|
||||
|
||||
// adjust g.cCpy
|
||||
g.cCpy.className = 'cCpy';
|
||||
$(g.cCpy).hide();
|
||||
|
||||
// adjust g.cPoint
|
||||
g.cPointer.className = g.alignment != 'vertical' ? 'cPointer' : 'cPointerVer';
|
||||
$(g.cPointer).css('visibility', 'hidden');
|
||||
|
||||
// adjust g.dHint
|
||||
g.dHint.className = 'dHint';
|
||||
$(g.dHint).hide();
|
||||
|
||||
// chain table and grid together
|
||||
t.grid = g;
|
||||
g.t = t;
|
||||
|
||||
// get first row data columns
|
||||
var $firstRowCols = g.alignment != 'vertical' ?
|
||||
$(t).find('tr:first th.draggable') :
|
||||
$(t).find('tr:first td');
|
||||
|
||||
// assign first column (actions) span
|
||||
if (! $(t).find('tr:first th:first').hasClass('draggable')) { // action header exist
|
||||
g.actionSpan = g.alignment != 'vertical' ?
|
||||
$(t).find('tr:first th:first').prop('colspan') :
|
||||
$(t).find('tr:first th:first').prop('rowspan');
|
||||
} 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 column reorder & column sort hint
|
||||
g.reorderHint = $('#col_order_hint').val();
|
||||
g.sortHint = $('#sort_hint').val();
|
||||
g.markHint = $('#col_mark_hint').val();
|
||||
|
||||
// determine whether to show the column reordering hint or not
|
||||
g.showReorderHint = $firstRowCols.length > 1;
|
||||
|
||||
// initialize column order
|
||||
$col_order = $('#col_order');
|
||||
if ($col_order.length > 0) {
|
||||
g.colOrder = $col_order.val().split(',');
|
||||
for (var i = 0; i < g.colOrder.length; i++) {
|
||||
g.colOrder[i] = parseInt(g.colOrder[i]);
|
||||
}
|
||||
} else {
|
||||
g.colOrder = new Array();
|
||||
for (var i = 0; i < $firstRowCols.length; i++) {
|
||||
g.colOrder.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
// create column borders
|
||||
$firstRowCols.each(function() {
|
||||
$this = $(this);
|
||||
var cb = document.createElement('div'); // column border
|
||||
var pad = parseInt($this.css('padding-right'));
|
||||
$(cb).css('left', Math.floor($this.position().left + $this.width() + pad));
|
||||
$(cb).addClass('colborder');
|
||||
$(cb).mousedown(function(e) {
|
||||
g.dragStartRsz(e, this);
|
||||
});
|
||||
$(g.cRsz).append(cb);
|
||||
});
|
||||
|
||||
// wrap all data cells, except actions cell, with span
|
||||
$(t).find('th, td:not(:has(span))')
|
||||
.wrapInner('<span />');
|
||||
|
||||
// register events
|
||||
if ($firstRowCols.length > 1) {
|
||||
$(t).find('th.draggable')
|
||||
.css('cursor', 'move')
|
||||
.mousedown(function(e) {
|
||||
g.dragStartMove(e, this);
|
||||
});
|
||||
}
|
||||
$(t).find('th.draggable')
|
||||
.mouseenter(function(e) {
|
||||
g.showMarkHint = !g.showSortHint;
|
||||
g.showHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.hideHint();
|
||||
});
|
||||
$(t).find('th.draggable a')
|
||||
.attr('title', '') // hide default tooltip for sorting
|
||||
.mouseenter(function(e) {
|
||||
g.showSortHint = true;
|
||||
g.showMarkHint = false;
|
||||
g.showHint(e);
|
||||
})
|
||||
.mouseleave(function(e) {
|
||||
g.showSortHint = false;
|
||||
g.showMarkHint = true;
|
||||
g.showHint(e);
|
||||
});
|
||||
$(document).mousemove(function(e) {
|
||||
g.dragMove(e);
|
||||
g.updateHint(e);
|
||||
});
|
||||
$(document).mouseup(function(e) {
|
||||
g.dragEnd(e);
|
||||
});
|
||||
$('.restore_column').click(function() {
|
||||
g.restore();
|
||||
});
|
||||
|
||||
// add table class
|
||||
$(t).addClass('pma_table');
|
||||
|
||||
// link all divs
|
||||
$(t).before(g.gDiv);
|
||||
$(g.gDiv).append(t);
|
||||
$(g.gDiv).prepend(g.cRsz);
|
||||
$(g.gDiv).append(g.cCpy);
|
||||
$(g.gDiv).append(g.cPointer);
|
||||
$(g.gDiv).append(g.dHint);
|
||||
|
||||
// some adjustment
|
||||
g.refreshRestoreButton();
|
||||
g.cRsz.className = 'cRsz';
|
||||
$(t).removeClass('data');
|
||||
$(g.gDiv).addClass('data');
|
||||
$(g.cRsz).css('height', $(t).height());
|
||||
$(t).find('th a').bind('dragstart', function() {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
// document ready checking
|
||||
var docready = false;
|
||||
$(document).ready(function() {
|
||||
docready = true;
|
||||
});
|
||||
|
||||
// Additional jQuery functions
|
||||
/**
|
||||
* Make resizable, reorderable grid.
|
||||
*/
|
||||
$.fn.makegrid = function() {
|
||||
return this.each(function() {
|
||||
if (!docready) {
|
||||
var t = this;
|
||||
$(document).ready(function() {
|
||||
$.grid(t);
|
||||
});
|
||||
} else {
|
||||
$.grid(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Refresh grid. This must be called after changing the grid's content.
|
||||
*/
|
||||
$.fn.refreshgrid = function() {
|
||||
return this.each(function() {
|
||||
if (!docready) {
|
||||
var t = this;
|
||||
$(document).ready(function() {
|
||||
if (t.grid) t.grid.reposRsz();
|
||||
});
|
||||
} else {
|
||||
if (this.grid) this.grid.reposRsz();
|
||||
}
|
||||
});
|
||||
}
|
||||
$.fn.noSelect = function (p) { //no select plugin by Paulo P.Marinas
|
||||
var prevent = (p == null) ? true : p;
|
||||
if (prevent) {
|
||||
return this.each(function () {
|
||||
if ($.browser.msie || $.browser.safari) $(this).bind('selectstart', function () {
|
||||
return false;
|
||||
});
|
||||
else if ($.browser.mozilla) {
|
||||
$(this).css('MozUserSelect', 'none');
|
||||
$('body').trigger('focus');
|
||||
} else if ($.browser.opera) $(this).bind('mousedown', function () {
|
||||
return false;
|
||||
});
|
||||
else $(this).attr('unselectable', 'on');
|
||||
});
|
||||
} else {
|
||||
return this.each(function () {
|
||||
if ($.browser.msie || $.browser.safari) $(this).unbind('selectstart');
|
||||
else if ($.browser.mozilla) $(this).css('MozUserSelect', 'inherit');
|
||||
else if ($.browser.opera) $(this).unbind('mousedown');
|
||||
else $(this).removeAttr('unselectable', 'on');
|
||||
});
|
||||
}
|
||||
}; //end noSelect
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -61,6 +61,8 @@ $js_messages['strRemovingSelectedUsers'] = __('Removing Selected Users');
|
||||
$js_messages['strClose'] = __('Close');
|
||||
|
||||
/* for server_status.js */
|
||||
$js_messages['strEdit'] = __('Edit');
|
||||
|
||||
$js_messages['strLiveTrafficChart'] = __('Live traffic chart');
|
||||
$js_messages['strLiveConnChart'] = __('Live conn./process chart');
|
||||
$js_messages['strLiveQueryChart'] = __('Live query chart');
|
||||
@ -75,6 +77,17 @@ $js_messages['strThousandsSeperator'] = __(',');
|
||||
/* l10n: Decimal separator */
|
||||
$js_messages['strDecimalSeperator'] = __('.');
|
||||
|
||||
$js_messages['strChartKBSent'] = __('KiB sent since last refresh');
|
||||
$js_messages['strChartKBReceived'] = __('KiB received since last refresh');
|
||||
$js_messages['strChartServerTraffic'] = __('Server traffic (in KiB)');
|
||||
$js_messages['strChartConnections'] = __('Connections since last refresh');
|
||||
$js_messages['strChartProcesses'] = __('Processes');
|
||||
$js_messages['strChartConnectionsTitle'] = __('Connections / Processes');
|
||||
$js_messages['strChartIssuedQueries'] = __('Issued queries since last refresh');
|
||||
$js_messages['strChartIssuedQueriesTitle'] = __('Issued queries');
|
||||
|
||||
$js_messages['strChartQueryPie'] = __('Query statistics');
|
||||
|
||||
/* For inline query editing */
|
||||
$js_messages['strGo'] = __('Go');
|
||||
$js_messages['strCancel'] = __('Cancel');
|
||||
|
||||
@ -21,9 +21,13 @@ $(function() {
|
||||
return /^[0-9]?[0-9,\.]*\s?(k|M|G|T|%)?$/.test(s);
|
||||
},
|
||||
format: function(s) {
|
||||
var num = jQuery.tablesorter.formatFloat( s.replace(PMA_messages['strThousandsSeperator'],'').replace(PMA_messages['strDecimalSeperator'],'.') );
|
||||
var num = jQuery.tablesorter.formatFloat(
|
||||
s.replace(PMA_messages['strThousandsSeperator'],'')
|
||||
.replace(PMA_messages['strDecimalSeperator'],'.')
|
||||
);
|
||||
|
||||
var factor = 1;
|
||||
switch (s.charAt(s.length-1)) {
|
||||
switch (s.charAt(s.length - 1)) {
|
||||
case '%': factor = -2; break;
|
||||
// Todo: Complete this list (as well as in the regexp a few lines up)
|
||||
case 'k': factor = 3; break;
|
||||
@ -31,7 +35,8 @@ $(function() {
|
||||
case 'G': factor = 9; break;
|
||||
case 'T': factor = 12; break;
|
||||
}
|
||||
return num*Math.pow(10,factor);
|
||||
|
||||
return num * Math.pow(10,factor);
|
||||
},
|
||||
type: "numeric"
|
||||
});
|
||||
@ -45,12 +50,16 @@ $(function() {
|
||||
var odd_row=false;
|
||||
var text=''; // Holds filter text
|
||||
var queryPieChart = null;
|
||||
/* Chart configuration */
|
||||
|
||||
/* Chart configuration */
|
||||
// Defines what the tabs are currently displaying (realtime or data)
|
||||
var tabStatus = new Object();
|
||||
// Holds the current chart instances for each tab
|
||||
var tabChart = new Object();
|
||||
|
||||
$.ajaxSetup({
|
||||
cache:false
|
||||
});
|
||||
|
||||
// Add tabs
|
||||
$('#serverStatusTabs').tabs({
|
||||
@ -69,12 +78,23 @@ $(function() {
|
||||
tabStatus[$(this).attr('id')] = 'static';
|
||||
});
|
||||
|
||||
// Handles refresh rate changing
|
||||
$('.statuslinks select').change(function() {
|
||||
var chart=tabChart[$(this).parents('div.ui-tabs-panel').attr('id')];
|
||||
chart.options.realtime.refreshRate = 1000*parseInt(this.value);
|
||||
chart.xAxis[0].setExtremes(new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate, chart.xAxis[0].getExtremes().max, true);
|
||||
|
||||
chart.xAxis[0].setExtremes(
|
||||
new Date().getTime() - chart.options.realtime.numMaxPoints * chart.options.realtime.refreshRate,
|
||||
chart.xAxis[0].getExtremes().max,
|
||||
true
|
||||
);
|
||||
|
||||
// Clear current timeout and set timeout with the new refresh rate
|
||||
clearTimeout(chart_activeTimeouts[chart.options.chart.renderTo]);
|
||||
chart_activeTimeouts[chart.options.chart.renderTo] = setTimeout(chart.options.realtime.timeoutCallBack, chart.options.realtime.refreshRate);
|
||||
chart_activeTimeouts[chart.options.chart.renderTo] = setTimeout(
|
||||
chart.options.realtime.timeoutCallBack,
|
||||
chart.options.realtime.refreshRate
|
||||
);
|
||||
});
|
||||
|
||||
// Ajax refresh of variables (always the first element in each tab)
|
||||
@ -107,26 +127,32 @@ $(function() {
|
||||
|
||||
if(tabstat=='static' || tabstat=='liveconnections') {
|
||||
var settings = {
|
||||
series: [{name:'kB sent since last refresh',data:[]},{name:'kB received since last refresh',data:[]}],
|
||||
title: {text:'Server traffic (in kB)'},
|
||||
realtime:{ url:'server_status.php?'+url_query,
|
||||
series: [
|
||||
{ name: PMA_messages['strChartKBSent'], data: [] },
|
||||
{ name: PMA_messages['strChartKBReceived'], data: [] }
|
||||
],
|
||||
title: { text: PMA_messages['strChartServerTraffic'] },
|
||||
realtime: { url:'server_status.php?' + url_query,
|
||||
type: 'traffic',
|
||||
callback: function(chartObj, curVal, lastVal,numLoadedPoints) {
|
||||
callback: function(chartObj, curVal, lastVal, numLoadedPoints) {
|
||||
if(lastVal==null) return;
|
||||
chartObj.series[0].addPoint(
|
||||
{ x:curVal.x, y:(curVal.y_sent-lastVal.y_sent)/1024},
|
||||
false, numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
{ x: curVal.x, y: (curVal.y_sent - lastVal.y_sent) / 1024 },
|
||||
false,
|
||||
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
);
|
||||
chartObj.series[1].addPoint(
|
||||
{ x:curVal.x, y:(curVal.y_received-lastVal.y_received)/1024},
|
||||
true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
{ x: curVal.x, y: (curVal.y_received - lastVal.y_received) / 1024 },
|
||||
true,
|
||||
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setupLiveChart($tab,this,settings);
|
||||
if(tabstat=='liveconnections') $tab.find('.statuslinks a.liveconnectionsLink').html(PMA_messages['strLiveConnChart']);
|
||||
if(tabstat == 'liveconnections')
|
||||
$tab.find('.statuslinks a.liveconnectionsLink').html(PMA_messages['strLiveConnChart']);
|
||||
tabStatus[$tab.attr('id')]='livetraffic';
|
||||
} else {
|
||||
$(this).html(PMA_messages['strLiveTrafficChart']);
|
||||
@ -141,28 +167,34 @@ $(function() {
|
||||
var $tab=$(this).parents('div.ui-tabs-panel');
|
||||
var tabstat = tabStatus[$tab.attr('id')];
|
||||
|
||||
if(tabstat=='static' || tabstat=='livetraffic') {
|
||||
if(tabstat == 'static' || tabstat == 'livetraffic') {
|
||||
var settings = {
|
||||
series: [{name:'Connections since last refresh', data:[]},{name:'Processes', data:[]}],
|
||||
title: {text:'Connections / Processes'},
|
||||
realtime:{ url:'server_status.php?'+url_query,
|
||||
series: [
|
||||
{ name: PMA_messages['strChartConnections'], data: [] },
|
||||
{ name: PMA_messages['strChartProcesses'], data: [] }
|
||||
],
|
||||
title: { text: PMA_messages['strChartConnectionsTitle'] },
|
||||
realtime: { url:'server_status.php?'+url_query,
|
||||
type: 'proc',
|
||||
callback: function(chartObj, curVal, lastVal,numLoadedPoints) {
|
||||
if(lastVal==null) return;
|
||||
chartObj.series[0].addPoint(
|
||||
{ x:curVal.x, y:curVal.y_conn-lastVal.y_conn },
|
||||
false, numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
{ x: curVal.x, y: curVal.y_conn - lastVal.y_conn },
|
||||
false,
|
||||
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
);
|
||||
chartObj.series[1].addPoint(
|
||||
{ x:curVal.x, y:curVal.y_proc },
|
||||
true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
{ x: curVal.x, y: curVal.y_proc },
|
||||
true,
|
||||
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
setupLiveChart($tab,this,settings);
|
||||
if(tabstat=='livetraffic') $tab.find('.statuslinks a.livetrafficLink').html(PMA_messages['strLiveTrafficChart']);
|
||||
if(tabstat == 'livetraffic')
|
||||
$tab.find('.statuslinks a.livetrafficLink').html(PMA_messages['strLiveTrafficChart']);
|
||||
tabStatus[$tab.attr('id')]='liveconnections';
|
||||
} else {
|
||||
$(this).html(PMA_messages['strLiveConnChart']);
|
||||
@ -172,62 +204,63 @@ $(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
// Live query charting
|
||||
// Live query statistics
|
||||
$('.statuslinks a.livequeriesLink').click(function() {
|
||||
var $tab=$(this).parents('div.ui-tabs-panel');
|
||||
var settings=null;
|
||||
var $tab = $(this).parents('div.ui-tabs-panel');
|
||||
var settings = null;
|
||||
|
||||
if(tabStatus[$tab.attr('id')]=='static') {
|
||||
if(tabStatus[$tab.attr('id')] == 'static') {
|
||||
settings = {
|
||||
series: [{name:'Issued queries since last refresh', data:[]}],
|
||||
title: {text:'Issued queries'},
|
||||
series: [ { name: PMA_messages['strChartIssuedQueries'], data: [] } ],
|
||||
title: { text: PMA_messages['strChartIssuedQueriesTitle'] },
|
||||
tooltip: { formatter:function() { return this.point.name; } },
|
||||
realtime:{ url:'server_status.php?'+url_query,
|
||||
realtime: { url:'server_status.php?'+url_query,
|
||||
type: 'queries',
|
||||
callback: function(chartObj, curVal, lastVal,numLoadedPoints) {
|
||||
if(lastVal==null) return;
|
||||
if(lastVal == null) return;
|
||||
chartObj.series[0].addPoint(
|
||||
{ x:curVal.x, y:curVal.y-lastVal.y, name:sortedQueriesPointInfo(curVal,lastVal) },
|
||||
true, numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
{ x: curVal.x, y: curVal.y - lastVal.y, name: sortedQueriesPointInfo(curVal,lastVal) },
|
||||
true,
|
||||
numLoadedPoints >= chartObj.options.realtime.numMaxPoints
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
$(this).html(PMA_messages['strLiveQueryChart']);
|
||||
}
|
||||
|
||||
setupLiveChart($tab,this,settings);
|
||||
tabStatus[$tab.attr('id')]='livequeries';
|
||||
tabStatus[$tab.attr('id')] = 'livequeries';
|
||||
return false;
|
||||
});
|
||||
|
||||
function setupLiveChart($tab,link,settings) {
|
||||
if(settings!=null) {
|
||||
if(settings != null) {
|
||||
// Loading a chart with existing chart => remove old chart first
|
||||
if(tabStatus[$tab.attr('id')]!='static') {
|
||||
clearTimeout(chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]);
|
||||
chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]=null;
|
||||
if(tabStatus[$tab.attr('id')] != 'static') {
|
||||
clearTimeout(chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]);
|
||||
chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"] = null;
|
||||
tabChart[$tab.attr('id')].destroy();
|
||||
// Also reset the select list
|
||||
$tab.find('.statuslinks select').get(0).selectedIndex=0;
|
||||
$tab.find('.statuslinks select').get(0).selectedIndex = 0;
|
||||
}
|
||||
|
||||
if(!settings.chart) settings.chart = {};
|
||||
settings.chart.renderTo=$tab.attr('id')+"_chart_cnt";
|
||||
if(! settings.chart) settings.chart = {};
|
||||
settings.chart.renderTo = $tab.attr('id') + "_chart_cnt";
|
||||
|
||||
$tab.find('.tabInnerContent')
|
||||
.hide()
|
||||
.after('<div style="clear:both; min-width:500px; height:400px; padding-bottom:80px;" id="'+$tab.attr('id')+'_chart_cnt"></div>');
|
||||
tabChart[$tab.attr('id')]=PMA_createChart(settings);
|
||||
.after('<div class="liveChart" id="' + $tab.attr('id') + '_chart_cnt"></div>');
|
||||
tabChart[$tab.attr('id')] = PMA_createChart(settings);
|
||||
$(link).html(PMA_messages['strStaticData']);
|
||||
$tab.find('.statuslinks a.tabRefresh').hide();
|
||||
$tab.find('.statuslinks select').show();
|
||||
} else {
|
||||
clearTimeout(chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]);
|
||||
chart_activeTimeouts[$tab.attr('id')+"_chart_cnt"]=null;
|
||||
clearTimeout(chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]);
|
||||
chart_activeTimeouts[$tab.attr('id') + "_chart_cnt"]=null;
|
||||
$tab.find('.tabInnerContent').show();
|
||||
$tab.find('div#'+$tab.attr('id')+'_chart_cnt').remove();
|
||||
$tab.find('div#'+$tab.attr('id') + '_chart_cnt').remove();
|
||||
tabStatus[$tab.attr('id')]='static';
|
||||
tabChart[$tab.attr('id')].destroy();
|
||||
$tab.find('.statuslinks a.tabRefresh').show();
|
||||
@ -243,9 +276,10 @@ $(function() {
|
||||
});
|
||||
|
||||
$('#filterText').keyup(function(e) {
|
||||
if($(this).val().length==0) textFilter=null;
|
||||
else textFilter = new RegExp("(^|_)"+$(this).val(),'i');
|
||||
text=$(this).val();
|
||||
if($(this).val().length == 0) textFilter = null;
|
||||
else textFilter = new RegExp("(^|_)" + $(this).val(),'i');
|
||||
|
||||
text = $(this).val();
|
||||
filterVariables();
|
||||
});
|
||||
|
||||
@ -258,11 +292,11 @@ $(function() {
|
||||
function initTab(tab,data) {
|
||||
switch(tab.attr('id')) {
|
||||
case 'statustabs_traffic':
|
||||
if(data!=null) tab.find('.tabInnerContent').html(data);
|
||||
if(data != null) tab.find('.tabInnerContent').html(data);
|
||||
initTooltips();
|
||||
break;
|
||||
case 'statustabs_queries':
|
||||
if(data!=null) {
|
||||
if(data != null) {
|
||||
queryPieChart.destroy();
|
||||
tab.find('.tabInnerContent').html(data);
|
||||
}
|
||||
@ -273,10 +307,9 @@ $(function() {
|
||||
cdata.push([key,parseInt(value)]);
|
||||
});
|
||||
|
||||
queryPieChart=PMA_createChart({
|
||||
queryPieChart = PMA_createChart({
|
||||
chart: {
|
||||
renderTo: 'serverstatusquerieschart'
|
||||
|
||||
},
|
||||
title: {
|
||||
text:'',
|
||||
@ -284,7 +317,7 @@ $(function() {
|
||||
},
|
||||
series: [{
|
||||
type:'pie',
|
||||
name: 'Query statistics',
|
||||
name: PMA_messages['strChartQueryPie'],
|
||||
data: cdata
|
||||
}],
|
||||
plotOptions: {
|
||||
@ -293,20 +326,22 @@ $(function() {
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
formatter: function() {
|
||||
return '<b>'+ this.point.name +'</b><br> '+ Highcharts.numberFormat(this.percentage, 2) +' %';
|
||||
formatter: function() {
|
||||
return '<b>'+ this.point.name +'</b><br/> ' + Highcharts.numberFormat(this.percentage, 2) + ' %';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
formatter: function() { return '<b>'+ this.point.name +'</b><br/>'+Highcharts.numberFormat(this.y, 2)+'<br/>('+Highcharts.numberFormat(this.percentage, 2) +' %)'; }
|
||||
formatter: function() {
|
||||
return '<b>' + this.point.name + '</b><br/>' + Highcharts.numberFormat(this.y, 2) + '<br/>(' + Highcharts.numberFormat(this.percentage, 2) + ' %)';
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case 'statustabs_allvars':
|
||||
if(data!=null) {
|
||||
if(data != null) {
|
||||
tab.find('.tabInnerContent').html(data);
|
||||
filterVariables();
|
||||
}
|
||||
@ -329,7 +364,7 @@ $(function() {
|
||||
});
|
||||
|
||||
$('#serverstatusqueriesdetails tr:first th')
|
||||
.append('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">');
|
||||
.append('<img class="sortableIcon" src="' + pma_theme_image + 'cleardot.gif" alt="">');
|
||||
|
||||
break;
|
||||
|
||||
@ -343,7 +378,7 @@ $(function() {
|
||||
});
|
||||
|
||||
$('#serverstatusvariables tr:first th')
|
||||
.append('<img class="sortableIcon" src="'+pma_theme_image+'cleardot.gif" alt="">');
|
||||
.append('<img class="sortableIcon" src="' + pma_theme_image + 'cleardot.gif" alt="">');
|
||||
|
||||
break;
|
||||
}
|
||||
@ -351,14 +386,14 @@ $(function() {
|
||||
|
||||
/* Filters the status variables by name/category/alert in the variables tab */
|
||||
function filterVariables() {
|
||||
var useful_links=0;
|
||||
var useful_links = 0;
|
||||
var section = text;
|
||||
|
||||
if(categoryFilter.length>0) section = categoryFilter;
|
||||
if(categoryFilter.length > 0) section = categoryFilter;
|
||||
|
||||
if(section.length>1) {
|
||||
if(section.length > 1) {
|
||||
$('#linkSuggestions span').each(function() {
|
||||
if($(this).attr('class').indexOf('status_'+section)!=-1) {
|
||||
if($(this).attr('class').indexOf('status_'+section) != -1) {
|
||||
useful_links++;
|
||||
$(this).css('display','');
|
||||
} else {
|
||||
@ -369,16 +404,16 @@ $(function() {
|
||||
});
|
||||
}
|
||||
|
||||
if(useful_links>0)
|
||||
if(useful_links > 0)
|
||||
$('#linkSuggestions').css('display','');
|
||||
else $('#linkSuggestions').css('display','none');
|
||||
|
||||
odd_row=false;
|
||||
$('#serverstatusvariables th.name').each(function() {
|
||||
if((textFilter==null || textFilter.exec($(this).text()))
|
||||
&& (!alertFilter || $(this).next().find('span.attention').length>0)
|
||||
&& (categoryFilter.length==0 || $(this).parent().hasClass('s_'+categoryFilter))) {
|
||||
odd_row = !odd_row;
|
||||
if((textFilter == null || textFilter.exec($(this).text()))
|
||||
&& (! alertFilter || $(this).next().find('span.attention').length>0)
|
||||
&& (categoryFilter.length == 0 || $(this).parent().hasClass('s_'+categoryFilter))) {
|
||||
odd_row = ! odd_row;
|
||||
$(this).parent().css('display','');
|
||||
if(odd_row) {
|
||||
$(this).parent().addClass('odd');
|
||||
@ -406,22 +441,22 @@ $(function() {
|
||||
if(value-lastQueries.pointInfo[key] > 0) {
|
||||
queryKeys.push(key);
|
||||
queryValues.push(value-lastQueries.pointInfo[key]);
|
||||
sumTotal+=value-lastQueries.pointInfo[key];
|
||||
sumTotal += value-lastQueries.pointInfo[key];
|
||||
}
|
||||
});
|
||||
var numQueries = queryKeys.length;
|
||||
var pointInfo = '<b>' + PMA_messages['strTotal'] + ': ' + sumTotal + '</b><br>';
|
||||
|
||||
while(queryKeys.length > 0) {
|
||||
max=0;
|
||||
for(var i=0; i<queryKeys.length; i++) {
|
||||
max = 0;
|
||||
for(var i=0; i < queryKeys.length; i++) {
|
||||
if(queryValues[i] > max) {
|
||||
max = queryValues[i];
|
||||
maxIdx = i;
|
||||
}
|
||||
}
|
||||
if(numQueries > 8 && num>=6)
|
||||
sumOther+=queryValues[maxIdx];
|
||||
if(numQueries > 8 && num >= 6)
|
||||
sumOther += queryValues[maxIdx];
|
||||
else pointInfo += queryKeys[maxIdx].substr(4).replace('_',' ') + ': ' + queryValues[maxIdx] + '<br>';
|
||||
|
||||
queryKeys.splice(maxIdx,1);
|
||||
|
||||
@ -1,42 +1,92 @@
|
||||
$(function() {
|
||||
var textFilter=null;
|
||||
var odd_row=false;
|
||||
|
||||
// Filter options are invisible for disabled js users
|
||||
$('fieldset#tableFilter').css('display','');
|
||||
|
||||
$('#filterText').keyup(function(e) {
|
||||
if($(this).val().length==0) textFilter=null;
|
||||
else textFilter = new RegExp("(^| )"+$(this).val(),'i');
|
||||
filterVariables();
|
||||
});
|
||||
|
||||
function filterVariables() {
|
||||
odd_row=false;
|
||||
var mark_next=false;
|
||||
var firstCell;
|
||||
|
||||
$('table.filteredData tbody tr').each(function() {
|
||||
firstCell = $(this).children(':first');
|
||||
|
||||
if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) {
|
||||
// If current row is 'marked', also display next row
|
||||
if($(this).hasClass('marked') && !mark_next)
|
||||
mark_next=true;
|
||||
else mark_next=false;
|
||||
|
||||
odd_row = !odd_row;
|
||||
$(this).css('display','');
|
||||
if(odd_row) {
|
||||
$(this).addClass('odd');
|
||||
$(this).removeClass('even');
|
||||
} else {
|
||||
$(this).addClass('even');
|
||||
$(this).removeClass('odd');
|
||||
}
|
||||
} else {
|
||||
$(this).css('display','none');
|
||||
}
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
var textFilter=null;
|
||||
var odd_row=false;
|
||||
var testString = 'abcdefghijklmnopqrstuvwxyz0123456789,ABCEFGHIJKLMOPQRSTUVWXYZ';
|
||||
var $tmpDiv;
|
||||
var charWidth;
|
||||
|
||||
/*** This code snippet takes care that the table stays readable. It cuts off long strings when the window is resized ***/
|
||||
$('table.data').after($tmpDiv=$('<span>'+testString+'</span>'));
|
||||
charWidth = $tmpDiv.width() / testString.length;
|
||||
$tmpDiv.remove();
|
||||
|
||||
$(window).resize(limitTableWidth);
|
||||
limitTableWidth();
|
||||
|
||||
function limitTableWidth() {
|
||||
var fulltext;
|
||||
var charDiff;
|
||||
var maxTableWidth;
|
||||
var $tmpTable;
|
||||
|
||||
$('table.data').after($tmpTable=$('<table id="testTable" style="width:100%;"><tr><td>'+testString+'</td></tr></table>'));
|
||||
maxTableWidth = $('#testTable').width();
|
||||
$tmpTable.remove();
|
||||
charDiff = ($('table.data').width()-maxTableWidth) / charWidth;
|
||||
|
||||
if($('body').innerWidth() < $('table.data').width()+10 || $('body').innerWidth() > $('table.data').width()+20) {
|
||||
var maxChars=0;
|
||||
|
||||
$('table.data tbody tr td:nth-child(2)').each(function() {
|
||||
maxChars=Math.max($(this).text().length,maxChars);
|
||||
});
|
||||
|
||||
// Do not resize smaller if there's only 50 chars displayed already
|
||||
if(charDiff > 0 && maxChars < 50) return;
|
||||
|
||||
$('table.data tbody tr td:nth-child(2)').each(function() {
|
||||
if((charDiff>0 && $(this).text().length > maxChars-charDiff) || (charDiff<0 && $(this).find('abbr.cutoff').length>0)) {
|
||||
if($(this).find('abbr.cutoff').length > 0)
|
||||
fulltext = $(this).find('abbr.cutoff').attr('title');
|
||||
else {
|
||||
fulltext = $(this).text();
|
||||
// Do not cut off elements with html in it and hope they are not too long
|
||||
if(fulltext.length != $(this).html().length) return 0;
|
||||
}
|
||||
|
||||
if(fulltext.length < maxChars-charDiff)
|
||||
$(this).html(fulltext);
|
||||
else $(this).html('<abbr class="cutoff" title="'+fulltext+'">'+fulltext.substr(0,maxChars-charDiff-3)+'...</abbr>');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Filter options are invisible for disabled js users
|
||||
$('fieldset#tableFilter').css('display','');
|
||||
|
||||
$('#filterText').keyup(function(e) {
|
||||
if($(this).val().length==0) textFilter=null;
|
||||
else textFilter = new RegExp("(^| )"+$(this).val(),'i');
|
||||
filterVariables();
|
||||
});
|
||||
|
||||
function filterVariables() {
|
||||
odd_row=false;
|
||||
var mark_next=false;
|
||||
var firstCell;
|
||||
|
||||
$('table.filteredData tbody tr').each(function() {
|
||||
firstCell = $(this).children(':first');
|
||||
|
||||
if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) {
|
||||
// If current row is 'marked', also display next row
|
||||
if($(this).hasClass('marked') && !mark_next)
|
||||
mark_next=true;
|
||||
else mark_next=false;
|
||||
|
||||
odd_row = !odd_row;
|
||||
$(this).css('display','');
|
||||
if(odd_row) {
|
||||
$(this).addClass('odd');
|
||||
$(this).removeClass('even');
|
||||
} else {
|
||||
$(this).addClass('even');
|
||||
$(this).removeClass('odd');
|
||||
}
|
||||
} else {
|
||||
$(this).css('display','none');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
123
js/sql.js
123
js/sql.js
@ -42,12 +42,13 @@ function getFieldName($this_field, disp_mode) {
|
||||
else {
|
||||
var this_field_index = $this_field.index();
|
||||
// ltr or rtl direction does not impact how the DOM was generated
|
||||
//
|
||||
// check if the action column in the left exist
|
||||
var leftActionExist = !$('#table_results').find('th:first').hasClass('draggable');
|
||||
// 5 columns to account for the checkbox, edit, appended inline edit, copy and delete anchors but index is zero-based so substract 4
|
||||
var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-4 )+') a').text();
|
||||
var field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ') a').text();
|
||||
// happens when just one row (headings contain no a)
|
||||
if ("" == field_name) {
|
||||
field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index-4 )+')').text();
|
||||
field_name = $('#table_results').find('thead').find('th:nth('+ (this_field_index - (leftActionExist ? 4 : 0)) + ')').text();
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,6 +212,24 @@ $(document).ready(function() {
|
||||
$("#sqlqueryresults").live('appendAnchor',function() {
|
||||
appendInlineAnchor();
|
||||
})
|
||||
|
||||
/**
|
||||
* Attach the {@link makegrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is reloaded
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$("#sqlqueryresults").live('makegrid', function() {
|
||||
$('#table_results').makegrid();
|
||||
})
|
||||
|
||||
/**
|
||||
* Attach the {@link refreshgrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is manipulated (e.g., by inline edit)
|
||||
* @memberOf jQuery
|
||||
*/
|
||||
$("#sqlqueryresults").live('refreshgrid', function() {
|
||||
$('#table_results').refreshgrid();
|
||||
})
|
||||
|
||||
/**
|
||||
* Trigger the appendAnchor event to prepare the first table for inline edit
|
||||
@ -324,6 +343,7 @@ $(document).ready(function() {
|
||||
$('#sqlqueryresults').show();
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
$('#togglequerybox').show();
|
||||
if($("#togglequerybox").siblings(":visible").length > 0) {
|
||||
$("#togglequerybox").trigger('click');
|
||||
@ -364,6 +384,7 @@ $(document).ready(function() {
|
||||
$.post($the_form.attr('action'), $the_form.serialize(), function(data) {
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
@ -387,6 +408,7 @@ $(document).ready(function() {
|
||||
$.post($the_form.attr('action'), $the_form.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults").html(data);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.post()
|
||||
@ -412,7 +434,8 @@ $(document).ready(function() {
|
||||
$.get($anchor.attr('href'), $anchor.serialize() + '&ajax_request=true', function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.trigger('appendAnchor');
|
||||
.trigger('appendAnchor')
|
||||
.trigger('makegrid');
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
})//end Sort results table
|
||||
@ -431,7 +454,8 @@ $(document).ready(function() {
|
||||
$.post($form.attr('action'), $form.serialize() + '&ajax_request=true' , function(data) {
|
||||
$("#sqlqueryresults")
|
||||
.html(data)
|
||||
.trigger('appendAnchor');
|
||||
.trigger('appendAnchor')
|
||||
.trigger('makegrid');
|
||||
PMA_init_slider();
|
||||
}) // end $.post()
|
||||
})
|
||||
@ -517,21 +541,22 @@ $(document).ready(function() {
|
||||
$this_hide.parent().removeClass("hover noclick");
|
||||
$this_hide.siblings().removeClass("hover");
|
||||
|
||||
var last_column = $this_hide.siblings().length;
|
||||
var $input_siblings = $this_hide.parent('tr').find('.inline_edit');
|
||||
var txt = '';
|
||||
for(var i = 4; i < last_column; i++) {
|
||||
if($this_hide.siblings("td:eq(" + i + ")").hasClass("inline_edit") == false) {
|
||||
continue;
|
||||
$input_siblings.each(function() {
|
||||
var $this_hide_siblings = $(this);
|
||||
txt = $this_hide_siblings.data('original_data');
|
||||
if($this_hide_siblings.children('span').children().length != 0) {
|
||||
$this_hide_siblings.children('span').empty();
|
||||
$this_hide_siblings.children('span').append(txt);
|
||||
}
|
||||
txt = $this_hide.siblings("td:eq(" + i + ")").data('original_data');
|
||||
if($this_hide.siblings("td:eq(" + i + ")").children().length != 0) {
|
||||
$this_hide.siblings("td:eq(" + i + ")").empty();
|
||||
$this_hide.siblings("td:eq(" + i + ")").append(txt);
|
||||
}
|
||||
}
|
||||
});
|
||||
$(this).prev().prev().remove();
|
||||
$(this).prev().remove();
|
||||
$(this).remove();
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
});
|
||||
} else {
|
||||
var txt = '';
|
||||
@ -539,7 +564,8 @@ $(document).ready(function() {
|
||||
|
||||
$('#table_results tbody tr td span a#hide').click(function() {
|
||||
var $hide_a = $(this);
|
||||
var pos = $hide_a.parents('td').index();
|
||||
var $this_hide = $(this).parents('td');
|
||||
var pos = $this_hide.index();
|
||||
|
||||
var $this_span = $hide_a.parent();
|
||||
$this_span.find('a, br').remove();
|
||||
@ -547,22 +573,26 @@ $(document).ready(function() {
|
||||
|
||||
var $this_row = $this_span.parents('tr');
|
||||
// changing inline_edit_active to inline_edit_anchor
|
||||
$this_row.siblings("tr:eq(3) td:eq(" + pos + ")").removeClass("inline_edit_active").addClass("inline_edit_anchor");
|
||||
$this_hide.removeClass("inline_edit_active").addClass("inline_edit_anchor");
|
||||
|
||||
// removing marked and hover classes.
|
||||
$this_row.parent('tbody').find('tr').find("td:eq(" + pos + ")").removeClass("marked hover");
|
||||
|
||||
for( var i = 6; i <= rows + 2; i++){
|
||||
for( var i = 0; i <= rows + 2; i++){
|
||||
if( $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").hasClass("inline_edit") == false) {
|
||||
continue;
|
||||
}
|
||||
txt = $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").data('original_data');
|
||||
$this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").empty();
|
||||
$this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")").append(txt);
|
||||
$this_row_siblings = $this_row.siblings("tr:eq(" + i + ") td:eq(" + pos + ")");
|
||||
txt = $this_row_siblings.data('original_data');
|
||||
$this_row_siblings.children('span').empty();
|
||||
$this_row_siblings.children('span').append(txt);
|
||||
}
|
||||
$(this).prev().remove();
|
||||
$(this).prev().remove();
|
||||
$(this).remove();
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
});
|
||||
}
|
||||
|
||||
@ -594,7 +624,7 @@ $(document).ready(function() {
|
||||
/**
|
||||
* @var data_value Current value of this field
|
||||
*/
|
||||
var data_value = $(this).html();
|
||||
var data_value = $(this).children('span').html();
|
||||
|
||||
// We need to retrieve the value from the server for truncated/relation fields
|
||||
// Find the field name
|
||||
@ -603,6 +633,10 @@ $(document).ready(function() {
|
||||
* @var this_field Object referring to this field (<td>)
|
||||
*/
|
||||
var $this_field = $(this);
|
||||
/**
|
||||
* @var this_field_span Object referring to this field's child (<span>)
|
||||
*/
|
||||
var $this_field_span = $(this).children('span');
|
||||
/**
|
||||
* @var field_name String containing the name of this field.
|
||||
* @see getFieldName()
|
||||
@ -620,11 +654,11 @@ $(document).ready(function() {
|
||||
/**
|
||||
* @var curr_value String current value of the field (for fields that are of type enum or set).
|
||||
*/
|
||||
var curr_value = $this_field.text();
|
||||
var curr_value = $this_field_span.text();
|
||||
|
||||
if($this_field.is(':not(.not_null)')){
|
||||
// add a checkbox to mark null for all the field that are nullable.
|
||||
$this_field.html('<div class="null_div">Null :<input type="checkbox" class="checkbox_null_'+ field_name + '_' + this_row_index +'"></div>');
|
||||
$this_field_span.html('<div class="null_div">Null :<input type="checkbox" class="checkbox_null_'+ field_name + '_' + this_row_index +'"></div>');
|
||||
// check the 'checkbox_null_<field_name>_<row_index>' if the corresponding value is null
|
||||
if($this_field.is('.null')) {
|
||||
$('.checkbox_null_' + field_name + '_' + this_row_index).attr('checked', true);
|
||||
@ -671,15 +705,17 @@ $(document).ready(function() {
|
||||
})
|
||||
|
||||
} else {
|
||||
$this_field.html('<div class="null_div"></div>');
|
||||
$this_field_span.html('<div class="null_div"></div>');
|
||||
}
|
||||
|
||||
// In each input sibling, wrap the current value in a textarea
|
||||
// and store the current value in a hidden span
|
||||
if($this_field.is(':not(.truncated, .transformed, .relation, .enum, .set, .null)')) {
|
||||
// handle non-truncated, non-transformed, non-relation values
|
||||
|
||||
value = data_value.replace("<br>", "\n");
|
||||
// We don't need to get any more data, just wrap the value
|
||||
$this_field.append('<textarea>'+data_value+'</textarea>');
|
||||
$this_field_span.append('<textarea>' + value + '</textarea>');
|
||||
$this_field.data('original_data', data_value);
|
||||
}
|
||||
else if($this_field.is('.truncated, .transformed')) {
|
||||
@ -700,8 +736,9 @@ $(document).ready(function() {
|
||||
'inline_edit' : true
|
||||
}, function(data) {
|
||||
if(data.success == true) {
|
||||
$this_field.append('<textarea>'+data.value+'</textarea>');
|
||||
$this_field_span.append('<textarea>'+data.value+'</textarea>');
|
||||
$this_field.data('original_data', data_value);
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
}
|
||||
else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
@ -727,8 +764,9 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
$.post('sql.php', post_params, function(data) {
|
||||
$this_field.append(data.dropdown);
|
||||
$this_field_span.append(data.dropdown);
|
||||
$this_field.data('original_data', data_value);
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
}) // end $.post()
|
||||
}
|
||||
else if($this_field.is('.enum')) {
|
||||
@ -748,8 +786,9 @@ $(document).ready(function() {
|
||||
'curr_value' : curr_value
|
||||
}
|
||||
$.post('sql.php', post_params, function(data) {
|
||||
$this_field.append(data.dropdown);
|
||||
$this_field_span.append(data.dropdown);
|
||||
$this_field.data('original_data', data_value);
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
}) // end $.post()
|
||||
}
|
||||
else if($this_field.is('.set')) {
|
||||
@ -770,16 +809,21 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
$.post('sql.php', post_params, function(data) {
|
||||
$this_field.append(data.select);
|
||||
$this_field_span.append(data.select);
|
||||
$this_field.data('original_data', data_value);
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
}) // end $.post()
|
||||
}
|
||||
else if($this_field.is('.null')) {
|
||||
//handle null fields
|
||||
$this_field.append('<textarea></textarea>');
|
||||
$this_field_span.append('<textarea></textarea>');
|
||||
$this_field.data('original_data', 'NULL');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
|
||||
}) // End On click, replace the current field with an input/textarea
|
||||
|
||||
/**
|
||||
@ -801,7 +845,7 @@ $(document).ready(function() {
|
||||
* being edited
|
||||
*
|
||||
*/
|
||||
var $this_td = $(this).parent().parent();
|
||||
var $this_td = $(this).parents('td');
|
||||
var $test_element = ''; // to test the presence of a element
|
||||
|
||||
// Initialize variables
|
||||
@ -1043,10 +1087,11 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
|
||||
$input_siblings.each(function() {
|
||||
// Inline edit post has been successful.
|
||||
$this_sibling = $(this);
|
||||
$this_sibling_span = $(this).children('span');
|
||||
|
||||
var is_null = $this_sibling.find('input:checkbox').is(':checked');
|
||||
if (is_null) {
|
||||
$this_sibling.html('NULL');
|
||||
$this_sibling_span.html('NULL');
|
||||
$this_sibling.addClass('null');
|
||||
} else {
|
||||
$this_sibling.removeClass('null');
|
||||
@ -1106,9 +1151,12 @@ function PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings,
|
||||
}
|
||||
}
|
||||
}
|
||||
$this_sibling.html(new_html);
|
||||
$this_sibling_span.html(new_html);
|
||||
}
|
||||
})
|
||||
|
||||
// refresh the grid
|
||||
$("#sqlqueryresults").trigger('refreshgrid');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1155,6 +1203,11 @@ $(document).ready(function() {
|
||||
$('.column_heading.marker').live('click', function() {
|
||||
PMA_changeClassForColumn($(this), 'marked');
|
||||
});
|
||||
|
||||
/**
|
||||
* create resizable table
|
||||
*/
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@ -67,6 +67,7 @@ $(document).ready(function() {
|
||||
// found results
|
||||
$("#sqlqueryresults").html(response);
|
||||
$("#sqlqueryresults").trigger('appendAnchor');
|
||||
$("#sqlqueryresults").trigger('makegrid');
|
||||
$('#tbl_search_form')
|
||||
// work around for bug #3168569 - Issue on toggling the "Hide search criteria" in chrome.
|
||||
.slideToggle()
|
||||
|
||||
@ -14,7 +14,7 @@ require_once './libraries/Message.class.php';
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
class RecentTable
|
||||
class PMA_RecentTable
|
||||
{
|
||||
/**
|
||||
* Defines the internal PMA table which contains recent tables.
|
||||
@ -33,9 +33,9 @@ class RecentTable
|
||||
public $tables;
|
||||
|
||||
/**
|
||||
* RecentTable instance.
|
||||
* PMA_RecentTable instance.
|
||||
*
|
||||
* @var RecentTable
|
||||
* @var PMA_RecentTable
|
||||
*/
|
||||
private static $_instance;
|
||||
|
||||
@ -56,12 +56,12 @@ class RecentTable
|
||||
/**
|
||||
* Returns class instance.
|
||||
*
|
||||
* @return RecentTable
|
||||
* @return PMA_RecentTable
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(self::$_instance)) {
|
||||
self::$_instance = new RecentTable();
|
||||
self::$_instance = new PMA_RecentTable();
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
@ -12,9 +12,10 @@
|
||||
class PMA_Table
|
||||
{
|
||||
/**
|
||||
* UI preferences property: sorted column
|
||||
* UI preferences properties
|
||||
*/
|
||||
const PROP_SORTED_COLUMN = 'sorted_col';
|
||||
const PROP_COLUMN_ORDER = 'col_order';
|
||||
|
||||
static $cache = array();
|
||||
|
||||
@ -1195,6 +1196,27 @@ class PMA_Table
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all columns
|
||||
*
|
||||
* returns an array with all columns
|
||||
*
|
||||
* @param boolean whether to quote name with backticks ``
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns($backquoted = true)
|
||||
{
|
||||
$sql = 'SHOW COLUMNS FROM ' . $this->getFullName(true);
|
||||
$indexed = PMA_DBI_fetch_result($sql, 'Field', 'Field');
|
||||
|
||||
$return = array();
|
||||
foreach ($indexed as $column) {
|
||||
$return[] = $this->getFullName($backquoted) . '.' . ($backquoted ? PMA_backquote($column) : $column);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return UI preferences for this table from phpMyAdmin database.
|
||||
*
|
||||
@ -1275,26 +1297,12 @@ class PMA_Table
|
||||
$this->uiprefs =& $_SESSION['tmp_user_values']['table_uiprefs'][$this->db_name][$this->name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get UI preferences array for this table.
|
||||
* If pmadb and table_uiprefs is set, it will get the UI preferences from
|
||||
* phpMyAdmin database.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUiPrefs()
|
||||
{
|
||||
if (! isset($this->uiprefs)) {
|
||||
$this->loadUiPrefs();
|
||||
}
|
||||
return $this->uiprefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a property from UI preferences.
|
||||
* Return false if the property is not found.
|
||||
* Available property:
|
||||
* - PROP_SORTED_COLUMN
|
||||
* - PROP_COLUMN_ORDER
|
||||
*
|
||||
* @uses loadUiPrefs()
|
||||
*
|
||||
@ -1306,6 +1314,42 @@ class PMA_Table
|
||||
if (! isset($this->uiprefs)) {
|
||||
$this->loadUiPrefs();
|
||||
}
|
||||
// do checking based on property
|
||||
if ($property == self::PROP_SORTED_COLUMN) {
|
||||
if (isset($this->uiprefs[$property])) {
|
||||
// check if the column name is exist in this table
|
||||
$tmp = explode(' ', $this->uiprefs[$property]);
|
||||
$colname = $tmp[0];
|
||||
$avail_columns = $this->getColumns();
|
||||
foreach ($avail_columns as $each_col) {
|
||||
// check if $each_col ends with $colname
|
||||
if (substr_compare($each_col, $colname,
|
||||
strlen($each_col) - strlen($colname)) === 0) {
|
||||
return $this->uiprefs[$property];
|
||||
}
|
||||
}
|
||||
// remove the property, since it is not exist anymore in database
|
||||
$this->removeUiProp(self::PROP_SORTED_COLUMN);
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if ($property == self::PROP_COLUMN_ORDER) {
|
||||
if (isset($this->uiprefs[$property])) {
|
||||
// check if the table has not been modified
|
||||
if (self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME') ==
|
||||
$this->uiprefs['CREATE_TIME']) {
|
||||
return $this->uiprefs[$property];
|
||||
} else {
|
||||
// remove the property, since the table has been modified
|
||||
$this->removeUiProp(self::PROP_COLUMN_ORDER);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// default behaviour for other property:
|
||||
return isset($this->uiprefs[$property]) ? $this->uiprefs[$property] : false;
|
||||
}
|
||||
|
||||
@ -1313,16 +1357,34 @@ class PMA_Table
|
||||
* Set a property from UI preferences.
|
||||
* If pmadb and table_uiprefs is set, it will save the UI preferences to
|
||||
* phpMyAdmin database.
|
||||
* Available property:
|
||||
* - PROP_SORTED_COLUMN
|
||||
* - PROP_COLUMN_ORDER
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
* @return true|PMA_Message
|
||||
* @param string $table_create_time Needed for PROP_COLUMN_ORDER
|
||||
* @return boolean|PMA_Message
|
||||
*/
|
||||
public function setUiProp($property, $value)
|
||||
public function setUiProp($property, $value, $table_create_time = NULL)
|
||||
{
|
||||
if (! isset($this->uiprefs)) {
|
||||
$this->loadUiPrefs();
|
||||
}
|
||||
// we want to save the create time if the property is PROP_COLUMN_ORDER
|
||||
if ($property == self::PROP_COLUMN_ORDER) {
|
||||
$curr_create_time = self::sGetStatusInfo($this->db_name, $this->name, 'CREATE_TIME');
|
||||
if (isset($table_create_time) &&
|
||||
$table_create_time == $curr_create_time) {
|
||||
$this->uiprefs['CREATE_TIME'] = $curr_create_time;
|
||||
} else {
|
||||
// there is no $table_create_time, or
|
||||
// supplied $table_create_time is older than current create time,
|
||||
// so don't save
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// save the value
|
||||
$this->uiprefs[$property] = $value;
|
||||
// check if pmadb is set
|
||||
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
|
||||
@ -1331,5 +1393,25 @@ class PMA_Table
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a property from UI preferences.
|
||||
*
|
||||
* @param string $property
|
||||
*/
|
||||
public function removeUiProp($property)
|
||||
{
|
||||
if (! isset($this->uiprefs)) {
|
||||
$this->loadUiPrefs();
|
||||
}
|
||||
if (isset($this->uiprefs[$property])) {
|
||||
unset($this->uiprefs[$property]);
|
||||
// check if pmadb is set
|
||||
if (strlen($GLOBALS['cfg']['Server']['pmadb'])
|
||||
&& strlen($GLOBALS['cfg']['Server']['table_uiprefs'])) {
|
||||
return $this->saveUiprefsToDb();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -288,7 +288,7 @@ class PMA_Theme_Manager
|
||||
$theme_preview_href = '<a href="' . $theme_preview_path . '" target="themes" onclick="'
|
||||
. "window.open('" . $theme_preview_path . "','themes','left=10,top=20,width=510,height=350,scrollbars=yes,status=yes,resizable=yes');"
|
||||
. '">';
|
||||
$select_box .= $theme_preview_href . __('Theme / Style') . '</a>:' . "\n";
|
||||
$select_box .= $theme_preview_href . __('Theme') . '</a>:' . "\n";
|
||||
|
||||
$select_box .= '<select name="set_theme" xml:lang="en" dir="ltr"'
|
||||
.' onchange="this.form.submit();" >';
|
||||
|
||||
@ -1032,6 +1032,22 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
|
||||
// Analyze it
|
||||
if (isset($parsed_sql)) {
|
||||
$analyzed_display_query = PMA_SQP_analyze($parsed_sql);
|
||||
|
||||
// Same as below (append LIMIT), append the remembered ORDER BY
|
||||
if ($GLOBALS['cfg']['RememberSorting']
|
||||
&& isset($analyzed_display_query[0]['queryflags']['select_from'])
|
||||
&& isset($GLOBALS['sql_order_to_append'])) {
|
||||
$query_base = $analyzed_display_query[0]['section_before_limit']
|
||||
. "\n" . $GLOBALS['sql_order_to_append']
|
||||
. $analyzed_display_query[0]['section_after_limit'];
|
||||
|
||||
// Need to reparse query
|
||||
$parsed_sql = PMA_SQP_parse($query_base);
|
||||
// update the $analyzed_display_query
|
||||
$analyzed_display_query[0]['section_before_limit'] .= $GLOBALS['sql_order_to_append'];
|
||||
$analyzed_display_query[0]['order_by_clause'] = $GLOBALS['sorted_col'];
|
||||
}
|
||||
|
||||
// Here we append the LIMIT added for navigation, to
|
||||
// enable its display. Adding it higher in the code
|
||||
// to $sql_query would create a problem when
|
||||
|
||||
@ -184,6 +184,25 @@ function PMA_setDisplayMode(&$the_disp_mode, &$the_total)
|
||||
} // end of the 'PMA_setDisplayMode()' function
|
||||
|
||||
|
||||
/**
|
||||
* Return true if we are executing a query in the form of
|
||||
* "SELECT * FROM <a table> ..."
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function PMA_isSelect()
|
||||
{
|
||||
// global variables set from sql.php
|
||||
global $is_count, $is_export, $is_func, $is_analyse;
|
||||
global $analyzed_sql;
|
||||
|
||||
return ! ($is_count || $is_export || $is_func || $is_analyse)
|
||||
&& count($analyzed_sql[0]['select_expr']) == 0
|
||||
&& isset($analyzed_sql[0]['queryflags']['select_from'])
|
||||
&& count($analyzed_sql[0]['table_ref']) == 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a navigation button
|
||||
*
|
||||
@ -374,6 +393,26 @@ function PMA_displayTableNavigation($pos_next, $pos_prev, $sql_query, $id_for_di
|
||||
);
|
||||
} // end move toward
|
||||
?>
|
||||
<td>
|
||||
<input class="restore_column hide" type="submit" value="<?php echo __('Restore column order'); ?>" />
|
||||
<?php
|
||||
if (PMA_isSelect()) {
|
||||
// generate the column order, if it is set
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
if ($col_order) {
|
||||
echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />';
|
||||
}
|
||||
// generate table create time
|
||||
echo '<input id="table_create_time" type="hidden" value="' .
|
||||
PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'CREATE_TIME') . '" />';
|
||||
}
|
||||
// generate hints
|
||||
echo '<input id="col_order_hint" type="hidden" value="' . __('Drag to reorder') . '" />';
|
||||
echo '<input id="sort_hint" type="hidden" value="' . __('Click to sort') . '" />';
|
||||
echo '<input id="col_mark_hint" type="hidden" value="' . __('Click to mark/unmark') . '" />';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@ -695,7 +734,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
// ... elseif display an empty column if the actions links are disabled to match the rest of the table
|
||||
elseif ($GLOBALS['cfg']['RowActionLinks'] == 'none' && ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped')) {
|
||||
echo '<td></td>';
|
||||
echo '<th></th>';
|
||||
}
|
||||
|
||||
// 2. Displays the fields' name
|
||||
@ -735,7 +774,17 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $fields_cnt; $i++) {
|
||||
if (PMA_isSelect()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||
// assign $i with appropriate column order
|
||||
$i = $col_order ? $col_order[$j] : $j;
|
||||
// See if this column should get highlight because it's used in the
|
||||
// where-query.
|
||||
if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) {
|
||||
@ -870,6 +919,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
|
||||
echo '<th';
|
||||
$th_class = array();
|
||||
$th_class[] = 'draggable';
|
||||
if ($condition_field) {
|
||||
$th_class[] = 'condition';
|
||||
}
|
||||
@ -888,7 +938,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
echo '>' . $order_link . $comments . '</th>';
|
||||
}
|
||||
$vertical_display['desc'][] = ' <th '
|
||||
. ($condition_field ? ' class="condition"' : '') . '>' . "\n"
|
||||
. 'class="draggable' . ($condition_field ? ' condition' : '') . '">' . "\n"
|
||||
. $order_link . $comments . ' </th>' . "\n";
|
||||
} // end if (2.1)
|
||||
|
||||
@ -897,9 +947,12 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal'
|
||||
|| $_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
|
||||
echo '<th';
|
||||
$th_class = array();
|
||||
$th_class[] = 'draggable';
|
||||
if ($condition_field) {
|
||||
echo ' class="condition"';
|
||||
$th_class[] = 'condition';
|
||||
}
|
||||
echo ' class="' . implode(' ', $th_class) . '"';
|
||||
if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontalflipped') {
|
||||
echo ' valign="bottom"';
|
||||
}
|
||||
@ -917,7 +970,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $
|
||||
echo "\n" . $comments . '</th>';
|
||||
}
|
||||
$vertical_display['desc'][] = ' <th '
|
||||
. ($condition_field ? ' class="condition"' : '') . '>' . "\n"
|
||||
. 'class="draggable' . ($condition_field ? ' condition"' : '') . '">' . "\n"
|
||||
. ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n"
|
||||
. $comments . ' </th>';
|
||||
} // end else (2.2)
|
||||
@ -1150,6 +1203,8 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
if ($vertical_display['emptypre'] > 0) {
|
||||
echo ' <th colspan="' . $vertical_display['emptypre'] . '">' . "\n"
|
||||
.' </th>' . "\n";
|
||||
} else if ($GLOBALS['cfg']['RowActionLinks'] == 'none') {
|
||||
echo ' <th></th>' . "\n";
|
||||
}
|
||||
|
||||
foreach ($vertical_display['desc'] as $val) {
|
||||
@ -1285,7 +1340,19 @@ function PMA_displayTableBody(&$dt_result, &$is_display, $map, $analyzed_sql) {
|
||||
} // end if (1)
|
||||
|
||||
// 2. Displays the rows' values
|
||||
for ($i = 0; $i < $fields_cnt; ++$i) {
|
||||
|
||||
if (PMA_isSelect()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
for ($j = 0; $j < $fields_cnt; ++$j) {
|
||||
// assign $i with appropriate column order
|
||||
$i = $col_order ? $col_order[$j] : $j;
|
||||
|
||||
$meta = $fields_meta[$i];
|
||||
$not_null_class = $meta->not_null ? 'not_null' : '';
|
||||
$relation_class = isset($map[$meta->name]) ? 'relation' : '';
|
||||
@ -1652,8 +1719,18 @@ function PMA_displayVerticalTable()
|
||||
echo '</tr>' . "\n";
|
||||
} // end if
|
||||
|
||||
if (PMA_isSelect()) {
|
||||
// prepare to get the column order, if available
|
||||
$pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
|
||||
$col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
|
||||
} else {
|
||||
$col_order = false;
|
||||
}
|
||||
|
||||
// Displays data
|
||||
foreach ($vertical_display['desc'] AS $key => $val) {
|
||||
foreach ($vertical_display['desc'] AS $j => $val) {
|
||||
// assign appropriate key with current column order
|
||||
$key = $col_order ? $col_order[$j] : $j;
|
||||
|
||||
echo '<tr>' . "\n";
|
||||
echo $val;
|
||||
|
||||
@ -19,7 +19,7 @@ require_once './libraries/RecentTable.class.php';
|
||||
* @param string $table The table name
|
||||
*/
|
||||
function PMA_addRecentTable($db, $table) {
|
||||
$tmp_result = RecentTable::getInstance()->add($db, $table);
|
||||
$tmp_result = PMA_RecentTable::getInstance()->add($db, $table);
|
||||
if ($tmp_result === true) {
|
||||
echo '<span class="hide" id="update_recent_tables"></span>';
|
||||
} else {
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* string $anchor: anchor to the documentation page
|
||||
* string $chapter: chapter of "HTML, one page per chapter" documentation
|
||||
* string $type: type of system variable
|
||||
* string $format: if set to 'byte' it will format the variable with PMA_formatByteDown()
|
||||
*/
|
||||
$VARIABLE_DOC_LINKS = array();
|
||||
$VARIABLE_DOC_LINKS['auto_increment_increment'] = array('auto_increment_increment','replication-options-master','sysvar');
|
||||
@ -16,11 +17,11 @@ $VARIABLE_DOC_LINKS['back_log'] = array('back_log','server-system-variables','sy
|
||||
$VARIABLE_DOC_LINKS['basedir'] = array('basedir','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['big_tables'] = array('big-tables','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['bind_address'] = array('bind-address','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['binlog_cache_size'] = array('binlog_cache_size','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['binlog_cache_size'] = array('binlog_cache_size','replication-options-binary-log','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['binlog_direct_non_transactional_updates'] = array('binlog_direct_non_transactional_updates','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['binlog_format'] = array('binlog-format','server-options','sysvar');
|
||||
$VARIABLE_DOC_LINKS['binlog_stmt_cache_size'] = array('binlog_stmt_cache_size','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['bulk_insert_buffer_size'] = array('bulk_insert_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['binlog_stmt_cache_size'] = array('binlog_stmt_cache_size','replication-options-binary-log','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['bulk_insert_buffer_size'] = array('bulk_insert_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['character_set_client'] = array('character_set_client','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['character_set_connection'] = array('character_set_connection','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['character_set_database'] = array('character_set_database','server-system-variables','sysvar');
|
||||
@ -84,11 +85,11 @@ $VARIABLE_DOC_LINKS['init_file'] = array('init-file','server-options','option_my
|
||||
$VARIABLE_DOC_LINKS['init_slave'] = array('init_slave','replication-options-slave','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_adaptive_flushing'] = array('innodb_adaptive_flushing','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_adaptive_hash_index'] = array('innodb_adaptive_hash_index','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_additional_mem_pool_size'] = array('innodb_additional_mem_pool_size','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_additional_mem_pool_size'] = array('innodb_additional_mem_pool_size','innodb-parameters','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['innodb_autoextend_increment'] = array('innodb_autoextend_increment','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_autoinc_lock_mode'] = array('innodb_autoinc_lock_mode','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_buffer_pool_instances'] = array('innodb_buffer_pool_instances','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_buffer_pool_size'] = array('innodb_buffer_pool_size','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_buffer_pool_size'] = array('innodb_buffer_pool_size','innodb-parameters','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['innodb_change_buffering'] = array('innodb_change_buffering','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_checksums'] = array('innodb_checksums','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_commit_concurrency'] = array('innodb_commit_concurrency','innodb-parameters','sysvar');
|
||||
@ -107,8 +108,8 @@ $VARIABLE_DOC_LINKS['innodb_force_recovery'] = array('innodb_force_recovery','in
|
||||
$VARIABLE_DOC_LINKS['innodb_io_capacity'] = array('innodb_io_capacity','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_lock_wait_timeout'] = array('innodb_lock_wait_timeout','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_locks_unsafe_for_binlog'] = array('innodb_locks_unsafe_for_binlog','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_buffer_size'] = array('innodb_log_buffer_size','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_file_size'] = array('innodb_log_file_size','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_buffer_size'] = array('innodb_log_buffer_size','innodb-parameters','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_file_size'] = array('innodb_log_file_size','innodb-parameters','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_files_in_group'] = array('innodb_log_files_in_group','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_log_group_home_dir'] = array('innodb_log_group_home_dir','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['innodb_max_dirty_pages_pct'] = array('innodb_max_dirty_pages_pct','innodb-parameters','sysvar');
|
||||
@ -138,15 +139,15 @@ $VARIABLE_DOC_LINKS['innodb_version'] = array('innodb_version','innodb-parameter
|
||||
$VARIABLE_DOC_LINKS['innodb_write_io_threads'] = array('innodb_write_io_threads','innodb-parameters','sysvar');
|
||||
$VARIABLE_DOC_LINKS['insert_id'] = array('insert_id','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['interactive_timeout'] = array('interactive_timeout','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['join_buffer_size'] = array('join_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['join_buffer_size'] = array('join_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['keep_files_on_create'] = array('keep_files_on_create','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['key_buffer_size'] = array('key_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['key_buffer_size'] = array('key_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['key_cache_age_threshold'] = array('key_cache_age_threshold','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['key_cache_block_size'] = array('key_cache_block_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['key_cache_block_size'] = array('key_cache_block_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['key_cache_division_limit'] = array('key_cache_division_limit','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['language'] = array('language','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['large_files_support'] = array('large_files_support','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['large_page_size'] = array('large_page_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['large_page_size'] = array('large_page_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['large_pages'] = array('large-pages','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['last_insert_id'] = array('last_insert_id','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['lc_messages'] = array('lc-messages','server-options','option_mysqld');
|
||||
@ -172,19 +173,19 @@ $VARIABLE_DOC_LINKS['lower_case_file_system'] = array('lower_case_file_system','
|
||||
$VARIABLE_DOC_LINKS['lower_case_table_names'] = array('lower_case_table_names','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['master-bind'] = array('','replication-options',0);
|
||||
$VARIABLE_DOC_LINKS['max_allowed_packet'] = array('max_allowed_packet','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_cache_size'] = array('max_binlog_cache_size','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_size'] = array('max_binlog_size','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_stmt_cache_size'] = array('max_binlog_stmt_cache_size','replication-options-binary-log','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_cache_size'] = array('max_binlog_cache_size','replication-options-binary-log','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_size'] = array('max_binlog_size','replication-options-binary-log','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['max_binlog_stmt_cache_size'] = array('max_binlog_stmt_cache_size','replication-options-binary-log','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['max_connect_errors'] = array('max_connect_errors','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_connections'] = array('max_connections','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_delayed_threads'] = array('max_delayed_threads','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_error_count'] = array('max_error_count','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_heap_table_size'] = array('max_heap_table_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_heap_table_size'] = array('max_heap_table_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['max_insert_delayed_threads'] = array('max_insert_delayed_threads','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_join_size'] = array('max_join_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_length_for_sort_data'] = array('max_length_for_sort_data','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_prepared_stmt_count'] = array('max_prepared_stmt_count','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_relay_log_size'] = array('max_relay_log_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_relay_log_size'] = array('max_relay_log_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['max_seeks_for_key'] = array('max_seeks_for_key','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_sort_length'] = array('max_sort_length','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['max_sp_recursion_depth'] = array('max_sp_recursion_depth','server-system-variables','sysvar');
|
||||
@ -193,12 +194,12 @@ $VARIABLE_DOC_LINKS['max_user_connections'] = array('max_user_connections','serv
|
||||
$VARIABLE_DOC_LINKS['max_write_lock_count'] = array('max_write_lock_count','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['memlock'] = array('memlock','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['min_examined_row_limit'] = array('min-examined-row-limit','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['myisam_data_pointer_size'] = array('myisam_data_pointer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_max_sort_file_size'] = array('myisam_max_sort_file_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_mmap_size'] = array('myisam_mmap_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_data_pointer_size'] = array('myisam_data_pointer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['myisam_max_sort_file_size'] = array('myisam_max_sort_file_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['myisam_mmap_size'] = array('myisam_mmap_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['myisam_recover_options'] = array('myisam_recover_options','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_repair_threads'] = array('myisam_repair_threads','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_sort_buffer_size'] = array('myisam_sort_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_sort_buffer_size'] = array('myisam_sort_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['myisam_stats_method'] = array('myisam_stats_method','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['myisam_use_mmap'] = array('myisam_use_mmap','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['named_pipe'] = array('named_pipe','server-system-variables','sysvar');
|
||||
@ -234,25 +235,25 @@ $VARIABLE_DOC_LINKS['performance_schema_max_thread_instances'] = array('performa
|
||||
$VARIABLE_DOC_LINKS['pid_file'] = array('pid-file','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['plugin_dir'] = array('plugin_dir','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['port'] = array('port','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['preload_buffer_size'] = array('preload_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['preload_buffer_size'] = array('preload_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['profiling'] = array('profiling','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['profiling_history_size'] = array('profiling_history_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['protocol_version'] = array('protocol_version','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['proxy_user'] = array('proxy_user','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['pseudo_thread_id'] = array('pseudo_thread_id','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_alloc_block_size'] = array('query_alloc_block_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_alloc_block_size'] = array('query_alloc_block_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['query_cache_limit'] = array('query_cache_limit','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_cache_min_res_unit'] = array('query_cache_min_res_unit','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_cache_size'] = array('query_cache_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_cache_size'] = array('query_cache_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['query_cache_type'] = array('query_cache_type','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_cache_wlock_invalidate'] = array('query_cache_wlock_invalidate','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_prealloc_size'] = array('query_prealloc_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['query_prealloc_size'] = array('query_prealloc_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['rand_seed1'] = array('rand_seed1','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['rand_seed2'] = array('rand_seed2','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['range_alloc_block_size'] = array('range_alloc_block_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['read_buffer_size'] = array('read_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['range_alloc_block_size'] = array('range_alloc_block_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['read_buffer_size'] = array('read_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['read_only'] = array('read_only','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['read_rnd_buffer_size'] = array('read_rnd_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['read_rnd_buffer_size'] = array('read_rnd_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['relay-log-index'] = array('relay-log-index','replication-options-slave','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['relay_log_index'] = array('relay_log_index','replication-options-slave','sysvar');
|
||||
$VARIABLE_DOC_LINKS['relay_log_info_file'] = array('relay_log_info_file','replication-options-slave','sysvar');
|
||||
@ -291,7 +292,7 @@ $VARIABLE_DOC_LINKS['slow_launch_time'] = array('slow_launch_time','server-syste
|
||||
$VARIABLE_DOC_LINKS['slow_query_log'] = array('slow-query-log','server-options','server-system-variables');
|
||||
$VARIABLE_DOC_LINKS['slow_query_log_file'] = array('slow_query_log_file','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['socket'] = array('socket','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['sort_buffer_size'] = array('sort_buffer_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['sort_buffer_size'] = array('sort_buffer_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['sql_auto_is_null'] = array('sql_auto_is_null','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['sql_big_selects'] = array('sql_big_selects','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['sql_big_tables'] = array('big-tables','server-options','server-system-variables');
|
||||
@ -332,10 +333,10 @@ $VARIABLE_DOC_LINKS['time_format'] = array('time_format','server-system-variable
|
||||
$VARIABLE_DOC_LINKS['time_zone'] = array('time_zone','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['timed_mutexes'] = array('timed_mutexes','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['timestamp'] = array('timestamp','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['tmp_table_size'] = array('tmp_table_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['tmp_table_size'] = array('tmp_table_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['tmpdir'] = array('tmpdir','server-options','option_mysqld');
|
||||
$VARIABLE_DOC_LINKS['transaction_alloc_block_size'] = array('transaction_alloc_block_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['transaction_prealloc_size'] = array('transaction_prealloc_size','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['transaction_alloc_block_size'] = array('transaction_alloc_block_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['transaction_prealloc_size'] = array('transaction_prealloc_size','server-system-variables','sysvar','byte');
|
||||
$VARIABLE_DOC_LINKS['tx_isolation'] = array('tx_isolation','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['unique_checks'] = array('unique_checks','server-system-variables','sysvar');
|
||||
$VARIABLE_DOC_LINKS['updatable_views_with_limit'] = array('updatable_views_with_limit','server-system-variables','sysvar');
|
||||
|
||||
@ -59,7 +59,7 @@ require_once './libraries/RecentTable.class.php';
|
||||
* Check if it is an ajax request to reload the recent tables list.
|
||||
*/
|
||||
if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) {
|
||||
PMA_ajaxResponse('', true, array('options' => RecentTable::getInstance()->getHtmlSelectOption()) );
|
||||
PMA_ajaxResponse('', true, array('options' => PMA_RecentTable::getInstance()->getHtmlSelectOption()) );
|
||||
}
|
||||
|
||||
// keep the offset of the db list in session before closing it
|
||||
@ -195,7 +195,7 @@ require './libraries/navigation_header.inc.php';
|
||||
// display recently used tables
|
||||
if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
|
||||
echo '<div id="recentTableList">';
|
||||
echo RecentTable::getInstance()->getHtmlSelect();
|
||||
echo PMA_RecentTable::getInstance()->getHtmlSelect();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
1508
po/be@latin.po
1508
po/be@latin.po
File diff suppressed because it is too large
Load Diff
1496
po/en_GB.po
1496
po/en_GB.po
File diff suppressed because it is too large
Load Diff
1278
po/phpmyadmin.pot
1278
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
1515
po/pt_BR.po
1515
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1498
po/sr@latin.po
1498
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
1404
po/uz@latin.po
1404
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
1436
po/zh_CN.po
1436
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1593
po/zh_TW.po
1593
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# vim: expandtab sw=4 ts=4 sts=4:
|
||||
export LC_COLLATE=C
|
||||
export LANG=C
|
||||
LOCS=`ls po/*.po | sed 's@.*/\(.*\)\.po@\1@'`
|
||||
xgettext \
|
||||
-d phpmyadmin \
|
||||
@ -12,7 +12,7 @@ xgettext \
|
||||
--debug \
|
||||
--keyword=__ --keyword=_pgettext:1c,2 --keyword=_ngettext:1,2 \
|
||||
--copyright-holder="phpMyAdmin devel team" \
|
||||
`find . -name '*.php' | sort`
|
||||
`find . -name '*.php' -not -path './test/*' | sort`
|
||||
|
||||
ver=`sed -n "/PMA_VERSION', '/ s/.*PMA_VERSION', '\(.*\)'.*/\1/p" libraries/Config.class.php`
|
||||
|
||||
|
||||
@ -1698,7 +1698,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
|
||||
|
||||
unset ($row);
|
||||
echo ' <fieldset id="fieldset_add_user">' . "\n"
|
||||
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n"
|
||||
. ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1" class="' . $conditional_class . '">' . "\n"
|
||||
. PMA_getIcon('b_usradd.png')
|
||||
. ' ' . __('Add user') . '</a>' . "\n"
|
||||
. ' </fieldset>' . "\n";
|
||||
|
||||
@ -14,6 +14,7 @@ require_once './libraries/common.inc.php';
|
||||
* Does the common work
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
|
||||
require_once './libraries/server_common.inc.php';
|
||||
|
||||
@ -15,21 +15,35 @@ if (! defined('PMA_NO_VARIABLES_IMPORT')) {
|
||||
define('PMA_NO_VARIABLES_IMPORT', true);
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true)
|
||||
$GLOBALS['is_header_sent'] = true;
|
||||
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
/**
|
||||
* Function to output refresh rate selection.
|
||||
*/
|
||||
function PMA_choose_refresh_rate() {
|
||||
echo '<option value="5">' . __('Refresh rate') . '</option>';
|
||||
foreach(array(1, 2, 5, 1, 20, 40, 60, 120, 300, 600) as $key => $rate) {
|
||||
if ($rate % 60 == 0) {
|
||||
$minrate = $rate / 60;
|
||||
echo '<option value="' . $rate . '">' . sprintf(_ngettext('%d minute', '%d minutes', $minrate), $minrate) . '</option>';
|
||||
} else {
|
||||
echo '<option value="' . $rate . '">' . sprintf(_ngettext('%d second', '%d seconds', $rate), $rate) . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax request
|
||||
*/
|
||||
|
||||
// Prevent ajax requests from being cached
|
||||
if (isset($_REQUEST['ajax_request'])) {
|
||||
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||
header_remove('Last-Modified');
|
||||
if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) {
|
||||
// Send with correct charset
|
||||
header('Content-Type: text/html; charset=UTF-8');
|
||||
|
||||
if (isset($_REQUEST["query_chart"])) {
|
||||
exit(createQueryChart());
|
||||
}
|
||||
// real-time charting data
|
||||
if(isset($_REQUEST['chart_data'])) {
|
||||
switch($_REQUEST['type']) {
|
||||
case 'proc':
|
||||
@ -37,20 +51,38 @@ if (isset($_REQUEST['ajax_request'])) {
|
||||
$result = PMA_DBI_query('SHOW PROCESSLIST');
|
||||
$num_procs = PMA_DBI_num_rows($result);
|
||||
|
||||
$ret = Array('x'=>(microtime(true)*1000),'y_proc'=>$num_procs,'y_conn'=>$c['Connections']);
|
||||
$ret = array(
|
||||
'x' => microtime(true)*1000,
|
||||
'y_proc' => $num_procs,
|
||||
'y_conn' => $c['Connections']
|
||||
);
|
||||
|
||||
exit(json_encode($ret));
|
||||
case 'queries':
|
||||
$queries = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name LIKE "Com_%" AND Value>0', 0, 1);
|
||||
cleanDeprecated($queries);
|
||||
// admin commands are not queries
|
||||
unset($queries['Com_admin_commands']);
|
||||
|
||||
$sum=array_sum($queries);
|
||||
$ret = Array('x'=>(microtime(true)*1000),'y'=>$sum,'pointInfo'=>$queries);
|
||||
$ret = array(
|
||||
'x' => microtime(true)*1000,
|
||||
'y' => $sum,
|
||||
'pointInfo' => $queries
|
||||
);
|
||||
|
||||
exit(json_encode($ret));
|
||||
case 'traffic':
|
||||
$traffic = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name="Bytes_received" OR Variable_name="Bytes_sent"', 0, 1);
|
||||
$ret = Array('x'=>(microtime(true)*1000),'y_sent'=>$traffic['Bytes_sent'],'y_received'=>$traffic['Bytes_received']);
|
||||
|
||||
$ret = array(
|
||||
'x' => microtime(true)*1000,
|
||||
'y_sent' => $traffic['Bytes_sent'],
|
||||
'y_received' => $traffic['Bytes_received']
|
||||
);
|
||||
|
||||
exit(json_encode($ret));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,6 +105,7 @@ $GLOBALS['js_include'][] = 'jquery/jquery.cookie.js'; // For tab persistence
|
||||
$GLOBALS['js_include'][] = 'highcharts/highcharts.js';
|
||||
/* Files required for chart exporting */
|
||||
$GLOBALS['js_include'][] = 'highcharts/exporting.js';
|
||||
$GLOBALS['js_include'][] = 'canvg/flashcanvas.js';
|
||||
$GLOBALS['js_include'][] = 'canvg/canvg.js';
|
||||
$GLOBALS['js_include'][] = 'canvg/rgbcolor.js';
|
||||
|
||||
@ -291,17 +324,17 @@ $links['innodb']['doc'] = 'innodb';
|
||||
|
||||
|
||||
// Variable to contain all com_ variables
|
||||
$used_queries = Array();
|
||||
$used_queries = array();
|
||||
|
||||
// Variable to map variable names to their respective section name (used for js category filtering)
|
||||
$allocationMap = Array();
|
||||
$allocationMap = array();
|
||||
|
||||
// sort vars into arrays
|
||||
foreach ($server_status as $name => $value) {
|
||||
foreach ($allocations as $filter => $section) {
|
||||
if (strpos($name, $filter) !== FALSE) {
|
||||
$allocationMap[$name] = $section;
|
||||
if($section=='com' && $value>0) $used_queries[$name] = $value;
|
||||
if($section == 'com' && $value > 0) $used_queries[$name] = $value;
|
||||
break; // Only exits inner loop
|
||||
}
|
||||
}
|
||||
@ -376,17 +409,7 @@ echo __('Runtime Information');
|
||||
<?php echo __('Refresh'); ?>
|
||||
</a>
|
||||
<select name="trafficChartRefresh" style="display:none;">
|
||||
<option value="5"><?php echo __('Refresh rate'); ?></option>
|
||||
<option value="1">1 <?php echo __('second'); ?></option>
|
||||
<option value="2">2 <?php echo __('seconds'); ?></option>
|
||||
<option value="5">5 <?php echo __('seconds'); ?></option>
|
||||
<option value="10">10 <?php echo __('seconds'); ?></option>
|
||||
<option value="20">20 <?php echo __('seconds'); ?></option>
|
||||
<option value="40">40 <?php echo __('seconds'); ?></option>
|
||||
<option value="60">1 <?php echo __('minutes'); ?></option>
|
||||
<option value="120">2 <?php echo __('minutes'); ?></option>
|
||||
<option value="300">5 <?php echo __('minutes'); ?></option>
|
||||
<option value="600">10 <?php echo __('minutes'); ?></option>
|
||||
<?php PMA_choose_refresh_rate(); ?>
|
||||
</select>
|
||||
|
||||
<a class="tabChart livetrafficLink" href="#">
|
||||
@ -394,6 +417,8 @@ echo __('Runtime Information');
|
||||
</a>
|
||||
<a class="tabChart liveconnectionsLink" href="#">
|
||||
<?php echo __('Live conn./process chart'); ?>
|
||||
|
||||
|
||||
</a>
|
||||
</div>
|
||||
<div class="tabInnerContent">
|
||||
@ -407,17 +432,7 @@ echo __('Runtime Information');
|
||||
<?php echo __('Refresh'); ?>
|
||||
</a>
|
||||
<select name="queryChartRefresh" style="display:none;">
|
||||
<option value="5"><?php echo __('Refresh rate'); ?></option>
|
||||
<option value="1">1 <?php echo __('second'); ?></option>
|
||||
<option value="2">2 <?php echo __('seconds'); ?></option>
|
||||
<option value="5">5 <?php echo __('seconds'); ?></option>
|
||||
<option value="10">10 <?php echo __('seconds'); ?></option>
|
||||
<option value="20">20 <?php echo __('seconds'); ?></option>
|
||||
<option value="40">40 <?php echo __('seconds'); ?></option>
|
||||
<option value="60">1 <?php echo __('minutes'); ?></option>
|
||||
<option value="120">2 <?php echo __('minutes'); ?></option>
|
||||
<option value="300">5 <?php echo __('minutes'); ?></option>
|
||||
<option value="600">10 <?php echo __('minutes'); ?></option>
|
||||
<?php PMA_choose_refresh_rate(); ?>
|
||||
</select>
|
||||
<a class="tabChart livequeriesLink" href="#">
|
||||
<?php echo __('Live query chart'); ?>
|
||||
@ -448,7 +463,7 @@ echo __('Runtime Information');
|
||||
<select id="filterCategory" name="filterCategory">
|
||||
<option value=''><?php echo __('Filter by category...'); ?></option>
|
||||
<?php
|
||||
foreach($sections as $section_id=>$section_name) {
|
||||
foreach($sections as $section_id => $section_name) {
|
||||
?>
|
||||
<option value='<?php echo $section_id; ?>'><?php echo $section_name; ?></option>
|
||||
<?php
|
||||
@ -465,7 +480,7 @@ echo __('Runtime Information');
|
||||
echo '<span class="status_'.$section_name.'"> ';
|
||||
$i=0;
|
||||
foreach ($section_links as $link_name => $link_url) {
|
||||
if($i>0) echo ', ';
|
||||
if($i > 0) echo ', ';
|
||||
if ('doc' == $link_name) {
|
||||
echo PMA_showMySQLDocu($link_url, $link_url);
|
||||
} else {
|
||||
@ -491,30 +506,32 @@ echo __('Runtime Information');
|
||||
function printQueryStatistics() {
|
||||
global $server_status, $used_queries, $url_query, $PMA_PHP_SELF;
|
||||
|
||||
$hour_factor = 3600 / $server_status['Uptime'];
|
||||
$hour_factor = 3600 / $server_status['Uptime'];
|
||||
|
||||
$total_queries = array_sum($used_queries);
|
||||
|
||||
?>
|
||||
<h3 id="serverstatusqueries"><?php echo
|
||||
//sprintf(__('<b>Query statistics</b>: Since its startup, %s queries have been sent to the server.'),
|
||||
//PMA_formatNumber($server_status['Questions'], 0));
|
||||
sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0));
|
||||
//echo PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_Questions');
|
||||
<h3 id="serverstatusqueries">
|
||||
<?php
|
||||
echo sprintf('Queries since startup: %s',PMA_formatNumber($total_queries, 0));
|
||||
?>
|
||||
<br>
|
||||
<span style="font-size:60%; display:inline;">
|
||||
ø <?php echo __('per hour'); ?>:
|
||||
<?php echo PMA_formatNumber($total_queries * $hour_factor, 0); ?><br>
|
||||
<br>
|
||||
<span>
|
||||
<?php
|
||||
echo 'ø'.__('per hour').':';
|
||||
echo PMA_formatNumber($total_queries * $hour_factor, 0);
|
||||
echo '<br>';
|
||||
|
||||
ø <?php echo __('per minute'); ?>:
|
||||
<?php echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0); ?><br>
|
||||
|
||||
<?php if($total_queries / $server_status['Uptime'] >= 1) {
|
||||
?>
|
||||
ø <?php echo __('per second'); ?>:
|
||||
<?php echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0); ?><br>
|
||||
echo 'ø'.__('per minute').':';
|
||||
echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0);
|
||||
echo '<br>';
|
||||
|
||||
if($total_queries / $server_status['Uptime'] >= 1) {
|
||||
echo 'ø'.__('per second').':';
|
||||
echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0);
|
||||
?>
|
||||
</span><br>
|
||||
</h3>
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -522,11 +539,11 @@ function printQueryStatistics() {
|
||||
arsort($used_queries);
|
||||
|
||||
$odd_row = true;
|
||||
$count_displayed_rows = 0;
|
||||
$perc_factor = 100 / $total_queries //(- $server_status['Connections']);
|
||||
$count_displayed_rows = 0;
|
||||
$perc_factor = 100 / $total_queries; //(- $server_status['Connections']);
|
||||
|
||||
?>
|
||||
</h3>
|
||||
|
||||
<table id="serverstatusqueriesdetails" class="data sortable">
|
||||
<col class="namecol" />
|
||||
<col class="valuecol" span="3" />
|
||||
@ -543,7 +560,7 @@ function printQueryStatistics() {
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
$chart_json = Array();
|
||||
$chart_json = array();
|
||||
$query_sum = array_sum($used_queries);
|
||||
$other_sum = 0;
|
||||
foreach ($used_queries as $name => $value) {
|
||||
@ -552,7 +569,7 @@ function printQueryStatistics() {
|
||||
// For the percentage column, use Questions - Connections, because
|
||||
// the number of connections is not an item of the Query types
|
||||
// but is included in Questions. Then the total of the percentages is 100.
|
||||
$name = str_replace(Array('Com_','_'), Array('',' '), $name);
|
||||
$name = str_replace(Array('Com_', '_'), Array('', ' '), $name);
|
||||
|
||||
if($value < $query_sum * 0.02)
|
||||
$other_sum += $value;
|
||||
@ -572,21 +589,12 @@ function printQueryStatistics() {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="serverstatusquerieschart" style="width:500px; height:350px; ">
|
||||
<div id="serverstatusquerieschart">
|
||||
<?php
|
||||
/*// Generate the graph if this is an ajax request
|
||||
if(isset($_REQUEST['ajax_request'])) {
|
||||
echo createQueryChart();
|
||||
} else {
|
||||
echo '<a href="'.$PMA_PHP_SELF.'?'.$url_query.'&query_chart=1#serverstatusqueries"'
|
||||
.'title="' . __('Show query chart') . '">['.__('Show query chart').']</a>';
|
||||
}*/
|
||||
|
||||
if($other_sum>0)
|
||||
if($other_sum > 0)
|
||||
$chart_json[__('Other')] = $other_sum;
|
||||
|
||||
echo json_encode($chart_json);
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
@ -605,10 +613,11 @@ function printServerTraffic() {
|
||||
'SELECT UNIX_TIMESTAMP() - ' . $server_status['Uptime']);
|
||||
|
||||
?>
|
||||
<h3><?php /* echo __('<b>Server traffic</b>: These tables show the network traffic statistics of this MySQL server since its startup.');*/
|
||||
echo sprintf(__('Network traffic since startup: %s'),
|
||||
implode(' ', PMA_formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1))
|
||||
);
|
||||
<h3><?php
|
||||
echo sprintf(
|
||||
__('Network traffic since startup: %s'),
|
||||
implode(' ', PMA_formatByteDown( $server_status['Bytes_received'] + $server_status['Bytes_sent'], 3, 1))
|
||||
);
|
||||
?>
|
||||
</h3>
|
||||
|
||||
@ -630,7 +639,7 @@ function printServerTraffic() {
|
||||
} elseif ($server_slave_status) {
|
||||
echo __('This MySQL server works as <b>slave</b> in <b>replication</b> process.');
|
||||
}
|
||||
echo __('For further information about replication status on the server, please visit the <a href=#replication>replication section</a>.');
|
||||
echo __('For further information about replication status on the server, please visit the <a href="#replication">replication section</a>.');
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
@ -785,7 +794,7 @@ function printServerTraffic() {
|
||||
<th><?php echo __('Status'); ?></th>
|
||||
<th><?php
|
||||
echo __('SQL query');
|
||||
if (!PMA_DRIZZLE) { ?>
|
||||
if (! PMA_DRIZZLE) { ?>
|
||||
<a href="<?php echo $full_text_link; ?>"
|
||||
title="<?php echo empty($full) ? __('Show Full Queries') : __('Truncate Shown Queries'); ?>">
|
||||
<img src="<?php echo $GLOBALS['pmaThemeImage'] . 's_' . (empty($_REQUEST['full']) ? 'full' : 'partial'); ?>text.png"
|
||||
@ -836,7 +845,7 @@ function printVariablesTable() {
|
||||
/**
|
||||
* Messages are built using the message name
|
||||
*/
|
||||
$strShowStatus = Array(
|
||||
$strShowStatus = array(
|
||||
'Aborted_connects' => __('The number of failed attempts to connect to the MySQL server.'),
|
||||
'Binlog_cache_disk_use' => __('The number of transactions that used the temporary binary log cache but that exceeded the value of binlog_cache_size and used a temporary file to store statements from the transaction.'),
|
||||
'Binlog_cache_use' => __('The number of transactions that used the temporary binary log cache.'),
|
||||
@ -1014,19 +1023,12 @@ function printVariablesTable() {
|
||||
<th><?php echo __('Description'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!--<tfoot>
|
||||
<tr class="tblFooters">
|
||||
<th colspan="3" class="tblFooters">
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>-->
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$odd_row = false;
|
||||
foreach ($server_status as $name => $value) {
|
||||
$odd_row = !$odd_row;
|
||||
// $allocations
|
||||
?>
|
||||
<tr class="noclick <?php echo $odd_row ? 'odd' : 'even'; echo isset($allocationMap[$name])?' s_'.$allocationMap[$name]:''; ?>">
|
||||
<th class="name"><?php echo htmlspecialchars($name) . PMA_showMySQLDocu('server-status-variables', 'server-status-variables', false, 'statvar_' . $name); ?>
|
||||
@ -1082,38 +1084,6 @@ function printVariablesTable() {
|
||||
<?php
|
||||
}
|
||||
|
||||
function createQueryChart($com_vars=FALSE) {
|
||||
/**
|
||||
* Chart generation
|
||||
*/
|
||||
require_once './libraries/chart.lib.php';
|
||||
|
||||
if(!$com_vars)
|
||||
$com_vars = PMA_DBI_fetch_result("SHOW GLOBAL STATUS LIKE 'Com\_%'", 0, 1);
|
||||
|
||||
// admin commands are not queries (e.g. they include COM_PING, which is excluded from $server_status['Questions'])
|
||||
unset($com_vars['Com_admin_commands']);
|
||||
|
||||
arsort($com_vars);
|
||||
|
||||
$merge_minimum = array_sum($com_vars) * 0.005;
|
||||
$merged_value = 0;
|
||||
|
||||
// remove zero values from the end, as well as merge together every value that is below 0.5%
|
||||
// variable empty for Drizzle
|
||||
if ($com_vars) {
|
||||
while (($last_element=end($com_vars)) <= $merge_minimum) {
|
||||
array_pop($com_vars);
|
||||
$merged_value += $last_element;
|
||||
}
|
||||
|
||||
$com_vars['Other'] = $merged_value;
|
||||
return PMA_chart_status($com_vars);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* cleanup of some deprecated values
|
||||
*/
|
||||
|
||||
@ -86,8 +86,10 @@ foreach ($serverVars as $name => $value) {
|
||||
<th nowrap="nowrap">
|
||||
<?php echo htmlspecialchars(str_replace('_', ' ', $name)); ?></th>
|
||||
<td class="value"><?php
|
||||
if (strlen($value) < 16 && is_numeric($value)) {
|
||||
echo PMA_formatNumber($value, 0);
|
||||
if (is_numeric($value)) {
|
||||
if(isset($VARIABLE_DOC_LINKS[$name][3]) && $VARIABLE_DOC_LINKS[$name][3]=='byte')
|
||||
echo '<abbr title="'.PMA_formatNumber($value, 0).'">'.implode(' ',PMA_formatByteDown($value,3,3)).'</abbr>';
|
||||
else echo PMA_formatNumber($value, 0);
|
||||
$is_numeric = true;
|
||||
} else {
|
||||
echo htmlspecialchars($value);
|
||||
|
||||
23
sql.php
23
sql.php
@ -159,6 +159,17 @@ if(isset($_REQUEST['get_set_values']) && $_REQUEST['get_set_values'] == true) {
|
||||
$extra_data['select'] = $select;
|
||||
PMA_ajaxResponse(NULL, true, $extra_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check ajax request to set the column order
|
||||
*/
|
||||
if(isset($_REQUEST['set_col_order']) && $_REQUEST['set_col_order'] == true) {
|
||||
$pmatable = new PMA_Table($table, $db);
|
||||
$col_order = explode(',', $_REQUEST['col_order']);
|
||||
$retval = $pmatable->setUiProp(PMA_Table::PROP_COLUMN_ORDER, $col_order, $_REQUEST['table_create_time']);
|
||||
PMA_ajaxResponse(NULL, ($retval == true));
|
||||
}
|
||||
|
||||
// Default to browse if no query set and we have table
|
||||
// (needed for browsing from DefaultTabTable)
|
||||
if (empty($sql_query) && strlen($table) && strlen($db)) {
|
||||
@ -363,10 +374,13 @@ if ($is_select) { // see line 141
|
||||
$is_maint = true;
|
||||
}
|
||||
|
||||
// assign default full_sql_query
|
||||
$full_sql_query = $sql_query;
|
||||
|
||||
// Handle remembered sorting order, only for single table query
|
||||
if ($GLOBALS['cfg']['RememberSorting']
|
||||
&& basename($GLOBALS['PMA_PHP_SELF']) == 'sql.php'
|
||||
&& ! ($is_count || $is_export || $is_func || $is_analyse)
|
||||
&& count($analyzed_sql[0]['select_expr']) == 0
|
||||
&& isset($analyzed_sql[0]['queryflags']['select_from'])
|
||||
&& count($analyzed_sql[0]['table_ref']) == 1
|
||||
) {
|
||||
@ -376,7 +390,7 @@ if ($GLOBALS['cfg']['RememberSorting']
|
||||
if ($sorted_col) {
|
||||
// retrieve the remembered sorting order for current table
|
||||
$sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
|
||||
$sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append . $analyzed_sql[0]['section_after_limit'];
|
||||
$full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append . $analyzed_sql[0]['section_after_limit'];
|
||||
|
||||
// update the $analyzed_sql
|
||||
$analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;
|
||||
@ -412,9 +426,7 @@ if ((! $cfg['ShowAll'] || $_SESSION['tmp_user_values']['max_rows'] != 'all')
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$full_sql_query = $sql_query;
|
||||
} // end if...else
|
||||
}
|
||||
|
||||
if (strlen($db)) {
|
||||
PMA_DBI_select_db($db);
|
||||
@ -846,6 +858,7 @@ else {
|
||||
} else {
|
||||
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
|
||||
unset($message);
|
||||
|
||||
@ -65,6 +65,7 @@ PMA_DBI_select_db($GLOBALS['db']);
|
||||
*/
|
||||
$goto_include = false;
|
||||
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
// Needed for generation of Inline Edit anchors
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
|
||||
@ -423,7 +424,8 @@ if (! empty($error_messages)) {
|
||||
unset($error_messages, $warning_messages, $total_affected_rows, $last_messages, $last_message);
|
||||
|
||||
if($GLOBALS['is_ajax_request'] == true) {
|
||||
|
||||
/**Get the total row count of the table*/
|
||||
$extra_data['row_count'] = PMA_Table::countRecords($_REQUEST['db'],$_REQUEST['table']);
|
||||
$extra_data['sql_query'] = PMA_showMessage(NULL, $GLOBALS['display_query']);
|
||||
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
require_once './libraries/common.inc.php';
|
||||
require_once './libraries/mysql_charsets.lib.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
$GLOBALS['js_include'][] = 'tbl_select.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
|
||||
@ -14,6 +14,7 @@ require_once './libraries/common.inc.php';
|
||||
* Runs common work
|
||||
*/
|
||||
$GLOBALS['js_include'][] = 'functions.js';
|
||||
$GLOBALS['js_include'][] = 'makegrid.js';
|
||||
$GLOBALS['js_include'][] = 'sql.js';
|
||||
|
||||
require './libraries/tbl_common.php';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user