markers for field errors
This commit is contained in:
@@ -299,6 +299,13 @@ function displayErrors(error_list) {
|
|||||||
return item != '';
|
return item != '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// CSS error class
|
||||||
|
if (!isFieldset) {
|
||||||
|
// checkboxes uses parent <span> for marking
|
||||||
|
var fieldMarker = (field.attr('type') == 'checkbox') ? field.parent() : field;
|
||||||
|
fieldMarker[errors.length ? 'addClass' : 'removeClass']('field-error');
|
||||||
|
}
|
||||||
|
|
||||||
if (errors.length) {
|
if (errors.length) {
|
||||||
// if error container doesn't exist, create it
|
// if error container doesn't exist, create it
|
||||||
if (errorCnt.length == 0) {
|
if (errorCnt.length == 0) {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
* Base class for forms, loads default configuration options, checks allowed
|
* Base class for forms, loads default configuration options, checks allowed
|
||||||
* values etc.
|
* values etc.
|
||||||
*
|
*
|
||||||
* @package phpMyAdmin-setup
|
* @package phpMyAdmin
|
||||||
*/
|
*/
|
||||||
class Form
|
class Form
|
||||||
{
|
{
|
||||||
|
@@ -98,6 +98,7 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a
|
|||||||
* o errors - error array
|
* o errors - error array
|
||||||
* o setvalue - (string) shows button allowing to set poredefined value
|
* o setvalue - (string) shows button allowing to set poredefined value
|
||||||
* o show_restore_default - (boolean) whether show "restore default" button
|
* o show_restore_default - (boolean) whether show "restore default" button
|
||||||
|
* o userprefs_allow - whether show user preferences allow/deny checkbox (null - no, true/false - yes)
|
||||||
* o values - key - value paris for <select> fields
|
* o values - key - value paris for <select> fields
|
||||||
* o values_escaped - (boolean) tells whether values array is already escaped (defaults to false)
|
* 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 values_disabled - (array)list of disabled values (keys from values)
|
||||||
@@ -113,13 +114,23 @@ function display_fieldset_top($title = '', $description = '', $errors = null, $a
|
|||||||
*/
|
*/
|
||||||
function display_input($path, $name, $description = '', $type, $value, $value_is_default = true, $opts = null)
|
function display_input($path, $name, $description = '', $type, $value, $value_is_default = true, $opts = null)
|
||||||
{
|
{
|
||||||
$field_class = $value_is_default ? '' : ' class="custom"';
|
static $base_dir, $img_path;
|
||||||
|
|
||||||
|
if ($base_dir === null) {
|
||||||
|
$is_setup_script = defined('PMA_SETUP') && PMA_SETUP;
|
||||||
|
$base_dir = $is_setup_script ? '../' : '';
|
||||||
|
$img_path = $is_setup_script
|
||||||
|
? '../' . ltrim($GLOBALS['cfg']['ThemePath'], './') . '/original/img/'
|
||||||
|
: $_SESSION['PMA_Theme']->img_path;
|
||||||
|
}
|
||||||
|
$has_errors = isset($opts['errors']) && !empty($opts['errors']);
|
||||||
|
$field_class = $type == 'checkbox' ? '' : 'checkbox';
|
||||||
|
if (!$value_is_default) {
|
||||||
|
$field_class .= ($field_class == '' ? '' : ' ') . ($has_errors ? 'custom field-error' : 'custom');
|
||||||
|
}
|
||||||
|
$field_class = 'class="' . $field_class . '"';
|
||||||
$name_id = 'name="' . $path . '" id="' . $path . '"';
|
$name_id = 'name="' . $path . '" id="' . $path . '"';
|
||||||
$base_dir = defined('PMA_SETUP') ? '../' : '';
|
|
||||||
//todo use PMA_showDocu(), create and use PMA_showWiki()
|
|
||||||
$img_path = defined('PMA_SETUP')
|
|
||||||
? '../' . ltrim($GLOBALS['cfg']['ThemePath'], './') . '/original/img/'
|
|
||||||
: $_SESSION['PMA_Theme']->img_path;
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
@@ -141,7 +152,7 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
|
|||||||
. ' value="' . htmlspecialchars($value) . '" />';
|
. ' value="' . htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
echo '<span class="checkbox' . ($value_is_default ? '' : ' custom')
|
echo '<span ' . $field_class
|
||||||
. '"><input type="checkbox" ' . $name_id
|
. '"><input type="checkbox" ' . $name_id
|
||||||
. ($value ? ' checked="checked"' : '') . ' /></span>';
|
. ($value ? ' checked="checked"' : '') . ' /></span>';
|
||||||
break;
|
break;
|
||||||
@@ -192,8 +203,8 @@ function display_input($path, $name, $description = '', $type, $value, $value_is
|
|||||||
<a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" src="<?php echo $img_path ?>s_reload.png" width="16" height="16" /></a>
|
<a class="restore-default" href="#<?php echo $path ?>" title="<?php echo __('Restore default value') ?>" style="display:none"><img alt="restore-default" src="<?php echo $img_path ?>s_reload.png" width="16" height="16" /></a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
// this must match with displayErrors() in scripts.js
|
// this must match with displayErrors() in scripts/config.js
|
||||||
if (isset($opts['errors']) && !empty($opts['errors'])) {
|
if ($has_errors) {
|
||||||
echo "\n <dl class=\"inline_errors\">";
|
echo "\n <dl class=\"inline_errors\">";
|
||||||
foreach ($opts['errors'] as $error) {
|
foreach ($opts['errors'] as $error) {
|
||||||
echo '<dd>' . htmlspecialchars($error) . '</dd>';
|
echo '<dd>' . htmlspecialchars($error) . '</dd>';
|
||||||
|
@@ -319,6 +319,10 @@ span.checkbox {
|
|||||||
border: 1px #EDEC90 solid;
|
border: 1px #EDEC90 solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field-error {
|
||||||
|
border-color: #C11 !important;
|
||||||
|
}
|
||||||
|
|
||||||
input[type="text"], select, textarea {
|
input[type="text"], select, textarea {
|
||||||
border: 1px #A7A6AA solid;
|
border: 1px #A7A6AA solid;
|
||||||
}
|
}
|
||||||
|
@@ -1362,6 +1362,10 @@ table#serverconnection_trg_local {
|
|||||||
background: #FFC;
|
background: #FFC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.config-form .field-error {
|
||||||
|
border-color: #A11 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.config-form input[type="text"],
|
.config-form input[type="text"],
|
||||||
.config-form select,
|
.config-form select,
|
||||||
.config-form textarea {
|
.config-form textarea {
|
||||||
@@ -1376,10 +1380,10 @@ table#serverconnection_trg_local {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* error list */
|
/* error list */
|
||||||
dd {
|
.config-form dd {
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd:before {
|
.config-form dd:before {
|
||||||
content: "\25B8 ";
|
content: "\25B8 ";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user