Merge pull request #5 from zero-24/weblinks_assoc

fix some smal things
This commit is contained in:
infograf768 2017-05-22 12:01:44 +02:00 committed by GitHub
commit da554cbac7
8 changed files with 26 additions and 27 deletions

View File

@ -16,7 +16,7 @@ JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_webli
/**
* Weblink HTML helper class.
*
* @since 1.6
* @since __DELPOY_VERSION__
*/
abstract class JHtmlWeblink
{
@ -28,14 +28,17 @@ abstract class JHtmlWeblink
* @return string The language HTML
*
* @throws Exception
*
* @since __DELPOY_VERSION__
*/
public static function association($weblinkid)
{
// Defaults
$html = '';
$associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $weblinkid);
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $weblinkid))
if ($associations)
{
foreach ($associations as $tag => $associated)
{
@ -70,7 +73,7 @@ abstract class JHtmlWeblink
foreach ($items as &$item)
{
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id);
$url = JRoute::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id);
$tooltip = htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br />' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'hasPopover label label-association label-' . $item->lang_sef;

View File

@ -90,18 +90,8 @@
<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="association ASC"
requires="associations"
>
JASSOCIATIONS_ASC
</option>
<option
value="association DESC"
requires="associations"
>
JASSOCIATIONS_DESC
</option>
<option value="association ASC" requires="associations">JASSOCIATIONS_ASC</option>
<option value="association DESC" requires="associations">JASSOCIATIONS_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>

View File

@ -31,8 +31,8 @@ class WeblinksModelWeblink extends JModelAdmin
/**
* The context used for the associations table
*
* @var string
* @since 3.4.4
* @var string
* @since __DEPLOY_VERSION__
*/
protected $associationsContext = 'com_weblinks.item';
@ -211,7 +211,6 @@ class WeblinksModelWeblink extends JModelAdmin
$item->images = $registry->toArray();
// Load associated web links items
$app = JFactory::getApplication();
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)

View File

@ -54,6 +54,7 @@ class WeblinksModelWeblinks extends JModelList
);
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)
{
$config['filter_fields'][] = 'association';

View File

@ -84,7 +84,7 @@ $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=c
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ( ! $isModal && $assoc) : ?>
<?php if (!$isModal && $assoc) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
<?php echo $this->loadTemplate('associations'); ?>
<?php echo JHtml::_('bootstrap.endTab'); ?>

View File

@ -15,13 +15,13 @@ JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
$saveOrder = $listOrder == 'a.ordering';
$assoc = JLanguageAssociations::isEnabled();
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
$saveOrder = $listOrder == 'a.ordering';
$assoc = JLanguageAssociations::isEnabled();
if ($saveOrder)
{

View File

@ -7,7 +7,9 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$app = JFactory::getApplication();
if ($app->isClient('site'))
{
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
@ -26,23 +28,27 @@ JHtml::_('formbehavior.chosen', 'select');
// Special case for the search field tooltip.
$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter');
JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom'));
$function = $app->input->getCmd('function', 'jSelectWeblink');
$editor = $app->input->getCmd('editor', '');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$onclick = $this->escape($function);
if (!empty($editor))
{
// This view is used also in com_menus. Load the xtd script only if the editor is set!
JFactory::getDocument()->addScriptOptions('xtd-weblinks', array('editor' => $editor));
$onclick = "jSelectWeblink";
}
$iconStates = array(
-2 => 'icon-trash',
0 => 'icon-unpublish',
1 => 'icon-publish',
2 => 'icon-archive',
);
?>
<div class="container-popup">

View File

@ -35,7 +35,7 @@ class PlgButtonWeblink extends JPlugin
*/
public function onDisplay($name)
{
$user = JFactory::getUser();
$user = JFactory::getUser();
if ($user->authorise('core.create', 'com_weblinks')
|| $user->authorise('core.edit', 'com_weblinks')