Merge remote-tracking branch 'refs/remotes/joomla-extensions/master' into joomla-extensions/tests

This commit is contained in:
Jelle Kok 2017-11-06 14:54:35 +01:00
commit 0fbc337d4a
63 changed files with 1747 additions and 505 deletions

View File

@ -640,5 +640,19 @@ class RoboFile extends \Robo\Tasks
{
(new \Joomla\Jorobo\Tasks\Build($params))->run();
}
/**
* Map into Joomla installation.
*
* @param String $target The target joomla instance
*
* @since __DEPLOY_VERSION__
*
* @return void
*/
public function map($target)
{
(new \Joomla\Jorobo\Tasks\Map($target))->run();
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<jedupdate version="1">
<core_body>The Web Links Manager allows you to add, edit and remove links to other web sites on your Joomla! web site, and organize them into categories. You can then display these links on your site, and optionally let visitors add new links.</core_body>
<!-- valid links only or leave blank -->
<homepage_link>https://github.com/joomla-extensions/weblinks</homepage_link>
<download_link>https://github.com/joomla-extensions/weblinks/releases</download_link>
<documentation_link>https://docs.joomla.org/Help33:Components_Weblinks_Links</documentation_link>
<support_link>https://forum.joomla.org/</support_link>
<license_link>http://opensourcematters.org/legal/license-copyright/gnu-general-public-license-v2.html</license_link>
<version>3.6.0</version>
<compatibility>
<version>36</version>
<version>37</version>
</compatibility>
</jedupdate>

View File

@ -9,6 +9,7 @@
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
<action name="core.edit.value" title="JACTION_EDITVALUE" description="JACTION_EDITVALUE_COMPONENT_DESC" />
</section>
<section name="category">
<action name="core.create" title="JACTION_CREATE" description="COM_CATEGORIES_ACCESS_CREATE_DESC" />
@ -17,4 +18,18 @@
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />
</section>
<section name="fieldgroup">
<action name="core.create" title="JACTION_CREATE" description="COM_FIELDS_GROUP_PERMISSION_CREATE_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_GROUP_PERMISSION_DELETE_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_GROUP_PERMISSION_EDIT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_GROUP_PERMISSION_EDITSTATE_DESC" />
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_FIELDS_GROUP_PERMISSION_EDITOWN_DESC" />
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_GROUP_PERMISSION_EDITVALUE_DESC" />
</section>
<section name="field">
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_FIELD_PERMISSION_DELETE_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" />
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" />
</section>
</access>

View File

@ -50,6 +50,7 @@
label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
default="5"
showon="save_history:1"
/>
<field
@ -64,6 +65,12 @@
<option value="0">JNO</option>
</field>
<field
name="spacer1"
type="spacer"
hr="true"
/>
<field
name="icons"
type="list"
@ -84,11 +91,17 @@
label="COM_WEBLINKS_FIELD_CONFIG_ICON_LABEL"
/>
<field
name="spacer2"
type="spacer"
hr="true"
/>
<field
name="float_first"
type="list"
label="COM_WEBLINKS_FLOAT_LABEL"
description="COM_WEBLINKS_FLOAT_DESC"
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
description="COM_WEBLINKS_FLOAT_FIRST_DESC"
>
<option value="right">COM_WEBLINKS_RIGHT</option>
<option value="left">COM_WEBLINKS_LEFT</option>
@ -98,14 +111,20 @@
<field
name="float_second"
type="list"
label="COM_WEBLINKS_FLOAT_LABEL"
description="COM_WEBLINKS_FLOAT_DESC"
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
description="COM_WEBLINKS_FLOAT_SECOND_DESC"
>
<option value="right">COM_WEBLINKS_RIGHT</option>
<option value="left">COM_WEBLINKS_LEFT</option>
<option value="none">COM_WEBLINKS_NONE</option>
</field>
<field
name="spacer3"
type="spacer"
hr="true"
/>
<field
id="show_tags"
name="show_tags"
@ -411,6 +430,18 @@
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="custom_fields_enable"
type="radio"
label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL"
description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
</fieldset>
<fieldset

View File

@ -36,7 +36,7 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
*
* @since __DEPLOY_VERSION__
*/
protected $itemTypes = array('category');
protected $itemTypes = array('weblink', 'category');
/**
* Has the extension association support
@ -105,6 +105,10 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
switch ($typeName)
{
case 'weblink':
$table = JTable::getInstance('Weblink', 'WeblinksTable');
break;
case 'category':
$table = JTable::getInstance('Category');
break;
@ -141,6 +145,21 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
{
switch ($typeName)
{
case 'weblink':
$support['state'] = true;
$support['acl'] = true;
$support['checkout'] = true;
$support['category'] = true;
$support['save2copy'] = true;
$tables = array(
'a' => '#__weblinks'
);
$title = 'weblink';
break;
case 'category':
$fields['created_user_id'] = 'a.created_user_id';
$fields['ordering'] = 'a.lft';

View File

@ -0,0 +1,94 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_weblinks/helpers/weblinks.php');
/**
* Weblink HTML helper class.
*
* @since __DELPOY_VERSION__
*/
abstract class JHtmlWeblink
{
/**
* Get the associated language flags
*
* @param integer $weblinkid The item id to search associations
*
* @return string The language HTML
*
* @throws Exception
*
* @since ___DEPLOY_VERSION__
*/
public static function association($weblinkid)
{
// Defaults
$html = '';
$associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $weblinkid);
// Get the associations
if ($associations)
{
foreach ($associations as $tag => $associated)
{
$associations[$tag] = (int) $associated->id;
}
// Get the associated weblinks items
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('c.id, c.title as title')
->select('l.sef as lang_sef, lang_code')
->from('#__weblinks as c')
->select('cat.title as category_title')
->join('LEFT', '#__categories as cat ON cat.id=c.catid')
->where('c.id IN (' . implode(',', array_values($associations)) . ')')
->join('LEFT', '#__languages as l ON c.language=l.lang_code')
->select('l.image')
->select('l.title as language_title');
$db->setQuery($query);
try
{
$items = $db->loadObjectList('id');
}
catch (RuntimeException $e)
{
throw new Exception($e->getMessage(), 500, $e);
}
if ($items)
{
foreach ($items as &$item)
{
$text = strtoupper($item->lang_sef);
$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;
$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes
. '" data-content="' . $tooltip . '" data-placement="top">'
. $text . '</a>';
}
}
JHtml::_('bootstrap.popover');
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
}

View File

@ -38,6 +38,21 @@ class WeblinksHelper extends JHelperContent
'index.php?option=com_categories&extension=com_weblinks',
$vName == 'categories'
);
if (JComponentHelper::isEnabled('com_fields') && JComponentHelper::getParams('com_weblinks')->get('custom_fields_enable', '1'))
{
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELDS'),
'index.php?option=com_fields&context=com_weblinks.weblink',
$vName == 'fields.fields'
);
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_FIELD_GROUPS'),
'index.php?option=com_fields&view=groups&context=com_weblinks.weblink',
$vName == 'fields.groups'
);
}
}
/**

View File

@ -0,0 +1,257 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
/**
* Supports a modal weblink picker.
*
* @since __DEPLOY_VERSION__
*/
class JFormFieldModal_Weblink extends JFormField
{
/**
* The form field type.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $type = 'Modal_Weblink';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since __DEPLOY_VERSION__
*/
protected function getInput()
{
$allowNew = ((string) $this->element['new'] == 'true');
$allowEdit = ((string) $this->element['edit'] == 'true');
$allowClear = ((string) $this->element['clear'] != 'false');
$allowSelect = ((string) $this->element['select'] != 'false');
// Load language
JFactory::getLanguage()->load('com_weblinks', JPATH_ADMINISTRATOR);
// The active weblink id field.
$value = (int) $this->value > 0 ? (int) $this->value : '';
// Create the modal id.
$modalId = 'Weblink_' . $this->id;
// Add the modal field script to the document head.
JHtml::_('jquery.framework');
JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));
// Script to proxy the select modal function to the modal-fields.js file.
if ($allowSelect)
{
static $scriptSelect = null;
if (is_null($scriptSelect))
{
$scriptSelect = array();
}
if (!isset($scriptSelect[$this->id]))
{
JFactory::getDocument()->addScriptDeclaration("
function jSelectWeblink_" . $this->id . "(id, title, catid, object, url, language) {
window.processModalSelect('Weblink', '" . $this->id . "', id, title, catid, object, url, language);
}
");
$scriptSelect[$this->id] = true;
}
}
// Setup variables for display.
$linkWeblinks = 'index.php?option=com_weblinks&amp;view=weblinks&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
$linkWeblink = 'index.php?option=com_weblinks&amp;view=weblink&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
$modalTitle = JText::_('COM_WEBLINKS_CHANGE_WEBLINK');
if (isset($this->element['language']))
{
$linkWeblinks .= '&amp;forcedLanguage=' . $this->element['language'];
$linkWeblink .= '&amp;forcedLanguage=' . $this->element['language'];
$modalTitle .= ' &#8212; ' . $this->element['label'];
}
$urlSelect = $linkWeblinks . '&amp;function=jSelectWeblink_' . $this->id;
$urlEdit = $linkWeblink . '&amp;task=weblink.edit&amp;id=\' + document.getElementById("' . $this->id . '_id").value + \'';
$urlNew = $linkWeblink . '&amp;task=weblink.add';
if ($value)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__weblinks'))
->where($db->quoteName('id') . ' = ' . (int) $value);
$db->setQuery($query);
try
{
$title = $db->loadResult();
}
catch (RuntimeException $e)
{
JError::raiseWarning(500, $e->getMessage());
}
}
$title = empty($title) ? JText::_('COM_WEBLINKS_SELECT_A_WEBLINK') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current weblink display field.
$html = '<span class="input-append">';
$html .= '<input class="input-medium" id="' . $this->id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />';
// Select weblink button
if ($allowSelect)
{
$html .= '<a'
. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
. ' id="' . $this->id . '_select"'
. ' data-toggle="modal"'
. ' role="button"'
. ' href="#ModalSelect' . $modalId . '"'
. ' title="' . JHtml::tooltipText('COM_WEBLINKS_CHANGE_WEBLINK') . '">'
. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
. '</a>';
}
// New weblink button
if ($allowNew)
{
$html .= '<a'
. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
. ' id="' . $this->id . '_new"'
. ' data-toggle="modal"'
. ' role="button"'
. ' href="#ModalNew' . $modalId . '"'
. ' title="' . JHtml::tooltipText('COM_WEBLINKS_NEW_WEBLINK') . '">'
. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
. '</a>';
}
// Edit weblink button
if ($allowEdit)
{
$html .= '<a'
. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
. ' id="' . $this->id . '_edit"'
. ' data-toggle="modal"'
. ' role="button"'
. ' href="#ModalEdit' . $modalId . '"'
. ' title="' . JHtml::tooltipText('COM_WEBLINKS_EDIT_WEBLINK') . '">'
. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
. '</a>';
}
// Clear weblink button
if ($allowClear)
{
$html .= '<a'
. ' class="btn' . ($value ? '' : ' hidden') . '"'
. ' id="' . $this->id . '_clear"'
. ' href="#"'
. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
. '</a>';
}
$html .= '</span>';
// Select weblink modal
if ($allowSelect)
{
$html .= JHtml::_(
'bootstrap.renderModal',
'ModalSelect' . $modalId,
array(
'title' => $modalTitle,
'url' => $urlSelect,
'height' => '400px',
'width' => '800px',
'bodyHeight' => '70',
'modalWidth' => '80',
'footer' => '<a role="button" class="btn" data-dismiss="modal" aria-hidden="true">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>',
)
);
}
// New weblink modal
if ($allowNew)
{
$html .= JHtml::_(
'bootstrap.renderModal',
'ModalNew' . $modalId,
array(
'title' => JText::_('COM_WEBLINKS_NEW_WEBLINK'),
'backdrop' => 'static',
'keyboard' => false,
'closeButton' => false,
'url' => $urlNew,
'height' => '400px',
'width' => '800px',
'bodyHeight' => '70',
'modalWidth' => '80',
'footer' => '<a role="button" class="btn" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'cancel\', \'weblink-form\'); return false;">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
. '<a role="button" class="btn btn-primary" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'save\', \'weblink-form\'); return false;">'
. JText::_('JSAVE') . '</a>'
. '<a role="button" class="btn btn-success" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'apply\', \'weblink-form\'); return false;">'
. JText::_('JAPPLY') . '</a>',
)
);
}
// Edit weblink modal
if ($allowEdit)
{
$html .= JHtml::_(
'bootstrap.renderModal',
'ModalEdit' . $modalId,
array(
'title' => JText::_('COM_WEBLINKS_EDIT_WEBLINK'),
'backdrop' => 'static',
'keyboard' => false,
'closeButton' => false,
'url' => $urlEdit,
'height' => '400px',
'width' => '800px',
'bodyHeight' => '70',
'modalWidth' => '80',
'footer' => '<a role="button" class="btn" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'cancel\', \'weblink-form\'); return false;">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
. '<a role="button" class="btn btn-primary" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'save\', \'weblink-form\'); return false;">'
. JText::_('JSAVE') . '</a>'
. '<a role="button" class="btn btn-success" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'apply\', \'weblink-form\'); return false;">'
. JText::_('JAPPLY') . '</a>',
)
);
}
// Note: class='required' for client side validation.
$class = $this->required ? ' class="required modal-value"' : '';
$html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
. '" data-text="' . htmlspecialchars(JText::_('COM_WEBLINKS_SELECT_A_WEBLINK', true), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';
return $html;
}
/**
* Method to get the field label markup.
*
* @return string The field label markup.
*
* @since __DEPLOY_VERSION__
*/
protected function getLabel()
{
return str_replace($this->id, $this->id . '_id', parent::getLabel());
}
}

