' . "\n";
- echo '
' . $table . ' ' . "\n";
+ echo '
' . htmlspecialchars($table) . ' ' . "\n";
/**
* Gets table informations
@@ -204,7 +204,7 @@ while ($row = PMA_DBI_fetch_row($rowset)) {
} else {
$row['Default'] = htmlspecialchars($row['Default']);
}
- $field_name = htmlspecialchars($row['Field']);
+ $field_name = $row['Field'];
if (PMA_MYSQL_INT_VERSION < 50025
&& ! empty($analyzed_sql[0]['create_table_fields'][$field_name]['type'])
@@ -226,9 +226,9 @@ while ($row = PMA_DBI_fetch_row($rowset)) {
' . $field_name . '';
+ echo '' . htmlspecialchars($field_name) . ' ';
} else {
- echo $field_name;
+ echo htmlspecialchars($field_name);
}
?>
diff --git a/db_search.php b/db_search.php
index c0f2c082af..6242a53d9b 100644
--- a/db_search.php
+++ b/db_search.php
@@ -128,8 +128,7 @@ if (isset($_REQUEST['submit_search'])) {
$sqlstr_delete = 'DELETE';
// Fields to select
- $tblfields = PMA_DBI_fetch_result('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']),
- null, 'Field');
+ $tblfields = PMA_DBI_get_columns($GLOBALS['db'], $table);
// Table to use
$sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
@@ -148,8 +147,8 @@ if (isset($_REQUEST['submit_search'])) {
$thefieldlikevalue = array();
foreach ($tblfields as $tblfield) {
- if (! isset($field) || strlen($field) == 0 || $tblfield == $field) {
- $thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield) . ' USING utf8)'
+ if (! isset($field) || strlen($field) == 0 || $tblfield['Field'] == $field) {
+ $thefieldlikevalue[] = 'CONVERT(' . PMA_backquote($tblfield['Field']) . ' USING utf8)'
. ' ' . $like_or_regex . ' '
. "'" . $automatic_wildcard
. $search_word
diff --git a/index.php b/index.php
index 5e0fa3619a..9add876131 100644
--- a/index.php
+++ b/index.php
@@ -69,7 +69,7 @@ $lang_iso_code = $GLOBALS['available_languages'][$GLOBALS['lang']][1];
// start output
-include ('./libraries/header_http.inc.php');
+include './libraries/header_http.inc.php';
?>
diff --git a/js/codemirror/mode/mysql/mysql.js b/js/codemirror/mode/mysql/mysql.js
index 657942d2cd..755e3ec85d 100644
--- a/js/codemirror/mode/mysql/mysql.js
+++ b/js/codemirror/mode/mysql/mysql.js
@@ -1,11 +1,14 @@
CodeMirror.defineMode("mysql", function(config, parserConfig) {
var indentUnit = config.indentUnit,
keywords = parserConfig.keywords,
+ verbs = parserConfig.verbs,
functions = parserConfig.functions,
types = parserConfig.types,
- attributes = parserConfig.attributes,
- multiLineStrings = parserConfig.multiLineStrings;
+ attributes = parserConfig.attributes,
+ multiLineStrings = parserConfig.multiLineStrings,
+ multiPartKeywords= parserConfig.multiPartKeywords;
var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
+
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
@@ -64,14 +67,35 @@ CodeMirror.defineMode("mysql", function(config, parserConfig) {
else {
// get the whole word
stream.eatWhile(/[\w\$_]/);
+ var word = stream.current().toLowerCase();
+ var oldPos = stream.pos;
+ // is it one of the listed verbs?
+ if (verbs && verbs.propertyIsEnumerable(word)) return ret("keyword", "statement-verb");
// is it one of the listed keywords?
- if (keywords && keywords.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "keyword");
+ if (keywords && keywords.propertyIsEnumerable(word)) return ret("keyword", "keyword");
// is it one of the listed functions?
- if (functions && functions.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "builtin");
+ if (functions && functions.propertyIsEnumerable(word)) {
+ // All functions begin with '('
+ stream.eatSpace();
+ if(stream.peek() == '(')
+ return ret("keyword", "builtin");
+ // Not func => restore old pos
+ stream.pos = oldPos;
+ }
// is it one of the listed types?
- if (types && types.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-2");
+ if (types && types.propertyIsEnumerable(word)) return ret("keyword", "variable-2");
// is it one of the listed attributes?
- if (attributes && attributes.propertyIsEnumerable(stream.current().toLowerCase())) return ret("keyword", "variable-3");
+ if (attributes && attributes.propertyIsEnumerable(word)) return ret("keyword", "variable-3");
+ // is it a multipart keyword? (currently only checks 2 word parts)
+
+ stream.eatSpace();
+ stream.eatWhile(/[\w\$_]/);
+ var doubleWord = stream.current().toLowerCase();
+ if (multiPartKeywords && multiPartKeywords.propertyIsEnumerable(doubleWord)) return ret("keyword", "keyword");
+
+ // restore old pos
+ stream.pos = oldPos;
+
// default: just a "word"
return ret("word", "mysql-word");
}
@@ -122,11 +146,14 @@ CodeMirror.defineMode("mysql", function(config, parserConfig) {
(function() {
function keywords(str) {
- var obj = {}, words = str.split(" ");
+ var obj = {}, words = str;
+ if(typeof str == 'string') words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
- var cKeywords = "accessible add all alter analyze and as asc asensitive before between bigint binary blob both by call cascade case change char character check collate column condition constraint continue convert create cross current_date current_time current_timestamp current_user cursor database databases day_hour day_microsecond day_minute day_second dec decimal declare default delayed delete desc describe deterministic distinct distinctrow div double drop dual each else elseif enclosed escaped exists exit explain false fetch float float4 float8 for force foreign from fulltext grant group having high_priority hour_microsecond hour_minute hour_second if ignore in index infile inner inout insensitive insert int int1 int2 int3 int4 int8 integer interval into is iterate join key keys kill leading leave left like limit linear lines load localtime localtimestamp lock long longblob longtext loop low_priority master_ssl_verify_server_cert match maxvalue mediumblob mediumint mediumtext middleint minute_microsecond minute_second mod modifies natural not no_write_to_binlog null numeric on optimize option optionally or order out outer outfile precision primary procedure purge range read reads read_write real references regexp release rename repeat replace require resignal restrict return revoke right rlike schema schemas second_microsecond select sensitive separator set show signal smallint spatial specific sql sqlexception sqlstate sqlwarning sql_big_result sql_calc_found_rows sql_small_result ssl starting straight_join table terminated then tinyblob tinyint tinytext to trailing trigger true undo union unique unlock unsigned update usage use using utc_date utc_time utc_timestamp values varbinary varchar varcharacter varying when where while with write xor year_month zerofill";
+ var cKeywords = "accessible add all and as asc asensitive before between bigint binary blob both cascade case char character collate column condition constraint continue convert cross current_date current_time current_timestamp current_user cursor database databases day_hour day_microsecond day_minute day_second dec decimal declare default delayed desc deterministic distinct distinctrow div double dual each else elseif enclosed escaped exists exit explain false fetch float float4 float8 for force foreign fulltext from having high_priority hour_microsecond hour_minute hour_second if ignore in index infile inner inout insensitive int int1 int2 int3 int4 int8 integer interval is iterate join key keys leading leave left like limit linear lines localtime localtimestamp long longblob longtext loop low_priority master_ssl_verify_server_cert match maxvalue mediumblob mediumint mediumtext middleint minute_microsecond minute_second mod modifies natural not no_write_to_binlog null numeric on option optionally or out outer outfile precision primary procedure range read reads read_write real references regexp repeat require restrict return right rlike schema schemas second_microsecond sensitive separator smallint spatial specific sql sqlexception sqlstate sqlwarning sql_big_result sql_calc_found_rows sql_small_result ssl starting straight_join table terminated then tinyblob tinyint tinytext to trailing trigger true undo union unique unsigned usage using utc_date utc_time utc_timestamp values varbinary varchar varcharacter varying when where while with write xor year_month zerofill";
+
+ var cVerbs = "alter analyze begin binlog call change check checksum commit create deallocate describe do drop execute flush grant handler install kill load lock optimize cache partition prepare purge release rename repair replace reset resignal revoke rollback savepoint select set signal show start truncate uninstall unlock update use xa";
var cFunctions = "abs acos adddate addtime aes_decrypt aes_encrypt area asbinary ascii asin astext atan atan2 avg bdmpolyfromtext bdmpolyfromwkb bdpolyfromtext bdpolyfromwkb benchmark bin bit_and bit_count bit_length bit_or bit_xor boundary buffer cast ceil ceiling centroid char character_length charset char_length coalesce coercibility collation compress concat concat_ws connection_id contains conv convert convert_tz convexhull cos cot count crc32 crosses curdate current_date current_time current_timestamp current_user curtime database date datediff date_add date_diff date_format date_sub day dayname dayofmonth dayofweek dayofyear decode default degrees des_decrypt des_encrypt difference dimension disjoint distance elt encode encrypt endpoint envelope equals exp export_set exteriorring extract extractvalue field find_in_set floor format found_rows from_days from_unixtime geomcollfromtext geomcollfromwkb geometrycollection geometrycollectionfromtext geometrycollectionfromwkb geometryfromtext geometryfromwkb geometryn geometrytype geomfromtext geomfromwkb get_format get_lock glength greatest group_concat group_unique_users hex hour if ifnull inet_aton inet_ntoa insert instr interiorringn intersection intersects interval isclosed isempty isnull isring issimple is_free_lock is_used_lock last_day last_insert_id lcase least left length linefromtext linefromwkb linestring linestringfromtext linestringfromwkb ln load_file localtime localtimestamp locate log log10 log2 lower lpad ltrim makedate maketime make_set master_pos_wait max mbrcontains mbrdisjoint mbrequal mbrintersects mbroverlaps mbrtouches mbrwithin md5 microsecond mid min minute mlinefromtext mlinefromwkb mod month monthname mpointfromtext mpointfromwkb mpolyfromtext mpolyfromwkb multilinestring multilinestringfromtext multilinestringfromwkb multipoint multipointfromtext multipointfromwkb multipolygon multipolygonfromtext multipolygonfromwkb name_const now nullif numgeometries numinteriorrings numpoints oct octet_length old_password ord overlaps password period_add period_diff pi point pointfromtext pointfromwkb pointn pointonsurface polyfromtext polyfromwkb polygon polygonfromtext polygonfromwkb position pow power quarter quote radians rand related release_lock repeat replace reverse right round row_count rpad rtrim schema second sec_to_time session_user sha sha1 sign sin sleep soundex space sqrt srid startpoint std stddev stddev_pop stddev_samp strcmp str_to_date subdate substr substring substring_index subtime sum symdifference sysdate system_user tan time timediff timestamp timestampadd timestampdiff time_format time_to_sec touches to_days trim truncate ucase uncompress uncompressed_length unhex unique_users unix_timestamp updatexml upper user utc_date utc_time utc_timestamp uuid variance var_pop var_samp version week weekday weekofyear within x y year yearweek";
@@ -134,11 +161,15 @@ CodeMirror.defineMode("mysql", function(config, parserConfig) {
var cAttributes = "archive ascii auto_increment bdb berkeleydb binary blackhole csv default example federated heap innobase innodb isam maria memory merge mrg_isam mrg_myisam myisam national ndb ndbcluster precision undefined unicode unsigned varying zerofill";
+ var cmultiPartKeywords = ['insert into', 'group by', 'order by', 'delete from'];
+
CodeMirror.defineMIME("text/x-mysql", {
name: "mysql",
keywords: keywords(cKeywords),
+ multiPartKeywords: keywords(cmultiPartKeywords),
+ verbs: keywords(cVerbs),
functions: keywords(cFunctions),
types: keywords(cTypes),
attributes: keywords(cAttributes)
});
-}());
+}());
\ No newline at end of file
diff --git a/js/functions.js b/js/functions.js
index 9f0b7f5ec6..022cb808c1 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1617,7 +1617,13 @@ function PMA_createProfilingChart(data, options)
},options));
}
-// Formats a profiling duration nicely. Used in PMA_createProfilingChart() and server_status.js
+/**
+ * Formats a profiling duration nicely (in us and ms time). Used in PMA_createProfilingChart() and server_status.js
+ *
+ * @param integer Number to be formatted, should be in the range of microsecond to second
+ * @param integer Acuracy, how many numbers right to the comma should be
+ * @return string The formatted number
+ */
function PMA_prettyProfilingNum(num, acc)
{
if (!acc) {
@@ -1635,6 +1641,150 @@ function PMA_prettyProfilingNum(num, acc)
return num + 's';
}
+
+/**
+ * Formats a SQL Query nicely with newlines and indentation. Depends on Codemirror and MySQL Mode!
+ *
+ * @param string Query to be formatted
+ * @return string The formatted query
+ */
+function PMA_SQLPrettyPrint(string)
+{
+ var mode = CodeMirror.getMode({},"text/x-mysql");
+ var stream = new CodeMirror.StringStream(string);
+ var state = mode.startState();
+ var token, tokens = [];
+ var output = '';
+ var tabs = function(cnt) {
+ var ret = '';
+ for (var i=0; i<4*cnt; i++)
+ ret += " ";
+ return ret;
+ };
+
+ // "root-level" statements
+ var statements = {
+ 'select': ['select', 'from','on','where','having','limit','order by','group by'],
+ 'update': ['update', 'set','where'],
+ 'insert into': ['insert into', 'values']
+ };
+ // don't put spaces before these tokens
+ var spaceExceptionsBefore = { ';':true, ',': true, '.': true, '(': true };
+ // don't put spaces after these tokens
+ var spaceExceptionsAfter = { '.': true };
+
+ // Populate tokens array
+ var str='';
+ while (! stream.eol()) {
+ stream.start = stream.pos;
+ token = mode.token(stream, state);
+ if(token != null) {
+ tokens.push([token, stream.current().toLowerCase()]);
+ }
+ }
+
+ var currentStatement = tokens[0][1];
+
+ if(! statements[currentStatement]) {
+ return string;
+ }
+ // Holds all currently opened code blocks (statement, function or generic)
+ var blockStack = [];
+ // Holds the type of block from last iteration (the current is in blockStack[0])
+ var previousBlock;
+ // If a new code block is found, newBlock contains its type for one iteration and vice versa for endBlock
+ var newBlock, endBlock;
+ // How much to indent in the current line
+ var indentLevel = 0;
+ // Holds the "root-level" statements
+ var statementPart, lastStatementPart = statements[currentStatement][0];
+
+ blockStack.unshift('statement');
+
+ // Iterate through every token and format accordingly
+ for (var i = 0; i < tokens.length; i++) {
+ previousBlock = blockStack[0];
+
+ // New block => push to stack
+ if (tokens[i][1] == '(') {
+ if (i < tokens.length - 1 && tokens[i+1][0] == 'statement-verb') {
+ blockStack.unshift(newBlock = 'statement');
+ } else if (i > 0 && tokens[i-1][0] == 'builtin') {
+ blockStack.unshift(newBlock = 'function');
+ } else {
+ blockStack.unshift(newBlock = 'generic');
+ }
+ } else {
+ newBlock = null;
+ }
+
+ // Block end => pop from stack
+ if (tokens[i][1] == ')') {
+ endBlock = blockStack[0];
+ blockStack.shift();
+ } else {
+ endBlock = null;
+ }
+
+ // A subquery is starting
+ if (i > 0 && newBlock == 'statement') {
+ indentLevel++;
+ output += "\n" + tabs(indentLevel) + tokens[i][1] + ' ' + tokens[i+1][1].toUpperCase() + "\n" + tabs(indentLevel + 1);
+ currentStatement = tokens[i+1][1];
+ i++;
+ continue;
+ }
+
+ // A subquery is ending
+ if (endBlock == 'statement' && indentLevel > 0) {
+ output += "\n" + tabs(indentLevel);
+ indentLevel--;
+ }
+
+ // One less indentation for statement parts (from, where, order by, etc.) and a newline
+ statementPart = statements[currentStatement].indexOf(tokens[i][1]);
+ if (statementPart != -1) {
+ if (i > 0) output += "\n";
+ output += tabs(indentLevel) + tokens[i][1].toUpperCase();
+ output += "\n" + tabs(indentLevel + 1);
+ lastStatementPart = tokens[i][1];
+ }
+ // Normal indentatin and spaces for everything else
+ else {
+ if (! spaceExceptionsBefore[tokens[i][1]]
+ && ! (i > 0 && spaceExceptionsAfter[tokens[i-1][1]])
+ && output.charAt(output.length -1) != ' ' ) {
+ output += " ";
+ }
+ if (tokens[i][0] == 'keyword') {
+ output += tokens[i][1].toUpperCase();
+ } else {
+ output += tokens[i][1];
+ }
+ }
+
+ // split columns in select and 'update set' clauses, but only inside statements blocks
+ if (( lastStatementPart == 'select' || lastStatementPart == 'where' || lastStatementPart == 'set')
+ && tokens[i][1]==',' && blockStack[0] == 'statement') {
+
+ output += "\n" + tabs(indentLevel + 1);
+ }
+
+ // split conditions in where clauses, but only inside statements blocks
+ if (lastStatementPart == 'where'
+ && (tokens[i][1]=='and' || tokens[i][1]=='or' || tokens[i][1]=='xor')) {
+
+ if (blockStack[0] == 'statement') {
+ output += "\n" + tabs(indentLevel + 1);
+ }
+ // Todo: Also split and or blocks in newlines & identation++
+ //if(blockStack[0] == 'generic')
+ // output += ...
+ }
+ }
+ return output;
+}
+
/**
* jQuery function that uses jQueryUI's dialogs to confirm with user. Does not
* return a jQuery object yet and hence cannot be chained
diff --git a/js/messages.php b/js/messages.php
index 10beb0ad66..5106283b7c 100644
--- a/js/messages.php
+++ b/js/messages.php
@@ -170,7 +170,7 @@ $js_messages['strJumpToTable'] = __('Jump to Log table');
$js_messages['strNoDataFound'] = __('Log analysed, but no data found in this time span.');
/* l10n: A collection of available filters */
-$js_messages['strFilters'] = __('Filters');
+$js_messages['strFiltersForLogTable'] = __('Log table filter options');
/* l10n: Filter as in "Start Filtering" */
$js_messages['strFilter'] = __('Filter');
$js_messages['strFilterByWordRegexp'] = __('Filter queries by word/regexp:');
@@ -265,7 +265,9 @@ $js_messages['strDisplayHelp'] = '
'
. ' '
. __('Hovering over a point will show its label.')
. ' '
- . __('Drag and select an area in the plot to zoom into it.')
+ . __('Use mousewheel to zoom in or out of the plot.')
+ . ' '
+ . __('Click and drag the mouse to navigate the plot.')
. ' '
. __('Click reset zoom link to come back to original state.')
. ' '
@@ -445,10 +447,16 @@ PMA_printJsValue("$.datepicker.regional['']['dayNamesMin']",
__('Sa')));
/* l10n: Column header for week of the year in calendar */
PMA_printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk'));
-
-PMA_printJsValue("$.datepicker.regional['']['hourText']", __('Hour'));
-PMA_printJsValue("$.datepicker.regional['']['minuteText']", __('Minute'));
-PMA_printJsValue("$.datepicker.regional['']['secondText']", __('Second'));
?>
$.extend($.datepicker._defaults, $.datepicker.regional['']);
} /* if ($.datepicker) */
+
+
+$.extend($.timepicker._defaults, $.timepicker.regional['']);
+} /* if ($.timepicker) */
diff --git a/js/pmd/move.js b/js/pmd/move.js
index eb2b246476..6c3f56e832 100644
--- a/js/pmd/move.js
+++ b/js/pmd/move.js
@@ -113,7 +113,7 @@ function MouseDown(e)
dx = offsetx - parseInt(cur_click.style.left);
dy = offsety - parseInt(cur_click.style.top);
//alert(" dx = " + dx + " dy = " +dy);
- document.getElementById("canvas").style.visibility = 'hidden';
+ document.getElementById("canvas").style.display = 'none';
/*
var left = parseInt(cur_click.style.left);
var top = parseInt(cur_click.style.top);
@@ -159,8 +159,8 @@ function MouseMove(e)
}
if (ON_relation || ON_display_field) {
- document.getElementById('hint').style.left = (Glob_X + 20) + 'px';
- document.getElementById('hint').style.top = (Glob_Y + 20) + 'px';
+ document.getElementById('pmd_hint').style.left = (Glob_X + 20) + 'px';
+ document.getElementById('pmd_hint').style.top = (Glob_Y + 20) + 'px';
}
if (layer_menu_cur_click) {
@@ -173,7 +173,7 @@ function MouseMove(e)
function MouseUp(e)
{
if (cur_click != null) {
- document.getElementById("canvas").style.visibility = 'visible';
+ document.getElementById("canvas").style.display = 'inline-block';
Re_load();
cur_click.style.zIndex = 1;
cur_click = null;
@@ -225,7 +225,7 @@ function Main()
Canvas_pos();
Small_tab_refresh();
Re_load();
- id_hint = document.getElementById('hint');
+ id_hint = document.getElementById('pmd_hint');
if (isIE) {
General_scroll();
}
@@ -535,12 +535,12 @@ function Start_relation()
if (!ON_relation) {
document.getElementById('foreign_relation').style.display = '';
ON_relation = 1;
- document.getElementById('hint').innerHTML = PMA_messages['strSelectReferencedKey'];
- document.getElementById('hint').style.visibility = "visible";
+ document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectReferencedKey'];
+ document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('rel_button').className = 'M_butt_Selected_down';
} else {
- document.getElementById('hint').innerHTML = "";
- document.getElementById('hint').style.visibility = "hidden";
+ document.getElementById('pmd_hint').innerHTML = "";
+ document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('rel_button').className = 'M_butt';
click_field = 0;
ON_relation = 0;
@@ -551,7 +551,7 @@ function Click_field(T, f, PK) // table field
{
if (ON_relation) {
if (!click_field) {
- //.style.display=='none' .style.visibility = "hidden"
+ //.style.display=='none' .style.display = 'none'
if (!PK) {
alert(PMA_messages['strPleaseSelectPrimaryOrUniqueKey']);
return;// 0;
@@ -561,7 +561,7 @@ function Click_field(T, f, PK) // table field
}
click_field = 1;
link_relation = "T1=" + T + "&F1=" + f;
- document.getElementById('hint').innerHTML = PMA_messages['strSelectForeignKey'];
+ document.getElementById('pmd_hint').innerHTML = PMA_messages['strSelectForeignKey'];
} else {
Start_relation(); // hidden hint...
if (j_tabs[db + '.' + T] != '1' || !PK) {
@@ -571,7 +571,7 @@ function Click_field(T, f, PK) // table field
document.getElementById('layer_new_relation').style.left = left + 'px';
var top = Glob_Y - document.getElementById('layer_new_relation').offsetHeight + 40;
document.getElementById('layer_new_relation').style.top = top + 'px';
- document.getElementById('layer_new_relation').style.visibility = "visible";
+ document.getElementById('layer_new_relation').style.display = 'block';
link_relation += '&T2=' + T + '&F2=' + f;
}
}
@@ -596,8 +596,8 @@ function Click_field(T, f, PK) // table field
display_field[T] = f;
}
ON_display_field = 0;
- document.getElementById('hint').innerHTML = "";
- document.getElementById('hint').style.visibility = "hidden";
+ document.getElementById('pmd_hint').innerHTML = "";
+ document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('display_field_button').className = 'M_butt';
makeRequest('pmd_display_field.php', 'T=' + T + '&F=' + f + '&server=' + server + '&db=' + db + '&token=' + token);
}
@@ -605,7 +605,7 @@ function Click_field(T, f, PK) // table field
function New_relation()
{
- document.getElementById('layer_new_relation').style.visibility = 'hidden';
+ document.getElementById('layer_new_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0';
link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value;
link_relation += Get_url_pos();
@@ -776,14 +776,14 @@ function Canvas_click(id)
document.getElementById('layer_upd_relation').style.left = left + 'px';
var top = Glob_Y - document.getElementById('layer_upd_relation').offsetHeight - 10;
document.getElementById('layer_upd_relation').style.top = top + 'px';
- document.getElementById('layer_upd_relation').style.visibility = 'visible';
+ document.getElementById('layer_upd_relation').style.display = 'block';
link_relation = 'T1=' + Key0 + '&F1=' + Key1 + '&T2=' + Key2 + '&F2=' + Key3 + '&K=' + Key;
}
}
function Upd_relation()
{
- document.getElementById('layer_upd_relation').style.visibility = 'hidden';
+ document.getElementById('layer_upd_relation').style.display = 'none';
link_relation += '&server=' + server + '&db=' + db + '&token=' + token + '&die_save_pos=0';
link_relation += Get_url_pos();
makeRequest('pmd_relation_upd.php', link_relation);
@@ -792,9 +792,9 @@ function Upd_relation()
function VisibleTab(id, t_n)
{
if (id.checked) {
- document.getElementById(t_n).style.visibility = 'visible';
+ document.getElementById(t_n).style.display = 'block';
} else {
- document.getElementById(t_n).style.visibility = 'hidden';
+ document.getElementById(t_n).style.display = 'none';
}
Re_load();
}
@@ -813,10 +813,10 @@ function Hide_tab_all(id_this) // max/min all tables
if (E.elements[i].type == "checkbox" && E.elements[i].id.substring(0, 10) == 'check_vis_') {
if (id_this.alt == 'v') {
E.elements[i].checked = true;
- document.getElementById(E.elements[i].value).style.visibility = 'visible';
+ document.getElementById(E.elements[i].value).style.display = 'block';
} else {
E.elements[i].checked = false;
- document.getElementById(E.elements[i].value).style.visibility = 'hidden';
+ document.getElementById(E.elements[i].value).style.display = 'none';
}
}
}
@@ -859,20 +859,15 @@ function No_have_constr(id_this)
if (!in_array_k(E.elements[i].value, a))
if (id_this.alt == 'v') {
E.elements[i].checked = true;
- document.getElementById(E.elements[i].value).style.visibility = 'visible';
+ document.getElementById(E.elements[i].value).style.display = 'block';
} else {
E.elements[i].checked = false;
- document.getElementById(E.elements[i].value).style.visibility = 'hidden';
+ document.getElementById(E.elements[i].value).style.display = 'none';
}
}
}
}
-function Help()
-{
- var WinHelp = window.open("pmd_help.php", "wind1", "top=200,left=400,width=300,height=200,resizable=yes,scrollbars=yes,menubar=no");
-}
-
function PDF_save()
{
// var WinPDF =
@@ -884,7 +879,7 @@ function General_scroll()
{
/*
if (!document.getElementById('show_relation_olways').checked) {
- document.getElementById("canvas").style.visibility = 'hidden';
+ document.getElementById("canvas").style.display = 'none';
clearTimeout(timeoutID);
timeoutID = setTimeout(General_scroll_end, 500);
}
@@ -913,15 +908,18 @@ function General_scroll_end()
document.getElementById('layer_menu').style.left = document.body.scrollLeft;
document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
}
- document.getElementById("canvas").style.visibility = 'visible';
+ document.getElementById("canvas").style.display = 'block';
}
*/
function Show_left_menu(id_this) // max/min all tables
{
if (id_this.alt == "v") {
- document.getElementById("layer_menu").style.top = document.getElementById('top_menu').offsetHeight + 'px';
- document.getElementById("layer_menu").style.visibility = 'visible';
+ var pos = $("#top_menu").offset();
+ var height = $("#top_menu").height();
+ document.getElementById("layer_menu").style.top = (pos.top + height) + 'px';
+ document.getElementById("layer_menu").style.left = pos.left + 'px';
+ document.getElementById("layer_menu").style.display = 'block';
id_this.alt = ">";
id_this.src = "pmd/images/uparrow2_m.png";
if (isIE) {
@@ -929,7 +927,7 @@ function Show_left_menu(id_this) // max/min all tables
}
} else {
document.getElementById("layer_menu").style.top = -1000 + 'px'; //fast scroll
- document.getElementById("layer_menu").style.visibility = 'hidden';
+ document.getElementById("layer_menu").style.display = 'none';
id_this.alt = "v";
id_this.src = "pmd/images/downarrow2_m.png";
}
@@ -955,16 +953,16 @@ function Start_display_field()
}
if (!ON_display_field) {
ON_display_field = 1;
- document.getElementById('hint').innerHTML = PMA_messages['strChangeDisplay'];
- document.getElementById('hint').style.visibility = "visible";
+ document.getElementById('pmd_hint').innerHTML = PMA_messages['strChangeDisplay'];
+ document.getElementById('pmd_hint').style.display = 'block';
document.getElementById('display_field_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
if (isIE) { // correct for IE
document.getElementById('display_field_button').className = 'M_butt_Selected_down_IE';
}
} else {
- document.getElementById('hint').innerHTML = "";
- document.getElementById('hint').style.visibility = "hidden";
+ document.getElementById('pmd_hint').innerHTML = "";
+ document.getElementById('pmd_hint').style.display = 'none';
document.getElementById('display_field_button').className = 'M_butt';
ON_display_field = 0;
}
@@ -1021,7 +1019,7 @@ function Click_option(id_this,column_name,table_name)
document.getElementById(id_this).style.left = left + 'px';
// var top = Glob_Y - document.getElementById(id_this).offsetHeight - 10;
document.getElementById(id_this).style.top = (screen.height / 4) + 'px';
- document.getElementById(id_this).style.visibility = "visible";
+ document.getElementById(id_this).style.display = 'block';
document.getElementById('option_col_name').innerHTML = '' + PMA_messages['strAddOption'] +'"' +column_name+ '" ';
col_name = column_name;
tab_name = table_name;
@@ -1029,7 +1027,7 @@ function Click_option(id_this,column_name,table_name)
function Close_option()
{
- document.getElementById('pmd_optionse').style.visibility = "hidden";
+ document.getElementById('pmd_optionse').style.display = 'none';
}
function Select_all(id_this,owner)
@@ -1136,8 +1134,8 @@ function add_object()
var init = history_array.length;
if (rel.value != '--') {
if (document.getElementById('Query').value == "") {
- document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
- document.getElementById('hint').style.visibility = "visible";
+ document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
+ document.getElementById('pmd_hint').style.display = 'block';
return;
}
var p = document.getElementById('Query');
@@ -1168,8 +1166,8 @@ function add_object()
}
if (document.getElementById('h_rel_opt').value != '--') {
if (document.getElementById('having').value == "") {
- document.getElementById('hint').innerHTML = "value/subQuery is empty" ;
- document.getElementById('hint').style.visibility = "visible";
+ document.getElementById('pmd_hint').innerHTML = "value/subQuery is empty" ;
+ document.getElementById('pmd_hint').style.display = 'block';
return;
}
var p = document.getElementById('having');
@@ -1186,8 +1184,8 @@ function add_object()
document.getElementById('orderby').checked = false;
//make orderby
}
- document.getElementById('hint').innerHTML = sum + "object created" ;
- document.getElementById('hint').style.visibility = "visible";
+ document.getElementById('pmd_hint').innerHTML = sum + "object created" ;
+ document.getElementById('pmd_hint').style.display = 'block';
//output sum new objects created
var existingDiv = document.getElementById('ab');
existingDiv.innerHTML = display(init,history_array.length);
diff --git a/js/querywindow.js b/js/querywindow.js
index ba9fe6e18f..55c895a061 100644
--- a/js/querywindow.js
+++ b/js/querywindow.js
@@ -7,36 +7,35 @@ function PMA_queryAutoCommit()
function PMA_querywindowCommit(tab)
{
- document.getElementById('hiddenqueryform').querydisplay_tab.value = tab;
- document.getElementById('hiddenqueryform').submit();
+ $('#hiddenqueryform').find("input[name='querydisplay_tab']").attr("value" ,tab);
+ $('#hiddenqueryform').submit();
return false;
}
function PMA_querywindowSetFocus()
{
- document.getElementById('sqlquery').focus();
+ $('#sqlquery').focus();
}
function PMA_querywindowResize()
{
// for Gecko
- if (typeof(self.sizeToContent) == 'function') {
- self.sizeToContent();
+ if (typeof($(this)[0].sizeToContent) == 'function') {
+ $(this)[0].sizeToContent();
//self.scrollbars.visible = false;
// give some more space ... to prevent 'fli(pp/ck)ing'
- self.resizeBy(10, 50);
+ $(this)[0].resizeBy(10, 50);
return;
}
// for IE, Opera
- if (document.getElementById && typeof(document.getElementById('querywindowcontainer')) != 'undefined') {
-
+ if ($('#querywindowcontainer') != 'undefined') {
// get content size
- var newWidth = document.getElementById('querywindowcontainer').offsetWidth;
- var newHeight = document.getElementById('querywindowcontainer').offsetHeight;
+ var newWidth = $("#querywindowcontainer")[0].offsetWidth;
+ var newHeight = $("#querywindowcontainer")[0].offsetHeight;
// set size to contentsize
// plus some offset for scrollbars, borders, statusbar, menus ...
- self.resizeTo(newWidth + 45, newHeight + 75);
+ $(this)[0].resizeTo(newWidth + 45, newHeight + 75);
}
}
diff --git a/js/server_status.js b/js/server_status.js
index 08d7679530..594e8d9ed2 100644
--- a/js/server_status.js
+++ b/js/server_status.js
@@ -43,6 +43,19 @@ $(function() {
},
type: "numeric"
});
+
+ jQuery.tablesorter.addParser({
+ id: "withinSpanNumber",
+ is: function(s) {
+ return /(.*)?<\/span>/);
+ return (res && res.length >= 3) ? res[2] : 0;
+ },
+ type: "numeric"
+ });
+
// faster zebra widget: no row visibility check, faster css class switching, no cssChildRow check
jQuery.tablesorter.addWidget({
id: "fast-zebra",
@@ -394,7 +407,7 @@ $(function() {
if (word.length == 0) {
textFilter = null;
}
- else textFilter = new RegExp("(^|_)" + word, 'i');
+ else textFilter = new RegExp("(^| )" + word, 'i');
text = word;
@@ -507,7 +520,7 @@ $(function() {
sortList: [[0, 0]],
widgets: ['fast-zebra'],
headers: {
- 1: { sorter: 'fancyNumber' }
+ 1: { sorter: 'withinSpanNumber' }
}
};
break;
diff --git a/js/server_status_monitor.js b/js/server_status_monitor.js
index fa0f28eb77..e89f0488bd 100644
--- a/js/server_status_monitor.js
+++ b/js/server_status_monitor.js
@@ -9,6 +9,10 @@ $(function() {
codemirror_editor = CodeMirror.fromTextArea(elm[0], { lineNumbers: true, matchBrackets: true, indentUnit: 4, mode: "text/x-mysql" });
}
}
+ // Timepicker is loaded on demand so we need to initialize datetime fields from the 'load log' dialog
+ $('div#logAnalyseDialog .datetimefield').each(function() {
+ PMA_addDatepicker($(this));
+ });
/**** Monitor charting implementation ****/
/* Saves the previous ajax response for differential values */
@@ -1022,8 +1026,6 @@ $(function() {
removeVariables: $('input#removeVariables').prop('checked'),
limitTypes: $('input#limitTypes').prop('checked')
});
-
- $('#logAnalyseDialog').find('dateStart,dateEnd').datepicker('destroy');
}
$('#logAnalyseDialog').dialog({
@@ -1388,7 +1390,7 @@ $(function() {
if (logData.numRows > 12) {
$('div#logTable').prepend(
'' +
- ' ' + PMA_messages['strFilters'] + ' ' +
+ ' ' + PMA_messages['strFiltersForLogTable'] + ' ' +
'