diff --git a/src/admin/src/View/Templates/HtmlView.php b/src/admin/src/View/Templates/HtmlView.php index 6df018113cc..87a1f65e84b 100644 --- a/src/admin/src/View/Templates/HtmlView.php +++ b/src/admin/src/View/Templates/HtmlView.php @@ -18,6 +18,7 @@ use Exception; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Kunena\Forum\Libraries\Template\KunenaTemplate; @@ -95,10 +96,14 @@ public function displayAdd(): void */ protected function setToolBarAdd(): void { + // Get the toolbar object instance + $toolbar = Toolbar::getInstance(); + + // Set the title bar text ToolbarHelper::title(Text::_('COM_KUNENA') . ': ' . Text::_('COM_KUNENA_TEMPLATE_MANAGER'), 'color-palette'); - ToolbarHelper::spacer(); - ToolbarHelper::back(); - ToolbarHelper::spacer(); + + $toolbar->back(); + $helpUrl = 'https://docs.kunena.org/en/manual/backend/templates/edit-template-settings'; ToolbarHelper::help('COM_KUNENA', false, $helpUrl); } @@ -131,19 +136,19 @@ public function display($tpl = null) */ protected function addToolbar(): void { + // Get the toolbar object instance + $toolbar = Toolbar::getInstance(); + + // Set the title bar text ToolbarHelper::title(Text::_('COM_KUNENA') . ': ' . Text::_('COM_KUNENA_TEMPLATE_MANAGER'), 'color-palette'); - ToolbarHelper::spacer(); - ToolbarHelper::addNew('template.addnew', 'COM_KUNENA_TEMPLATES_NEW_TEMPLATE'); + + $toolbar->addNew('template.addnew', 'COM_KUNENA_TEMPLATES_NEW_TEMPLATE'); ToolbarHelper::custom('template.edit', 'edit', 'edit', 'COM_KUNENA_EDIT'); - ToolbarHelper::divider(); ToolbarHelper::custom('template.publish', 'star', 'star', 'COM_KUNENA_A_TEMPLATE_MANAGER_DEFAULT'); - ToolbarHelper::divider(); ToolbarHelper::custom('template.uninstall', 'remove', 'remove', 'COM_KUNENA_A_TEMPLATE_MANAGER_UNINSTALL'); - ToolbarHelper::spacer(); ToolbarHelper::custom('template.chooseCss', 'edit', 'edit', 'COM_KUNENA_A_TEMPLATE_MANAGER_EDITCSS'); - ToolbarHelper::divider(); ToolbarHelper::custom('template.chooseScss', 'edit', 'edit', 'COM_KUNENA_A_TEMPLATE_MANAGER_EDITSCSS'); - ToolbarHelper::divider(); + $helpUrl = 'https://docs.kunena.org/en/manual/backend/templates/add-template'; ToolbarHelper::help('COM_KUNENA', false, $helpUrl); } @@ -185,16 +190,17 @@ public function displayEdit(): void */ protected function setToolBarEdit(): void { + // Get the toolbar object instance + $toolbar = Toolbar::getInstance(); + + // Set the title bar text ToolbarHelper::title(Text::_('COM_KUNENA') . ': ' . Text::_('COM_KUNENA_TEMPLATE_MANAGER'), 'color-palette'); - ToolbarHelper::spacer(); - ToolbarHelper::apply('apply'); - ToolbarHelper::spacer(); - ToolbarHelper::save('save'); - ToolbarHelper::spacer(); + + $toolbar->apply('apply'); + $toolbar->save('save'); ToolbarHelper::custom('restore', 'checkin.png', 'checkin_f2.png', 'COM_KUNENA_TRASH_RESTORE_TEMPLATE_SETTINGS', false); - ToolbarHelper::spacer(); - ToolbarHelper::cancel(); - ToolbarHelper::spacer(); + $toolbar->cancel(); + $helpUrl = 'https://docs.kunena.org/en/manual/backend/templates/edit-template-settings'; ToolbarHelper::help('COM_KUNENA', false, $helpUrl); } @@ -223,14 +229,14 @@ public function displayEditCss(): void */ protected function setToolBarEditCss(): void { + // Get the toolbar object instance + $toolbar = Toolbar::getInstance(); + + // Set the title bar text ToolbarHelper::title(Text::_('COM_KUNENA') . ': ' . Text::_('COM_KUNENA_TEMPLATE_MANAGER'), 'color-palette'); - ToolbarHelper::spacer(); - ToolbarHelper::apply('applyCss'); - ToolbarHelper::spacer(); - ToolbarHelper::save('saveCss'); - ToolbarHelper::spacer(); - ToolbarHelper::spacer(); - ToolbarHelper::cancel(); - ToolbarHelper::spacer(); + + $toolsbar->apply('applyCss'); + $toolsbar->save('saveCss'); + $toolsbar->cancel(); } } diff --git a/src/admin/tmpl/attachments/default.php b/src/admin/tmpl/attachments/default.php index e2f0a224207..6d6c3bc6f27 100644 --- a/src/admin/tmpl/attachments/default.php +++ b/src/admin/tmpl/attachments/default.php @@ -79,7 +79,7 @@ <td class="text-center"> <?php echo HTMLHelper::_('grid.id', $i, intval($attachment->id)) ?> </td> - <td> + <th> <div class="d-flex"> <div class="image me-2 align-self-center"> <?php echo $attachment->getLayout()->render('thumbnail'); ?> @@ -88,7 +88,7 @@ <small><?php echo $attachment->getFilename(); ?></small> </div> </div> - </td> + </th> <td><?php echo $this->escape($attachment->filetype); ?></td> <td><?php echo number_format(intval($attachment->size) / 1024, 0, '', ',') . ' ' . Text::_('COM_KUNENA_A_FILESIZE_KB'); ?></td> <td><?php echo $attachment->width > 0 ? $attachment->width . ' x ' . $attachment->height : '' ?></td> diff --git a/src/admin/tmpl/ranks/default.php b/src/admin/tmpl/ranks/default.php index 80d68aaf3c0..33385a8a1b3 100644 --- a/src/admin/tmpl/ranks/default.php +++ b/src/admin/tmpl/ranks/default.php @@ -86,14 +86,14 @@ <img loading=lazy src="<?php echo $this->escape($this->ktemplate->getRankPath($item->rankImage, true)) ?>" alt="<?php echo $this->escape($item->rankImage); ?>" /> <?php endif; ?> </td> - <td> + <th> <?php if ($canEdit) : ?> <a href="<?php echo Route::_('index.php?option=com_kunena&view=rank&layout=edit&id=' . $item->rankId); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->rankTitle); ?>"> <?php echo Text::_($item->rankTitle); ?></a> <?php else : ?> <?php echo Text::_($item->rankTitle); ?> <?php endif; ?> - </td> + </th> <td class="d-none d-md-table-cell"> <?php echo $item->rankSpecial == 1 ? Text::_('COM_KUNENA_YES') : Text::_('COM_KUNENA_NO'); ?> diff --git a/src/admin/tmpl/smilies/default.php b/src/admin/tmpl/smilies/default.php index c1abdc00358..c3aded5c5e1 100644 --- a/src/admin/tmpl/smilies/default.php +++ b/src/admin/tmpl/smilies/default.php @@ -67,11 +67,11 @@ <td class="text-center"> <?php echo HTMLHelper::_('grid.id', $i, intval($row->id)) ?> </td> - <td class="d-none d-md-table-cell center"> + <th class="d-none d-md-table-cell center"> <a href="<?php echo Route::_('index.php?option=com_kunena&view=smiley&layout=edit&id=' . (int) $row->id); ?>"> <img loading=lazy src="<?php echo $this->escape($this->ktemplate->getSmileyPath($row->location, true)); ?>" alt="<?php echo $this->escape($row->location); ?>" /> </a> - </td> + </td> <td> <?php echo $this->escape($row->code); ?> </td> diff --git a/src/admin/tmpl/templates/default.php b/src/admin/tmpl/templates/default.php index 8610a3845e1..1791996c118 100644 --- a/src/admin/tmpl/templates/default.php +++ b/src/admin/tmpl/templates/default.php @@ -13,85 +13,79 @@ defined('_JEXEC') or die(); +use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; -use Joomla\CMS\WebAsset\WebAssetManager; -use Kunena\Forum\Libraries\Version\KunenaVersion; use Kunena\Forum\Libraries\Route\KunenaRoute; +use Kunena\Forum\Libraries\Version\KunenaVersion; -/** @var WebAssetManager $wa */ +/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */ $wa = $this->document->getWebAssetManager(); -$wa->useScript('multiselect'); +$wa->useScript('table.columns') + ->useScript('multiselect'); + +$app = Factory::getApplication(); +$user = $this->getCurrentUser(); +$userId = $user->get('id'); ?> -<div id="kunena" class="container-fluid"> +<form action="<?php echo KunenaRoute::_('administrator/index.php?option=com_kunena&view=templates') ?>" method="post" id="adminForm" name="adminForm"> <div class="row"> - <div id="j-main-container" class="col-md-12" role="main"> - <div class="card card-block bg-faded p-2"> - <form action="<?php echo KunenaRoute::_('administrator/index.php?option=com_kunena&view=templates') ?>" - method="post" id="adminForm" name="adminForm"> - <input type="hidden" name="task" value=""/> - <input type="hidden" name="boxchecked" value="0"/> - <?php echo HTMLHelper::_('form.token'); ?> - - <div class="btn-group pull-right d-none d-md-block"> - <label for="limit" - class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label> - </div> - - <table class="table table-striped"> - <thead> + <div class="col-md-12"> + <div id="j-main-container" class="j-main-container"> + <div class="btn-group pull-right d-none d-md-block"> + <label for="limit" class="element-invisible"><?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?></label> + </div> + <table class="table"> + <thead> <tr> - <th width="1%"></th> - <th><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NAME'); ?></th> - <th class="text-center"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DEFAULT'); ?></th> - <th><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR'); ?></th> - <th><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_VERSION'); ?></th> - <th><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DATE'); ?></th> - <th><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR_URL'); ?></th> + <td class="w-1 text-center"></td> + <th scope="col" class="w-10 d-none d-md-table-cell"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NAME'); ?> + </th> + <th scope="col" class="w-1 text-center"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DEFAULT'); ?> + </th> + <th scope="col" class="w-20 d-none d-md-table-cell"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR'); ?> + </th> + <th scope="col" class="w-10 d-none d-md-table-cell"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_VERSION'); ?> + </th> + <th scope="col" class="w-10 d-none d-md-table-cell"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DATE'); ?> + </th> + <th scope="col" class="w-15 d-none d-md-table-cell"> + <?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR_URL'); ?> + </th> </tr> - </thead> - <tfoot> - <tr> - <td colspan="7"> - </td> - </tr> - </tfoot> - <tbody> - <?php foreach ($this->templates as $id => $row) : - ?> + </thead> + <tbody> + <?php + $i = 0; + $img_no = '<span class="icon-unfeatured" aria-hidden="true"></span>'; + $img_yes = '<span class="icon-color-featured icon-star" aria-hidden="true"></span>'; + + foreach ($this->templates as $id => $row) : + $templatepublishTask = $row->published ? 'template.unpublish' : 'template.publish'; + ?> <tr> - <td> - <input type="radio" id="cb<?php echo $this->escape($row->directory); ?>" - name="cid[]" - value="<?php echo $this->escape($row->directory); ?>" - onclick="Joomla.isChecked(this.checked);"/> + <td class="text-center"> + <input type="radio" id="cb<?php echo $i; ?>" name="cid[]" value="<?php echo $this->escape($row->directory); ?>" onclick="Joomla.isChecked(this.checked);" /> </td> - <td> + <th> <?php $img_path = Uri::root(true) . '/components/com_kunena/template/' . $row->directory . '/assets/images/template_thumbnail.png'; ?> - <span class="editlinktip hasTip" - title="<?php echo $this->escape($row->name . '::<img loading=lazy border="1" src="' . $this->escape($img_path) . '" name="imagelib" alt="' . Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_NO_PREVIEW') . '" width="200" height="145" />'); ?>"> - <a href="<?php echo Route::_('index.php?option=com_kunena&view=template&layout=edit&name=' . $this->escape($row->directory)); ?>" - title="<?php echo $this->escape($row->name); ?>"> - <?php echo $this->escape($row->name); ?></a> - </span> - </td> - <td class="tbody-icon"> - <?php if ($row->published == 1) : - ?> - <a class="tbody-icon jgrid" title="Default"><span - class="icon-color-featured icon-star"></span></a> - - <?php else : - ?> - <a href="javascript: void(0);" - onclick="return Joomla.listItemTask('cb<?php echo urlencode($row->directory); ?>','template.publish')"> - <span class="icon-unfeatured" - title="<?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_NO_DEFAULT'); ?>"></span> - </a> - <?php endif; ?> + <span class="editlinktip hasTip" title="<?php echo $this->escape($row->name . '::<img loading=lazy border="1" src="' . $this->escape($img_path) . '" name="imagelib" alt="' . Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_NO_PREVIEW') . '" width="200" height="145" />'); ?>"> + <a href="<?php echo Route::_('index.php?option=com_kunena&view=template&layout=edit&name=' . $this->escape($row->directory)); ?>" title="<?php echo $this->escape($row->name); ?>"> + <?php echo $this->escape($row->name); ?></a> + </span> + </th> + <td class="d-none d-md-table-cell text-center tbody-icon"> + <a href="javascript: void(0);" onclick="return Joomla.listItemTask('cb<?php echo $i; ?>', '<?php echo $templatepublishTask; ?>')"> + <?php echo $row->published ? $img_yes : $img_no; ?> + </a> </td> <td> <?php echo $row->authorEmail ? '<a href="mailto:' . $this->escape($row->authorEmail) . '">' . $this->escape($row->author) . '</a>' : $this->escape($row->author); ?> @@ -103,79 +97,78 @@ class="icon-color-featured icon-star"></span></a> <?php echo $this->escape($row->creationdate); ?> </td> <td> - <a href="<?php echo $this->escape($row->authorUrl); ?>" target="_blank" - rel="noopener noreferrer"><?php echo $this->escape($row->authorUrl); ?></a> + <a href="<?php echo $this->escape($row->authorUrl); ?>" target="_blank" rel="noopener noreferrer"><?php echo $this->escape($row->authorUrl); ?></a> </td> </tr> - <?php endforeach; ?> - </tbody> - </table> - <table class="table table-striped" style="padding-top: 200px;"> + <?php $i++; + endforeach; ?> + </tbody> + </table> + <h2 class="mt-5"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_PREMIUM'); ?></h2> + <?php if ($this->templatesxml !== false) : ?> + <table class="table"> <thead> - <tr> - <td colspan="7"> - <strong><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_PREMIUM'); ?></strong></td> - </tr> + <tr> + <th class="w-10"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_PRICE'); ?></th> + <th class="w-5"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TYPE'); ?></th> + <th class="w-5"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_VERSION'); ?></th> + <th class="w-15"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NAME'); ?></th> + <th class="w-10"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DATE'); ?></th> + <th class="w-10"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR'); ?></th> + <th class="w-10"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DOWNLOAD'); ?></th> + <th class="w-25"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR_URL'); ?></th> + </tr> </thead> <tbody> - <tr> - <th width="5%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_PRICE'); ?></th> - <th width="5%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TYPE'); ?></th> - <th width="5%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_VERSION'); ?></th> - <th width="15%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_TEMPLATE_NAME'); ?></th> - <th width="10%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DATE'); ?></th> - <th width="10%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR'); ?></th> - <th width="10%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DOWNLOAD'); ?></th> - <th width="25%"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_AUTHOR_URL'); ?></th> - <th width="30%"></th> - </tr> - <?php if ($this->templatesxml !== false) : ?> <?php foreach ($this->templatesxml as $row) : ?> <tr> - <td style="width: 5%;"><?php echo $row->price; ?> - </td> - <td style="width: 5%;"><?php echo $row->type == 'paid-template' ? Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_PAID') : Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_FREE'); ?> + <td> + <?php echo $row->price; ?> </td> - <td style="width: 5%;"><?php echo $row->version; ?> + <td> + <?php echo $row->type == 'paid-template' ? Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_PAID') : Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_FREE'); ?> </td> - <td style="width: 15%;"> - <span class="editlinktip hasTip" - title="<?php echo $row->name . $this->escape('::<img loading=lazy border="1" src="' . $row->thumbnail . '" name="imagelib" alt="' . Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_NO_PREVIEW') . '" width="200" height="145" />'); ?>"> - <a href="<?php echo $row->detailsurl; ?>" target="_blank" - rel="noopener noreferrer"><?php echo $row->name; ?></a> - </span> + <td> + <?php echo $row->version; ?> </td> - <td style="width: 10%;"> + <th> + <span class="editlinktip hasTip" title="<?php echo $row->name . $this->escape('::<img loading=lazy border="1" src="' . $row->thumbnail . '" name="imagelib" alt="' . Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_NO_PREVIEW') . '" width="200" height="145" />'); ?>"> + <a href="<?php echo $row->detailsurl; ?>" target="_blank" rel="noopener noreferrer"><?php echo $row->name; ?></a> + </span> + </th> + <td> <?php echo $row->created; ?> </td> - <td style="width: 10%;"> + <td> <a href="mailto:<?php echo $row->authoremail; ?>"><?php echo $row->author; ?></a> </td> - <td style="width: 10%;"> - <a href="<?php echo $row->detailsurl; ?>" target="_blank" - rel="noopener noreferrer"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DOWNLOAD'); ?></a> - </td> - <td style="width: 25%;"> - <a href="<?php echo $row->authorurl; ?>" target="_blank" - rel="noopener noreferrer"><?php echo $row->authorurl; ?></a> + <td> + <a href="<?php echo $row->detailsurl; ?>" target="_blank" rel="noopener noreferrer"><?php echo Text::_('COM_KUNENA_A_TEMPLATE_MANAGER_DOWNLOAD'); ?></a> </td> - <td style="width: 30%;"> + <td> + <a href="<?php echo $row->authorurl; ?>" target="_blank" rel="noopener noreferrer"><?php echo $row->authorurl; ?></a> </td> </tr> <?php endforeach; ?> - <?php else : ?> - <tr> - <td style="width: 30%;"><?php echo Text::_('COM_KUNENA_ADMIN_TEMPLATE_MANAGER_ERROR_CANNOT_CONNECT_TO_KUNENA_SERVER'); ?> - </td> - </tr> - <?php endif; ?> </tbody> </table> - </form> + <?php else : ?> + <div> + <div class="alert alert-danger"><?php echo Text::_('COM_KUNENA_ADMIN_TEMPLATE_MANAGER_ERROR_CANNOT_CONNECT_TO_KUNENA_SERVER'); ?> + </div> + </div> + <?php endif; ?> + <?php // load the pagination. + ?> + <?php echo $this->pagination->getListFooter(); ?> + + <input type="hidden" name="task" value="" /> + <input type="hidden" name="boxchecked" value="0" /> + <?php echo HTMLHelper::_('form.token'); ?> </div> </div> </div> - <div class="pull-right small"> - <?php echo KunenaVersion::getLongVersionHTML(); ?> - </div> -</div> +</form> +<div class="mt-3 text-center small"> + <?php echo KunenaVersion::getLongVersionHTML(); ?> +</div> \ No newline at end of file diff --git a/src/admin/tmpl/users/default.php b/src/admin/tmpl/users/default.php index 1bbb108e382..9c654c38e8b 100644 --- a/src/admin/tmpl/users/default.php +++ b/src/admin/tmpl/users/default.php @@ -92,7 +92,7 @@ <td class="text-center"> <?php echo HTMLHelper::_('grid.id', $i, intval($user->userid)) ?> </td> - <td> + <th> <div class="editlinktip d-flex kwho-<?php echo $user->getType(0, true); ?>" title="<?php echo $this->escape($user->username); ?> "> <div class="avatar me-2 align-self-center"> <?php echo $user->getAvatarImage(KunenaFactory::getTemplate()->params->get('avatarType'), 'thumb'); ?> @@ -108,7 +108,7 @@ </div> </div> </div> - </td> + </th> <td> <a href="<?php echo Route::_('index.php?option=com_kunena&view=user&layout=edit&userid=' . (int) $user->userid); ?>" title="<?php echo Text::sprintf('COM_USERS_EDIT_USER', $this->escape($user->name)); ?>"> <?php echo $this->escape($user->email); ?></a>