View File

@ -8,7 +8,6 @@
description="COM_WEBLINKS_FILTER_SEARCH_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
@ -18,7 +17,6 @@
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
name="category_id"
type="category"
@ -29,7 +27,6 @@
>
<option value="">JOPTION_SELECT_CATEGORY</option>
</field>
<field
name="access"
type="accesslevel"
@ -39,7 +36,6 @@
>
<option value="">JOPTION_SELECT_ACCESS</option>
</field>
<field
name="language"
type="contentlanguage"
@ -50,7 +46,6 @@
<option value="">JOPTION_SELECT_LANGUAGE</option>
<option value="*">JALL</option>
</field>
<field
name="tag"
type="tag"
@ -61,7 +56,6 @@
>
<option value="">JOPTION_SELECT_TAG</option>
</field>
<field
name="level"
type="integer"
@ -76,7 +70,6 @@
<option value="">JOPTION_SELECT_MAX_LEVELS</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
@ -97,12 +90,13 @@
<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="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"

View File

@ -6,38 +6,38 @@
<field
name="id"
type="text"
default="0"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
readonly="true"
class="readonly"
description="JGLOBAL_FIELD_ID_DESC"
default="0"
/>
<field
name="title"
type="text"
class="input-xxlarge input-large-text"
size="40"
label="JGLOBAL_TITLE"
description="COM_WEBLINKS_FIELD_TITLE_DESC"
class="input-xxlarge input-large-text"
size="40"
required="true"
/>
<field
name="alias"
type="text"
size="40"
label="JFIELD_ALIAS_LABEL"
description="COM_WEBLINKS_FIELD_ALIAS_DESC"
size="40"
hint="JFIELD_ALIAS_PLACEHOLDER"
/>
<field
name="catid"
type="categoryedit"
extension="com_weblinks"
label="JCATEGORY"
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
extension="com_weblinks"
required="true"
default=""
/>
@ -45,31 +45,31 @@
<field
name="url"
type="url"
label="COM_WEBLINKS_FIELD_URL_LABEL"
description="COM_WEBLINKS_FIELD_URL_DESC"
class="span12"
filter="url"
size="40"
label="COM_WEBLINKS_FIELD_URL_LABEL"
description="COM_WEBLINKS_FIELD_URL_DESC"
required="true"
/>
<field
name="description"
type="editor"
label="JGLOBAL_DESCRIPTION"
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
buttons="true"
hide="pagebreak,readmore"
filter="JComponentHelper::filterText"
label="JGLOBAL_DESCRIPTION"
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
/>
<field
name="hits"
type="text"
class="readonly"
size="6"
label="JGLOBAL_HITS"
description="COM_WEBLINKS_HITS_DESC"
class="readonly"
size="6"
readonly="true"
filter="unset"
/>
@ -160,9 +160,9 @@
<field
name="modified"
type="calendar"
class="readonly"
label="JGLOBAL_FIELD_MODIFIED_LABEL"
description="COM_WEBLINKS_FIELD_MODIFIED_DESC"
class="readonly"
size="22"
readonly="true"
format="%Y-%m-%d %H:%M:%S"
@ -213,10 +213,10 @@
<field
name="version"
type="text"
class="readonly"
label="COM_WEBLINKS_FIELD_VERSION_LABEL"
size="6"
description="COM_WEBLINKS_FIELD_VERSION_DESC"
class="readonly"
size="6"
readonly="true"
filter="unset"
/>
@ -259,9 +259,9 @@
<field
name="target"
type="list"
default=""
label="COM_WEBLINKS_FIELD_TARGET_LABEL"
description="COM_WEBLINKS_FIELD_TARGET_DESC"
default=""
useglobal="true"
>
<option value="0">JBROWSERTARGET_PARENT</option>
@ -273,25 +273,25 @@
<field
name="width"
type="text"
class="validate-numeric"
label="COM_WEBLINKS_FIELD_WIDTH_LABEL"
description="COM_WEBLINKS_FIELD_WIDTH_DESC"
class="validate-numeric"
/>
<field
name="height"
type="text"
class="validate-numeric"
label="COM_WEBLINKS_FIELD_HEIGHT_LABEL"
description="COM_WEBLINKS_FIELD_HEIGHT_DESC"
class="validate-numeric"
/>
<field
name="count_clicks"
type="list"
class="chzn-color"
label="COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
description="COM_WEBLINKS_FIELD_COUNTCLICKS_DESC"
class="chzn-color"
useglobal="true"
>
<option value="0">JNO</option>
@ -317,8 +317,8 @@
<field
name="float_first"
type="list"
label="COM_WEBLINKS_FLOAT_LABEL"
description="COM_WEBLINKS_FLOAT_DESC"
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
description="COM_WEBLINKS_FLOAT_FIRST_DESC"
useglobal="true"
>
<option value="right">COM_WEBLINKS_RIGHT</option>
@ -358,8 +358,8 @@
<field
name="float_second"
type="list"
label="COM_WEBLINKS_FLOAT_LABEL"
description="COM_WEBLINKS_FLOAT_DESC"
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
description="COM_WEBLINKS_FLOAT_SECOND_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="right">COM_WEBLINKS_RIGHT</option>

