From 9b30cedb4db9b3160263f9eee73e78aab91bad6a Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 21 May 2017 18:59:44 +0200 Subject: [PATCH] fix some smal things --- .../com_weblinks/helpers/html/weblink.php | 9 ++++++--- .../com_weblinks/models/forms/filter_weblinks.xml | 14 ++------------ .../components/com_weblinks/models/weblink.php | 5 ++--- .../components/com_weblinks/models/weblinks.php | 1 + .../com_weblinks/views/weblink/tmpl/edit.php | 2 +- .../com_weblinks/views/weblinks/tmpl/default.php | 14 +++++++------- .../com_weblinks/views/weblinks/tmpl/modal.php | 6 ++++++ src/plugins/editors-xtd/weblink/weblink.php | 2 +- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/administrator/components/com_weblinks/helpers/html/weblink.php b/src/administrator/components/com_weblinks/helpers/html/weblink.php index 4a7a18d..7299f2a 100644 --- a/src/administrator/components/com_weblinks/helpers/html/weblink.php +++ b/src/administrator/components/com_weblinks/helpers/html/weblink.php @@ -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') . '
' . JText::sprintf('JCATEGORY_SPRINTF', $item->category_title); $classes = 'hasPopover label label-association label-' . $item->lang_sef; diff --git a/src/administrator/components/com_weblinks/models/forms/filter_weblinks.xml b/src/administrator/components/com_weblinks/models/forms/filter_weblinks.xml index 3746583..3862039 100644 --- a/src/administrator/components/com_weblinks/models/forms/filter_weblinks.xml +++ b/src/administrator/components/com_weblinks/models/forms/filter_weblinks.xml @@ -90,18 +90,8 @@ - - + + diff --git a/src/administrator/components/com_weblinks/models/weblink.php b/src/administrator/components/com_weblinks/models/weblink.php index d5b5455..cb238fb 100644 --- a/src/administrator/components/com_weblinks/models/weblink.php +++ b/src/administrator/components/com_weblinks/models/weblink.php @@ -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) diff --git a/src/administrator/components/com_weblinks/models/weblinks.php b/src/administrator/components/com_weblinks/models/weblinks.php index 808d919..9e5b4c5 100644 --- a/src/administrator/components/com_weblinks/models/weblinks.php +++ b/src/administrator/components/com_weblinks/models/weblinks.php @@ -54,6 +54,7 @@ class WeblinksModelWeblinks extends JModelList ); $assoc = JLanguageAssociations::isEnabled(); + if ($assoc) { $config['filter_fields'][] = 'association'; diff --git a/src/administrator/components/com_weblinks/views/weblink/tmpl/edit.php b/src/administrator/components/com_weblinks/views/weblink/tmpl/edit.php index 7765b32..998ad90 100644 --- a/src/administrator/components/com_weblinks/views/weblink/tmpl/edit.php +++ b/src/administrator/components/com_weblinks/views/weblink/tmpl/edit.php @@ -84,7 +84,7 @@ $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=c - + loadTemplate('associations'); ?> diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php index 75fee92..69b0840 100644 --- a/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php +++ b/src/administrator/components/com_weblinks/views/weblinks/tmpl/default.php @@ -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) { diff --git a/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php b/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php index 34893af..56d1190 100644 --- a/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php +++ b/src/administrator/components/com_weblinks/views/weblinks/tmpl/modal.php @@ -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', ); + ?>
diff --git a/src/plugins/editors-xtd/weblink/weblink.php b/src/plugins/editors-xtd/weblink/weblink.php index 235a531..67b6291 100644 --- a/src/plugins/editors-xtd/weblink/weblink.php +++ b/src/plugins/editors-xtd/weblink/weblink.php @@ -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')