29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-07-06 20:13:40 +00:00

[4.0] Multilang status module (#25581)

The notices and warning were displayed in a table. A table should never be used for display purposes and this is not tabular data.

This PR corrects that and puts the notices as divs
This commit is contained in:
Brian Teeman 2019-07-23 18:51:44 +01:00 committed by George Wilson
parent 4f7f83ce5c
commit 273e805211

View File

@ -19,279 +19,245 @@ $notice_switchers = !$this->switchers && ($this->homes > 1 || $this->language_fi
<?php if (!$this->language_filter && $this->switchers == 0) : ?>
<?php if ($this->homes == 1) : ?>
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<span class="fa fa-info-circle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_NONE'); ?>
</div>
<?php else : ?>
<div class="alert alert-info">
<span class="fa fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<span class="fa fa-info-circle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_USELESS_HOMES'); ?>
</div>
<?php endif; ?>
<?php else : ?>
<table class="table table-sm">
<tbody>
<?php if ($this->defaultHome == true) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_DEFAULT_HOME_MODULE_PUBLISHED'); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_DEFAULT_HOME_MODULE_PUBLISHED'); ?>
</div>
<?php endif; ?>
<?php if ($notice_homes) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_MISSING'); ?>
</td>
</tr>
<?php endif; ?>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_MISSING'); ?>
</div>
<?php endif; ?>
<?php if ($notice_disabled) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER_DISABLED'); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER_DISABLED'); ?>
</div>
<?php endif; ?>
<?php if ($notice_switchers) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_UNPUBLISHED'); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_UNPUBLISHED'); ?>
</div>
<?php endif; ?>
<?php foreach ($this->contentlangs as $contentlang) : ?>
<?php if (array_key_exists($contentlang->lang_code, $this->homepages) && (!array_key_exists($contentlang->lang_code, $this->site_langs) || !$contentlang->published)) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE', $contentlang->lang_code); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE', $contentlang->lang_code); ?>
</div>
<?php endif; ?>
<?php if (!array_key_exists($contentlang->lang_code, $this->site_langs)) : ?>
<tr class="table-warning">
<td>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_LANGUAGE_TAG', $contentlang->lang_code); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_LANGUAGE_TAG', $contentlang->lang_code); ?>
</div>
<?php endif; ?>
<?php if ($contentlang->published == -2) : ?>
<tr class="warning">
<td>
<span class="icon-pending" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE_TRASHED', $contentlang->lang_code); ?>
</td>
</tr>
<div class="alert alert-warning">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_ERROR_CONTENT_LANGUAGE_TRASHED', $contentlang->lang_code); ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($this->listUsersError) : ?>
<tr class="info">
<td>
<span class="fa fa-help" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JHELP'); ?></span>
</td>
<td>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR_TIP'); ?>
<ul>
<?php foreach ($this->listUsersError as $user) : ?>
<li>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR', $user->name); ?>
</li>
<?php endforeach; ?>
</ul>
</td>
</tr>
<div class="alert alert-info">
<span class="fa fa-help" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JHELP'); ?></span>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR_TIP'); ?>
<ul>
<?php foreach ($this->listUsersError as $user) : ?>
<li>
<?php echo Text::sprintf('COM_LANGUAGES_MULTILANGSTATUS_CONTACTS_ERROR', $user->name); ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</tbody>
</table>
<table class="table table-sm">
<thead>
<tr>
<th>
<?php echo Text::_('JDETAILS'); ?>
</th>
<th class="text-center">
<?php echo Text::_('JSTATUS'); ?>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER'); ?>
</th>
<td class="text-center">
<?php if ($this->language_filter) : ?>
<?php echo Text::_('JENABLED'); ?>
<?php else : ?>
<?php echo Text::_('JDISABLED'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_PUBLISHED'); ?>
</th>
<td class="text-center">
<?php if ($this->switchers != 0) : ?>
<?php echo $this->switchers; ?>
<?php else : ?>
<?php echo Text::_('JNONE'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php if ($this->homes > 1) : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_INCLUDING_ALL'); ?>
<?php else : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
<?php endif; ?>
</th>
<td class="text-center">
<?php if ($this->homes > 1) : ?>
<?php echo $this->homes; ?>
<?php else : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_ALL'); ?>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm">
<thead>
<tr>
<th>
<?php echo Text::_('JGRID_HEADING_LANGUAGE'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_SITE_LANG_PUBLISHED'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_PUBLISHED'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->statuses as $status) : ?>
<?php if ($status->element) : ?>
<tr>
<td>
<?php echo $status->element; ?>
</td>
<?php endif; ?>
<?php // Published Site languages ?>
<?php if ($status->element) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
</td>
<?php else : ?>
<td class="text-center">
<?php echo Text::_('JNO'); ?>
</td>
<?php endif; ?>
<?php // Published Content languages ?>
<?php if ($status->lang_code && $status->published == 1) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
</td>
<?php elseif ($status->lang_code && $status->published == 0) : ?>
<td class="text-center">
<span class="icon-pending" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php elseif ($status->lang_code && $status->published == -2) : ?>
<td class="text-center">
<span class="icon-trash" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php else : ?>
<td class="text-center">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php endif; ?>
<?php // Published Home pages ?>
<?php if ($status->home_language) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
</td>
<?php else : ?>
<td class="text-center">
<span class="fa fa-times" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JNO'); ?></span>
</td>
<?php endif; ?>
<table class="table table-sm">
<thead>
<tr>
<th>
<?php echo Text::_('JDETAILS'); ?>
</th>
<th class="text-center">
<?php echo Text::_('JSTATUS'); ?>
</th>
</tr>
<?php endforeach; ?>
<?php foreach ($this->contentlangs as $contentlang) : ?>
<?php if (!array_key_exists($contentlang->lang_code, $this->site_langs)) : ?>
<tr>
<td>
<?php echo $contentlang->lang_code; ?>
</td>
<td class="text-center">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td class="text-center">
<?php if ($contentlang->published) : ?>
</thead>
<tbody>
<tr>
<th scope="row">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGUAGEFILTER'); ?>
</th>
<td class="text-center">
<?php if ($this->language_filter) : ?>
<?php echo Text::_('JENABLED'); ?>
<?php else : ?>
<?php echo Text::_('JDISABLED'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_LANGSWITCHER_PUBLISHED'); ?>
</th>
<td class="text-center">
<?php if ($this->switchers != 0) : ?>
<?php echo $this->switchers; ?>
<?php else : ?>
<?php echo Text::_('JNONE'); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<th scope="row">
<?php if ($this->homes > 1) : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_INCLUDING_ALL'); ?>
<?php else : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
<?php endif; ?>
</th>
<td class="text-center">
<?php if ($this->homes > 1) : ?>
<?php echo $this->homes; ?>
<?php else : ?>
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED_ALL'); ?>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm">
<thead>
<tr>
<th>
<?php echo Text::_('JGRID_HEADING_LANGUAGE'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_SITE_LANG_PUBLISHED'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_CONTENT_LANGUAGE_PUBLISHED'); ?>
</th>
<th class="text-center">
<?php echo Text::_('COM_LANGUAGES_MULTILANGSTATUS_HOMES_PUBLISHED'); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->statuses as $status) : ?>
<?php if ($status->element) : ?>
<tr>
<td>
<?php echo $status->element; ?>
</td>
<?php endif; ?>
<?php // Published Site languages ?>
<?php if ($status->element) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
<?php elseif (!$contentlang->published && array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
</td>
<?php else : ?>
<td class="text-center">
<?php echo Text::_('JNO'); ?>
</td>
<?php endif; ?>
<?php // Published Content languages ?>
<?php if ($status->lang_code && $status->published == 1) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
</td>
<?php elseif ($status->lang_code && $status->published == 0) : ?>
<td class="text-center">
<span class="icon-pending" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php elseif ($status->lang_code && $status->published == -2) : ?>
<td class="text-center">
<span class="icon-trash" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php else : ?>
<td class="text-center">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<?php endif; ?>
<?php // Published Home pages ?>
<?php if ($status->home_language) : ?>
<td class="text-center">
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
</td>
<?php else : ?>
<td class="text-center">
<span class="fa fa-times" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JNO'); ?></span>
<?php elseif (!$contentlang->published) : ?>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if (!array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php else : ?>
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
<?php endif; ?>
</td>
</td>
<?php endif; ?>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach; ?>
<?php foreach ($this->contentlangs as $contentlang) : ?>
<?php if (!array_key_exists($contentlang->lang_code, $this->site_langs)) : ?>
<tr>
<td>
<?php echo $contentlang->lang_code; ?>
</td>
<td class="text-center">
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
</td>
<td class="text-center">
<?php if ($contentlang->published) : ?>
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
<?php elseif (!$contentlang->published && array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
<span class="fa fa-times" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JNO'); ?></span>
<?php elseif (!$contentlang->published) : ?>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php endif; ?>
</td>
<td class="text-center">
<?php if (!array_key_exists($contentlang->lang_code, $this->homepages)) : ?>
<span class="fa fa-exclamation-triangle" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('WARNING'); ?></span>
<?php else : ?>
<span class="fa fa-check" aria-hidden="true"></span>
<span class="sr-only"><?php echo Text::_('JYES'); ?></span>
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>