View File

@ -11,6 +11,8 @@ defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_weblinks/helpers/weblinks.php');
/**
* Weblinks model.
*
@ -26,6 +28,14 @@ class WeblinksModelWeblink extends JModelAdmin
*/
public $typeAlias = 'com_weblinks.weblink';
/**
* The context used for the associations table
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $associationsContext = 'com_weblinks.item';
/**
* The prefix to use with controller messages.
*
@ -200,6 +210,24 @@ class WeblinksModelWeblink extends JModelAdmin
$registry->loadString($item->images);
$item->images = $registry->toArray();
// Load associated web links items
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)
{
$item->associations = array();
if ($item->id != null)
{
$associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $item->id);
foreach ($associations as $tag => $association)
{
$item->associations[$tag] = $association->id;
}
}
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
@ -296,7 +324,7 @@ class WeblinksModelWeblink extends JModelAdmin
// Cast catid to integer for comparison
$catid = (int) $data['catid'];
// Check if New Category exists
if ($catid > 0)
{
@ -376,6 +404,37 @@ class WeblinksModelWeblink extends JModelAdmin
$form->setFieldAttribute('catid', 'allowAdd', 'true');
}
// Association weblinks items
if (JLanguageAssociations::isEnabled())
{
$languages = JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc');
if (count($languages) > 1)
{
$addform = new SimpleXMLElement('<form />');
$fields = $addform->addChild('fields');
$fields->addAttribute('name', 'associations');
$fieldset = $fields->addChild('fieldset');
$fieldset->addAttribute('name', 'item_associations');
foreach ($languages as $language)
{
$field = $fieldset->addChild('field');
$field->addAttribute('name', $language->lang_code);
$field->addAttribute('type', 'modal_weblink');
$field->addAttribute('language', $language->lang_code);
$field->addAttribute('label', $language->title);
$field->addAttribute('translate_label', 'false');
$field->addAttribute('select', 'true');
$field->addAttribute('new', 'true');
$field->addAttribute('edit', 'true');
$field->addAttribute('clear', 'true');
}
$form->load($addform, false);
}
}
parent::preprocessForm($form, $data, $group);
}

View File

@ -52,6 +52,13 @@ class WeblinksModelWeblinks extends JModelList
'tag',
'level', 'c.level',
);
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)
{
$config['filter_fields'][] = 'association';
}
}
parent::__construct($config);
@ -70,6 +77,22 @@ class WeblinksModelWeblinks extends JModelList
*/
protected function populateState($ordering = 'a.title', $direction = 'asc')
{
$app = JFactory::getApplication();
$forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd');
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
// Adjust the context to support forced languages.
if ($forcedLanguage)
{
$this->context .= '.' . $forcedLanguage;
}
// Load the filter state.
$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'));
@ -83,6 +106,12 @@ class WeblinksModelWeblinks extends JModelList
$params = JComponentHelper::getParams('com_weblinks');
$this->setState('params', $params);
// Force a language.
if (!empty($forcedLanguage))
{
$this->setState('filter.language', $forcedLanguage);
}
// List state information.
parent::populateState($ordering, $direction);
}
@ -132,7 +161,7 @@ class WeblinksModelWeblinks extends JModelList
$query->select(
$this->getState(
'list.select',
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid, a.created_by, ' .
'a.id, a.title, a.alias, a.checked_out, a.checked_out_time, a.catid, a.created, a.created_by, ' .
'a.hits, a.state, a.access, a.ordering, a.language, a.publish_up, a.publish_down'
)
);
@ -155,6 +184,17 @@ class WeblinksModelWeblinks extends JModelList
$query->select('c.title AS category_title')
->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('a.catid'));
// Join over the associations.
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)
{
$query->select('COUNT(asso2.id)>1 AS association')
->join('LEFT', $db->quoteName('#__associations', 'asso') . ' ON asso.id = a.id AND asso.context = ' . $db->quote('com_weblinks.item'))
->join('LEFT', $db->quoteName('#__associations', 'asso2') . ' ON asso2.key = asso.key')
->group('a.id, l.title, l.image, uc.name, ag.title, c.title');
}
// Filter by access level.
if ($access = $this->getState('filter.access'))
{

View File

@ -93,7 +93,7 @@ class WeblinksTableWeblink extends JTable
// Verify that the alias is unique
$table = JTable::getInstance('Weblink', 'WeblinksTable');
if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
if ($table->load(array('language' => $this->language, 'alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS'));
@ -136,6 +136,7 @@ class WeblinksTableWeblink extends JTable
->select($db->quoteName('id'))
->from($db->quoteName('#__weblinks'))
->where($db->quoteName('title') . ' = ' . $db->quote($this->title))
->where($db->quoteName('language') . ' = ' . $db->quote($this->language))
->where($db->quoteName('catid') . ' = ' . (int) $this->catid);
$db->setQuery($query);
@ -153,7 +154,7 @@ class WeblinksTableWeblink extends JTable
$this->alias = $this->title;
}
$this->alias = JApplicationHelper::stringURLSafe($this->alias);
$this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language);
if (trim(str_replace('-', '', $this->alias)) == '')
{

View File

@ -14,8 +14,13 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 ));
// Ignore Image fieldset for the layouts as we render it manually
$this->ignore_fieldsets = array('images');
$app = JFactory::getApplication();
$input = $app->input;
$assoc = JLanguageAssociations::isEnabled();
// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
$this->ignore_fieldsets = array('details', 'images', 'item_associations', 'jmetadata');
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
@ -26,9 +31,14 @@ JFactory::getDocument()->addScriptDeclaration("
}
};
");
// In case of modal
$isModal = $input->get('layout') == 'modal' ? true : false;
$layout = $isModal ? 'modal' : 'edit';
$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
?>
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="weblink-form" class="form-validate">
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="weblink-form" class="form-validate">
<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
@ -73,11 +83,20 @@ JFactory::getDocument()->addScriptDeclaration("
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?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'); ?>
<?php elseif ($isModal && $assoc) : ?>
<div class="hidden"><?php echo $this->loadTemplate('associations'); ?></div>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
</div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,31 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
// @deprecated 4.0 the function parameter, the inline js and the buttons are not needed since 3.7.0.
$function = JFactory::getApplication()->input->getCmd('function', 'jEditWeblink_' . (int) $this->item->id);
// Function to update input title when changed
JFactory::getDocument()->addScriptDeclaration('
function jEditWeblinkModal() {
if (window.parent && document.formvalidator.isValid(document.getElementById("weblink-form"))) {
return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value);
}
}
');
?>
<button id="applyBtn" type="button" class="hidden" onclick="Joomla.submitbutton('weblink.apply'); jEditWeblinkModal();"></button>
<button id="saveBtn" type="button" class="hidden" onclick="Joomla.submitbutton('weblink.save'); jEditWeblinkModal();"></button>
<button id="closeBtn" type="button" class="hidden" onclick="Joomla.submitbutton('weblink.cancel');"></button>
<div class="container-popup">
<?php $this->setLayout('edit'); ?>
<?php echo $this->loadTemplate(); ?>
</div>

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.associations', $this);

View File

@ -0,0 +1,12 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
echo JLayoutHelper::render('joomla.edit.metadata', $this);

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$fieldSets = $this->form->getFieldsets('params'); ?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<div class="tab-pane" id="params-<?php echo $name; ?>">
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<?php echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>'; ?>
<?php endif; ?>
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
<div class="control-group">
<div class="control-label"><?php echo $field->label; ?></div>
<div class="controls"><?php echo $field->input; ?></div>
</div>
<?php endforeach; ?>
</div>
<?php endforeach; ?>

View File

@ -42,6 +42,20 @@ class WeblinksViewWeblink extends JViewLegacy
return false;
}
// If we are forcing a language in modal (used for associations).
if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd'))
{
// Set the language field to the forcedLanguage and disable changing it.
$this->form->setValue('language', null, $forcedLanguage);
$this->form->setFieldAttribute('language', 'readonly', 'true');
// Only allow to select categories with All language or with the forced language.
$this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage);
// Only allow to select tags with All language or with the forced language.
$this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
}
$this->addToolbar();

