30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-09-28 21:19:07 +00:00

Merge pull request #3 from chmst/4.0-compatible-layouts-frontend

4.0 compatible layouts frontend
This commit is contained in:
Tuan Pham Ngoc 2021-07-29 22:04:13 +07:00 committed by GitHub
commit baddd59e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 458 additions and 440 deletions

View File

@ -7,7 +7,6 @@
label="WEBLINK_ID_LABEL"
readonly="true"
required="true"
size="10"
default="0"
/>
@ -23,9 +22,7 @@
name="title"
type="text"
label="JGLOBAL_TITLE"
description="COM_WEBLINKS_FIELD_TITLE_DESC"
required="true"
size="30"
/>
<field
@ -34,14 +31,12 @@
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER"
size="45"
/>
<field
name="description"
type="editor"
label="JGLOBAL_DESCRIPTION"
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
buttons="true"
hide="pagebreak,readmore"
filter="safehtml"
@ -52,9 +47,10 @@
name="state"
type="list"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
default="1"
class="form-select-color-state"
size="1"
default="1"
validate="options"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
@ -64,7 +60,6 @@
name="catid"
type="categoryedit"
label="JCATEGORY"
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
extension="com_weblinks"
required="true"
/>
@ -73,18 +68,14 @@
name="url"
type="url"
label="COM_WEBLINKS_FIELD_URL_LABEL"
description="COM_WEBLINKS_FIELD_URL_DESC"
filter="url"
required="true"
size="45"
/>
<field
name="language"
type="contentlanguage"
label="JFIELD_LANGUAGE_LABEL"
description="JFIELD_LANGUAGE_DESC"
class="inputbox"
>
<option value="*">JALL</option>
</field>
@ -100,17 +91,13 @@
name="version_note"
type="text"
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
class="inputbox"
size="45"
labelclass="control-label"
maxlength="255"
/>
<field
name="captcha"
type="captcha"
label="COM_WEBLINKS_CAPTCHA_LABEL"
description="COM_WEBLINKS_CAPTCHA_DESC"
validate="captcha"
namespace="weblink"
/>
@ -125,9 +112,7 @@
name="robots"
type="hidden"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
filter="unset"
labelclass="control-label"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
@ -140,31 +125,21 @@
name="author"
type="hidden"
label="JAUTHOR"
description="JFIELD_METADATA_AUTHOR_DESC"
filter="unset"
size="20"
labelclass="control-label"
/>
<field
name="rights"
type="hidden"
label="JFIELD_META_RIGHTS_LABEL"
description="JFIELD_META_RIGHTS_DESC"
filter="unset"
required="false"
labelclass="control-label"
/>
<field
name="xreference"
type="hidden"
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
filter="unset"
class="inputbox"
size="20"
labelclass="control-label"
/>
</fieldset>
</fields>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="com_weblinks_categories_view_default_title" option="com_weblinks_categories_view_default_option">
<layout title="COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_TITLE" option="com_weblinks_categories_view_default_option">
<help
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORIES"
/>
<message>
<![CDATA[com_weblinks_categories_view_default_desc]]>
<![CDATA[COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
@ -33,6 +33,7 @@
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
class="form-select-color-state"
useglobal="true"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -51,6 +52,7 @@
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
validate="options"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
@ -67,6 +69,7 @@
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -78,6 +81,7 @@
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -89,6 +93,7 @@
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -102,6 +107,7 @@
label="JGLOBAL_SHOW_CATEGORY_TITLE"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -113,6 +119,7 @@
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -124,6 +131,7 @@
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -134,6 +142,8 @@
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JNONE</option>
<option value="-1">JALL</option>
@ -150,6 +160,7 @@
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -161,6 +172,7 @@
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -172,6 +184,7 @@
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -198,6 +211,7 @@
label="JGLOBAL_DISPLAY_SELECT_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -209,6 +223,7 @@
label="JGLOBAL_SHOW_HEADINGS_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -220,6 +235,7 @@
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="com_weblinks_category_view_default_title" option="com_weblinks_category_view_default_option">
<layout title="COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE" option="com_weblinks_category_view_default_option">
<help
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
/>
<message>
<![CDATA[com_weblinks_category_view_default_desc]]>
<![CDATA[COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_DESC]]>
</message>
</layout>

View File

@ -16,11 +16,11 @@ use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
?>
<ul class="com-weblinks-category__children list-striped list-condensed">
<ul class="com-weblinks-category__children list-group list-unstyled">
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
<?php if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) : ?>
<li>
<h4 class="item-title">
<li class="list-group-item">
<div class="item-title">
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
<?php echo $this->escape($child->title); ?>
</a>
@ -28,7 +28,7 @@ if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
<?php if ($this->params->get('show_cat_items') == 1) : ?>
<span class="badge bg-info float-end" title="<?php echo Text::_('COM_WEBLINKS_CAT_NUM'); ?>"><?php echo $child->numitems; ?></span>
<?php endif; ?>
</h4>
</div>
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
<?php if ($child->description) : ?>

View File

@ -13,9 +13,10 @@ use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Uri\Uri;
// HTMLHelper::_('behavior.framework');
HTMLHelper::_('behavior.core');
// Create a shortcut for params.
$params = &$this->category->params;
@ -36,57 +37,71 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?php if (empty($this->items)) : ?>
<p> <?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
<?php else : ?>
<div class="com-weblinks-category__items">
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field') != 'hide') : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search"><?php echo Text::_('COM_WEBLINKS_FILTER_LABEL') . '&#160;'; ?></label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
<?php if ($this->params->get('filter_field')) : ?>
<div class="com-weblinks-category__filter btn-group">
<label class="filter-search-lbl visually-hidden" for="filter-search">
<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>
</label>
<input
type="text"
name="filter-search"
id="filter-search"
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
class="inputbox" onchange="document.adminForm.submit();"
placeholder="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>"
>
<button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button>
<button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<div class="com-weblinks-category__pagination btn-group float-end">
<label for="limit" class="visually-hidden">
<?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<ul class="category list-striped list-condensed">
<ul class="category list-group list-unstyled">
<?php foreach ($this->items as $i => $item) : ?>
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php // Shouldn't this be checked in the model?The pagination will be affected
if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php
// Shouldn't this be only for users with admin rights?
if ($item->state == 0) : ?>
<li class="system-unpublished list-group-item">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>" >
<li class="list-group-item">
<?php endif; ?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<span class="list-hits badge badge-info pull-right">
<span class="list-hits badge badge-info float-end">
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
<?php if ($canEdit) : ?>
<span class="list-edit pull-left width-50">
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $params); ?>
</span>
<?php echo LayoutHelper::render('joomla.content.icons', array('params' => $params, 'item' => $item)); ?>
<?php endif; ?>
<div class="list-title">
<?php if ($this->params->get('icons', 1) == 0) : ?>
<?php if (!$this->params->get('icons', 1)) : ?>
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
<?php else : ?>
<?php // ToDo css icons as variables ?>
<?php if (!$this->params->get('link_icons')) : ?>
<?php echo HTMLHelper::_('image', 'system/weblink.png', Text::_('COM_WEBLINKS_LINK'), null, true); ?>
<span class="icon-globe" aria-hidden="true"></span>
<?php else: ?>
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php endif; ?>
<?php endif; ?>
<?php // Compute the correct link ?>
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
<?php $link = $item->link; ?>
@ -96,7 +111,8 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?php $width = 600; ?>
<?php $height = 500; ?>
<?php endif; ?>
<?php if ($this->items[$i]->state == 0) : ?>
<?php if ($item->state == 0) : ?>
<span class="label label-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
@ -130,29 +146,38 @@ $listDirn = $this->escape($this->state->get('list.direction'));
}
?>
</div>
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
<?php $this->category->tagLayout = new FileLayout('joomla.content.tags'); ?>
<?php echo $this->category->tagLayout->render($tagsData); ?>
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
<?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?>
<?php $images = json_decode($item->images); ?>
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_first_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
src="<?php echo htmlspecialchars($images->image_first); ?>"
alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/>
</div>
<?php endif; ?>
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_second_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
src="<?php echo htmlspecialchars($images->image_second); ?>"
alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
<?php endif; ?>
<?php echo $item->description; ?>
<?php endif; ?>
</li>
@ -172,4 +197,6 @@ $listDirn = $this->escape($this->state->get('list.direction'));
</div>
<?php endif; ?>
</form>
</div>
<?php endif; ?>