short comments for inputs:

- information whether SQL validator is enabled for Validate link
- information about required extensions (SOAP, compression)
- information for constrained values (eg. MaxDbList)
This commit is contained in:
Crack
2010-07-30 00:47:20 +02:00
parent 5a3ec082d8
commit 9adc2597c5
7 changed files with 119 additions and 2 deletions

View File

@@ -1,9 +1,9 @@
restore cache'ing in phpmyadmin.css.php
remove debug from user preferences header
marker for extension dependent options (SOAP for sql validation)
info about setup script in prefs manage, it seems many people still don't know it exists
(and maybe some description in docs on making it work with live configuration?)
info for constrained values (eg. MaxDbList)?
show blacklist (and debug?) on prefs manage page

View File

@@ -109,6 +109,7 @@ class Form
$value = array_combine($keys, $value);
}
}
// $value has keys and value names, return it
return $value;
}

View File

@@ -374,6 +374,7 @@ class FormDisplay
}
}
}
$this->_setComments($system_path, $opts);
// send default value to form's JS
$js_line = '\'' . $translated_path . '\': ';
@@ -705,5 +706,67 @@ class FormDisplay
$this->userprefs_disallow = array_flip($userprefs_disallow);
}
}
/**
* Sets field comments and warnings based on current environment
*
* @param string $system_path
* @param array $opts
*/
private function _setComments($system_path, array &$opts)
{
// RecodingEngine - mark unavailable types
if ($system_path == 'RecodingEngine') {
$comment = '';
if (!function_exists('iconv')) {
$opts['values']['iconv'] .= ' (' . __('unavailable') . ')';
$comment = sprintf(__('"%s" requires %s extension'), 'iconv', 'iconv');
}
if (!function_exists('recode_string')) {
$opts['values']['recode'] .= ' (' . __('unavailable') . ')';
$comment .= ($comment ? ", " : '') . sprintf(__('"%s" requires %s extension'),
'recode', 'recode');
}
$opts['comment'] = $comment;
$opts['comment_warning'] = true;
}
// ZipDump, GZipDump, BZipDump - check function availability
if ($system_path == 'ZipDump' || $system_path == 'GZipDump' || $system_path == 'BZipDump') {
$comment = '';
$funcs = array(
'ZipDump' => array('zip_open', 'gzcompress'),
'GZipDump' => array('gzopen', 'gzencode'),
'BZipDump' => array('bzopen', 'bzcompress'));
if (!function_exists($funcs[$system_path][0])) {
$comment = sprintf(__('import will not work, missing function (%s)'),
$funcs[$system_path][0]);
}
if (!function_exists($funcs[$system_path][1])) {
$comment .= ($comment ? '; ' : '') . sprintf(__('export will not work, missing function (%s)'),
$funcs[$system_path][1]);
}
$opts['comment'] = $comment;
$opts['comment_warning'] = true;
}
if ($system_path == 'SQLQuery/Validate' && !$GLOBALS['cfg']['SQLValidator']['use']) {
$opts['comment'] = __('SQL Validator is disabled');
$opts['comment_warning'] = true;
}
if ($system_path == 'SQLValidator/use') {
if (!class_exists('SOAPClient')) {
@include_once 'SOAP/Client.php';
if (!class_exists('SOAP_Client')) {
$opts['comment'] = __('SOAP extension not found');
$opts['comment_warning'] = true;
}
}
}
if (!defined('PMA_SETUP') || !PMA_SETUP) {
if (($system_path == 'MaxDbList' || $system_path == 'MaxTableList'
|| $system_path == 'QueryHistoryMax')) {
$opts['comment'] = sprintf(__('maximum %s'), $GLOBALS['cfg'][$system_path]);
}
}
}
}
?>

View File

@@ -111,6 +111,8 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a
* o values - key - value paris for <select> fields
* o values_escaped - (boolean) tells whether values array is already escaped (defaults to false)
* o values_disabled - (array)list of disabled values (keys from values)
* o comment - (string) tooltip comment
* o comment_warning - (bool) whether this comments warns about something
* o wiki - (string) wiki link
*
* @uses $GLOBALS['_FormDisplayGroup']
@@ -229,6 +231,15 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
. '</textarea>';
break;
}
if (isset($opts['comment']) && $opts['comment']) {
$class = 'field-comment-mark';
if (isset($opts['comment_warning']) && $opts['comment_warning']) {
$class .= ' field-comment-warning';
}
?>
<span class="<?php echo $class ?>" title="<?php echo htmlspecialchars($opts['comment']) ?>">i</span>
<?php
}
if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) {
?>
<a class="userprefs-comment" title="<?php echo htmlspecialchars($opts['userprefs_comment']) ?>"><img alt="comment" src="<?php echo $img_path ?>b_tblops.png" width="16" height="16" /></a>

View File

@@ -363,6 +363,22 @@ input[type="text"]:focus, select:focus, textarea:focus {
background: #F7FBFF;
}
.field-comment {
position: relative;
}
.field-comment-mark {
cursor: help;
padding: 0 0.2em;
font-weight: bold;
font-style: italic;
}
.field-comment-warning {
color: #A00;
}
.green { /* default form button */
color: #080;
}

View File

@@ -1550,6 +1550,19 @@ fieldset .disabled-field td {
background: #F7FBFF;
}
.config-form .field-comment-mark {
font-family: serif;
color: #00A;
cursor: help;
padding: 0 0.2em;
font-weight: bold;
font-style: italic;
}
.config-form .field-comment-warning {
color: #A00;
}
/* error list */
.config-form dd {
margin-left: 0.5em;

View File

@@ -1482,6 +1482,19 @@ fieldset .disabled-field td {
background: #F7FBFF;
}
.config-form .field-comment-mark {
font-family: serif;
color: #007;
cursor: help;
padding: 0 0.2em;
font-weight: bold;
font-style: italic;
}
.config-form .field-comment-warning {
color: #A00;
}
/* error list */
.config-form dd {
margin-left: 0.5em;