View File

@ -15,12 +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';
$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)
{
@ -65,6 +66,11 @@ if ($saveOrder)
<th width="5%" class="nowrap center hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
</th>
<?php if ($assoc) : ?>
<th width="5%" class="nowrap hidden-phone hidden-tablet">
<?php echo JHtml::_('searchtools.sort', 'COM_WEBLINKS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
</th>
@ -98,7 +104,7 @@ if ($saveOrder)
<?php $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); ?>
<?php endif; ?>
<span class="sortable-handler<?php echo $iconClass ?>">
<i class="icon-menu"></i>
<i class="icon-menu" aria-hidden="true"></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 " />
@ -141,7 +147,14 @@ if ($saveOrder)
<td class="center hidden-phone">
<?php echo $item->hits; ?>
</td>
<td class="small nowrap hidden-phone">
<?php if ($assoc) : ?>
<td class="hidden-phone hidden-tablet">
<?php if ($item->association) : ?>
<?php echo JHtml::_('weblink.association', $item->id); ?>
<?php endif; ?>
</td>
<?php endif; ?>
<td class="small hidden-phone">
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<td class="center hidden-phone">

View File

@ -0,0 +1,147 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @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'));
}
JLoader::register('WeblinksHelperRoute', JPATH_ROOT . '/components/com_weblinks/helpers/route.php');
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.core');
JHtml::_('behavior.polyfill', array('event'), 'lt IE 9');
JHtml::_('script', 'com_weblinks/admin-weblinks-modal.js', array('version' => 'auto', 'relative' => true));
JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
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">
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks&layout=modal&tmpl=component&function=' . $function . '&' . JSession::getFormToken() . '=1&editor=' . $editor); ?>" method="post" name="adminForm" id="adminForm" class="form-inline">
<?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">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table table-striped table-condensed">
<thead>
<tr>
<th width="1%" class="center nowrap">
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
</th>
<th class="title">
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
</th>
<th width="15%" class="nowrap">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JDATE', 'a.created', $listDirn, $listOrder); ?>
</th>
<th width="1%" class="nowrap hidden-phone">
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<?php $lang = ''; ?>
<?php if ($item->language && JLanguageMultilang::isEnabled()) : ?>
<?php $tag = strlen($item->language); ?>
<?php if ($tag == 5) : ?>
<?php $lang = substr($item->language, 0, 2); ?>
<?php elseif ($tag == 6) : ?>
<?php $lang = substr($item->language, 0, 3); ?>
<?php endif; ?>
<?php endif; ?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<span class="<?php echo $iconStates[$this->escape($item->state)]; ?>"></span>
</td>
<td>
<?php $attribs = 'data-function="' . $this->escape($onclick) . '"'
. ' data-id="' . $item->id . '"'
. ' data-title="' . $this->escape(addslashes($item->title)) . '"'
. ' data-cat-id="' . $this->escape($item->catid) . '"'
. ' data-uri="' . $this->escape(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid, $item->language)) . '"'
. ' data-language="' . $this->escape($lang) . '"';
?>
<a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>>
<?php echo $this->escape($item->title); ?>
</a>
<div class="small">
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
</div>
</td>
<td class="small hidden-phone">
<?php echo $this->escape($item->access_level); ?>
</td>
<td class="small">
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
</td>
<td class="nowrap small hidden-phone">
<?php echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC4')); ?>
</td>
<td class="nowrap small hidden-phone">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="forcedLanguage" value="<?php echo $app->input->get('forcedLanguage', '', 'CMD'); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
</div>

View File

