Skip to content

Commit

Permalink
Merge pull request #5 from zero-24/weblinks_assoc
Browse files Browse the repository at this point in the history
fix some smal things
  • Loading branch information
infograf768 committed May 22, 2017
2 parents db0bfa9 + 9b30ced commit da554cb
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Weblink HTML helper class.
*
* @since 1.6
* @since __DELPOY_VERSION__
*/
abstract class JHtmlWeblink
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -70,7 +73,7 @@ public static function association($weblinkid)
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 2 additions & 3 deletions src/administrator/components/com_weblinks/models/weblink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -211,7 +211,6 @@ public function getItem($pk = null)
$item->images = $registry->toArray();

// Load associated web links items
$app = JFactory::getApplication();
$assoc = JLanguageAssociations::isEnabled();

if ($assoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function __construct($config = array())
);

$assoc = JLanguageAssociations::isEnabled();

if ($assoc)
{
$config['filter_fields'][] = 'association';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

<?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'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -26,23 +28,27 @@
// 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">

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/editors-xtd/weblink/weblink.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit da554cb

Please sign in to comment.