32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-12-26 01:57:30 +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>
@ -13,8 +13,8 @@
<fields name="request">
<fieldset name="request"
>
<field
name="id"
<field
name="id"
type="category"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
extension="com_weblinks"
@ -25,240 +25,256 @@
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic" label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
class="form-select-color-state"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<fields name="params">
<fieldset name="basic" label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
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>
</field>
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
cols="25"
rows="5"
/>
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
cols="25"
rows="5"
/>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
validate="options"
>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
</field>
<field
name="show_empty_categories_cat"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_empty_categories_cat"
type="list"
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>
</field>
<field
name="show_subcat_desc_cat"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc_cat"
type="list"
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>
</field>
<field
name="show_cat_num_links_cat"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<field
name="show_cat_num_links_cat"
type="list"
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>
</field>
</fieldset>
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
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>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
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>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
>
<option value="0">JNONE</option>
<option value="-1">JALL</option>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="maxLevel"
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>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="5">J5</option>
</field>
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_empty_categories"
type="list"
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>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
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>
</field>
<field
name="show_cat_num_links"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_links"
type="list"
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>
</field>
</fieldset>
</fieldset>
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
default=""
useglobal="true"
class="form-select-color-state"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
default=""
useglobal="true"
class="form-select-color-state"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
useglobal="true"
class="form-select-color-state"
validate="options"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link_description"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link_description"
type="list"
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>
</field>
<field
name="show_link_hits"
type="list"
label="JGLOBAL_HITS"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link_hits"
type="list"
label="JGLOBAL_HITS"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
useglobal="true"
class="form-select-color-state"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</fields>
</metadata>

View File

@ -18,39 +18,39 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
?>
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
<div class="com-weblinks-categories__items">
<h3 class="page-header item-title">
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
<div class="com-weblinks-categories__items">
<h3 class="page-header item-title">
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php if ($this->params->get('show_cat_items_cat') == 1) :?>
<span class="badge bg-info">
<span class="badge bg-info">
<?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>&nbsp;
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<button
type="button"
id="category-btn-<?php echo $item->id; ?>"
data-bs-target="#category-<?php echo $item->id; ?>"
data-bs-toggle="collapse"
class="btn btn-secondary btn-sm float-end"
aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"
>
<span class="icon-plus" aria-hidden="true"></span>
</button>
<button
type="button"
id="category-btn-<?php echo $item->id; ?>"
data-bs-target="#category-<?php echo $item->id; ?>"
data-bs-toggle="collapse"
class="btn btn-secondary btn-sm float-end"
aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"
>
<span class="icon-plus" aria-hidden="true"></span>
</button>
<?php endif; ?>
</h3>
</h3>
<?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
<?php if ($item->description) : ?>
<div class="category-desc">
<div class="category-desc">
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<div class="collapse fade" id="category-<?php echo $item->id; ?>">
<div class="collapse fade" id="category-<?php echo $item->id; ?>">
<?php
$this->items[$item->id] = $item->getChildren();
$this->parent = $item;
@ -59,9 +59,9 @@ if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
$this->parent = $item->getParent();
$this->maxLevelcat++;
?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>

View File