@ -37,7 +37,11 @@ class WeblinksViewWeblinks extends JViewLegacy
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
WeblinksHelper::addSubmenu('weblinks');
// Modal layout doesn't need the submenu.
if ($this->getLayout() !== 'modal')
{
WeblinksHelper::addSubmenu('weblinks');
}
// Check for errors.
if (count($errors = $this->get('Errors')))
@ -46,8 +50,30 @@ class WeblinksViewWeblinks extends JViewLegacy
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// We don't need toolbar in the modal layout.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
else
{
// In article associations modal we need to remove language filter if forcing a language.
// We also need to change the category filter to show show categories with All or the forced language.
if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'CMD'))
{
// If the language is forced we can't allow to select the language, so transform the language selector filter into an hidden field.
$languageXml = new SimpleXMLElement('<field name="language" type="hidden" default="' . $forcedLanguage . '" />');
$this->filterForm->setField($languageXml, 'filter', true);
// Also, unset the active language filter so the search tools is not open by default with this filter.
unset($this->activeFilters['language']);
// One last changes needed is to change the category filter to just show categories with All language or with the forced language.
$this->filterForm->setFieldAttribute('category_id', 'language', '*,' . $forcedLanguage, 'filter');
}
}
parent::display($tpl);
}

View File

@ -33,6 +33,10 @@
</schemas>
</update>
<media folder="media/com_weblinks" destination="com_weblinks">
##MEDIA_FILES##
</media>
<files folder="components/com_weblinks">
##FRONTEND_COMPONENT_FILES##
</files>

View File

@ -9,6 +9,7 @@ COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links"
COM_WEBLINKS_BATCH_TIP="If a category is selected for move/copy, any actions selected will be applied to the copied or moved links. Otherwise, all actions are applied to the selected links."
COM_WEBLINKS_CATEGORIES_DESC="These settings apply for Web Links Categories Options unless they are changed for a specific menu item."
COM_WEBLINKS_CATEGORY_DESC="These settings apply for Web Links Category Options unless they are changed for a specific menu item."
COM_WEBLINKS_CHANGE_WEBLINK="Select or Change Web Link"
COM_WEBLINKS_COMPONENT_DESC="These settings apply for Web Links unless they are changed for a specific menu item or web link."
COM_WEBLINKS_COMPONENT_LABEL="Web Link"
COM_WEBLINKS_CONFIG_INTEGRATION_SETTINGS_DESC="These settings determine how the Web Links Component will integrate with other extensions."
@ -84,8 +85,11 @@ COM_WEBLINKS_FILTER_CATEGORY="Filter Category"
COM_WEBLINKS_FILTER_SEARCH_DESC="Search in web link title and alias. Prefix with ID: to search for a 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"
COM_WEBLINKS_FLOAT_FIRST_DESC="Controls placement of the first image."
COM_WEBLINKS_FLOAT_FIRST_LABEL="First Image Float"
COM_WEBLINKS_FLOAT_SECOND_DESC="Controls placement of the second image."
COM_WEBLINKS_FLOAT_SECOND_LABEL="Second Image Float"
COM_WEBLINKS_HEADING_ASSOCIATION="Association"
COM_WEBLINKS_HITS_DESC="Number of hits for this web link."
COM_WEBLINKS_LEFT="Left"
COM_WEBLINKS_LIST_LAYOUT_DESC="These settings apply for Web Links List Layout Options unless they are changed for a specific menu item."
@ -116,9 +120,11 @@ COM_WEBLINKS_ORDER_HEADING="Order"
COM_WEBLINKS_RIGHT="Right"
COM_WEBLINKS_SAVE_SUCCESS="Web link successfully saved"
COM_WEBLINKS_SEARCH_IN_TITLE="Search in title"
COM_WEBLINKS_SELECT_A_WEBLINK="Select Web Link"
COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC="If Show, empty categories will display. A category is only empty - if it has no Web links or subcategories."
COM_WEBLINKS_SUBMENU_CATEGORIES="Categories"
COM_WEBLINKS_SUBMENU_WEBLINKS="Web Links"
COM_WEBLINKS_WEBLINKS="Web Links"
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management"
JGLOBAL_NO_ITEM_SELECTED="No web links selected"
JGLOBAL_NEWITEMSLAST_DESC="New Web links default to the last position. Ordering can be changed after this Web link is saved."

View File

@ -15,11 +15,15 @@ COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_OPTION="Default"
COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE="List Web Links in a Category"
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
COM_WEBLINKS_FIELD_SELECT_WEBLINK_DESC="Select the desired Web link from the list."
COM_WEBLINKS_FIELD_SELECT_WEBLINK_LABEL="Select Weblink"
COM_WEBLINKS_FORM_VIEW_DEFAULT_DESC="Display a form to submit a web link in the Frontend."
COM_WEBLINKS_FORM_VIEW_DEFAULT_OPTION="Default"
COM_WEBLINKS_FORM_VIEW_DEFAULT_TITLE="Submit a Web Link"
COM_WEBLINKS_LINKS="Links"
COM_WEBLINKS_TAGS_WEBLINK="Web Link"
COM_WEBLINKS_TAGS_CATEGORY="Web Link Category"
COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_DESC="Display a single Web link"
COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_TITLE="Single Weblink"
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management."

View File

