[interface] Provide links to documentation in highlighted SQL.

This commit is contained in:
Michal Čihař
2010-01-22 18:35:38 +00:00
parent 7f9126fde9
commit 46a2a4e0ba
3 changed files with 65 additions and 7 deletions

View File

@@ -33,6 +33,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
- rfe #1516803 [edit] Allow to set BLOB to/from NULL with ProtectBinary.
- [edit] Do not default to UNHEX when using file upload.
- rfe #1379201 [core] Add option to configure session_save_path.
+ [interface] Provide links to documentation in highlighted SQL.
3.3.0.0 (not yet released)
+ rfe #2308632 [edit] Use hex for (var)binary fields,

View File

@@ -364,7 +364,7 @@ function PMA_formatSql($parsed_sql, $unparsed_sql = '')
*
* @access public
*/
function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '')
function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '', $just_open = false)
{
global $cfg;
@@ -428,7 +428,9 @@ function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = '')
break;
}
if ($big_icon) {
if ($just_open) {
return '<a href="' . $url . '" target="mysql_doc">';
} elseif ($big_icon) {
return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_sqlhelp.png" width="16" height="16" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>';
} elseif ($GLOBALS['cfg']['ReplaceHelpImg']) {
return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>';

View File

@@ -2090,6 +2090,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$html_line_break = '<br />';
break;
} // end switch
$close_docu_link = false;
$indent = 0;
$bracketlevel = 0;
$functionlevel = 0;
@@ -2356,22 +2357,61 @@ if (! defined('PMA_MINIMUM_COMMON')) {
switch ($arr[$i]['data']) {
case 'CREATE':
case 'ALTER':
case 'DROP':
case 'RENAME';
case 'TRUNCATE':
case 'ANALYZE':
case 'ANALYSE':
case 'OPTIMIZE':
switch ($arr[$i + 1]['data']) {
case 'EVENT':
case 'TABLE':
case 'TABLESPACE':
case 'FUNCTION':
case 'INDEX':
case 'PROCEDURE':
case 'TRIGGER':
case 'SERVER':
case 'DATABASE':
case 'VIEW':
$before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'] . '_' . $arr[$i + 1]['data'], false, '', true);
$close_docu_link = true;
break;
}
if ($arr[$i + 1]['data'] == 'LOGFILE' && $arr[$i + 2]['data'] == 'GROUP') {
$before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'] . '_LOGFILE_GROUP', false, '', true);
$close_docu_link = true;
}
if (!$in_priv_list) {
$space_punct_listsep = $html_line_break;
$space_alpha_reserved_word = ' ';
}
break;
case 'EVENT':
case 'TABLESPACE':
case 'TABLE':
case 'FUNCTION':
case 'INDEX':
case 'PROCEDURE':
case 'SERVER':
case 'TRIGGER':
case 'DATABASE':
case 'VIEW':
case 'GROUP':
if ($close_docu_link) {
$after = '</a>' . $after;
$close_docu_link = false;
}
break;
case 'EXPLAIN':
case 'DESCRIBE':
case 'SET':
case 'ALTER':
case 'DELETE':
case 'SHOW':
case 'DROP':
case 'UPDATE':
case 'TRUNCATE':
case 'ANALYZE':
case 'ANALYSE':
$before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true);
$after = '</a>' . $after;
if (!$in_priv_list) {
$space_punct_listsep = $html_line_break;
$space_alpha_reserved_word = ' ';
@@ -2379,6 +2419,8 @@ if (! defined('PMA_MINIMUM_COMMON')) {
break;
case 'INSERT':
case 'REPLACE':
$before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true);
$after = '</a>' . $after;
if (!$in_priv_list) {
$space_punct_listsep = $html_line_break;
$space_alpha_reserved_word = $html_line_break;
@@ -2389,9 +2431,17 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$space_alpha_reserved_word = $html_line_break;
break;
case 'SELECT':
$before .= PMA_showMySQLDocu('SQL-Syntax', 'SELECT', false, '', true);
$after = '</a>' . $after;
$space_punct_listsep = ' ';
$space_alpha_reserved_word = $html_line_break;
break;
case 'CALL':
case 'DO':
case 'HANDLER':
$before .= PMA_showMySQLDocu('SQL-Syntax', $arr[$i]['data'], false, '', true);
$after = '</a>' . $after;
break;
default:
break;
} // end switch ($arr[$i]['data'])
@@ -2454,6 +2504,11 @@ if (! defined('PMA_MINIMUM_COMMON')) {
*/
$str .= $before . ($mode=='color' ? PMA_SQP_formatHTML_colorize($arr[$i]) : $arr[$i]['data']). $after;
} // end for
/* End possibly unclosed documentation link */
if ($close_docu_link) {
$str .= '</a>';
$close_docu_link = false;
}
if ($mode=='color') {
$str .= '</span>';
}