@ -1,19 +1,19 @@
<?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>
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field
name="id"
<field
name="id"
type="category"
label="COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL"
default="0"
@ -29,8 +29,8 @@
name="basic"
label="JGLOBAL_CATEGORY_OPTIONS"
description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
<field
name="show_category_title"
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
useglobal="true"
@ -40,8 +40,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
useglobal="true"
@ -51,8 +51,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
useglobal="true"
@ -62,8 +62,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
useglobal="true"
@ -78,8 +78,8 @@
</field>
<field
name="show_empty_categories"
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
useglobal="true"
@ -89,8 +89,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
@ -100,8 +100,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_cat_num_links"
<field
name="show_cat_num_links"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
@ -126,8 +126,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination_limit"
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
useglobal="true"
@ -137,8 +137,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_headings"
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
useglobal="true"
@ -148,8 +148,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_link_description"
<field
name="show_link_description"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
useglobal="true"
@ -159,8 +159,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_link_hits"
<field
name="show_link_hits"
type="list"
label="JGLOBAL_HITS"
useglobal="true"
@ -170,8 +170,8 @@
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
useglobal="true"
@ -182,8 +182,8 @@
<option value="2">JGLOBAL_AUTO</option>
</field>
<field
name="show_pagination_results"
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
useglobal="true"
@ -195,8 +195,8 @@
</fieldset>
<fieldset name="integration">
<field
name="show_feed_link"
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
useglobal="true"
@ -204,7 +204,7 @@
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -16,25 +16,25 @@ 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">
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
<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>
</a>
<?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>
<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) : ?>
<div class="category-desc">
<div class="category-desc">
<?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
@ -46,8 +46,8 @@ if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
$this->category = $child->getParent();
$this->maxLevel++;
endif; ?>
</li>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</ul>
<?php endif; ?>

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,140 +37,166 @@ $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')) : ?>
<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="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; ?>
<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'); ?>" />
</div>
<?php endif; ?>
<ul class="category list-group list-unstyled">
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<?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">
<?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 else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>" >
<?php endif; ?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<span class="list-hits badge badge-info pull-right">
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
<?php foreach ($this->items as $i => $item) : ?>
<?php if ($canEdit) : ?>
<span class="list-edit pull-left width-50">
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $params); ?>
</span>
<?php endif; ?>
<div class="list-title">
<?php if ($this->params->get('icons', 1) == 0) : ?>
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
<?php if (!$this->params->get('link_icons')) : ?>
<?php echo HTMLHelper::_('image', 'system/weblink.png', Text::_('COM_WEBLINKS_LINK'), null, true); ?>
<?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; ?>
<?php $width = $item->params->get('width'); ?>
<?php $height = $item->params->get('height'); ?>
<?php if ($width == null || $height == null) : ?>
<?php $width = 600; ?>
<?php $height = 500; ?>
<?php endif; ?>
<?php if ($this->items[$i]->state == 0) : ?>
<span class="label label-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php // Shouldn't this be checked in the model?The pagination will be affected
if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php
switch ($item->params->get('target', $this->params->get('target')))
{
case 1:
// Open in a new window
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
case 2:
// Open in a popup window
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
$this->escape($item->title) . '</a>';
break;
case 3:
// Open in a modal window
HTMLHelper::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . ' </a>';
break;
default:
// Open in parent window
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . ' </a>';
break;
}
?>
</div>
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->category->tagLayout = new FileLayout('joomla.content.tags'); ?>
<?php echo $this->category->tagLayout->render($tagsData); ?>
// 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="list-group-item">
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) and ($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
<?php if ($images->image_first_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<span class="list-hits badge badge-info float-end">
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
<?php if ($canEdit) : ?>
<?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)) : ?>
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
<?php else : ?>
<?php // ToDo css icons as variables ?>
<?php if (!$this->params->get('link_icons')) : ?>
<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; ?>
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
<?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>
<?php endif; ?>
<?php echo $item->description; ?>
<?php endif; ?>
</li>
<?php endif;?>
<?php endforeach; ?>
</ul>
<?php // Code to add a link to submit a weblink. ?>
<?php if ($this->params->get('show_pagination')) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php // Compute the correct link ?>
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
<?php $link = $item->link; ?>
<?php $width = $item->params->get('width'); ?>
<?php $height = $item->params->get('height'); ?>
<?php if ($width == null || $height == null) : ?>
<?php $width = 600; ?>
<?php $height = 500; ?>
<?php endif; ?>
<?php if ($item->state == 0) : ?>
<span class="label label-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php
switch ($item->params->get('target', $this->params->get('target')))
{
case 1:
// Open in a new window
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
case 2:
// Open in a popup window
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
$this->escape($item->title) . '</a>';
break;
case 3:
// Open in a modal window
HTMLHelper::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . ' </a>';
break;
default:
// Open in parent window
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . ' </a>';
break;
}
?>
</div>
<?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')) && ($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
<?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>
<?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
<?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>
<?php endif; ?>
<?php echo $item->description; ?>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php // Code to add a link to submit a weblink. ?>
<?php if ($this->params->get('show_pagination')) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</form>
</form>
</div>
<?php endif; ?>