Implements searchtools, filters, dropdown actions and counting (#208)
* implements searchtools, filters and merge the other two PR * just to force travis to run * revert * filter is published * filter is published 2 * modify filter test thanks to yvesh * code style * elseif , not else if
This commit is contained in:
parent
cff91ba244
commit
258f337d59
|
@ -39,4 +39,57 @@ class WeblinksHelper extends JHelperContent
|
|||
$vName == 'categories'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Count Items for WebLinks Category Manager.
|
||||
*
|
||||
* @param stdClass[] &$items The weblinks category objects.
|
||||
*
|
||||
* @return stdClass[] The weblinks category objects.
|
||||
*
|
||||
* @since 3.6.0
|
||||
*/
|
||||
public static function countItems(&$items)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$item->count_trashed = 0;
|
||||
$item->count_archived = 0;
|
||||
$item->count_unpublished = 0;
|
||||
$item->count_published = 0;
|
||||
|
||||
$query = $db->getQuery(true)
|
||||
->select('state, COUNT(*) AS count')
|
||||
->from($db->qn('#__weblinks'))
|
||||
->where($db->qn('catid') . ' = ' . (int) $item->id)
|
||||
->group('state');
|
||||
|
||||
$db->setQuery($query);
|
||||
$weblinks = $db->loadObjectList();
|
||||
|
||||
foreach ($weblinks as $weblink)
|
||||
{
|
||||
if ($weblink->state == 1)
|
||||
{
|
||||
$item->count_published = $weblink->count;
|
||||
}
|
||||
elseif ($weblink->state == 0)
|
||||
{
|
||||
$item->count_unpublished = $weblink->count;
|
||||
}
|
||||
elseif ($weblink->state == 2)
|
||||
{
|
||||
$item->count_archived = $weblink->count;
|
||||
}
|
||||
elseif ($weblink->state == -2)
|
||||
{
|
||||
$item->count_trashed = $weblink->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="filter">
|
||||
<field
|
||||
name="search"
|
||||
type="text"
|
||||
label="COM_WEBLINKS_FILTER_SEARCH_LABEL"
|
||||
description="COM_WEBLINKS_FILTER_SEARCH_DESC"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="status"
|
||||
label="JOPTION_FILTER_PUBLISHED"
|
||||
description="JOPTION_FILTER_PUBLISHED_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
name="category_id"
|
||||
type="category"
|
||||
label="JOPTION_FILTER_CATEGORY"
|
||||
description="JOPTION_FILTER_CATEGORY_DESC"
|
||||
extension="com_weblinks"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_CATEGORY</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="JOPTION_FILTER_ACCESS"
|
||||
description="JOPTION_FILTER_ACCESS_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_ACCESS</option>
|
||||
</field>
|
||||
<field
|
||||
name="language"
|
||||
type="contentlanguage"
|
||||
label="JOPTION_FILTER_LANGUAGE"
|
||||
description="JOPTION_FILTER_LANGUAGE_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
<field
|
||||
name="tag"
|
||||
type="tag"
|
||||
label="JOPTION_FILTER_TAG"
|
||||
description="JOPTION_FILTER_TAG_DESC"
|
||||
mode="nested"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_TAG</option>
|
||||
</field>
|
||||
<field
|
||||
name="level"
|
||||
type="integer"
|
||||
label="JOPTION_FILTER_LEVEL"
|
||||
description="JOPTION_FILTER_LEVEL_DESC"
|
||||
first="1"
|
||||
last="10"
|
||||
step="1"
|
||||
languages="*"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_MAX_LEVELS</option>
|
||||
</field>
|
||||
</fields>
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
onchange="this.form.submit();"
|
||||
default="a.title ASC"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.state ASC">JSTATUS_ASC</option>
|
||||
<option value="a.state DESC">JSTATUS_DESC</option>
|
||||
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
|
||||
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
|
||||
<option value="category_title ASC">JCATEGORY_ASC</option>
|
||||
<option value="category_title DESC">JCATEGORY_DESC</option>
|
||||
<option value="access_level ASC">JGRID_HEADING_ACCESS_ASC</option>
|
||||
<option value="access_level DESC">JGRID_HEADING_ACCESS_DESC</option>
|
||||
<option value="a.hits ASC">JGLOBAL_HITS_ASC</option>
|
||||
<option value="a.hits DESC">JGLOBAL_HITS_DESC</option>
|
||||
<option value="language_title ASC">JGRID_HEADING_LANGUAGE_ASC</option>
|
||||
<option value="language_title DESC">JGRID_HEADING_LANGUAGE_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
|
@ -34,18 +34,23 @@ class WeblinksModelWeblinks extends JModelList
|
|||
'alias', 'a.alias',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'catid', 'a.catid', 'category_title',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'catid', 'a.catid', 'category_id',
|
||||
'c.title', 'category_title',
|
||||
'state', 'a.state', 'published',
|
||||
'access', 'a.access',
|
||||
'ag.title', 'access_level',
|
||||
'created', 'a.created',
|
||||
'created_by', 'a.created_by',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'l.title', 'language_title',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'url', 'a.url',
|
||||
'tag',
|
||||
'level', 'c.level',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -60,33 +65,23 @@ class WeblinksModelWeblinks extends JModelList
|
|||
* @note Calling getState in this method will result in recursion.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
protected function populateState($ordering = 'a.title', $direction = 'asc')
|
||||
{
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$accessId = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
|
||||
$this->setState('filter.state', $published);
|
||||
|
||||
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '');
|
||||
$this->setState('filter.category_id', $categoryId);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
|
||||
$this->setState('filter.tag', $tag);
|
||||
$this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string'));
|
||||
$this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd'));
|
||||
$this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string'));
|
||||
$this->setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd'));
|
||||
$this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '', 'string'));
|
||||
$this->setState('filter.tag', $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '', 'string'));
|
||||
$this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd'));
|
||||
|
||||
// Load the parameters.
|
||||
$params = JComponentHelper::getParams('com_weblinks');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.title', 'asc');
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,9 +102,11 @@ class WeblinksModelWeblinks extends JModelList
|
|||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.state');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.category_id');
|
||||
$id .= ':' . $this->getState('filter.language');
|
||||
$id .= ':' . $this->getState('filter.tag');
|
||||
$id .= ':' . $this->getState('filter.level');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
@ -136,47 +133,48 @@ class WeblinksModelWeblinks extends JModelList
|
|||
'a.hits, a.state, a.access, a.ordering, a.language, a.publish_up, a.publish_down'
|
||||
)
|
||||
);
|
||||
$query->from($db->quoteName('#__weblinks') . ' AS a');
|
||||
$query->from($db->quoteName('#__weblinks', 'a'));
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title, l.image AS language_image')
|
||||
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||
$query->select($db->quoteName('l.title', 'language_title'))
|
||||
->select($db->quoteName('l.image', 'language_image'))
|
||||
->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON ' . $db->qn('l.lang_code') . ' = ' . $db->qn('a.language'));
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor')
|
||||
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
$query->select($db->quoteName('uc.name', 'editor'))
|
||||
->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->qn('uc.id') . ' = ' . $db->qn('a.checked_out'));
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level')
|
||||
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
$query->select($db->quoteName('ag.title', 'access_level'))
|
||||
->join('LEFT', $db->quoteName('#__viewlevels', 'ag') . ' ON ' . $db->qn('ag.id') . ' = ' . $db->qn('a.access'));
|
||||
|
||||
// Join over the categories.
|
||||
$query->select('c.title AS category_title')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||
->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('a.catid'));
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where($db->quoteName('a.access') . ' = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.admin'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
$query->where($db->quoteName('a.access') . ' IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.state');
|
||||
$published = $this->getState('filter.published');
|
||||
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.state = ' . (int) $published);
|
||||
$query->where($db->quoteName('a.state') . ' = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.state IN (0, 1))');
|
||||
$query->where('(' . $db->quoteName('a.state') . ' IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by category.
|
||||
|
@ -184,7 +182,13 @@ class WeblinksModelWeblinks extends JModelList
|
|||
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId);
|
||||
$query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId);
|
||||
}
|
||||
|
||||
// Filter on the level.
|
||||
if ($level = $this->getState('filter.level'))
|
||||
{
|
||||
$query->where($db->quoteName('c.level') . ' <= ' . (int) $level);
|
||||
}
|
||||
|
||||
// Filter by search in title
|
||||
|
@ -194,19 +198,19 @@ class WeblinksModelWeblinks extends JModelList
|
|||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.id = ' . (int) substr($search, 3));
|
||||
$query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
|
||||
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')');
|
||||
$query->where('(' . $db->quoteName('a.title') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.alias') . ' LIKE ' . $search . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
$query->where($db->quoteName('a.language') . ' = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
$tagId = $this->getState('filter.tag');
|
||||
|
@ -223,8 +227,8 @@ class WeblinksModelWeblinks extends JModelList
|
|||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering');
|
||||
$orderDirn = $this->state->get('list.direction');
|
||||
$orderCol = $this->state->get('list.ordering', 'a.title');
|
||||
$orderDirn = $this->state->get('list.direction', 'ASC');
|
||||
|
||||
if ($orderCol == 'a.ordering' || $orderCol == 'category_title')
|
||||
{
|
||||
|
|
|
@ -26,64 +26,17 @@ if ($saveOrder)
|
|||
$saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
|
||||
}
|
||||
$sortFields = $this->getSortFields();
|
||||
|
||||
JFactory::getDocument()->addScriptDeclaration('
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != "' . $listOrder . '")
|
||||
{
|
||||
dirn = "asc";
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, "");
|
||||
};
|
||||
');
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<?php if (!empty($this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif;?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_WEBLINKS_SEARCH_IN_TITLE');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_WEBLINKS_SEARCH_IN_TITLE'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.getElementById('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
||||
<div class="clearfix"> </div>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-no-items">
|
||||
|
@ -94,34 +47,34 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
<thead>
|
||||
<tr>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
||||
</th>
|
||||
<th width="1%" class="hidden-phone center">
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th width="1%" style="min-width:55px" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
<td colspan="8">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -135,7 +88,7 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
|
||||
$canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin;
|
||||
?>
|
||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid?>">
|
||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid; ?>">
|
||||
<td class="order nowrap center hidden-phone">
|
||||
<?php
|
||||
$iconClass = '';
|
||||
|
@ -152,14 +105,24 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
<i class="icon-menu"></i>
|
||||
</span>
|
||||
<?php if ($canChange && $saveOrder) : ?>
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering;?>" class="width-20 text-area-order " />
|
||||
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="center hidden-phone">
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||
<div class="btn-group">
|
||||
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||
<?php // Create dropdown items and render the dropdown list.
|
||||
if ($canChange)
|
||||
{
|
||||
JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'weblinks');
|
||||
JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'weblinks');
|
||||
echo JHtml::_('actionsdropdown.render', $this->escape($item->title));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="nowrap has-context">
|
||||
<?php if ($item->checked_out) : ?>
|
||||
|
@ -172,10 +135,10 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
<?php echo $this->escape($item->title); ?>
|
||||
<?php endif; ?>
|
||||
<span class="small">
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||
</span>
|
||||
<div class="small">
|
||||
<?php echo $this->escape($item->category_title); ?>
|
||||
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
|
@ -185,7 +148,7 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
<?php echo $item->hits; ?>
|
||||
</td>
|
||||
<td class="small nowrap hidden-phone">
|
||||
<?php if ($item->language == '*'):?>
|
||||
<?php if ($item->language == '*') : ?>
|
||||
<?php echo JText::alt('JALL', 'language'); ?>
|
||||
<?php else:?>
|
||||
<?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
|
||||
|
@ -205,8 +168,6 @@ JFactory::getDocument()->addScriptDeclaration('
|
|||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$published = $this->state->get('filter.state');
|
||||
$published = $this->state->get('filter.published');
|
||||
?>
|
||||
<div class="modal hide fade" id="collapseModal">
|
||||
<div class="modal-header">
|
||||
|
|
|
@ -29,9 +29,11 @@ class WeblinksViewWeblinks extends JViewLegacy
|
|||
*/
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->state = $this->get('State');
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
|
||||
WeblinksHelper::addSubmenu('weblinks');
|
||||
|
||||
|
@ -84,7 +86,7 @@ class WeblinksViewWeblinks extends JViewLegacy
|
|||
JToolbarHelper::checkin('weblinks.checkin');
|
||||
}
|
||||
|
||||
if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
|
||||
if ($state->get('filter.published') == -2 && $canDo->get('core.delete'))
|
||||
{
|
||||
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
|
@ -113,39 +115,6 @@ class WeblinksViewWeblinks extends JViewLegacy
|
|||
}
|
||||
|
||||
JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_weblinks&view=weblinks');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_state',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_CATEGORY'),
|
||||
'filter_category_id',
|
||||
JHtml::_('select.options', JHtml::_('category.options', 'com_weblinks'), 'value', 'text', $this->state->get('filter.category_id'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_LANGUAGE'),
|
||||
'filter_language',
|
||||
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_TAG'),
|
||||
'filter_tag',
|
||||
JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,6 +79,8 @@ COM_WEBLINKS_FIELD_WIDTH_LABEL="Width"
|
|||
COM_WEBLINKS_FIELDSET_IMAGES="Images"
|
||||
COM_WEBLINKS_FIELDSET_OPTIONS="Options"
|
||||
COM_WEBLINKS_FILTER_CATEGORY="Filter Category"
|
||||
COM_WEBLINKS_FILTER_SEARCH_DESC="Search in web link title and alias. Prefix with ID: to search for an web link ID."
|
||||
COM_WEBLINKS_FILTER_SEARCH_LABEL="Search Web Links"
|
||||
COM_WEBLINKS_FILTER_STATE="Filter State"
|
||||
COM_WEBLINKS_FLOAT_DESC="Controls placement of the image."
|
||||
COM_WEBLINKS_FLOAT_LABEL="Image Float"
|
||||
|
|
|
@ -99,7 +99,9 @@ class AdministratorWeblinksCest
|
|||
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->expectTo('see weblinks page');
|
||||
$I->selectOptionInChosen('- Select Status -', 'Trashed');
|
||||
$I->click('Search Tools');
|
||||
$I->wait(2);
|
||||
$I->selectOptionInChosenById('filter_published', 'Trashed');
|
||||
$I->amGoingTo('Search the just saved weblink');
|
||||
$I->searchForItem($this->title);
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
|
|
Loading…
Reference in New Issue