Skip to content
Snippets Groups Projects
Commit 348bd130 authored by André Noack's avatar André Noack
Browse files

Resolve "MessageBox sollte als Statusmeldung ausgezeichnet werden"

Closes #4042

Merge request studip/studip!2896
parent 4fe996bb
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ class MessageBox implements LayoutMessage ...@@ -41,6 +41,7 @@ class MessageBox implements LayoutMessage
public $details; public $details;
public $close_details; public $close_details;
protected $hide_close = false; protected $hide_close = false;
public static $counter = 0;
/** /**
* This function returns an exception message box. Use it only for system errors * This function returns an exception message box. Use it only for system errors
...@@ -147,12 +148,21 @@ class MessageBox implements LayoutMessage ...@@ -147,12 +148,21 @@ class MessageBox implements LayoutMessage
*/ */
public function __toString() public function __toString()
{ {
$label = [
'exception' => _('Systemfehler'),
'error' => _('Fehler'),
'warning' => _('Warnung'),
'info' => _('Hinweis'),
'success' => _('Erfolg'),
];
return $GLOBALS['template_factory']->render('shared/message_box', [ return $GLOBALS['template_factory']->render('shared/message_box', [
'class' => $this->class, 'class' => $this->class,
'message' => $this->message, 'message' => $this->message,
'details' => is_array($this->details) ? $this->details : [], 'details' => is_array($this->details) ? $this->details : [],
'close_details' => $this->close_details, 'close_details' => $this->close_details,
'hide_close' => $this->hide_close, 'hide_close' => $this->hide_close,
'label' => $label[$this->class],
'counter' => self::$counter++,
]); ]);
} }
} }
...@@ -43,9 +43,11 @@ $password_tooltip_text = (string)Config::get()->PASSWORD_TOOLTIP_TEXT; ...@@ -43,9 +43,11 @@ $password_tooltip_text = (string)Config::get()->PASSWORD_TOOLTIP_TEXT;
name="password" name="password"
autocomplete="current-password" autocomplete="current-password"
size="20" size="20"
required> required
<?= $loginerror ? 'aria-describedby="messagebox-0"' : ''?>
>
<i id="password-toggle" tabindex="0" aria-role="button" class="enter-accessible"> <i id="password-toggle" tabindex="0" role="button" class="enter-accessible">
<?= Icon::create('visibility-checked')->asImg(20, [ <?= Icon::create('visibility-checked')->asImg(20, [
'id ' => 'visible-password', 'id ' => 'visible-password',
'title' => _('Passwort anzeigen'), 'title' => _('Passwort anzeigen'),
......
<div class="messagebox messagebox_<?= $class ?> <? if (count($details) > 0 && $close_details): ?>details_hidden<? endif; ?>"> <div role="region" aria-label="<?= $label ?>" aria-describedby="messagebox-<?= $counter ?>" class="messagebox messagebox_<?= $class ?> <? if (count($details) > 0 && $close_details): ?>details_hidden<? endif; ?>">
<div class="messagebox_buttons"> <div class="messagebox_buttons">
<? if (count($details) > 0 && $close_details) : ?> <? if (count($details) > 0 && $close_details) : ?>
<a class="details" href="#" title="<?=_('Detailanzeige umschalten')?>"> <a class="details" href="#" title="<?=_('Detailanzeige umschalten')?>">
...@@ -6,19 +6,21 @@ ...@@ -6,19 +6,21 @@
</a> </a>
<? endif ?> <? endif ?>
<? if (!$hide_close): ?> <? if (!$hide_close): ?>
<a class="close" href="#" title="<?= _('Nachrichtenbox schließen') ?>"> <a class="close" role="button" href="#" title="<?= _('Nachrichtenbox schließen') ?>">
<span><?= _('Nachrichtenbox schließen') ?></span> <span><?= _('Nachrichtenbox schließen') ?></span>
</a> </a>
<? endif; ?> <? endif; ?>
</div> </div>
<div role="status" id="messagebox-<?= $counter ?>">
<?= $message ?> <?= $message ?>
<? if (count($details) > 0) : ?> <? if (count($details) > 0) : ?>
<div class="messagebox_details"> <div class="messagebox_details">
<ul> <ul>
<? foreach ($details as $li) : ?> <? foreach ($details as $li) : ?>
<li><?= $li ?></li> <li><?= $li ?></li>
<? endforeach ?> <? endforeach ?>
</ul> </ul>
</div>
<? endif ?>
</div> </div>
<? endif ?>
</div> </div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment