MDL-44907 admin: Better styling of admin settings validation errors

This commit is contained in:
Frederic Massart 2015-01-08 14:14:37 +08:00
parent eb1dc9fab9
commit 1920eebcaa
5 changed files with 14 additions and 9 deletions

View File

@ -1141,7 +1141,7 @@ $string['users'] = 'Users';
$string['userquota'] = 'User quota';
$string['usesitenameforsitepages'] = 'Use site name for site pages';
$string['usetags'] = 'Enable tags functionality';
$string['validateerror'] = 'This value was not valid:';
$string['validateerror'] = 'This value is not valid';
$string['verifychangedemail'] = 'Restrict domains when changing email';
$string['warningcurrentsetting'] = 'Invalid current value: {$a}';
$string['warningiconvbuggy'] = 'Your version of the iconv library does not support the //IGNORE modifier. You should install the mbstring extension which can be used instead for cleaning strings containing invalid UTF-8 characters.';

View File

@ -6966,21 +6966,22 @@ function format_admin_setting($setting, $title='', $form='', $description='', $l
}
$adminroot = admin_get_root();
$error = '';
if (array_key_exists($fullname, $adminroot->errors)) {
$error = '<div><span class="error">' . $adminroot->errors[$fullname]->error . '</span></div>';
}
$str = '
<div class="form-item clearfix" id="admin-'.$setting->name.'">
<div class="form-label">
<label '.$labelfor.'>'.highlightfast($query, $title).$override.$warning.'</label>
<span class="form-shortname">'.highlightfast($query, $name).'</span>
</div>
<div class="form-setting">'.$form.$defaultinfo.'</div>
<div class="form-setting">'.$error.$form.$defaultinfo.'</div>
<div class="form-description">'.highlight($query, markdown_to_html($description)).'</div>
</div>';
$adminroot = admin_get_root();
if (array_key_exists($fullname, $adminroot->errors)) {
$str = '<fieldset class="error"><legend>'.$adminroot->errors[$fullname]->error.'</legend>'.$str.'</fieldset>';
}
return $str;
}

View File

@ -461,8 +461,10 @@ a.skip:active {position: static;display: block;}
.mform .fitem .fitemtitle div {display: inline;}
.mform .fitem .felement {border-width: 0;width:80%;margin-left:16%;}
.mform .fitem fieldset.felement {margin-left:15%;padding-left:1%;margin-bottom:0}
#adminsettings span.error,
.mform .error,
.mform .required {color:#A00;}
#adminsettings span.error,
.mform span.error {display: inline-block;padding: 4px;margin-bottom: 4px;background-color: #F2DEDE;border: 1px solid #EED3D7;}
.mform .required .fgroup span label {color:#000;}
.mform .fdescription.required {color:#A00;text-align:right;}

View File

@ -23,7 +23,8 @@ form {
.mform fieldset.error {
border: 1px solid @errorText;
}
.mform span.error {
.mform span.error,
#adminsettings span.error {
display: inline-block;
border: 1px solid @errorBorder;
border-radius: 4px;
@ -55,6 +56,7 @@ form {
.mform .fitem .fitemtitle div {
display: inline;
}
#adminsettings .error,
.loginpanel .error,
.mform .error {
color: @errorText;

File diff suppressed because one or more lines are too long