@ -21,6 +21,7 @@
<file type="plugin" id="weblinks" group="finder">plg_finder_weblinks.zip</file>
<file type="plugin" id="weblinks" group="search">plg_search_weblinks.zip</file>
<file type="plugin" id="weblinks" group="system">plg_system_weblinks.zip</file>
<file type="plugin" id="weblinks" group="editors-xtd">plg_editors-xtd_weblink.zip</file>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
@ -36,6 +36,23 @@ abstract class WeblinksHelperAssociation extends CategoryHelperAssociation
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'weblink')
{
if ($id)
{
$associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $id);
$return = array();
foreach ($associations as $tag => $item)
{
$return[$tag] = WeblinksHelperRoute::getWeblinkRoute($item->id, (int) $item->catid, $item->language);
}
return $return;
}
}
if ($view == 'category' || $view == 'categories')
{
return self::getCategoryAssociations($id, 'com_weblinks');

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -22,8 +22,8 @@
<field
name="title"
type="text"
description="COM_WEBLINKS_FIELD_TITLE_DESC"
label="JGLOBAL_TITLE"
description="COM_WEBLINKS_FIELD_TITLE_DESC"
required="true"
size="30"
/>
@ -31,8 +31,8 @@
<field
name="alias"
type="text"
description="COM_WEBLINKS_FIELD_ALIAS_DESC"
label="JFIELD_ALIAS_LABEL"
description="COM_WEBLINKS_FIELD_ALIAS_DESC"
hint="JFIELD_ALIAS_PLACEHOLDER"
size="45"
/>
@ -40,20 +40,20 @@
<field
name="description"
type="editor"
label="JGLOBAL_DESCRIPTION"
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
buttons="true"
hide="pagebreak,readmore"
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
filter="safehtml"
label="JGLOBAL_DESCRIPTION"
asset_id="com_weblinks"
/>
<field
name="state"
type="list"
default="1"
description="JFIELD_PUBLISHED_DESC"
label="JSTATUS"
description="JFIELD_PUBLISHED_DESC"
default="1"
size="1"
>
<option value="1">JPUBLISHED</option>
@ -63,18 +63,18 @@
<field
name="catid"
type="categoryedit"
label="JCATEGORY"
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
extension="com_weblinks"
label="JCATEGORY"
required="true"
/>
<field
name="url"
type="url"
filter="url"
description="COM_WEBLINKS_FIELD_URL_DESC"
label="COM_WEBLINKS_FIELD_URL_LABEL"
description="COM_WEBLINKS_FIELD_URL_DESC"
filter="url"
required="true"
size="45"
/>
@ -126,9 +126,9 @@
<field
name="robots"
type="hidden"
filter="unset"
label="JFIELD_METADATA_ROBOTS_LABEL"
description="JFIELD_METADATA_ROBOTS_DESC"
filter="unset"
labelclass="control-label"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
@ -141,9 +141,9 @@
<field
name="author"
type="hidden"
filter="unset"
label="JAUTHOR"
description="JFIELD_METADATA_AUTHOR_DESC"
filter="unset"
size="20"
labelclass="control-label"
/>
@ -152,8 +152,8 @@
name="rights"
type="hidden"
label="JFIELD_META_RIGHTS_LABEL"
filter="unset"
description="JFIELD_META_RIGHTS_DESC"
filter="unset"
required="false"
labelclass="control-label"
/>
@ -161,9 +161,9 @@
<field
name="xreference"
type="hidden"
filter="unset"
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
filter="unset"
class="inputbox"
size="20"
labelclass="control-label"

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
@ -10,6 +10,7 @@
defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
use Joomla\Registry\Registry;
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
@ -38,15 +39,25 @@ class WeblinksModelWeblink extends JModelItem
*/
protected function populateState()
{
$app = JFactory::getApplication();
$params = $app->getParams();
$app = JFactory::getApplication('site');
// Load the object state.
$id = $app->input->getInt('id');
$this->setState('weblink.id', $id);
$pk = $app->input->getInt('id');
$this->setState('weblink.id', $pk);
// Load the parameters.
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
if ((!$user->authorise('core.edit.state', 'com_weblinks')) && (!$user->authorise('core.edit', 'com_weblinks')))
{
$this->setState('filter.published', 1);
$this->setState('filter.archived', 2);
}
$this->setState('filter.language', JLanguageMultilang::isEnabled());
}
/**
@ -56,43 +67,109 @@ class WeblinksModelWeblink extends JModelItem
*
* @return mixed Object on success, false on failure.
*/
public function getItem($id = null)
public function getItem($pk = null)
{
$user = JFactory::getUser();
$pk = (!empty($pk)) ? $pk : (int) $this->getState('weblink.id');
if ($this->_item === null)
{
$this->_item = false;
$this->_item = array();
}
if (empty($id))
if (!isset($this->_item[$pk]))
{
try
{
$id = $this->getState('weblink.id');
}
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($this->getState('item.select', 'a.*'))
->from('#__weblinks AS a')
->where('a.id = ' . (int) $pk);
// Get a level row instance.
$table = JTable::getInstance('Weblink', 'WeblinksTable');
// Join on category table.
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')
->innerJoin('#__categories AS c on c.id = a.catid')
->where('c.published > 0');
// Attempt to load the row.
if ($table->load($id))
{
// Check published state.
if ($published = $this->getState('filter.published'))
// Join on user table.
$query->select('u.name AS author')
->join('LEFT', '#__users AS u on u.id = a.created_by');
// Filter by language
if ($this->getState('filter.language'))
{
if ($table->state != $published)
{
return $this->_item;
}
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
// Convert the JTable to a clean JObject.
$properties = $table->getProperties(1);
$this->_item = ArrayHelper::toObject($properties, 'JObject');
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
if ((!$user->authorise('core.edit.state', 'com_weblinks')) && (!$user->authorise('core.edit', 'com_weblinks')))
{
// Filter by start and end dates.
$nullDate = $db->quote($db->getNullDate());
$date = JFactory::getDate();
$nowDate = $db->quote($date->toSql());
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
}
// Filter by published state.
$published = $this->getState('filter.published');
$archived = $this->getState('filter.archived');
if (is_numeric($published))
{
$query->where('(a.state = ' . (int) $published . ' OR a.state =' . (int) $archived . ')');
}
$db->setQuery($query);
$data = $db->loadObject();
if (empty($data))
{
JError::raiseError(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
}
// Check for published state if filter set.
if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived)))
{
JError::raiseError(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
}
// Convert parameter fields to objects.
$data->params = new Registry($data->params);
$data->metadata = new Registry($data->metadata);
// Compute access permissions.
if ($access = $this->getState('filter.access'))
{
// If the access filter has been set, we already know this user can view.
$data->params->set('access-view', true);
}
else
{
// If no access filter is set, the layout takes some responsibility for display of limited information.
$groups = $user->getAuthorisedViewLevels();
$data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups));
}
$this->_item[$pk] = $data;
}
elseif ($error = $table->getError())
catch (Exception $e)
{
$this->setError($error);
$this->setError($e);
$this->_item[$pk] = false;
}
}
return $this->_item;
return $this->_item[$pk];
}
/**
@ -118,13 +195,13 @@ class WeblinksModelWeblink extends JModelItem
*
* @return boolean True on success
*/
public function hit($id = null)
public function hit($pk = null)
{
if (empty($id))
if (empty($pk))
{
$id = $this->getState('weblink.id');
$pk = $this->getState('weblink.id');
}
return $this->getTable('Weblink', 'WeblinksTable')->hit($id);
return $this->getTable('Weblink', 'WeblinksTable')->hit($pk);
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -13,10 +13,12 @@
<fields name="request">
<fieldset name="request"
>
<field name="id" type="category"
<field
name="id"
type="category"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_weblinks"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
show_root="true"
required="true"
/>
@ -25,136 +27,162 @@
<!-- 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"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="categories_description" type="textarea"
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
cols="25"
rows="5"
/>
<field name="maxLevelcat" type="list"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
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>
<field name="show_empty_categories_cat" type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_subcat_desc_cat" type="list"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_cat_num_links_cat" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS">
<field name="spacer1" type="spacer" class="text"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
/>
<field name="show_category_title" type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_description" type="list"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_description_image" type="list"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="maxLevel" type="list"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
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="show_empty_categories" type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_subcat_desc" type="list"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
useglobal="true"
<fieldset name="basic" label="JGLOBAL_CATEGORIES_OPTIONS">
<field
name="show_base_description"
type="list"
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_cat_num_links" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
<field
name="categories_description"
type="textarea"
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
description="JGLOBAL_FIELD_CATEGORIES_DESC_DESC"
cols="25"
rows="5"
/>
<field
name="maxLevelcat"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
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>
<field
name="show_empty_categories_cat"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
>
<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"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
>
<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"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
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="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
>
<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"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
@ -163,77 +191,90 @@
</fieldset>
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field name="spacer2" type="spacer" class="text"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
/>
<field
name="filter_field"
type="list"
default=""
description="JGLOBAL_FILTER_FIELD_DESC"
label="JGLOBAL_FILTER_FIELD_LABEL"
useglobal="true"
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field name="show_pagination_limit" type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_headings" type="list"
description="JGLOBAL_SHOW_HEADINGS_DESC"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_link_description" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_link_hits" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
label="JGLOBAL_HITS"
<field
name="filter_field"
type="list"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
>
<option value="0">JHIDE</option>
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination" type="list"
description="JGLOBAL_PAGINATION_DESC"
label="JGLOBAL_PAGINATION_LABEL"
useglobal="true"
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<option value="2">JGLOBAL_AUTO</option>
</field>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination_results" type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
<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"
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_link_hits"
type="list"
label="JGLOBAL_HITS"
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
>
<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"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -12,56 +12,68 @@
<!-- Add fields to the request variables for the layout. -->
<fields name="request">
<fieldset name="request">
<field name="id" type="category"
default="0"
description="COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC"
extension="com_weblinks"
<field
name="id"
type="category"
label="COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL"
description="COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC"
default="0"
extension="com_weblinks"
required="true"
/>
</fieldset>
</fields>
<!-- Add fields to the parameters object for the layout. -->
<fields name="params">
<fieldset name="basic" label="JGLOBAL_CATEGORY_OPTIONS">
<field name="spacer1" type="spacer" class="text"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
<fields name="params">
<fieldset name="basic" label="JGLOBAL_CATEGORY_OPTIONS">
<field
name="spacer1"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field name="show_category_title" type="list"
<field
name="show_category_title"
type="list"
label="JGLOBAL_SHOW_CATEGORY_TITLE"
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_description" type="list"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
<field
name="show_description"
type="list"
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_description_image" type="list"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
<field
name="show_description_image"
type="list"
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="maxLevel" type="list"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
<field
name="maxLevel"
type="list"
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
useglobal="true"
>
>
<option value="0">JNONE</option>
<option value="-1">JALL</option>
<option value="1">J1</option>
@ -72,124 +84,140 @@
</field>
<field name="show_empty_categories" type="list"
<field
name="show_empty_categories"
type="list"
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_subcat_desc" type="list"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
<field
name="show_subcat_desc"
type="list"
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_cat_num_links" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
<field
name="show_cat_num_links"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fieldset>
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field name="spacer2" type="spacer" class="text"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
<field
name="spacer2"
type="spacer"
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
class="text"
/>
<field
name="filter_field"
type="list"
default=""
description="JGLOBAL_FILTER_FIELD_DESC"
label="JGLOBAL_FILTER_FIELD_LABEL"
description="JGLOBAL_FILTER_FIELD_DESC"
default=""
useglobal="true"
>
>
<option value="hide">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination_limit" type="list"
<field
name="show_pagination_limit"
type="list"
label="JGLOBAL_DISPLAY_SELECT_LABEL"
description="JGLOBAL_DISPLAY_SELECT_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_headings" type="list"
description="JGLOBAL_SHOW_HEADINGS_DESC"
<field
name="show_headings"
type="list"
label="JGLOBAL_SHOW_HEADINGS_LABEL"
description="JGLOBAL_SHOW_HEADINGS_DESC"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_link_description" type="list"
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
<field
name="show_link_description"
type="list"
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_link_hits" type="list"
<field
name="show_link_hits"
type="list"
label="JGLOBAL_HITS"
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
label="JGLOBAL_HITS"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_pagination" type="list"
description="JGLOBAL_PAGINATION_DESC"
<field
name="show_pagination"
type="list"
label="JGLOBAL_PAGINATION_LABEL"
description="JGLOBAL_PAGINATION_DESC"
useglobal="true"
>
>
<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"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
<field
name="show_pagination_results"
type="list"
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
description="JGLOBAL_PAGINATION_RESULTS_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
<fieldset name="integration"
>
<field name="show_feed_link" type="list"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
useglobal="true"
>
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
<fieldset name="integration">
<field
name="show_feed_link"
type="list"
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
description="JGLOBAL_SHOW_FEED_LINK_DESC"
useglobal="true"
>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
</fieldset>
</fields>
</metadata>

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
@ -135,7 +135,7 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?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="img-intro-<?php echo htmlspecialchars($imgfloat); ?>"> <img
<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; ?>
@ -143,7 +143,7 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<?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); ?> item-image"> <img
<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; ?>

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$weblinkUrl = JStringPunycode::urlToUTF8($this->item->url);
?>
<div class="item-page">
<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? JFactory::getConfig()->get('language') : $this->item->language; ?>" />
<div class="page-header">
<h2 itemprop="headline">
<?php echo $this->escape($this->item->title); ?>
</h2>
</div>
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
<?php echo $this->item->event->beforeDisplayContent; ?>
<div itemprop="articleBody">
<a href="<?php echo $weblinkUrl; ?>" target="_blank" itemprop="url">
<?php echo $weblinkUrl; ?>
</a>
<?php echo $this->item->description; ?>
</div>
<?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
<?php echo $this->item->event->afterDisplayContent; ?>
</div>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_TITLE" option="COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_OPTION">
<help
key = "JHELP_MENUS_MENU_ITEM_WEBLINK_SINGLE_WEBLINK"
/>
<message>
<![CDATA[COM_WEBLINKS_WEBLINK_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset
name="request"
addfieldpath="/administrator/components/com_weblinks/models/fields"
>
<field name="id"
type="modal_weblink"
label="COM_WEBLINKS_FIELD_SELECT_WEBLINK_LABEL"
required="true"
select="true"
new="true"
edit="true"
clear="true"
description="COM_WEBLINKS_FIELD_SELECT_WEBLINK_DESC"
/>
</fieldset>
</fields>
</metadata>

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
@ -10,44 +10,53 @@
defined('_JEXEC') or die;
/**
* HTML View class for the WebLinks component
* HTML Weblink View class for the Weblinks component
*
* @since 1.5
* @since __DEPLOY_VERSION__
*/
class WeblinksViewWeblink extends JViewLegacy
{
protected $state;
protected $item;
protected $params;
protected $state;
/**
* Display the view.
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since __DEPLOY_VERSION__
*/
public function display($tpl = null)
{
// Get some data from the models
$item = $this->get('Item');
$dispatcher = JEventDispatcher::getInstance();
if ($this->getLayout() == 'edit')
{
$this->_displayEdit($tpl);
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->params = $this->state->get('params');
return;
}
// Create a shortcut for $item.
$item = $this->item;
if ($item->url)
{
// Redirects to url if matching id found
JFactory::getApplication()->redirect($item->url);
}
else
{
// @TODO create proper error handling
JFactory::getApplication()->redirect(JRoute::_('index.php'), JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 'notice');
}
$offset = $this->state->get('list.offset');
$dispatcher->trigger('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event = new stdClass;
$results = $dispatcher->trigger('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayContent = trim(implode("\n", $results));
parent::display($tpl);
}
}

View File

@ -1,7 +1,7 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage Weblinks
* @package Joomla.Site
* @subpackage com_weblinks
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -0,0 +1,61 @@
/**
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
(function() {
"use strict";
/**
* Javascript to insert the link
* View element calls jSelectWeblink when an weblink is clicked
* jSelectWeblink creates the link tag, sends it to the editor,
* and closes the select frame.
**/
window.jSelectWeblink = function (id, title, catid, object, link, lang) {
var hreflang = '', editor, tag;
if (!Joomla.getOptions('xtd-weblinks')) {
// Something went wrong!
window.parent.jModalClose();
return false;
}
editor = Joomla.getOptions('xtd-weblinks').editor;
if (lang !== '')
{
hreflang = ' hreflang="' + lang + '"';
}
tag = '<a' + hreflang + ' href="' + link + '">' + title + '</a>';
/** Use the API, if editor supports it **/
if (window.Joomla && window.Joomla.editors && Joomla.editors.instances && Joomla.editors.instances.hasOwnProperty(editor)) {
Joomla.editors.instances[editor].replaceSelection(tag)
} else {
window.parent.jInsertEditorText(tag, editor);
}
window.parent.jModalClose();
};
document.addEventListener('DOMContentLoaded', function(){
// Get the elements
var elements = document.querySelectorAll('.select-link');
for(var i = 0, l = elements.length; l>i; i++) {
// Listen for click event
elements[i].addEventListener('click', function (event) {
event.preventDefault();
var functionName = event.target.getAttribute('data-function');
if (functionName === 'jSelectWeblink') {
// Used in xtd_weblinks
window[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language', null));
} else {
// Used in com_menus
window.parent[functionName](event.target.getAttribute('data-id'), event.target.getAttribute('data-title'), event.target.getAttribute('data-cat-id'), null, event.target.getAttribute('data-uri'), event.target.getAttribute('data-language', null));
}
})
}
});
})();

View File

@ -0,0 +1 @@
!function(){"use strict";window.jSelectWeblink=function(a,b,c,d,e,f){var h,i,g="";if(!Joomla.getOptions("xtd-weblinks"))return window.parent.jModalClose(),!1;h=Joomla.getOptions("xtd-weblinks").editor,""!==f&&(g=' hreflang="'+f+'"'),i="<a"+g+' href="'+e+'">'+b+"</a>",window.Joomla&&window.Joomla.editors&&Joomla.editors.instances&&Joomla.editors.instances.hasOwnProperty(h)?Joomla.editors.instances[h].replaceSelection(i):window.parent.jInsertEditorText(i,h),window.parent.jModalClose()},document.addEventListener("DOMContentLoaded",function(){for(var a=document.querySelectorAll(".select-link"),b=0,c=a.length;c>b;b++)a[b].addEventListener("click",function(a){a.preventDefault();var b=a.target.getAttribute("data-function");"jSelectWeblink"===b?window[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language",null)):window.parent[b](a.target.getAttribute("data-id"),a.target.getAttribute("data-title"),a.target.getAttribute("data-cat-id"),null,a.target.getAttribute("data-uri"),a.target.getAttribute("data-language",null))})})}();

View File

@ -11,6 +11,7 @@
<description>MOD_WEBLINKS_XML_DESCRIPTION</description>
<files>
##MODULE_FILES##
<file module="mod_weblinks">mod_weblinks.php</file>
</files>
<languages folder="language">
##LANGUAGE_FILES##
@ -22,20 +23,20 @@
<field
name="catid"
type="category"
extension="com_weblinks"
required="true"
label="JCATEGORY"
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC"
extension="com_weblinks"
required="true"
/>
<field
name="groupby"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_GROUPBY_LABEL"
description="MOD_WEBLINKS_FIELD_GROUPBY_DESC"
>
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
@ -43,12 +44,12 @@
<field
name="groupby_showtitle"
type="radio"
class="btn-group btn-group-yesno"
default="1"
label="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_LABEL"
description="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_DESC"
class="btn-group btn-group-yesno"
default="1"
showon="groupby:1"
>
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
@ -56,11 +57,11 @@
<field
name="groupby_ordering"
type="list"
default="c.lft"
label="MOD_WEBLINKS_FIELD_GROUPBYORDERING_LABEL"
description="MOD_WEBLINKS_FIELD_GROUPBYORDERING_DESC"
default="c.lft"
showon="groupby:1"
>
>
<option value="c.title">JGLOBAL_TITLE</option>
<option value="c.lft">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
</field>
@ -68,11 +69,11 @@
<field
name="groupby_direction"
type="list"
default="asc"
label="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_LABEL"
description="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_DESC"
default="asc"
showon="groupby:1"
>
>
<option value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
<option value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
</field>
@ -80,12 +81,12 @@
<field
name="groupby_columns"
type="list"
default="3"
label="MOD_WEBLINKS_FIELD_COLUMNS_LABEL"
description="MOD_WEBLINKS_FIELD_COLUMNS_DESC"
>
default="3"
>
<option value="1">J1</option>
<option value="2">J2</option>
<option value="2">J2</option>
<option value="3">J3</option>
<option value="4">J4</option>
<option value="6">J6</option>
@ -94,18 +95,18 @@
<field
name="count"
type="text"
default="5"
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
description="MOD_WEBLINKS_FIELD_COUNT_DESC"
default="5"
/>
<field
name="ordering"
type="list"
default="title"
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERING_DESC"
>
default="title"
>
<option value="title">JGLOBAL_TITLE</option>
<option value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
<option value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
@ -114,10 +115,10 @@
<field
name="direction"
type="list"
default="asc"
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC"
>
default="asc"
>
<option value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
<option value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
</field>
@ -125,10 +126,10 @@
<field
name="follow"
type="list"
default="0"
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC"
>
default="0"
>
<option value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
<option value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
</field>
@ -136,11 +137,11 @@
<field
name="description"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC"
>
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
@ -148,11 +149,11 @@
<field
name="hits"
type="radio"
class="btn-group btn-group-yesno"
default="0"
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
description="MOD_WEBLINKS_FIELD_HITS_DESC"
>
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
@ -160,16 +161,17 @@
<field
name="count_clicks"
type="list"
class="chzn-color"
default="0"
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC"
>
class="chzn-color"
default="0"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
@ -181,18 +183,18 @@
<field
name="moduleclass_sfx"
type="textarea"
rows="3"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="cache"
type="list"
default="1"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
>
default="1"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
@ -200,9 +202,9 @@
<field
name="cache_time"
type="text"
default="900"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
/>
<field

View File

@ -0,0 +1,8 @@
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
PLG_EDITORS-XTD_WEBLINK="Button - Web Link"
PLG_EDITORS-XTD_WEBLINK_BUTTON_WEBLINK="Web Link"
PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION="Displays a button to make it possible to insert web links into an Article. Displays a popup allowing you to choose the web link."

View File

@ -0,0 +1,7 @@
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
PLG_EDITORS-XTD_WEBLINK="Button - Web Link"
PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION="Displays a button to make it possible to insert web links into an Article. Displays a popup allowing you to choose the web link."

View File

@ -0,0 +1,59 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.weblink
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Editor Web Link button
*
* @since __DEPLOY_VERSION__
*/
class PlgButtonWeblink extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $autoloadLanguage = true;
/**
* Display the button
*
* @param string $name The name of the button to add
*
* @return JObject The button options as JObject
*
* @since __DEPLOY_VERSION__
*/
public function onDisplay($name)
{
$user = JFactory::getUser();
if ($user->authorise('core.create', 'com_weblinks')
|| $user->authorise('core.edit', 'com_weblinks')
|| $user->authorise('core.edit.own', 'com_weblinks'))
{
// The URL for the weblinks list
$link = 'index.php?option=com_weblinks&amp;view=weblinks&amp;layout=modal&amp;tmpl=component&amp;'
. JSession::getFormToken() . '=1&amp;editor=' . $name;
$button = new JObject;
$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = JText::_('PLG_EDITORS-XTD_WEBLINK_BUTTON_WEBLINK');
$button->name = 'link';
$button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";
return $button;
}
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.7" type="plugin" group="editors-xtd" method="upgrade">
<name>plg_editors-xtd_weblink</name>
<author>Joomla! Project</author>
<creationDate>##DATE##</creationDate>
<copyright>Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.7.0</version>
<description>PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION</description>
<files>
##FILES##
</files>
<languages folder="language">
##LANGUAGE_FILES##
</languages>
</extension>

View File

@ -21,20 +21,20 @@
<field
name="search_limit"
type="text"
default="50"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
label="JFIELD_PLG_SEARCH_SEARCHLIMIT_LABEL"
description="JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC"
default="50"
size="5"
/>
<field
name="search_content"
type="radio"
label="JFIELD_PLG_SEARCH_ALL_LABEL"
description="JFIELD_PLG_SEARCH_ALL_DESC"
class="btn-group btn-group-yesno"
default="0"
description="JFIELD_PLG_SEARCH_ALL_DESC"
label="JFIELD_PLG_SEARCH_ALL_LABEL"
>
>
<option value="1">JON</option>
<option value="0">JOFF</option>
</field>
@ -42,11 +42,11 @@
<field
name="search_archived"
type="radio"
label="JFIELD_PLG_SEARCH_ARCHIVED_LABEL"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"
class="btn-group btn-group-yesno"
default="0"
description="JFIELD_PLG_SEARCH_ARCHIVED_DESC"
label="JFIELD_PLG_SEARCH_ARCHIVED_LABEL"
>
>
<option value="1">JON</option>
<option value="0">JOFF</option>
</field>