mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-05-29 04:30:46 +00:00
Merge pull request #436 from joomdonation/4.0-compatible
Make weblinks 4.0-compatible
This commit is contained in:
commit
8491a67566
25
.drone.yml
25
.drone.yml
|
@ -6,6 +6,7 @@ steps:
|
||||||
- name: weblinks-codeception-tests
|
- name: weblinks-codeception-tests
|
||||||
image: joomlaprojects/docker-images:systemtests
|
image: joomlaprojects/docker-images:systemtests
|
||||||
commands:
|
commands:
|
||||||
|
- pwd
|
||||||
- composer install
|
- composer install
|
||||||
- chmod a+x .drone/build.sh
|
- chmod a+x .drone/build.sh
|
||||||
- ./.drone/build.sh
|
- ./.drone/build.sh
|
||||||
|
@ -18,6 +19,28 @@ steps:
|
||||||
- fluxbox > /dev/null 2>&1 &
|
- fluxbox > /dev/null 2>&1 &
|
||||||
- vendor/bin/robo run:tests
|
- vendor/bin/robo run:tests
|
||||||
|
|
||||||
|
- name: artifacts-codeception-tests
|
||||||
|
image: cschlosser/drone-ftps
|
||||||
|
depends_on: [ weblinks-codeception-tests ]
|
||||||
|
environment:
|
||||||
|
FTP_USERNAME:
|
||||||
|
from_secret: ftpusername
|
||||||
|
FTP_PASSWORD:
|
||||||
|
from_secret: ftppassword
|
||||||
|
PLUGIN_HOSTNAME: artifacts.joomla.org:21
|
||||||
|
PLUGIN_SRC_DIR: /tests/_output
|
||||||
|
PLUGIN_DEST_DIR: /
|
||||||
|
PLUGIN_SECURE: false
|
||||||
|
PLUGIN_EXCLUDE: ^\.git/$
|
||||||
|
commands:
|
||||||
|
- ls -l /drone/src/tests/_output
|
||||||
|
- export PLUGIN_DEST_DIR=$PLUGIN_DEST_DIR/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST/system-tests/$DRONE_BUILD_NUMBER
|
||||||
|
- echo https://artifacts.joomla.org/drone$PLUGIN_DEST_DIR
|
||||||
|
- /bin/upload.sh
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- failure
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: weblinks_cache
|
- name: weblinks_cache
|
||||||
host:
|
host:
|
||||||
|
@ -25,6 +48,6 @@ volumes:
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: bdbb55e8a838f65e5a832cfca09af95d450cbdc9d733e03f0f528abdebfff47f
|
hmac: bcc028d5d9601f1f3355862f17dd2434ba86f47634f0737877db534e49c8265b
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
@ -22,6 +22,8 @@ cd /tests/www
|
||||||
cp jorobo.dist.ini jorobo.ini
|
cp jorobo.dist.ini jorobo.ini
|
||||||
cp RoboFile.dist.ini RoboFile.ini
|
cp RoboFile.dist.ini RoboFile.ini
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Build package
|
# Build package
|
||||||
vendor/bin/robo build --dev
|
vendor/bin/robo build --dev
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
actor: Tester
|
actor: Tester
|
||||||
paths:
|
paths:
|
||||||
tests: tests
|
tests: tests
|
||||||
log: tests/_output
|
log: /drone/src/tests/_output
|
||||||
data: tests/_data
|
data: tests/_data
|
||||||
helpers: tests/_support
|
helpers: tests/_support
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Administrator
|
|
||||||
* @subpackage com_contact
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Joomla\Component\Weblinks\Administrator\Extension;
|
|
||||||
|
|
||||||
defined('JPATH_PLATFORM') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Association\AssociationServiceInterface;
|
|
||||||
use Joomla\CMS\Association\AssociationServiceTrait;
|
|
||||||
use Joomla\CMS\Categories\CategoryServiceInterface;
|
|
||||||
use Joomla\CMS\Categories\CategoryServiceTrait;
|
|
||||||
use Joomla\CMS\Extension\MVCComponent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Component class for com_contact
|
|
||||||
*
|
|
||||||
* @since 4.0.0
|
|
||||||
*/
|
|
||||||
class WeblinksComponent extends MVCComponent implements CategoryServiceInterface, AssociationServiceInterface
|
|
||||||
{
|
|
||||||
use CategoryServiceTrait;
|
|
||||||
use AssociationServiceTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the table for the count items functions for the given section.
|
|
||||||
*
|
|
||||||
* @param string $section The section
|
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*
|
|
||||||
* @since 4.0.0
|
|
||||||
*/
|
|
||||||
protected function getTableNameForSection(string $section = null)
|
|
||||||
{
|
|
||||||
return ($section === 'category' ? 'categories' : 'weblinks');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the state column for the count items functions for the given section.
|
|
||||||
*
|
|
||||||
* @param string $section The section
|
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*
|
|
||||||
* @since 4.0.0
|
|
||||||
*/
|
|
||||||
protected function getStateColumnForSection(string $section = null)
|
|
||||||
{
|
|
||||||
return 'published';
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,261 +0,0 @@
|
||||||
<?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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Joomla\Component\Weblinks\Administrator\Field\Modal;
|
|
||||||
|
|
||||||
defined('JPATH_BASE') or die;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Supports a modal weblink picker.
|
|
||||||
*
|
|
||||||
* @since __DEPLOY_VERSION__
|
|
||||||
*/
|
|
||||||
class WeblinkField 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&view=weblinks&layout=modal&tmpl=component&' . \JSession::getFormToken() . '=1';
|
|
||||||
$linkWeblink = 'index.php?option=com_weblinks&view=weblink&layout=modal&tmpl=component&' . \JSession::getFormToken() . '=1';
|
|
||||||
$modalTitle = \JText::_('COM_WEBLINKS_CHANGE_WEBLINK');
|
|
||||||
|
|
||||||
if (isset($this->element['language']))
|
|
||||||
{
|
|
||||||
$linkWeblinks .= '&forcedLanguage=' . $this->element['language'];
|
|
||||||
$linkWeblink .= '&forcedLanguage=' . $this->element['language'];
|
|
||||||
$modalTitle .= ' — ' . $this->element['label'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$urlSelect = $linkWeblinks . '&function=jSelectWeblink_' . $this->id;
|
|
||||||
$urlEdit = $linkWeblink . '&task=weblink.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \'';
|
|
||||||
$urlNew = $linkWeblink . '&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());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,205 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Administrator
|
|
||||||
* @subpackage 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Joomla\Component\Weblinks\Administrator\Table;
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Weblink Table class
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
class WeblinkTable extends \JTable
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Ensure the params and metadata in json encoded in the bind method
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 3.4
|
|
||||||
*/
|
|
||||||
protected $_jsonEncode = array('params', 'metadata', 'images');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param JDatabaseDriver &$db A database connector object
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
public function __construct(&$db)
|
|
||||||
{
|
|
||||||
parent::__construct('#__weblinks', 'id', $db);
|
|
||||||
|
|
||||||
// Set the published column alias
|
|
||||||
$this->setColumnAlias('published', 'state');
|
|
||||||
|
|
||||||
if (version_compare(JVERSION, '4.0', '<' ) == 1)
|
|
||||||
{
|
|
||||||
\JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
|
|
||||||
\JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overload the store method for the Weblinks table.
|
|
||||||
*
|
|
||||||
* @param boolean $updateNulls Toggle whether null values should be updated.
|
|
||||||
*
|
|
||||||
* @return boolean True on success, false on failure.
|
|
||||||
*
|
|
||||||
* @since 1.6
|
|
||||||
*/
|
|
||||||
public function store($updateNulls = false)
|
|
||||||
{
|
|
||||||
$date = \JFactory::getDate();
|
|
||||||
$user = \JFactory::getUser();
|
|
||||||
|
|
||||||
$this->modified = $date->toSql();
|
|
||||||
|
|
||||||
if ($this->id)
|
|
||||||
{
|
|
||||||
// Existing item
|
|
||||||
$this->modified_by = $user->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// New weblink. A weblink created and created_by field can be set by the user,
|
|
||||||
// so we don't touch either of these if they are set.
|
|
||||||
if (!(int) $this->created)
|
|
||||||
{
|
|
||||||
$this->created = $date->toSql();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($this->created_by))
|
|
||||||
{
|
|
||||||
$this->created_by = $user->id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set publish_up to null date if not set
|
|
||||||
if (!$this->publish_up)
|
|
||||||
{
|
|
||||||
$this->publish_up = $this->getDbo()->getNullDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set publish_down to null date if not set
|
|
||||||
if (!$this->publish_down)
|
|
||||||
{
|
|
||||||
$this->publish_down = $this->getDbo()->getNullDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that the alias is unique
|
|
||||||
$table = new WeblinkTable($this->getDbo());
|
|
||||||
|
|
||||||
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'));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert IDN urls to punycode
|
|
||||||
$this->url = \JStringPunycode::urlToPunycode($this->url);
|
|
||||||
|
|
||||||
return parent::store($updateNulls);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overloaded check method to ensure data integrity.
|
|
||||||
*
|
|
||||||
* @return boolean True on success.
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
public function check()
|
|
||||||
{
|
|
||||||
if (\JFilterInput::checkAttribute(array('href', $this->url)))
|
|
||||||
{
|
|
||||||
$this->setError(\JText::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL'));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for valid name
|
|
||||||
if (trim($this->title) == '')
|
|
||||||
{
|
|
||||||
$this->setError(\JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for existing name
|
|
||||||
$db = $this->getDbo();
|
|
||||||
|
|
||||||
$query = $db->getQuery(true)
|
|
||||||
->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);
|
|
||||||
|
|
||||||
$xid = (int) $db->loadResult();
|
|
||||||
|
|
||||||
if ($xid && $xid != (int) $this->id)
|
|
||||||
{
|
|
||||||
$this->setError(\JText::_('COM_WEBLINKS_ERR_TABLES_NAME'));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($this->alias))
|
|
||||||
{
|
|
||||||
$this->alias = $this->title;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->alias = \JApplicationHelper::stringURLSafe($this->alias, $this->language);
|
|
||||||
|
|
||||||
if (trim(str_replace('-', '', $this->alias)) == '')
|
|
||||||
{
|
|
||||||
$this->alias = \JFactory::getDate()->format("Y-m-d-H-i-s");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check the publish down date is not earlier than publish up.
|
|
||||||
if ($this->publish_down > $db->getNullDate() && $this->publish_down < $this->publish_up)
|
|
||||||
{
|
|
||||||
$this->setError(\JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clean up keywords -- eliminate extra spaces between phrases
|
|
||||||
* and cr (\r) and lf (\n) characters from string
|
|
||||||
*/
|
|
||||||
if (!empty($this->metakey))
|
|
||||||
{
|
|
||||||
// Array of characters to remove
|
|
||||||
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
|
||||||
$after_clean = \JString::str_ireplace($bad_characters, "", $this->metakey);
|
|
||||||
$keys = explode(',', $after_clean);
|
|
||||||
$clean_keys = array();
|
|
||||||
|
|
||||||
foreach ($keys as $key)
|
|
||||||
{
|
|
||||||
// Ignore blank keywords
|
|
||||||
if (trim($key))
|
|
||||||
{
|
|
||||||
$clean_keys[] = trim($key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put array back together delimited by ", "
|
|
||||||
$this->metakey = implode(", ", $clean_keys);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::check();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,119 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Administrator
|
|
||||||
* @subpackage 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Joomla\Component\Weblinks\Administrator\View\Weblink;
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* View to edit a weblink.
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
class HtmlView extends \Joomla\CMS\MVC\View\HtmlView
|
|
||||||
{
|
|
||||||
protected $state;
|
|
||||||
|
|
||||||
protected $item;
|
|
||||||
|
|
||||||
protected $form;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the view.
|
|
||||||
*
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
public function display($tpl = null)
|
|
||||||
{
|
|
||||||
$this->state = $this->get('State');
|
|
||||||
$this->item = $this->get('Item');
|
|
||||||
$this->form = $this->get('Form');
|
|
||||||
|
|
||||||
// Check for errors.
|
|
||||||
if (count($errors = $this->get('Errors')))
|
|
||||||
{
|
|
||||||
\JError::raiseError(500, implode("\n", $errors));
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
parent::display($tpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the page title and toolbar.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.6
|
|
||||||
*/
|
|
||||||
protected function addToolbar()
|
|
||||||
{
|
|
||||||
\JFactory::getApplication()->input->set('hidemainmenu', true);
|
|
||||||
|
|
||||||
$user = \JFactory::getUser();
|
|
||||||
$isNew = ($this->item->id == 0);
|
|
||||||
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
|
|
||||||
|
|
||||||
// Since we don't track these assets at the item level, use the category id.
|
|
||||||
$canDo = \JHelperContent::getActions('com_weblinks', 'category', $this->item->catid);
|
|
||||||
|
|
||||||
\JToolbarHelper::title($isNew ? \JText::_('COM_WEBLINKS_MANAGER_WEBLINK_NEW') : \JText::_('COM_WEBLINKS_MANAGER_WEBLINK_EDIT'), 'link weblinks');
|
|
||||||
|
|
||||||
// If not checked out, can save the item.
|
|
||||||
if (!$checkedOut && ($canDo->get('core.edit')||(count($user->getAuthorisedCategories('com_weblinks', 'core.create')))))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::apply('weblink.apply');
|
|
||||||
\JToolbarHelper::save('weblink.save');
|
|
||||||
}
|
|
||||||
if (!$checkedOut && (count($user->getAuthorisedCategories('com_weblinks', 'core.create'))))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::save2new('weblink.save2new');
|
|
||||||
}
|
|
||||||
// If an existing item, can save to a copy.
|
|
||||||
if (!$isNew && (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::save2copy('weblink.save2copy');
|
|
||||||
}
|
|
||||||
if (empty($this->item->id))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::cancel('weblink.cancel');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($this->state->params->get('save_history', 0) && $user->authorise('core.edit'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::versions('com_weblinks.weblink', $this->item->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
\JToolbarHelper::cancel('weblink.cancel', 'JTOOLBAR_CLOSE');
|
|
||||||
}
|
|
||||||
|
|
||||||
\JToolbarHelper::divider();
|
|
||||||
\JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS_EDIT');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,171 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @package Joomla.Administrator
|
|
||||||
* @subpackage 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Joomla\Component\Weblinks\Administrator\View\Weblinks;
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* View class for a list of weblinks.
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
class HtmlView extends \Joomla\CMS\MVC\View\HtmlView
|
|
||||||
{
|
|
||||||
protected $items;
|
|
||||||
|
|
||||||
protected $pagination;
|
|
||||||
|
|
||||||
protected $state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the view.
|
|
||||||
*
|
|
||||||
* @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.
|
|
||||||
*/
|
|
||||||
public function display($tpl = null)
|
|
||||||
{
|
|
||||||
$this->state = $this->get('State');
|
|
||||||
$this->items = $this->get('Items');
|
|
||||||
$this->pagination = $this->get('Pagination');
|
|
||||||
$this->filterForm = $this->get('FilterForm');
|
|
||||||
$this->activeFilters = $this->get('ActiveFilters');
|
|
||||||
|
|
||||||
// Modal layout doesn't need the submenu.
|
|
||||||
if ($this->getLayout() !== 'modal')
|
|
||||||
{
|
|
||||||
\WeblinksHelper::addSubmenu('weblinks');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for errors.
|
|
||||||
if (count($errors = $this->get('Errors')))
|
|
||||||
{
|
|
||||||
\JError::raiseError(500, implode("\n", $errors));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the page title and toolbar.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.6
|
|
||||||
*/
|
|
||||||
protected function addToolbar()
|
|
||||||
{
|
|
||||||
require_once JPATH_COMPONENT . '/helpers/weblinks.php';
|
|
||||||
|
|
||||||
$state = $this->get('State');
|
|
||||||
$canDo = \JHelperContent::getActions('com_weblinks', 'category', $state->get('filter.category_id'));
|
|
||||||
$user = \JFactory::getUser();
|
|
||||||
|
|
||||||
// Get the toolbar object instance
|
|
||||||
$bar = \JToolbar::getInstance('toolbar');
|
|
||||||
|
|
||||||
\JToolbarHelper::title(\JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks');
|
|
||||||
|
|
||||||
if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0)
|
|
||||||
{
|
|
||||||
\JToolbarHelper::addNew('weblink.add');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($canDo->get('core.edit') || $canDo->get('core.edit.own'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::editList('weblink.edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($canDo->get('core.edit.state'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::publish('weblinks.publish', 'JTOOLBAR_PUBLISH', true);
|
|
||||||
\JToolbarHelper::unpublish('weblinks.unpublish', 'JTOOLBAR_UNPUBLISH', true);
|
|
||||||
|
|
||||||
\JToolbarHelper::archiveList('weblinks.archive');
|
|
||||||
\JToolbarHelper::checkin('weblinks.checkin');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($state->get('filter.published') == -2 && $canDo->get('core.delete'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
|
|
||||||
}
|
|
||||||
elseif ($canDo->get('core.edit.state'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::trash('weblinks.trash');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a batch button
|
|
||||||
if ($user->authorise('core.create', 'com_weblinks') && $user->authorise('core.edit', 'com_weblinks')
|
|
||||||
&& $user->authorise('core.edit.state', 'com_weblinks'))
|
|
||||||
{
|
|
||||||
\JHtml::_('bootstrap.renderModal', 'collapseModal');
|
|
||||||
$title = \JText::_('JTOOLBAR_BATCH');
|
|
||||||
|
|
||||||
// Instantiate a new JLayoutFile instance and render the batch button
|
|
||||||
$layout = new \JLayoutFile('joomla.toolbar.batch');
|
|
||||||
|
|
||||||
$dhtml = $layout->render(array('title' => $title));
|
|
||||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->authorise('core.admin', 'com_weblinks') || $user->authorise('core.options', 'com_weblinks'))
|
|
||||||
{
|
|
||||||
\JToolbarHelper::preferences('com_weblinks');
|
|
||||||
}
|
|
||||||
|
|
||||||
\JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array of fields the table can be sorted by
|
|
||||||
*
|
|
||||||
* @return array Array containing the field name to sort by as the key and display text as value
|
|
||||||
*
|
|
||||||
* @since 3.0
|
|
||||||
*/
|
|
||||||
protected function getSortFields()
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'a.ordering' => \JText::_('JGRID_HEADING_ORDERING'),
|
|
||||||
'a.state' => \JText::_('JSTATUS'),
|
|
||||||
'a.title' => \JText::_('JGLOBAL_TITLE'),
|
|
||||||
'a.access' => \JText::_('JGRID_HEADING_ACCESS'),
|
|
||||||
'a.hits' => \JText::_('JGLOBAL_HITS'),
|
|
||||||
'a.language' => \JText::_('JGRID_HEADING_LANGUAGE'),
|
|
||||||
'a.id' => \JText::_('JGRID_HEADING_ID')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +1,35 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<access component="com_weblinks">
|
<access component="com_weblinks">
|
||||||
<section name="component">
|
<section name="component">
|
||||||
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
<action name="core.admin" title="JACTION_ADMIN" />
|
||||||
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
|
<action name="core.options" title="JACTION_OPTIONS" />
|
||||||
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
<action name="core.manage" title="JACTION_MANAGE" />
|
||||||
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
<action name="core.create" title="JACTION_CREATE" />
|
||||||
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
<action name="core.delete" title="JACTION_DELETE" />
|
||||||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
<action name="core.edit" title="JACTION_EDIT" />
|
||||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
<action name="core.edit.state" title="JACTION_EDITSTATE" />
|
||||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
<action name="core.edit.own" title="JACTION_EDITOWN" />
|
||||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="JACTION_EDITVALUE_COMPONENT_DESC" />
|
<action name="core.edit.value" title="JACTION_EDITVALUE" />
|
||||||
</section>
|
</section>
|
||||||
<section name="category">
|
<section name="category">
|
||||||
<action name="core.create" title="JACTION_CREATE" description="COM_CATEGORIES_ACCESS_CREATE_DESC" />
|
<action name="core.create" title="JACTION_CREATE" />
|
||||||
<action name="core.delete" title="JACTION_DELETE" description="COM_CATEGORIES_ACCESS_DELETE_DESC" />
|
<action name="core.delete" title="JACTION_DELETE" />
|
||||||
<action name="core.edit" title="JACTION_EDIT" description="COM_CATEGORIES_ACCESS_EDIT_DESC" />
|
<action name="core.edit" title="JACTION_EDIT" />
|
||||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
|
<action name="core.edit.state" title="JACTION_EDITSTATE" />
|
||||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_CATEGORIES_ACCESS_EDITOWN_DESC" />
|
<action name="core.edit.own" title="JACTION_EDITOWN" />
|
||||||
</section>
|
</section>
|
||||||
<section name="fieldgroup">
|
<section name="fieldgroup">
|
||||||
<action name="core.create" title="JACTION_CREATE" description="COM_FIELDS_GROUP_PERMISSION_CREATE_DESC" />
|
<action name="core.create" title="JACTION_CREATE" />
|
||||||
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_GROUP_PERMISSION_DELETE_DESC" />
|
<action name="core.delete" title="JACTION_DELETE" />
|
||||||
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_GROUP_PERMISSION_EDIT_DESC" />
|
<action name="core.edit" title="JACTION_EDIT" />
|
||||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_GROUP_PERMISSION_EDITSTATE_DESC" />
|
<action name="core.edit.state" title="JACTION_EDITSTATE" />
|
||||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_FIELDS_GROUP_PERMISSION_EDITOWN_DESC" />
|
<action name="core.edit.own" title="JACTION_EDITOWN" />
|
||||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_GROUP_PERMISSION_EDITVALUE_DESC" />
|
<action name="core.edit.value" title="JACTION_EDITVALUE" />
|
||||||
</section>
|
</section>
|
||||||
<section name="field">
|
<section name="field">
|
||||||
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_FIELD_PERMISSION_DELETE_DESC" />
|
<action name="core.delete" title="JACTION_DELETE" />
|
||||||
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" />
|
<action name="core.edit" title="JACTION_EDIT" />
|
||||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" />
|
<action name="core.edit.state" title="JACTION_EDITSTATE" />
|
||||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" />
|
<action name="core.edit.value" title="JACTION_EDITVALUE" />
|
||||||
</section>
|
</section>
|
||||||
</access>
|
</access>
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
name="captcha"
|
name="captcha"
|
||||||
type="plugins"
|
type="plugins"
|
||||||
label="COM_WEBLINKS_FIELD_CAPTCHA_LABEL"
|
label="COM_WEBLINKS_FIELD_CAPTCHA_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_CAPTCHA_DESC"
|
|
||||||
default=""
|
default=""
|
||||||
folder="captcha"
|
folder="captcha"
|
||||||
filter="cmd"
|
filter="cmd"
|
||||||
|
@ -21,9 +20,9 @@
|
||||||
<field
|
<field
|
||||||
name="target"
|
name="target"
|
||||||
type="list"
|
type="list"
|
||||||
default="0"
|
|
||||||
description="COM_WEBLINKS_FIELD_TARGET_DESC"
|
|
||||||
label="COM_WEBLINKS_FIELD_TARGET_LABEL"
|
label="COM_WEBLINKS_FIELD_TARGET_LABEL"
|
||||||
|
default="0"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="0">JBROWSERTARGET_PARENT</option>
|
<option value="0">JBROWSERTARGET_PARENT</option>
|
||||||
<option value="1">JBROWSERTARGET_NEW</option>
|
<option value="1">JBROWSERTARGET_NEW</option>
|
||||||
|
@ -34,35 +33,32 @@
|
||||||
<field
|
<field
|
||||||
name="save_history"
|
name="save_history"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="0"
|
|
||||||
label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"
|
label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL"
|
||||||
description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="0"
|
||||||
>
|
>
|
||||||
<option value="1">JYES</option>
|
|
||||||
<option value="0">JNO</option>
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="history_limit"
|
name="history_limit"
|
||||||
type="text"
|
type="number"
|
||||||
filter="integer"
|
|
||||||
label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
|
label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL"
|
||||||
description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
|
filter="integer"
|
||||||
default="5"
|
default="10"
|
||||||
showon="save_history:1"
|
showon="save_history:1"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="count_clicks"
|
name="count_clicks"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
label="COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_COUNTCLICKS_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JYES</option>
|
|
||||||
<option value="0">JNO</option>
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
|
@ -76,7 +72,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
default="1"
|
default="1"
|
||||||
label="COM_WEBLINKS_FIELD_ICON_LABEL"
|
label="COM_WEBLINKS_FIELD_ICON_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_ICON_DESC"
|
|
||||||
filter="integer"
|
filter="integer"
|
||||||
>
|
>
|
||||||
<option value="0">COM_WEBLINKS_FIELD_ICON_OPTION_TEXT</option>
|
<option value="0">COM_WEBLINKS_FIELD_ICON_OPTION_TEXT</option>
|
||||||
|
@ -101,7 +96,8 @@
|
||||||
name="float_first"
|
name="float_first"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
|
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
|
||||||
description="COM_WEBLINKS_FLOAT_FIRST_DESC"
|
default="none"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="right">COM_WEBLINKS_RIGHT</option>
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
<option value="left">COM_WEBLINKS_LEFT</option>
|
<option value="left">COM_WEBLINKS_LEFT</option>
|
||||||
|
@ -112,7 +108,8 @@
|
||||||
name="float_second"
|
name="float_second"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
|
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
|
||||||
description="COM_WEBLINKS_FLOAT_SECOND_DESC"
|
default="none"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="right">COM_WEBLINKS_RIGHT</option>
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
<option value="left">COM_WEBLINKS_LEFT</option>
|
<option value="left">COM_WEBLINKS_LEFT</option>
|
||||||
|
@ -124,18 +121,15 @@
|
||||||
type="spacer"
|
type="spacer"
|
||||||
hr="true"
|
hr="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
id="show_tags"
|
|
||||||
name="show_tags"
|
name="show_tags"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL"
|
label="COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_SHOW_TAGS_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -148,7 +142,7 @@
|
||||||
name="category_layout"
|
name="category_layout"
|
||||||
type="componentlayout"
|
type="componentlayout"
|
||||||
label="JGLOBAL_FIELD_LAYOUT_LABEL"
|
label="JGLOBAL_FIELD_LAYOUT_LABEL"
|
||||||
description="JGLOBAL_FIELD_LAYOUT_DESC"
|
class="form-select"
|
||||||
menuitems="true"
|
menuitems="true"
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
view="category"
|
view="category"
|
||||||
|
@ -157,45 +151,42 @@
|
||||||
<field
|
<field
|
||||||
name="show_category_title"
|
name="show_category_title"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_description"
|
name="show_description"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_description_image"
|
name="show_description_image"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="0"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="maxLevel"
|
name="maxLevel"
|
||||||
type="list"
|
type="list"
|
||||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
|
||||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||||
default="-1"
|
default="-1"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="0">JNONE</option>
|
<option value="0">JNONE</option>
|
||||||
<option value="-1">JALL</option>
|
<option value="-1">JALL</option>
|
||||||
|
@ -209,49 +200,45 @@
|
||||||
<field
|
<field
|
||||||
name="show_empty_categories"
|
name="show_empty_categories"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||||
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="0"
|
default="0"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_subcat_desc"
|
name="show_subcat_desc"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
|
||||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||||
|
default="1"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_cat_num_links"
|
name="show_cat_num_links"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
|
|
||||||
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_cat_tags"
|
name="show_cat_tags"
|
||||||
type="radio"
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
label="COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL"
|
label="COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_DESC"
|
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -263,23 +250,22 @@
|
||||||
<field
|
<field
|
||||||
name="show_base_description"
|
name="show_base_description"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
|
label="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_LABEL"
|
||||||
description="JGLOBAL_FIELD_SHOW_BASE_DESCRIPTION_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="maxLevelcat"
|
name="maxLevelcat"
|
||||||
type="list"
|
type="list"
|
||||||
default="-1"
|
|
||||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
|
||||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||||
|
default="-1"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
|
<option value="0">JNONE</option>
|
||||||
<option value="-1">JALL</option>
|
<option value="-1">JALL</option>
|
||||||
<option value="1">J1</option>
|
<option value="1">J1</option>
|
||||||
<option value="2">J2</option>
|
<option value="2">J2</option>
|
||||||
|
@ -291,37 +277,36 @@
|
||||||
<field
|
<field
|
||||||
name="show_empty_categories_cat"
|
name="show_empty_categories_cat"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="0"
|
|
||||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||||
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="0"
|
||||||
|
showon="maxLevelcat:-1,1,2,3,4,5"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_subcat_desc_cat"
|
name="show_subcat_desc_cat"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
|
||||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
|
showon="maxLevelcat:-1,1,2,3,4,5"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_cat_num_links_cat"
|
name="show_cat_num_articles_cat"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
|
|
||||||
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -333,9 +318,8 @@
|
||||||
<field
|
<field
|
||||||
name="filter_field"
|
name="filter_field"
|
||||||
type="list"
|
type="list"
|
||||||
default="1"
|
|
||||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
|
||||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
<option value="hide">JHIDE</option>
|
<option value="hide">JHIDE</option>
|
||||||
|
@ -344,10 +328,9 @@
|
||||||
<field
|
<field
|
||||||
name="show_pagination_limit"
|
name="show_pagination_limit"
|
||||||
type="radio"
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
@ -356,37 +339,34 @@
|
||||||
<field
|
<field
|
||||||
name="show_headings"
|
name="show_headings"
|
||||||
type="radio"
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
|
||||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_link_description"
|
name="show_link_description"
|
||||||
type="radio"
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
|
|
||||||
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
|
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_link_hits"
|
name="show_link_hits"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
|
|
||||||
label="JGLOBAL_HITS"
|
label="JGLOBAL_HITS"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
|
@ -394,7 +374,6 @@
|
||||||
type="list"
|
type="list"
|
||||||
default="2"
|
default="2"
|
||||||
label="JGLOBAL_PAGINATION_LABEL"
|
label="JGLOBAL_PAGINATION_LABEL"
|
||||||
description="JGLOBAL_PAGINATION_DESC"
|
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
@ -404,13 +383,12 @@
|
||||||
<field
|
<field
|
||||||
name="show_pagination_results"
|
name="show_pagination_results"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="1"
|
default="1"
|
||||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||||
description="JGLOBAL_PAGINATION_RESULTS_DESC"
|
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -422,25 +400,23 @@
|
||||||
<field
|
<field
|
||||||
name="show_feed_link"
|
name="show_feed_link"
|
||||||
type="radio"
|
type="radio"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
default="1"
|
|
||||||
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
||||||
description="JGLOBAL_SHOW_FEED_LINK_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
default="1"
|
||||||
>
|
>
|
||||||
<option value="1">JSHOW</option>
|
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="custom_fields_enable"
|
name="custom_fields_enable"
|
||||||
type="radio"
|
type="radio"
|
||||||
label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL"
|
label="JGLOBAL_CUSTOM_FIELDS_ENABLE_LABEL"
|
||||||
description="JGLOBAL_CUSTOM_FIELDS_ENABLE_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
default="0"
|
default="0"
|
||||||
class="btn-group btn-group-yesno"
|
|
||||||
>
|
>
|
||||||
<option value="1">JYES</option>
|
|
||||||
<option value="0">JNO</option>
|
<option value="0">JNO</option>
|
||||||
|
<option value="1">JYES</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
name="published"
|
name="published"
|
||||||
type="status"
|
type="status"
|
||||||
label="JOPTION_FILTER_PUBLISHED"
|
label="JOPTION_FILTER_PUBLISHED"
|
||||||
description="JOPTION_FILTER_PUBLISHED_DESC"
|
|
||||||
onchange="this.form.submit();"
|
onchange="this.form.submit();"
|
||||||
>
|
>
|
||||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||||
|
@ -21,7 +20,6 @@
|
||||||
name="category_id"
|
name="category_id"
|
||||||
type="category"
|
type="category"
|
||||||
label="JOPTION_FILTER_CATEGORY"
|
label="JOPTION_FILTER_CATEGORY"
|
||||||
description="JOPTION_FILTER_CATEGORY_DESC"
|
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
onchange="this.form.submit();"
|
onchange="this.form.submit();"
|
||||||
>
|
>
|
||||||
|
@ -31,7 +29,6 @@
|
||||||
name="access"
|
name="access"
|
||||||
type="accesslevel"
|
type="accesslevel"
|
||||||
label="JOPTION_FILTER_ACCESS"
|
label="JOPTION_FILTER_ACCESS"
|
||||||
description="JOPTION_FILTER_ACCESS_DESC"
|
|
||||||
onchange="this.form.submit();"
|
onchange="this.form.submit();"
|
||||||
>
|
>
|
||||||
<option value="">JOPTION_SELECT_ACCESS</option>
|
<option value="">JOPTION_SELECT_ACCESS</option>
|
||||||
|
@ -40,7 +37,6 @@
|
||||||
name="language"
|
name="language"
|
||||||
type="contentlanguage"
|
type="contentlanguage"
|
||||||
label="JOPTION_FILTER_LANGUAGE"
|
label="JOPTION_FILTER_LANGUAGE"
|
||||||
description="JOPTION_FILTER_LANGUAGE_DESC"
|
|
||||||
onchange="this.form.submit();"
|
onchange="this.form.submit();"
|
||||||
>
|
>
|
||||||
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||||
|
@ -50,7 +46,6 @@
|
||||||
name="tag"
|
name="tag"
|
||||||
type="tag"
|
type="tag"
|
||||||
label="JOPTION_FILTER_TAG"
|
label="JOPTION_FILTER_TAG"
|
||||||
description="JOPTION_FILTER_TAG_DESC"
|
|
||||||
mode="nested"
|
mode="nested"
|
||||||
onchange="this.form.submit();"
|
onchange="this.form.submit();"
|
||||||
>
|
>
|
||||||
|
@ -60,7 +55,6 @@
|
||||||
name="level"
|
name="level"
|
||||||
type="integer"
|
type="integer"
|
||||||
label="JOPTION_FILTER_LEVEL"
|
label="JOPTION_FILTER_LEVEL"
|
||||||
description="JOPTION_FILTER_LEVEL_DESC"
|
|
||||||
first="1"
|
first="1"
|
||||||
last="10"
|
last="10"
|
||||||
step="1"
|
step="1"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
name="id"
|
name="id"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_FIELD_ID_LABEL"
|
label="JGLOBAL_FIELD_ID_LABEL"
|
||||||
description="JGLOBAL_FIELD_ID_DESC"
|
|
||||||
readonly="true"
|
readonly="true"
|
||||||
class="readonly"
|
class="readonly"
|
||||||
default="0"
|
default="0"
|
||||||
|
@ -17,18 +16,15 @@
|
||||||
name="title"
|
name="title"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_TITLE"
|
label="JGLOBAL_TITLE"
|
||||||
description="COM_WEBLINKS_FIELD_TITLE_DESC"
|
|
||||||
class="input-xxlarge input-large-text"
|
|
||||||
size="40"
|
|
||||||
required="true"
|
required="true"
|
||||||
|
maxlength="250"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="alias"
|
name="alias"
|
||||||
type="text"
|
type="text"
|
||||||
label="JFIELD_ALIAS_LABEL"
|
label="JFIELD_ALIAS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_ALIAS_DESC"
|
description="JFIELD_ALIAS_DESC"
|
||||||
size="40"
|
|
||||||
hint="JFIELD_ALIAS_PLACEHOLDER"
|
hint="JFIELD_ALIAS_PLACEHOLDER"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -36,7 +32,6 @@
|
||||||
name="catid"
|
name="catid"
|
||||||
type="categoryedit"
|
type="categoryedit"
|
||||||
label="JCATEGORY"
|
label="JCATEGORY"
|
||||||
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
|
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
|
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
|
||||||
required="true"
|
required="true"
|
||||||
|
@ -47,10 +42,8 @@
|
||||||
name="url"
|
name="url"
|
||||||
type="url"
|
type="url"
|
||||||
label="COM_WEBLINKS_FIELD_URL_LABEL"
|
label="COM_WEBLINKS_FIELD_URL_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_URL_DESC"
|
|
||||||
class="span12"
|
|
||||||
filter="url"
|
filter="url"
|
||||||
size="40"
|
validate="url"
|
||||||
required="true"
|
required="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -58,7 +51,6 @@
|
||||||
name="description"
|
name="description"
|
||||||
type="editor"
|
type="editor"
|
||||||
label="JGLOBAL_DESCRIPTION"
|
label="JGLOBAL_DESCRIPTION"
|
||||||
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
|
|
||||||
buttons="true"
|
buttons="true"
|
||||||
hide="pagebreak,readmore"
|
hide="pagebreak,readmore"
|
||||||
filter="JComponentHelper::filterText"
|
filter="JComponentHelper::filterText"
|
||||||
|
@ -68,21 +60,19 @@
|
||||||
name="hits"
|
name="hits"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_HITS"
|
label="JGLOBAL_HITS"
|
||||||
description="COM_WEBLINKS_HITS_DESC"
|
|
||||||
class="readonly"
|
class="readonly"
|
||||||
size="6"
|
|
||||||
readonly="true"
|
readonly="true"
|
||||||
filter="unset"
|
filter="unset"
|
||||||
|
default="0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="state"
|
name="state"
|
||||||
type="list"
|
type="list"
|
||||||
label="JSTATUS"
|
label="JSTATUS"
|
||||||
description="COM_WEBLINKS_FIELD_STATE_DESC"
|
class="form-select-color-state"
|
||||||
class="chzn-color-state"
|
|
||||||
size="1"
|
|
||||||
default="1"
|
default="1"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="1">JPUBLISHED</option>
|
<option value="1">JPUBLISHED</option>
|
||||||
<option value="0">JUNPUBLISHED</option>
|
<option value="0">JUNPUBLISHED</option>
|
||||||
|
@ -95,7 +85,6 @@
|
||||||
name="ordering"
|
name="ordering"
|
||||||
type="ordering"
|
type="ordering"
|
||||||
label="JFIELD_ORDERING_LABEL"
|
label="JFIELD_ORDERING_LABEL"
|
||||||
description="JFIELD_ORDERING_DESC"
|
|
||||||
content_type="com_weblinks.weblink"
|
content_type="com_weblinks.weblink"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -103,15 +92,14 @@
|
||||||
name="access"
|
name="access"
|
||||||
type="accesslevel"
|
type="accesslevel"
|
||||||
label="JFIELD_ACCESS_LABEL"
|
label="JFIELD_ACCESS_LABEL"
|
||||||
description="JFIELD_ACCESS_DESC"
|
filter="UINT"
|
||||||
size="1"
|
validate="options"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="language"
|
name="language"
|
||||||
type="contentlanguage"
|
type="contentlanguage"
|
||||||
label="JFIELD_LANGUAGE_LABEL"
|
label="JFIELD_LANGUAGE_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_LANGUAGE_DESC"
|
|
||||||
>
|
>
|
||||||
<option value="*">JALL</option>
|
<option value="*">JALL</option>
|
||||||
</field>
|
</field>
|
||||||
|
@ -120,7 +108,7 @@
|
||||||
name="tags"
|
name="tags"
|
||||||
type="tag"
|
type="tag"
|
||||||
label="JTAG"
|
label="JTAG"
|
||||||
description="JTAG_DESC"
|
class="advancedSelect"
|
||||||
multiple="true"
|
multiple="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -128,18 +116,15 @@
|
||||||
name="version_note"
|
name="version_note"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
|
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
|
||||||
description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
|
maxlength="250"
|
||||||
size="45"
|
|
||||||
labelclass="control-label"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="created"
|
name="created"
|
||||||
type="calendar"
|
type="calendar"
|
||||||
label="JGLOBAL_FIELD_CREATED_LABEL"
|
label="JGLOBAL_FIELD_CREATED_LABEL"
|
||||||
description="JGLOBAL_FIELD_CREATED_DESC"
|
translateformat="true"
|
||||||
size="22"
|
showtime="true"
|
||||||
format="%Y-%m-%d %H:%M:%S"
|
|
||||||
filter="user_utc"
|
filter="user_utc"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -147,26 +132,23 @@
|
||||||
name="created_by"
|
name="created_by"
|
||||||
type="user"
|
type="user"
|
||||||
label="JGLOBAL_FIELD_CREATED_BY_LABEL"
|
label="JGLOBAL_FIELD_CREATED_BY_LABEL"
|
||||||
description="JGLOBAL_FIELD_CREATED_BY_Desc"
|
validate="UserId"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="created_by_alias"
|
name="created_by_alias"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL"
|
label="JGLOBAL_FIELD_CREATED_BY_ALIAS_LABEL"
|
||||||
description="JGLOBAL_FIELD_CREATED_BY_ALIAS_DESC"
|
|
||||||
size="20"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="modified"
|
name="modified"
|
||||||
type="calendar"
|
type="calendar"
|
||||||
label="JGLOBAL_FIELD_MODIFIED_LABEL"
|
label="JGLOBAL_FIELD_MODIFIED_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_MODIFIED_DESC"
|
|
||||||
class="readonly"
|
class="readonly"
|
||||||
size="22"
|
|
||||||
readonly="true"
|
readonly="true"
|
||||||
format="%Y-%m-%d %H:%M:%S"
|
translateformat="true"
|
||||||
|
showtime="true"
|
||||||
filter="user_utc"
|
filter="user_utc"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -177,6 +159,7 @@
|
||||||
class="readonly"
|
class="readonly"
|
||||||
readonly="true"
|
readonly="true"
|
||||||
filter="unset"
|
filter="unset"
|
||||||
|
validate="UserId"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
|
@ -195,9 +178,8 @@
|
||||||
name="publish_up"
|
name="publish_up"
|
||||||
type="calendar"
|
type="calendar"
|
||||||
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
|
label="JGLOBAL_FIELD_PUBLISH_UP_LABEL"
|
||||||
description="JGLOBAL_FIELD_PUBLISH_UP_DESC"
|
translateformat="true"
|
||||||
format="%Y-%m-%d %H:%M:%S"
|
showtime="true"
|
||||||
size="22"
|
|
||||||
filter="user_utc"
|
filter="user_utc"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -205,9 +187,8 @@
|
||||||
name="publish_down"
|
name="publish_down"
|
||||||
type="calendar"
|
type="calendar"
|
||||||
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
|
label="JGLOBAL_FIELD_PUBLISH_DOWN_LABEL"
|
||||||
description="JGLOBAL_FIELD_PUBLISH_DOWN_DESC"
|
translateformat="true"
|
||||||
format="%Y-%m-%d %H:%M:%S"
|
showtime="true"
|
||||||
size="22"
|
|
||||||
filter="user_utc"
|
filter="user_utc"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -215,9 +196,7 @@
|
||||||
name="version"
|
name="version"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_VERSION_LABEL"
|
label="COM_WEBLINKS_FIELD_VERSION_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_VERSION_DESC"
|
|
||||||
class="readonly"
|
class="readonly"
|
||||||
size="6"
|
|
||||||
readonly="true"
|
readonly="true"
|
||||||
filter="unset"
|
filter="unset"
|
||||||
/>
|
/>
|
||||||
|
@ -226,7 +205,6 @@
|
||||||
name="metakey"
|
name="metakey"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
label="JFIELD_META_KEYWORDS_LABEL"
|
label="JFIELD_META_KEYWORDS_LABEL"
|
||||||
description="JFIELD_META_KEYWORDS_DESC"
|
|
||||||
rows="3"
|
rows="3"
|
||||||
cols="30"
|
cols="30"
|
||||||
/>
|
/>
|
||||||
|
@ -235,17 +213,16 @@
|
||||||
name="metadesc"
|
name="metadesc"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
label="JFIELD_META_DESCRIPTION_LABEL"
|
label="JFIELD_META_DESCRIPTION_LABEL"
|
||||||
description="JFIELD_META_DESCRIPTION_DESC"
|
|
||||||
rows="3"
|
rows="3"
|
||||||
cols="30"
|
cols="30"
|
||||||
|
maxlength="160"
|
||||||
|
charcounter="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="xreference"
|
name="xreference"
|
||||||
type="text"
|
type="text"
|
||||||
label="JFIELD_XREFERENCE_LABEL"
|
label="JFIELD_XREFERENCE_LABEL"
|
||||||
description="JFIELD_XREFERENCE_DESC"
|
|
||||||
size="20"
|
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
@ -261,7 +238,6 @@
|
||||||
name="target"
|
name="target"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FIELD_TARGET_LABEL"
|
label="COM_WEBLINKS_FIELD_TARGET_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_TARGET_DESC"
|
|
||||||
default=""
|
default=""
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
>
|
>
|
||||||
|
@ -275,7 +251,6 @@
|
||||||
name="width"
|
name="width"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_WIDTH_LABEL"
|
label="COM_WEBLINKS_FIELD_WIDTH_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_WIDTH_DESC"
|
|
||||||
class="validate-numeric"
|
class="validate-numeric"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -283,17 +258,14 @@
|
||||||
name="height"
|
name="height"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_HEIGHT_LABEL"
|
label="COM_WEBLINKS_FIELD_HEIGHT_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_HEIGHT_DESC"
|
|
||||||
class="validate-numeric"
|
class="validate-numeric"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="count_clicks"
|
name="count_clicks"
|
||||||
type="list"
|
type="radio"
|
||||||
label="COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
label="COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_COUNTCLICKS_DESC"
|
layout="joomla.form.field.radio.switcher"
|
||||||
class="chzn-color"
|
|
||||||
useglobal="true"
|
|
||||||
>
|
>
|
||||||
<option value="0">JNO</option>
|
<option value="0">JNO</option>
|
||||||
<option value="1">JYES</option>
|
<option value="1">JYES</option>
|
||||||
|
@ -312,14 +284,12 @@
|
||||||
name="image_first"
|
name="image_first"
|
||||||
type="media"
|
type="media"
|
||||||
label="COM_WEBLINKS_FIELD_FIRST_LABEL"
|
label="COM_WEBLINKS_FIELD_FIRST_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_FIRST_DESC"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="float_first"
|
name="float_first"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
|
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
|
||||||
description="COM_WEBLINKS_FLOAT_FIRST_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
>
|
>
|
||||||
<option value="right">COM_WEBLINKS_RIGHT</option>
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
|
@ -331,16 +301,19 @@
|
||||||
name="image_first_alt"
|
name="image_first_alt"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC"
|
/>
|
||||||
size="20"
|
|
||||||
|
<field
|
||||||
|
name="image_first_alt_empty"
|
||||||
|
type="checkbox"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL"
|
||||||
|
description="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="image_first_caption"
|
name="image_first_caption"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC"
|
|
||||||
size="20"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
|
@ -353,16 +326,14 @@
|
||||||
name="image_second"
|
name="image_second"
|
||||||
type="media"
|
type="media"
|
||||||
label="COM_WEBLINKS_FIELD_SECOND_LABEL"
|
label="COM_WEBLINKS_FIELD_SECOND_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_SECOND_DESC"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="float_second"
|
name="float_second"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
|
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
|
||||||
description="COM_WEBLINKS_FLOAT_SECOND_DESC"
|
useglobal="true"
|
||||||
>
|
>
|
||||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
|
||||||
<option value="right">COM_WEBLINKS_RIGHT</option>
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
<option value="left">COM_WEBLINKS_LEFT</option>
|
<option value="left">COM_WEBLINKS_LEFT</option>
|
||||||
<option value="none">COM_WEBLINKS_NONE</option>
|
<option value="none">COM_WEBLINKS_NONE</option>
|
||||||
|
@ -372,16 +343,19 @@
|
||||||
name="image_second_alt"
|
name="image_second_alt"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_IMAGE_ALT_DESC"
|
/>
|
||||||
size="20"
|
|
||||||
|
<field
|
||||||
|
name="image_second_alt_empty"
|
||||||
|
type="checkbox"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL"
|
||||||
|
description="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="image_second_caption"
|
name="image_second_caption"
|
||||||
type="text"
|
type="text"
|
||||||
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC"
|
|
||||||
size="20"
|
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
||||||
|
@ -398,7 +372,7 @@
|
||||||
name="robots"
|
name="robots"
|
||||||
type="list"
|
type="list"
|
||||||
label="JFIELD_METADATA_ROBOTS_LABEL"
|
label="JFIELD_METADATA_ROBOTS_LABEL"
|
||||||
description="JFIELD_METADATA_ROBOTS_DESC"
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||||
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
||||||
|
@ -411,11 +385,6 @@
|
||||||
name="rights"
|
name="rights"
|
||||||
type="text"
|
type="text"
|
||||||
label="JFIELD_META_RIGHTS_LABEL"
|
label="JFIELD_META_RIGHTS_LABEL"
|
||||||
description="JFIELD_META_RIGHTS_DESC"
|
|
||||||
required="false"
|
|
||||||
filter="string"
|
|
||||||
cols="30"
|
|
||||||
rows="2"
|
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
<?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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,153 +14,7 @@ defined('_JEXEC') or die;
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
class WeblinksHelper extends JHelperContent
|
class WeblinksHelper extends \Joomla\Component\Weblinks\Administrator\Helper\WeblinksHelper
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Configure the Linkbar.
|
|
||||||
*
|
|
||||||
* @param string $vName The name of the active view.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.6
|
|
||||||
*/
|
|
||||||
public static function addSubmenu($vName = 'weblinks')
|
|
||||||
{
|
|
||||||
JHtmlSidebar::addEntry(
|
|
||||||
JText::_('COM_WEBLINKS_SUBMENU_WEBLINKS'),
|
|
||||||
'index.php?option=com_weblinks&view=weblinks',
|
|
||||||
$vName == 'weblinks'
|
|
||||||
);
|
|
||||||
|
|
||||||
JHtmlSidebar::addEntry(
|
|
||||||
JText::_('COM_WEBLINKS_SUBMENU_CATEGORIES'),
|
|
||||||
'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'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds Count Items for WebLinks Category Manager.
|
|
||||||
*
|
|
||||||
* @param stdClass[] &$items The weblinks category objects.
|
|
||||||
*
|
|
||||||
* @return stdClass[] The weblinks category objects.
|
|
||||||
*
|
|
||||||
* @since 3.6.0
|
|
||||||
*/
|
|
||||||
public static function countItems(&$items)
|
|
||||||
{
|
|
||||||
$db = JFactory::getDbo();
|
|
||||||
|
|
||||||
foreach ($items as $item)
|
|
||||||
{
|
|
||||||
$item->count_trashed = 0;
|
|
||||||
$item->count_archived = 0;
|
|
||||||
$item->count_unpublished = 0;
|
|
||||||
$item->count_published = 0;
|
|
||||||
|
|
||||||
$query = $db->getQuery(true)
|
|
||||||
->select('state, COUNT(*) AS count')
|
|
||||||
->from($db->qn('#__weblinks'))
|
|
||||||
->where($db->qn('catid') . ' = ' . (int) $item->id)
|
|
||||||
->group('state');
|
|
||||||
|
|
||||||
$db->setQuery($query);
|
|
||||||
$weblinks = $db->loadObjectList();
|
|
||||||
|
|
||||||
foreach ($weblinks as $weblink)
|
|
||||||
{
|
|
||||||
if ($weblink->state == 1)
|
|
||||||
{
|
|
||||||
$item->count_published = $weblink->count;
|
|
||||||
}
|
|
||||||
elseif ($weblink->state == 0)
|
|
||||||
{
|
|
||||||
$item->count_unpublished = $weblink->count;
|
|
||||||
}
|
|
||||||
elseif ($weblink->state == 2)
|
|
||||||
{
|
|
||||||
$item->count_archived = $weblink->count;
|
|
||||||
}
|
|
||||||
elseif ($weblink->state == -2)
|
|
||||||
{
|
|
||||||
$item->count_trashed = $weblink->count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $items;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds Count Items for Tag Manager.
|
|
||||||
*
|
|
||||||
* @param stdClass[] &$items The weblink tag objects
|
|
||||||
* @param string $extension The name of the active view.
|
|
||||||
*
|
|
||||||
* @return stdClass[]
|
|
||||||
*
|
|
||||||
* @since 3.7.0
|
|
||||||
*/
|
|
||||||
public static function countTagItems(&$items, $extension)
|
|
||||||
{
|
|
||||||
$db = JFactory::getDbo();
|
|
||||||
|
|
||||||
foreach ($items as $item)
|
|
||||||
{
|
|
||||||
$item->count_trashed = 0;
|
|
||||||
$item->count_archived = 0;
|
|
||||||
$item->count_unpublished = 0;
|
|
||||||
$item->count_published = 0;
|
|
||||||
|
|
||||||
$query = $db->getQuery(true);
|
|
||||||
$query->select('published as state, count(*) AS count')
|
|
||||||
->from($db->qn('#__contentitem_tag_map') . 'AS ct ')
|
|
||||||
->where('ct.tag_id = ' . (int) $item->id)
|
|
||||||
->where('ct.type_alias =' . $db->q($extension))
|
|
||||||
->join('LEFT', $db->qn('#__categories') . ' AS c ON ct.content_item_id=c.id')
|
|
||||||
->group('state');
|
|
||||||
|
|
||||||
$db->setQuery($query);
|
|
||||||
$weblinks = $db->loadObjectList();
|
|
||||||
|
|
||||||
foreach ($weblinks as $weblink)
|
|
||||||
{
|
|
||||||
if ($weblink->state == 1)
|
|
||||||
{
|
|
||||||
$item->count_published = $weblink->count;
|
|
||||||
}
|
|
||||||
if ($weblink->state == 0)
|
|
||||||
{
|
|
||||||
$item->count_unpublished = $weblink->count;
|
|
||||||
}
|
|
||||||
if ($weblink->state == 2)
|
|
||||||
{
|
|
||||||
$item->count_archived = $weblink->count;
|
|
||||||
}
|
|
||||||
if ($weblink->state == -2)
|
|
||||||
{
|
|
||||||
$item->count_trashed = $weblink->count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $items;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,13 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Filesystem\File;
|
||||||
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
|
use Joomla\CMS\Installer\InstallerAdapter;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installation class to perform additional changes during install/uninstall/update
|
* Installation class to perform additional changes during install/uninstall/update
|
||||||
*
|
*
|
||||||
|
@ -16,6 +23,57 @@ defined('_JEXEC') or die;
|
||||||
*/
|
*/
|
||||||
class Com_WeblinksInstallerScript
|
class Com_WeblinksInstallerScript
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Function called before extension installation/update/removal procedure commences
|
||||||
|
*
|
||||||
|
* @param string $type The type of change (install, update or discover_install, not uninstall)
|
||||||
|
* @param InstallerAdapter $parent The class calling this method
|
||||||
|
*
|
||||||
|
* @return boolean True on success
|
||||||
|
*
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public function preflight($type, $parent)
|
||||||
|
{
|
||||||
|
$files = [
|
||||||
|
'/administrator/components/com_weblinks/helpers/associations.php',
|
||||||
|
'/administrator/components/com_weblinks/sql/install.sqlsrv.sql',
|
||||||
|
'/administrator/components/com_weblinks/sql/uninstall.sqlsrv.sql',
|
||||||
|
'/administrator/language/en-GB/en-GB.com_weblinks.ini',
|
||||||
|
'/administrator/language/en-GB/en-GB.com_weblinks.sys.ini',
|
||||||
|
'/components/com_weblinks/helpers/association.php',
|
||||||
|
'/components/com_weblinks/helpers/category.php',
|
||||||
|
'/language/en-GB/en-GB.com_weblinks.ini',
|
||||||
|
'/language/en-GB/en-GB.mod_weblinks.ini',
|
||||||
|
'/language/en-GB/en-GB.mod_weblinks.sys.ini',
|
||||||
|
'/language/en-GB/en-GB.pkg_weblinks.sys.ini',
|
||||||
|
'/modules/mod_weblinks/helper.php',
|
||||||
|
];
|
||||||
|
|
||||||
|
$folders = [
|
||||||
|
'/administrator/components/com_weblinks/helpers/html',
|
||||||
|
'/administrator/components/com_weblinks/sql/updates/sqlsrv',
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($files as $file)
|
||||||
|
{
|
||||||
|
if (File::exists(JPATH_ROOT . $file))
|
||||||
|
{
|
||||||
|
File::delete(JPATH_ROOT . $file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($folders as $folder)
|
||||||
|
{
|
||||||
|
if (Folder::exists(JPATH_ROOT . $folder))
|
||||||
|
{
|
||||||
|
Folder::delete(JPATH_ROOT . $folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to perform changes during install
|
* Function to perform changes during install
|
||||||
*
|
*
|
||||||
|
@ -28,27 +86,27 @@ class Com_WeblinksInstallerScript
|
||||||
public function install($parent)
|
public function install($parent)
|
||||||
{
|
{
|
||||||
// Initialize a new category
|
// Initialize a new category
|
||||||
/** @type JTableCategory $category */
|
/** @type Joomla\CMS\Table\Category $category */
|
||||||
$category = JTable::getInstance('Category');
|
$category = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
|
|
||||||
// Check if the Uncategorised category exists before adding it
|
// Check if the Uncategorised category exists before adding it
|
||||||
if (!$category->load(array('extension' => 'com_weblinks', 'title' => 'Uncategorised')))
|
if (!$category->load(array('extension' => 'com_weblinks', 'title' => 'Uncategorised')))
|
||||||
{
|
{
|
||||||
$category->extension = 'com_weblinks';
|
$category->extension = 'com_weblinks';
|
||||||
$category->title = 'Uncategorised';
|
$category->title = 'Uncategorised';
|
||||||
$category->description = '';
|
$category->description = '';
|
||||||
$category->published = 1;
|
$category->published = 1;
|
||||||
$category->access = 1;
|
$category->access = 1;
|
||||||
$category->params = '{"category_layout":"","image":""}';
|
$category->params = '{"category_layout":"","image":""}';
|
||||||
$category->metadata = '{"author":"","robots":""}';
|
$category->metadata = '{"author":"","robots":""}';
|
||||||
$category->metadesc = '';
|
$category->metadesc = '';
|
||||||
$category->metakey = '';
|
$category->metakey = '';
|
||||||
$category->language = '*';
|
$category->language = '*';
|
||||||
$category->checked_out_time = JFactory::getDbo()->getNullDate();
|
$category->checked_out_time = null;
|
||||||
$category->version = 1;
|
$category->version = 1;
|
||||||
$category->hits = 0;
|
$category->hits = 0;
|
||||||
$category->modified_user_id = 0;
|
$category->modified_user_id = 0;
|
||||||
$category->checked_out = 0;
|
$category->checked_out = null;
|
||||||
|
|
||||||
// Set the location in the tree
|
// Set the location in the tree
|
||||||
$category->setLocation(1, 'last-child');
|
$category->setLocation(1, 'last-child');
|
||||||
|
@ -56,7 +114,7 @@ class Com_WeblinksInstallerScript
|
||||||
// Check to make sure our data is valid
|
// Check to make sure our data is valid
|
||||||
if (!$category->check())
|
if (!$category->check())
|
||||||
{
|
{
|
||||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_WEBLINKS_ERROR_INSTALL_CATEGORY', $category->getError()));
|
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_WEBLINKS_ERROR_INSTALL_CATEGORY', $category->getError()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +122,7 @@ class Com_WeblinksInstallerScript
|
||||||
// Now store the category
|
// Now store the category
|
||||||
if (!$category->store(true))
|
if (!$category->store(true))
|
||||||
{
|
{
|
||||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_WEBLINKS_ERROR_INSTALL_CATEGORY', $category->getError()));
|
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_WEBLINKS_ERROR_INSTALL_CATEGORY', $category->getError()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,14 +145,14 @@ class Com_WeblinksInstallerScript
|
||||||
public function postflight($type, $parent)
|
public function postflight($type, $parent)
|
||||||
{
|
{
|
||||||
// Only execute database changes on MySQL databases
|
// Only execute database changes on MySQL databases
|
||||||
$dbName = JFactory::getDbo()->name;
|
$dbName = Factory::getDbo()->name;
|
||||||
|
|
||||||
if (strpos($dbName, 'mysql') !== false)
|
if (strpos($dbName, 'mysql') !== false)
|
||||||
{
|
{
|
||||||
// Add Missing Table Colums if needed
|
// Add Missing Table Columns if needed
|
||||||
$this->addColumnsIfNeeded();
|
$this->addColumnsIfNeeded();
|
||||||
|
|
||||||
// Drop the Table Colums if needed
|
// Drop the Table Columns if needed
|
||||||
$this->dropColumnsIfNeeded();
|
$this->dropColumnsIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +170,7 @@ class Com_WeblinksInstallerScript
|
||||||
private function insertMissingUcmRecords()
|
private function insertMissingUcmRecords()
|
||||||
{
|
{
|
||||||
// Insert the rows in the #__content_types table if they don't exist already
|
// Insert the rows in the #__content_types table if they don't exist already
|
||||||
$db = JFactory::getDbo();
|
$db = Factory::getDbo();
|
||||||
|
|
||||||
// Get the type ID for a Weblink
|
// Get the type ID for a Weblink
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
|
@ -153,7 +211,8 @@ class Com_WeblinksInstallerScript
|
||||||
. $db->quote('com_weblinks.weblink') . ', '
|
. $db->quote('com_weblinks.weblink') . ', '
|
||||||
. $db->quote(
|
. $db->quote(
|
||||||
'{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},
|
'{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},
|
||||||
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'
|
||||||
|
) . ', '
|
||||||
. $db->quote('') . ', '
|
. $db->quote('') . ', '
|
||||||
. $db->quote(
|
. $db->quote(
|
||||||
'{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias",
|
'{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias",
|
||||||
|
@ -161,7 +220,8 @@ class Com_WeblinksInstallerScript
|
||||||
"core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_params":"params",
|
"core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_params":"params",
|
||||||
"core_featured":"featured", "core_metadata":"metadata", "core_language":"language", "core_images":"images", "core_urls":"url",
|
"core_featured":"featured", "core_metadata":"metadata", "core_language":"language", "core_images":"images", "core_urls":"url",
|
||||||
"core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc",
|
"core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc",
|
||||||
"core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}') . ', '
|
"core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}'
|
||||||
|
) . ', '
|
||||||
. $db->quote('WeblinksHelperRoute::getWeblinkRoute') . ', '
|
. $db->quote('WeblinksHelperRoute::getWeblinkRoute') . ', '
|
||||||
. $db->quote(
|
. $db->quote(
|
||||||
'{"formFile":"administrator\\/components\\/com_weblinks\\/models\\/forms\\/weblink.xml",
|
'{"formFile":"administrator\\/components\\/com_weblinks\\/models\\/forms\\/weblink.xml",
|
||||||
|
@ -170,7 +230,8 @@ class Com_WeblinksInstallerScript
|
||||||
"ordering"], "displayLookup":[{"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"},
|
"ordering"], "displayLookup":[{"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"},
|
||||||
{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},
|
{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},
|
||||||
{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},
|
{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},
|
||||||
{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}')
|
{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->setQuery($query);
|
$db->setQuery($query);
|
||||||
|
@ -189,7 +250,8 @@ class Com_WeblinksInstallerScript
|
||||||
. $db->quote('com_weblinks.category') . ', '
|
. $db->quote('com_weblinks.category') . ', '
|
||||||
. $db->quote('
|
. $db->quote('
|
||||||
{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},
|
{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},
|
||||||
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'
|
||||||
|
) . ', '
|
||||||
. $db->quote('') . ', '
|
. $db->quote('') . ', '
|
||||||
. $db->quote('
|
. $db->quote('
|
||||||
{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias",
|
{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias",
|
||||||
|
@ -198,7 +260,8 @@ class Com_WeblinksInstallerScript
|
||||||
"core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language",
|
"core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language",
|
||||||
"core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey",
|
"core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey",
|
||||||
"core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"},
|
"core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"},
|
||||||
"special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}') . ', '
|
"special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}'
|
||||||
|
) . ', '
|
||||||
. $db->quote('WeblinksHelperRoute::getCategoryRoute') . ', '
|
. $db->quote('WeblinksHelperRoute::getCategoryRoute') . ', '
|
||||||
. $db->quote('
|
. $db->quote('
|
||||||
{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml",
|
{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml",
|
||||||
|
@ -209,7 +272,8 @@ class Com_WeblinksInstallerScript
|
||||||
"displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id",
|
"displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id",
|
||||||
"displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id",
|
"displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id",
|
||||||
"displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id",
|
"displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id",
|
||||||
"displayColumn":"title"}]}')
|
"displayColumn":"title"}]}'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$db->setQuery($query);
|
$db->setQuery($query);
|
||||||
|
@ -233,7 +297,7 @@ class Com_WeblinksInstallerScript
|
||||||
'approved',
|
'approved',
|
||||||
);
|
);
|
||||||
|
|
||||||
$db = JFactory::getDbo();
|
$db = Factory::getDbo();
|
||||||
$table = $db->getTableColumns('#__weblinks');
|
$table = $db->getTableColumns('#__weblinks');
|
||||||
|
|
||||||
$columns = array_intersect($oldColumns, array_keys($table));
|
$columns = array_intersect($oldColumns, array_keys($table));
|
||||||
|
@ -255,12 +319,12 @@ class Com_WeblinksInstallerScript
|
||||||
*/
|
*/
|
||||||
private function addColumnsIfNeeded()
|
private function addColumnsIfNeeded()
|
||||||
{
|
{
|
||||||
$db = JFactory::getDbo();
|
$db = Factory::getDbo();
|
||||||
$table = $db->getTableColumns('#__weblinks');
|
$table = $db->getTableColumns('#__weblinks');
|
||||||
|
|
||||||
if (!array_key_exists('version', $table))
|
if (!array_key_exists('version', $table))
|
||||||
{
|
{
|
||||||
$sql = 'ALTER TABLE ' . $db->quoteName('#__weblinks') . ' ADD COLUMN ' . $db->quoteName('version') . " int(10) unsigned NOT NULL DEFAULT '1'";
|
$sql = 'ALTER TABLE ' . $db->quoteName('#__weblinks') . ' ADD COLUMN ' . $db->quoteName('version') . " int unsigned NOT NULL DEFAULT '1'";
|
||||||
$db->setQuery($sql);
|
$db->setQuery($sql);
|
||||||
$db->execute();
|
$db->execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,19 @@
|
||||||
*/
|
*/
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Association\AssociationExtensionInterface;
|
||||||
use Joomla\CMS\Categories\CategoryFactoryInterface;
|
use Joomla\CMS\Categories\CategoryFactoryInterface;
|
||||||
|
use Joomla\CMS\Component\Router\RouterFactoryInterface;
|
||||||
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||||
use Joomla\CMS\Extension\ComponentInterface;
|
use Joomla\CMS\Extension\ComponentInterface;
|
||||||
use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
|
use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
|
||||||
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
||||||
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
||||||
|
use Joomla\CMS\Extension\Service\Provider\RouterFactory;
|
||||||
|
use Joomla\CMS\HTML\Registry;
|
||||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
use Joomla\Component\Weblinks\Administrator\Extension\WeblinksComponent;
|
use Joomla\Component\Weblinks\Administrator\Extension\WeblinksComponent;
|
||||||
|
use Joomla\Component\Weblinks\Administrator\Helper\AssociationsHelper;
|
||||||
use Joomla\DI\Container;
|
use Joomla\DI\Container;
|
||||||
use Joomla\DI\ServiceProviderInterface;
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
|
||||||
|
@ -26,30 +31,39 @@ use Joomla\DI\ServiceProviderInterface;
|
||||||
*/
|
*/
|
||||||
return new class implements ServiceProviderInterface
|
return new class implements ServiceProviderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Registers the service provider with a DI container.
|
* Registers the service provider with a DI container.
|
||||||
*
|
*
|
||||||
* @param Container $container The DI container.
|
* @param Container $container The DI container.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 4.0.0
|
* @since 4.0.0
|
||||||
*/
|
*/
|
||||||
public function register(Container $container)
|
public function register(Container $container)
|
||||||
{
|
{
|
||||||
$container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Weblinks'));
|
$container->set(AssociationExtensionInterface::class, new AssociationsHelper);
|
||||||
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Weblinks'));
|
|
||||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Weblinks'));
|
|
||||||
$container->set(
|
|
||||||
ComponentInterface::class,
|
|
||||||
function (Container $container)
|
|
||||||
{
|
|
||||||
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
|
||||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
|
||||||
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
|
||||||
|
|
||||||
return $component;
|
$componentNamespace = '\\Joomla\\Component\\Weblinks';
|
||||||
}
|
|
||||||
);
|
$container->registerServiceProvider(new CategoryFactory($componentNamespace));
|
||||||
}
|
$container->registerServiceProvider(new MVCFactory($componentNamespace));
|
||||||
|
$container->registerServiceProvider(new ComponentDispatcherFactory($componentNamespace));
|
||||||
|
$container->registerServiceProvider(new RouterFactory($componentNamespace));
|
||||||
|
|
||||||
|
$container->set(
|
||||||
|
ComponentInterface::class,
|
||||||
|
function (Container $container) {
|
||||||
|
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||||
|
|
||||||
|
$component->setRegistry($container->get(Registry::class));
|
||||||
|
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||||
|
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
||||||
|
$component->setAssociationExtension($container->get(AssociationExtensionInterface::class));
|
||||||
|
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
||||||
|
|
||||||
|
return $component;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,33 +11,33 @@ INSERT INTO `#__content_types` (`type_title`, `type_alias`, `table`, `rules`, `f
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `#__weblinks` (
|
CREATE TABLE IF NOT EXISTS `#__weblinks` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`catid` int(11) NOT NULL DEFAULT 0,
|
`catid` int NOT NULL DEFAULT 0,
|
||||||
`title` varchar(250) NOT NULL DEFAULT '',
|
`title` varchar(250) NOT NULL DEFAULT '',
|
||||||
`alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
|
`alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
|
||||||
`url` varchar(250) NOT NULL DEFAULT '',
|
`url` varchar(250) NOT NULL DEFAULT '',
|
||||||
`description` text NOT NULL,
|
`description` text NOT NULL,
|
||||||
`hits` int(11) NOT NULL DEFAULT 0,
|
`hits` int NOT NULL DEFAULT 0,
|
||||||
`state` tinyint(1) NOT NULL DEFAULT 0,
|
`state` tinyint NOT NULL DEFAULT 0,
|
||||||
`checked_out` int(11) NOT NULL DEFAULT 0,
|
`checked_out` int unsigned,
|
||||||
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`checked_out_time` datetime,
|
||||||
`ordering` int(11) NOT NULL DEFAULT 0,
|
`ordering` int NOT NULL DEFAULT 0,
|
||||||
`access` int(11) NOT NULL DEFAULT 1,
|
`access` int NOT NULL DEFAULT 1,
|
||||||
`params` text NOT NULL,
|
`params` text NOT NULL,
|
||||||
`language` char(7) NOT NULL DEFAULT '',
|
`language` char(7) NOT NULL DEFAULT '',
|
||||||
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`created` datetime NOT NULL,
|
||||||
`created_by` int(10) unsigned NOT NULL DEFAULT 0,
|
`created_by` int unsigned NOT NULL DEFAULT 0,
|
||||||
`created_by_alias` varchar(255) NOT NULL DEFAULT '',
|
`created_by_alias` varchar(255) NOT NULL DEFAULT '',
|
||||||
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`modified` datetime NOT NULL,
|
||||||
`modified_by` int(10) unsigned NOT NULL DEFAULT 0,
|
`modified_by` int unsigned NOT NULL DEFAULT 0,
|
||||||
`metakey` text NOT NULL,
|
`metakey` text NOT NULL,
|
||||||
`metadesc` text NOT NULL,
|
`metadesc` text NOT NULL,
|
||||||
`metadata` text NOT NULL,
|
`metadata` text NOT NULL,
|
||||||
`featured` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Set if link is featured.',
|
`featured` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Set if link is featured.',
|
||||||
`xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
|
`xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.',
|
||||||
`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`publish_up` datetime,
|
||||||
`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`publish_down` datetime,
|
||||||
`version` int(10) unsigned NOT NULL DEFAULT 1,
|
`version` int unsigned NOT NULL DEFAULT 1,
|
||||||
`images` text NOT NULL,
|
`images` text NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_access` (`access`),
|
KEY `idx_access` (`access`),
|
||||||
|
|
|
@ -17,24 +17,24 @@ CREATE TABLE "#__weblinks" (
|
||||||
"description" text NOT NULL,
|
"description" text NOT NULL,
|
||||||
"hits" bigint DEFAULT 0 NOT NULL,
|
"hits" bigint DEFAULT 0 NOT NULL,
|
||||||
"state" smallint DEFAULT 0 NOT NULL,
|
"state" smallint DEFAULT 0 NOT NULL,
|
||||||
"checked_out" bigint DEFAULT 0 NOT NULL,
|
"checked_out" integer,
|
||||||
"checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
|
"checked_out_time" timestamp without time zone,
|
||||||
"ordering" bigint DEFAULT 0 NOT NULL,
|
"ordering" bigint DEFAULT 0 NOT NULL,
|
||||||
"access" bigint DEFAULT 1 NOT NULL,
|
"access" bigint DEFAULT 1 NOT NULL,
|
||||||
"params" text NOT NULL,
|
"params" text NOT NULL,
|
||||||
"language" varchar(7) DEFAULT '' NOT NULL,
|
"language" varchar(7) DEFAULT '' NOT NULL,
|
||||||
"created" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
|
"created" timestamp without time zone NOT NULL,
|
||||||
"created_by" integer DEFAULT 0 NOT NULL,
|
"created_by" integer DEFAULT 0 NOT NULL,
|
||||||
"created_by_alias" varchar(255) DEFAULT '' NOT NULL,
|
"created_by_alias" varchar(255) DEFAULT '' NOT NULL,
|
||||||
"modified" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
|
"modified" timestamp without time zone NOT NULL,
|
||||||
"modified_by" integer DEFAULT 0 NOT NULL,
|
"modified_by" integer DEFAULT 0 NOT NULL,
|
||||||
"metakey" text NOT NULL,
|
"metakey" text NOT NULL,
|
||||||
"metadesc" text NOT NULL,
|
"metadesc" text NOT NULL,
|
||||||
"metadata" text NOT NULL,
|
"metadata" text NOT NULL,
|
||||||
"featured" smallint DEFAULT 0 NOT NULL,
|
"featured" smallint DEFAULT 0 NOT NULL,
|
||||||
"xreference" varchar(50) NOT NULL,
|
"xreference" varchar(50) NOT NULL,
|
||||||
"publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
|
"publish_up" timestamp without time zone,
|
||||||
"publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL,
|
"publish_down" timestamp without time zone,
|
||||||
"version" bigint DEFAULT 1 NOT NULL,
|
"version" bigint DEFAULT 1 NOT NULL,
|
||||||
"images" text NOT NULL,
|
"images" text NOT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
/****** Insert data into table [#__content_types] for UCM functions ******/
|
|
||||||
INSERT [#__content_types] ([type_title], [type_alias], [table], [rules], [field_mappings], [router], [content_history_options])
|
|
||||||
SELECT 'Weblink', 'com_weblinks.weblink', '{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}', '', '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias","core_created_time":"created","core_modified_time":"modified","core_body":"description", "core_hits":"hits","core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_params":"params", "core_featured":"featured", "core_metadata":"metadata", "core_language":"language", "core_images":"images", "core_urls":"urls", "core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc", "core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}', 'WeblinksHelperRoute::getWeblinkRoute', '{"formFile":"administrator\/components\/com_weblinks\/models\/forms\/weblink.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","featured","images"], "ignoreChanges":["modified_by", "modified", "checked_out", "checked_out_time", "version", "hits"], "convertToInt":["publish_up", "publish_down", "featured", "ordering"], "displayLookup":[{"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'Weblinks Category', 'com_weblinks.category', '{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}', '', '{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias","core_created_time":"created_time","core_modified_time":"modified_time","core_body":"description", "core_hits":"hits","core_publish_up":"null","core_publish_down":"null","core_access":"access", "core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language", "core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey", "core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"}, "special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}', 'WeblinksHelperRoute::getCategoryRoute', '{"formFile":"administrator\/components\/com_categories\/models\/forms\/category.xml", "hideFields":["asset_id","checked_out","checked_out_time","version","lft","rgt","level","path","extension"], "ignoreChanges":["modified_user_id", "modified_time", "checked_out", "checked_out_time", "version", "hits", "path"],"convertToInt":["publish_up", "publish_down"], "displayLookup":[{"sourceColumn":"created_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"}]}';
|
|
||||||
|
|
||||||
/****** Object: Table [#__weblinks] ******/
|
|
||||||
SET QUOTED_IDENTIFIER ON;
|
|
||||||
|
|
||||||
CREATE TABLE [#__weblinks](
|
|
||||||
[id] [bigint] IDENTITY(1,1) NOT NULL,
|
|
||||||
[catid] [int] NOT NULL DEFAULT 0,
|
|
||||||
[title] [nvarchar](250) NOT NULL DEFAULT '',
|
|
||||||
[alias] [nvarchar](255) NOT NULL,
|
|
||||||
[url] [nvarchar](250) NOT NULL DEFAULT '',
|
|
||||||
[description] [nvarchar](max) NOT NULL,
|
|
||||||
[hits] [int] NOT NULL DEFAULT 0,
|
|
||||||
[state] [smallint] NOT NULL DEFAULT 0,
|
|
||||||
[checked_out] [int] NOT NULL DEFAULT 0,
|
|
||||||
[checked_out_time] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000',
|
|
||||||
[ordering] [int] NOT NULL DEFAULT 0,
|
|
||||||
[access] [int] NOT NULL DEFAULT 1,
|
|
||||||
[params] [nvarchar](max) NOT NULL,
|
|
||||||
[language] [nvarchar](7) NOT NULL DEFAULT '',
|
|
||||||
[created] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000',
|
|
||||||
[created_by] [bigint] NOT NULL DEFAULT 0,
|
|
||||||
[created_by_alias] [nvarchar](255) NOT NULL DEFAULT '',
|
|
||||||
[modified] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000',
|
|
||||||
[modified_by] [bigint] NOT NULL DEFAULT 0,
|
|
||||||
[metakey] [nvarchar](max) NOT NULL,
|
|
||||||
[metadesc] [nvarchar](max) NOT NULL,
|
|
||||||
[metadata] [nvarchar](max) NOT NULL,
|
|
||||||
[featured] [tinyint] NOT NULL DEFAULT 0,
|
|
||||||
[xreference] [nvarchar](50) NOT NULL,
|
|
||||||
[publish_up] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000',
|
|
||||||
[publish_down] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000',
|
|
||||||
[version] [bigint] NOT NULL DEFAULT 1,
|
|
||||||
[images] [nvarchar](max) NOT NULL,
|
|
||||||
CONSTRAINT [PK_#__weblinks_id] PRIMARY KEY CLUSTERED
|
|
||||||
(
|
|
||||||
[id] ASC
|
|
||||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
|
||||||
) ON [PRIMARY];
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_access] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[access] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_catid] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[catid] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_checkout] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[checked_out] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_createdby] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[created_by] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_featured_catid] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[featured] ASC,
|
|
||||||
[catid] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_language] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[language] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_state] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[state] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
||||||
|
|
||||||
CREATE NONCLUSTERED INDEX [idx_xreference] ON [#__weblinks]
|
|
||||||
(
|
|
||||||
[xreference] ASC
|
|
||||||
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
|
|
|
@ -1,3 +0,0 @@
|
||||||
DELETE FROM [#__content_types] WHERE [type_alias] IN ('com_weblinks.weblink', 'com_weblinks.category');
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS [#__weblinks];
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `created` datetime NOT NULL;
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `modified` datetime NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `publish_up` datetime NULL DEFAULT NULL;
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `publish_down` datetime NULL DEFAULT NULL;
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `checked_out_time` datetime NULL DEFAULT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `#__weblinks` MODIFY `checked_out` int unsigned;
|
||||||
|
|
||||||
|
UPDATE `#__weblinks` SET `modified` = `created` WHERE `modified` = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
|
UPDATE `#__weblinks` SET `publish_up` = NULL WHERE `publish_up` = '0000-00-00 00:00:00';
|
||||||
|
UPDATE `#__weblinks` SET `publish_down` = NULL WHERE `publish_down` = '0000-00-00 00:00:00';
|
||||||
|
UPDATE `#__weblinks` SET `checked_out_time` = NULL WHERE `checked_out_time` = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
|
UPDATE `#__weblinks` SET `checked_out` = null WHERE `checked_out` = 0;
|
||||||
|
|
||||||
|
UPDATE `#__categories` SET `modified_time` = `created_time` WHERE `modified_time` = '0000-00-00 00:00:00' AND `extension` = 'com_weblinks';
|
||||||
|
|
||||||
|
UPDATE `#__categories` SET `checked_out_time` = NULL WHERE `checked_out_time` = '0000-00-00 00:00:00' AND `extension` = 'com_weblinks';
|
||||||
|
|
||||||
|
UPDATE `#__ucm_content` SET `core_modified_time` = `core_created_time`
|
||||||
|
WHERE `core_type_alias` IN ('com_weblinks.weblink', 'com_weblinks.category')
|
||||||
|
AND `core_modified_time` = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
|
UPDATE `#__ucm_content` SET `core_publish_up` = NULL
|
||||||
|
WHERE `core_type_alias` = 'com_weblinks.weblink'
|
||||||
|
AND `core_publish_up` = '0000-00-00 00:00:00';
|
||||||
|
UPDATE `#__ucm_content` SET `core_publish_down` = NULL
|
||||||
|
WHERE `core_type_alias` = 'com_weblinks.weblink'
|
||||||
|
AND `core_publish_down` = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
|
UPDATE `#__ucm_content` SET `core_checked_out_time` = NULL
|
||||||
|
WHERE `core_type_alias` IN ('com_weblinks.weblink', 'com_weblinks.category')
|
||||||
|
AND `core_checked_out_time` = '0000-00-00 00:00:00';
|
|
@ -0,0 +1,42 @@
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "created" DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "modified" DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "publish_up" DROP NOT NULL;
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "publish_up" DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "publish_down" DROP NOT NULL;
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "publish_down" DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "checked_out_time" DROP NOT NULL;
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "checked_out_time" DROP DEFAULT;
|
||||||
|
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "checked_out" DROP NOT NULL;
|
||||||
|
ALTER TABLE "#__weblinks" ALTER COLUMN "checked_out" DROP DEFAULT;
|
||||||
|
|
||||||
|
UPDATE "#__weblinks" SET "modified" = "created" WHERE "modified" = '1970-01-01 00:00:00';
|
||||||
|
|
||||||
|
UPDATE "#__weblinks" SET "publish_up" = NULL WHERE "publish_up" = '1970-01-01 00:00:00';
|
||||||
|
UPDATE "#__weblinks" SET "publish_down" = NULL WHERE "publish_down" = '1970-01-01 00:00:00';
|
||||||
|
UPDATE "#__weblinks" SET "checked_out_time" = NULL WHERE "checked_out_time" = '1970-01-01 00:00:00';
|
||||||
|
|
||||||
|
UPDATE "#__weblinks" SET "checked_out" = null WHERE "checked_out" = 0;
|
||||||
|
|
||||||
|
UPDATE "#__categories" SET "modified_time" = "created_time" WHERE "modified_time" = '1970-01-01 00:00:00' AND "extension" = 'com_weblinks';
|
||||||
|
|
||||||
|
UPDATE "#__categories" SET "checked_out_time" = NULL WHERE "checked_out_time" = '1970-01-01 00:00:00' AND "extension" = 'com_weblinks';
|
||||||
|
|
||||||
|
UPDATE "#__ucm_content" SET "core_modified_time" = "core_created_time"
|
||||||
|
WHERE "core_type_alias" IN ('com_weblinks.weblink', 'com_weblinks.category')
|
||||||
|
AND "core_modified_time" = '1970-01-01 00:00:00';
|
||||||
|
|
||||||
|
UPDATE "#__ucm_content" SET "core_publish_up" = NULL
|
||||||
|
WHERE "core_type_alias" = 'com_weblinks.weblink'
|
||||||
|
AND "core_publish_up" = '1970-01-01 00:00:00';
|
||||||
|
UPDATE "#__ucm_content" SET "core_publish_down" = NULL
|
||||||
|
WHERE "core_type_alias" = 'com_weblinks.weblink'
|
||||||
|
AND "core_publish_down" = '1970-01-01 00:00:00';
|
||||||
|
|
||||||
|
UPDATE "#__ucm_content" SET "core_checked_out_time" = NULL
|
||||||
|
WHERE "core_type_alias" IN ('com_weblinks.weblink', 'com_weblinks.category')
|
||||||
|
AND "core_checked_out_time" = '1970-01-01 00:00:00';
|
|
@ -1 +0,0 @@
|
||||||
# Placeholder file to set the extension database schema version
|
|
|
@ -37,14 +37,12 @@ class DisplayController extends BaseController
|
||||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||||
* for valid values see {@link JFilterInput::clean()}.
|
* for valid values see {@link JFilterInput::clean()}.
|
||||||
*
|
*
|
||||||
* @return JControllerLegacy This object to support chaining.
|
* @return BaseController|boolean This object to support chaining.
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
public function display($cacheable = false, $urlparams = false)
|
public function display($cacheable = false, $urlparams = false)
|
||||||
{
|
{
|
||||||
require_once JPATH_COMPONENT . '/helpers/weblinks.php';
|
|
||||||
|
|
||||||
$view = $this->input->get('view', 'weblinks');
|
$view = $this->input->get('view', 'weblinks');
|
||||||
$layout = $this->input->get('layout', 'default');
|
$layout = $this->input->get('layout', 'default');
|
||||||
$id = $this->input->getInt('id');
|
$id = $this->input->getInt('id');
|
||||||
|
@ -53,8 +51,11 @@ class DisplayController extends BaseController
|
||||||
if ($view == 'weblink' && $layout == 'edit' && !$this->checkEditId('com_weblinks.edit.weblink', $id))
|
if ($view == 'weblink' && $layout == 'edit' && !$this->checkEditId('com_weblinks.edit.weblink', $id))
|
||||||
{
|
{
|
||||||
// Somehow the person just went to the form - we don't allow that.
|
// Somehow the person just went to the form - we don't allow that.
|
||||||
$this->setError(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
if (!\count($this->app->getMessageQueue()))
|
||||||
$this->setMessage($this->getError(), 'error');
|
{
|
||||||
|
$this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
|
||||||
|
}
|
||||||
|
|
||||||
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks', false));
|
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks', false));
|
||||||
|
|
||||||
return false;
|
return false;
|
|
@ -11,6 +11,9 @@ namespace Joomla\Component\Weblinks\Administrator\Controller;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\Controller\FormController;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\CMS\Versioning\VersionableControllerTrait;
|
||||||
use Joomla\Utilities\ArrayHelper;
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,8 +21,10 @@ use Joomla\Utilities\ArrayHelper;
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
class WeblinkController extends \JControllerForm
|
class WeblinkController extends FormController
|
||||||
{
|
{
|
||||||
|
use VersionableControllerTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method override to check if you can add a new record.
|
* Method override to check if you can add a new record.
|
||||||
*
|
*
|
||||||
|
@ -32,20 +37,14 @@ class WeblinkController extends \JControllerForm
|
||||||
protected function allowAdd($data = array())
|
protected function allowAdd($data = array())
|
||||||
{
|
{
|
||||||
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
|
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
|
||||||
$allow = null;
|
|
||||||
|
|
||||||
if ($categoryId)
|
if ($categoryId)
|
||||||
{
|
{
|
||||||
// If the category has been passed in the URL check it.
|
// If the category has been passed in the URL check it.
|
||||||
$allow = \JFactory::getUser()->authorise('core.create', $this->option . '.category.' . $categoryId);
|
return $this->app->getIdentity()->authorise('core.create', $this->option . '.category.' . $categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($allow !== null)
|
// In the absence of better information, revert to the component permissions.
|
||||||
{
|
|
||||||
return $allow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the absense of better information, revert to the component permissions.
|
|
||||||
return parent::allowAdd($data);
|
return parent::allowAdd($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ class WeblinkController extends \JControllerForm
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = \JFactory::getUser();
|
$user = $this->app->getIdentity();
|
||||||
|
|
||||||
// Check if can edit own core.edit.own.
|
// Check if can edit own core.edit.own.
|
||||||
$canEditOwn = $user->authorise('core.edit.own', $this->option . '.category.' . (int) $item->catid) && $item->created_by == $user->id;
|
$canEditOwn = $user->authorise('core.edit.own', $this->option . '.category.' . (int) $item->catid) && $item->created_by == $user->id;
|
||||||
|
@ -98,13 +97,13 @@ class WeblinkController extends \JControllerForm
|
||||||
*/
|
*/
|
||||||
public function batch($model = null)
|
public function batch($model = null)
|
||||||
{
|
{
|
||||||
\JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN'));
|
$this->checkToken();
|
||||||
|
|
||||||
// Set the model
|
// Set the model
|
||||||
$model = $this->getModel('Weblink', '', array());
|
$model = $this->getModel('Weblink', 'Administrator', array());
|
||||||
|
|
||||||
// Preset the redirect
|
// Preset the redirect
|
||||||
$this->setRedirect(\JRoute::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
|
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
|
||||||
|
|
||||||
return parent::batch($model);
|
return parent::batch($model);
|
||||||
}
|
}
|
||||||
|
@ -112,8 +111,8 @@ class WeblinkController extends \JControllerForm
|
||||||
/**
|
/**
|
||||||
* Function that allows child controller access to model data after the data has been saved.
|
* Function that allows child controller access to model data after the data has been saved.
|
||||||
*
|
*
|
||||||
* @param JModelLegacy $model The data model object.
|
* @param \Joomla\CMS\MVC\Model\BaseDatabaseModel $model The data model object.
|
||||||
* @param array $validData The validated data.
|
* @param array $validData The validated data.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
@ -125,7 +124,7 @@ class WeblinkController extends \JControllerForm
|
||||||
|
|
||||||
if ($task == 'save')
|
if ($task == 'save')
|
||||||
{
|
{
|
||||||
$this->setRedirect(\JRoute::_('index.php?option=com_weblinks&view=weblinks', false));
|
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks', false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,138 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_weblinks
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Extension;
|
||||||
|
|
||||||
|
defined('JPATH_PLATFORM') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Application\SiteApplication;
|
||||||
|
use Joomla\CMS\Association\AssociationServiceInterface;
|
||||||
|
use Joomla\CMS\Association\AssociationServiceTrait;
|
||||||
|
use Joomla\CMS\Categories\CategoryServiceInterface;
|
||||||
|
use Joomla\CMS\Categories\CategoryServiceTrait;
|
||||||
|
use Joomla\CMS\Component\Router\RouterServiceInterface;
|
||||||
|
use Joomla\CMS\Component\Router\RouterServiceTrait;
|
||||||
|
use Joomla\CMS\Extension\BootableExtensionInterface;
|
||||||
|
use Joomla\CMS\Extension\MVCComponent;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Fields\FieldsServiceInterface;
|
||||||
|
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Tag\TagServiceInterface;
|
||||||
|
use Joomla\CMS\Tag\TagServiceTrait;
|
||||||
|
use Joomla\Component\Weblinks\Administrator\Service\HTML\AdministratorService;
|
||||||
|
use Joomla\Component\Weblinks\Administrator\Service\HTML\Icon;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component class for com_weblinks
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
class WeblinksComponent extends MVCComponent implements CategoryServiceInterface, AssociationServiceInterface,
|
||||||
|
TagServiceInterface, RouterServiceInterface, BootableExtensionInterface, FieldsServiceInterface
|
||||||
|
{
|
||||||
|
use CategoryServiceTrait;
|
||||||
|
use AssociationServiceTrait;
|
||||||
|
use HTMLRegistryAwareTrait;
|
||||||
|
use RouterServiceTrait;
|
||||||
|
use CategoryServiceTrait, TagServiceTrait
|
||||||
|
{
|
||||||
|
CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait;
|
||||||
|
CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Booting the extension. This is the function to set up the environment of the extension like
|
||||||
|
* registering new class loaders, etc.
|
||||||
|
*
|
||||||
|
* If required, some initial set up can be done from services of the container, eg.
|
||||||
|
* registering HTML services.
|
||||||
|
*
|
||||||
|
* @param ContainerInterface $container The container
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function boot(ContainerInterface $container)
|
||||||
|
{
|
||||||
|
$this->getRegistry()->register('weblinksadministrator', new AdministratorService);
|
||||||
|
$this->getRegistry()->register('weblinkicon', new Icon($container->get(SiteApplication::class)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a valid section for the given section. If it is not valid then null
|
||||||
|
* is returned.
|
||||||
|
*
|
||||||
|
* @param string $section The section to get the mapping for
|
||||||
|
* @param object $item The item
|
||||||
|
*
|
||||||
|
* @return string|null The new section
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function validateSection($section, $item = null)
|
||||||
|
{
|
||||||
|
if ($section != 'weblink')
|
||||||
|
{
|
||||||
|
// We don't know other sections
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $section;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns valid contexts
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function getContexts(): array
|
||||||
|
{
|
||||||
|
Factory::getLanguage()->load('com_weblinks', JPATH_ADMINISTRATOR);
|
||||||
|
|
||||||
|
$contexts = array(
|
||||||
|
'com_weblinks.weblink' => Text::_('COM_WEBLINKS'),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $contexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the table for the count items functions for the given section.
|
||||||
|
*
|
||||||
|
* @param string $section The section
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
protected function getTableNameForSection(string $section = null)
|
||||||
|
{
|
||||||
|
return ($section === 'category' ? 'categories' : 'weblinks');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state column for the count items functions for the given section.
|
||||||
|
*
|
||||||
|
* @param string $section The section
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
protected function getStateColumnForSection(string $section = null)
|
||||||
|
{
|
||||||
|
return 'state';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,295 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Field\Modal;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Form\FormField;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
|
|
||||||
|
defined('JPATH_BASE') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supports a modal weblink picker.
|
||||||
|
*
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
|
*/
|
||||||
|
class WeblinkField extends FormField
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
Factory::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;
|
||||||
|
|
||||||
|
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||||
|
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
||||||
|
|
||||||
|
// Add the modal field script to the document head.
|
||||||
|
$wa->useScript('field.modal-fields');
|
||||||
|
|
||||||
|
// 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]))
|
||||||
|
{
|
||||||
|
$wa->addInlineScript("
|
||||||
|
window.jSelectWeblink_" . $this->id . " = function (id, title, catid, object, url, language) {
|
||||||
|
window.processModalSelect('Article', '" . $this->id . "', id, title, catid, object, url, language);
|
||||||
|
}",
|
||||||
|
[],
|
||||||
|
['type' => 'module']
|
||||||
|
);
|
||||||
|
|
||||||
|
Text::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');
|
||||||
|
|
||||||
|
$scriptSelect[$this->id] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup variables for display.
|
||||||
|
$linkWeblinks = 'index.php?option=com_weblinks&view=weblinks&layout=modal&tmpl=component&' . Session::getFormToken() . '=1';
|
||||||
|
$linkWeblink = 'index.php?option=com_weblinks&view=weblink&layout=modal&tmpl=component&' . Session::getFormToken() . '=1';
|
||||||
|
$modalTitle = Text::_('COM_WEBLINKS_CHANGE_WEBLINK');
|
||||||
|
|
||||||
|
if (isset($this->element['language']))
|
||||||
|
{
|
||||||
|
$linkWeblinks .= '&forcedLanguage=' . $this->element['language'];
|
||||||
|
$linkWeblink .= '&forcedLanguage=' . $this->element['language'];
|
||||||
|
$modalTitle .= ' — ' . $this->element['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$urlSelect = $linkWeblinks . '&function=jSelectWeblink_' . $this->id;
|
||||||
|
$urlEdit = $linkWeblink . '&task=weblink.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \'';
|
||||||
|
$urlNew = $linkWeblink . '&task=weblink.add';
|
||||||
|
|
||||||
|
if ($value)
|
||||||
|
{
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('title'))
|
||||||
|
->from($db->quoteName('#__weblinks'))
|
||||||
|
->where($db->quoteName('id') . ' = :id')
|
||||||
|
->bind(':id', $value, ParameterType::INTEGER);
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$title = $db->loadResult();
|
||||||
|
}
|
||||||
|
catch (\RuntimeException $e)
|
||||||
|
{
|
||||||
|
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = empty($title) ? Text::_('COM_WEBLINKS_SELECT_A_WEBLINK') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
|
// The current weblink display field.
|
||||||
|
$html = '';
|
||||||
|
|
||||||
|
if ($allowSelect || $allowNew || $allowEdit || $allowClear)
|
||||||
|
{
|
||||||
|
$html .= '<span class="input-group">';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '<input class="form-control" id="' . $this->id . '_name" type="text" value="' . $title . '" readonly size="35">';
|
||||||
|
|
||||||
|
// Select weblink button
|
||||||
|
if ($allowSelect)
|
||||||
|
{
|
||||||
|
$html .= '<button'
|
||||||
|
. ' class="btn btn-primary' . ($value ? ' hidden' : '') . '"'
|
||||||
|
. ' id="' . $this->id . '_select"'
|
||||||
|
. ' data-bs-toggle="modal"'
|
||||||
|
. ' type="button"'
|
||||||
|
. ' data-bs-target="#ModalSelect' . $modalId . '">'
|
||||||
|
. '<span class="icon-file" aria-hidden="true"></span> ' . Text::_('JSELECT')
|
||||||
|
. '</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// New weblink button
|
||||||
|
if ($allowNew)
|
||||||
|
{
|
||||||
|
$html .= '<button'
|
||||||
|
. ' class="btn btn-secondary' . ($value ? ' hidden' : '') . '"'
|
||||||
|
. ' id="' . $this->id . '_new"'
|
||||||
|
. ' data-bs-toggle="modal"'
|
||||||
|
. ' type="button"'
|
||||||
|
. ' data-bs-target="#ModalNew' . $modalId . '">'
|
||||||
|
. '<span class="icon-plus" aria-hidden="true"></span> ' . Text::_('JACTION_CREATE')
|
||||||
|
. '</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit weblink button
|
||||||
|
if ($allowEdit)
|
||||||
|
{
|
||||||
|
$html .= '<button'
|
||||||
|
. ' class="btn btn-primary' . ($value ? '' : ' hidden') . '"'
|
||||||
|
. ' id="' . $this->id . '_edit"'
|
||||||
|
. ' data-bs-toggle="modal"'
|
||||||
|
. ' type="button"'
|
||||||
|
. ' data-bs-target="#ModalEdit' . $modalId . '">'
|
||||||
|
. '<span class="icon-pen-square" aria-hidden="true"></span> ' . Text::_('JACTION_EDIT')
|
||||||
|
. '</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear weblink button
|
||||||
|
if ($allowClear)
|
||||||
|
{
|
||||||
|
$html .= '<button'
|
||||||
|
. ' class="btn btn-secondary' . ($value ? '' : ' hidden') . '"'
|
||||||
|
. ' id="' . $this->id . '_clear"'
|
||||||
|
. ' type="button"'
|
||||||
|
. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
|
||||||
|
. '<span class="icon-times" aria-hidden="true"></span> ' . Text::_('JCLEAR')
|
||||||
|
. '</button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($allowSelect || $allowNew || $allowEdit || $allowClear)
|
||||||
|
{
|
||||||
|
$html .= '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select weblink modal
|
||||||
|
if ($allowSelect)
|
||||||
|
{
|
||||||
|
$html .= HTMLHelper::_(
|
||||||
|
'bootstrap.renderModal',
|
||||||
|
'ModalSelect' . $modalId,
|
||||||
|
array(
|
||||||
|
'title' => $modalTitle,
|
||||||
|
'url' => $urlSelect,
|
||||||
|
'height' => '400px',
|
||||||
|
'width' => '800px',
|
||||||
|
'bodyHeight' => 70,
|
||||||
|
'modalWidth' => 80,
|
||||||
|
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'
|
||||||
|
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$closeButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'cancel', 'weblink-form'); return false;";
|
||||||
|
$saveButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'save', 'weblink-form'); return false;";
|
||||||
|
$applyButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'apply', 'weblink-form'); return false;";
|
||||||
|
|
||||||
|
// New weblink modal
|
||||||
|
if ($allowNew)
|
||||||
|
{
|
||||||
|
$html .= HTMLHelper::_(
|
||||||
|
'bootstrap.renderModal',
|
||||||
|
'ModalNew' . $modalId,
|
||||||
|
array(
|
||||||
|
'title' => Text::_('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="' . $closeButtonClick . '">'
|
||||||
|
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
|
||||||
|
. '<a role="button" class="btn btn-primary" aria-hidden="true"'
|
||||||
|
. ' onclick="' . $saveButtonClick . '">'
|
||||||
|
. Text::_('JSAVE') . '</a>'
|
||||||
|
. '<a role="button" class="btn btn-success" aria-hidden="true"'
|
||||||
|
. ' onclick="' . $applyButtonClick . '">'
|
||||||
|
. Text::_('JAPPLY') . '</a>',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit weblink modal
|
||||||
|
if ($allowEdit)
|
||||||
|
{
|
||||||
|
$html .= HTMLHelper::_(
|
||||||
|
'bootstrap.renderModal',
|
||||||
|
'ModalEdit' . $modalId,
|
||||||
|
array(
|
||||||
|
'title' => Text::_('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="' . $closeButtonClick . '">'
|
||||||
|
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
|
||||||
|
. '<a role="button" class="btn btn-primary" aria-hidden="true"'
|
||||||
|
. ' onclick="' . $saveButtonClick . '">'
|
||||||
|
. Text::_('JSAVE') . '</a>'
|
||||||
|
. '<a role="button" class="btn btn-success" aria-hidden="true"'
|
||||||
|
. ' onclick="' . $applyButtonClick . '">'
|
||||||
|
. Text::_('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(Text::_('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 . '_name', parent::getLabel());
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,23 +7,26 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Helper;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\Utilities\ArrayHelper;
|
use Joomla\CMS\Association\AssociationExtensionHelper;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
JTable::addIncludePath(__DIR__ . '/../tables');
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\AssociationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content associations helper.
|
* Content associations helper.
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
class AssociationsHelper extends AssociationExtensionHelper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The extension name
|
* The extension name
|
||||||
*
|
*
|
||||||
* @var array $extension
|
* @var string $extension
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +35,7 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
/**
|
/**
|
||||||
* Array of item types
|
* Array of item types
|
||||||
*
|
*
|
||||||
* @var array $itemTypes
|
* @var array $itemTypes
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
|
@ -41,12 +44,27 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
/**
|
/**
|
||||||
* Has the extension association support
|
* Has the extension association support
|
||||||
*
|
*
|
||||||
* @var boolean $associationsSupport
|
* @var boolean $associationsSupport
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
protected $associationsSupport = true;
|
protected $associationsSupport = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the associations for a given item.
|
||||||
|
*
|
||||||
|
* @param integer $id Id of the item
|
||||||
|
* @param string $view Name of the view
|
||||||
|
*
|
||||||
|
* @return array Array of associations for the item
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function getAssociationsForItem($id = 0, $view = null)
|
||||||
|
{
|
||||||
|
return AssociationHelper::getAssociations($id, $view);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the associated items for an item
|
* Get the associated items for an item
|
||||||
*
|
*
|
||||||
|
@ -71,7 +89,7 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the associations.
|
// Get the associations.
|
||||||
$associations = JLanguageAssociations::getAssociations(
|
$associations = Associations::getAssociations(
|
||||||
$this->extension,
|
$this->extension,
|
||||||
$type['tables']['a'],
|
$type['tables']['a'],
|
||||||
$context,
|
$context,
|
||||||
|
@ -90,7 +108,7 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
* @param string $typeName The item type
|
* @param string $typeName The item type
|
||||||
* @param int $id The id of item for which we need the associated items
|
* @param int $id The id of item for which we need the associated items
|
||||||
*
|
*
|
||||||
* @return JTable|null
|
* @return Table|null
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
|
@ -106,11 +124,11 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
switch ($typeName)
|
switch ($typeName)
|
||||||
{
|
{
|
||||||
case 'weblink':
|
case 'weblink':
|
||||||
$table = JTable::getInstance('Weblink', 'WeblinksTable');
|
$table = Table::getInstance('WeblinkTable', 'Joomla\\Component\\Weblinks\\Administrator\\Table\\');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
$table = JTable::getInstance('Category');
|
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,14 +165,14 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
{
|
{
|
||||||
case 'weblink':
|
case 'weblink':
|
||||||
|
|
||||||
$support['state'] = true;
|
$support['state'] = true;
|
||||||
$support['acl'] = true;
|
$support['acl'] = true;
|
||||||
$support['checkout'] = true;
|
$support['checkout'] = true;
|
||||||
$support['category'] = true;
|
$support['category'] = true;
|
||||||
$support['save2copy'] = true;
|
$support['save2copy'] = true;
|
||||||
|
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'a' => '#__weblinks'
|
'a' => '#__weblinks',
|
||||||
);
|
);
|
||||||
|
|
||||||
$title = 'weblink';
|
$title = 'weblink';
|
||||||
|
@ -170,10 +188,10 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
$support['state'] = true;
|
$support['state'] = true;
|
||||||
$support['acl'] = true;
|
$support['acl'] = true;
|
||||||
$support['checkout'] = true;
|
$support['checkout'] = true;
|
||||||
$support['level'] = true;
|
$support['level'] = true;
|
||||||
|
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'a' => '#__categories'
|
'a' => '#__categories',
|
||||||
);
|
);
|
||||||
|
|
||||||
$title = 'category';
|
$title = 'category';
|
||||||
|
@ -186,7 +204,7 @@ class WeblinksAssociationsHelper extends JAssociationExtensionHelper
|
||||||
'support' => $support,
|
'support' => $support,
|
||||||
'tables' => $tables,
|
'tables' => $tables,
|
||||||
'joins' => $joins,
|
'joins' => $joins,
|
||||||
'title' => $title
|
'title' => $title,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Helper;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Helper\ContentHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks helper.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class WeblinksHelper extends ContentHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -11,17 +11,26 @@ namespace Joomla\Component\Weblinks\Administrator\Model;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Application\ApplicationHelper;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
|
use Joomla\CMS\Language\LanguageHelper;
|
||||||
|
use Joomla\CMS\MVC\Model\AdminModel;
|
||||||
|
use Joomla\CMS\Versioning\VersionableModelTrait;
|
||||||
|
use Joomla\Component\Categories\Administrator\Helper\CategoriesHelper;
|
||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
|
use Joomla\String\StringHelper;
|
||||||
\JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_weblinks/helpers/weblinks.php');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks model.
|
* Weblinks model.
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinkModel extends \JModelAdmin
|
class WeblinkModel extends AdminModel
|
||||||
{
|
{
|
||||||
|
use VersionableModelTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type alias for this content type.
|
* The type alias for this content type.
|
||||||
*
|
*
|
||||||
|
@ -57,20 +66,12 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*/
|
*/
|
||||||
protected function canDelete($record)
|
protected function canDelete($record)
|
||||||
{
|
{
|
||||||
if (!empty($record->id))
|
if (empty($record->id) || $record->state != -2)
|
||||||
{
|
{
|
||||||
if ($record->state != -2)
|
return false;
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($record->catid)
|
|
||||||
{
|
|
||||||
return \JFactory::getUser()->authorise('core.delete', 'com_weblinks.category.' . (int) $record->catid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::canDelete($record);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Factory::getApplication()->getIdentity()->authorise('core.delete', 'com_weblinks.category.' . (int) $record->catid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +87,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
{
|
{
|
||||||
if (!empty($record->catid))
|
if (!empty($record->catid))
|
||||||
{
|
{
|
||||||
return \JFactory::getUser()->authorise('core.edit.state', 'com_weblinks.category.' . (int) $record->catid);
|
return Factory::getApplication()->getIdentity()->authorise('core.edit.state', 'com_weblinks.category.' . (int) $record->catid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::canEditState($record);
|
return parent::canEditState($record);
|
||||||
|
@ -141,6 +142,12 @@ class WeblinkModel extends \JModelAdmin
|
||||||
$form->setFieldAttribute('publish_down', 'filter', 'unset');
|
$form->setFieldAttribute('publish_down', 'filter', 'unset');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't allow to change the created_by user if not allowed to access com_users.
|
||||||
|
if (!Factory::getApplication()->getIdentity()->authorise('core.manage', 'com_users'))
|
||||||
|
{
|
||||||
|
$form->setFieldAttribute('created_by', 'filter', 'unset');
|
||||||
|
}
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,8 +160,10 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*/
|
*/
|
||||||
protected function loadFormData()
|
protected function loadFormData()
|
||||||
{
|
{
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
// Check the session for previously entered form data.
|
// Check the session for previously entered form data.
|
||||||
$data = \JFactory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
|
$data = $app->getUserState('com_weblinks.edit.weblink.data', array());
|
||||||
|
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
|
@ -163,7 +172,6 @@ class WeblinkModel extends \JModelAdmin
|
||||||
// Prime some default values.
|
// Prime some default values.
|
||||||
if ($this->getState('weblink.id') == 0)
|
if ($this->getState('weblink.id') == 0)
|
||||||
{
|
{
|
||||||
$app = \JFactory::getApplication();
|
|
||||||
$data->set('catid', $app->input->get('catid', $app->getUserState('com_weblinks.weblinks.filter.category_id'), 'int'));
|
$data->set('catid', $app->input->get('catid', $app->getUserState('com_weblinks.weblinks.filter.category_id'), 'int'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +205,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
$item->images = $registry->toArray();
|
$item->images = $registry->toArray();
|
||||||
|
|
||||||
// Load associated web links items
|
// Load associated web links items
|
||||||
$assoc = \JLanguageAssociations::isEnabled();
|
$assoc = Associations::isEnabled();
|
||||||
|
|
||||||
if ($assoc)
|
if ($assoc)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +213,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
|
|
||||||
if ($item->id != null)
|
if ($item->id != null)
|
||||||
{
|
{
|
||||||
$associations = \JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $item->id);
|
$associations = Associations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $item->id);
|
||||||
|
|
||||||
foreach ($associations as $tag => $association)
|
foreach ($associations as $tag => $association)
|
||||||
{
|
{
|
||||||
|
@ -216,7 +224,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
|
|
||||||
if (!empty($item->id))
|
if (!empty($item->id))
|
||||||
{
|
{
|
||||||
$item->tags = new \JHelperTags;
|
$item->tags = new TagsHelper;
|
||||||
$item->tags->getTagIds($item->id, 'com_weblinks.weblink');
|
$item->tags->getTagIds($item->id, 'com_weblinks.weblink');
|
||||||
$item->metadata['tags'] = $item->tags;
|
$item->metadata['tags'] = $item->tags;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +236,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
/**
|
/**
|
||||||
* Prepare and sanitise the table data prior to saving.
|
* Prepare and sanitise the table data prior to saving.
|
||||||
*
|
*
|
||||||
* @param JTable $table A reference to a JTable object.
|
* @param \Joomla\CMS\Table\Table $table A reference to a JTable object.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
@ -236,15 +244,15 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*/
|
*/
|
||||||
protected function prepareTable($table)
|
protected function prepareTable($table)
|
||||||
{
|
{
|
||||||
$date = \JFactory::getDate();
|
$date = Factory::getDate();
|
||||||
$user = \JFactory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
||||||
$table->alias = \JApplicationHelper::stringURLSafe($table->alias);
|
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
||||||
|
|
||||||
if (empty($table->alias))
|
if (empty($table->alias))
|
||||||
{
|
{
|
||||||
$table->alias = \JApplicationHelper::stringURLSafe($table->title);
|
$table->alias = ApplicationHelper::stringURLSafe($table->title);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($table->id))
|
if (empty($table->id))
|
||||||
|
@ -254,7 +262,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
// Set ordering to the last item if not set
|
// Set ordering to the last item if not set
|
||||||
if (empty($table->ordering))
|
if (empty($table->ordering))
|
||||||
{
|
{
|
||||||
$db = $this->getDbo();
|
$db = $this->getDbo();
|
||||||
$query = $db->getQuery(true)
|
$query = $db->getQuery(true)
|
||||||
->select('MAX(ordering)')
|
->select('MAX(ordering)')
|
||||||
->from($db->quoteName('#__weblinks'));
|
->from($db->quoteName('#__weblinks'));
|
||||||
|
@ -279,7 +287,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
/**
|
/**
|
||||||
* A protected method to get a set of ordering conditions.
|
* A protected method to get a set of ordering conditions.
|
||||||
*
|
*
|
||||||
* @param JTable $table A JTable object.
|
* @param \Joomla\CMS\Table\Table $table A JTable object.
|
||||||
*
|
*
|
||||||
* @return array An array of conditions to add to ordering queries.
|
* @return array An array of conditions to add to ordering queries.
|
||||||
*
|
*
|
||||||
|
@ -287,7 +295,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*/
|
*/
|
||||||
protected function getReorderConditions($table)
|
protected function getReorderConditions($table)
|
||||||
{
|
{
|
||||||
$condition = array();
|
$condition = array();
|
||||||
$condition[] = 'catid = ' . (int) $table->catid;
|
$condition[] = 'catid = ' . (int) $table->catid;
|
||||||
|
|
||||||
return $condition;
|
return $condition;
|
||||||
|
@ -300,13 +308,11 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*
|
*
|
||||||
* @return boolean True on success.
|
* @return boolean True on success.
|
||||||
*
|
*
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
public function save($data)
|
public function save($data)
|
||||||
{
|
{
|
||||||
$app = \JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
\JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');
|
|
||||||
|
|
||||||
// Cast catid to integer for comparison
|
// Cast catid to integer for comparison
|
||||||
$catid = (int) $data['catid'];
|
$catid = (int) $data['catid'];
|
||||||
|
@ -314,30 +320,30 @@ class WeblinkModel extends \JModelAdmin
|
||||||
// Check if New Category exists
|
// Check if New Category exists
|
||||||
if ($catid > 0)
|
if ($catid > 0)
|
||||||
{
|
{
|
||||||
$catid = \CategoriesHelper::validateCategoryId($data['catid'], 'com_weblinks');
|
$catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_weblinks');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save New Category
|
// Save New Category
|
||||||
if ($catid == 0 && $this->canCreateCategory())
|
if ($catid == 0 && $this->canCreateCategory())
|
||||||
{
|
{
|
||||||
$table = array();
|
$table = array();
|
||||||
$table['title'] = $data['catid'];
|
$table['title'] = $data['catid'];
|
||||||
$table['parent_id'] = 1;
|
$table['parent_id'] = 1;
|
||||||
$table['extension'] = 'com_weblinks';
|
$table['extension'] = 'com_weblinks';
|
||||||
$table['language'] = $data['language'];
|
$table['language'] = $data['language'];
|
||||||
$table['published'] = 1;
|
$table['published'] = 1;
|
||||||
|
|
||||||
// Create new category and get catid back
|
// Create new category and get catid back
|
||||||
$data['catid'] = \CategoriesHelper::createCategory($table);
|
$data['catid'] = CategoriesHelper::createCategory($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alter the title for save as copy
|
// Alter the title for save as copy
|
||||||
if ($app->input->get('task') == 'save2copy')
|
if ($app->input->get('task') == 'save2copy')
|
||||||
{
|
{
|
||||||
list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
|
list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']);
|
||||||
$data['title'] = $name;
|
$data['title'] = $name;
|
||||||
$data['alias'] = $alias;
|
$data['alias'] = $alias;
|
||||||
$data['state'] = 0;
|
$data['state'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::save($data);
|
return parent::save($data);
|
||||||
|
@ -363,10 +369,10 @@ class WeblinkModel extends \JModelAdmin
|
||||||
{
|
{
|
||||||
if ($name == $table->title)
|
if ($name == $table->title)
|
||||||
{
|
{
|
||||||
$name = \JString::increment($name);
|
$name = StringHelper::increment($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$alias = \JString::increment($alias, 'dash');
|
$alias = StringHelper::increment($alias, 'dash');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($name, $alias);
|
return array($name, $alias);
|
||||||
|
@ -375,7 +381,7 @@ class WeblinkModel extends \JModelAdmin
|
||||||
/**
|
/**
|
||||||
* Allows preprocessing of the JForm object.
|
* Allows preprocessing of the JForm object.
|
||||||
*
|
*
|
||||||
* @param JForm $form The form object
|
* @param \JForm $form The form object
|
||||||
* @param array $data The data to be merged into the form object
|
* @param array $data The data to be merged into the form object
|
||||||
* @param string $group The plugin group to be executed
|
* @param string $group The plugin group to be executed
|
||||||
*
|
*
|
||||||
|
@ -391,14 +397,14 @@ class WeblinkModel extends \JModelAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
// Association weblinks items
|
// Association weblinks items
|
||||||
if (\JLanguageAssociations::isEnabled())
|
if (Associations::isEnabled())
|
||||||
{
|
{
|
||||||
$languages = \JLanguageHelper::getContentLanguages(false, true, null, 'ordering', 'asc');
|
$languages = LanguageHelper::getContentLanguages(false, false, null, 'ordering', 'asc');
|
||||||
|
|
||||||
if (count($languages) > 1)
|
if (count($languages) > 1)
|
||||||
{
|
{
|
||||||
$addform = new \SimpleXMLElement('<form />');
|
$addform = new \SimpleXMLElement('<form />');
|
||||||
$fields = $addform->addChild('fields');
|
$fields = $addform->addChild('fields');
|
||||||
$fields->addAttribute('name', 'associations');
|
$fields->addAttribute('name', 'associations');
|
||||||
$fieldset = $fields->addChild('fieldset');
|
$fieldset = $fields->addChild('fieldset');
|
||||||
$fieldset->addAttribute('name', 'item_associations');
|
$fieldset->addAttribute('name', 'item_associations');
|
||||||
|
@ -434,6 +440,6 @@ class WeblinkModel extends \JModelAdmin
|
||||||
*/
|
*/
|
||||||
private function canCreateCategory()
|
private function canCreateCategory()
|
||||||
{
|
{
|
||||||
return \JFactory::getUser()->authorise('core.create', 'com_weblinks');
|
return Factory::getApplication()->getIdentity()->authorise('core.create', 'com_weblinks');
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,8 +11,12 @@ namespace Joomla\Component\Weblinks\Administrator\Model;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\CMS\MVC\Model\ListModel;
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||||
|
use Joomla\CMS\MVC\Model\ListModel;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods supporting a list of weblink records.
|
* Methods supporting a list of weblink records.
|
||||||
|
@ -24,7 +28,7 @@ class WeblinksModel extends ListModel
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param array $config An optional associative array of configuration settings.
|
* @param array $config An optional associative array of configuration settings.
|
||||||
* @param MVCFactoryInterface $factory The factory.
|
* @param MVCFactoryInterface $factory The factory.
|
||||||
*
|
*
|
||||||
* @see JControllerLegacy
|
* @see JControllerLegacy
|
||||||
|
@ -59,7 +63,7 @@ class WeblinksModel extends ListModel
|
||||||
'level', 'c.level',
|
'level', 'c.level',
|
||||||
);
|
);
|
||||||
|
|
||||||
$assoc = \JLanguageAssociations::isEnabled();
|
$assoc = Associations::isEnabled();
|
||||||
|
|
||||||
if ($assoc)
|
if ($assoc)
|
||||||
{
|
{
|
||||||
|
@ -83,7 +87,7 @@ class WeblinksModel extends ListModel
|
||||||
*/
|
*/
|
||||||
protected function populateState($ordering = 'a.title', $direction = 'asc')
|
protected function populateState($ordering = 'a.title', $direction = 'asc')
|
||||||
{
|
{
|
||||||
$app = \JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
$forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd');
|
$forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd');
|
||||||
|
|
||||||
|
@ -99,17 +103,8 @@ class WeblinksModel extends ListModel
|
||||||
$this->context .= '.' . $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'));
|
|
||||||
$this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string'));
|
|
||||||
$this->setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd'));
|
|
||||||
$this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '', 'string'));
|
|
||||||
$this->setState('filter.tag', $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '', 'string'));
|
|
||||||
$this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd'));
|
|
||||||
|
|
||||||
// Load the parameters.
|
// Load the parameters.
|
||||||
$params = \JComponentHelper::getParams('com_weblinks');
|
$params = ComponentHelper::getParams('com_weblinks');
|
||||||
$this->setState('params', $params);
|
$this->setState('params', $params);
|
||||||
|
|
||||||
// Force a language.
|
// Force a language.
|
||||||
|
@ -152,16 +147,16 @@ class WeblinksModel extends ListModel
|
||||||
/**
|
/**
|
||||||
* Build an SQL query to load the list data.
|
* Build an SQL query to load the list data.
|
||||||
*
|
*
|
||||||
* @return JDatabaseQuery
|
* @return \JDatabaseQuery
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
protected function getListQuery()
|
protected function getListQuery()
|
||||||
{
|
{
|
||||||
// Create a new query object.
|
// Create a new query object.
|
||||||
$db = $this->getDbo();
|
$db = $this->getDbo();
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
$user = \JFactory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
// Select the required fields from the table.
|
// Select the required fields from the table.
|
||||||
$query->select(
|
$query->select(
|
||||||
|
@ -191,7 +186,7 @@ class WeblinksModel extends ListModel
|
||||||
->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('a.catid'));
|
->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('a.catid'));
|
||||||
|
|
||||||
// Join over the associations.
|
// Join over the associations.
|
||||||
$assoc = \JLanguageAssociations::isEnabled();
|
$assoc = Associations::isEnabled();
|
||||||
|
|
||||||
if ($assoc)
|
if ($assoc)
|
||||||
{
|
{
|
||||||
|
@ -204,14 +199,14 @@ class WeblinksModel extends ListModel
|
||||||
// Filter by access level.
|
// Filter by access level.
|
||||||
if ($access = $this->getState('filter.access'))
|
if ($access = $this->getState('filter.access'))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('a.access') . ' = ' . (int) $access);
|
$query->where($db->quoteName('a.access') . ' = :access')
|
||||||
|
->bind(':access', $access, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement View Level Access
|
// Implement View Level Access
|
||||||
if (!$user->authorise('core.admin'))
|
if (!$user->authorise('core.admin'))
|
||||||
{
|
{
|
||||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
$query->whereIn($db->quoteName('a.access'), $user->getAuthorisedViewLevels());
|
||||||
$query->where($db->quoteName('a.access') . ' IN (' . $groups . ')');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by published state
|
// Filter by published state
|
||||||
|
@ -219,11 +214,12 @@ class WeblinksModel extends ListModel
|
||||||
|
|
||||||
if (is_numeric($published))
|
if (is_numeric($published))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('a.state') . ' = ' . (int) $published);
|
$query->where($db->quoteName('a.state') . ' = :state')
|
||||||
|
->bind(':state', $published, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
elseif ($published === '')
|
elseif ($published === '')
|
||||||
{
|
{
|
||||||
$query->where('(' . $db->quoteName('a.state') . ' IN (0, 1))');
|
$query->whereIn($db->quoteName('a.state'), [0, 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by category.
|
// Filter by category.
|
||||||
|
@ -231,13 +227,15 @@ class WeblinksModel extends ListModel
|
||||||
|
|
||||||
if (is_numeric($categoryId))
|
if (is_numeric($categoryId))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId);
|
$query->where($db->quoteName('a.catid') . ' = :catid')
|
||||||
|
->bind(':catid', $categoryId, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter on the level.
|
// Filter on the level.
|
||||||
if ($level = $this->getState('filter.level'))
|
if ($level = $this->getState('filter.level'))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('c.level') . ' <= ' . (int) $level);
|
$query->where($db->quoteName('c.level') . ' <= :level')
|
||||||
|
->bind(':level', $level, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by search in title
|
// Filter by search in title
|
||||||
|
@ -247,19 +245,24 @@ class WeblinksModel extends ListModel
|
||||||
{
|
{
|
||||||
if (stripos($search, 'id:') === 0)
|
if (stripos($search, 'id:') === 0)
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3));
|
$search = substr($search, 3);
|
||||||
|
$query->where($db->quoteName('a.id') . ' = :id')
|
||||||
|
->bind(':id', $search, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
|
$search = '%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%');
|
||||||
$query->where('(' . $db->quoteName('a.title') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.alias') . ' LIKE ' . $search . ')');
|
$query->where('(' . $db->quoteName('a.title') . ' LIKE :title OR ' . $db->quoteName('a.alias') . ' LIKE :alias)')
|
||||||
|
->bind(':title', $search)
|
||||||
|
->bind(':alias', $search);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter on the language.
|
// Filter on the language.
|
||||||
if ($language = $this->getState('filter.language'))
|
if ($language = $this->getState('filter.language'))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('a.language') . ' = ' . $db->quote($language));
|
$query->where($db->quoteName('a.language') . ' = :language')
|
||||||
|
->bind(':language', $language);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tagId = $this->getState('filter.tag');
|
$tagId = $this->getState('filter.tag');
|
||||||
|
@ -267,7 +270,8 @@ class WeblinksModel extends ListModel
|
||||||
// Filter by a single tag.
|
// Filter by a single tag.
|
||||||
if (is_numeric($tagId))
|
if (is_numeric($tagId))
|
||||||
{
|
{
|
||||||
$query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId)
|
$query->where($db->quoteName('tagmap.tag_id') . ' = :tagId')
|
||||||
|
->bind(':tagId', $tagId, ParameterType::INTEGER)
|
||||||
->join(
|
->join(
|
||||||
'LEFT', $db->quoteName('#__contentitem_tag_map', 'tagmap')
|
'LEFT', $db->quoteName('#__contentitem_tag_map', 'tagmap')
|
||||||
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
|
. ' ON ' . $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id')
|
|
@ -0,0 +1,115 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_weblinks
|
||||||
|
*
|
||||||
|
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Service\HTML;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
|
use Joomla\CMS\Language\LanguageHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks HTML helper class.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
class AdministratorService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the associated language flags
|
||||||
|
*
|
||||||
|
* @param integer $weblinkid The item id to search associations
|
||||||
|
*
|
||||||
|
* @return string The language HTML
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function association($weblinkid)
|
||||||
|
{
|
||||||
|
// Defaults
|
||||||
|
$html = '';
|
||||||
|
|
||||||
|
// Get the associations
|
||||||
|
if ($associations = Associations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $weblinkid))
|
||||||
|
{
|
||||||
|
foreach ($associations as $tag => $associated)
|
||||||
|
{
|
||||||
|
$associations[$tag] = (int) $associated->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the associated contact items
|
||||||
|
$db = Factory::getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select(
|
||||||
|
[
|
||||||
|
$db->quoteName('c.id'),
|
||||||
|
$db->quoteName('c.title', 'title'),
|
||||||
|
$db->quoteName('l.sef', 'lang_sef'),
|
||||||
|
$db->quoteName('lang_code'),
|
||||||
|
$db->quoteName('cat.title', 'category_title'),
|
||||||
|
$db->quoteName('l.image'),
|
||||||
|
$db->quoteName('l.title', 'language_title'),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->from($db->quoteName('#__weblinks', 'c'))
|
||||||
|
->join('LEFT', $db->quoteName('#__categories', 'cat'), $db->quoteName('cat.id') . ' = ' . $db->quoteName('c.catid'))
|
||||||
|
->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('c.language') . ' = ' . $db->quoteName('l.lang_code'))
|
||||||
|
->whereIn($db->quoteName('c.id'), array_values($associations))
|
||||||
|
->where($db->quoteName('c.id') . ' != :id')
|
||||||
|
->bind(':id', $weblinkid, ParameterType::INTEGER);
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$items = $db->loadObjectList('id');
|
||||||
|
}
|
||||||
|
catch (\RuntimeException $e)
|
||||||
|
{
|
||||||
|
throw new \Exception($e->getMessage(), 500, $e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($items)
|
||||||
|
{
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
$languages = LanguageHelper::getContentLanguages(array(0, 1));
|
||||||
|
$content_languages = array_column($languages, 'lang_code');
|
||||||
|
|
||||||
|
foreach ($items as &$item)
|
||||||
|
{
|
||||||
|
if (in_array($item->lang_code, $content_languages))
|
||||||
|
{
|
||||||
|
$text = $item->lang_code;
|
||||||
|
$url = Route::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id);
|
||||||
|
$tooltip = '<strong>' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '</strong><br>'
|
||||||
|
. htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8')
|
||||||
|
. '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title);
|
||||||
|
$classes = 'badge bg-secondary';
|
||||||
|
|
||||||
|
$item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
|
||||||
|
. '<div role="tooltip" id="tip-' . (int) $weblinkid . '-' . (int) $item->id . '">' . $tooltip . '</div>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Display warning if Content Language is trashed or deleted
|
||||||
|
$app->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = LayoutHelper::render('joomla.content.associations', $items);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_weblinks
|
||||||
|
*
|
||||||
|
* @copyright (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Service\HTML;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks Component HTML Helper
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
class Icon
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application
|
||||||
|
*
|
||||||
|
* @var CMSApplication
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service constructor
|
||||||
|
*
|
||||||
|
* @param CMSApplication $application The application
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function __construct(CMSApplication $application)
|
||||||
|
{
|
||||||
|
$this->application = $application;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to generate a link to the create item page for the given category
|
||||||
|
*
|
||||||
|
* @param object $category The category information
|
||||||
|
* @param Registry $params The item parameters
|
||||||
|
* @param array $attribs Optional attributes for the link
|
||||||
|
*
|
||||||
|
* @return string The HTML markup for the create item link
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public static function create($category, $params, $attribs = array())
|
||||||
|
{
|
||||||
|
$uri = Uri::getInstance();
|
||||||
|
|
||||||
|
$url = 'index.php?option=com_weblinks&task=weblink.add&return=' . base64_encode($uri) . '&w_id=0&catid=' . $category->id;
|
||||||
|
|
||||||
|
$text = LayoutHelper::render('joomla.content.icons.create', array('params' => $params, 'legacy' => false));
|
||||||
|
|
||||||
|
// Add the button classes to the attribs array
|
||||||
|
if (isset($attribs['class']))
|
||||||
|
{
|
||||||
|
$attribs['class'] .= ' btn btn-primary';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$attribs['class'] = 'btn btn-primary';
|
||||||
|
}
|
||||||
|
|
||||||
|
$button = HTMLHelper::_('link', Route::_($url), $text, $attribs);
|
||||||
|
|
||||||
|
$output = '<span class="hasTooltip" title="' . HTMLHelper::_('tooltipText', 'COM_WEBLINKS_FORM_CREATE_WEBLINK') . '">' . $button . '</span>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an edit icon for the weblink.
|
||||||
|
*
|
||||||
|
* This icon will not display in a popup window, nor if the weblink is trashed.
|
||||||
|
* Edit access checks must be performed in the calling code.
|
||||||
|
*
|
||||||
|
* @param object $weblink The weblink information
|
||||||
|
* @param Registry $params The item parameters
|
||||||
|
* @param array $attribs Optional attributes for the link
|
||||||
|
* @param boolean $legacy True to use legacy images, false to use icomoon based graphic
|
||||||
|
*
|
||||||
|
* @return string The HTML for the weblink edit icon.
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public static function edit($weblink, $params, $attribs = array(), $legacy = false)
|
||||||
|
{
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
$uri = Uri::getInstance();
|
||||||
|
|
||||||
|
// Ignore if in a popup window.
|
||||||
|
if ($params && $params->get('popup'))
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore if the state is negative (trashed).
|
||||||
|
if ($weblink->state < 0)
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show checked_out icon if the contact is checked out by a different user
|
||||||
|
if (property_exists($weblink, 'checked_out')
|
||||||
|
&& property_exists($weblink, 'checked_out_time')
|
||||||
|
&& $weblink->checked_out
|
||||||
|
&& $weblink->checked_out !== $user->get('id'))
|
||||||
|
{
|
||||||
|
$checkoutUser = Factory::getUser($weblink->checked_out);
|
||||||
|
$date = HTMLHelper::_('date', $weblink->checked_out_time);
|
||||||
|
$tooltip = Text::sprintf('COM_WEBLINKS_CHECKED_OUT_BY', $checkoutUser->name)
|
||||||
|
. ' <br> ' . $date;
|
||||||
|
|
||||||
|
$text = LayoutHelper::render('joomla.content.icons.edit_lock', array('contact' => $weblink, 'tooltip' => $tooltip, 'legacy' => $legacy));
|
||||||
|
|
||||||
|
$attribs['aria-describedby'] = 'editweblink-' . (int) $weblink->id;
|
||||||
|
$output = HTMLHelper::_('link', '#', $text, $attribs);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$weblinkUrl = RouteHelper::getWeblinkRoute($weblink->slug, $weblink->catid, $weblink->language);
|
||||||
|
$url = $weblinkUrl . '&task=weblink.edit&w_id=' . $weblink->id . '&return=' . base64_encode($uri);
|
||||||
|
|
||||||
|
if ((int) $weblink->state === 0)
|
||||||
|
{
|
||||||
|
$tooltip = Text::_('COM_WEBLINKS_EDIT_UNPUBLISHED_WEBLINK');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tooltip = Text::_('COM_WEBLINKS_EDIT_PUBLISHED_WEBLINK');
|
||||||
|
}
|
||||||
|
|
||||||
|
$nowDate = strtotime(Factory::getDate());
|
||||||
|
$icon = $weblink->state ? 'edit' : 'eye-slash';
|
||||||
|
|
||||||
|
if (($weblink->publish_up !== null && strtotime($weblink->publish_up) > $nowDate)
|
||||||
|
|| ($weblink->publish_down !== null && strtotime($weblink->publish_down) < $nowDate
|
||||||
|
&& $weblink->publish_down !== Factory::getDbo()->getNullDate()))
|
||||||
|
{
|
||||||
|
$icon = 'eye-slash';
|
||||||
|
}
|
||||||
|
|
||||||
|
$aria_described = 'editweblink-' . (int) $weblink->id;
|
||||||
|
|
||||||
|
$text = '<span class="icon-' . $icon . '" aria-hidden="true"></span>';
|
||||||
|
$text .= Text::_('JGLOBAL_EDIT');
|
||||||
|
$text .= '<div role="tooltip" id="' . $aria_described . '">' . $tooltip . '</div>';
|
||||||
|
|
||||||
|
$attribs['aria-describedby'] = $aria_described;
|
||||||
|
$output = HTMLHelper::_('link', Route::_($url), $text, $attribs);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,292 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\Table;
|
||||||
|
|
||||||
|
use Joomla\CMS\Application\ApplicationHelper;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Filter\InputFilter;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\String\PunycodeHelper;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\CMS\Tag\TaggableTableInterface;
|
||||||
|
use Joomla\CMS\Tag\TaggableTableTrait;
|
||||||
|
use Joomla\CMS\Versioning\VersionableTableInterface;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
|
use Joomla\String\StringHelper;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblink Table class
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class WeblinkTable extends Table implements VersionableTableInterface, TaggableTableInterface
|
||||||
|
{
|
||||||
|
use TaggableTableTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that columns fully support the NULL value in the database
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
|
*/
|
||||||
|
protected $_supportNullValue = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the params and metadata in json encoded in the bind method
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 3.4
|
||||||
|
*/
|
||||||
|
protected $_jsonEncode = array('params', 'metadata', 'images');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param \JDatabaseDriver &$db A database connector object
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function __construct(&$db)
|
||||||
|
{
|
||||||
|
$this->typeAlias = 'com_weblinks.weblink';
|
||||||
|
|
||||||
|
parent::__construct('#__weblinks', 'id', $db);
|
||||||
|
|
||||||
|
// Set the published column alias
|
||||||
|
$this->setColumnAlias('published', 'state');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overload the store method for the Weblinks table.
|
||||||
|
*
|
||||||
|
* @param boolean $updateNulls Toggle whether null values should be updated.
|
||||||
|
*
|
||||||
|
* @return boolean True on success, false on failure.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function store($updateNulls = true)
|
||||||
|
{
|
||||||
|
$date = Factory::getDate()->toSql();
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
$this->modified = $date;
|
||||||
|
|
||||||
|
if ($this->id)
|
||||||
|
{
|
||||||
|
// Existing item
|
||||||
|
$this->modified_by = $user->id;
|
||||||
|
$this->modified = $date;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// New weblink. A weblink created and created_by field can be set by the user,
|
||||||
|
// so we don't touch either of these if they are set.
|
||||||
|
if (!(int) $this->created)
|
||||||
|
{
|
||||||
|
$this->created = $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->created_by))
|
||||||
|
{
|
||||||
|
$this->created_by = $user->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(int) $this->modified)
|
||||||
|
{
|
||||||
|
$this->modified = $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->modified_by))
|
||||||
|
{
|
||||||
|
$this->modified_by = $user->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->hits))
|
||||||
|
{
|
||||||
|
$this->hits = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set publish_up to null if not set
|
||||||
|
if (!$this->publish_up)
|
||||||
|
{
|
||||||
|
$this->publish_up = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set publish_down to null if not set
|
||||||
|
if (!$this->publish_down)
|
||||||
|
{
|
||||||
|
$this->publish_down = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the alias is unique
|
||||||
|
$table = new WeblinkTable($this->getDbo());
|
||||||
|
|
||||||
|
if ($table->load(array('language' => $this->language, 'alias' => $this->alias, 'catid' => (int) $this->catid))
|
||||||
|
&& ($table->id != $this->id || $this->id == 0))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert IDN urls to punycode
|
||||||
|
$this->url = PunycodeHelper::urlToPunycode($this->url);
|
||||||
|
|
||||||
|
return parent::store($updateNulls);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloaded check method to ensure data integrity.
|
||||||
|
*
|
||||||
|
* @return boolean True on success.
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
public function check()
|
||||||
|
{
|
||||||
|
if (InputFilter::checkAttribute(array('href', $this->url)))
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_WEBLINKS_ERR_TABLES_PROVIDE_URL'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for valid name
|
||||||
|
if (trim($this->title) == '')
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for existing name
|
||||||
|
$db = $this->getDbo();
|
||||||
|
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select($db->quoteName('id'))
|
||||||
|
->from($db->quoteName('#__weblinks'))
|
||||||
|
->where($db->quoteName('title') . ' = :title')
|
||||||
|
->where($db->quoteName('language') . ' = :language')
|
||||||
|
->where($db->quoteName('catid') . ' = :catid')
|
||||||
|
->bind(':title', $this->title)
|
||||||
|
->bind(':language', $this->language)
|
||||||
|
->bind(':catid', $this->catid, ParameterType::INTEGER);
|
||||||
|
$db->setQuery($query);
|
||||||
|
|
||||||
|
$xid = (int) $db->loadResult();
|
||||||
|
|
||||||
|
if ($xid && $xid != (int) $this->id)
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('COM_WEBLINKS_ERR_TABLES_NAME'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->alias))
|
||||||
|
{
|
||||||
|
$this->alias = $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->alias = ApplicationHelper::stringURLSafe($this->alias, $this->language);
|
||||||
|
|
||||||
|
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||||
|
{
|
||||||
|
$this->alias = Factory::getDate()->format("Y-m-d-H-i-s");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the publish down date is not earlier than publish up.
|
||||||
|
if ((int) $this->publish_down > 0 && $this->publish_down < $this->publish_up)
|
||||||
|
{
|
||||||
|
$this->setError(Text::_('JGLOBAL_START_PUBLISH_AFTER_FINISH'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Clean up keywords -- eliminate extra spaces between phrases
|
||||||
|
* and cr (\r) and lf (\n) characters from string
|
||||||
|
*/
|
||||||
|
if (!empty($this->metakey))
|
||||||
|
{
|
||||||
|
// Array of characters to remove
|
||||||
|
$bad_characters = array("\n", "\r", "\"", "<", ">");
|
||||||
|
$after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey);
|
||||||
|
$keys = explode(',', $after_clean);
|
||||||
|
$clean_keys = array();
|
||||||
|
|
||||||
|
foreach ($keys as $key)
|
||||||
|
{
|
||||||
|
// Ignore blank keywords
|
||||||
|
if (trim($key))
|
||||||
|
{
|
||||||
|
$clean_keys[] = trim($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put array back together delimited by ", "
|
||||||
|
$this->metakey = implode(", ", $clean_keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure any new items have compulsory fields set. This is needed for things like
|
||||||
|
* frontend editing where we don't show all the fields or using some kind of API
|
||||||
|
*/
|
||||||
|
if (!$this->id)
|
||||||
|
{
|
||||||
|
if (!isset($this->xreference))
|
||||||
|
{
|
||||||
|
$this->xreference = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->metakey))
|
||||||
|
{
|
||||||
|
$this->metakey = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->metadesc))
|
||||||
|
{
|
||||||
|
$this->metadesc = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->images))
|
||||||
|
{
|
||||||
|
$this->images = '{}';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->metadata))
|
||||||
|
{
|
||||||
|
$this->metadata = '{}';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->params))
|
||||||
|
{
|
||||||
|
$this->params = '{}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::check();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type alias for the history table
|
||||||
|
*
|
||||||
|
* @return string The alias as described above
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function getTypeAlias()
|
||||||
|
{
|
||||||
|
return $this->typeAlias;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\View\Weblink;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Helper\ContentHelper;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\View\GenericDataException;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View to edit a weblink.
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class HtmlView extends BaseHtmlView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Form object
|
||||||
|
*
|
||||||
|
* @var \Joomla\CMS\Form\Form
|
||||||
|
*/
|
||||||
|
protected $form;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The active item
|
||||||
|
*
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
protected $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model state
|
||||||
|
*
|
||||||
|
* @var \Joomla\CMS\Object\CMSObject
|
||||||
|
*/
|
||||||
|
protected $state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the view.
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
$this->state = $this->get('State');
|
||||||
|
$this->item = $this->get('Item');
|
||||||
|
$this->form = $this->get('Form');
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
throw new GenericDataException(implode("\n", $errors), 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are forcing a language in modal (used for associations).
|
||||||
|
if ($this->getLayout() === 'modal' && $forcedLanguage = Factory::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();
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the page title and toolbar.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function addToolbar()
|
||||||
|
{
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
$app->input->set('hidemainmenu', true);
|
||||||
|
|
||||||
|
$user = $app->getIdentity();
|
||||||
|
$isNew = ($this->item->id == 0);
|
||||||
|
$checkedOut = $this->item->checked_out && $this->item->checked_out !== $user->get('id');
|
||||||
|
|
||||||
|
// Since we don't track these assets at the item level, use the category id.
|
||||||
|
$canDo = ContentHelper::getActions('com_weblinks', 'category', $this->item->catid);
|
||||||
|
|
||||||
|
ToolbarHelper::title($isNew ? Text::_('COM_WEBLINKS_MANAGER_WEBLINK_NEW') : Text::_('COM_WEBLINKS_MANAGER_WEBLINK_EDIT'), 'link weblinks');
|
||||||
|
|
||||||
|
// Build the actions for new and existing records.
|
||||||
|
if ($isNew)
|
||||||
|
{
|
||||||
|
// For new records, check the create permission.
|
||||||
|
if (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0)
|
||||||
|
{
|
||||||
|
ToolbarHelper::apply('weblink.apply');
|
||||||
|
|
||||||
|
ToolbarHelper::saveGroup(
|
||||||
|
[
|
||||||
|
['save', 'weblink.save'],
|
||||||
|
['save2new', 'weblink.save2new']
|
||||||
|
],
|
||||||
|
'btn-success'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarHelper::cancel('weblink.cancel');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Since it's an existing record, check the edit permission, or fall back to edit own if the owner.
|
||||||
|
$itemEditable = $canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_by == $user->id);
|
||||||
|
|
||||||
|
$toolbarButtons = [];
|
||||||
|
|
||||||
|
// Can't save the record if it's checked out and editable
|
||||||
|
if (!$checkedOut && $itemEditable)
|
||||||
|
{
|
||||||
|
ToolbarHelper::apply('weblink.apply');
|
||||||
|
|
||||||
|
$toolbarButtons[] = ['save', 'weblink.save'];
|
||||||
|
|
||||||
|
// We can save this record, but check the create permission to see if we can return to make a new one.
|
||||||
|
if ($canDo->get('core.create'))
|
||||||
|
{
|
||||||
|
$toolbarButtons[] = ['save2new', 'weblink.save2new'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If checked out, we can still save
|
||||||
|
if ($canDo->get('core.create'))
|
||||||
|
{
|
||||||
|
$toolbarButtons[] = ['save2copy', 'weblink.save2copy'];
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarHelper::saveGroup(
|
||||||
|
$toolbarButtons,
|
||||||
|
'btn-success'
|
||||||
|
);
|
||||||
|
|
||||||
|
ToolbarHelper::cancel('weblink.cancel', 'JTOOLBAR_CLOSE');
|
||||||
|
|
||||||
|
if (ComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $itemEditable)
|
||||||
|
{
|
||||||
|
ToolbarHelper::versions('com_weblinks.weblink', $this->item->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Associations::isEnabled() && ComponentHelper::isEnabled('com_associations'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::custom('weblink.editAssociations', 'contract', '', 'JTOOLBAR_ASSOCIATIONS', false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Administrator\View\Weblinks;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Helper\ContentHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\View\GenericDataException;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
use Joomla\CMS\Toolbar\Toolbar;
|
||||||
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View class for a list of weblinks.
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class HtmlView extends BaseHtmlView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* An array of items
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The pagination object
|
||||||
|
*
|
||||||
|
* @var \Joomla\CMS\Pagination\Pagination
|
||||||
|
*/
|
||||||
|
protected $pagination;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model state
|
||||||
|
*
|
||||||
|
* @var \Joomla\CMS\Object\CMSObject
|
||||||
|
*/
|
||||||
|
protected $state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form object for search filters
|
||||||
|
*
|
||||||
|
* @var \Joomla\CMS\Form\Form
|
||||||
|
*/
|
||||||
|
public $filterForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The active search filters
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $activeFilters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the view.
|
||||||
|
*
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
$this->state = $this->get('State');
|
||||||
|
$this->items = $this->get('Items');
|
||||||
|
$this->pagination = $this->get('Pagination');
|
||||||
|
$this->filterForm = $this->get('FilterForm');
|
||||||
|
$this->activeFilters = $this->get('ActiveFilters');
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
throw new GenericDataException(implode("\n", $errors), 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't need toolbar in the modal layout.
|
||||||
|
if ($this->getLayout() !== 'modal')
|
||||||
|
{
|
||||||
|
$this->addToolbar();
|
||||||
|
}
|
||||||
|
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 = Factory::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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the page title and toolbar.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function addToolbar()
|
||||||
|
{
|
||||||
|
$canDo = ContentHelper::getActions('com_weblinks', 'category', $this->state->get('filter.category_id'));
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
// Get the toolbar object instance
|
||||||
|
$toolbar = Toolbar::getInstance('toolbar');
|
||||||
|
|
||||||
|
ToolbarHelper::title(Text::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks');
|
||||||
|
|
||||||
|
if ($canDo->get('core.create') || \count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0)
|
||||||
|
{
|
||||||
|
ToolbarHelper::addNew('weblink.add');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($canDo->get('core.edit.state'))
|
||||||
|
{
|
||||||
|
$dropdown = $toolbar->dropdownButton('status-group')
|
||||||
|
->text('JTOOLBAR_CHANGE_STATUS')
|
||||||
|
->toggleSplit(false)
|
||||||
|
->icon('icon-ellipsis-h')
|
||||||
|
->buttonClass('btn btn-action')
|
||||||
|
->listCheck(true);
|
||||||
|
|
||||||
|
$childBar = $dropdown->getChildToolbar();
|
||||||
|
|
||||||
|
$childBar->publish('weblinks.publish')->listCheck(true);
|
||||||
|
|
||||||
|
$childBar->unpublish('weblinks.unpublish')->listCheck(true);
|
||||||
|
|
||||||
|
$childBar->archive('weblinks.archive')->listCheck(true);
|
||||||
|
|
||||||
|
if ($user->authorise('core.admin'))
|
||||||
|
{
|
||||||
|
$childBar->checkin('weblinks.checkin')->listCheck(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->state->get('filter.published') != -2)
|
||||||
|
{
|
||||||
|
$childBar->trash('weblinks.trash')->listCheck(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a batch button
|
||||||
|
if ($user->authorise('core.create', 'com_weblinks')
|
||||||
|
&& $user->authorise('core.edit', 'com_weblinks')
|
||||||
|
&& $user->authorise('core.edit.state', 'com_weblinks'))
|
||||||
|
{
|
||||||
|
$childBar->popupButton('batch')
|
||||||
|
->text('JTOOLBAR_BATCH')
|
||||||
|
->selector('collapseModal')
|
||||||
|
->listCheck(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete'))
|
||||||
|
{
|
||||||
|
$toolbar->delete('weblinks.delete')
|
||||||
|
->text('JTOOLBAR_EMPTY_TRASH')
|
||||||
|
->message('JGLOBAL_CONFIRM_DELETE')
|
||||||
|
->listCheck(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->authorise('core.admin', 'com_weblinks') || $user->authorise('core.options', 'com_weblinks'))
|
||||||
|
{
|
||||||
|
ToolbarHelper::preferences('com_weblinks');
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,18 +9,23 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
JHtml::_('behavior.formvalidator');
|
HTMLHelper::_('behavior.formvalidator');
|
||||||
JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 ));
|
|
||||||
|
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$input = $app->input;
|
$input = $app->input;
|
||||||
|
|
||||||
$assoc = JLanguageAssociations::isEnabled();
|
$assoc = Associations::isEnabled();
|
||||||
|
|
||||||
// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
|
// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
|
||||||
$this->ignore_fieldsets = array('details', 'images', 'item_associations', 'jmetadata');
|
$this->ignore_fieldsets = array('details', 'images', 'item_associations', 'jmetadata');
|
||||||
|
$this->useCoreUI = true;
|
||||||
|
|
||||||
// In case of modal
|
// In case of modal
|
||||||
$isModal = $input->get('layout') == 'modal' ? true : false;
|
$isModal = $input->get('layout') == 'modal' ? true : false;
|
||||||
|
@ -28,65 +33,83 @@ $layout = $isModal ? 'modal' : 'edit';
|
||||||
$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
|
$tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<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">
|
<form action="<?php echo Route::_('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); ?>
|
<?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
|
||||||
|
|
||||||
<div class="form-horizontal">
|
<div class="main-card">
|
||||||
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
|
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', array('active' => 'details')); ?>
|
||||||
|
|
||||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', empty($this->item->id) ? JText::_('COM_WEBLINKS_NEW_WEBLINK', true) : JText::_('COM_WEBLINKS_EDIT_WEBLINK', true)); ?>
|
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', empty($this->item->id) ? Text::_('COM_WEBLINKS_NEW_WEBLINK', true) : Text::_('COM_WEBLINKS_EDIT_WEBLINK', true)); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="form-vertical">
|
<div class="form-vertical">
|
||||||
<?php echo $this->form->renderField('url'); ?>
|
<div>
|
||||||
<?php echo $this->form->renderField('description'); ?>
|
<fieldset class="adminform">
|
||||||
|
<?php echo $this->form->renderField('url'); ?>
|
||||||
|
<?php echo $this->form->renderField('description'); ?>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<?php echo JLayoutHelper::render('joomla.edit.global', $this); ?>
|
<?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||||
|
|
||||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'images', JText::_('JGLOBAL_FIELDSET_IMAGE_OPTIONS', true)); ?>
|
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'images', Text::_('JGLOBAL_FIELDSET_IMAGE_OPTIONS', true)); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<fieldset id="fieldset-image; ?>" class="options-form">
|
||||||
|
<legend><?php echo Text::_('JGLOBAL_FIELDSET_IMAGE_OPTIONS'); ?></legend>
|
||||||
|
<div>
|
||||||
|
<?php echo $this->form->renderField('imaJGLOBAL_FIELDSET_IMAGE_OPTIONSges'); ?>
|
||||||
|
<?php foreach ($this->form->getGroup('images') as $field) : ?>
|
||||||
|
<?php echo $field->renderField(); ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||||
|
|
||||||
|
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'publishing', Text::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-12 col-lg-6">
|
||||||
<?php echo $this->form->renderField('images'); ?>
|
<fieldset id="fieldset-publishingdata" class="options-form">
|
||||||
<?php foreach ($this->form->getGroup('images') as $field) : ?>
|
<legend><?php echo Text::_('JGLOBAL_FIELDSET_PUBLISHING'); ?></legend>
|
||||||
<?php echo $field->renderField(); ?>
|
<?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
|
||||||
<?php endforeach; ?>
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
<fieldset id="fieldset-metadata" class="options-form">
|
||||||
|
<legend><?php echo Text::_('JGLOBAL_FIELDSET_METADATA_OPTIONS'); ?></legend>
|
||||||
|
<?php echo LayoutHelper::render('joomla.edit.metadata', $this); ?>
|
||||||
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||||
|
|
||||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
|
||||||
|
|
||||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
|
|
||||||
<div class="row form-horizontal-desktop">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<?php echo JLayoutHelper::render('joomla.edit.publishingdata', $this); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<?php echo JLayoutHelper::render('joomla.edit.metadata', $this); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
|
||||||
|
|
||||||
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
|
||||||
|
|
||||||
<?php if (!$isModal && $assoc) : ?>
|
<?php if (!$isModal && $assoc) : ?>
|
||||||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
|
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'associations', Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
|
||||||
<?php echo $this->loadTemplate('associations'); ?>
|
<fieldset id="fieldset-associations" class="options-form">
|
||||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
<legend><?php echo Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS'); ?></legend>
|
||||||
|
<?php echo LayoutHelper::render('joomla.edit.associations', $this); ?>
|
||||||
|
</fieldset>
|
||||||
|
<?php echo HTMLHelper::_('uitab.endTab'); ?>
|
||||||
<?php elseif ($isModal && $assoc) : ?>
|
<?php elseif ($isModal && $assoc) : ?>
|
||||||
<div class="hidden"><?php echo $this->loadTemplate('associations'); ?></div>
|
<div class="hidden"><?php echo $this->loadTemplate('associations'); ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
<?php echo HTMLHelper::_('uitab.endTabSet'); ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="task" value="" />
|
<input type="hidden" name="task" value="" />
|
||||||
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>" />
|
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>" />
|
||||||
<?php echo JHtml::_('form.token'); ?>
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
echo JLayoutHelper::render('joomla.edit.associations', $this);
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
echo LayoutHelper::render('joomla.edit.associations', $this);
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
echo JLayoutHelper::render('joomla.edit.metadata', $this);
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
echo LayoutHelper::render('joomla.edit.metadata', $this);
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
|
||||||
$fieldSets = $this->form->getFieldsets('params'); ?>
|
$fieldSets = $this->form->getFieldsets('params'); ?>
|
||||||
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
|
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
|
||||||
<div class="tab-pane" id="params-<?php echo $name; ?>">
|
<div class="tab-pane" id="params-<?php echo $name; ?>">
|
||||||
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
|
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
|
||||||
<?php echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>'; ?>
|
<?php echo '<p class="alert alert-info">' . $this->escape(Text::_($fieldSet->description)) . '</p>'; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -7,13 +7,17 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
|
||||||
|
HTMLHelper::_('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.
|
// @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 = Factory::getApplication()->input->getCmd('function', 'jEditWeblink_' . (int) $this->item->id);
|
||||||
|
|
||||||
// Function to update input title when changed
|
// Function to update input title when changed
|
||||||
JFactory::getDocument()->addScriptDeclaration('
|
Factory::getDocument()->addScriptDeclaration('
|
||||||
function jEditWeblinkModal() {
|
function jEditWeblinkModal() {
|
||||||
if (window.parent && document.formvalidator.isValid(document.getElementById("weblink-form"))) {
|
if (window.parent && document.formvalidator.isValid(document.getElementById("weblink-form"))) {
|
||||||
return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value);
|
return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value);
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
echo JLayoutHelper::render('joomla.edit.associations', $this);
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
echo LayoutHelper::render('joomla.edit.associations', $this);
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
echo JLayoutHelper::render('joomla.edit.metadata', $this);
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
echo LayoutHelper::render('joomla.edit.metadata', $this);
|
||||||
|
|
|
@ -9,11 +9,13 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
|
||||||
$fieldSets = $this->form->getFieldsets('params'); ?>
|
$fieldSets = $this->form->getFieldsets('params'); ?>
|
||||||
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
|
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
|
||||||
<div class="tab-pane" id="params-<?php echo $name; ?>">
|
<div class="tab-pane" id="params-<?php echo $name; ?>">
|
||||||
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
|
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
|
||||||
<?php echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>'; ?>
|
<?php echo '<p class="alert alert-info">' . $this->escape(Text::_($fieldSet->description)) . '</p>'; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -9,181 +9,190 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Associations;
|
||||||
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
JHtml::_('bootstrap.tooltip');
|
/** @var \Joomla\Component\Weblinks\Administrator\View\Weblinks\HtmlView $this */
|
||||||
JHtml::_('behavior.multiselect');
|
|
||||||
JHtml::_('formbehavior.chosen', 'select');
|
|
||||||
|
|
||||||
$user = JFactory::getUser();
|
HTMLHelper::_('behavior.multiselect');
|
||||||
|
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
$userId = $user->get('id');
|
$userId = $user->get('id');
|
||||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||||
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
|
|
||||||
$saveOrder = $listOrder == 'a.ordering';
|
$saveOrder = $listOrder == 'a.ordering';
|
||||||
$assoc = JLanguageAssociations::isEnabled();
|
$assoc = Associations::isEnabled();
|
||||||
|
|
||||||
if ($saveOrder)
|
if ($saveOrder && !empty($this->items))
|
||||||
{
|
{
|
||||||
$saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
|
$saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
|
||||||
JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
|
HTMLHelper::_('draggablelist.draggable');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
|
<form action="<?php echo Route::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<?php if (!empty($this->sidebar)) : ?>
|
<div class="col-md-12">
|
||||||
<div id="j-sidebar-container" class="col-md-2">
|
<div id="j-main-container" class="j-main-container">
|
||||||
<?php echo $this->sidebar; ?>
|
<?php
|
||||||
</div>
|
// Search tools bar
|
||||||
<div id="j-main-container" class="col-md-10">
|
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
|
||||||
<?php else : ?>
|
?>
|
||||||
<div id="j-main-container">
|
<?php if (empty($this->items)) : ?>
|
||||||
<?php endif;?>
|
<div class="alert alert-info">
|
||||||
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||||
<div class="clearfix"> </div>
|
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
<?php if (empty($this->items)) : ?>
|
</div>
|
||||||
<div class="alert alert-no-items">
|
<?php else : ?>
|
||||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
<table class="table" id="weblinkList">
|
||||||
</div>
|
<caption class="visually-hidden">
|
||||||
<?php else : ?>
|
<?php echo Text::_('COM_WEBLINKS_WEBLINKS_TABLE_CAPTION'); ?>,
|
||||||
<table class="table table-striped" id="weblinkList">
|
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||||
<thead>
|
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||||
<tr>
|
</caption>
|
||||||
<th width="1%" class="nowrap center hidden-phone">
|
<thead>
|
||||||
<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
<tr>
|
||||||
</th>
|
<td class="w-1 text-center">
|
||||||
<th width="1%" class="nowrap center">
|
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||||
<?php echo JHtml::_('grid.checkall'); ?>
|
|
||||||
</th>
|
|
||||||
<th width="1%" class="nowrap center">
|
|
||||||
<?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', 'access_level', $listDirn, $listOrder); ?>
|
|
||||||
</th>
|
|
||||||
<th width="5%" class="nowrap center hidden-phone">
|
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
|
||||||
</th>
|
|
||||||
<?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>
|
|
||||||
<th width="1%" class="nowrap center hidden-phone">
|
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="8">
|
|
||||||
<?php echo $this->pagination->getListFooter(); ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<?php foreach ($this->items as $i => $item) : ?>
|
|
||||||
<?php $ordering = ($listOrder == 'a.ordering'); ?>
|
|
||||||
<?php $item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]=' . $item->catid); ?>
|
|
||||||
<?php $canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid); ?>
|
|
||||||
<?php $canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid); ?>
|
|
||||||
<?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; ?>
|
|
||||||
<?php $canEditOwn = $user->authorise('core.edit.own', 'com_weblinks.category.' . $item->catid) && $item->created_by == $user->id; ?>
|
|
||||||
<?php $canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin; ?>
|
|
||||||
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid; ?>">
|
|
||||||
<td class="order nowrap center hidden-phone">
|
|
||||||
<?php $iconClass = ''; ?>
|
|
||||||
<?php if (!$canChange) : ?>
|
|
||||||
<?php $iconClass = ' inactive'; ?>
|
|
||||||
<?php elseif (!$saveOrder) : ?>
|
|
||||||
<?php $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<span class="sortable-handler<?php echo $iconClass ?>">
|
|
||||||
<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 " />
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td class="center">
|
|
||||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
|
||||||
</td>
|
|
||||||
<td class="center">
|
|
||||||
<div class="btn-group">
|
|
||||||
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
|
||||||
<?php // Create dropdown items and render the dropdown list. ?>
|
|
||||||
<?php if ($canChange) : ?>
|
|
||||||
<?php JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'weblinks'); ?>
|
|
||||||
<?php JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'weblinks'); ?>
|
|
||||||
<?php echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="nowrap has-context">
|
|
||||||
<?php if ($item->checked_out) : ?>
|
|
||||||
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'weblinks.', $canCheckin); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($canEdit || $canEditOwn) : ?>
|
|
||||||
<a href="<?php echo JRoute::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id); ?>">
|
|
||||||
<?php echo $this->escape($item->title); ?></a>
|
|
||||||
<?php else : ?>
|
|
||||||
<?php echo $this->escape($item->title); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<span class="small">
|
|
||||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
|
||||||
</span>
|
|
||||||
<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="center hidden-phone">
|
|
||||||
<?php echo $item->hits; ?>
|
|
||||||
</td>
|
|
||||||
<?php if ($assoc) : ?>
|
|
||||||
<td class="hidden-phone hidden-tablet">
|
|
||||||
<?php if ($item->association) : ?>
|
|
||||||
<?php echo JHtml::_('weblink.association', $item->id); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
</td>
|
||||||
<?php endif; ?>
|
<th scope="col" class="w-1 text-center d-none d-md-table-cell">
|
||||||
<td class="small hidden-phone">
|
<?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
||||||
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
|
</th>
|
||||||
</td>
|
<th scope="col" style="min-width:85px" class="w-1 text-center">
|
||||||
<td class="center hidden-phone">
|
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||||
<?php echo (int) $item->id; ?>
|
</th>
|
||||||
</td>
|
<th scope="col">
|
||||||
</tr>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||||
<?php endforeach; ?>
|
</th>
|
||||||
</tbody>
|
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||||
</table>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
|
||||||
<?php // Load the batch processing form. ?>
|
</th>
|
||||||
<?php if ($user->authorise('core.create', 'com_content')
|
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||||
&& $user->authorise('core.edit', 'com_content')
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||||
&& $user->authorise('core.edit.state', 'com_content')) : ?>
|
</th>
|
||||||
<?php echo JHtml::_(
|
<?php if ($assoc) : ?>
|
||||||
'bootstrap.renderModal',
|
<th scope="col" class="w-10">
|
||||||
'collapseModal',
|
<?php echo HTMLHelper::_('searchtools.sort', 'COM_WEBLINKS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
|
||||||
array(
|
</th>
|
||||||
'title' => JText::_('COM_WEBLINKS_BATCH_OPTIONS'),
|
<?php endif; ?>
|
||||||
'footer' => $this->loadTemplate('batch_footer'),
|
<?php if (Multilanguage::isEnabled()) : ?>
|
||||||
),
|
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||||
$this->loadTemplate('batch_body')
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
|
||||||
); ?>
|
</th>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<th scope="col" class="w-5 d-none d-md-table-cell">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody <?php if ($saveOrder) :?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"<?php endif; ?>>
|
||||||
|
<?php foreach ($this->items as $i => $item) : ?>
|
||||||
|
<?php $ordering = ($listOrder == 'a.ordering'); ?>
|
||||||
|
<?php $item->cat_link = Route::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]=' . $item->catid); ?>
|
||||||
|
<?php $canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid); ?>
|
||||||
|
<?php $canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid); ?>
|
||||||
|
<?php $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || !$item->checked_out; ?>
|
||||||
|
<?php $canEditOwn = $user->authorise('core.edit.own', 'com_weblinks.category.' . $item->catid) && $item->created_by == $user->id; ?>
|
||||||
|
<?php $canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin; ?>
|
||||||
|
<tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->catid; ?>">
|
||||||
|
<td class="text-center">
|
||||||
|
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
|
||||||
|
</td>
|
||||||
|
<td class="text-center d-none d-md-table-cell">
|
||||||
|
<?php
|
||||||
|
$iconClass = '';
|
||||||
|
if (!$canChange)
|
||||||
|
{
|
||||||
|
$iconClass = ' inactive';
|
||||||
|
}
|
||||||
|
elseif (!$saveOrder)
|
||||||
|
{
|
||||||
|
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<span class="sortable-handler<?php echo $iconClass; ?>">
|
||||||
|
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
||||||
|
</span>
|
||||||
|
<?php if ($canChange && $saveOrder) : ?>
|
||||||
|
<input type="text" name="order[]" size="5"
|
||||||
|
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden">
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||||
|
</td>
|
||||||
|
<th scope="row" class="has-context">
|
||||||
|
<div>
|
||||||
|
<?php if ($item->checked_out) : ?>
|
||||||
|
<?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'weblinks.', $canCheckin); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($canEdit || $canEditOwn) : ?>
|
||||||
|
<a href="<?php echo Route::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
|
||||||
|
<?php echo $this->escape($item->title); ?></a>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php echo $this->escape($item->title); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="small">
|
||||||
|
<?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||||
|
</span>
|
||||||
|
<div class="small">
|
||||||
|
<?php echo Text::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
<td class="small d-none d-md-table-cell">
|
||||||
|
<?php echo $this->escape($item->access_level); ?>
|
||||||
|
</td>
|
||||||
|
<td class="d-none d-md-table-cell">
|
||||||
|
<?php echo $item->hits; ?>
|
||||||
|
</td>
|
||||||
|
<?php if ($assoc) : ?>
|
||||||
|
<td class="hidden-phone hidden-tablet">
|
||||||
|
<?php if ($item->association) : ?>
|
||||||
|
<?php echo HTMLHelper::_('weblinksadministrator.association', $item->id); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (Multilanguage::isEnabled()) : ?>
|
||||||
|
<td class="small d-none d-md-table-cell">
|
||||||
|
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
<td class="d-none d-md-table-cell">
|
||||||
|
<?php echo (int) $item->id; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<input type="hidden" name="task" value="" />
|
<?php // Load the pagination. ?>
|
||||||
<input type="hidden" name="boxchecked" value="0" />
|
<?php echo $this->pagination->getListFooter(); ?>
|
||||||
<?php echo JHtml::_('form.token'); ?>
|
|
||||||
|
<?php // Load the batch processing form. ?>
|
||||||
|
<?php if ($user->authorise('core.create', 'com_weblinks')
|
||||||
|
&& $user->authorise('core.edit', 'com_weblinks')
|
||||||
|
&& $user->authorise('core.edit.state', 'com_weblinks')) : ?>
|
||||||
|
<?php echo HTMLHelper::_(
|
||||||
|
'bootstrap.renderModal',
|
||||||
|
'collapseModal',
|
||||||
|
[
|
||||||
|
'title' => Text::_('COM_WEBLINKS_BATCH_OPTIONS'),
|
||||||
|
'footer' => $this->loadTemplate('batch_footer')
|
||||||
|
],
|
||||||
|
$this->loadTemplate('batch_body')
|
||||||
|
); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<input type="hidden" name="task" value="">
|
||||||
|
<input type="hidden" name="boxchecked" value="0">
|
||||||
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?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\CMS\Language\Multilanguage;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
$published = $this->state->get('filter.published');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="row">
|
||||||
|
<?php if (Multilanguage::isEnabled()) : ?>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<div class="controls">
|
||||||
|
<?php echo LayoutHelper::render('joomla.html.batch.language', []); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<div class="controls">
|
||||||
|
<?php echo LayoutHelper::render('joomla.html.batch.access', []); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<?php if ($published >= 0) : ?>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<div class="controls">
|
||||||
|
<?php echo LayoutHelper::render('joomla.html.batch.item', ['extension' => 'com_weblinks']); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<div class="controls">
|
||||||
|
<?php echo LayoutHelper::render('joomla.html.batch.tag', []); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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\CMS\Language\Text;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
|
||||||
|
<?php echo Text::_('JCANCEL'); ?>
|
||||||
|
</button>
|
||||||
|
<button type="submit" id='batch-submit-button-id' class="btn btn-success" onclick="Joomla.submitbutton('weblink.batch');return false;">
|
||||||
|
<?php echo Text::_('JGLOBAL_BATCH_PROCESS'); ?>
|
||||||
|
</button>
|
|
@ -6,39 +6,41 @@
|
||||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
$app = JFactory::getApplication();
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\CMS\Session\Session;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
|
||||||
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
if ($app->isClient('site'))
|
if ($app->isClient('site'))
|
||||||
{
|
{
|
||||||
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
|
Session::checkToken('get') or die(Text::_('JINVALID_TOKEN'));
|
||||||
}
|
}
|
||||||
JLoader::register('WeblinksHelperRoute', JPATH_ROOT . '/components/com_weblinks/helpers/route.php');
|
|
||||||
|
|
||||||
// Include the component HTML helpers.
|
HTMLHelper::_('behavior.multiselect');
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
$this->document->getWebAssetManager()
|
||||||
JHtml::_('behavior.core');
|
->registerAndUseScript('com_weblinks.admin-weblinks-modal', 'media/com_weblinks/js/admin-weblinks-modal.js', [], ['defer' => true], ['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');
|
$function = $app->input->getCmd('function', 'jSelectWeblink');
|
||||||
$editor = $app->input->getCmd('editor', '');
|
$editor = $app->input->getCmd('editor', '');
|
||||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||||
$onclick = $this->escape($function);
|
$onclick = $this->escape($function);
|
||||||
|
$multilang = Multilanguage::isEnabled();
|
||||||
|
|
||||||
if (!empty($editor))
|
if (!empty($editor))
|
||||||
{
|
{
|
||||||
// This view is used also in com_menus. Load the xtd script only if the editor is set!
|
// 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));
|
$this->document->addScriptOptions('xtd-weblinks', array('editor' => $editor));
|
||||||
$onclick = "jSelectWeblink";
|
$onclick = "jSelectWeblink";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,48 +54,49 @@ $iconStates = array(
|
||||||
?>
|
?>
|
||||||
<div class="container-popup">
|
<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">
|
<form action="<?php echo Route::_('index.php?option=com_weblinks&view=weblinks&layout=modal&tmpl=component&function=' . $function . '&' . Session::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 echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
||||||
|
|
||||||
<?php if (empty($this->items)) : ?>
|
<?php if (empty($this->items)) : ?>
|
||||||
<div class="alert alert-no-items">
|
<div class="alert alert-no-items">
|
||||||
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<table class="table table-striped table-condensed">
|
<table class="table table-sm">
|
||||||
|
<caption class="visually-hidden">
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_WEBLINKS_TABLE_CAPTION'); ?>,
|
||||||
|
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||||
|
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||||
|
</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="1%" class="center nowrap">
|
<th scope="col" class="w-1 text-center">
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||||
</th>
|
</th>
|
||||||
<th class="title">
|
<th scope="col" class="title">
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||||
</th>
|
</th>
|
||||||
<th width="10%" class="nowrap hidden-phone">
|
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||||
</th>
|
</th>
|
||||||
<th width="15%" class="nowrap">
|
<?php if ($multilang) : ?>
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
|
<th scope="col" class="w-15">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<?php endif; ?>
|
||||||
|
<th scope="col" class="w-10 d-none d-md-table-cell">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'JDATE', 'a.created', $listDirn, $listOrder); ?>
|
||||||
</th>
|
</th>
|
||||||
<th width="5%" class="nowrap hidden-phone">
|
<th scope="col" class="w-1 d-none d-md-table-cell">
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JDATE', 'a.created', $listDirn, $listOrder); ?>
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||||
</th>
|
|
||||||
<th width="1%" class="nowrap hidden-phone">
|
|
||||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan="6">
|
|
||||||
<?php echo $this->pagination->getListFooter(); ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($this->items as $i => $item) : ?>
|
<?php foreach ($this->items as $i => $item) : ?>
|
||||||
<?php $lang = ''; ?>
|
<?php $lang = ''; ?>
|
||||||
<?php if ($item->language && JLanguageMultilang::isEnabled()) : ?>
|
<?php if ($item->language && $multilang) : ?>
|
||||||
<?php $tag = strlen($item->language); ?>
|
<?php $tag = strlen($item->language); ?>
|
||||||
<?php if ($tag == 5) : ?>
|
<?php if ($tag == 5) : ?>
|
||||||
<?php $lang = substr($item->language, 0, 2); ?>
|
<?php $lang = substr($item->language, 0, 2); ?>
|
||||||
|
@ -105,31 +108,33 @@ $iconStates = array(
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<span class="<?php echo $iconStates[$this->escape($item->state)]; ?>"></span>
|
<span class="<?php echo $iconStates[$this->escape($item->state)]; ?>"></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<th scope="row">
|
||||||
<?php $attribs = 'data-function="' . $this->escape($onclick) . '"'
|
<?php $attribs = 'data-function="' . $this->escape($onclick) . '"'
|
||||||
. ' data-id="' . $item->id . '"'
|
. ' data-id="' . $item->id . '"'
|
||||||
. ' data-title="' . $this->escape(addslashes($item->title)) . '"'
|
. ' data-title="' . $this->escape(addslashes($item->title)) . '"'
|
||||||
. ' data-cat-id="' . $this->escape($item->catid) . '"'
|
. ' data-cat-id="' . $this->escape($item->catid) . '"'
|
||||||
. ' data-uri="' . $this->escape(WeblinksHelperRoute::getWeblinkRoute($item->id, $item->catid, $item->language)) . '"'
|
. ' data-uri="' . $this->escape(RouteHelper::getWeblinkRoute($item->id, $item->catid, $item->language)) . '"'
|
||||||
. ' data-language="' . $this->escape($lang) . '"';
|
. ' data-language="' . $this->escape($lang) . '"';
|
||||||
?>
|
?>
|
||||||
<a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>>
|
<a class="select-link" href="javascript:void(0)" <?php echo $attribs; ?>>
|
||||||
<?php echo $this->escape($item->title); ?>
|
<?php echo $this->escape($item->title); ?>
|
||||||
</a>
|
</a>
|
||||||
<div class="small">
|
<div class="small">
|
||||||
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
<?php echo Text::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</th>
|
||||||
<td class="small hidden-phone">
|
<td class="small d-none d-md-table-cell">
|
||||||
<?php echo $this->escape($item->access_level); ?>
|
<?php echo $this->escape($item->access_level); ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="small">
|
<?php if ($multilang) : ?>
|
||||||
<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
|
<td class="small">
|
||||||
|
<?php echo LayoutHelper::render('joomla.content.language', $item); ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
|
<td class="small d-none d-md-table-cell">
|
||||||
|
<?php echo HTMLHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')); ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="nowrap small hidden-phone">
|
<td class="small d-none d-md-table-cell">
|
||||||
<?php echo JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC4')); ?>
|
|
||||||
</td>
|
|
||||||
<td class="nowrap small hidden-phone">
|
|
||||||
<?php echo (int) $item->id; ?>
|
<?php echo (int) $item->id; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -138,10 +143,13 @@ $iconStates = array(
|
||||||
</table>
|
</table>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php // load the pagination. ?>
|
||||||
|
<?php echo $this->pagination->getListFooter(); ?>
|
||||||
|
|
||||||
<input type="hidden" name="task" value="" />
|
<input type="hidden" name="task" value="" />
|
||||||
<input type="hidden" name="boxchecked" value="0" />
|
<input type="hidden" name="boxchecked" value="0" />
|
||||||
<input type="hidden" name="forcedLanguage" value="<?php echo $app->input->get('forcedLanguage', '', 'CMD'); ?>" />
|
<input type="hidden" name="forcedLanguage" value="<?php echo $app->input->get('forcedLanguage', '', 'CMD'); ?>" />
|
||||||
<?php echo JHtml::_('form.token'); ?>
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?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;
|
|
||||||
$published = $this->state->get('filter.published');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="control-group span6">
|
|
||||||
<div class="controls">
|
|
||||||
<?php echo JHtml::_('batch.language'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="control-group span6">
|
|
||||||
<div class="controls">
|
|
||||||
<?php echo JHtml::_('batch.access'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row-fluid">
|
|
||||||
<?php if ($published >= 0) : ?>
|
|
||||||
<div class="control-group span6">
|
|
||||||
<div class="controls">
|
|
||||||
<?php echo JHtml::_('batch.item', 'com_weblinks'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="control-group span6">
|
|
||||||
<div class="controls">
|
|
||||||
<?php echo JHtml::_('batch.tag'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
?>
|
|
||||||
<a class="btn" type="button" onclick="document.getElementById('batch-category-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value='';document.getElementById('batch-user-id').value='';document.getElementById('batch-tag-id').value=''" data-dismiss="modal">
|
|
||||||
<?php echo JText::_('JCANCEL'); ?>
|
|
||||||
</a>
|
|
||||||
<button class="btn btn-success" type="submit" onclick="Joomla.submitbutton('weblink.batch');">
|
|
||||||
<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
|
|
||||||
</button>
|
|
|
@ -10,27 +10,24 @@
|
||||||
<version>##VERSION##</version>
|
<version>##VERSION##</version>
|
||||||
<description>COM_WEBLINKS_XML_DESCRIPTION</description>
|
<description>COM_WEBLINKS_XML_DESCRIPTION</description>
|
||||||
<scriptfile>script.php</scriptfile>
|
<scriptfile>script.php</scriptfile>
|
||||||
<namespace>Joomla\Component\Weblinks</namespace>
|
<namespace path="src">Joomla\Component\Weblinks</namespace>
|
||||||
|
|
||||||
<install>
|
<install>
|
||||||
<sql>
|
<sql>
|
||||||
<file charset="utf8" driver="mysql">sql/install.mysql.sql</file>
|
<file charset="utf8" driver="mysql">sql/install.mysql.sql</file>
|
||||||
<file charset="utf8" driver="postgresql">sql/install.postgresql.sql</file>
|
<file charset="utf8" driver="postgresql">sql/install.postgresql.sql</file>
|
||||||
<file charset="utf8" driver="sqlsrv">sql/install.sqlsrv.sql</file>
|
|
||||||
</sql>
|
</sql>
|
||||||
</install>
|
</install>
|
||||||
<uninstall>
|
<uninstall>
|
||||||
<sql>
|
<sql>
|
||||||
<file charset="utf8" driver="mysql">sql/uninstall.mysql.sql</file>
|
<file charset="utf8" driver="mysql">sql/uninstall.mysql.sql</file>
|
||||||
<file charset="utf8" driver="postgresql">sql/uninstall.postgresql.sql</file>
|
<file charset="utf8" driver="postgresql">sql/uninstall.postgresql.sql</file>
|
||||||
<file charset="utf8" driver="sqlsrv">sql/uninstall.sqlsrv.sql</file>
|
|
||||||
</sql>
|
</sql>
|
||||||
</uninstall>
|
</uninstall>
|
||||||
<update>
|
<update>
|
||||||
<schemas>
|
<schemas>
|
||||||
<schemapath type="mysql">sql/updates/mysql</schemapath>
|
<schemapath type="mysql">sql/updates/mysql</schemapath>
|
||||||
<schemapath type="postgresql">sql/updates/postgresql</schemapath>
|
<schemapath type="postgresql">sql/updates/postgresql</schemapath>
|
||||||
<schemapath type="sqlsrv">sql/updates/sqlsrv</schemapath>
|
|
||||||
</schemas>
|
</schemas>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
@ -55,6 +52,10 @@
|
||||||
alt="Weblinks/Links">com_weblinks_links</menu>
|
alt="Weblinks/Links">com_weblinks_links</menu>
|
||||||
<menu link="option=com_categories&extension=com_weblinks"
|
<menu link="option=com_categories&extension=com_weblinks"
|
||||||
view="categories" img="class:weblinks-cat" alt="Weblinks/Categories">com_weblinks_categories</menu>
|
view="categories" img="class:weblinks-cat" alt="Weblinks/Categories">com_weblinks_categories</menu>
|
||||||
|
<menu link="option=com_fields&view=fields&context=com_weblinks.weblink"
|
||||||
|
alt="Weblinks/Fields">com_weblinks_fields</menu>
|
||||||
|
<menu link="option=com_fields&view=groups&context=com_weblinks.weblink"
|
||||||
|
alt="Weblinks/Field Groups">com_weblinks_field_groups</menu>
|
||||||
</submenu>
|
</submenu>
|
||||||
<files folder="administrator/components/com_weblinks">
|
<files folder="administrator/components/com_weblinks">
|
||||||
##BACKEND_COMPONENT_FILES##
|
##BACKEND_COMPONENT_FILES##
|
||||||
|
|
|
@ -4,130 +4,84 @@
|
||||||
; Note : All ini files need to be saved as UTF-8
|
; Note : All ini files need to be saved as UTF-8
|
||||||
|
|
||||||
COM_WEBLINKS="Web Links"
|
COM_WEBLINKS="Web Links"
|
||||||
COM_WEBLINKS_ACCESS_HEADING="Access"
|
|
||||||
COM_WEBLINKS_BATCH_OPTIONS="Batch process the selected links"
|
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_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_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_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_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_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_COMPONENT_LABEL="Web Link"
|
||||||
COM_WEBLINKS_CONFIG_INTEGRATION_SETTINGS_DESC="These settings determine how the Web Links Component will integrate with other extensions."
|
|
||||||
COM_WEBLINKS_CONFIGURATION="Web Links Manager Options"
|
COM_WEBLINKS_CONFIGURATION="Web Links Manager Options"
|
||||||
|
COM_WEBLINKS_CONFIG_INTEGRATION_SETTINGS_DESC="These settings determine how the Web Links Component will integrate with other extensions."
|
||||||
COM_WEBLINKS_EDIT_WEBLINK="Edit Web Link"
|
COM_WEBLINKS_EDIT_WEBLINK="Edit Web Link"
|
||||||
|
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another Web Link from this category has the same alias (remember it may be a trashed item)."
|
||||||
COM_WEBLINKS_ERR_TABLES_NAME="There is already a Web Link with that name in this category. Please try again."
|
COM_WEBLINKS_ERR_TABLES_NAME="There is already a Web Link with that name in this category. Please try again."
|
||||||
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Please provide a valid URL"
|
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Please provide a valid URL"
|
||||||
COM_WEBLINKS_ERR_TABLES_TITLE="Your web link must contain a title."
|
COM_WEBLINKS_ERR_TABLES_TITLE="Your Web Link must contain a title."
|
||||||
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another web link from this category has the same alias (remember it may be a trashed item)."
|
COM_WEBLINKS_FIELDSET_OPTIONS="Options"
|
||||||
COM_WEBLINKS_FIELD_ALIAS_DESC="The alias is for internal use only. Leave this blank and Joomla will fill in a default value from the title. It has to be unique for each web link in the same category."
|
|
||||||
COM_WEBLINKS_FIELD_CATEGORY_DESC="Choose a category for this Web link."
|
|
||||||
COM_WEBLINKS_FIELD_CATEGORYCHOOSE_DESC="Please choose a Web Links category to display."
|
|
||||||
COM_WEBLINKS_FIELD_CAPTCHA_DESC="Select the captcha plugin that will be used in the web link submit form. You may need to enter required information for your captcha plugin in the Plugin Manager.<br />If 'Use Default' is selected, make sure a captcha plugin is selected in Global Configuration."
|
|
||||||
COM_WEBLINKS_FIELD_CAPTCHA_LABEL="Allow Captcha on Web Link"
|
COM_WEBLINKS_FIELD_CAPTCHA_LABEL="Allow Captcha on Web Link"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC="Show or hide the number of Web Links in each Category."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL="# Web Links"
|
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL="# Web Links"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_LABEL="Count Clicks"
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_DESCRIPTION_DESC="Show or hide the description below."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_HITS_DESC="Show or hide hits."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_ICON_DESC="If Icon is chosen above, select an icon to display with the Web Links. If none is selected, the default icon will be used."
|
COM_WEBLINKS_FIELD_CONFIG_ICON_DESC="If Icon is chosen above, select an icon to display with the Web Links. If none is selected, the default icon will be used."
|
||||||
COM_WEBLINKS_FIELD_CONFIG_ICON_LABEL="Select Icon"
|
COM_WEBLINKS_FIELD_CONFIG_ICON_LABEL="Select Icon"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC="Show or hide the links description."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL="Links Description"
|
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL="Links Description"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_DESC="Show or hide other categories."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_LABEL="Other Categories"
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_SHOWREPORT_DESC="Show or hide the Report Bad Link option."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_SHOWREPORT_LABEL="Reports"
|
|
||||||
COM_WEBLINKS_FIELD_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
|
||||||
COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL="Count Clicks"
|
COM_WEBLINKS_FIELD_COUNTCLICKS_LABEL="Count Clicks"
|
||||||
COM_WEBLINKS_FIELD_DESCRIPTION_DESC="Enter a description for the web link."
|
|
||||||
COM_WEBLINKS_FIELD_DISPLAY_NUM_DESC="Default number of Web links to list on a page."
|
|
||||||
COM_WEBLINKS_FIELD_DISPLAY_NUM_LABEL="# of Web links to List"
|
|
||||||
COM_WEBLINKS_FIELD_FIRST_DESC="The image to be displayed."
|
|
||||||
COM_WEBLINKS_FIELD_FIRST_LABEL="First Image"
|
COM_WEBLINKS_FIELD_FIRST_LABEL="First Image"
|
||||||
|
|
||||||
COM_WEBLINKS_FIELD_HEIGHT_DESC="Height of the target popup or modal window. Defaults to 600x500 if one field is left empty."
|
|
||||||
COM_WEBLINKS_FIELD_HEIGHT_LABEL="Height"
|
COM_WEBLINKS_FIELD_HEIGHT_LABEL="Height"
|
||||||
COM_WEBLINKS_FIELD_ICON_DESC="Displays a text, an icon or nothing with the Web links. Default is 'Icon'."
|
|
||||||
COM_WEBLINKS_FIELD_ICON_LABEL="Text/Icon/Web Link Only"
|
COM_WEBLINKS_FIELD_ICON_LABEL="Text/Icon/Web Link Only"
|
||||||
COM_WEBLINKS_FIELD_ICON_OPTION_ICON="Icon"
|
COM_WEBLINKS_FIELD_ICON_OPTION_ICON="Icon"
|
||||||
COM_WEBLINKS_FIELD_ICON_OPTION_TEXT="Text"
|
COM_WEBLINKS_FIELD_ICON_OPTION_TEXT="Text"
|
||||||
COM_WEBLINKS_FIELD_ICON_OPTION_WEBLINK="Web Link Only"
|
COM_WEBLINKS_FIELD_ICON_OPTION_WEBLINK="Web Link Only"
|
||||||
COM_WEBLINKS_FIELD_IMAGE_ALT_DESC="Alternative text used for visitors without access to images. Replaced with caption text if it is present."
|
COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC="Decorative Image - no description required"
|
||||||
|
COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL="No Description"
|
||||||
COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL="Alt Text"
|
COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL="Alt Text"
|
||||||
COM_WEBLINKS_FIELD_IMAGE_CAPTION_DESC="Caption attached to the image."
|
|
||||||
COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL="Caption"
|
COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL="Caption"
|
||||||
|
|
||||||
COM_WEBLINKS_FIELD_LANGUAGE_DESC="Assign a language to this web link."
|
|
||||||
COM_WEBLINKS_FIELD_MODIFIED_DESC="The date and time the link was last modified."
|
COM_WEBLINKS_FIELD_MODIFIED_DESC="The date and time the link was last modified."
|
||||||
COM_WEBLINKS_FIELD_SECOND_DESC="The second image to be displayed."
|
|
||||||
COM_WEBLINKS_FIELD_SECOND_LABEL="Second Image"
|
COM_WEBLINKS_FIELD_SECOND_LABEL="Second Image"
|
||||||
COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC="Select a web links category to display."
|
|
||||||
COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL="Select a Category"
|
COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL="Select a Category"
|
||||||
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_DESC="Show the tags for a category."
|
|
||||||
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Show Tags"
|
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Show Tags"
|
||||||
COM_WEBLINKS_FIELD_SHOW_TAGS_DESC="Show the tags for a web link."
|
|
||||||
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Show Tags"
|
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Show Tags"
|
||||||
COM_WEBLINKS_FIELD_STATE_DESC="Set publication status."
|
|
||||||
COM_WEBLINKS_FIELD_TARGET_DESC="Target browser window when the link is selected."
|
|
||||||
COM_WEBLINKS_FIELD_TARGET_LABEL="Target"
|
COM_WEBLINKS_FIELD_TARGET_LABEL="Target"
|
||||||
COM_WEBLINKS_FIELD_TITLE_DESC="Web Link must have a title."
|
|
||||||
COM_WEBLINKS_FIELD_URL_DESC="You must enter a URL. IDN (International) Links are converted to punycode when they are saved."
|
|
||||||
COM_WEBLINKS_FIELD_URL_LABEL="URL"
|
COM_WEBLINKS_FIELD_URL_LABEL="URL"
|
||||||
COM_WEBLINKS_FIELD_VALUE_REPORTED="Reported"
|
COM_WEBLINKS_FIELD_VALUE_REPORTED="Reported"
|
||||||
COM_WEBLINKS_FIELD_VERSION_DESC="A count of the number of times this web link has been revised."
|
|
||||||
COM_WEBLINKS_FIELD_VERSION_LABEL="Revision"
|
COM_WEBLINKS_FIELD_VERSION_LABEL="Revision"
|
||||||
COM_WEBLINKS_FIELD_WIDTH_DESC="Width of the target popup or modal window. Defaults to 600x500 if one field is left empty."
|
|
||||||
COM_WEBLINKS_FIELD_WIDTH_LABEL="Width"
|
COM_WEBLINKS_FIELD_WIDTH_LABEL="Width"
|
||||||
COM_WEBLINKS_FIELDSET_IMAGES="Images"
|
COM_WEBLINKS_FILTER_SEARCH_DESC="Search in Web Link title and alias. Prefix with ID: to search for a Web Link ID."
|
||||||
COM_WEBLINKS_FIELDSET_OPTIONS="Options"
|
|
||||||
COM_WEBLINKS_FILTER_CATEGORY="Filter Category"
|
|
||||||
COM_WEBLINKS_FILTER_SEARCH_DESC="Search in web link title and alias. Prefix with ID: to search for a web link ID."
|
|
||||||
COM_WEBLINKS_FILTER_SEARCH_LABEL="Search Web Links"
|
COM_WEBLINKS_FILTER_SEARCH_LABEL="Search Web Links"
|
||||||
COM_WEBLINKS_FILTER_STATE="Filter State"
|
COM_WEBLINKS_FILTER_STATE="Filter State"
|
||||||
COM_WEBLINKS_FLOAT_FIRST_DESC="Controls placement of the first image."
|
|
||||||
COM_WEBLINKS_FLOAT_FIRST_LABEL="First Image Float"
|
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_FLOAT_SECOND_LABEL="Second Image Float"
|
||||||
COM_WEBLINKS_HEADING_ASSOCIATION="Association"
|
COM_WEBLINKS_HEADING_ASSOCIATION="Association"
|
||||||
COM_WEBLINKS_HITS_DESC="Number of hits for this web link."
|
|
||||||
COM_WEBLINKS_LEFT="Left"
|
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."
|
COM_WEBLINKS_LIST_LAYOUT_DESC="These settings apply for Web Links List Layout Options unless they are changed for a specific menu item."
|
||||||
COM_WEBLINKS_MANAGER_WEBLINK="Web Links"
|
COM_WEBLINKS_MANAGER_WEBLINK="Web Links"
|
||||||
COM_WEBLINKS_MANAGER_WEBLINKS="Web Links"
|
COM_WEBLINKS_MANAGER_WEBLINKS="Web Links"
|
||||||
COM_WEBLINKS_MANAGER_WEBLINK_EDIT="Web Link: Edit"
|
COM_WEBLINKS_MANAGER_WEBLINK_EDIT="Web Link: Edit"
|
||||||
COM_WEBLINKS_MANAGER_WEBLINK_NEW="Web Link: New"
|
COM_WEBLINKS_MANAGER_WEBLINK_NEW="Web Link: New"
|
||||||
COM_WEBLINKS_N_ITEMS_ARCHIVED="%d web links successfully archived."
|
|
||||||
COM_WEBLINKS_N_ITEMS_ARCHIVED_1="%d web link successfully archived."
|
|
||||||
COM_WEBLINKS_N_ITEMS_CHECKED_IN_0="No web link successfully checked in."
|
|
||||||
COM_WEBLINKS_N_ITEMS_CHECKED_IN_1="%d web link successfully checked in."
|
|
||||||
COM_WEBLINKS_N_ITEMS_CHECKED_IN_MORE="%d web links successfully checked in."
|
|
||||||
COM_WEBLINKS_N_ITEMS_DELETED="%d web links successfully deleted."
|
|
||||||
COM_WEBLINKS_N_ITEMS_DELETED_1="%d web link successfully deleted."
|
|
||||||
COM_WEBLINKS_N_ITEMS_PUBLISHED="%d web links successfully published."
|
|
||||||
COM_WEBLINKS_N_ITEMS_PUBLISHED_1="%d web link successfully published."
|
|
||||||
COM_WEBLINKS_N_ITEMS_TRASHED="%d web links successfully trashed."
|
|
||||||
COM_WEBLINKS_N_ITEMS_TRASHED_1="%d web link successfully trashed."
|
|
||||||
COM_WEBLINKS_N_ITEMS_UNPUBLISHED="%d web links successfully unpublished."
|
|
||||||
COM_WEBLINKS_N_ITEMS_UNPUBLISHED_1="%d web link successfully unpublished."
|
|
||||||
COM_WEBLINKS_NEW_WEBLINK="New Web Link"
|
COM_WEBLINKS_NEW_WEBLINK="New Web Link"
|
||||||
COM_WEBLINKS_NONE="None"
|
COM_WEBLINKS_NONE="None"
|
||||||
COM_WEBLINKS_OPTION_FILTER_ACCESS="- Filter Access -"
|
COM_WEBLINKS_N_ITEMS_ARCHIVED="%d Web Links archived."
|
||||||
COM_WEBLINKS_OPTION_FILTER_CATEGORY="- Filter Category -"
|
COM_WEBLINKS_N_ITEMS_ARCHIVED_1="%d Web Link archived."
|
||||||
COM_WEBLINKS_OPTION_FILTER_PUBLISHED="- Filter State -"
|
COM_WEBLINKS_N_ITEMS_CHECKED_IN_0="No Web Link checked in."
|
||||||
|
COM_WEBLINKS_N_ITEMS_CHECKED_IN_1="%d Web Link checked in."
|
||||||
|
COM_WEBLINKS_N_ITEMS_CHECKED_IN_MORE="%d Web Links checked in."
|
||||||
|
COM_WEBLINKS_N_ITEMS_DELETED="%d Web Links deleted."
|
||||||
|
COM_WEBLINKS_N_ITEMS_DELETED_1="%d Web Link deleted."
|
||||||
|
COM_WEBLINKS_N_ITEMS_PUBLISHED="%d Web Links published."
|
||||||
|
COM_WEBLINKS_N_ITEMS_PUBLISHED_1="%d Web Link published."
|
||||||
|
COM_WEBLINKS_N_ITEMS_TRASHED="%d Web Links trashed."
|
||||||
|
COM_WEBLINKS_N_ITEMS_TRASHED_1="%d Web Link trashed."
|
||||||
|
COM_WEBLINKS_N_ITEMS_UNPUBLISHED="%d Web Links unpublished."
|
||||||
|
COM_WEBLINKS_N_ITEMS_UNPUBLISHED_1="%d Web Link unpublished."
|
||||||
COM_WEBLINKS_OPTIONS="Options"
|
COM_WEBLINKS_OPTIONS="Options"
|
||||||
COM_WEBLINKS_ORDER_HEADING="Order"
|
|
||||||
COM_WEBLINKS_RIGHT="Right"
|
COM_WEBLINKS_RIGHT="Right"
|
||||||
COM_WEBLINKS_SAVE_SUCCESS="Web link successfully saved"
|
COM_WEBLINKS_SAVE_SUCCESS="Web link saved"
|
||||||
COM_WEBLINKS_SEARCH_IN_TITLE="Search in title"
|
|
||||||
COM_WEBLINKS_SELECT_A_WEBLINK="Select Web Link"
|
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_CATEGORIES="Categories"
|
||||||
COM_WEBLINKS_SUBMENU_WEBLINKS="Web Links"
|
COM_WEBLINKS_SUBMENU_WEBLINKS="Web Links"
|
||||||
COM_WEBLINKS_WEBLINKS="Web Links"
|
COM_WEBLINKS_WEBLINKS="Web Links"
|
||||||
COM_WEBLINKS_XML_DESCRIPTION="Component for web links management"
|
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."
|
JGLOBAL_NEWITEMSLAST_DESC="New Web links default to the last position. Ordering can be changed after this Web link is saved."
|
||||||
JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE="You are not allowed to create new web links in this category."
|
JGLOBAL_NO_ITEM_SELECTED="No Web Links selected"
|
||||||
JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT="You are not allowed to edit one or more of these web links."
|
JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE="You are not allowed to create new Web Links in this category."
|
||||||
|
JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT="You are not allowed to edit one or more of these Web Links."
|
||||||
JLIB_RULES_SETTING_NOTES="Changes apply to this component only.<br /><em><strong>Inherited</strong></em> - a Global Configuration setting or higher level setting is applied.<br /><em><strong>Denied</strong></em> always wins - whatever is set at the Global or higher level and applies to all child elements.<br /><em><strong>Allowed</strong></em> will enable the action for this component unless it is overruled by a Global Configuration setting."
|
JLIB_RULES_SETTING_NOTES="Changes apply to this component only.<br /><em><strong>Inherited</strong></em> - a Global Configuration setting or higher level setting is applied.<br /><em><strong>Denied</strong></em> always wins - whatever is set at the Global or higher level and applies to all child elements.<br /><em><strong>Allowed</strong></em> will enable the action for this component unless it is overruled by a Global Configuration setting."
|
||||||
|
|
|
@ -15,11 +15,12 @@ COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_OPTION="Default"
|
||||||
COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE="List Web Links in a Category"
|
COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE="List Web Links in a Category"
|
||||||
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
||||||
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
|
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_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_DESC="Display a form to submit a web link in the Frontend."
|
||||||
COM_WEBLINKS_FORM_VIEW_DEFAULT_OPTION="Default"
|
COM_WEBLINKS_FORM_VIEW_DEFAULT_OPTION="Default"
|
||||||
COM_WEBLINKS_FORM_VIEW_DEFAULT_TITLE="Submit a Web Link"
|
COM_WEBLINKS_FORM_VIEW_DEFAULT_TITLE="Submit a Web Link"
|
||||||
|
COM_WEBLINKS_FIELDS="Fields"
|
||||||
|
COM_WEBLINKS_FIELD_GROUPS="Field Groups"
|
||||||
COM_WEBLINKS_LINKS="Links"
|
COM_WEBLINKS_LINKS="Links"
|
||||||
COM_WEBLINKS_TAGS_WEBLINK="Web Link"
|
COM_WEBLINKS_TAGS_WEBLINK="Web Link"
|
||||||
COM_WEBLINKS_TAGS_CATEGORY="Web Link Category"
|
COM_WEBLINKS_TAGS_CATEGORY="Web Link Category"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<file type="plugin" id="weblinks" group="editors-xtd">plg_editors-xtd_weblink.zip</file>
|
<file type="plugin" id="weblinks" group="editors-xtd">plg_editors-xtd_weblink.zip</file>
|
||||||
</files>
|
</files>
|
||||||
<languages folder="language">
|
<languages folder="language">
|
||||||
<language tag="en-GB">en-GB/en-GB.pkg_weblinks.sys.ini</language>
|
<language tag="en-GB">en-GB/pkg_weblinks.sys.ini</language>
|
||||||
</languages>
|
</languages>
|
||||||
<updateservers>
|
<updateservers>
|
||||||
<!-- Note: No spaces or linebreaks allowed between the server tags -->
|
<!-- Note: No spaces or linebreaks allowed between the server tags -->
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<form>
|
<form>
|
||||||
<fieldset addfieldpath="/administrator/components/com_categories/models/fields">
|
<fieldset addfieldprefix="Joomla\Component\Categories\Administrator\Field">
|
||||||
<field
|
<field
|
||||||
name="id"
|
name="id"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
label="WEBLINK_ID_LABEL"
|
label="WEBLINK_ID_LABEL"
|
||||||
readonly="true"
|
readonly="true"
|
||||||
required="true"
|
|
||||||
size="10"
|
|
||||||
default="0"
|
default="0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -23,25 +21,21 @@
|
||||||
name="title"
|
name="title"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_TITLE"
|
label="JGLOBAL_TITLE"
|
||||||
description="COM_WEBLINKS_FIELD_TITLE_DESC"
|
|
||||||
required="true"
|
required="true"
|
||||||
size="30"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="alias"
|
name="alias"
|
||||||
type="text"
|
type="text"
|
||||||
label="JFIELD_ALIAS_LABEL"
|
label="JFIELD_ALIAS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_ALIAS_DESC"
|
description="JFIELD_ALIAS_DESC"
|
||||||
hint="JFIELD_ALIAS_PLACEHOLDER"
|
hint="JFIELD_ALIAS_PLACEHOLDER"
|
||||||
size="45"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="description"
|
name="description"
|
||||||
type="editor"
|
type="editor"
|
||||||
label="JGLOBAL_DESCRIPTION"
|
label="JGLOBAL_DESCRIPTION"
|
||||||
description="COM_WEBLINKS_FIELD_DESCRIPTION_DESC"
|
|
||||||
buttons="true"
|
buttons="true"
|
||||||
hide="pagebreak,readmore"
|
hide="pagebreak,readmore"
|
||||||
filter="safehtml"
|
filter="safehtml"
|
||||||
|
@ -52,9 +46,10 @@
|
||||||
name="state"
|
name="state"
|
||||||
type="list"
|
type="list"
|
||||||
label="JSTATUS"
|
label="JSTATUS"
|
||||||
description="JFIELD_PUBLISHED_DESC"
|
class="form-select-color-state"
|
||||||
default="1"
|
|
||||||
size="1"
|
size="1"
|
||||||
|
default="1"
|
||||||
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="1">JPUBLISHED</option>
|
<option value="1">JPUBLISHED</option>
|
||||||
<option value="0">JUNPUBLISHED</option>
|
<option value="0">JUNPUBLISHED</option>
|
||||||
|
@ -64,7 +59,6 @@
|
||||||
name="catid"
|
name="catid"
|
||||||
type="categoryedit"
|
type="categoryedit"
|
||||||
label="JCATEGORY"
|
label="JCATEGORY"
|
||||||
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
|
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
required="true"
|
required="true"
|
||||||
/>
|
/>
|
||||||
|
@ -73,18 +67,14 @@
|
||||||
name="url"
|
name="url"
|
||||||
type="url"
|
type="url"
|
||||||
label="COM_WEBLINKS_FIELD_URL_LABEL"
|
label="COM_WEBLINKS_FIELD_URL_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_URL_DESC"
|
|
||||||
filter="url"
|
filter="url"
|
||||||
required="true"
|
required="true"
|
||||||
size="45"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="language"
|
name="language"
|
||||||
type="contentlanguage"
|
type="contentlanguage"
|
||||||
label="JFIELD_LANGUAGE_LABEL"
|
label="JFIELD_LANGUAGE_LABEL"
|
||||||
description="JFIELD_LANGUAGE_DESC"
|
|
||||||
class="inputbox"
|
|
||||||
>
|
>
|
||||||
<option value="*">JALL</option>
|
<option value="*">JALL</option>
|
||||||
</field>
|
</field>
|
||||||
|
@ -93,8 +83,6 @@
|
||||||
name="tags"
|
name="tags"
|
||||||
type="tag"
|
type="tag"
|
||||||
label="JTAG"
|
label="JTAG"
|
||||||
description="JTAG_DESC"
|
|
||||||
class="inputbox"
|
|
||||||
multiple="true"
|
multiple="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -102,22 +90,105 @@
|
||||||
name="version_note"
|
name="version_note"
|
||||||
type="text"
|
type="text"
|
||||||
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
|
label="JGLOBAL_FIELD_VERSION_NOTE_LABEL"
|
||||||
description="JGLOBAL_FIELD_VERSION_NOTE_DESC"
|
maxlength="255"
|
||||||
class="inputbox"
|
|
||||||
size="45"
|
|
||||||
labelclass="control-label"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="captcha"
|
name="captcha"
|
||||||
type="captcha"
|
type="captcha"
|
||||||
label="COM_WEBLINKS_CAPTCHA_LABEL"
|
label="COM_WEBLINKS_CAPTCHA_LABEL"
|
||||||
description="COM_WEBLINKS_CAPTCHA_DESC"
|
|
||||||
validate="captcha"
|
validate="captcha"
|
||||||
namespace="weblink"
|
namespace="weblink"
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fields
|
||||||
|
name="images"
|
||||||
|
>
|
||||||
|
<fieldset
|
||||||
|
name="images"
|
||||||
|
label="JGLOBAL_FIELDSET_IMAGE_OPTIONS"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="image_first"
|
||||||
|
type="media"
|
||||||
|
label="COM_WEBLINKS_FIELD_FIRST_LABEL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="float_first"
|
||||||
|
type="list"
|
||||||
|
label="COM_WEBLINKS_FLOAT_FIRST_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
>
|
||||||
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
|
<option value="left">COM_WEBLINKS_LEFT</option>
|
||||||
|
<option value="none">COM_WEBLINKS_NONE</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_first_alt"
|
||||||
|
type="text"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_first_alt_empty"
|
||||||
|
type="checkbox"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL"
|
||||||
|
description="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_first_caption"
|
||||||
|
type="text"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="spacer1"
|
||||||
|
type="spacer"
|
||||||
|
hr="true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_second"
|
||||||
|
type="media"
|
||||||
|
label="COM_WEBLINKS_FIELD_SECOND_LABEL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="float_second"
|
||||||
|
type="list"
|
||||||
|
label="COM_WEBLINKS_FLOAT_SECOND_LABEL"
|
||||||
|
>
|
||||||
|
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||||
|
<option value="right">COM_WEBLINKS_RIGHT</option>
|
||||||
|
<option value="left">COM_WEBLINKS_LEFT</option>
|
||||||
|
<option value="none">COM_WEBLINKS_NONE</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_second_alt"
|
||||||
|
type="text"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_second_alt_empty"
|
||||||
|
type="checkbox"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL"
|
||||||
|
description="COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="image_second_caption"
|
||||||
|
type="text"
|
||||||
|
label="COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
|
||||||
<fields name="metadata">
|
<fields name="metadata">
|
||||||
<fieldset
|
<fieldset
|
||||||
name="jmetadata"
|
name="jmetadata"
|
||||||
|
@ -127,9 +198,7 @@
|
||||||
name="robots"
|
name="robots"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
label="JFIELD_METADATA_ROBOTS_LABEL"
|
label="JFIELD_METADATA_ROBOTS_LABEL"
|
||||||
description="JFIELD_METADATA_ROBOTS_DESC"
|
|
||||||
filter="unset"
|
filter="unset"
|
||||||
labelclass="control-label"
|
|
||||||
>
|
>
|
||||||
<option value="">JGLOBAL_USE_GLOBAL</option>
|
<option value="">JGLOBAL_USE_GLOBAL</option>
|
||||||
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
<option value="index, follow">JGLOBAL_INDEX_FOLLOW</option>
|
||||||
|
@ -142,31 +211,21 @@
|
||||||
name="author"
|
name="author"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
label="JAUTHOR"
|
label="JAUTHOR"
|
||||||
description="JFIELD_METADATA_AUTHOR_DESC"
|
|
||||||
filter="unset"
|
filter="unset"
|
||||||
size="20"
|
|
||||||
labelclass="control-label"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="rights"
|
name="rights"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
label="JFIELD_META_RIGHTS_LABEL"
|
label="JFIELD_META_RIGHTS_LABEL"
|
||||||
description="JFIELD_META_RIGHTS_DESC"
|
|
||||||
filter="unset"
|
filter="unset"
|
||||||
required="false"
|
|
||||||
labelclass="control-label"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="xreference"
|
name="xreference"
|
||||||
type="hidden"
|
type="hidden"
|
||||||
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
|
label="COM_CONTENT_FIELD_XREFERENCE_LABEL"
|
||||||
description="COM_CONTENT_FIELD_XREFERENCE_DESC"
|
|
||||||
filter="unset"
|
filter="unset"
|
||||||
class="inputbox"
|
|
||||||
size="20"
|
|
||||||
labelclass="control-label"
|
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
|
@ -19,21 +19,14 @@ class JHtmlIcon
|
||||||
/**
|
/**
|
||||||
* Create a link to create a new weblink
|
* Create a link to create a new weblink
|
||||||
*
|
*
|
||||||
* @param mixed $weblink Unused
|
* @param object $category The category information
|
||||||
* @param mixed $params Unused
|
* @param \Joomla\Registry\Registry $params The item parameters
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function create($weblink, $params)
|
public static function create($category, $params)
|
||||||
{
|
{
|
||||||
JHtml::_('bootstrap.tooltip');
|
return self::getIcon()->create($category, $params);
|
||||||
|
|
||||||
$uri = JUri::getInstance();
|
|
||||||
$url = JRoute::_(WeblinksHelperRoute::getFormRoute(0, base64_encode($uri)));
|
|
||||||
$text = JHtml::_('image', 'system/new.png', JText::_('JNEW'), null, true);
|
|
||||||
$button = JHtml::_('link', $url, $text);
|
|
||||||
|
|
||||||
return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_FORM_CREATE_WEBLINK') . '">' . $button . '</span>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,43 +40,16 @@ class JHtmlIcon
|
||||||
*/
|
*/
|
||||||
public static function edit($weblink, $params, $attribs = array())
|
public static function edit($weblink, $params, $attribs = array())
|
||||||
{
|
{
|
||||||
$uri = JUri::getInstance();
|
return self::getIcon()->edit($weblink, $params, $attribs);
|
||||||
|
}
|
||||||
|
|
||||||
if ($params && $params->get('popup'))
|
/**
|
||||||
{
|
* Creates an icon instance.
|
||||||
return;
|
*
|
||||||
}
|
* @return \Joomla\Component\Weblinks\Administrator\Service\HTML\Icon
|
||||||
|
*/
|
||||||
if ($weblink->state < 0)
|
private static function getIcon()
|
||||||
{
|
{
|
||||||
return;
|
return (new \Joomla\Component\Weblinks\Administrator\Service\HTML\Icon(Joomla\CMS\Factory::getApplication()));
|
||||||
}
|
|
||||||
|
|
||||||
JHtml::_('bootstrap.tooltip');
|
|
||||||
|
|
||||||
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
|
|
||||||
$icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
|
|
||||||
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
|
|
||||||
|
|
||||||
if ($weblink->state == 0)
|
|
||||||
{
|
|
||||||
$overlib = JText::_('JUNPUBLISHED');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$overlib = JText::_('JPUBLISHED');
|
|
||||||
}
|
|
||||||
|
|
||||||
$date = JHtml::_('date', $weblink->created);
|
|
||||||
$author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
|
|
||||||
|
|
||||||
$overlib .= '<br />';
|
|
||||||
$overlib .= $date;
|
|
||||||
$overlib .= '<br />';
|
|
||||||
$overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
|
|
||||||
|
|
||||||
$button = JHtml::_('link', JRoute::_($url), $text);
|
|
||||||
|
|
||||||
return '<span class="hasTooltip" title="' . JHtml::tooltipText('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,263 +9,14 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks Component Route Helper.
|
* Weblinks Component Route Helper.
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
abstract class WeblinksHelperRoute
|
abstract class WeblinksHelperRoute extends RouteHelper
|
||||||
{
|
{
|
||||||
protected static $lookup;
|
|
||||||
|
|
||||||
protected static $lang_lookup = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the route of the weblink
|
|
||||||
*
|
|
||||||
* @param integer $id Web link ID
|
|
||||||
* @param integer $catid Category ID
|
|
||||||
* @param string $language Language
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getWeblinkRoute($id, $catid, $language = 0)
|
|
||||||
{
|
|
||||||
$needles = array('weblink' => array((int) $id));
|
|
||||||
|
|
||||||
// Create the link
|
|
||||||
$link = 'index.php?option=com_weblinks&view=weblink&id=' . $id;
|
|
||||||
|
|
||||||
if ($catid > 1)
|
|
||||||
{
|
|
||||||
$categories = JCategories::getInstance('Weblinks');
|
|
||||||
$category = $categories->get($catid);
|
|
||||||
|
|
||||||
if ($category)
|
|
||||||
{
|
|
||||||
$needles['category'] = array_reverse($category->getPath());
|
|
||||||
$needles['categories'] = $needles['category'];
|
|
||||||
$link .= '&catid=' . $catid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
|
||||||
{
|
|
||||||
self::buildLanguageLookup();
|
|
||||||
|
|
||||||
if (isset(self::$lang_lookup[$language]))
|
|
||||||
{
|
|
||||||
$link .= '&lang=' . self::$lang_lookup[$language];
|
|
||||||
$needles['language'] = $language;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($item = self::_findItem($needles))
|
|
||||||
{
|
|
||||||
$link .= '&Itemid=' . $item;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ge the form route
|
|
||||||
*
|
|
||||||
* @param integer $id The id of the weblink.
|
|
||||||
* @param string $return The return page variable.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getFormRoute($id, $return = null)
|
|
||||||
{
|
|
||||||
// Create the link.
|
|
||||||
if ($id)
|
|
||||||
{
|
|
||||||
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id=' . $id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$link = 'index.php?option=com_weblinks&task=weblink.add&w_id=0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($return)
|
|
||||||
{
|
|
||||||
$link .= '&return=' . $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Category Route
|
|
||||||
*
|
|
||||||
* @param JCategoryNode|string|integer $catid JCategoryNode object or category ID
|
|
||||||
* @param integer $language Language code
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getCategoryRoute($catid, $language = 0)
|
|
||||||
{
|
|
||||||
if ($catid instanceof JCategoryNode)
|
|
||||||
{
|
|
||||||
$id = $catid->id;
|
|
||||||
$category = $catid;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$id = (int) $catid;
|
|
||||||
$category = JCategories::getInstance('Weblinks')->get($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($id < 1 || !($category instanceof JCategoryNode))
|
|
||||||
{
|
|
||||||
$link = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$needles = array();
|
|
||||||
|
|
||||||
// Create the link
|
|
||||||
$link = 'index.php?option=com_weblinks&view=category&id=' . $id;
|
|
||||||
|
|
||||||
$catids = array_reverse($category->getPath());
|
|
||||||
$needles['category'] = $catids;
|
|
||||||
$needles['categories'] = $catids;
|
|
||||||
|
|
||||||
if ($language && $language != "*" && JLanguageMultilang::isEnabled())
|
|
||||||
{
|
|
||||||
self::buildLanguageLookup();
|
|
||||||
|
|
||||||
if (isset(self::$lang_lookup[$language]))
|
|
||||||
{
|
|
||||||
$link .= '&lang=' . self::$lang_lookup[$language];
|
|
||||||
$needles['language'] = $language;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($item = self::_findItem($needles))
|
|
||||||
{
|
|
||||||
$link .= '&Itemid=' . $item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $link;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do a language lookup
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected static function buildLanguageLookup()
|
|
||||||
{
|
|
||||||
if (count(self::$lang_lookup) == 0)
|
|
||||||
{
|
|
||||||
$db = JFactory::getDbo();
|
|
||||||
$query = $db->getQuery(true)
|
|
||||||
->select('a.sef AS sef')
|
|
||||||
->select('a.lang_code AS lang_code')
|
|
||||||
->from('#__languages AS a');
|
|
||||||
|
|
||||||
$db->setQuery($query);
|
|
||||||
$langs = $db->loadObjectList();
|
|
||||||
|
|
||||||
foreach ($langs as $lang)
|
|
||||||
{
|
|
||||||
self::$lang_lookup[$lang->lang_code] = $lang->sef;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find items per given $needles
|
|
||||||
*
|
|
||||||
* @param array $needles A given array of needles to find
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected static function _findItem($needles = null)
|
|
||||||
{
|
|
||||||
$app = JFactory::getApplication();
|
|
||||||
$menus = $app->getMenu('site');
|
|
||||||
$language = isset($needles['language']) ? $needles['language'] : '*';
|
|
||||||
|
|
||||||
// Prepare the reverse lookup array.
|
|
||||||
if (!isset(self::$lookup[$language]))
|
|
||||||
{
|
|
||||||
self::$lookup[$language] = array();
|
|
||||||
|
|
||||||
$component = JComponentHelper::getComponent('com_weblinks');
|
|
||||||
|
|
||||||
$attributes = array('component_id');
|
|
||||||
$values = array($component->id);
|
|
||||||
|
|
||||||
if ($language != '*')
|
|
||||||
{
|
|
||||||
$attributes[] = 'language';
|
|
||||||
$values[] = array($needles['language'], '*');
|
|
||||||
}
|
|
||||||
|
|
||||||
$items = $menus->getItems($attributes, $values);
|
|
||||||
|
|
||||||
if ($items)
|
|
||||||
{
|
|
||||||
foreach ($items as $item)
|
|
||||||
{
|
|
||||||
if (isset($item->query) && isset($item->query['view']))
|
|
||||||
{
|
|
||||||
$view = $item->query['view'];
|
|
||||||
|
|
||||||
if (!isset(self::$lookup[$language][$view]))
|
|
||||||
{
|
|
||||||
self::$lookup[$language][$view] = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($item->query['id']))
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Here it will become a bit tricky
|
|
||||||
* language != * can override existing entries
|
|
||||||
* language == * cannot override existing entries
|
|
||||||
*/
|
|
||||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
|
||||||
{
|
|
||||||
self::$lookup[$language][$view][$item->query['id']] = $item->id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($needles)
|
|
||||||
{
|
|
||||||
foreach ($needles as $view => $ids)
|
|
||||||
{
|
|
||||||
if (isset(self::$lookup[$language][$view]))
|
|
||||||
{
|
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
if (isset(self::$lookup[$language][$view][(int) $id]))
|
|
||||||
{
|
|
||||||
return self::$lookup[$language][$view][(int) $id];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the active menuitem matches the requested language
|
|
||||||
$active = $menus->getActive();
|
|
||||||
|
|
||||||
if ($active && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
|
|
||||||
{
|
|
||||||
return $active->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not found, return language specific home link
|
|
||||||
$default = $menus->getDefault($language);
|
|
||||||
|
|
||||||
return !empty($default->id) ? $default->id : null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<metadata>
|
|
||||||
</metadata>
|
|
|
@ -1,295 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Routing class from com_weblinks
|
|
||||||
*
|
|
||||||
* @since 3.3
|
|
||||||
*/
|
|
||||||
class WeblinksRouter extends JComponentRouterBase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Build the route for the com_weblinks component
|
|
||||||
*
|
|
||||||
* @param array &$query An array of URL arguments
|
|
||||||
*
|
|
||||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
|
||||||
*
|
|
||||||
* @since 3.3
|
|
||||||
*/
|
|
||||||
public function build(&$query)
|
|
||||||
{
|
|
||||||
$segments = array();
|
|
||||||
|
|
||||||
// Get a menu item based on Itemid or currently active
|
|
||||||
$app = JFactory::getApplication();
|
|
||||||
$menu = $app->getMenu();
|
|
||||||
$params = JComponentHelper::getParams('com_weblinks');
|
|
||||||
$advanced = $params->get('sef_advanced_link', 0);
|
|
||||||
|
|
||||||
// We need a menu item. Either the one specified in the query, or the current active one if none specified
|
|
||||||
if (empty($query['Itemid']))
|
|
||||||
{
|
|
||||||
$menuItem = $menu->getActive();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$menuItem = $menu->getItem($query['Itemid']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
|
|
||||||
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
|
|
||||||
|
|
||||||
if (isset($query['view']))
|
|
||||||
{
|
|
||||||
$view = $query['view'];
|
|
||||||
|
|
||||||
if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_weblinks')
|
|
||||||
{
|
|
||||||
$segments[] = $query['view'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// We need to keep the view for forms since they never have their own menu item
|
|
||||||
if ($view != 'form')
|
|
||||||
{
|
|
||||||
unset($query['view']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Are we dealing with an weblink that is attached to a menu item?
|
|
||||||
if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
|
|
||||||
{
|
|
||||||
unset($query['view']);
|
|
||||||
unset($query['catid']);
|
|
||||||
unset($query['id']);
|
|
||||||
|
|
||||||
return $segments;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($view) and ($view == 'category' or $view == 'weblink'))
|
|
||||||
{
|
|
||||||
if ($mId != (int) $query['id'] || $mView != $view)
|
|
||||||
{
|
|
||||||
if ($view == 'weblink' && isset($query['catid']))
|
|
||||||
{
|
|
||||||
$catid = $query['catid'];
|
|
||||||
}
|
|
||||||
elseif (isset($query['id']))
|
|
||||||
{
|
|
||||||
$catid = $query['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$menuCatid = $mId;
|
|
||||||
$categories = JCategories::getInstance('Weblinks');
|
|
||||||
$category = $categories->get($catid);
|
|
||||||
|
|
||||||
if ($category)
|
|
||||||
{
|
|
||||||
// TODO Throw error that the category either not exists or is unpublished
|
|
||||||
$path = $category->getPath();
|
|
||||||
$path = array_reverse($path);
|
|
||||||
|
|
||||||
$array = array();
|
|
||||||
|
|
||||||
foreach ($path as $id)
|
|
||||||
{
|
|
||||||
if ((int) $id == (int) $menuCatid)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($advanced)
|
|
||||||
{
|
|
||||||
list($tmp, $id) = explode(':', $id, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$array[] = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$segments = array_merge($segments, array_reverse($array));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($view == 'weblink')
|
|
||||||
{
|
|
||||||
if ($advanced)
|
|
||||||
{
|
|
||||||
list($tmp, $id) = explode(':', $query['id'], 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$id = $query['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$segments[] = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($query['id']);
|
|
||||||
unset($query['catid']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($query['layout']))
|
|
||||||
{
|
|
||||||
if (!empty($query['Itemid']) && isset($menuItem->query['layout']))
|
|
||||||
{
|
|
||||||
if ($query['layout'] == $menuItem->query['layout'])
|
|
||||||
{
|
|
||||||
unset($query['layout']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($query['layout'] == 'default')
|
|
||||||
{
|
|
||||||
unset($query['layout']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$total = count($segments);
|
|
||||||
|
|
||||||
for ($i = 0; $i < $total; $i++)
|
|
||||||
{
|
|
||||||
$segments[$i] = str_replace(':', '-', $segments[$i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $segments;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse the segments of a URL.
|
|
||||||
*
|
|
||||||
* @param array &$segments The segments of the URL to parse.
|
|
||||||
*
|
|
||||||
* @return array The URL attributes to be used by the application.
|
|
||||||
*
|
|
||||||
* @since 3.3
|
|
||||||
*/
|
|
||||||
public function parse(&$segments)
|
|
||||||
{
|
|
||||||
$total = count($segments);
|
|
||||||
$vars = array();
|
|
||||||
|
|
||||||
for ($i = 0; $i < $total; $i++)
|
|
||||||
{
|
|
||||||
$segments[$i] = preg_replace('/-/', ':', $segments[$i], 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the active menu item.
|
|
||||||
$app = JFactory::getApplication();
|
|
||||||
$menu = $app->getMenu();
|
|
||||||
$item = $menu->getActive();
|
|
||||||
$params = JComponentHelper::getParams('com_weblinks');
|
|
||||||
$advanced = $params->get('sef_advanced_link', 0);
|
|
||||||
|
|
||||||
// Count route segments
|
|
||||||
$count = count($segments);
|
|
||||||
|
|
||||||
// Standard routing for weblinks.
|
|
||||||
if (!isset($item))
|
|
||||||
{
|
|
||||||
$vars['view'] = $segments[0];
|
|
||||||
$vars['id'] = $segments[$count - 1];
|
|
||||||
|
|
||||||
return $vars;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From the categories view, we can only jump to a category.
|
|
||||||
$id = (isset($item->query['id']) && $item->query['id'] > 1) ? $item->query['id'] : 'root';
|
|
||||||
|
|
||||||
$category = JCategories::getInstance('Weblinks')->get($id);
|
|
||||||
|
|
||||||
$categories = $category->getChildren();
|
|
||||||
$found = 0;
|
|
||||||
|
|
||||||
foreach ($segments as $segment)
|
|
||||||
{
|
|
||||||
foreach ($categories as $category)
|
|
||||||
{
|
|
||||||
if (($category->slug == $segment) || ($advanced && $category->alias == str_replace(':', '-', $segment)))
|
|
||||||
{
|
|
||||||
$vars['id'] = $category->id;
|
|
||||||
$vars['view'] = 'category';
|
|
||||||
$categories = $category->getChildren();
|
|
||||||
$found = 1;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($found == 0)
|
|
||||||
{
|
|
||||||
if ($advanced)
|
|
||||||
{
|
|
||||||
$db = JFactory::getDbo();
|
|
||||||
$query = $db->getQuery(true)
|
|
||||||
->select($db->quoteName('id'))
|
|
||||||
->from('#__weblinks')
|
|
||||||
->where($db->quoteName('catid') . ' = ' . (int) $vars['catid'])
|
|
||||||
->where($db->quoteName('alias') . ' = ' . $db->quote(str_replace(':', '-', $segment)));
|
|
||||||
$db->setQuery($query);
|
|
||||||
$id = $db->loadResult();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$id = $segment;
|
|
||||||
}
|
|
||||||
|
|
||||||
$vars['id'] = $id;
|
|
||||||
$vars['view'] = 'weblink';
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$found = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $vars;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Weblinks router functions
|
|
||||||
*
|
|
||||||
* @param array &$query An array of URL arguments
|
|
||||||
*
|
|
||||||
* @return array The URL arguments to use to assemble the subsequent URL.
|
|
||||||
*
|
|
||||||
* Note. These functions are proxies for the new router interface
|
|
||||||
* for old SEF extensions.
|
|
||||||
*
|
|
||||||
* @deprecated 4.0 Use Class based routers instead
|
|
||||||
*/
|
|
||||||
function WeblinksBuildRoute(&$query)
|
|
||||||
{
|
|
||||||
$router = new WeblinksRouter;
|
|
||||||
|
|
||||||
return $router->build($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Weblinks router functions
|
|
||||||
*
|
|
||||||
* @param array $segments The segments of the URL to parse.
|
|
||||||
*
|
|
||||||
* @return array The URL attributes to be used by the application.
|
|
||||||
*
|
|
||||||
* Note. These functions are proxies for the new router interface
|
|
||||||
* for old SEF extensions.
|
|
||||||
*
|
|
||||||
* @deprecated 4.0 Use Class based routers instead
|
|
||||||
*/
|
|
||||||
function WeblinksParseRoute($segments)
|
|
||||||
{
|
|
||||||
$router = new WeblinksRouter;
|
|
||||||
|
|
||||||
return $router->parse($segments);
|
|
||||||
}
|
|
|
@ -7,14 +7,19 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Controller;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\Controller\BaseController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks Component Controller
|
* Weblinks Component Controller
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinksController extends JControllerLegacy
|
class DisplayController extends BaseController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Method to display a view.
|
* Method to display a view.
|
||||||
|
@ -23,7 +28,7 @@ class WeblinksController extends JControllerLegacy
|
||||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||||
* for valid values see {@link JFilterInput::clean()}.
|
* for valid values see {@link JFilterInput::clean()}.
|
||||||
*
|
*
|
||||||
* @return WeblinksController This object to support chaining.
|
* @return BaseController This object to support chaining.
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +46,7 @@ class WeblinksController extends JControllerLegacy
|
||||||
$vName = $this->input->get('view', 'categories');
|
$vName = $this->input->get('view', 'categories');
|
||||||
$this->input->set('view', $vName);
|
$this->input->set('view', $vName);
|
||||||
|
|
||||||
if (JFactory::getUser()->id ||($this->input->getMethod() == 'POST' && $vName == 'categories'))
|
if ($this->app->getIdentity()->id ||($this->input->getMethod() == 'POST' && $vName == 'categories'))
|
||||||
{
|
{
|
||||||
$cacheable = false;
|
$cacheable = false;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +64,7 @@ class WeblinksController extends JControllerLegacy
|
||||||
if ($vName == 'form' && !$this->checkEditId('com_weblinks.edit.weblink', $id))
|
if ($vName == 'form' && !$this->checkEditId('com_weblinks.edit.weblink', $id))
|
||||||
{
|
{
|
||||||
// Somehow the person just went to the form - we don't allow that.
|
// Somehow the person just went to the form - we don't allow that.
|
||||||
return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::display($cacheable, $safeurlparams);
|
return parent::display($cacheable, $safeurlparams);
|
|
@ -7,8 +7,13 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Controller;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\Controller\FormController;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
use Joomla\Utilities\ArrayHelper;
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +21,7 @@ use Joomla\Utilities\ArrayHelper;
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinksControllerWeblink extends JControllerForm
|
class WeblinkController extends FormController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The URL view item variable.
|
* The URL view item variable.
|
||||||
|
@ -55,7 +60,11 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
{
|
{
|
||||||
// Redirect to the return page.
|
// Redirect to the return page.
|
||||||
$this->setRedirect($this->getReturnPage());
|
$this->setRedirect($this->getReturnPage());
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,20 +79,14 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
protected function allowAdd($data = array())
|
protected function allowAdd($data = array())
|
||||||
{
|
{
|
||||||
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('id'), 'int');
|
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('id'), 'int');
|
||||||
$allow = null;
|
|
||||||
|
|
||||||
if ($categoryId)
|
if ($categoryId)
|
||||||
{
|
{
|
||||||
// If the category has been passed in the URL check it.
|
// If the category has been passed in the URL check it.
|
||||||
$allow = JFactory::getUser()->authorise('core.create', $this->option . '.category.' . $categoryId);
|
return $this->app->getIdentity()->authorise('core.create', $this->option . '.category.' . $categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($allow !== null)
|
// In the absence of better information, revert to the component permissions.
|
||||||
{
|
|
||||||
return $allow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the absense of better information, revert to the component permissions.
|
|
||||||
return parent::allowAdd($data);
|
return parent::allowAdd($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +103,33 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
protected function allowEdit($data = array(), $key = 'id')
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
{
|
{
|
||||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||||
$categoryId = 0;
|
|
||||||
|
|
||||||
if ($recordId)
|
if (!$recordId)
|
||||||
{
|
{
|
||||||
$categoryId = (int) $this->getModel()->getItem($recordId)->catid;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$record = $this->getModel()->getItem($recordId);
|
||||||
|
$categoryId = (int) $record->catid;
|
||||||
|
|
||||||
if ($categoryId)
|
if ($categoryId)
|
||||||
{
|
{
|
||||||
// The category has been set. Check the category permissions.
|
// The category has been set. Check the category permissions.
|
||||||
return JFactory::getUser()->authorise('core.edit', $this->option . '.category.' . $categoryId);
|
$user = $this->app->getIdentity();
|
||||||
|
|
||||||
|
// First, check edit permission
|
||||||
|
if ($user->authorise('core.edit', $this->option . '.category.' . $categoryId))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback on edit.own
|
||||||
|
if ($user->authorise('core.edit.own', $this->option . '.category.' . $categoryId) && $record->created_by == $user->id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since there is no asset tracking, revert to the component permissions.
|
// Since there is no asset tracking, revert to the component permissions.
|
||||||
|
@ -162,7 +181,7 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
public function getModel($name = 'form', $prefix = '', $config = array('ignore_request' => true))
|
public function getModel($name = 'form', $prefix = 'Site', $config = array('ignore_request' => true))
|
||||||
{
|
{
|
||||||
return parent::getModel($name, $prefix, $config);
|
return parent::getModel($name, $prefix, $config);
|
||||||
}
|
}
|
||||||
|
@ -207,9 +226,9 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
{
|
{
|
||||||
$return = $this->input->get('return', null, 'base64');
|
$return = $this->input->get('return', null, 'base64');
|
||||||
|
|
||||||
if (empty($return) || !JUri::isInternal(base64_decode($return)))
|
if (empty($return) || !Uri::isInternal(base64_decode($return)))
|
||||||
{
|
{
|
||||||
return JUri::base();
|
return Uri::base();
|
||||||
}
|
}
|
||||||
|
|
||||||
return base64_decode($return);
|
return base64_decode($return);
|
||||||
|
@ -228,7 +247,7 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
public function save($key = null, $urlVar = 'w_id')
|
public function save($key = null, $urlVar = 'w_id')
|
||||||
{
|
{
|
||||||
// Get the application
|
// Get the application
|
||||||
$app = JFactory::getApplication();
|
$app = $this->app;
|
||||||
|
|
||||||
// Get the data from POST
|
// Get the data from POST
|
||||||
$data = $this->input->post->get('jform', array(), 'array');
|
$data = $this->input->post->get('jform', array(), 'array');
|
||||||
|
@ -253,6 +272,8 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public function go()
|
public function go()
|
||||||
|
@ -261,7 +282,7 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
$id = $this->input->getInt('id');
|
$id = $this->input->getInt('id');
|
||||||
|
|
||||||
// Get the model, requiring published items
|
// Get the model, requiring published items
|
||||||
$modelLink = $this->getModel('Weblink', '', array('ignore_request' => true));
|
$modelLink = $this->getModel('Weblink');
|
||||||
$modelLink->setState('filter.published', 1);
|
$modelLink->setState('filter.published', 1);
|
||||||
|
|
||||||
// Get the item
|
// Get the item
|
||||||
|
@ -270,19 +291,19 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
// Make sure the item was found.
|
// Make sure the item was found.
|
||||||
if (empty($link))
|
if (empty($link))
|
||||||
{
|
{
|
||||||
return JError::raiseWarning(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
|
throw new \Exception(Text::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether item access level allows access.
|
// Check whether item access level allows access.
|
||||||
$groups = JFactory::getUser()->getAuthorisedViewLevels();
|
$groups = $this->app->getIdentity()->getAuthorisedViewLevels();
|
||||||
|
|
||||||
if (!in_array($link->access, $groups))
|
if (!in_array($link->access, $groups))
|
||||||
{
|
{
|
||||||
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
throw new \Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether category access level allows access.
|
// Check whether category access level allows access.
|
||||||
$modelCat = $this->getModel('Category', 'WeblinksModel', array('ignore_request' => true));
|
$modelCat = $this->getModel('Category', 'Site', array('ignore_request' => true));
|
||||||
$modelCat->setState('filter.published', 1);
|
$modelCat->setState('filter.published', 1);
|
||||||
|
|
||||||
// Get the category
|
// Get the category
|
||||||
|
@ -291,23 +312,22 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||||
// Make sure the category was found.
|
// Make sure the category was found.
|
||||||
if (empty($category))
|
if (empty($category))
|
||||||
{
|
{
|
||||||
return JError::raiseWarning(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
|
throw new \Exception(Text::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether item access level allows access.
|
// Check whether item access level allows access.
|
||||||
if (!in_array($category->access, $groups))
|
if (!in_array($category->access, $groups))
|
||||||
{
|
{
|
||||||
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
throw new \Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the URL
|
// Redirect to the URL
|
||||||
// @todo: Probably should check for a valid http link
|
|
||||||
if ($link->url)
|
if ($link->url)
|
||||||
{
|
{
|
||||||
$modelLink->hit($id);
|
$modelLink->hit($id);
|
||||||
JFactory::getApplication()->redirect($link->url, 301);
|
$this->app->redirect($link->url, 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JError::raiseWarning(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_URL_INVALID'));
|
throw new \Exception(Text::_('COM_WEBLINKS_ERROR_WEBLINK_URL_INVALID'), 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,18 +7,20 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Helper;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_weblinks/helpers/weblinks.php');
|
use Joomla\CMS\Factory;
|
||||||
JLoader::register('WeblinksHelperRoute', JPATH_SITE . '/components/com_weblinks/helpers/route.php');
|
use Joomla\CMS\Language\Associations;
|
||||||
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');
|
use Joomla\Component\Categories\Administrator\Helper\CategoryAssociationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks Component Association Helper
|
* Weblinks Component Association Helper
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
abstract class WeblinksHelperAssociation extends CategoryHelperAssociation
|
abstract class AssociationHelper extends CategoryAssociationHelper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Method to get the associations for a given item
|
* Method to get the associations for a given item
|
||||||
|
@ -32,21 +34,21 @@ abstract class WeblinksHelperAssociation extends CategoryHelperAssociation
|
||||||
*/
|
*/
|
||||||
public static function getAssociations($id = 0, $view = null)
|
public static function getAssociations($id = 0, $view = null)
|
||||||
{
|
{
|
||||||
$jinput = JFactory::getApplication()->input;
|
$input = Factory::getApplication()->input;
|
||||||
$view = is_null($view) ? $jinput->get('view') : $view;
|
$view = is_null($view) ? $input->get('view') : $view;
|
||||||
$id = empty($id) ? $jinput->getInt('id') : $id;
|
$id = empty($id) ? $input->getInt('id') : $id;
|
||||||
|
|
||||||
if ($view === 'weblink')
|
if ($view === 'weblink')
|
||||||
{
|
{
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$associations = JLanguageAssociations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $id);
|
$associations = Associations::getAssociations('com_weblinks', '#__weblinks', 'com_weblinks.item', $id);
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
|
|
||||||
foreach ($associations as $tag => $item)
|
foreach ($associations as $tag => $item)
|
||||||
{
|
{
|
||||||
$return[$tag] = WeblinksHelperRoute::getWeblinkRoute($item->id, (int) $item->catid, $item->language);
|
$return[$tag] = RouteHelper::getWeblinkRoute($item->id, (int) $item->catid, $item->language);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
115
src/components/com_weblinks/src/Helper/RouteHelper.php
Normal file
115
src/components/com_weblinks/src/Helper/RouteHelper.php
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Helper;
|
||||||
|
|
||||||
|
use Joomla\CMS\Categories\CategoryNode;
|
||||||
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks Component Route Helper.
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
abstract class RouteHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the route of the weblink
|
||||||
|
*
|
||||||
|
* @param integer $id Web link ID
|
||||||
|
* @param integer $catid Category ID
|
||||||
|
* @param string $language Language
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getWeblinkRoute($id, $catid, $language = 0)
|
||||||
|
{
|
||||||
|
// Create the link
|
||||||
|
$link = 'index.php?option=com_weblinks&view=weblink&id=' . $id;
|
||||||
|
|
||||||
|
if ($catid > 1)
|
||||||
|
{
|
||||||
|
$link .= '&catid=' . $catid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($language && $language !== '*' && Multilanguage::isEnabled())
|
||||||
|
{
|
||||||
|
$link .= '&lang=' . $language;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ge the form route
|
||||||
|
*
|
||||||
|
* @param integer $id The id of the weblink.
|
||||||
|
* @param string $return The return page variable.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getFormRoute($id, $return = null)
|
||||||
|
{
|
||||||
|
// Create the link.
|
||||||
|
if ($id)
|
||||||
|
{
|
||||||
|
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id=' . $id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$link = 'index.php?option=com_weblinks&task=weblink.add&w_id=0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
{
|
||||||
|
$link .= '&return=' . $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Category Route
|
||||||
|
*
|
||||||
|
* @param CategoryNode|string|integer $catid JCategoryNode object or category ID
|
||||||
|
* @param integer $language Language code
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getCategoryRoute($catid, $language = 0)
|
||||||
|
{
|
||||||
|
if ($catid instanceof CategoryNode)
|
||||||
|
{
|
||||||
|
$id = $catid->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$id = (int) $catid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($id < 1)
|
||||||
|
{
|
||||||
|
$link = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Create the link
|
||||||
|
$link = 'index.php?option=com_weblinks&view=category&id=' . $id;
|
||||||
|
|
||||||
|
if ($language && $language !== '*' && Multilanguage::isEnabled())
|
||||||
|
{
|
||||||
|
$link .= '&lang=' . $language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,14 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Model;
|
||||||
|
|
||||||
|
use Joomla\CMS\Categories\Categories;
|
||||||
|
use Joomla\CMS\Categories\CategoryNode;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\MVC\Model\ListModel;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +22,7 @@ defined('_JEXEC') or die;
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
class WeblinksModelCategories extends JModelList
|
class CategoriesModel extends ListModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Context string for the model type. This is used to handle uniqueness
|
* Context string for the model type. This is used to handle uniqueness
|
||||||
|
@ -31,8 +39,18 @@ class WeblinksModelCategories extends JModelList
|
||||||
*/
|
*/
|
||||||
protected $_extension = 'com_weblinks';
|
protected $_extension = 'com_weblinks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent category
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
private $_parent = null;
|
private $_parent = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories data
|
||||||
|
*
|
||||||
|
* @var false|array
|
||||||
|
*/
|
||||||
private $_items = null;
|
private $_items = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +67,7 @@ class WeblinksModelCategories extends JModelList
|
||||||
*/
|
*/
|
||||||
protected function populateState($ordering = null, $direction = null)
|
protected function populateState($ordering = null, $direction = null)
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$this->setState('filter.extension', $this->_extension);
|
$this->setState('filter.extension', $this->_extension);
|
||||||
|
|
||||||
// Get the parent id if defined.
|
// Get the parent id if defined.
|
||||||
|
@ -92,22 +110,16 @@ class WeblinksModelCategories extends JModelList
|
||||||
*/
|
*/
|
||||||
public function getItems()
|
public function getItems()
|
||||||
{
|
{
|
||||||
if (!count($this->_items))
|
if ($this->_items === null)
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$params = $this->getState('params', new Registry);
|
||||||
$menu = $app->getMenu();
|
|
||||||
$active = $menu->getActive();
|
|
||||||
$params = new JRegistry;
|
|
||||||
|
|
||||||
if ($active)
|
$options = array();
|
||||||
{
|
$options['access'] = $this->getState('filter.access');
|
||||||
$params->loadString($active->params);
|
$options['published'] = $this->getState('filter.published');
|
||||||
}
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$options['countItems'] = $params->get('show_cat_num_links', 1) || !$params->get('show_empty_categories_cat', 0);
|
$options['countItems'] = $params->get('show_cat_num_links', 1) || !$params->get('show_empty_categories_cat', 0);
|
||||||
$categories = JCategories::getInstance('Weblinks', $options);
|
$categories = Categories::getInstance('Weblinks', $options);
|
||||||
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
||||||
|
|
||||||
if (is_object($this->_parent))
|
if (is_object($this->_parent))
|
||||||
{
|
{
|
|
@ -7,8 +7,18 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Model;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Categories\Categories;
|
||||||
|
use Joomla\CMS\Categories\CategoryNode;
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
use Joomla\CMS\MVC\Model\ListModel;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,21 +26,41 @@ use Joomla\Registry\Registry;
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinksModelCategory extends JModelList
|
class CategoryModel extends ListModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Category items data
|
* Category item data
|
||||||
*
|
*
|
||||||
* @var array
|
* @var CategoryNode|null
|
||||||
*/
|
*/
|
||||||
protected $_item = null;
|
protected $_item = null;
|
||||||
|
|
||||||
protected $_articles = null;
|
/**
|
||||||
|
* Category left of this one
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
|
protected $_leftsibling = null;
|
||||||
|
|
||||||
protected $_siblings = null;
|
/**
|
||||||
|
* Category right right of this one
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
|
protected $_rightsibling = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of child-categories
|
||||||
|
*
|
||||||
|
* @var CategoryNode[]|null
|
||||||
|
*/
|
||||||
protected $_children = null;
|
protected $_children = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent category of the current one
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
protected $_parent = null;
|
protected $_parent = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,19 +86,6 @@ class WeblinksModelCategory extends JModelList
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The category that applies.
|
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
protected $_category = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The list of other weblink categories.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $_categories = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to get a list of items.
|
* Method to get a list of items.
|
||||||
|
@ -85,13 +102,11 @@ class WeblinksModelCategory extends JModelList
|
||||||
{
|
{
|
||||||
if (!isset($this->_params))
|
if (!isset($this->_params))
|
||||||
{
|
{
|
||||||
$params = new Registry;
|
$item->params = new Registry($item->params);
|
||||||
$params->loadString($item->params);
|
|
||||||
$item->params = $params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the tags
|
// Get the tags
|
||||||
$item->tags = new JHelperTags;
|
$item->tags = new TagsHelper;
|
||||||
$item->tags->getItemTags('com_weblinks.weblink', $item->id);
|
$item->tags->getItemTags('com_weblinks.weblink', $item->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,22 +116,22 @@ class WeblinksModelCategory extends JModelList
|
||||||
/**
|
/**
|
||||||
* Method to get a JDatabaseQuery object for retrieving the data set from a database.
|
* Method to get a JDatabaseQuery object for retrieving the data set from a database.
|
||||||
*
|
*
|
||||||
* @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set.
|
* @return \JDatabaseQuery A JDatabaseQuery object to retrieve the data set.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
protected function getListQuery()
|
protected function getListQuery()
|
||||||
{
|
{
|
||||||
$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
|
$viewLevels = Factory::getApplication()->getIdentity()->getAuthorisedViewLevels();
|
||||||
|
|
||||||
// Create a new query object.
|
// Create a new query object.
|
||||||
$db = $this->getDbo();
|
$db = $this->getDbo();
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
// Select required fields from the categories.
|
// Select required fields from the categories.
|
||||||
$query->select($this->getState('list.select', 'a.*'))
|
$query->select($this->getState('list.select', 'a.*'))
|
||||||
->from($db->quoteName('#__weblinks') . ' AS a')
|
->from($db->quoteName('#__weblinks') . ' AS a')
|
||||||
->where('a.access IN (' . $groups . ')');
|
->whereIn($db->quoteName('a.access'), $viewLevels);
|
||||||
|
|
||||||
// Filter by category.
|
// Filter by category.
|
||||||
if ($categoryId = $this->getState('category.id'))
|
if ($categoryId = $this->getState('category.id'))
|
||||||
|
@ -125,15 +140,17 @@ class WeblinksModelCategory extends JModelList
|
||||||
if ($this->getState('category.group', 0))
|
if ($this->getState('category.group', 0))
|
||||||
{
|
{
|
||||||
$query->select('c.title AS category_title')
|
$query->select('c.title AS category_title')
|
||||||
->where('c.parent_id = ' . (int) $categoryId)
|
->where('c.parent_id = :parent_id')
|
||||||
|
->bind(':parent_id', $categoryId, ParameterType::INTEGER)
|
||||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||||
->where('c.access IN (' . $groups . ')');
|
->whereIn($db->quoteName('c.access'), $viewLevels);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$query->where('a.catid = ' . (int) $categoryId)
|
$query->where('a.catid = :catid')
|
||||||
|
->bind(':catid', $categoryId, ParameterType::INTEGER)
|
||||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||||
->where('c.access IN (' . $groups . ')');
|
->whereIn($db->quoteName('c.access'), $viewLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by published category
|
// Filter by published category
|
||||||
|
@ -141,7 +158,8 @@ class WeblinksModelCategory extends JModelList
|
||||||
|
|
||||||
if (is_numeric($cpublished))
|
if (is_numeric($cpublished))
|
||||||
{
|
{
|
||||||
$query->where('c.published = ' . (int) $cpublished);
|
$query->where('c.published = :published')
|
||||||
|
->bind(':published', $cpublished, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,26 +174,31 @@ class WeblinksModelCategory extends JModelList
|
||||||
|
|
||||||
if (is_numeric($state))
|
if (is_numeric($state))
|
||||||
{
|
{
|
||||||
$query->where('a.state = ' . (int) $state);
|
$query->where('a.state = :state')
|
||||||
|
->bind(':state', $state, ParameterType::INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not show trashed links on the front-end
|
// Do not show trashed links on the front-end
|
||||||
$query->where('a.state != -2');
|
$query->where('a.state != -2');
|
||||||
|
|
||||||
// Filter by start and end dates.
|
// Filter by start and end dates.
|
||||||
$nullDate = $db->quote($db->getNullDate());
|
|
||||||
$nowDate = $db->quote(JFactory::getDate()->toSql());
|
|
||||||
|
|
||||||
if ($this->getState('filter.publish_date'))
|
if ($this->getState('filter.publish_date'))
|
||||||
{
|
{
|
||||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
$nowDate = Factory::getDate()->toSql();
|
||||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
$query->where('(' . $db->quoteName('a.publish_up')
|
||||||
|
. ' IS NULL OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)'
|
||||||
|
)
|
||||||
|
->where('(' . $db->quoteName('a.publish_down')
|
||||||
|
. ' IS NULL OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)'
|
||||||
|
)
|
||||||
|
->bind(':publish_up', $nowDate)
|
||||||
|
->bind(':publish_down', $nowDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by language
|
// Filter by language
|
||||||
if ($this->getState('filter.language'))
|
if ($this->getState('filter.language'))
|
||||||
{
|
{
|
||||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
$query->whereIn($db->quoteName('a.language'), [Factory::getLanguage()->getTag(), '*'], ParameterType::STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by search in title
|
// Filter by search in title
|
||||||
|
@ -183,10 +206,11 @@ class WeblinksModelCategory extends JModelList
|
||||||
|
|
||||||
if (!empty($search))
|
if (!empty($search))
|
||||||
{
|
{
|
||||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
$search = '%' . trim($search) . '%';
|
||||||
$query->where('(a.title LIKE ' . $search . ')');
|
$query->where('(a.title LIKE :search)')
|
||||||
|
->bind(':search', $search);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If grouping by subcategory, add the subcategory list ordering clause.
|
// If grouping by subcategory, add the subcategory list ordering clause.
|
||||||
if ($this->getState('category.group', 0))
|
if ($this->getState('category.group', 0))
|
||||||
{
|
{
|
||||||
|
@ -219,8 +243,10 @@ class WeblinksModelCategory extends JModelList
|
||||||
*/
|
*/
|
||||||
protected function populateState($ordering = null, $direction = null)
|
protected function populateState($ordering = null, $direction = null)
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$params = JComponentHelper::getParams('com_weblinks');
|
|
||||||
|
$params = $app->getParams();
|
||||||
|
$this->setState('params', $params);
|
||||||
|
|
||||||
// List state information
|
// List state information
|
||||||
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
|
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
|
||||||
|
@ -253,9 +279,9 @@ class WeblinksModelCategory extends JModelList
|
||||||
$id = $app->input->get('id', 0, 'int');
|
$id = $app->input->get('id', 0, 'int');
|
||||||
$this->setState('category.id', $id);
|
$this->setState('category.id', $id);
|
||||||
|
|
||||||
$user = JFactory::getUser();
|
$user = $app->getIdentity();
|
||||||
|
|
||||||
if ((!$user->authorise('core.edit.state', 'com_weblinks')) && (!$user->authorise('core.edit', 'com_weblinks')))
|
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
||||||
{
|
{
|
||||||
// Limit to published for people who can't edit or edit.state.
|
// Limit to published for people who can't edit or edit.state.
|
||||||
$this->setState('filter.state', 1);
|
$this->setState('filter.state', 1);
|
||||||
|
@ -264,10 +290,7 @@ class WeblinksModelCategory extends JModelList
|
||||||
$this->setState('filter.publish_date', true);
|
$this->setState('filter.publish_date', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
$this->setState('filter.language', Multilanguage::isEnabled());
|
||||||
|
|
||||||
// Load the parameters.
|
|
||||||
$this->setState('params', $params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,27 +304,19 @@ class WeblinksModelCategory extends JModelList
|
||||||
{
|
{
|
||||||
if (!is_object($this->_item))
|
if (!is_object($this->_item))
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$params = $this->getState('params', new Registry);
|
||||||
$menu = $app->getMenu();
|
|
||||||
$active = $menu->getActive();
|
|
||||||
$params = new Registry;
|
|
||||||
|
|
||||||
if ($active)
|
$options = array();
|
||||||
{
|
|
||||||
$params->loadString($active->params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$options['countItems'] = $params->get('show_cat_num_links_cat', 1)
|
$options['countItems'] = $params->get('show_cat_num_links_cat', 1)
|
||||||
|| $params->get('show_empty_categories', 0);
|
|| $params->get('show_empty_categories', 0);
|
||||||
|
|
||||||
$categories = JCategories::getInstance('Weblinks', $options);
|
$categories = Categories::getInstance('Weblinks', $options);
|
||||||
$this->_item = $categories->get($this->getState('category.id', 'root'));
|
$this->_item = $categories->get($this->getState('category.id', 'root'));
|
||||||
|
|
||||||
if (is_object($this->_item))
|
if (is_object($this->_item))
|
||||||
{
|
{
|
||||||
$this->_children = $this->_item->getChildren();
|
$this->_children = $this->_item->getChildren();
|
||||||
$this->_parent = false;
|
$this->_parent = false;
|
||||||
|
|
||||||
if ($this->_item->getParent())
|
if ($this->_item->getParent())
|
||||||
{
|
{
|
||||||
|
@ -309,12 +324,12 @@ class WeblinksModelCategory extends JModelList
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_rightsibling = $this->_item->getSibling();
|
$this->_rightsibling = $this->_item->getSibling();
|
||||||
$this->_leftsibling = $this->_item->getSibling(false);
|
$this->_leftsibling = $this->_item->getSibling(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->_children = false;
|
$this->_children = false;
|
||||||
$this->_parent = false;
|
$this->_parent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,12 +407,12 @@ class WeblinksModelCategory extends JModelList
|
||||||
*/
|
*/
|
||||||
public function hit($pk = 0)
|
public function hit($pk = 0)
|
||||||
{
|
{
|
||||||
$hitcount = JFactory::getApplication()->input->getInt('hitcount', 1);
|
$hitcount = Factory::getApplication()->input->getInt('hitcount', 1);
|
||||||
|
|
||||||
if ($hitcount)
|
if ($hitcount)
|
||||||
{
|
{
|
||||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
||||||
$table = JTable::getInstance('Category', 'JTable');
|
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
$table->load($pk);
|
$table->load($pk);
|
||||||
$table->hit($pk);
|
$table->hit($pk);
|
||||||
}
|
}
|
|
@ -7,16 +7,21 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Model;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/weblink.php';
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
use Joomla\Component\Weblinks\Administrator\Model\WeblinkModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks model.
|
* Weblinks model.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
class WeblinksModelForm extends WeblinksModelWeblink
|
class FormModel extends WeblinkModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Model typeAlias string. Used for version history.
|
* Model typeAlias string. Used for version history.
|
||||||
|
@ -49,7 +54,7 @@ class WeblinksModelForm extends WeblinksModelWeblink
|
||||||
*/
|
*/
|
||||||
protected function populateState()
|
protected function populateState()
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
// Load state from the request.
|
// Load state from the request.
|
||||||
$pk = $app->input->getInt('w_id');
|
$pk = $app->input->getInt('w_id');
|
||||||
|
@ -63,7 +68,7 @@ class WeblinksModelForm extends WeblinksModelWeblink
|
||||||
|
|
||||||
$return = $app->input->get('return', null, 'base64');
|
$return = $app->input->get('return', null, 'base64');
|
||||||
|
|
||||||
if (!JUri::isInternal(base64_decode($return)))
|
if (!Uri::isInternal(base64_decode($return)))
|
||||||
{
|
{
|
||||||
$return = null;
|
$return = null;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +97,7 @@ class WeblinksModelForm extends WeblinksModelWeblink
|
||||||
$form = $this->loadForm('com_weblinks.form', 'weblink', array('control' => 'jform', 'load_data' => $loadData));
|
$form = $this->loadForm('com_weblinks.form', 'weblink', array('control' => 'jform', 'load_data' => $loadData));
|
||||||
|
|
||||||
// Disable the buttons and just allow editor none for not authenticated users
|
// Disable the buttons and just allow editor none for not authenticated users
|
||||||
if (JFactory::getUser()->guest)
|
if (Factory::getApplication()->getIdentity()->guest)
|
||||||
{
|
{
|
||||||
$form->setFieldAttribute('description', 'editor', 'none');
|
$form->setFieldAttribute('description', 'editor', 'none');
|
||||||
$form->setFieldAttribute('description', 'buttons', 'no');
|
$form->setFieldAttribute('description', 'buttons', 'no');
|
||||||
|
@ -100,4 +105,21 @@ class WeblinksModelForm extends WeblinksModelWeblink
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get a table object, load it if necessary.
|
||||||
|
*
|
||||||
|
* @param string $name The table name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
* @param array $options Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return Table A Table object
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function getTable($name = 'Weblink', $prefix = 'Administrator', $options = array())
|
||||||
|
{
|
||||||
|
return parent::getTable($name, $prefix, $options);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,20 +7,34 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Model;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\Utilities\ArrayHelper;
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Helper\TagsHelper;
|
||||||
|
use Joomla\CMS\Language\Multilanguage;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\Model\ItemModel;
|
||||||
|
use Joomla\CMS\Table\Table;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
use Joomla\Registry\Registry;
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks Component Model for a Weblink record
|
* Weblinks Component Model for a Weblink record
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinksModelWeblink extends JModelItem
|
class WeblinkModel extends ItemModel
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Store loaded weblink items
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected $_item = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model context string.
|
* Model context string.
|
||||||
*
|
*
|
||||||
|
@ -39,7 +53,7 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
*/
|
*/
|
||||||
protected function populateState()
|
protected function populateState()
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication('site');
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
// Load the object state.
|
// Load the object state.
|
||||||
$pk = $app->input->getInt('id');
|
$pk = $app->input->getInt('id');
|
||||||
|
@ -49,15 +63,15 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
$params = $app->getParams();
|
$params = $app->getParams();
|
||||||
$this->setState('params', $params);
|
$this->setState('params', $params);
|
||||||
|
|
||||||
$user = JFactory::getUser();
|
$user = $app->getIdentity();
|
||||||
|
|
||||||
if ((!$user->authorise('core.edit.state', 'com_weblinks')) && (!$user->authorise('core.edit', 'com_weblinks')))
|
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
||||||
{
|
{
|
||||||
$this->setState('filter.published', 1);
|
$this->setState('filter.published', 1);
|
||||||
$this->setState('filter.archived', 2);
|
$this->setState('filter.archived', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
$this->setState('filter.language', Multilanguage::isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +83,7 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
*/
|
*/
|
||||||
public function getItem($pk = null)
|
public function getItem($pk = null)
|
||||||
{
|
{
|
||||||
$user = JFactory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('weblink.id');
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('weblink.id');
|
||||||
|
|
||||||
|
@ -86,7 +100,8 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
$query = $db->getQuery(true)
|
$query = $db->getQuery(true)
|
||||||
->select($this->getState('item.select', 'a.*'))
|
->select($this->getState('item.select', 'a.*'))
|
||||||
->from('#__weblinks AS a')
|
->from('#__weblinks AS a')
|
||||||
->where('a.id = ' . (int) $pk);
|
->where($db->quoteName('a.id') . ' = :id')
|
||||||
|
->bind(':id', $pk, ParameterType::INTEGER);
|
||||||
|
|
||||||
// Join on category table.
|
// Join on category table.
|
||||||
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')
|
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access')
|
||||||
|
@ -100,23 +115,25 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
// Filter by language
|
// Filter by language
|
||||||
if ($this->getState('filter.language'))
|
if ($this->getState('filter.language'))
|
||||||
{
|
{
|
||||||
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
$query->whereIn($db->quoteName('a.language'), [Factory::getLanguage()->getTag(), '*'], ParameterType::STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join over the categories to get parent category titles
|
// 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')
|
$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');
|
->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')))
|
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
||||||
{
|
{
|
||||||
// Filter by start and end dates.
|
// Filter by start and end dates.
|
||||||
$nullDate = $db->quote($db->getNullDate());
|
$nowDate = Factory::getDate()->toSql();
|
||||||
$date = JFactory::getDate();
|
$query->where('(' . $db->quoteName('a.publish_up')
|
||||||
|
. ' IS NULL OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)'
|
||||||
$nowDate = $db->quote($date->toSql());
|
)
|
||||||
|
->where('(' . $db->quoteName('a.publish_down')
|
||||||
$query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')')
|
. ' IS NULL OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)'
|
||||||
->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')');
|
)
|
||||||
|
->bind(':publish_up', $nowDate)
|
||||||
|
->bind(':publish_down', $nowDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter by published state.
|
// Filter by published state.
|
||||||
|
@ -125,7 +142,7 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
|
|
||||||
if (is_numeric($published))
|
if (is_numeric($published))
|
||||||
{
|
{
|
||||||
$query->where('(a.state = ' . (int) $published . ' OR a.state =' . (int) $archived . ')');
|
$query->whereIn($db->quoteName('a.state'), [$published, $archived]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->setQuery($query);
|
$db->setQuery($query);
|
||||||
|
@ -134,19 +151,26 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
|
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
JError::raiseError(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
|
throw new \Exception(Text::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for published state if filter set.
|
// Check for published state if filter set.
|
||||||
if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived)))
|
if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived)))
|
||||||
{
|
{
|
||||||
JError::raiseError(404, JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'));
|
throw new \Exception(Text::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert parameter fields to objects.
|
// Convert parameter fields to objects.
|
||||||
$data->params = new Registry($data->params);
|
$data->params = new Registry($data->params);
|
||||||
$data->metadata = new Registry($data->metadata);
|
$data->metadata = new Registry($data->metadata);
|
||||||
|
|
||||||
|
// Some contexts may not use tags data at all, so we allow callers to disable loading tag data
|
||||||
|
if ($this->getState('load_tags', true))
|
||||||
|
{
|
||||||
|
$data->tags = new TagsHelper;
|
||||||
|
$data->tags->getItemTags('com_weblinks.weblink', $data->id);
|
||||||
|
}
|
||||||
|
|
||||||
// Compute access permissions.
|
// Compute access permissions.
|
||||||
if ($access = $this->getState('filter.access'))
|
if ($access = $this->getState('filter.access'))
|
||||||
{
|
{
|
||||||
|
@ -162,7 +186,7 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
|
|
||||||
$this->_item[$pk] = $data;
|
$this->_item[$pk] = $data;
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$this->setError($e);
|
$this->setError($e);
|
||||||
$this->_item[$pk] = false;
|
$this->_item[$pk] = false;
|
||||||
|
@ -179,13 +203,13 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
* @param string $prefix A prefix for the table class name. Optional.
|
* @param string $prefix A prefix for the table class name. Optional.
|
||||||
* @param array $config Configuration array for model. Optional.
|
* @param array $config Configuration array for model. Optional.
|
||||||
*
|
*
|
||||||
* @return JTable A database object
|
* @return Table A database object
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public function getTable($type = 'Weblink', $prefix = 'WeblinksTable', $config = array())
|
public function getTable($type = 'Weblink', $prefix = 'Administrator', $config = array())
|
||||||
{
|
{
|
||||||
return JTable::getInstance($type, $prefix, $config);
|
return parent::getTable($type, $prefix, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -202,6 +226,6 @@ class WeblinksModelWeblink extends JModelItem
|
||||||
$pk = $this->getState('weblink.id');
|
$pk = $this->getState('weblink.id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getTable('Weblink', 'WeblinksTable')->hit($pk);
|
return $this->getTable('Weblink')->hit($pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,29 +3,33 @@
|
||||||
* @package Joomla.Site
|
* @package Joomla.Site
|
||||||
* @subpackage com_weblinks
|
* @subpackage com_weblinks
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
namespace Joomla\Component\Weblinks\Site\Service;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Categories\Categories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Weblinks Component Category Tree.
|
* Weblinks Component Category Tree
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
class WeblinksCategories extends JCategories
|
class Category extends Categories
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param array $options Array of options
|
* @param array $options Array of options
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.7.0
|
||||||
*/
|
*/
|
||||||
public function __construct($options = array())
|
public function __construct($options = array())
|
||||||
{
|
{
|
||||||
$options['table'] = '#__weblinks';
|
$options['table'] = '#__weblinks';
|
||||||
$options['extension'] = 'com_weblinks';
|
$options['extension'] = 'com_weblinks';
|
||||||
|
|
||||||
parent::__construct($options);
|
parent::__construct($options);
|
298
src/components/com_weblinks/src/Service/Router.php
Normal file
298
src/components/com_weblinks/src/Service/Router.php
Normal file
|
@ -0,0 +1,298 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Site
|
||||||
|
* @subpackage com_weblinks
|
||||||
|
*
|
||||||
|
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\Service;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Application\SiteApplication;
|
||||||
|
use Joomla\CMS\Categories\CategoryFactoryInterface;
|
||||||
|
use Joomla\CMS\Categories\CategoryInterface;
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
|
use Joomla\CMS\Component\Router\RouterView;
|
||||||
|
use Joomla\CMS\Component\Router\RouterViewConfiguration;
|
||||||
|
use Joomla\CMS\Component\Router\Rules\MenuRules;
|
||||||
|
use Joomla\CMS\Component\Router\Rules\NomenuRules;
|
||||||
|
use Joomla\CMS\Component\Router\Rules\StandardRules;
|
||||||
|
use Joomla\CMS\Menu\AbstractMenu;
|
||||||
|
use Joomla\Database\DatabaseInterface;
|
||||||
|
use Joomla\Database\ParameterType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Routing class from com_weblinks
|
||||||
|
*
|
||||||
|
* @since 3.3
|
||||||
|
*/
|
||||||
|
class Router extends RouterView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Flag to remove IDs
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $noIDs = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The category factory
|
||||||
|
*
|
||||||
|
* @var CategoryFactoryInterface
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $categoryFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The category cache
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $categoryCache = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The db
|
||||||
|
*
|
||||||
|
* @var DatabaseInterface
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks Component router constructor
|
||||||
|
*
|
||||||
|
* @param SiteApplication $app The application object
|
||||||
|
* @param AbstractMenu $menu The menu object to work with
|
||||||
|
* @param CategoryFactoryInterface $categoryFactory The category object
|
||||||
|
* @param DatabaseInterface $db The database object
|
||||||
|
*/
|
||||||
|
public function __construct(SiteApplication $app, AbstractMenu $menu, CategoryFactoryInterface $categoryFactory, DatabaseInterface $db)
|
||||||
|
{
|
||||||
|
$this->categoryFactory = $categoryFactory;
|
||||||
|
$this->db = $db;
|
||||||
|
|
||||||
|
$params = ComponentHelper::getParams('com_weblinks');
|
||||||
|
$this->noIDs = (bool) $params->get('sef_ids');
|
||||||
|
$categories = new RouterViewConfiguration('categories');
|
||||||
|
$categories->setKey('id');
|
||||||
|
$this->registerView($categories);
|
||||||
|
$category = new RouterViewConfiguration('category');
|
||||||
|
$category->setKey('id')->setParent($categories, 'catid')->setNestable();
|
||||||
|
$this->registerView($category);
|
||||||
|
$webLink = new RouterViewConfiguration('weblink');
|
||||||
|
$webLink->setKey('id')->setParent($category, 'catid');
|
||||||
|
$this->registerView($webLink);
|
||||||
|
$form = new RouterViewConfiguration('form');
|
||||||
|
$form->setKey('w_id');
|
||||||
|
$this->registerView($form);
|
||||||
|
|
||||||
|
parent::__construct($app, $menu);
|
||||||
|
|
||||||
|
$this->attachRule(new MenuRules($this));
|
||||||
|
$this->attachRule(new StandardRules($this));
|
||||||
|
$this->attachRule(new NomenuRules($this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a category
|
||||||
|
*
|
||||||
|
* @param string $id ID of the category to retrieve the segments for
|
||||||
|
* @param array $query The request that is built right now
|
||||||
|
*
|
||||||
|
* @return array|string The segments of this item
|
||||||
|
*/
|
||||||
|
public function getCategorySegment($id, $query)
|
||||||
|
{
|
||||||
|
$category = $this->getCategories()->get($id);
|
||||||
|
|
||||||
|
if ($category)
|
||||||
|
{
|
||||||
|
$path = array_reverse($category->getPath(), true);
|
||||||
|
$path[0] = '1:root';
|
||||||
|
|
||||||
|
if ($this->noIDs)
|
||||||
|
{
|
||||||
|
foreach ($path as &$segment)
|
||||||
|
{
|
||||||
|
list($id, $segment) = explode(':', $segment, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a category
|
||||||
|
*
|
||||||
|
* @param string $id ID of the category to retrieve the segments for
|
||||||
|
* @param array $query The request that is built right now
|
||||||
|
*
|
||||||
|
* @return array|string The segments of this item
|
||||||
|
*/
|
||||||
|
public function getCategoriesSegment($id, $query)
|
||||||
|
{
|
||||||
|
return $this->getCategorySegment($id, $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a weblink
|
||||||
|
*
|
||||||
|
* @param string $id ID of the weblink to retrieve the segments for
|
||||||
|
* @param array $query The request that is built right now
|
||||||
|
*
|
||||||
|
* @return array|string The segments of this item
|
||||||
|
*/
|
||||||
|
public function getWeblinkSegment($id, $query)
|
||||||
|
{
|
||||||
|
if (!strpos($id, ':'))
|
||||||
|
{
|
||||||
|
$id = (int) $id;
|
||||||
|
$dbquery = $this->db->getQuery(true);
|
||||||
|
$dbquery->select($this->db->quoteName('alias'))
|
||||||
|
->from($this->db->quoteName('#__weblinks'))
|
||||||
|
->where($this->db->quoteName('id') . ' = :id')
|
||||||
|
->bind(':id', $id, ParameterType::INTEGER);
|
||||||
|
$this->db->setQuery($dbquery);
|
||||||
|
|
||||||
|
$id .= ':' . $this->db->loadResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->noIDs)
|
||||||
|
{
|
||||||
|
list($void, $segment) = explode(':', $id, 2);
|
||||||
|
|
||||||
|
return array($void => $segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array((int) $id => $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a form
|
||||||
|
*
|
||||||
|
* @param string $id ID of the weblink form to retrieve the segments for
|
||||||
|
* @param array $query The request that is built right now
|
||||||
|
*
|
||||||
|
* @return array|string The segments of this item
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
public function getFormSegment($id, $query)
|
||||||
|
{
|
||||||
|
return $this->getWeblinkSegment($id, $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the id for a category
|
||||||
|
*
|
||||||
|
* @param string $segment Segment to retrieve the ID for
|
||||||
|
* @param array $query The request that is parsed right now
|
||||||
|
*
|
||||||
|
* @return mixed The id of this item or false
|
||||||
|
*/
|
||||||
|
public function getCategoryId($segment, $query)
|
||||||
|
{
|
||||||
|
if (isset($query['id']))
|
||||||
|
{
|
||||||
|
$category = $this->getCategories(['access' => false])->get($query['id']);
|
||||||
|
|
||||||
|
if ($category)
|
||||||
|
{
|
||||||
|
foreach ($category->getChildren() as $child)
|
||||||
|
{
|
||||||
|
if ($this->noIDs)
|
||||||
|
{
|
||||||
|
if ($child->alias == $segment)
|
||||||
|
{
|
||||||
|
return $child->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($child->id == (int) $segment)
|
||||||
|
{
|
||||||
|
return $child->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a category
|
||||||
|
*
|
||||||
|
* @param string $segment Segment to retrieve the ID for
|
||||||
|
* @param array $query The request that is parsed right now
|
||||||
|
*
|
||||||
|
* @return mixed The id of this item or false
|
||||||
|
*/
|
||||||
|
public function getCategoriesId($segment, $query)
|
||||||
|
{
|
||||||
|
return $this->getCategoryId($segment, $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the segment(s) for a weblink
|
||||||
|
*
|
||||||
|
* @param string $segment Segment of the weblink to retrieve the ID for
|
||||||
|
* @param array $query The request that is parsed right now
|
||||||
|
*
|
||||||
|
* @return mixed The id of this item or false
|
||||||
|
*/
|
||||||
|
public function getWeblinkId($segment, $query)
|
||||||
|
{
|
||||||
|
if ($this->noIDs)
|
||||||
|
{
|
||||||
|
$dbquery = $this->db->getQuery(true);
|
||||||
|
$dbquery->select($this->db->quoteName('id'))
|
||||||
|
->from($this->db->quoteName('#__weblinks'))
|
||||||
|
->where(
|
||||||
|
[
|
||||||
|
$this->db->quoteName('alias') . ' = :alias',
|
||||||
|
$this->db->quoteName('catid') . ' = :catid',
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->bind(':alias', $segment)
|
||||||
|
->bind(':catid', $query['id'], ParameterType::INTEGER);
|
||||||
|
$this->db->setQuery($dbquery);
|
||||||
|
|
||||||
|
return (int) $this->db->loadResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) $segment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get categories from cache
|
||||||
|
*
|
||||||
|
* @param array $options The options for retrieving categories
|
||||||
|
*
|
||||||
|
* @return CategoryInterface The object containing categories
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
private function getCategories(array $options = []): CategoryInterface
|
||||||
|
{
|
||||||
|
$key = serialize($options);
|
||||||
|
|
||||||
|
if (!isset($this->categoryCache[$key]))
|
||||||
|
{
|
||||||
|
$this->categoryCache[$key] = $this->categoryFactory->createCategory($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->categoryCache[$key];
|
||||||
|
}
|
||||||
|
}
|
34
src/components/com_weblinks/src/View/Categories/HtmlView.php
Normal file
34
src/components/com_weblinks/src/View/Categories/HtmlView.php
Normal 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\View\Categories;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\View\CategoriesView;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weblinks categories view.
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class HtmlView extends CategoriesView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string Default title to use for page title
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $pageHeading = 'COM_WEBLINKS_DEFAULT_PAGE_TITLE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The name of the extension for the category
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $extension = 'com_weblinks';
|
||||||
|
}
|
|
@ -7,6 +7,10 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\View\Category;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\View\CategoryFeedView;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +18,7 @@ defined('_JEXEC') or die;
|
||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class WeblinksViewCategory extends JViewCategoryfeed
|
class FeedView extends CategoryFeedView
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string The name of the view to link individual items to
|
* @var string The name of the view to link individual items to
|
113
src/components/com_weblinks/src/View/Category/HtmlView.php
Normal file
113
src/components/com_weblinks/src/View/Category/HtmlView.php
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\View\Category;
|
||||||
|
|
||||||
|
use Joomla\CMS\MVC\View\CategoryView;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTML View class for the WebLinks component
|
||||||
|
*
|
||||||
|
* @since 1.5
|
||||||
|
*/
|
||||||
|
class HtmlView extends CategoryView
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string The name of the extension for the category
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
protected $extension = 'com_weblinks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 a Error object.
|
||||||
|
*/
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
parent::commonCategoryDisplay();
|
||||||
|
|
||||||
|
// Prepare the data.
|
||||||
|
// Compute the weblink slug & link url.
|
||||||
|
foreach ($this->items as $item)
|
||||||
|
{
|
||||||
|
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||||
|
|
||||||
|
if ($item->params->get('count_clicks', $this->params->get('count_clicks', 1)) == 1)
|
||||||
|
{
|
||||||
|
$item->link = Route::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$item->link = $item->url;
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp = new Registry;
|
||||||
|
$temp->loadString($item->params);
|
||||||
|
$item->params = clone $this->params;
|
||||||
|
$item->params->merge($temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the document
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function prepareDocument()
|
||||||
|
{
|
||||||
|
parent::prepareDocument();
|
||||||
|
|
||||||
|
parent::addFeed();
|
||||||
|
|
||||||
|
if ($this->menuItemMatchCategory)
|
||||||
|
{
|
||||||
|
// If the active menu item is linked directly to the category being displayed, no further process is needed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get ID of the category from active menu item
|
||||||
|
$menu = $this->menu;
|
||||||
|
|
||||||
|
if ($menu && $menu->component == 'com_weblinks' && isset($menu->query['view'])
|
||||||
|
&& in_array($menu->query['view'], ['categories', 'category']))
|
||||||
|
{
|
||||||
|
$id = $menu->query['id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = [['title' => $this->category->title, 'link' => '']];
|
||||||
|
$category = $this->category->getParent();
|
||||||
|
|
||||||
|
while ($category !== null && $category->id != $id && $category->id !== 'root')
|
||||||
|
{
|
||||||
|
$path[] = ['title' => $category->title, 'link' => RouteHelper::getCategoryRoute($category->id, $category->language)];
|
||||||
|
$category = $category->getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = array_reverse($path);
|
||||||
|
|
||||||
|
foreach ($path as $item)
|
||||||
|
{
|
||||||
|
$this->pathway->addItem($item['title'], $item['link']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,23 +7,58 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\View\Form;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\MVC\View\GenericDataException;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML Article View class for the Weblinks component
|
* HTML Article View class for the Weblinks component
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
class WeblinksViewForm extends JViewLegacy
|
class HtmlView extends BaseHtmlView
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var \Joomla\CMS\Form\Form
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
protected $form;
|
protected $form;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var object
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
protected $return_page;
|
protected $return_page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
protected $pageclass_sfx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Joomla\Registry\Registry
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
protected $state;
|
protected $state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Joomla\Registry\Registry
|
||||||
|
* @since 4.0.0
|
||||||
|
*/
|
||||||
|
protected $params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the view.
|
* Display the view.
|
||||||
*
|
*
|
||||||
|
@ -33,7 +68,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
*/
|
*/
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
$user = JFactory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
// Get model data.
|
// Get model data.
|
||||||
$this->state = $this->get('State');
|
$this->state = $this->get('State');
|
||||||
|
@ -43,7 +78,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
|
|
||||||
if (empty($this->item->id))
|
if (empty($this->item->id))
|
||||||
{
|
{
|
||||||
$authorised = ($user->authorise('core.create', 'com_weblinks') || (count($user->getAuthorisedCategories('com_weblinks', 'core.create'))));
|
$authorised = $user->authorise('core.create', 'com_weblinks') || count($user->getAuthorisedCategories('com_weblinks', 'core.create'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -52,15 +87,13 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
|
|
||||||
if ($authorised !== true)
|
if ($authorised !== true)
|
||||||
{
|
{
|
||||||
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
throw new \Exception(Text::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->item))
|
if (!empty($this->item))
|
||||||
{
|
{
|
||||||
// Override the base weblink data with any data in the session.
|
// Override the base weblink data with any data in the session.
|
||||||
$temp = (array) JFactory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
|
$temp = (array) Factory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
|
||||||
|
|
||||||
foreach ($temp as $k => $v)
|
foreach ($temp as $k => $v)
|
||||||
{
|
{
|
||||||
|
@ -73,9 +106,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
// Check for errors.
|
// Check for errors.
|
||||||
if (count($errors = $this->get('Errors')))
|
if (count($errors = $this->get('Errors')))
|
||||||
{
|
{
|
||||||
JError::raiseWarning(500, implode("\n", $errors));
|
throw new GenericDataException(implode("\n", $errors), 500);
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a shortcut to the parameters.
|
// Create a shortcut to the parameters.
|
||||||
|
@ -88,6 +119,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
$this->_prepareDocument();
|
$this->_prepareDocument();
|
||||||
|
|
||||||
parent::display($tpl);
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,21 +130,19 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
*/
|
*/
|
||||||
protected function _prepareDocument()
|
protected function _prepareDocument()
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$menus = $app->getMenu();
|
|
||||||
$title = null;
|
|
||||||
|
|
||||||
// Because the application sets a default page title,
|
// Because the application sets a default page title,
|
||||||
// we need to get it from the menu item itself
|
// we need to get it from the menu item itself
|
||||||
$menu = $menus->getActive();
|
$menu = $app->getMenu()->getActive();
|
||||||
|
|
||||||
if (empty($this->item->id))
|
if (empty($this->item->id))
|
||||||
{
|
{
|
||||||
$head = JText::_('COM_WEBLINKS_FORM_SUBMIT_WEBLINK');
|
$head = Text::_('COM_WEBLINKS_FORM_SUBMIT_WEBLINK');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$head = JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK');
|
$head = Text::_('COM_WEBLINKS_FORM_EDIT_WEBLINK');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($menu)
|
if ($menu)
|
||||||
|
@ -126,16 +156,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||||
|
|
||||||
$title = $this->params->def('page_title', $head);
|
$title = $this->params->def('page_title', $head);
|
||||||
|
|
||||||
if ($app->get('sitename_pagetitles', 0) == 1)
|
$this->setDocumentTitle($title);
|
||||||
{
|
|
||||||
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
|
|
||||||
}
|
|
||||||
elseif ($app->get('sitename_pagetitles', 0) == 2)
|
|
||||||
{
|
|
||||||
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->document->setTitle($title);
|
|
||||||
|
|
||||||
if ($this->params->get('menu-meta_description'))
|
if ($this->params->get('menu-meta_description'))
|
||||||
{
|
{
|
|
@ -7,6 +7,11 @@
|
||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace Joomla\Component\Weblinks\Site\View\Weblink;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,12 +19,28 @@ defined('_JEXEC') or die;
|
||||||
*
|
*
|
||||||
* @since __DEPLOY_VERSION__
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
class WeblinksViewWeblink extends JViewLegacy
|
class HtmlView extends BaseHtmlView
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The weblink object
|
||||||
|
*
|
||||||
|
* @var \JObject
|
||||||
|
*/
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The page parameters
|
||||||
|
*
|
||||||
|
* @var \Joomla\Registry\Registry|null
|
||||||
|
*/
|
||||||
protected $params;
|
protected $params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item model state
|
||||||
|
*
|
||||||
|
* @var \Joomla\Registry\Registry
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
protected $state;
|
protected $state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +54,7 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||||
*/
|
*/
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
$dispatcher = JEventDispatcher::getInstance();
|
$app = Factory::getApplication();
|
||||||
|
|
||||||
$this->item = $this->get('Item');
|
$this->item = $this->get('Item');
|
||||||
$this->state = $this->get('State');
|
$this->state = $this->get('State');
|
||||||
|
@ -42,19 +63,21 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||||
// Create a shortcut for $item.
|
// Create a shortcut for $item.
|
||||||
$item = $this->item;
|
$item = $this->item;
|
||||||
|
|
||||||
|
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||||
|
|
||||||
$offset = $this->state->get('list.offset');
|
$offset = $this->state->get('list.offset');
|
||||||
|
|
||||||
$dispatcher->trigger('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset));
|
$app->triggerEvent('onContentPrepare', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
|
|
||||||
$item->event = new stdClass;
|
$item->event = new \stdClass;
|
||||||
|
|
||||||
$results = $dispatcher->trigger('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
$results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
$item->event->afterDisplayTitle = trim(implode("\n", $results));
|
$item->event->afterDisplayTitle = trim(implode("\n", $results));
|
||||||
|
|
||||||
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
$item->event->beforeDisplayContent = trim(implode("\n", $results));
|
$item->event->beforeDisplayContent = trim(implode("\n", $results));
|
||||||
|
|
||||||
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
$results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
$item->event->afterDisplayContent = trim(implode("\n", $results));
|
$item->event->afterDisplayContent = trim(implode("\n", $results));
|
||||||
|
|
||||||
parent::display($tpl);
|
parent::display($tpl);
|
30
src/components/com_weblinks/tmpl/categories/default.php
Normal file
30
src/components/com_weblinks/tmpl/categories/default.php
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
|
||||||
|
// Add strings for translations in Javascript.
|
||||||
|
Text::script('JGLOBAL_EXPAND_CATEGORIES');
|
||||||
|
Text::script('JGLOBAL_COLLAPSE_CATEGORIES');
|
||||||
|
|
||||||
|
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||||
|
$wa = $this->document->getWebAssetManager();
|
||||||
|
$wa->getRegistry()->addExtensionRegistryFile('com_categories');
|
||||||
|
$wa->usePreset('com_categories.shared-categories-accordion');
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="com-weblinks-categories categories-list">
|
||||||
|
<?php
|
||||||
|
echo LayoutHelper::render('joomla.content.categories_default', $this);
|
||||||
|
echo $this->loadTemplate('items');
|
||||||
|
?>
|
||||||
|
</div>
|
280
src/components/com_weblinks/tmpl/categories/default.xml
Normal file
280
src/components/com_weblinks/tmpl/categories/default.xml
Normal file
|
@ -0,0 +1,280 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<metadata>
|
||||||
|
<layout title="COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_TITLE" option="com_weblinks_categories_view_default_option">
|
||||||
|
<help
|
||||||
|
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORIES"
|
||||||
|
/>
|
||||||
|
<message>
|
||||||
|
<![CDATA[COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_DESC]]>
|
||||||
|
</message>
|
||||||
|
</layout>
|
||||||
|
|
||||||
|
<!-- Add fields to the request variables for the layout. -->
|
||||||
|
<fields name="request">
|
||||||
|
<fieldset name="request"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="id"
|
||||||
|
type="category"
|
||||||
|
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
|
||||||
|
extension="com_weblinks"
|
||||||
|
show_root="true"
|
||||||
|
required="true"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
|
||||||
|
<!-- 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"
|
||||||
|
class="form-select-color-state"
|
||||||
|
useglobal="true"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="categories_description"
|
||||||
|
type="textarea"
|
||||||
|
label="JGLOBAL_FIELD_CATEGORIES_DESC_LABEL"
|
||||||
|
cols="25"
|
||||||
|
rows="5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="maxLevelcat"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="category" label="JGLOBAL_CATEGORY_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
|
||||||
|
<field
|
||||||
|
name="show_category_title"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_description"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_description_image"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="maxLevel"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_subcat_desc"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
|
||||||
|
<field
|
||||||
|
name="filter_field"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||||
|
default=""
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
>
|
||||||
|
<option value="hide">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_pagination_limit"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_headings"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
validate="options"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_link_hits"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_HITS"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
|
||||||
|
<field
|
||||||
|
name="show_pagination"
|
||||||
|
type="list"
|
||||||
|
label="JGLOBAL_PAGINATION_LABEL"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
>
|
||||||
|
<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"
|
||||||
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
|
>
|
||||||
|
<option value="0">JHIDE</option>
|
||||||
|
<option value="1">JSHOW</option>
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
</fields>
|
||||||
|
</metadata>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
|
||||||
|
if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
|
||||||
|
?>
|
||||||
|
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
|
||||||
|
<?php if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) : ?>
|
||||||
|
<div class="com-weblinks-categories__items">
|
||||||
|
<h3 class="page-header item-title">
|
||||||
|
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($item->id, $item->language)); ?>">
|
||||||
|
<?php echo $this->escape($item->title); ?></a>
|
||||||
|
<?php if ($this->params->get('show_cat_items_cat') == 1) :?>
|
||||||
|
<span class="badge bg-info">
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_NUM_ITEMS'); ?>
|
||||||
|
<?php echo $item->numitems; ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
id="category-btn-<?php echo $item->id; ?>"
|
||||||
|
data-category-id="<?php echo $item->id; ?>"
|
||||||
|
class="btn btn-secondary btn-sm float-end"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="<?php echo Text::_('JGLOBAL_EXPAND_CATEGORIES'); ?>"
|
||||||
|
>
|
||||||
|
<span class="icon-plus" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<?php endif; ?>
|
||||||
|
</h3>
|
||||||
|
<?php if ($this->params->get('show_subcat_desc_cat') == 1) : ?>
|
||||||
|
<?php if ($item->description) : ?>
|
||||||
|
<div class="category-desc">
|
||||||
|
<?php echo HTMLHelper::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
|
||||||
|
<div class="com-weblinks-categories__children" id="category-<?php echo $item->id; ?>" hidden>
|
||||||
|
<?php
|
||||||
|
$this->items[$item->id] = $item->getChildren();
|
||||||
|
$this->parent = $item;
|
||||||
|
$this->maxLevelcat--;
|
||||||
|
echo $this->loadTemplate('items');
|
||||||
|
$this->parent = $item->getParent();
|
||||||
|
$this->maxLevelcat++;
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
|
@ -9,6 +9,12 @@
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
$this->subtemplatename = 'items';
|
|
||||||
echo JLayoutHelper::render('joomla.content.category_default', $this);
|
?>
|
||||||
|
<div class="com-weblinks-category">
|
||||||
|
<?php
|
||||||
|
$this->subtemplatename = 'items';
|
||||||
|
echo LayoutHelper::render('joomla.content.category_default', $this);
|
||||||
|
?>
|
||||||
|
</div>
|
|
@ -1,22 +1,21 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<metadata>
|
<metadata>
|
||||||
<layout title="com_weblinks_category_view_default_title" option="com_weblinks_category_view_default_option">
|
<layout title="COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_TITLE" option="com_weblinks_category_view_default_option">
|
||||||
<help
|
<help
|
||||||
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
|
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORY"
|
||||||
/>
|
/>
|
||||||
<message>
|
<message>
|
||||||
<![CDATA[com_weblinks_category_view_default_desc]]>
|
<![CDATA[COM_WEBLINKS_CATEGORY_VIEW_DEFAULT_DESC]]>
|
||||||
</message>
|
</message>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
<!-- Add fields to the request variables for the layout. -->
|
<!-- Add fields to the request variables for the layout. -->
|
||||||
<fields name="request">
|
<fields name="request">
|
||||||
<fieldset name="request">
|
<fieldset name="request">
|
||||||
<field
|
<field
|
||||||
name="id"
|
name="id"
|
||||||
type="category"
|
type="category"
|
||||||
label="COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL"
|
label="COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC"
|
|
||||||
default="0"
|
default="0"
|
||||||
extension="com_weblinks"
|
extension="com_weblinks"
|
||||||
required="true"
|
required="true"
|
||||||
|
@ -26,52 +25,47 @@
|
||||||
|
|
||||||
<!-- Add fields to the parameters object for the layout. -->
|
<!-- Add fields to the parameters object for the layout. -->
|
||||||
<fields name="params">
|
<fields name="params">
|
||||||
<fieldset name="basic" label="JGLOBAL_CATEGORY_OPTIONS">
|
<fieldset
|
||||||
<field
|
name="basic"
|
||||||
name="spacer1"
|
label="JGLOBAL_CATEGORY_OPTIONS"
|
||||||
type="spacer"
|
description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
|
||||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
<field
|
||||||
class="text"
|
name="show_category_title"
|
||||||
/>
|
|
||||||
|
|
||||||
<field
|
|
||||||
name="show_category_title"
|
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
label="JGLOBAL_SHOW_CATEGORY_TITLE"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_TITLE_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_description"
|
name="show_description"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
label="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_LABEL"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_description_image"
|
name="show_description_image"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
label="JGLOBAL_SHOW_CATEGORY_IMAGE_LABEL"
|
||||||
description="JGLOBAL_SHOW_CATEGORY_IMAGE_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="maxLevel"
|
name="maxLevel"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL"
|
||||||
description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
>
|
>
|
||||||
<option value="0">JNONE</option>
|
<option value="0">JNONE</option>
|
||||||
|
@ -84,34 +78,34 @@
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_empty_categories"
|
name="show_empty_categories"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL"
|
||||||
description="COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_subcat_desc"
|
name="show_subcat_desc"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL"
|
||||||
description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_cat_num_links"
|
name="show_cat_num_links"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
label="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
|
@ -119,88 +113,81 @@
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS">
|
<fieldset name="advanced" label="JGLOBAL_LIST_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL">
|
||||||
<field
|
|
||||||
name="spacer2"
|
|
||||||
type="spacer"
|
|
||||||
label="JGLOBAL_SUBSLIDER_DRILL_CATEGORIES_LABEL"
|
|
||||||
class="text"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="filter_field"
|
name="filter_field"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_FILTER_FIELD_LABEL"
|
label="JGLOBAL_FILTER_FIELD_LABEL"
|
||||||
description="JGLOBAL_FILTER_FIELD_DESC"
|
|
||||||
default=""
|
default=""
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="hide">JHIDE</option>
|
<option value="hide">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_pagination_limit"
|
name="show_pagination_limit"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
label="JGLOBAL_DISPLAY_SELECT_LABEL"
|
||||||
description="JGLOBAL_DISPLAY_SELECT_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_headings"
|
name="show_headings"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
label="JGLOBAL_SHOW_HEADINGS_LABEL"
|
||||||
description="JGLOBAL_SHOW_HEADINGS_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_link_description"
|
name="show_link_description"
|
||||||
type="list"
|
type="list"
|
||||||
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
|
label="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL"
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_link_hits"
|
name="show_link_hits"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_HITS"
|
label="JGLOBAL_HITS"
|
||||||
description="COM_WEBLINKS_FIELD_CONFIG_HITS_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_pagination"
|
name="show_pagination"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_PAGINATION_LABEL"
|
label="JGLOBAL_PAGINATION_LABEL"
|
||||||
description="JGLOBAL_PAGINATION_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
<option value="2">JGLOBAL_AUTO</option>
|
<option value="2">JGLOBAL_AUTO</option>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<field
|
<field
|
||||||
name="show_pagination_results"
|
name="show_pagination_results"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
label="JGLOBAL_PAGINATION_RESULTS_LABEL"
|
||||||
description="JGLOBAL_PAGINATION_RESULTS_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
|
@ -208,16 +195,16 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset name="integration">
|
<fieldset name="integration">
|
||||||
<field
|
<field
|
||||||
name="show_feed_link"
|
name="show_feed_link"
|
||||||
type="list"
|
type="list"
|
||||||
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
label="JGLOBAL_SHOW_FEED_LINK_LABEL"
|
||||||
description="JGLOBAL_SHOW_FEED_LINK_DESC"
|
|
||||||
useglobal="true"
|
useglobal="true"
|
||||||
|
class="form-select-color-state"
|
||||||
>
|
>
|
||||||
<option value="0">JHIDE</option>
|
<option value="0">JHIDE</option>
|
||||||
<option value="1">JSHOW</option>
|
<option value="1">JSHOW</option>
|
||||||
</field>
|
</field>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
||||||
</metadata>
|
</metadata>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
|
|
||||||
|
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
|
||||||
|
?>
|
||||||
|
<ul class="com-weblinks-category__children list-group list-unstyled">
|
||||||
|
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
||||||
|
<?php if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) : ?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<div class="item-title">
|
||||||
|
<a href="<?php echo Route::_(RouteHelper::getCategoryRoute($child->id, $child->language)); ?>">
|
||||||
|
<?php echo $this->escape($child->title); ?>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_cat_items') == 1) : ?>
|
||||||
|
<span class="badge bg-info float-end" title="<?php echo Text::_('COM_WEBLINKS_CAT_NUM'); ?>"><?php echo $child->numitems; ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_subcat_desc') == 1) : ?>
|
||||||
|
<?php if ($child->description) : ?>
|
||||||
|
<div class="category-desc">
|
||||||
|
<?php echo HTMLHelper::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (count($child->getChildren()) > 0 ) :
|
||||||
|
$this->children[$child->id] = $child->getChildren();
|
||||||
|
$this->category = $child;
|
||||||
|
$this->maxLevel--;
|
||||||
|
echo $this->loadTemplate('children');
|
||||||
|
$this->category = $child->getParent();
|
||||||
|
$this->maxLevel++;
|
||||||
|
endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
223
src/components/com_weblinks/tmpl/category/default_items.php
Normal file
223
src/components/com_weblinks/tmpl/category/default_items.php
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Uri\Uri;
|
||||||
|
|
||||||
|
HTMLHelper::_('behavior.core');
|
||||||
|
|
||||||
|
// Create a shortcut for params.
|
||||||
|
$params = &$this->category->params;
|
||||||
|
|
||||||
|
// Get the user object.
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
// Check if user is allowed to add/edit based on weblinks permission.
|
||||||
|
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
|
||||||
|
$canEditOwn = $user->authorise('core.edit.own', 'com_weblinks.category.' . $this->category->id);
|
||||||
|
$canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $this->category->id);
|
||||||
|
|
||||||
|
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||||
|
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="com-weblinks-category__items">
|
||||||
|
<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
|
<?php if ($this->params->get('filter_field')) : ?>
|
||||||
|
<div class="com-weblinks-category__filter btn-group">
|
||||||
|
<label class="filter-search-lbl visually-hidden" for="filter-search">
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
name="filter-search"
|
||||||
|
id="filter-search"
|
||||||
|
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
|
||||||
|
onchange="document.adminForm.submit();"
|
||||||
|
placeholder="<?php echo Text::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>"
|
||||||
|
>
|
||||||
|
<button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button>
|
||||||
|
<button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
||||||
|
<div class="com-weblinks-category__pagination btn-group float-end">
|
||||||
|
<label for="limit" class="visually-hidden">
|
||||||
|
<?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
|
||||||
|
</label>
|
||||||
|
<?php echo $this->pagination->getLimitBox(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (empty($this->items)) : ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<ul class="category list-unstyled">
|
||||||
|
<?php foreach ($this->items as $i => $item) : ?>
|
||||||
|
<?php
|
||||||
|
// Shouldn't this be only for users with admin rights?
|
||||||
|
// @ToDo: what is the difference -class system-unbublished?
|
||||||
|
if ($item->state == 0) : ?>
|
||||||
|
<li class="system-unpublished list-group mt-3">
|
||||||
|
<?php else : ?>
|
||||||
|
<li class="list-group mt-3">
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($canEdit || ($canEditOwn && $item->created_by == $userId)) : ?>
|
||||||
|
<div class="icons list-group-item">
|
||||||
|
<?php echo HTMLHelper::_('weblinkicon.edit', $item, $this->params); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="list-title list-group-item ">
|
||||||
|
<?php if (!$this->params->get('icons', 1)) : ?>
|
||||||
|
<?php echo Text::_('COM_WEBLINKS_LINK'); ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php // ToDo css icons as variables ?>
|
||||||
|
<?php if (!$this->params->get('link_icons')) : ?>
|
||||||
|
<span class="icon-globe" aria-hidden="true"></span>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . Text::_('COM_WEBLINKS_LINK') . '" />'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php // Compute the correct link ?>
|
||||||
|
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
|
||||||
|
<?php $link = $item->link; ?>
|
||||||
|
<?php $width = $item->params->get('width', 600); ?>
|
||||||
|
<?php $height = $item->params->get('height', 500); ?>
|
||||||
|
|
||||||
|
<?php if ($item->state == 0) : ?>
|
||||||
|
<span class="badge bg-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
switch ($item->params->get('target', $this->params->get('target')))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
// Open in a new window
|
||||||
|
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
|
||||||
|
$this->escape($item->title) . '</a>';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// Open in a popup window
|
||||||
|
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
|
||||||
|
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
|
||||||
|
$this->escape($item->title) . '</a>';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// Open in a modal window
|
||||||
|
$modalId = 'weblink-item-modal-' . $item->id;
|
||||||
|
$modalParams['title'] = $this->escape($item->title);
|
||||||
|
$modalParams['url'] = $link;
|
||||||
|
$modalParams['height'] = '100%';
|
||||||
|
$modalParams['width'] = '100%';
|
||||||
|
$modalParams['bodyHeight'] = 70;
|
||||||
|
$modalParams['modalWidth'] = 80;
|
||||||
|
echo HTMLHelper::_('bootstrap.renderModal', $modalId, $modalParams);
|
||||||
|
echo '<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#' . $modalId . '">
|
||||||
|
' . $item->title . '
|
||||||
|
</button>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Open in parent window
|
||||||
|
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
|
||||||
|
$this->escape($item->title) . ' </a>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php if ($this->params->get('show_link_hits', 1)) : ?>
|
||||||
|
<div class="list-hits badge bg-info float-end">
|
||||||
|
<?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_tags', 1) && !empty($item->tags->itemTags)) : ?>
|
||||||
|
<div class="mt-2 mb-2">
|
||||||
|
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?>
|
||||||
|
<div class="mt-2 mb-2">
|
||||||
|
<?php $images = json_decode($item->images); ?>
|
||||||
|
<?php if (!empty($images->image_first)) : ?>
|
||||||
|
<?php $imgFloat = '';?>
|
||||||
|
<?php if (!empty($images->float_first)) : ?>
|
||||||
|
<?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php $img = HTMLHelper::cleanImageURL($images->image_first); ?>
|
||||||
|
<?php $alt = empty($images->image_first_alt) && empty($images->image_first_alt_empty)
|
||||||
|
? ''
|
||||||
|
: 'alt="' . htmlspecialchars($images->image_first_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
|
||||||
|
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||||
|
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||||
|
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||||
|
<?php if (!empty($images->image_first_caption)) : ?>
|
||||||
|
<figcaption class="caption"><?php echo htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||||
|
<?php endif; ?>
|
||||||
|
</figure>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!empty($images->image_second)) : ?>
|
||||||
|
<?php $imgFloat = ''; ?>
|
||||||
|
<?php if (!empty($images->float_second)) : ?>
|
||||||
|
<?php $imgFloat = $images->float_second == 'right' ? 'float-end' : 'float-start'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php $img = HTMLHelper::cleanImageURL($images->image_second); ?>
|
||||||
|
<?php $alt = empty($images->image_second_alt) && empty($images->image_second_alt_empty)
|
||||||
|
? ''
|
||||||
|
: 'alt="' . htmlspecialchars($images->image_second_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
|
||||||
|
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||||
|
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||||
|
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||||
|
<?php if (!empty($images->image_second_caption)) : ?>
|
||||||
|
<figcaption class="caption"><?php echo htmlspecialchars($images->image_second_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||||
|
<?php endif; ?>
|
||||||
|
</figure>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo $item->description; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_pagination')) : ?>
|
||||||
|
<div class="com-weblinks-category__counter w-100">
|
||||||
|
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||||
|
<p class="com-weblinks-category__counter counter float-end pt-3 pe-2">
|
||||||
|
<?php echo $this->pagination->getPagesCounter(); ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($canCreate) : ?>
|
||||||
|
<?php echo HTMLHelper::_('weblinkicon.create', $this->category, $this->category->params); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
99
src/components/com_weblinks/tmpl/form/edit.php
Normal file
99
src/components/com_weblinks/tmpl/form/edit.php
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Plugin\PluginHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
|
HTMLHelper::_('behavior.keepalive');
|
||||||
|
HTMLHelper::_('behavior.formvalidator');
|
||||||
|
|
||||||
|
$captchaEnabled = false;
|
||||||
|
$captchaSet = $this->params->get('captcha', Factory::getApplication()->get('captcha', '0'));
|
||||||
|
|
||||||
|
foreach (PluginHelper::getPlugin('captcha') as $plugin)
|
||||||
|
{
|
||||||
|
if ($captchaSet === $plugin->name)
|
||||||
|
{
|
||||||
|
$captchaEnabled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create shortcut to parameters.
|
||||||
|
$params = $this->state->get('params');
|
||||||
|
?>
|
||||||
|
<div class="edit item-page<?php echo $this->pageclass_sfx; ?>">
|
||||||
|
<?php if ($this->params->get('show_page_heading')) : ?>
|
||||||
|
<div class="page-header">
|
||||||
|
<h1>
|
||||||
|
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="<?php echo Route::_('index.php?option=com_weblinks&view=form&w_id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate form-vertical">
|
||||||
|
|
||||||
|
<?php echo $this->form->renderField('title'); ?>
|
||||||
|
<?php echo $this->form->renderField('alias'); ?>
|
||||||
|
<?php echo $this->form->renderField('catid'); ?>
|
||||||
|
<?php echo $this->form->renderField('url'); ?>
|
||||||
|
<?php echo $this->form->renderField('tags'); ?>
|
||||||
|
|
||||||
|
<?php if ($params->get('save_history', 0)) : ?>
|
||||||
|
<?php echo $this->form->renderField('version_note'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($this->user->authorise('core.edit.state', 'com_weblinks.weblink')) : ?>
|
||||||
|
<?php echo $this->form->renderField('state'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php echo $this->form->renderField('language'); ?>
|
||||||
|
<?php echo $this->form->renderField('description'); ?>
|
||||||
|
|
||||||
|
<?php echo $this->form->renderField('image_first', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_first_alt', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_first_alt_empty', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('float_first', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_first_caption', 'images'); ?>
|
||||||
|
|
||||||
|
<?php echo $this->form->renderField('image_second', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_second_alt', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_second_alt_empty', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('float_second', 'images'); ?>
|
||||||
|
<?php echo $this->form->renderField('image_second_caption', 'images'); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if ($captchaEnabled) : ?>
|
||||||
|
<div class="btn-group">
|
||||||
|
<?php echo $this->form->renderField('captcha'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('weblink.save')">
|
||||||
|
<span class="icon-check" aria-hidden="true"></span>
|
||||||
|
<?php echo Text::_('JSAVE'); ?>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-danger" onclick="Joomla.submitbutton('weblink.cancel')">
|
||||||
|
<span class="icon-times" aria-hidden="true"></span>
|
||||||
|
<?php echo Text::_('JCANCEL'); ?>
|
||||||
|
</button>
|
||||||
|
<?php if ($this->params->get('save_history', 0) && $this->item->id) : ?>
|
||||||
|
<?php echo $this->form->getInput('contenthistory'); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
|
||||||
|
<input type="hidden" name="task" value="" />
|
||||||
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
111
src/components/com_weblinks/tmpl/weblink/default.php
Normal file
111
src/components/com_weblinks/tmpl/weblink/default.php
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\String\PunycodeHelper;
|
||||||
|
|
||||||
|
$weblinkUrl = PunycodeHelper::urlToUTF8($this->item->url);
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
|
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->item->catid);
|
||||||
|
|
||||||
|
if (!$canEdit)
|
||||||
|
{
|
||||||
|
$canEditOwn = $user->authorise('core.edit.own', 'com_weblinks.category.' . $this->item->catid);
|
||||||
|
$canEdit = $canEditOwn && $this->item->created_by == $user->id;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div class="item-page">
|
||||||
|
<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? Factory::getApplication()->get('language') : $this->item->language; ?>" />
|
||||||
|
<div class="page-header">
|
||||||
|
<h2 itemprop="headline">
|
||||||
|
<?php echo $this->escape($this->item->title); ?>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<?php if ($canEdit) : ?>
|
||||||
|
<div class="icons">
|
||||||
|
<div class="float-end">
|
||||||
|
<div>
|
||||||
|
<?php echo HTMLHelper::_('weblinkicon.edit', $this->item, $this->item->params); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?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">
|
||||||
|
<div class="p-3">
|
||||||
|
<a href="<?php echo $weblinkUrl; ?>" target="_blank" itemprop="url">
|
||||||
|
<?php echo $weblinkUrl; ?>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ($this->params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
|
||||||
|
<div class="p-2">
|
||||||
|
<?php echo LayoutHelper::render('joomla.content.tags', $this->item->tags->itemTags); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="p-3">
|
||||||
|
<?php $images = json_decode($this->item->images); ?>
|
||||||
|
<?php if (!empty($images->image_first)) : ?>
|
||||||
|
<?php $imgFloat = '';?>
|
||||||
|
<?php if (!empty($images->float_first)) : ?>
|
||||||
|
<?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php $img = HTMLHelper::cleanImageURL($images->image_first); ?>
|
||||||
|
<?php $alt = empty($images->image_first_alt) && empty($images->image_first_alt_empty)
|
||||||
|
? ''
|
||||||
|
: 'alt="' . htmlspecialchars($images->image_first_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
|
||||||
|
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||||
|
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||||
|
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||||
|
<?php if (!empty($images->image_first_caption)) : ?>
|
||||||
|
<figcaption class="caption"><?php echo htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||||
|
<?php endif; ?>
|
||||||
|
</figure>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!empty($images->image_second)) : ?>
|
||||||
|
<?php $imgFloat = ''; ?>
|
||||||
|
<?php if (!empty($images->float_second)) : ?>
|
||||||
|
<?php $imgFloat = $images->float_second == 'right' ? 'float-end' : 'float-start'; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php $img = HTMLHelper::cleanImageURL($images->image_second); ?>
|
||||||
|
<?php $alt = empty($images->image_second_alt) && empty($images->image_second_alt_empty)
|
||||||
|
? ''
|
||||||
|
: 'alt="' . htmlspecialchars($images->image_second_alt, ENT_COMPAT, 'UTF-8') . '"'; ?>
|
||||||
|
<figure class="item-image <?php echo $imgFloat; ?>">
|
||||||
|
<img src="<?php echo htmlspecialchars($img->url, ENT_COMPAT, 'UTF-8'); ?>"
|
||||||
|
<?php echo $alt; ?> itemprop="thumbnail" />
|
||||||
|
<?php if (!empty($images->image_second_caption)) : ?>
|
||||||
|
<figcaption class="caption"><?php echo htmlspecialchars($images->image_second_caption, ENT_COMPAT, 'UTF-8'); ?></figcaption>
|
||||||
|
<?php endif; ?>
|
||||||
|
</figure>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!empty($this->item->description)) : ?>
|
||||||
|
<?php echo $this->item->description; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php // Content is generated by content plugin event "onContentAfterDisplay" ?>
|
||||||
|
<?php echo $this->item->event->afterDisplayContent; ?>
|
||||||
|
</div>
|
|
@ -12,7 +12,7 @@
|
||||||
<fields name="request">
|
<fields name="request">
|
||||||
<fieldset
|
<fieldset
|
||||||
name="request"
|
name="request"
|
||||||
addfieldpath="/administrator/components/com_weblinks/models/fields"
|
addfieldprefix="Joomla\Component\Weblinks\Administrator\Field"
|
||||||
>
|
>
|
||||||
|
|
||||||
<field name="id"
|
<field name="id"
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
new="true"
|
new="true"
|
||||||
edit="true"
|
edit="true"
|
||||||
clear="true"
|
clear="true"
|
||||||
description="COM_WEBLINKS_FIELD_SELECT_WEBLINK_DESC"
|
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</fields>
|
</fields>
|
|
@ -1,31 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
|
||||||
JHtml::_('behavior.caption');
|
|
||||||
|
|
||||||
JFactory::getDocument()->addScriptDeclaration("
|
|
||||||
jQuery(function($) {
|
|
||||||
$('.categories-list').find('[id^=category-btn-]').each(function(index, btn) {
|
|
||||||
var btn = $(btn);
|
|
||||||
btn.on('click', function() {
|
|
||||||
btn.find('span').toggleClass('icon-plus');
|
|
||||||
btn.find('span').toggleClass('icon-minus');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});");
|
|
||||||
?>
|
|
||||||
<div class="categories-list<?php echo $this->pageclass_sfx;?>">
|
|
||||||
<?php
|
|
||||||
echo JLayoutHelper::render('joomla.content.categories_default', $this);
|
|
||||||
echo $this->loadTemplate('items');
|
|
||||||
?>
|
|
||||||
</div>
|
|
|
@ -1,282 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<metadata>
|
|
||||||
<layout title="com_weblinks_categories_view_default_title" option="com_weblinks_categories_view_default_option">
|
|
||||||
<help
|
|
||||||
key="JHELP_MENUS_MENU_ITEM_WEBLINK_CATEGORIES"
|
|
||||||
/>
|
|
||||||
<message>
|
|
||||||
<![CDATA[com_weblinks_categories_view_default_desc]]>
|
|
||||||
</message>
|
|
||||||
</layout>
|
|
||||||
|
|
||||||
<!-- Add fields to the request variables for the layout. -->
|
|
||||||
<fields name="request">
|
|
||||||
<fieldset name="request"
|
|
||||||
>
|
|
||||||
<field
|
|
||||||
name="id"
|
|
||||||
type="category"
|
|
||||||
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
|
|
||||||
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
|
|
||||||
extension="com_weblinks"
|
|
||||||
show_root="true"
|
|
||||||
required="true"
|
|
||||||
/>
|
|
||||||
</fieldset>
|
|
||||||
</fields>
|
|
||||||
|
|
||||||
<!-- 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"
|
|
||||||
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"
|
|
||||||
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>
|
|
||||||
</field>
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<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"
|
|
||||||
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"
|
|
||||||
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"
|
|
||||||
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"
|
|
||||||
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>
|
|
||||||
|
|
||||||
</fields>
|
|
||||||
</metadata>
|
|
|
@ -1,64 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
JHtml::_('bootstrap.tooltip');
|
|
||||||
|
|
||||||
$class = ' class="first"';
|
|
||||||
|
|
||||||
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
|
|
||||||
?>
|
|
||||||
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
|
|
||||||
<?php
|
|
||||||
if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
|
|
||||||
if (!isset($this->items[$this->parent->id][$id + 1]))
|
|
||||||
{
|
|
||||||
$class = ' class="last"';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div <?php echo $class; ?> >
|
|
||||||
<?php $class = ''; ?>
|
|
||||||
<h3 class="page-header item-title">
|
|
||||||
<a href="<?php echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($item->id));?>">
|
|
||||||
<?php echo $this->escape($item->title); ?></a>
|
|
||||||
<?php if ($this->params->get('show_cat_num_links_cat') == 1) :?>
|
|
||||||
<span class="badge badge-info tip hasTooltip" title="<?php echo JHtml::tooltipText('COM_WEBLINKS_NUM_ITEMS'); ?>">
|
|
||||||
<?php echo $item->numitems; ?>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
|
|
||||||
<a id="category-btn-<?php echo $item->id;?>" href="#category-<?php echo $item->id;?>"
|
|
||||||
data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
|
|
||||||
<?php endif;?>
|
|
||||||
</h3>
|
|
||||||
<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
|
|
||||||
<?php if ($item->description) : ?>
|
|
||||||
<div class="category-desc">
|
|
||||||
<?php echo JHtml::_('content.prepare', $item->description, '', 'com_weblinks.categories'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) :?>
|
|
||||||
<div class="collapse fade" id="category-<?php echo $item->id;?>">
|
|
||||||
<?php
|
|
||||||
$this->items[$item->id] = $item->getChildren();
|
|
||||||
$this->parent = $item;
|
|
||||||
$this->maxLevelcat--;
|
|
||||||
echo $this->loadTemplate('items');
|
|
||||||
$this->parent = $item->getParent();
|
|
||||||
$this->maxLevelcat++;
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
|
@ -1,83 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Content categories view.
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
class WeblinksViewCategories extends JViewCategories
|
|
||||||
{
|
|
||||||
protected $item = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string Default title to use for page title
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
protected $defaultPageTitle = 'COM_WEBLINKS_DEFAULT_PAGE_TITLE';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string The name of the extension for the category
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
protected $extension = 'com_weblinks';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string The name of the view to link individual items to
|
|
||||||
* @since 3.2
|
|
||||||
*/
|
|
||||||
protected $viewName = 'weblink';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 a Error object.
|
|
||||||
*/
|
|
||||||
public function display($tpl = null)
|
|
||||||
{
|
|
||||||
$state = $this->get('State');
|
|
||||||
$items = $this->get('Items');
|
|
||||||
$parent = $this->get('Parent');
|
|
||||||
|
|
||||||
// Check for errors.
|
|
||||||
if (count($errors = $this->get('Errors')))
|
|
||||||
{
|
|
||||||
JError::raiseWarning(500, implode("\n", $errors));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($items === false)
|
|
||||||
{
|
|
||||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parent == false)
|
|
||||||
{
|
|
||||||
return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = &$state->params;
|
|
||||||
|
|
||||||
$items = array($parent->id => $items);
|
|
||||||
|
|
||||||
// Escape strings for HTML output
|
|
||||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
|
||||||
|
|
||||||
$this->maxLevelcat = $params->get('maxLevelcat', -1);
|
|
||||||
$this->params = &$params;
|
|
||||||
$this->parent = &$parent;
|
|
||||||
$this->items = &$items;
|
|
||||||
|
|
||||||
return parent::display($tpl);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<metadata>
|
|
||||||
<view title="Category">
|
|
||||||
<message><![CDATA[TYPECATEGORYDESC]]></message>
|
|
||||||
</view>
|
|
||||||
</metadata>
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
$class = ' class="first"';
|
|
||||||
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
|
|
||||||
?>
|
|
||||||
<ul>
|
|
||||||
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
|
|
||||||
<?php
|
|
||||||
if ($this->params->get('show_empty_categories') || $child->numitems || count($child->getChildren())) :
|
|
||||||
if (!isset($this->children[$this->category->id][$id + 1]))
|
|
||||||
{
|
|
||||||
$class = ' class="last"';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<li<?php echo $class; ?>>
|
|
||||||
<?php $class = ''; ?>
|
|
||||||
<span class="item-title"><a href="<?php echo JRoute::_(WeblinksHelperRoute::getCategoryRoute($child->id));?>">
|
|
||||||
<?php echo $this->escape($child->title); ?></a>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<?php if ($this->params->get('show_subcat_desc') == 1) :?>
|
|
||||||
<?php if ($child->description) : ?>
|
|
||||||
<div class="category-desc">
|
|
||||||
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
|
|
||||||
<dl class="weblink-count"><dt>
|
|
||||||
<?php echo JText::_('COM_WEBLINKS_NUM'); ?></dt>
|
|
||||||
<dd><?php echo $child->numitems; ?></dd>
|
|
||||||
</dl>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (count($child->getChildren()) > 0 ) :
|
|
||||||
$this->children[$child->id] = $child->getChildren();
|
|
||||||
$this->category = $child;
|
|
||||||
$this->maxLevel--;
|
|
||||||
echo $this->loadTemplate('children');
|
|
||||||
$this->category = $child->getParent();
|
|
||||||
$this->maxLevel++;
|
|
||||||
endif; ?>
|
|
||||||
</li>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
<?php endif;
|
|
|
@ -1,171 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
|
||||||
|
|
||||||
JHtml::_('behavior.framework');
|
|
||||||
|
|
||||||
// Create a shortcut for params.
|
|
||||||
$params = &$this->item->params;
|
|
||||||
|
|
||||||
// Get the user object.
|
|
||||||
$user = JFactory::getUser();
|
|
||||||
|
|
||||||
// Check if user is allowed to add/edit based on weblinks permissinos.
|
|
||||||
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
|
|
||||||
$canCreate = $user->authorise('core.create', 'com_weblinks');
|
|
||||||
$canEditState = $user->authorise('core.edit.state', 'com_weblinks');
|
|
||||||
|
|
||||||
$n = count($this->items);
|
|
||||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
|
||||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if (empty($this->items)) : ?>
|
|
||||||
<p> <?php echo JText::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
|
|
||||||
<?php else : ?>
|
|
||||||
|
|
||||||
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
|
|
||||||
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) : ?>
|
|
||||||
<fieldset class="filters btn-toolbar">
|
|
||||||
<?php if ($this->params->get('filter_field') != 'hide') : ?>
|
|
||||||
<div class="btn-group">
|
|
||||||
<label class="filter-search-lbl element-invisible" for="filter-search"><?php echo JText::_('COM_WEBLINKS_FILTER_LABEL') . ' '; ?></label>
|
|
||||||
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->params->get('show_pagination_limit')) : ?>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<label for="limit" class="element-invisible">
|
|
||||||
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
|
|
||||||
</label>
|
|
||||||
<?php echo $this->pagination->getLimitBox(); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</fieldset>
|
|
||||||
<?php endif; ?>
|
|
||||||
<ul class="category list-striped list-condensed">
|
|
||||||
<?php foreach ($this->items as $i => $item) : ?>
|
|
||||||
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
|
|
||||||
<?php if ($this->items[$i]->state == 0) : ?>
|
|
||||||
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
|
|
||||||
<?php else : ?>
|
|
||||||
<li class="cat-list-row<?php echo $i % 2; ?>" >
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($this->params->get('show_link_hits', 1)) : ?>
|
|
||||||
<span class="list-hits badge badge-info pull-right">
|
|
||||||
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($canEdit) : ?>
|
|
||||||
<span class="list-edit pull-left width-50">
|
|
||||||
<?php echo JHtml::_('icon.edit', $item, $params); ?>
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="list-title">
|
|
||||||
<?php if ($this->params->get('icons', 1) == 0) : ?>
|
|
||||||
<?php echo JText::_('COM_WEBLINKS_LINK'); ?>
|
|
||||||
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
|
|
||||||
<?php if (!$this->params->get('link_icons')) : ?>
|
|
||||||
<?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . JText::_('COM_WEBLINKS_LINK') . '" />'; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php // Compute the correct link ?>
|
|
||||||
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
|
|
||||||
<?php $link = $item->link; ?>
|
|
||||||
<?php $width = $item->params->get('width'); ?>
|
|
||||||
<?php $height = $item->params->get('height'); ?>
|
|
||||||
<?php if ($width == null || $height == null) : ?>
|
|
||||||
<?php $width = 600; ?>
|
|
||||||
<?php $height = 500; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($this->items[$i]->state == 0) : ?>
|
|
||||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
switch ($item->params->get('target', $this->params->get('target')))
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
// Open in a new window
|
|
||||||
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
|
|
||||||
$this->escape($item->title) . '</a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
// Open in a popup window
|
|
||||||
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
|
|
||||||
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
|
|
||||||
$this->escape($item->title) . '</a>';
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
// Open in a modal window
|
|
||||||
JHtml::_('behavior.modal', 'a.modal');
|
|
||||||
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
|
|
||||||
$this->escape($item->title) . ' </a>';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Open in parent window
|
|
||||||
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
|
|
||||||
$this->escape($item->title) . ' </a>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
|
|
||||||
<?php if ($this->params->get('show_tags', 1)) : ?>
|
|
||||||
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
|
|
||||||
<?php echo $this->item->tagLayout->render($tagsData); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
|
|
||||||
<?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="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; ?>
|
|
||||||
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
|
|
||||||
<?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, 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; ?>
|
|
||||||
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $item->description; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</li>
|
|
||||||
<?php endif;?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<?php // Code to add a link to submit a weblink. ?>
|
|
||||||
<?php if ($this->params->get('show_pagination')) : ?>
|
|
||||||
<div class="pagination">
|
|
||||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
|
||||||
<p class="counter">
|
|
||||||
<?php echo $this->pagination->getPagesCounter(); ?>
|
|
||||||
</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HTML View class for the WebLinks component
|
|
||||||
*
|
|
||||||
* @since 1.5
|
|
||||||
*/
|
|
||||||
class WeblinksViewCategory extends JViewCategory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 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 a Error object.
|
|
||||||
*/
|
|
||||||
public function display($tpl = null)
|
|
||||||
{
|
|
||||||
parent::commonCategoryDisplay();
|
|
||||||
|
|
||||||
// Prepare the data.
|
|
||||||
// Compute the weblink slug & link url.
|
|
||||||
foreach ($this->items as $item)
|
|
||||||
{
|
|
||||||
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
|
||||||
|
|
||||||
if ($item->params->get('count_clicks', $this->params->get('count_clicks', 1)) == 1)
|
|
||||||
{
|
|
||||||
$item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$item->link = $item->url;
|
|
||||||
}
|
|
||||||
|
|
||||||
$temp = new JRegistry;
|
|
||||||
$temp->loadString($item->params);
|
|
||||||
$item->params = clone($this->params);
|
|
||||||
$item->params->merge($temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::display($tpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepares the document
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function prepareDocument()
|
|
||||||
{
|
|
||||||
parent::prepareDocument();
|
|
||||||
|
|
||||||
$app = JFactory::getApplication();
|
|
||||||
$menus = $app->getMenu();
|
|
||||||
$pathway = $app->getPathway();
|
|
||||||
$title = null;
|
|
||||||
|
|
||||||
// Because the application sets a default page title,
|
|
||||||
// we need to get it from the menu item itself
|
|
||||||
$menu = $menus->getActive();
|
|
||||||
|
|
||||||
if ($menu)
|
|
||||||
{
|
|
||||||
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->params->def('page_heading', JText::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = (int) @$menu->query['id'];
|
|
||||||
|
|
||||||
if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id))
|
|
||||||
{
|
|
||||||
$this->params->set('page_subheading', $this->category->title);
|
|
||||||
$path = array(array('title' => $this->category->title, 'link' => ''));
|
|
||||||
$category = $this->category->getParent();
|
|
||||||
|
|
||||||
while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1)
|
|
||||||
{
|
|
||||||
$path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
|
|
||||||
$category = $category->getParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = array_reverse($path);
|
|
||||||
|
|
||||||
foreach ($path as $item)
|
|
||||||
{
|
|
||||||
$pathway->addItem($item['title'], $item['link']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::addFeed();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<metadata>
|
|
||||||
<view
|
|
||||||
title="Form">
|
|
||||||
<message><![CDATA[TYPEARTICLAYDESC]]></message>
|
|
||||||
</view>
|
|
||||||
</metadata>
|
|
|
@ -1,97 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
JHtml::_('behavior.keepalive');
|
|
||||||
JHtml::_('behavior.formvalidation');
|
|
||||||
JHtml::_('formbehavior.chosen', 'select');
|
|
||||||
JHtml::_('behavior.modal', 'a.modal_jform_contenthistory');
|
|
||||||
|
|
||||||
$captchaEnabled = false;
|
|
||||||
$captchaSet = $this->params->get('captcha', JFactory::getApplication()->get('captcha', '0'));
|
|
||||||
|
|
||||||
foreach (JPluginHelper::getPlugin('captcha') as $plugin)
|
|
||||||
{
|
|
||||||
if ($captchaSet === $plugin->name)
|
|
||||||
{
|
|
||||||
$captchaEnabled = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create shortcut to parameters.
|
|
||||||
$params = $this->state->get('params');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
Joomla.submitbutton = function(task)
|
|
||||||
{
|
|
||||||
if (task == 'weblink.cancel' || document.formvalidator.isValid(document.getElementById('adminForm')))
|
|
||||||
{
|
|
||||||
<?php echo $this->form->getField('description')->save(); ?>
|
|
||||||
Joomla.submitform(task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<div class="edit<?php echo $this->pageclass_sfx; ?>">
|
|
||||||
<?php if ($this->params->get('show_page_heading')) : ?>
|
|
||||||
<h1>
|
|
||||||
<?php echo $this->escape($this->params->get('page_heading')); ?>
|
|
||||||
</h1>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=form&w_id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate form-vertical">
|
|
||||||
|
|
||||||
<?php echo $this->form->renderField('title'); ?>
|
|
||||||
<?php echo $this->form->renderField('alias'); ?>
|
|
||||||
<?php echo $this->form->renderField('catid'); ?>
|
|
||||||
<?php echo $this->form->renderField('url'); ?>
|
|
||||||
<?php echo $this->form->renderField('tags'); ?>
|
|
||||||
|
|
||||||
<?php if ($params->get('save_history', 0)) : ?>
|
|
||||||
<?php echo $this->form->renderField('version_note'); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($this->user->authorise('core.edit.state', 'com_weblinks.weblink')) : ?>
|
|
||||||
<?php echo $this->form->renderField('state'); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $this->form->renderField('language'); ?>
|
|
||||||
<?php echo $this->form->renderField('description'); ?>
|
|
||||||
|
|
||||||
<hr class="hr-condensed" />
|
|
||||||
|
|
||||||
<?php if ($captchaEnabled) : ?>
|
|
||||||
<div class="btn-group">
|
|
||||||
<?php echo $this->form->renderField('captcha'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="btn-toolbar">
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('weblink.save')">
|
|
||||||
<span class="icon-ok"></span> <?php echo JText::_('JSAVE') ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn" onclick="Joomla.submitbutton('weblink.cancel')">
|
|
||||||
<span class="icon-cancel"></span> <?php echo JText::_('JCANCEL') ?>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<?php if ($params->get('save_history', 0)) : ?>
|
|
||||||
<div class="btn-group">
|
|
||||||
<?php echo $this->form->getInput('contenthistory'); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
|
|
||||||
<input type="hidden" name="task" value="" />
|
|
||||||
<?php echo JHtml::_('form.token'); ?>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?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;
|
|
||||||
|
|
||||||
require_once JPATH_COMPONENT . '/helpers/route.php';
|
|
||||||
|
|
||||||
$controller = JControllerLegacy::getInstance('Weblinks');
|
|
||||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
|
||||||
$controller->redirect();
|
|
|
@ -19,20 +19,16 @@ COM_WEBLINKS_ERR_TABLES_NAME="Es existiert bereits ein Weblink mit diesem Namen
|
||||||
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Bitte eine gültige URL eingeben."
|
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Bitte eine gültige URL eingeben."
|
||||||
COM_WEBLINKS_ERR_TABLES_TITLE="Ein Weblink muss einen Titel haben."
|
COM_WEBLINKS_ERR_TABLES_TITLE="Ein Weblink muss einen Titel haben."
|
||||||
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Ein anderer Weblink in dieser Kategorie hat denselben Alias (ggf. ist er im Papierkorb)!"
|
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Ein anderer Weblink in dieser Kategorie hat denselben Alias (ggf. ist er im Papierkorb)!"
|
||||||
COM_WEBLINKS_FIELD_ALIAS_DESC="Der Alias ist nun für interne Zwecke notwendig. Wird das Feld leer gelassen, dann wird Joomla! einen Standardwert aus dem Titel generieren. Der Alias muss eindeutig für jeden Weblink innerhalb der gleichen Kategorie sein!"
|
|
||||||
COM_WEBLINKS_FIELD_CATEGORY_DESC="Eine Kategorie für den Weblink auswählen"
|
COM_WEBLINKS_FIELD_CATEGORY_DESC="Eine Kategorie für den Weblink auswählen"
|
||||||
COM_WEBLINKS_FIELD_CATEGORYCHOOSE_DESC="Die Weblink-Kategorie, die angezeigt werden soll, auswählen."
|
COM_WEBLINKS_FIELD_CATEGORYCHOOSE_DESC="Die Weblink-Kategorie, die angezeigt werden soll, auswählen."
|
||||||
COM_WEBLINKS_FIELD_CAPTCHA_DESC="Das Captcha auswählen, das im Weblinkeinreichungsformular verwendet wird. Möglicherweise müssen in den Plugins die erforderlichen Informationen für das Captcha-Plugin hinterlegen werden.<br />Wenn „Standard verwenden“ ausgewählt ist, muss in der Konfiguration ein Captcha-Plugin ausgewählt sein."
|
COM_WEBLINKS_FIELD_CAPTCHA_DESC="Das Captcha auswählen, das im Weblinkeinreichungsformular verwendet wird. Möglicherweise müssen in den Plugins die erforderlichen Informationen für das Captcha-Plugin hinterlegen werden.<br />Wenn „Standard verwenden“ ausgewählt ist, muss in der Konfiguration ein Captcha-Plugin ausgewählt sein."
|
||||||
COM_WEBLINKS_FIELD_CAPTCHA_LABEL="Captcha beim Einreichen erlauben"
|
COM_WEBLINKS_FIELD_CAPTCHA_LABEL="Captcha beim Einreichen erlauben"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_DESC="Ein- oder Ausblenden der Anzahl von Weblinks je Kategorie"
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL="# Weblinks"
|
COM_WEBLINKS_FIELD_CONFIG_CAT_SHOWNUMBERS_LABEL="# Weblinks"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_DESC="Falls „Ja“ ausgewählt wurde, wird die Anzahl an Klicks pro Link gespeichert."
|
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_DESC="Falls „Ja“ ausgewählt wurde, wird die Anzahl an Klicks pro Link gespeichert."
|
||||||
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_LABEL="Anzahl Klicks"
|
COM_WEBLINKS_FIELD_CONFIG_COUNTCLICKS_LABEL="Anzahl Klicks"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_DESCRIPTION_DESC="Anzeigen oder Verbergen der Beschreibung unten"
|
COM_WEBLINKS_FIELD_CONFIG_DESCRIPTION_DESC="Anzeigen oder Verbergen der Beschreibung unten"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_HITS_DESC="Anzeigen oder Verbergen der Klicks"
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_ICON_DESC="Wenn oben „Icon“ ausgewählt wurde, kann allen Weblinks ein gemeinsames Icon zugeordnet werden. Falls kein Icon ausgewählt wurde, wird das Standard-Icon (Weltkugel) angezeigt."
|
COM_WEBLINKS_FIELD_CONFIG_ICON_DESC="Wenn oben „Icon“ ausgewählt wurde, kann allen Weblinks ein gemeinsames Icon zugeordnet werden. Falls kein Icon ausgewählt wurde, wird das Standard-Icon (Weltkugel) angezeigt."
|
||||||
COM_WEBLINKS_FIELD_CONFIG_ICON_LABEL="Icon auswählen"
|
COM_WEBLINKS_FIELD_CONFIG_ICON_LABEL="Icon auswählen"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_DESC="Anzeigen oder Verbergen der Linkbeschreibung."
|
|
||||||
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL="Linksbeschreibung"
|
COM_WEBLINKS_FIELD_CONFIG_LINKDESCRIPTION_LABEL="Linksbeschreibung"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_DESC="Anzeigen oder Verbergen andere Kategorien"
|
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_DESC="Anzeigen oder Verbergen andere Kategorien"
|
||||||
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_LABEL="Andere Kategorien"
|
COM_WEBLINKS_FIELD_CONFIG_OTHERCATS_LABEL="Andere Kategorien"
|
||||||
|
@ -62,9 +58,7 @@ COM_WEBLINKS_FIELD_SECOND_DESC="Das Bild, das als zweites angezeigt werden soll.
|
||||||
COM_WEBLINKS_FIELD_SECOND_LABEL="Zweites Bild"
|
COM_WEBLINKS_FIELD_SECOND_LABEL="Zweites Bild"
|
||||||
COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC="Eine Weblink-Kategorie zum Anzeigen auswählen"
|
COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC="Eine Weblink-Kategorie zum Anzeigen auswählen"
|
||||||
COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL="Kategorie auswählen"
|
COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL="Kategorie auswählen"
|
||||||
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_DESC="Tags für die Kategorie anzeigen."
|
|
||||||
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Tags anzeigen"
|
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Tags anzeigen"
|
||||||
COM_WEBLINKS_FIELD_SHOW_TAGS_DESC="Tags für den Weblink anzeigen."
|
|
||||||
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Tags anzeigen"
|
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Tags anzeigen"
|
||||||
COM_WEBLINKS_FIELD_STATE_DESC="Status der Veröffentlichung."
|
COM_WEBLINKS_FIELD_STATE_DESC="Status der Veröffentlichung."
|
||||||
COM_WEBLINKS_FIELD_TARGET_DESC="Zielfenster, wenn auf den Link geklickt wird."
|
COM_WEBLINKS_FIELD_TARGET_DESC="Zielfenster, wenn auf den Link geklickt wird."
|
||||||
|
@ -115,7 +109,6 @@ COM_WEBLINKS_ORDER_HEADING="Reihenfolge"
|
||||||
COM_WEBLINKS_RIGHT="Rechts"
|
COM_WEBLINKS_RIGHT="Rechts"
|
||||||
COM_WEBLINKS_SAVE_SUCCESS="Der Weblink wurde gespeichert!"
|
COM_WEBLINKS_SAVE_SUCCESS="Der Weblink wurde gespeichert!"
|
||||||
COM_WEBLINKS_SEARCH_IN_TITLE="Im Titel suchen"
|
COM_WEBLINKS_SEARCH_IN_TITLE="Im Titel suchen"
|
||||||
COM_WEBLINKS_SHOW_EMPTY_CATEGORIES_DESC="Falls „Anzeigen“ ausgewählt wurde, werden auch leere Kategorien angezeigt. Eine Kategorie gilt als leer, wenn sie weder Weblinks noch Unterkategorien enthält."
|
|
||||||
COM_WEBLINKS_SUBMENU_CATEGORIES="Kategorien"
|
COM_WEBLINKS_SUBMENU_CATEGORIES="Kategorien"
|
||||||
COM_WEBLINKS_SUBMENU_WEBLINKS="Weblinks"
|
COM_WEBLINKS_SUBMENU_WEBLINKS="Weblinks"
|
||||||
COM_WEBLINKS_XML_DESCRIPTION="Komponenten zum Verwalten von Weblinks."
|
COM_WEBLINKS_XML_DESCRIPTION="Komponenten zum Verwalten von Weblinks."
|
||||||
|
|
|
@ -3,36 +3,42 @@
|
||||||
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
|
; 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
|
; Note : All ini files need to be saved as UTF-8
|
||||||
|
|
||||||
COM_WEBLINKS_CAPTCHA_LABEL="Captcha"
|
|
||||||
COM_WEBLINKS_CAPTCHA_DESC="Please complete the security check."
|
COM_WEBLINKS_CAPTCHA_DESC="Please complete the security check."
|
||||||
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
COM_WEBLINKS_CAPTCHA_LABEL="Captcha"
|
||||||
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
|
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
|
||||||
|
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
||||||
COM_WEBLINKS_DEFAULT_PAGE_TITLE="Web Links"
|
COM_WEBLINKS_DEFAULT_PAGE_TITLE="Web Links"
|
||||||
COM_WEBLINKS_EDIT="Edit Web link"
|
COM_WEBLINKS_EDIT="Edit Web link"
|
||||||
COM_WEBLINKS_ERR_TABLES_NAME="There is already a Web Link with that name in this category. Please try again."
|
COM_WEBLINKS_EDIT_PUBLISHED_WEBLINK="Published Weblink"
|
||||||
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Please provide a valid URL"
|
COM_WEBLINKS_EDIT_UNPUBLISHED_WEBLINK="Unpublished Weblink"
|
||||||
COM_WEBLINKS_ERR_TABLES_TITLE="Your Web Link must contain a title."
|
|
||||||
COM_WEBLINKS_ERROR_CATEGORY_NOT_FOUND="Web Link category not found."
|
|
||||||
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another Web Link from this category has the same alias (remember it may be a trashed item)."
|
COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another Web Link from this category has the same alias (remember it may be a trashed item)."
|
||||||
COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND="Web Link not found."
|
COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND="Web Link not found."
|
||||||
COM_WEBLINKS_ERROR_WEBLINK_URL_INVALID="Invalid Web link URL."
|
COM_WEBLINKS_ERROR_WEBLINK_URL_INVALID="Invalid Web link URL."
|
||||||
COM_WEBLINKS_FIELD_ALIAS_DESC="The alias is for internal use only. Leave this blank and Joomla will fill in a default value from the title. It has to be unique for each web link in the same category."
|
COM_WEBLINKS_ERR_TABLES_NAME="There is already a Web Link with that name in this category. Please try again."
|
||||||
COM_WEBLINKS_FIELD_CATEGORY_DESC="You must select a Category."
|
COM_WEBLINKS_ERR_TABLES_PROVIDE_URL="Please provide a valid URL"
|
||||||
COM_WEBLINKS_FIELD_DESCRIPTION_DESC="Enter a description for your Web link."
|
COM_WEBLINKS_ERR_TABLES_TITLE="Your Web Link must contain a title."
|
||||||
|
COM_WEBLINKS_FIELD_CAPTION_LABEL="Caption First Image"
|
||||||
|
COM_WEBLINKS_FIELD_FIRST_LABEL="First Image"
|
||||||
|
COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_DESC="Decorative Image - no description required"
|
||||||
|
COM_WEBLINKS_FIELD_IMAGE_ALT_EMPTY_LABEL="No Description"
|
||||||
|
COM_WEBLINKS_FIELD_IMAGE_ALT_LABEL="Alt Text"
|
||||||
|
COM_WEBLINKS_FIELD_IMAGE_CAPTION_LABEL="Caption"
|
||||||
|
COM_WEBLINKS_FIELD_SECOND_LABEL="Second Image"
|
||||||
|
COM_WEBLINKS_FIELD_URL_LABEL="URL"
|
||||||
COM_WEBLINKS_FILTER_LABEL="Filter Field"
|
COM_WEBLINKS_FILTER_LABEL="Filter Field"
|
||||||
COM_WEBLINKS_FILTER_SEARCH_DESC="Web Links filter search"
|
COM_WEBLINKS_FILTER_SEARCH_DESC="Web Links filter search"
|
||||||
COM_WEBLINKS_FIELD_TITLE_DESC="Your Web Link must have a Title."
|
COM_WEBLINKS_FLOAT_FIRST_LABEL="First Image Float"
|
||||||
COM_WEBLINKS_FIELD_URL_DESC="You must enter a URL."
|
COM_WEBLINKS_FLOAT_SECOND_LABEL="Second Image Float"
|
||||||
COM_WEBLINKS_FIELD_URL_LABEL="URL"
|
|
||||||
COM_WEBLINKS_FORM_CREATE_WEBLINK="Submit a Web Link"
|
COM_WEBLINKS_FORM_CREATE_WEBLINK="Submit a Web Link"
|
||||||
COM_WEBLINKS_GRID_TITLE="Title"
|
|
||||||
COM_WEBLINKS_LINK="Web Link"
|
|
||||||
COM_WEBLINKS_NAME="Name"
|
|
||||||
COM_WEBLINKS_NO_WEBLINKS="There are no Web Links in this category."
|
|
||||||
COM_WEBLINKS_NUM="# of links:"
|
|
||||||
COM_WEBLINKS_NUM_ITEMS="Links in categories"
|
|
||||||
COM_WEBLINKS_FORM_EDIT_WEBLINK="Edit a Web Link"
|
COM_WEBLINKS_FORM_EDIT_WEBLINK="Edit a Web Link"
|
||||||
COM_WEBLINKS_FORM_SUBMIT_WEBLINK="Submit a Web Link"
|
COM_WEBLINKS_FORM_SUBMIT_WEBLINK="Submit a Web Link"
|
||||||
|
COM_WEBLINKS_LEFT="Left"
|
||||||
|
COM_WEBLINKS_LINK="Web Link"
|
||||||
|
COM_WEBLINKS_NO_WEBLINKS="There are no Web Links in this category."
|
||||||
|
COM_WEBLINKS_NONE="None"
|
||||||
|
COM_WEBLINKS_NUM="# of links:"
|
||||||
|
COM_WEBLINKS_NUM_ITEMS="Links in categories"
|
||||||
|
COM_WEBLINKS_RIGHT="Right"
|
||||||
COM_WEBLINKS_SAVE_SUCCESS="Web link successfully saved."
|
COM_WEBLINKS_SAVE_SUCCESS="Web link successfully saved."
|
||||||
COM_WEBLINKS_SUBMIT_SAVE_SUCCESS="Web Link successfully submitted."
|
COM_WEBLINKS_SUBMIT_SAVE_SUCCESS="Web Link successfully submitted."
|
||||||
COM_WEBLINKS_WEB_LINKS="Web Links"
|
COM_WEBLINKS_WEB_LINKS="Web Links"
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user