mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-02-04 18:28:25 +00:00
Merge remote-tracking branch 'refs/remotes/joomla-extensions/master' into acl-edit-own
This commit is contained in:
commit
ed336b0466
17
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
17
CONTRIBUTING.md → .github/CONTRIBUTING.md
vendored
@ -29,19 +29,12 @@ If you find any new bugs, or want to raise any type of support issue, please use
|
||||
|
||||
## Release Procedure
|
||||
|
||||
This is the procedure and checklist for creating a new package.
|
||||
This is the procedure and checklist for creating a new package:
|
||||
|
||||
* Update the version number in `build.ini`.
|
||||
* Run `phing set-version`.
|
||||
* Pun `phing` to make the new package for the version.
|
||||
* Run `phing tag`.
|
||||
* Push the commits and tags up to Github.
|
||||
* Go to the releases page on Github.
|
||||
* Click on the new tag.
|
||||
- Click the `Edit Tag` button.
|
||||
- Fill in the title and description for the release.
|
||||
- Attach the zip-file for the package to the release. Wait for the file to complete uploading!
|
||||
- Click the `Publish Release` button.
|
||||
* Update the version number in `jorobo.ini`
|
||||
* Modify `jorobo.ini`, add your GitHub token and add ` Release` after `Package`
|
||||
* Run `robo build` to make the new package and auto-upload and release it on GitHub.
|
||||
* Go to the releases page on GitHub, review the Changelog and change the status from Pre-Release to Stable.
|
||||
* Create a new `<update>` tag in the `manifest.xml` file.
|
||||
- Change the `<version>` tag to the new version.
|
||||
- Change the `<downloadurl>` tag to match the URL of the new release.
|
18
.github/ISSUE_TEMPLATE.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#### Steps to reproduce the issue
|
||||
|
||||
|
||||
|
||||
#### Expected result
|
||||
|
||||
|
||||
|
||||
#### Actual result
|
||||
|
||||
|
||||
|
||||
#### System information (as much as possible)
|
||||
|
||||
|
||||
|
||||
#### Additional comments
|
||||
|
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
5
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Pull Request for Issue # .
|
||||
|
||||
#### Summary of Changes
|
||||
|
||||
#### Testing Instructions
|
40
.travis.yml
40
.travis.yml
@ -1,29 +1,34 @@
|
||||
language: php
|
||||
php:
|
||||
- 5.5
|
||||
- 5.6
|
||||
addons:
|
||||
firefox: "44.0.2"
|
||||
|
||||
env:
|
||||
global:
|
||||
- RUN_PHPCS="no"
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 5.6
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 5.5
|
||||
- php: 5.6
|
||||
env: RUN_PHPCS="yes"
|
||||
- php: 7.0
|
||||
sudo: true
|
||||
addons:
|
||||
firefox: "47.0.1"
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
|
||||
before_script:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi php5-curl php5-mysql php5-intl php5-gd > /dev/null
|
||||
- sudo apt-get install -y --force-yes apache2 libapache2-mod-fastcgi > /dev/null
|
||||
- sudo mkdir $(pwd)/.run
|
||||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php5-fpm.sock,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,;listen.owner = nobody,listen.owner = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,;listen.group = nobody,listen.group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,user = nobody,;user = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- sudo sed -e "s,group = nobody,;group = $USER,g" --in-place ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||
- chmod a+x tests/travis-php-fpm.sh
|
||||
- sudo ./tests/travis-php-fpm.sh $USER $(phpenv version-name)
|
||||
- sudo a2enmod rewrite actions fastcgi alias
|
||||
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||
- sudo cp -f tests/travis-ci-apache.conf /etc/apache2/sites-available/default
|
||||
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
|
||||
- sudo sed -e "s?%PHPVERSION%?${TRAVIS_PHP_VERSION:0:1}?g" --in-place /etc/apache2/sites-available/default
|
||||
- git submodule update --init --recursive
|
||||
- sudo service apache2 restart
|
||||
# Xvfb
|
||||
@ -41,5 +46,8 @@ script:
|
||||
# Build
|
||||
- mv jorobo.dist.ini jorobo.ini
|
||||
- vendor/bin/robo build
|
||||
# System tests (Codeception)
|
||||
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
|
||||
- vendor/bin/robo run:tests --use-htaccess
|
||||
# Run phpcs on PHP 5.6 against weblinks source
|
||||
- if [[ $RUN_PHPCS == "yes" ]]; then vendor/bin/phpcs --report=full --extensions=php -p --standard=tests/joomla-cms3/build/phpcs/Joomla ./src; fi
|
||||
|
14
README.md
14
README.md
@ -2,6 +2,20 @@
|
||||
|
||||
This repo is meant to hold the decoupled com_weblinks component and related code.
|
||||
|
||||
How to test a PR with the [Patch Tester Component](https://github.com/joomla-extensions/patchtester/releases/latest)
|
||||
============
|
||||
|
||||
Easily apply changes from a pull requests against this repo:
|
||||
Install the last release of [com_weblinks](https://github.com/joomla-extensions/weblinks/releases/latest) into your Joomla.
|
||||
Install the last release of [com_patchtester](https://github.com/joomla-extensions/patchtester/releases/latest) into your Joomla (weblinks is supported since Version 3.0.0 Alpha 2).
|
||||
Log into your site's administrator section, go to the Patch Tester Component Options (Components -> Patch Tester -> Options)
|
||||
Switch the `GitHub Repository` to `Joomla Weblinks Package`
|
||||
Click `Save & Close` and hit the `Fetch Data` Button to the the lastest pull requests
|
||||
Click `Apply Patch` to apply the proposed changes from the pull request.
|
||||
Click `Revert Patch` to revert an applied patch.
|
||||
|
||||
You can read more about the Patch Tester extension on the [Joomla! Documentation Wiki](https://docs.joomla.org/Component_Patchtester_for_Testers).
|
||||
|
||||
# Building
|
||||
|
||||
```bash
|
||||
|
12
RoboFile.php
12
RoboFile.php
@ -66,9 +66,17 @@ class RoboFile extends \Robo\Tasks
|
||||
{
|
||||
if ($this->isWindows())
|
||||
{
|
||||
return '.exe';
|
||||
// check wehter git.exe or git as command should be used,
|
||||
// as on window both is possible
|
||||
if(!$this->_exec('git.exe --version')->getMessage())
|
||||
{
|
||||
return '';
|
||||
}
|
||||
else
|
||||
{
|
||||
return '.exe';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,13 @@
|
||||
"php": ">=5.3.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "~2.1",
|
||||
"joomla-projects/joomla-browser": "v3.4.8.3",
|
||||
"codeception/codeception": "^2.2",
|
||||
"joomla-projects/joomla-browser": "v3.6.0",
|
||||
"codegyre/robo": "~0.5",
|
||||
"joomla-projects/robo": "dev-master",
|
||||
"joomla-projects/selenium-server-standalone": "v2.52.0",
|
||||
"joomla-projects/selenium-server-standalone": "v2.53.1",
|
||||
"fzaninotto/faker": "^1.5",
|
||||
"joomla-projects/jorobo": "0.3"
|
||||
"joomla-projects/jorobo": "0.4",
|
||||
"Behat/Gherkin": "^4.4.1"
|
||||
}
|
||||
}
|
||||
|
697
composer.lock
generated
697
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -2,3 +2,36 @@ extension = weblinks
|
||||
version = 3.5.0
|
||||
source = src
|
||||
target = package
|
||||
|
||||
; Create a pre-release of the extension on GitHub
|
||||
; Add your personal GitHub access tocken
|
||||
; and add Release to the target (separated by space) above
|
||||
[github]
|
||||
remote = origin
|
||||
branch = develop
|
||||
token =
|
||||
owner = joomla-extensions
|
||||
repository = weblinks
|
||||
changelog_source = commits
|
||||
|
||||
; Automatic upload of the built extension package to an FTP server
|
||||
[ftp]
|
||||
host =
|
||||
port = 21
|
||||
user =
|
||||
password =
|
||||
ssl = false
|
||||
target = /
|
||||
|
||||
; Adds / replaces copyright headers at the beginning of files in the source folder
|
||||
[header]
|
||||
files = php,js
|
||||
exclude =
|
||||
text = "
|
||||
/**
|
||||
* @package Weblinks
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - ##YEAR## Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
"
|
@ -11,6 +11,6 @@
|
||||
<downloads>
|
||||
<downloadurl type="full" format="zip">https://github.com/joomla-extensions/weblinks/releases/download/3.5.0/pkg-weblinks-3.5.0.zip</downloadurl>
|
||||
</downloads>
|
||||
<targetplatform name="joomla" version="3.[456789]" />
|
||||
<targetplatform name="joomla" version="3.[56789]" />
|
||||
</update>
|
||||
</updates>
|
||||
|
@ -5,6 +5,19 @@
|
||||
description="COM_WEBLINKS_COMPONENT_DESC"
|
||||
>
|
||||
|
||||
<field
|
||||
name="captcha"
|
||||
type="plugins"
|
||||
label="COM_WEBLINKS_FIELD_CAPTCHA_LABEL"
|
||||
description="COM_WEBLINKS_FIELD_CAPTCHA_DESC"
|
||||
default=""
|
||||
folder="captcha"
|
||||
filter="cmd"
|
||||
>
|
||||
<option value="">JOPTION_USE_DEFAULT</option>
|
||||
<option value="0">JOPTION_DO_NOT_USE</option>
|
||||
</field>
|
||||
|
||||
<field name="target" type="list"
|
||||
default="0"
|
||||
description="COM_WEBLINKS_FIELD_TARGET_DESC"
|
||||
|
@ -19,14 +19,15 @@ class WeblinksController extends JControllerLegacy
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
|
||||
* @param boolean $cacheable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||
* for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return JControllerLegacy This object to support chaining.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
public function display($cacheable = false, $urlparams = false)
|
||||
{
|
||||
require_once JPATH_COMPONENT . '/helpers/weblinks.php';
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
/**
|
||||
* Weblink controller class.
|
||||
*
|
||||
@ -27,14 +29,13 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$categoryId = JArrayHelper::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 the category has been passed in the URL check it.
|
||||
$allow = $user->authorise('core.create', $this->option . '.category.' . $categoryId);
|
||||
$allow = JFactory::getUser()->authorise('core.create', $this->option . '.category.' . $categoryId);
|
||||
}
|
||||
|
||||
if ($allow !== null)
|
||||
@ -112,9 +113,9 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
* @param JModelLegacy $model The data model object.
|
||||
* @param array $validData The validated data.
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||
{
|
||||
|
@ -39,4 +39,57 @@ class WeblinksHelper extends JHelperContent
|
||||
$vName == 'categories'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fields name="filter">
|
||||
<field
|
||||
name="search"
|
||||
type="text"
|
||||
label="COM_WEBLINKS_FILTER_SEARCH_LABEL"
|
||||
description="COM_WEBLINKS_FILTER_SEARCH_DESC"
|
||||
hint="JSEARCH_FILTER"
|
||||
/>
|
||||
<field
|
||||
name="published"
|
||||
type="status"
|
||||
label="JOPTION_FILTER_PUBLISHED"
|
||||
description="JOPTION_FILTER_PUBLISHED_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
</field>
|
||||
<field
|
||||
name="category_id"
|
||||
type="category"
|
||||
label="JOPTION_FILTER_CATEGORY"
|
||||
description="JOPTION_FILTER_CATEGORY_DESC"
|
||||
extension="com_weblinks"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_CATEGORY</option>
|
||||
</field>
|
||||
<field
|
||||
name="access"
|
||||
type="accesslevel"
|
||||
label="JOPTION_FILTER_ACCESS"
|
||||
description="JOPTION_FILTER_ACCESS_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_ACCESS</option>
|
||||
</field>
|
||||
<field
|
||||
name="language"
|
||||
type="contentlanguage"
|
||||
label="JOPTION_FILTER_LANGUAGE"
|
||||
description="JOPTION_FILTER_LANGUAGE_DESC"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
<field
|
||||
name="tag"
|
||||
type="tag"
|
||||
label="JOPTION_FILTER_TAG"
|
||||
description="JOPTION_FILTER_TAG_DESC"
|
||||
mode="nested"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_TAG</option>
|
||||
</field>
|
||||
<field
|
||||
name="level"
|
||||
type="integer"
|
||||
label="JOPTION_FILTER_LEVEL"
|
||||
description="JOPTION_FILTER_LEVEL_DESC"
|
||||
first="1"
|
||||
last="10"
|
||||
step="1"
|
||||
languages="*"
|
||||
onchange="this.form.submit();"
|
||||
>
|
||||
<option value="">JOPTION_SELECT_MAX_LEVELS</option>
|
||||
</field>
|
||||
</fields>
|
||||
<fields name="list">
|
||||
<field
|
||||
name="fullordering"
|
||||
type="list"
|
||||
onchange="this.form.submit();"
|
||||
default="a.title ASC"
|
||||
>
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.state ASC">JSTATUS_ASC</option>
|
||||
<option value="a.state DESC">JSTATUS_DESC</option>
|
||||
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
|
||||
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
|
||||
<option value="category_title ASC">JCATEGORY_ASC</option>
|
||||
<option value="category_title DESC">JCATEGORY_DESC</option>
|
||||
<option value="access_level ASC">JGRID_HEADING_ACCESS_ASC</option>
|
||||
<option value="access_level DESC">JGRID_HEADING_ACCESS_DESC</option>
|
||||
<option value="a.hits ASC">JGLOBAL_HITS_ASC</option>
|
||||
<option value="a.hits DESC">JGLOBAL_HITS_DESC</option>
|
||||
<option value="language_title ASC">JGRID_HEADING_LANGUAGE_ASC</option>
|
||||
<option value="language_title DESC">JGRID_HEADING_LANGUAGE_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
<field
|
||||
name="limit"
|
||||
type="limitbox"
|
||||
class="input-mini"
|
||||
default="25"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
</fields>
|
||||
</form>
|
@ -19,7 +19,7 @@ class WeblinksModelWeblinks extends JModelList
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
*
|
||||
* @see JControllerLegacy
|
||||
* @since 1.6
|
||||
@ -34,18 +34,23 @@ class WeblinksModelWeblinks extends JModelList
|
||||
'alias', 'a.alias',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'catid', 'a.catid', 'category_title',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'catid', 'a.catid', 'category_id',
|
||||
'c.title', 'category_title',
|
||||
'state', 'a.state', 'published',
|
||||
'access', 'a.access',
|
||||
'ag.title', 'access_level',
|
||||
'created', 'a.created',
|
||||
'created_by', 'a.created_by',
|
||||
'ordering', 'a.ordering',
|
||||
'featured', 'a.featured',
|
||||
'language', 'a.language',
|
||||
'l.title', 'language_title',
|
||||
'hits', 'a.hits',
|
||||
'publish_up', 'a.publish_up',
|
||||
'publish_down', 'a.publish_down',
|
||||
'url', 'a.url',
|
||||
'tag',
|
||||
'level', 'c.level',
|
||||
);
|
||||
}
|
||||
|
||||
@ -55,38 +60,31 @@ class WeblinksModelWeblinks extends JModelList
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @note Calling getState in this method will result in recursion.
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
protected function populateState($ordering = 'a.title', $direction = 'asc')
|
||||
{
|
||||
// Load the filter state.
|
||||
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
$accessId = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);
|
||||
|
||||
$published = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
|
||||
$this->setState('filter.state', $published);
|
||||
|
||||
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '');
|
||||
$this->setState('filter.category_id', $categoryId);
|
||||
|
||||
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
$tag = $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', '');
|
||||
$this->setState('filter.tag', $tag);
|
||||
$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.
|
||||
$params = JComponentHelper::getParams('com_weblinks');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.title', 'asc');
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,9 +105,11 @@ class WeblinksModelWeblinks extends JModelList
|
||||
// Compile the store id.
|
||||
$id .= ':' . $this->getState('filter.search');
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.state');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.category_id');
|
||||
$id .= ':' . $this->getState('filter.language');
|
||||
$id .= ':' . $this->getState('filter.tag');
|
||||
$id .= ':' . $this->getState('filter.level');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
@ -136,47 +136,48 @@ class WeblinksModelWeblinks extends JModelList
|
||||
'a.hits, a.state, a.access, a.ordering, a.language, a.publish_up, a.publish_down'
|
||||
)
|
||||
);
|
||||
$query->from($db->quoteName('#__weblinks') . ' AS a');
|
||||
$query->from($db->quoteName('#__weblinks', 'a'));
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title, l.image AS language_image')
|
||||
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||
$query->select($db->quoteName('l.title', 'language_title'))
|
||||
->select($db->quoteName('l.image', 'language_image'))
|
||||
->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON ' . $db->qn('l.lang_code') . ' = ' . $db->qn('a.language'));
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor')
|
||||
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
$query->select($db->quoteName('uc.name', 'editor'))
|
||||
->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->qn('uc.id') . ' = ' . $db->qn('a.checked_out'));
|
||||
|
||||
// Join over the asset groups.
|
||||
$query->select('ag.title AS access_level')
|
||||
->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
|
||||
$query->select($db->quoteName('ag.title', 'access_level'))
|
||||
->join('LEFT', $db->quoteName('#__viewlevels', 'ag') . ' ON ' . $db->qn('ag.id') . ' = ' . $db->qn('a.access'));
|
||||
|
||||
// Join over the categories.
|
||||
$query->select('c.title AS category_title')
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||
->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('a.catid'));
|
||||
|
||||
// Filter by access level.
|
||||
if ($access = $this->getState('filter.access'))
|
||||
{
|
||||
$query->where('a.access = ' . (int) $access);
|
||||
$query->where($db->quoteName('a.access') . ' = ' . (int) $access);
|
||||
}
|
||||
|
||||
// Implement View Level Access
|
||||
if (!$user->authorise('core.admin'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
$query->where($db->quoteName('a.access') . ' IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Filter by published state
|
||||
$published = $this->getState('filter.state');
|
||||
$published = $this->getState('filter.published');
|
||||
|
||||
if (is_numeric($published))
|
||||
{
|
||||
$query->where('a.state = ' . (int) $published);
|
||||
$query->where($db->quoteName('a.state') . ' = ' . (int) $published);
|
||||
}
|
||||
elseif ($published === '')
|
||||
{
|
||||
$query->where('(a.state IN (0, 1))');
|
||||
$query->where('(' . $db->quoteName('a.state') . ' IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by category.
|
||||
@ -184,7 +185,13 @@ class WeblinksModelWeblinks extends JModelList
|
||||
|
||||
if (is_numeric($categoryId))
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId);
|
||||
$query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId);
|
||||
}
|
||||
|
||||
// Filter on the level.
|
||||
if ($level = $this->getState('filter.level'))
|
||||
{
|
||||
$query->where($db->quoteName('c.level') . ' <= ' . (int) $level);
|
||||
}
|
||||
|
||||
// Filter by search in title
|
||||
@ -194,19 +201,19 @@ class WeblinksModelWeblinks extends JModelList
|
||||
{
|
||||
if (stripos($search, 'id:') === 0)
|
||||
{
|
||||
$query->where('a.id = ' . (int) substr($search, 3));
|
||||
$query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
|
||||
$query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')');
|
||||
$query->where('(' . $db->quoteName('a.title') . ' LIKE ' . $search . ' OR ' . $db->quoteName('a.alias') . ' LIKE ' . $search . ')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language'))
|
||||
{
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
$query->where($db->quoteName('a.language') . ' = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
$tagId = $this->getState('filter.tag');
|
||||
@ -223,8 +230,8 @@ class WeblinksModelWeblinks extends JModelList
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering');
|
||||
$orderDirn = $this->state->get('list.direction');
|
||||
$orderCol = $this->state->get('list.ordering', 'a.title');
|
||||
$orderDirn = $this->state->get('list.direction', 'ASC');
|
||||
|
||||
if ($orderCol == 'a.ordering' || $orderCol == 'category_title')
|
||||
{
|
||||
|
@ -151,11 +151,26 @@ class Com_WeblinksInstallerScript
|
||||
$query->values(
|
||||
$db->quote('Weblink') . ', '
|
||||
. $db->quote('com_weblinks.weblink') . ', '
|
||||
. $db->quote('{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
||||
. $db->quote(
|
||||
'{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},
|
||||
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
||||
. $db->quote('') . ', '
|
||||
. $db->quote('{"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":"url", "core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc", "core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}') . ', '
|
||||
. $db->quote(
|
||||
'{"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":"url",
|
||||
"core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc",
|
||||
"core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}') . ', '
|
||||
. $db->quote('WeblinksHelperRoute::getWeblinkRoute') . ', '
|
||||
. $db->quote('{"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"} ]}')
|
||||
. $db->quote(
|
||||
'{"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"} ]}')
|
||||
);
|
||||
|
||||
$db->setQuery($query);
|
||||
@ -172,11 +187,29 @@ class Com_WeblinksInstallerScript
|
||||
$query->values(
|
||||
$db->quote('Weblinks Category') . ', '
|
||||
. $db->quote('com_weblinks.category') . ', '
|
||||
. $db->quote('{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
||||
. $db->quote('
|
||||
{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},
|
||||
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
|
||||
. $db->quote('') . ', '
|
||||
. $db->quote('{"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"}}') . ', '
|
||||
. $db->quote('
|
||||
{"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"}}') . ', '
|
||||
. $db->quote('WeblinksHelperRoute::getCategoryRoute') . ', '
|
||||
. $db->quote('{"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"}]}')
|
||||
. $db->quote('
|
||||
{"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"}]}')
|
||||
);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `#__weblinks` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`catid` int(11) NOT NULL DEFAULT 0,
|
||||
`title` varchar(250) NOT NULL DEFAULT '',
|
||||
`alias` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
|
||||
`url` varchar(250) NOT NULL DEFAULT '',
|
||||
`description` text NOT NULL,
|
||||
`hits` int(11) NOT NULL DEFAULT 0,
|
||||
@ -48,4 +48,4 @@ CREATE TABLE IF NOT EXISTS `#__weblinks` (
|
||||
KEY `idx_featured_catid` (`featured`,`catid`),
|
||||
KEY `idx_language` (`language`),
|
||||
KEY `idx_xreference` (`xreference`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||
|
@ -0,0 +1,25 @@
|
||||
# Conversion to utf8mb4
|
||||
|
||||
--
|
||||
-- Step 1.1: Enlarge columns to avoid data loss on later conversion to utf8mb4
|
||||
--
|
||||
|
||||
ALTER TABLE `#__weblinks` MODIFY `alias` varchar(400) NOT NULL DEFAULT '';
|
||||
|
||||
--
|
||||
-- Step 1.2: Convert table to utf8mb4 chracter set with utf8mb4_unicode_ci collation
|
||||
--
|
||||
|
||||
ALTER TABLE `#__weblinks` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
--
|
||||
-- Step 1.3: Set collation to utf8mb4_bin for formerly utf8_bin collated columns
|
||||
--
|
||||
|
||||
ALTER TABLE `#__weblinks` MODIFY `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '';
|
||||
|
||||
--
|
||||
-- Step 1.4: Set default character set and collation for all tables
|
||||
--
|
||||
|
||||
ALTER TABLE `#__weblinks` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
@ -45,7 +45,7 @@ class WeblinksTableWeblink extends JTable
|
||||
/**
|
||||
* Overload the store method for the Weblinks table.
|
||||
*
|
||||
* @param boolean Toggle whether null values should be updated.
|
||||
* @param boolean $updateNulls Toggle whether null values should be updated.
|
||||
*
|
||||
* @return boolean True on success, false on failure.
|
||||
*
|
||||
@ -122,7 +122,7 @@ class WeblinksTableWeblink extends JTable
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for valid name
|
||||
// Check for valid name
|
||||
if (trim($this->title) == '')
|
||||
{
|
||||
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
|
||||
|
@ -9,20 +9,17 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$fieldSets = $this->form->getFieldsets('params');
|
||||
foreach ($fieldSets as $name => $fieldSet) :
|
||||
?>
|
||||
<div class="tab-pane" id="params-<?php echo $name;?>">
|
||||
<?php
|
||||
if (isset($fieldSet->description) && trim($fieldSet->description)) :
|
||||
echo '<p class="alert alert-info">'.$this->escape(JText::_($fieldSet->description)).'</p>';
|
||||
endif;
|
||||
?>
|
||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $field->label; ?></div>
|
||||
<div class="controls"><?php echo $field->input; ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
$fieldSets = $this->form->getFieldsets('params'); ?>
|
||||
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
|
||||
<div class="tab-pane" id="params-<?php echo $name; ?>">
|
||||
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
|
||||
<?php echo '<p class="alert alert-info">' . $this->escape(JText::_($fieldSet->description)) . '</p>'; ?>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($this->form->getFieldset($name) as $field) : ?>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><?php echo $field->label; ?></div>
|
||||
<div class="controls"><?php echo $field->input; ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
@ -23,40 +23,48 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
* 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');
|
||||
$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;
|
||||
}
|
||||
|
||||
$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'));
|
||||
$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);
|
||||
$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');
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
JHtml::_('behavior.multiselect');
|
||||
@ -21,69 +21,23 @@ $listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
|
||||
$saveOrder = $listOrder == 'a.ordering';
|
||||
|
||||
if ($saveOrder)
|
||||
{
|
||||
$saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
|
||||
JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
|
||||
}
|
||||
$sortFields = $this->getSortFields();
|
||||
|
||||
JFactory::getDocument()->addScriptDeclaration('
|
||||
Joomla.orderTable = function()
|
||||
{
|
||||
table = document.getElementById("sortTable");
|
||||
direction = document.getElementById("directionTable");
|
||||
order = table.options[table.selectedIndex].value;
|
||||
if (order != "' . $listOrder . '")
|
||||
{
|
||||
dirn = "asc";
|
||||
}
|
||||
else
|
||||
{
|
||||
dirn = direction.options[direction.selectedIndex].value;
|
||||
}
|
||||
Joomla.tableOrdering(order, dirn, "");
|
||||
};
|
||||
');
|
||||
?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<?php if (!empty( $this->sidebar)) : ?>
|
||||
<?php if (!empty($this->sidebar)) : ?>
|
||||
<div id="j-sidebar-container" class="span2">
|
||||
<?php echo $this->sidebar; ?>
|
||||
</div>
|
||||
<div id="j-main-container" class="span10">
|
||||
<?php else : ?>
|
||||
<?php else : ?>
|
||||
<div id="j-main-container">
|
||||
<?php endif;?>
|
||||
<div id="filter-bar" class="btn-toolbar">
|
||||
<div class="filter-search btn-group pull-left">
|
||||
<label for="filter_search" class="element-invisible"><?php echo JText::_('COM_WEBLINKS_SEARCH_IN_TITLE');?></label>
|
||||
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_WEBLINKS_SEARCH_IN_TITLE'); ?>" />
|
||||
</div>
|
||||
<div class="btn-group pull-left">
|
||||
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
|
||||
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.getElementById('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
|
||||
<?php echo $this->pagination->getLimitBox(); ?>
|
||||
</div>
|
||||
<div class="btn-group pull-right hidden-phone">
|
||||
<label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
|
||||
<select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
|
||||
<option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
|
||||
<option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="btn-group pull-right">
|
||||
<label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
|
||||
<select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
|
||||
<option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
|
||||
<?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
||||
<div class="clearfix"> </div>
|
||||
<?php if (empty($this->items)) : ?>
|
||||
<div class="alert alert-no-items">
|
||||
@ -94,88 +48,90 @@ JFactory::getDocument()->addScriptDeclaration('
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
|
||||
</th>
|
||||
<th width="1%" class="hidden-phone center">
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.checkall'); ?>
|
||||
</th>
|
||||
<th width="1%" style="min-width:55px" class="nowrap center">
|
||||
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||
<th width="1%" class="nowrap center">
|
||||
<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="5%" class="nowrap center hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
<th width="10%" class="nowrap hidden-phone">
|
||||
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
|
||||
<?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>
|
||||
<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::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="10">
|
||||
<td colspan="8">
|
||||
<?php echo $this->pagination->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php foreach ($this->items as $i => $item) :
|
||||
$ordering = ($listOrder == 'a.ordering');
|
||||
$item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]='. $item->catid);
|
||||
$canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid);
|
||||
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid);
|
||||
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
|
||||
$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?>">
|
||||
<?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->get('id') || $item->checked_out == 0; ?>
|
||||
<?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 = '';
|
||||
if (!$canChange)
|
||||
{
|
||||
$iconClass = ' inactive';
|
||||
}
|
||||
elseif (!$saveOrder)
|
||||
{
|
||||
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||
}
|
||||
?>
|
||||
<?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"></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 " />
|
||||
<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 hidden-phone">
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
|
||||
<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) : ?>
|
||||
<a href="<?php echo JRoute::_('index.php?option=com_weblinks&task=weblink.edit&id='.(int) $item->id); ?>">
|
||||
<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));?>
|
||||
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||
</span>
|
||||
<div class="small">
|
||||
<?php echo $this->escape($item->category_title); ?>
|
||||
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="small hidden-phone">
|
||||
@ -185,9 +141,9 @@ JFactory::getDocument()->addScriptDeclaration('
|
||||
<?php echo $item->hits; ?>
|
||||
</td>
|
||||
<td class="small nowrap hidden-phone">
|
||||
<?php if ($item->language == '*'):?>
|
||||
<?php if ($item->language == '*') : ?>
|
||||
<?php echo JText::alt('JALL', 'language'); ?>
|
||||
<?php else:?>
|
||||
<?php else : ?>
|
||||
<?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
@ -205,8 +161,6 @@ JFactory::getDocument()->addScriptDeclaration('
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="boxchecked" value="0" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$published = $this->state->get('filter.state');
|
||||
$published = $this->state->get('filter.published');
|
||||
?>
|
||||
<div class="modal hide fade" id="collapseModal">
|
||||
<div class="modal-header">
|
||||
|
@ -23,15 +23,19 @@ class WeblinksViewWeblinks extends JViewLegacy
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* Display the view
|
||||
* Display the view.
|
||||
*
|
||||
* @return void
|
||||
* @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->state = $this->get('State');
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->filterForm = $this->get('FilterForm');
|
||||
$this->activeFilters = $this->get('ActiveFilters');
|
||||
|
||||
WeblinksHelper::addSubmenu('weblinks');
|
||||
|
||||
@ -50,6 +54,8 @@ class WeblinksViewWeblinks extends JViewLegacy
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function addToolbar()
|
||||
@ -84,7 +90,7 @@ class WeblinksViewWeblinks extends JViewLegacy
|
||||
JToolbarHelper::checkin('weblinks.checkin');
|
||||
}
|
||||
|
||||
if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
|
||||
if ($state->get('filter.published') == -2 && $canDo->get('core.delete'))
|
||||
{
|
||||
JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'weblinks.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
@ -113,39 +119,6 @@ class WeblinksViewWeblinks extends JViewLegacy
|
||||
}
|
||||
|
||||
JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
|
||||
|
||||
JHtmlSidebar::setAction('index.php?option=com_weblinks&view=weblinks');
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_state',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true)
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_CATEGORY'),
|
||||
'filter_category_id',
|
||||
JHtml::_('select.options', JHtml::_('category.options', 'com_weblinks'), 'value', 'text', $this->state->get('filter.category_id'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_ACCESS'),
|
||||
'filter_access',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_LANGUAGE'),
|
||||
'filter_language',
|
||||
JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'))
|
||||
);
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_TAG'),
|
||||
'filter_tag',
|
||||
JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag'))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.1" method="upgrade">
|
||||
<extension type="component" version="3.5" method="upgrade">
|
||||
<name>com_weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>##DATE##</creationDate>
|
||||
|
@ -3,7 +3,7 @@
|
||||
; 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
|
||||
|
||||
COM_WEBLINKS="Weblinks"
|
||||
COM_WEBLINKS="Web Links"
|
||||
COM_WEBLINKS_ACCESS_HEADING="Access"
|
||||
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."
|
||||
@ -21,6 +21,8 @@ COM_WEBLINKS_ERROR_UNIQUE_ALIAS="Another web link from this category has the sam
|
||||
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_CONFIG_CAT_SHOWNUMBERS_DESC="Show/Hide the number of Web Links in each Category."
|
||||
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."
|
||||
@ -79,6 +81,8 @@ COM_WEBLINKS_FIELD_WIDTH_LABEL="Width"
|
||||
COM_WEBLINKS_FIELDSET_IMAGES="Images"
|
||||
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 an web link ID."
|
||||
COM_WEBLINKS_FILTER_SEARCH_LABEL="Search Web Links"
|
||||
COM_WEBLINKS_FILTER_STATE="Filter State"
|
||||
COM_WEBLINKS_FLOAT_DESC="Controls placement of the image."
|
||||
COM_WEBLINKS_FLOAT_LABEL="Image Float"
|
||||
|
@ -3,7 +3,7 @@
|
||||
; 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
|
||||
|
||||
COM_WEBLINKS="Weblinks"
|
||||
COM_WEBLINKS="Web Links"
|
||||
COM_WEBLINKS_CATEGORIES="Categories"
|
||||
COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_DESC="Show all the web link categories within a category."
|
||||
COM_WEBLINKS_CATEGORIES_VIEW_DEFAULT_OPTION="Default"
|
||||
|
@ -19,7 +19,7 @@ class WeblinksController extends JControllerLegacy
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean $cachable If true, the view output will be cached
|
||||
* @param boolean $cacheable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||
* for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
@ -27,30 +27,32 @@ class WeblinksController extends JControllerLegacy
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function display($cachable = false, $urlparams = false)
|
||||
public function display($cacheable = false, $urlparams = false)
|
||||
{
|
||||
$cachable = true; // Huh? Why not just put that in the constructor?
|
||||
$user = JFactory::getUser();
|
||||
// Huh? Why not just put that in the constructor?
|
||||
$cacheable = true;
|
||||
|
||||
// Set the default view name and format from the Request.
|
||||
// Note we are using w_id to avoid collisions with the router and the return page.
|
||||
// Frontend is a bit messier than the backend.
|
||||
/**
|
||||
* Set the default view name and format from the Request.
|
||||
* Note we are using w_id to avoid collisions with the router and the return page.
|
||||
* Frontend is a bit messier than the backend.
|
||||
*/
|
||||
$id = $this->input->getInt('w_id');
|
||||
$vName = $this->input->get('view', 'categories');
|
||||
$this->input->set('view', $vName);
|
||||
|
||||
if (JFactory::getUser()->id ||($this->input->getMethod() == 'POST' && $vName = 'categories'))
|
||||
{
|
||||
$cachable = false;
|
||||
$cacheable = false;
|
||||
}
|
||||
|
||||
$safeurlparams = array(
|
||||
'id' => 'INT',
|
||||
'limit' => 'UINT',
|
||||
'limitstart' => 'UINT',
|
||||
'filter_order' => 'CMD',
|
||||
'filter_order_Dir' => 'CMD',
|
||||
'lang' => 'CMD'
|
||||
'id' => 'INT',
|
||||
'limit' => 'UINT',
|
||||
'limitstart' => 'UINT',
|
||||
'filter_order' => 'CMD',
|
||||
'filter_order_Dir' => 'CMD',
|
||||
'lang' => 'CMD'
|
||||
);
|
||||
|
||||
// Check for edit form.
|
||||
@ -60,6 +62,6 @@ class WeblinksController extends JControllerLegacy
|
||||
return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
}
|
||||
|
||||
return parent::display($cachable, $safeurlparams);
|
||||
return parent::display($cacheable, $safeurlparams);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
*/
|
||||
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)
|
||||
@ -180,8 +180,8 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = null)
|
||||
{
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
$itemId = $this->input->getInt('Itemid');
|
||||
$return = $this->getReturnPage();
|
||||
$itemId = $this->input->getInt('Itemid');
|
||||
$return = $this->getReturnPage();
|
||||
|
||||
if ($itemId)
|
||||
{
|
||||
@ -227,11 +227,21 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
*/
|
||||
public function save($key = null, $urlVar = 'w_id')
|
||||
{
|
||||
// Get the application
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// Get the data from POST
|
||||
$data = $this->input->post->get('jform', array(), 'array');
|
||||
|
||||
// Save the data in the session.
|
||||
$app->setUserState('com_weblinks.edit.weblink.data', $data);
|
||||
$result = parent::save($key, $urlVar);
|
||||
|
||||
// If ok, redirect to the return page.
|
||||
if ($result)
|
||||
{
|
||||
// Flush the data from the session
|
||||
$app->setUserState('com_weblinks.edit.weblink.data', null);
|
||||
$this->setRedirect($this->getReturnPage());
|
||||
}
|
||||
|
||||
@ -264,7 +274,7 @@ class WeblinksControllerWeblink extends JControllerForm
|
||||
}
|
||||
|
||||
// Check whether item access level allows access.
|
||||
$groups = JFactory::getUser()->getAuthorisedViewLevels();
|
||||
$groups = JFactory::getUser()->getAuthorisedViewLevels();
|
||||
|
||||
if (!in_array($link->access, $groups))
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JLoader::register('WeblinksHelper', JPATH_ADMINISTRATOR . '/components/com_weblinks/helpers/weblinks.php');
|
||||
JLoader::register('WeblinksHelperRoute', JPATH_SITE . '/components/com_weblinks/helpers/route.php');
|
||||
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');
|
||||
|
||||
/**
|
||||
@ -31,11 +32,9 @@ abstract class WeblinksHelperAssociation extends CategoryHelperAssociation
|
||||
*/
|
||||
public static function getAssociations($id = 0, $view = null)
|
||||
{
|
||||
jimport('helper.route', JPATH_COMPONENT_SITE);
|
||||
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$view = is_null($view) ? $jinput->get('view') : $view;
|
||||
$id = empty($id) ? $jinput->getInt('id') : $id;
|
||||
$view = is_null($view) ? $jinput->get('view') : $view;
|
||||
$id = empty($id) ? $jinput->getInt('id') : $id;
|
||||
|
||||
if ($view == 'category' || $view == 'categories')
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ class JHtmlIcon
|
||||
|
||||
$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);
|
||||
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
|
||||
|
||||
if ($weblink->state == 0)
|
||||
{
|
||||
|
@ -21,18 +21,20 @@ abstract class WeblinksHelperRoute
|
||||
protected static $lang_lookup = array();
|
||||
|
||||
/**
|
||||
* @param integer The route of the weblink
|
||||
* 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)
|
||||
);
|
||||
$needles = array('weblink' => array((int) $id));
|
||||
|
||||
// Create the link
|
||||
$link = 'index.php?option=com_weblinks&view=weblink&id='. $id;
|
||||
$link = 'index.php?option=com_weblinks&view=weblink&id=' . $id;
|
||||
|
||||
if ($catid > 1)
|
||||
{
|
||||
@ -43,7 +45,7 @@ abstract class WeblinksHelperRoute
|
||||
{
|
||||
$needles['category'] = array_reverse($category->getPath());
|
||||
$needles['categories'] = $needles['category'];
|
||||
$link .= '&catid='.$catid;
|
||||
$link .= '&catid=' . $catid;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,13 +62,15 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
$link .= '&Itemid=' . $item;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ge the form route
|
||||
*
|
||||
* @param integer $id The id of the weblink.
|
||||
* @param string $return The return page variable.
|
||||
*
|
||||
@ -77,7 +81,7 @@ abstract class WeblinksHelperRoute
|
||||
// Create the link.
|
||||
if ($id)
|
||||
{
|
||||
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id='. $id;
|
||||
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id=' . $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -86,13 +90,15 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if ($return)
|
||||
{
|
||||
$link .= '&return='.$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
|
||||
*
|
||||
@ -120,7 +126,7 @@ abstract class WeblinksHelperRoute
|
||||
$needles = array();
|
||||
|
||||
// Create the link
|
||||
$link = 'index.php?option=com_weblinks&view=category&id='.$id;
|
||||
$link = 'index.php?option=com_weblinks&view=category&id=' . $id;
|
||||
|
||||
$catids = array_reverse($category->getPath());
|
||||
$needles['category'] = $catids;
|
||||
@ -139,7 +145,7 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
$link .= '&Itemid=' . $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +153,9 @@ abstract class WeblinksHelperRoute
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* Do a language lookup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function buildLanguageLookup()
|
||||
{
|
||||
@ -169,6 +177,13 @@ abstract class WeblinksHelperRoute
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
@ -180,7 +195,7 @@ abstract class WeblinksHelperRoute
|
||||
{
|
||||
self::$lookup[$language] = array();
|
||||
|
||||
$component = JComponentHelper::getComponent('com_weblinks');
|
||||
$component = JComponentHelper::getComponent('com_weblinks');
|
||||
|
||||
$attributes = array('component_id');
|
||||
$values = array($component->id);
|
||||
@ -208,9 +223,11 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if (isset($item->query['id']))
|
||||
{
|
||||
// here it will become a bit tricky
|
||||
// language != * can override existing entries
|
||||
// language == * cannot override existing entries
|
||||
/**
|
||||
* 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;
|
||||
|
@ -40,6 +40,11 @@ class WeblinksModelCategories extends JModelList
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
@ -54,8 +59,8 @@ class WeblinksModelCategories extends JModelList
|
||||
$params = $app->getParams();
|
||||
$this->setState('params', $params);
|
||||
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.access', true);
|
||||
$this->setState('filter.published', 1);
|
||||
$this->setState('filter.access', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,25 +70,25 @@ class WeblinksModelCategories extends JModelList
|
||||
* different modules that might need different sets of data or different
|
||||
* ordering requirements.
|
||||
*
|
||||
* @param string $id A prefix for the store id.
|
||||
* @param string $id A prefix for the store id.
|
||||
*
|
||||
* @return string A store id.
|
||||
*/
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.extension');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.parentId');
|
||||
$id .= ':' . $this->getState('filter.extension');
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
$id .= ':' . $this->getState('filter.access');
|
||||
$id .= ':' . $this->getState('filter.parentId');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* redefine the function an add some properties to make the styling more easy
|
||||
* Redefine the function and add some properties to make the styling more easy
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
@ -117,12 +122,18 @@ class WeblinksModelCategories extends JModelList
|
||||
return $this->_items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
if (!is_object($this->_parent))
|
||||
{
|
||||
$this->getItems();
|
||||
}
|
||||
|
||||
return $this->_parent;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class WeblinksModelCategory extends JModelList
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param array An optional associative array of configuration settings.
|
||||
* @param array $config An optional associative array of configuration settings.
|
||||
*
|
||||
* @see JControllerLegacy
|
||||
* @since 1.6
|
||||
@ -121,9 +121,20 @@ class WeblinksModelCategory extends JModelList
|
||||
// Filter by category.
|
||||
if ($categoryId = $this->getState('category.id'))
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId)
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
// Group by subcategory
|
||||
if ($this->getState('category.group', 0))
|
||||
{
|
||||
$query->select('c.title AS category_title')
|
||||
->where('c.parent_id = ' . (int) $categoryId)
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->where('a.catid = ' . (int) $categoryId)
|
||||
->join('LEFT', '#__categories AS c ON c.id = a.catid')
|
||||
->where('c.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Filter by published category
|
||||
$cpublished = $this->getState('filter.c.published');
|
||||
@ -141,7 +152,6 @@ class WeblinksModelCategory extends JModelList
|
||||
->join('LEFT', '#__users AS uam ON uam.id = a.modified_by');
|
||||
|
||||
// Filter by state
|
||||
|
||||
$state = $this->getState('filter.state');
|
||||
|
||||
if (is_numeric($state))
|
||||
@ -149,7 +159,7 @@ class WeblinksModelCategory extends JModelList
|
||||
$query->where('a.state = ' . (int) $state);
|
||||
}
|
||||
|
||||
// do not show trashed links on the front-end
|
||||
// Do not show trashed links on the front-end
|
||||
$query->where('a.state != -2');
|
||||
|
||||
// Filter by start and end dates.
|
||||
@ -176,12 +186,20 @@ class WeblinksModelCategory extends JModelList
|
||||
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||
$query->where('(a.title LIKE ' . $search . ')');
|
||||
}
|
||||
|
||||
// If grouping by subcategory, add the subcategory list ordering clause.
|
||||
if ($this->getState('category.group', 0))
|
||||
{
|
||||
$query->order(
|
||||
$db->escape($this->getState('category.ordering', 'c.lft')) . ' ' .
|
||||
$db->escape($this->getState('category.direction', 'ASC'))
|
||||
);
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$query->order(
|
||||
$db->escape(
|
||||
$this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')
|
||||
)
|
||||
$db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' .
|
||||
$db->escape($this->getState('list.direction', 'ASC'))
|
||||
);
|
||||
|
||||
return $query;
|
||||
@ -192,6 +210,11 @@ class WeblinksModelCategory extends JModelList
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @param string $ordering An optional ordering field.
|
||||
* @param string $direction An optional direction (asc|desc).
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
@ -234,7 +257,7 @@ class WeblinksModelCategory extends JModelList
|
||||
|
||||
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);
|
||||
|
||||
// Filter by start and end dates.
|
||||
@ -301,8 +324,6 @@ class WeblinksModelCategory extends JModelList
|
||||
/**
|
||||
* Get the parent category
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
public function getParent()
|
||||
@ -311,40 +332,46 @@ class WeblinksModelCategory extends JModelList
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sibling (adjacent) categories.
|
||||
* Get the leftsibling (adjacent) categories.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
function &getLeftSibling()
|
||||
public function &getLeftSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_leftsibling;
|
||||
}
|
||||
|
||||
function &getRightSibling()
|
||||
/**
|
||||
* Get the rightsibling (adjacent) categories.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
public function &getRightSibling()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
$this->getCategory();
|
||||
}
|
||||
|
||||
return $this->_rightsibling;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the child categories.
|
||||
*
|
||||
* @param integer An optional category id. If not supplied, the model state 'category.id' will be used.
|
||||
*
|
||||
* @return mixed An array of categories or false if an error occurs.
|
||||
*/
|
||||
function &getChildren()
|
||||
public function &getChildren()
|
||||
{
|
||||
if (!is_object($this->_item))
|
||||
{
|
||||
|
@ -43,6 +43,8 @@ class WeblinksModelForm extends WeblinksModelWeblink
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
|
@ -89,6 +89,15 @@
|
||||
size="45"
|
||||
labelclass="control-label" />
|
||||
|
||||
<field
|
||||
name="captcha"
|
||||
type="captcha"
|
||||
label="COM_WEBLINKS_CAPTCHA_LABEL"
|
||||
description="COM_WEBLINKS_CAPTCHA_DESC"
|
||||
validate="captcha"
|
||||
namespace="weblink"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
<fields name="metadata">
|
||||
<fieldset name="jmetadata"
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
|
||||
|
||||
/**
|
||||
@ -30,15 +32,17 @@ class WeblinksModelWeblink extends JModelItem
|
||||
*
|
||||
* Note. Calling getState in this method will result in recursion.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function populateState()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$params = $app->getParams();
|
||||
$app = JFactory::getApplication();
|
||||
$params = $app->getParams();
|
||||
|
||||
// Load the object state.
|
||||
$id = $app->input->getInt('id');
|
||||
$id = $app->input->getInt('id');
|
||||
$this->setState('weblink.id', $id);
|
||||
|
||||
// Load the parameters.
|
||||
@ -48,7 +52,7 @@ class WeblinksModelWeblink extends JModelItem
|
||||
/**
|
||||
* Method to get an object.
|
||||
*
|
||||
* @param integer The id of the object to get.
|
||||
* @param integer $id The id of the object to get.
|
||||
*
|
||||
* @return mixed Object on success, false on failure.
|
||||
*/
|
||||
@ -79,8 +83,8 @@ class WeblinksModelWeblink extends JModelItem
|
||||
}
|
||||
|
||||
// Convert the JTable to a clean JObject.
|
||||
$properties = $table->getProperties(1);
|
||||
$this->_item = JArrayHelper::toObject($properties, 'JObject');
|
||||
$properties = $table->getProperties(1);
|
||||
$this->_item = ArrayHelper::toObject($properties, 'JObject');
|
||||
}
|
||||
elseif ($error = $table->getError())
|
||||
{
|
||||
@ -94,13 +98,13 @@ class WeblinksModelWeblink extends JModelItem
|
||||
/**
|
||||
* Returns a reference to the a Table object, always creating it.
|
||||
*
|
||||
* @param type The table type to instantiate
|
||||
* @param string A prefix for the table class name. Optional.
|
||||
* @param array Configuration array for model. Optional.
|
||||
* @param string $type The table type to instantiate
|
||||
* @param string $prefix A prefix for the table class name. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JTable A database object
|
||||
* @return JTable A database object
|
||||
*
|
||||
* @since 1.6
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getTable($type = 'Weblink', $prefix = 'WeblinksTable', $config = array())
|
||||
{
|
||||
@ -121,8 +125,6 @@ class WeblinksModelWeblink extends JModelItem
|
||||
$id = $this->getState('weblink.id');
|
||||
}
|
||||
|
||||
$weblink = $this->getTable('Weblink', 'WeblinksTable');
|
||||
|
||||
return $weblink->hit($id);
|
||||
return $this->getTable('Weblink', 'WeblinksTable')->hit($id);
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,11 @@ class WeblinksRouter extends JComponentRouterBase
|
||||
/**
|
||||
* Weblinks router functions
|
||||
*
|
||||
* These functions are proxys for the new router interface
|
||||
* @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
|
||||
@ -271,6 +275,18 @@ function WeblinksBuildRoute(&$query)
|
||||
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;
|
||||
|
@ -9,6 +9,6 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers');
|
||||
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
|
||||
$this->subtemplatename = 'items';
|
||||
echo JLayoutHelper::render('joomla.content.category_default', $this);
|
||||
|
@ -25,8 +25,8 @@ $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'));
|
||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||
?>
|
||||
|
||||
<?php if (empty($this->items)) : ?>
|
||||
@ -34,9 +34,9 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
<?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')) :?>
|
||||
<?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') :?>
|
||||
<?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'); ?>" />
|
||||
@ -54,12 +54,11 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
</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: ?>
|
||||
<?php else : ?>
|
||||
<li class="cat-list-row<?php echo $i % 2; ?>" >
|
||||
<?php endif; ?>
|
||||
<?php if ($this->params->get('show_link_hits', 1)) : ?>
|
||||
@ -84,48 +83,47 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
<?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
|
||||
// Compute the correct link
|
||||
$menuclass = 'category' . $this->pageclass_sfx;
|
||||
$link = $item->link;
|
||||
$width = $item->params->get('width');
|
||||
$height = $item->params->get('height');
|
||||
if ($width == null || $height == null)
|
||||
{
|
||||
$width = 600;
|
||||
$height = 500;
|
||||
}
|
||||
if ($this->items[$i]->state == 0) : ?>
|
||||
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
|
||||
<?php endif; ?>
|
||||
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;
|
||||
|
||||
<?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;
|
||||
|
||||
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;
|
||||
}
|
||||
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); ?>
|
||||
@ -133,38 +131,32 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
||||
<?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="img-intro-<?php echo htmlspecialchars($imgfloat); ?>"> <img
|
||||
<?php if ($images->image_first_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_first_caption) .'"';
|
||||
endif; ?>
|
||||
<?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); ?> item-image"> <img
|
||||
<?php if ($images->image_second_caption):
|
||||
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_second_caption) .'"';
|
||||
endif; ?>
|
||||
<?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 ($canCreate) : // TODO This is not working due to some problem in the router, I think. Ref issue #23685 ?>
|
||||
<?php echo JHtml::_('icon.create', $item, $item->params); ?>
|
||||
<?php endif; */ ?>
|
||||
<?php if ($this->params->get('show_pagination')) : ?>
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
|
@ -14,6 +14,18 @@ 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');
|
||||
?>
|
||||
@ -34,7 +46,32 @@ $params = $this->state->get('params');
|
||||
<?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">
|
||||
<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')">
|
||||
@ -53,23 +90,6 @@ $params = $this->state->get('params');
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<hr class="hr-condensed" />
|
||||
<?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'); ?>
|
||||
|
||||
<input type="hidden" name="return" value="<?php echo $this->return_page;?>" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
|
@ -24,6 +24,13 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
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)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
@ -40,7 +47,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||
}
|
||||
else
|
||||
{
|
||||
$authorised = $user->authorise('core.edit', 'com_weblinks.category.'.$this->item->catid);
|
||||
$authorised = $user->authorise('core.edit', 'com_weblinks.category.' . $this->item->catid);
|
||||
}
|
||||
|
||||
if ($authorised !== true)
|
||||
@ -52,6 +59,14 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
if (!empty($this->item))
|
||||
{
|
||||
// Override the base weblink data with any data in the session.
|
||||
$temp = (array) JFactory::getApplication()->getUserState('com_weblinks.edit.weblink.data', array());
|
||||
|
||||
foreach ($temp as $k => $v)
|
||||
{
|
||||
$this->item->$k = $v;
|
||||
}
|
||||
|
||||
$this->form->bind($this->item);
|
||||
}
|
||||
|
||||
@ -66,7 +81,7 @@ class WeblinksViewForm extends JViewLegacy
|
||||
// Create a shortcut to the parameters.
|
||||
$params = &$this->state->params;
|
||||
|
||||
//Escape strings for HTML output
|
||||
// Escape strings for HTML output
|
||||
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
|
||||
|
||||
$this->params = $params;
|
||||
@ -78,12 +93,14 @@ class WeblinksViewForm extends JViewLegacy
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
$app = JFactory::getApplication();
|
||||
$menus = $app->getMenu();
|
||||
$title = null;
|
||||
|
||||
// Because the application sets a default page title,
|
||||
// we need to get it from the menu item itself
|
||||
|
@ -20,25 +20,33 @@ class WeblinksViewWeblink extends JViewLegacy
|
||||
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Get some data from the models
|
||||
$item = $this->get('Item');
|
||||
$item = $this->get('Item');
|
||||
|
||||
if ($this->getLayout() == 'edit')
|
||||
{
|
||||
$this->_displayEdit($tpl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($item->url)
|
||||
{
|
||||
// redirects to url if matching id found
|
||||
// Redirects to url if matching id found
|
||||
JFactory::getApplication()->redirect($item->url);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO create proper error handling
|
||||
// @TODO create proper error handling
|
||||
JFactory::getApplication()->redirect(JRoute::_('index.php'), JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 'notice');
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
; 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 - No BOM
|
||||
|
||||
COM_WEBLINKS_CAPTCHA_LABEL="Captcha"
|
||||
COM_WEBLINKS_CAPTCHA_DESC="Please complete the security check."
|
||||
COM_WEBLINKS_CONTENT_TYPE_WEBLINK="Web Link"
|
||||
COM_WEBLINKS_CONTENT_TYPE_CATEGORY="Web Links Category"
|
||||
COM_WEBLINKS_DEFAULT_PAGE_TITLE="Web Links"
|
||||
|
@ -3,8 +3,18 @@
|
||||
; 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 - No BOM
|
||||
|
||||
MOD_WEBLINKS="Weblinks"
|
||||
MOD_WEBLINKS="Web Links"
|
||||
MOD_WEBLINKS_FIELD_CATEGORY_DESC="Choose the Web Links category to display."
|
||||
MOD_WEBLINKS_FIELD_GROUPBY_DESC="If set to yes, weblinks will be grouped by subcategories."
|
||||
MOD_WEBLINKS_FIELD_GROUPBY_LABEL="Group By Subcategories"
|
||||
MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_DESC="If set to yes, will show groups titles (valid only if grouping)."
|
||||
MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_LABEL="Show Group Title"
|
||||
MOD_WEBLINKS_FIELD_GROUPBYORDERING_DESC="Ordering for the subcategories (valid only if grouping)."
|
||||
MOD_WEBLINKS_FIELD_GROUPBYORDERING_LABEL="Group Ordering"
|
||||
MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_DESC="Direction for the subcategories (valid only if grouping)."
|
||||
MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_LABEL="Group Ordering Direction"
|
||||
MOD_WEBLINKS_FIELD_COLUMNS_DESC="When grouping by subcategories, split into # columns."
|
||||
MOD_WEBLINKS_FIELD_COLUMNS_LABEL="Columns"
|
||||
MOD_WEBLINKS_FIELD_COUNT_DESC="Number of Web Links to display."
|
||||
MOD_WEBLINKS_FIELD_COUNT_LABEL="Count"
|
||||
MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC="If set to yes, the number of times the link has been clicked will be recorded."
|
||||
|
@ -3,5 +3,5 @@
|
||||
; 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
|
||||
|
||||
PKG_WEBLINKS="Weblinks Extension Package"
|
||||
PKG_WEBLINKS_XML_DESCRIPTION="The Weblinks package includes the weblinks component, module, and search plugins for both of Joomla's search platforms."
|
||||
PKG_WEBLINKS="Web Links Extension Package"
|
||||
PKG_WEBLINKS_XML_DESCRIPTION="The Web Links package includes the Web Links component, module, and search plugins for both of Joomla's search platforms."
|
||||
|
@ -57,6 +57,9 @@ class ModWeblinksHelper
|
||||
|
||||
$catid = (int) $params->get('catid', 0);
|
||||
$model->setState('category.id', $catid);
|
||||
$model->setState('category.group', $params->get('groupby', 0));
|
||||
$model->setState('category.ordering', $params->get('groupby_ordering', 'c.lft'));
|
||||
$model->setState('category.direction', $params->get('groupby_direction', 'ASC'));
|
||||
|
||||
// Create query object
|
||||
$db = JFactory::getDbo();
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="module" version="3.1" client="site" method="upgrade">
|
||||
<extension type="module" version="3.5" client="site" method="upgrade">
|
||||
<name>mod_weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>##DATE##</creationDate>
|
||||
@ -20,141 +20,204 @@
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_weblinks"
|
||||
required="true"
|
||||
label="JCATEGORY"
|
||||
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
|
||||
name="catid"
|
||||
type="category"
|
||||
extension="com_weblinks"
|
||||
required="true"
|
||||
label="JCATEGORY"
|
||||
description="MOD_WEBLINKS_FIELD_CATEGORY_DESC" />
|
||||
<field
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="title"
|
||||
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
|
||||
name="groupby"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_GROUPBY_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_GROUPBY_DESC">
|
||||
<option
|
||||
value="title">JGLOBAL_TITLE</option>
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
||||
<option
|
||||
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="direction"
|
||||
type="list"
|
||||
default="asc"
|
||||
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
|
||||
name="groupby_showtitle"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
label="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_GROUPBYSHOWTITLE_DESC">
|
||||
<option
|
||||
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
||||
value="1">JYES</option>
|
||||
<option
|
||||
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
||||
value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
name="target"
|
||||
type="list"
|
||||
default="3"
|
||||
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
|
||||
name="groupby_ordering"
|
||||
type="list"
|
||||
default="c.lft"
|
||||
label="MOD_WEBLINKS_FIELD_GROUPBYORDERING_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_GROUPBYORDERING_DESC">
|
||||
<option
|
||||
value="1">JBROWSERTARGET_NEW</option>
|
||||
value="c.title">JGLOBAL_TITLE</option>
|
||||
<option
|
||||
value="2">JBROWSERTARGET_POPUP</option>
|
||||
<option
|
||||
value="3">JBROWSERTARGET_PARENT</option>
|
||||
value="c.lft">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
||||
</field>
|
||||
<field
|
||||
name="follow"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
|
||||
name="groupby_direction"
|
||||
type="list"
|
||||
default="asc"
|
||||
label="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_GROUPBYDIRECTION_DESC">
|
||||
<option
|
||||
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
|
||||
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
||||
<option
|
||||
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
|
||||
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
||||
</field>
|
||||
<field
|
||||
name="description"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
|
||||
name="groupby_columns"
|
||||
type="list"
|
||||
default="3"
|
||||
label="MOD_WEBLINKS_FIELD_COLUMNS_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_COLUMNS_DESC">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
value="1">1</option>
|
||||
<option
|
||||
value="2">2</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
value="3">3</option>
|
||||
<option
|
||||
value="4">4</option>
|
||||
<option
|
||||
value="6">6</option>
|
||||
</field>
|
||||
<field
|
||||
name="hits"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_HITS_DESC">
|
||||
name="count"
|
||||
type="text"
|
||||
default="5"
|
||||
label="MOD_WEBLINKS_FIELD_COUNT_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_COUNT_DESC" />
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
default="title"
|
||||
label="MOD_WEBLINKS_FIELD_ORDERING_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_ORDERING_DESC">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
value="title">JGLOBAL_TITLE</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
value="order">MOD_WEBLINKS_FIELD_VALUE_ORDER</option>
|
||||
<option
|
||||
value="hits">MOD_WEBLINKS_FIELD_VALUE_HITS</option>
|
||||
</field>
|
||||
<field
|
||||
name="direction"
|
||||
type="list"
|
||||
default="asc"
|
||||
label="MOD_WEBLINKS_FIELD_ORDERDIRECTION_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_ORDERDIRECTION_DESC">
|
||||
<option
|
||||
value="asc">MOD_WEBLINKS_FIELD_VALUE_ASCENDING</option>
|
||||
<option
|
||||
value="desc">MOD_WEBLINKS_FIELD_VALUE_DESCENDING</option>
|
||||
</field>
|
||||
<field
|
||||
name="target"
|
||||
type="list"
|
||||
default="3"
|
||||
label="MOD_WEBLINKS_FIELD_TARGET_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_TARGET_DESC">
|
||||
<option
|
||||
value="1">JBROWSERTARGET_NEW</option>
|
||||
<option
|
||||
value="2">JBROWSERTARGET_POPUP</option>
|
||||
<option
|
||||
value="3">JBROWSERTARGET_PARENT</option>
|
||||
</field>
|
||||
<field
|
||||
name="follow"
|
||||
type="list"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_FOLLOW_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_FOLLOW_DESC">
|
||||
<option
|
||||
value="follow">MOD_WEBLINKS_FIELD_VALUE_FOLLOW</option>
|
||||
<option
|
||||
value="nofollow">MOD_WEBLINKS_FIELD_VALUE_NOFOLLOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="description"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_DESCRIPTION_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_DESCRIPTION_DESC">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
<field
|
||||
name="hits"
|
||||
type="radio"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_HITS_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_HITS_DESC">
|
||||
<option
|
||||
value="1">JSHOW</option>
|
||||
<option
|
||||
value="0">JHIDE</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="count_clicks"
|
||||
type="list"
|
||||
class="chzn-color"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
|
||||
name="count_clicks"
|
||||
type="list"
|
||||
class="chzn-color"
|
||||
default="0"
|
||||
label="MOD_WEBLINKS_FIELD_COUNTCLICKS_LABEL"
|
||||
description="MOD_WEBLINKS_FIELD_COUNTCLICKS_DESC">
|
||||
<option
|
||||
value="">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="">JGLOBAL_USE_GLOBAL</option>
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
description="JFIELD_ALT_MODULE_LAYOUT_DESC" />
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
name="moduleclass_sfx"
|
||||
type="textarea" rows="3"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
name="cache"
|
||||
type="list"
|
||||
default="1"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHING_DESC">
|
||||
<option
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
<field
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
name="cache_time"
|
||||
type="text"
|
||||
default="900"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
description="COM_MODULES_FIELD_CACHE_TIME_DESC" />
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static">
|
||||
<option
|
||||
value="static"></option>
|
||||
value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
|
@ -9,47 +9,109 @@
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
||||
<?php
|
||||
foreach ($list as $item) :
|
||||
?>
|
||||
<li>
|
||||
<?php
|
||||
$link = $item->link;
|
||||
|
||||
switch ($params->get('target', 3))
|
||||
{
|
||||
case 1:
|
||||
// Open in a new window
|
||||
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
<?php if ($params->get('groupby', 0)) : ?>
|
||||
<?php $cats = array(); ?>
|
||||
<?php $cols = $params->get('groupby_columns', 3); ?>
|
||||
<?php foreach ($list as $l) : ?>
|
||||
<?php $cats[] = array('catid' => $l->catid, 'title' => $l->category_title); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php $cats = array_values(array_map('unserialize', array_unique(array_map('serialize', $cats)))); ?>
|
||||
<?php foreach ($cats as $k => $cat) : ?>
|
||||
<?php $items = array(); ?>
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<?php if ($item->catid == $cat['catid']) : ?>
|
||||
<?php $items[] = $item; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($cols > 1) : ?>
|
||||
<?php if ($k % $cols == 0) : ?>
|
||||
<div class="row row-fluid">
|
||||
<?php endif; ?>
|
||||
<div class="span<?php echo (12 / $cols); ?>">
|
||||
<?php endif; ?>
|
||||
<?php if ($params->get('groupby_showtitle', 1)) : ?>
|
||||
<h4><?php echo htmlspecialchars($cat['title'], ENT_COMPAT, 'UTF-8')); ?></h4>
|
||||
<?php endif; ?>
|
||||
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<li>
|
||||
<?php $link = $item->link; ?>
|
||||
<?php
|
||||
switch ($item->params->get('target', 3))
|
||||
{
|
||||
case 1:
|
||||
// Open in a new window
|
||||
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Open in a popup window
|
||||
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
case 2:
|
||||
// Open in a popup window
|
||||
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Open in parent window
|
||||
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Open in parent window
|
||||
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php if ($params->get('description', 0)) : ?>
|
||||
<?php echo nl2br($item->description); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
if ($params->get('description', 0))
|
||||
{
|
||||
echo nl2br($item->description);
|
||||
}
|
||||
<?php if ($params->get('hits', 0)) : ?>
|
||||
<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php if ($cols > 1) : ?>
|
||||
</div>
|
||||
<?php if(($k + 1) % $cols == 0 || $k == count($cats) - 1) : ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<ul class="weblinks<?php echo $moduleclass_sfx; ?>">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li>
|
||||
<?php $link = $item->link; ?>
|
||||
<?php
|
||||
switch ($item->params->get('target', 3))
|
||||
{
|
||||
case 1:
|
||||
// Open in a new window
|
||||
echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
|
||||
if ($params->get('hits', 0))
|
||||
{
|
||||
echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')';
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
case 2:
|
||||
// Open in a popup window
|
||||
echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Open in parent window
|
||||
echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
|
||||
htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($params->get('description', 0)) : ?>
|
||||
<?php echo nl2br($item->description); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('hits', 0)) : ?>
|
||||
<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<extension type="package" version="3.0" method="upgrade">
|
||||
<extension type="package" version="3.5" method="upgrade">
|
||||
<name>pkg_weblinks</name>
|
||||
<packagename>weblinks</packagename>
|
||||
<creationDate>December 2012</creationDate>
|
||||
@ -25,6 +25,6 @@
|
||||
</languages>
|
||||
<updateservers>
|
||||
<!-- Note: No spaces or linebreaks allowed between the server tags -->
|
||||
<server type="extension" name="Weblinks Update Site">https://raw.githubusercontent.com/joomla-extensions/weblinks/master/manifest.xml</server>
|
||||
<server type="extension" name="Web Links Update Site">https://raw.githubusercontent.com/joomla-extensions/weblinks/master/manifest.xml</server>
|
||||
</updateservers>
|
||||
</extension>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.1" type="plugin" group="finder" method="upgrade">
|
||||
<extension version="3.5" type="plugin" group="finder" method="upgrade">
|
||||
<name>plg_finder_weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>##DATE##</creationDate>
|
||||
|
@ -174,7 +174,7 @@ class PlgSearchWeblinks extends JPlugin
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id . ' END as catslug';
|
||||
|
||||
$query->select('a.title AS title, \'\' AS created, a.url, a.description AS text, ' . $case_when . "," . $case_when1)
|
||||
$query->select('a.title AS title, a.created AS created, a.url, a.description AS text, ' . $case_when . "," . $case_when1)
|
||||
->select($query->concatenate(array($db->quote($searchWeblinks), 'c.title'), " / ") . ' AS section')
|
||||
->select('\'1\' AS browsernav')
|
||||
->from('#__weblinks AS a')
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension version="3.1" type="plugin" group="search" method="upgrade">
|
||||
<extension version="3.5" type="plugin" group="search" method="upgrade">
|
||||
<name>plg_search_weblinks</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>##DATE##</creationDate>
|
||||
|
@ -44,4 +44,35 @@ class weblink extends \AcceptanceTester
|
||||
$I->clickToolbarButton('Save & Close');
|
||||
$I->waitForText('Web link successfully saved', '30', ['id' => 'system-message-container']);
|
||||
}
|
||||
|
||||
public function administratorDeleteWeblink($title)
|
||||
{
|
||||
$I = $this;
|
||||
|
||||
$I->amGoingTo('Navigate to Weblinks page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->expectTo('see weblinks page');
|
||||
|
||||
$I->amGoingTo('Search for the weblink');
|
||||
$I->searchForItem($title);
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
|
||||
$I->amGoingTo('Trash the weblink');
|
||||
$I->checkAllResults();
|
||||
$I->clickToolbarButton('Trash');
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->waitForText('1 web link successfully trashed', 30, ['id' => 'system-message-container']);
|
||||
|
||||
$I->amGoingTo('Delete the weblink');
|
||||
$I->selectOptionInChosen('- Select Status -', 'Trashed');
|
||||
$I->amGoingTo('Search the just saved weblink');
|
||||
$I->searchForItem($title);
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->checkAllResults();
|
||||
$I->click(['xpath'=> '//div[@id="toolbar-delete"]/button']);
|
||||
$I->acceptPopup();
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->waitForText('1 web link successfully deleted.', 30, ['id' => 'system-message-container']);
|
||||
}
|
||||
}
|
@ -32,12 +32,12 @@ class AdministratorCategoriesCest
|
||||
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->expectTo('see categories page');
|
||||
|
||||
$I->amGoingTo('try to save a category with empty title and it should fail');
|
||||
$I->clickToolbarButton('new');
|
||||
$I->waitForText('Weblinks: New Category', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: New Category', '60', ['css' => 'h1']);
|
||||
$I->clickToolbarButton('save');
|
||||
$I->expectTo('see an error when trying to save a category without title');
|
||||
$I->see('Invalid field: Title', ['id' => 'system-message-container']);
|
||||
@ -52,13 +52,13 @@ class AdministratorCategoriesCest
|
||||
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/ and create a Category');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->expectTo('see categories page');
|
||||
$I->checkForPhpNoticesOrWarnings();
|
||||
|
||||
$I->amGoingTo('try to save a category with a filled title');
|
||||
$I->clickToolbarButton('New');
|
||||
$I->waitForText('Weblinks: New Category', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: New Category', '60', ['css' => 'h1']);
|
||||
$I->fillField(['id' => 'jform_title'], $this->categoryTitle);
|
||||
$I->clickToolbarButton('Save & Close');
|
||||
$I->expectTo('see a success message after saving the category');
|
||||
@ -78,9 +78,9 @@ class AdministratorCategoriesCest
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->searchForItem($this->categoryTitle);
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->checkAllResults();
|
||||
$I->amGoingTo('try to publish a Weblinks Category');
|
||||
$I->amGoingTo('try to publish a Web Links Category');
|
||||
$I->clickToolbarButton('publish');
|
||||
$I->waitForElement(['id' => 'system-message-container'], '60');
|
||||
$I->expectTo('see a success message after publishing the category');
|
||||
@ -98,10 +98,10 @@ class AdministratorCategoriesCest
|
||||
$I->doAdministratorLogin();
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->searchForItem($this->categoryTitle);
|
||||
$I->checkAllResults();
|
||||
$I->amGoingTo('try to unpublish a Weblinks Category');
|
||||
$I->amGoingTo('try to unpublish a Web Links Category');
|
||||
$I->clickToolbarButton('unpublish');
|
||||
$I->waitForElement(['id' => 'system-message-container'], '60');
|
||||
$I->expectTo('See a success message after unpublishing the category');
|
||||
@ -119,10 +119,10 @@ class AdministratorCategoriesCest
|
||||
$I->doAdministratorLogin();
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->searchForItem($this->categoryTitle);
|
||||
$I->checkAllResults();
|
||||
$I->amGoingTo('try to archive a weblink category');
|
||||
$I->amGoingTo('try to archive a Web Links category');
|
||||
$I->clickToolbarButton('archive');
|
||||
$I->waitForElement(['id' => 'system-message-container'], '60');
|
||||
$I->expectTo('see a success message after Archiving the category');
|
||||
@ -140,11 +140,11 @@ class AdministratorCategoriesCest
|
||||
$I->doAdministratorLogin();
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->setFilter('Select Status', 'Archived');
|
||||
$I->searchForItem($this->categoryTitle);
|
||||
$I->checkAllResults();
|
||||
$I->amGoingTo('try to delete a Weblinks Category');
|
||||
$I->amGoingTo('try to delete a Web Links Category');
|
||||
$I->clickToolbarButton('Trash');
|
||||
$I->waitForElement(['id' => 'system-message-container'], '60');
|
||||
$I->expectTo('see a success message after Trashing the category');
|
||||
@ -162,11 +162,11 @@ class AdministratorCategoriesCest
|
||||
$I->doAdministratorLogin();
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->waitForText('Weblinks: Categories', '60', ['css' => 'h1']);
|
||||
$I->waitForText('Web Links: Categories', '60', ['css' => 'h1']);
|
||||
$I->setFilter('Select Status', 'Trashed');
|
||||
$I->searchForItem($this->categoryTitle);
|
||||
$I->checkAllResults();
|
||||
$I->amGoingTo('try to delete a Weblinks Category');
|
||||
$I->amGoingTo('try to delete a Web Links Category');
|
||||
$I->clickToolbarButton('Empty trash');
|
||||
$I->acceptPopup();
|
||||
$I->waitForElement(['id' => 'system-message-container'], '60');
|
||||
@ -184,7 +184,7 @@ class AdministratorCategoriesCest
|
||||
$I->amGoingTo('Navigate to Categories page in /administrator/ and verify the Tabs');
|
||||
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
|
||||
$I->clickToolbarButton('New');
|
||||
$I->waitForText('Weblinks: New Category', '30', ['css' => 'h1']);
|
||||
$I->verifyAvailableTabs(['Category', 'Publishing', 'Permissions', 'Options']);
|
||||
$I->waitForText('Web Links: New Category', '30', ['css' => 'h1']);
|
||||
$I->verifyAvailableTabs(['Category', 'Options', 'Publishing', 'Permissions']);
|
||||
}
|
||||
}
|
||||
|
179
tests/acceptance/administrator/AdministratorSmartSearchCest.php
Normal file
179
tests/acceptance/administrator/AdministratorSmartSearchCest.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_finder
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
class AdministratorSmartSearchCest
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->faker = Faker\Factory::create();
|
||||
$this->title = $this->faker->bothify('SmartSearch ?##?');
|
||||
$this->url = $this->faker->url;
|
||||
$this->articletext = 'This is a test';
|
||||
}
|
||||
|
||||
/**
|
||||
* Before the tests proper, switch the WYSIWYG editor off. This is to make it easier to create test content.
|
||||
*/
|
||||
public function administratorDisableEditor(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Disable the editor before the tests proper');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to the Global Configuration page in /administrator/ and disable the WYSIWYG Editor');
|
||||
$I->amOnPage('administrator/index.php?option=com_config');
|
||||
$I->waitForText('Global Configuration', 30, ['class' => 'page-title']);
|
||||
$I->selectOptionInChosen('Default Editor', 'Editor - None');
|
||||
$I->clickToolbarButton('Save & Close');
|
||||
$I->waitForText('Control Panel', 30, ['class'=> 'page-title']);
|
||||
$I->expectTo('see a success message after saving the configuration');
|
||||
$I->see('Configuration successfully saved', ['id' => 'system-message-container']);
|
||||
}
|
||||
|
||||
public function administratorEnableContentPlugin(\Step\Acceptance\weblink $I)
|
||||
{
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Enabling the Smart Search content plugin. Note that this is not a requirement for Smart Search to index Weblinks');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to the Smart Search page in /administrator/');
|
||||
$I->amOnPage('administrator/index.php?option=com_finder');
|
||||
$I->expectTo('see a message saying that the content plugin should be enabled');
|
||||
$I->waitForElement(['link' => 'Smart Search Content Plugin']);
|
||||
$I->click(['link' => 'Smart Search Content Plugin']);
|
||||
$I->waitForText('Plugins: Content - Smart Search', 30, ['class'=> 'page-title']);
|
||||
$I->selectOptionInChosen('Status', 'Enabled');
|
||||
$I->clickToolbarButton('save & close');
|
||||
$I->waitForText('Plugin successfully saved.', 30, ['id' => 'system-message-container']);
|
||||
$I->see('Plugin successfully saved.', ['id' => 'system-message-container']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before the tests proper, the Weblinks Smart Search plugin must be enabled.
|
||||
*/
|
||||
public function administratorEnableSmartsearchWeblinksPlugin(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Enabling the Smart Search Weblinks plugin');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amOnPage('administrator/index.php?option=com_plugins');
|
||||
$I->searchForItem('Smart Search - Web Links');
|
||||
$I->click(['link' => 'Smart Search - Web Links']);
|
||||
$I->waitForText('Plugins: Smart Search - Web Links', 30, ['class'=> 'page-title']);
|
||||
$I->selectOptionInChosen('Status', 'Enabled');
|
||||
$I->clickToolbarButton('save & close');
|
||||
$I->waitForText('Plugin successfully saved.', 30, ['id' => 'system-message-container']);
|
||||
$I->see('Plugin successfully saved.', ['id' => 'system-message-container']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge the index.
|
||||
*/
|
||||
public function administratorPurgeIndex(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Purging the index');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to the Smart Search page in /administrator/ and purge the index');
|
||||
$I->amOnPage('administrator/index.php?option=com_finder');
|
||||
$I->waitForText('Smart Search', 30, ['class'=> 'page-title']);
|
||||
|
||||
$I->click('Clear Index');
|
||||
$I->acceptPopup();
|
||||
$I->waitForText('All items have been successfully deleted', 30, ['class' => 'alert-message']);
|
||||
$I->see('All items have been successfully deleted', ['class' => 'alert-message']);
|
||||
}
|
||||
|
||||
public function administratorCreateWeblink(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->createWeblink($this->title, $this->url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index the current content.
|
||||
*/
|
||||
public function administratorRunTheIndexer(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Smart Search Indexer');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to Smart Search page in /administrator/ and index the content');
|
||||
$I->amOnPage('administrator/index.php?option=com_finder');
|
||||
$I->waitForText('Smart Search: Indexed Content', 30, ['class'=> 'page-title']);
|
||||
$I->click(['xpath' => "//div[@id='toolbar']//button[contains(text()[normalize-space()], 'Index')]"]);
|
||||
$I->comment('I wait while smart search indexes the links');
|
||||
$I->wait(2);
|
||||
$I->waitForText($this->title, 30, '#j-main-container');
|
||||
}
|
||||
|
||||
/**
|
||||
* After the tests, the Smart Search content plugin must be disabled, ready for the next test.
|
||||
*/
|
||||
public function administratorDisableContentPlugin(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Disabling the Smart Search content plugin, ready for the next test run');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to Plugins page in /administrator/ and disable the Smart Search Content plugin');
|
||||
$I->amOnPage('administrator/index.php?option=com_plugins&view=plugins');
|
||||
$I->searchForItem('Content - Smart Search');
|
||||
$I->waitForText('Plugins', 30, ['class'=> 'page-title']);
|
||||
$I->waitForElement(['link' => 'Content - Smart Search']);
|
||||
$I->checkOption(['id' => 'cb0']);
|
||||
$I->clickToolbarButton('Unpublish'); // Note: The button is called "Disable", but we need to call it "Unpublish" here.
|
||||
$I->waitForText('Plugin successfully disabled', 30, ['class' => 'alert-message']);
|
||||
}
|
||||
|
||||
/**
|
||||
* After the tests, the Smart Search content plugin must be disabled, ready for the next test.
|
||||
*/
|
||||
public function administratorDisableSmartsearchWeblinksPlugin(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Disabling the Smart Search content plugin, ready for the next test run');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->amGoingTo('Navigate to Plugins page in /administrator/ and disable the Smart Search Content plugin');
|
||||
$I->amOnPage('administrator/index.php?option=com_plugins&view=plugins');
|
||||
$I->searchForItem('Smart Search - Web Links');
|
||||
$I->waitForText('Plugins', 30, ['class'=> 'page-title']);
|
||||
$I->waitForElement(['link' => 'Smart Search - Web Links']);
|
||||
$I->checkOption(['id' => 'cb0']);
|
||||
$I->clickToolbarButton('Unpublish'); // Note: The button is called "Disable", but we need to call it "Unpublish" here.
|
||||
$I->waitForText('Plugin successfully disabled', 30, ['class' => 'alert-message']);
|
||||
}
|
||||
|
||||
public function cleanUp(\Step\Acceptance\weblink $I, $scenario)
|
||||
{
|
||||
$scenario->skip('Temporarilly skipped, see: https://github.com/joomla-extensions/weblinks/issues/239');
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->administratorDeleteWeblink($this->title);
|
||||
}
|
||||
}
|
@ -99,7 +99,9 @@ class AdministratorWeblinksCest
|
||||
$I->amOnPage('administrator/index.php?option=com_weblinks');
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
$I->expectTo('see weblinks page');
|
||||
$I->selectOptionInChosen('- Select Status -', 'Trashed');
|
||||
$I->click('Search Tools');
|
||||
$I->wait(2);
|
||||
$I->selectOptionInChosenById('filter_published', 'Trashed');
|
||||
$I->amGoingTo('Search the just saved weblink');
|
||||
$I->searchForItem($this->title);
|
||||
$I->waitForText('Web Links','30',['css' => 'h1']);
|
||||
|
@ -28,26 +28,26 @@ class FrontendWeblinksCest
|
||||
public function createWeblinkAndConfirmFrontend(\Step\Acceptance\weblink $I)
|
||||
{
|
||||
$I->am('Administrator');
|
||||
$I->wantToTest('Listing a category of Weblinks in frontend');
|
||||
$I->wantToTest('Listing a category of Web Links in frontend');
|
||||
|
||||
$I->doAdministratorLogin();
|
||||
|
||||
$I->createWeblink($this->title, $this->url, "No");
|
||||
|
||||
// Menu link
|
||||
$I->createMenuItem($this->menuItem, 'Weblinks', 'List All Web Link Categories', 'Main Menu');
|
||||
$I->createMenuItem($this->menuItem, 'Web Links', 'List All Web Link Categories', 'Main Menu');
|
||||
|
||||
// Go to the frontend
|
||||
$I->comment('I want to check if the menu entry exists in the frontend');
|
||||
$I->amOnPage('index.php?option=com_weblinks');
|
||||
$I->expectTo('see weblink categories');
|
||||
$I->expectTo('see web link categories');
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
||||
$I->checkForPhpNoticesOrWarnings();
|
||||
$I->comment('I open the uncategorised Weblink Category');
|
||||
$I->comment('I open the uncategorised Web link Category');
|
||||
$I->click(['link' => 'Uncategorised']);
|
||||
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
||||
$I->expectTo('see the weblink we created');
|
||||
$I->expectTo('see the web link we created');
|
||||
$I->seeElement(['link' => $this->title]);
|
||||
$I->seeElement(['xpath' => "//a[@href='$this->url']"]);
|
||||
}
|
||||
@ -66,16 +66,16 @@ class FrontendWeblinksCest
|
||||
|
||||
// Go to the frontend
|
||||
$I->amOnPage('index.php?option=com_weblinks');
|
||||
$I->expectTo('see weblink categories');
|
||||
$I->expectTo('see web link categories');
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
||||
$I->checkForPhpNoticesOrWarnings();
|
||||
$I->comment('I open the uncategorised Weblink Category');
|
||||
$I->comment('I open the uncategorised Web Link Category');
|
||||
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
||||
$I->click(['link' => 'Uncategorised']);
|
||||
|
||||
// Check that hits is 0
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
||||
$I->expectTo('see the weblink we created');
|
||||
$I->expectTo('see the web link we created');
|
||||
$I->seeElement(['link' => $title]);
|
||||
$I->expectTo('see that hits is 0');
|
||||
$I->see('Hits: 0', ['class' => 'list-hits']);
|
||||
@ -86,7 +86,7 @@ class FrontendWeblinksCest
|
||||
$I->amOnPage('index.php?option=com_weblinks');
|
||||
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
||||
$I->click(['link' => 'Uncategorised']);
|
||||
$I->comment('I search the weblink: ' . $title);
|
||||
$I->comment('I search the web link: ' . $title);
|
||||
$I->waitForElement(['id' => 'filter-search'], 60);
|
||||
$I->fillField(['id' => 'filter-search'], $title);
|
||||
$I->pressKey(['id' => 'filter-search'], \Facebook\WebDriver\WebDriverKeys::ENTER);
|
||||
@ -111,15 +111,15 @@ class FrontendWeblinksCest
|
||||
|
||||
// Go to the frontend
|
||||
$I->amOnPage('index.php?option=com_weblinks');
|
||||
$I->expectTo('see weblink categories');
|
||||
$I->expectTo('see web link categories');
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h3']);
|
||||
$I->checkForPhpNoticesOrWarnings();
|
||||
$I->comment('I open the uncategorised Weblink Category');
|
||||
$I->comment('I open the uncategorised Web Link Category');
|
||||
$I->click(['link' => 'Uncategorised']);
|
||||
|
||||
// Check that hits is 0
|
||||
$I->waitForText('Uncategorised','30', ['css' => 'h2']);
|
||||
$I->expectTo('see the weblink we created');
|
||||
$I->expectTo('see the web link we created');
|
||||
$I->seeElement(['link' => $title]);
|
||||
$I->expectTo('see that hits is 0');
|
||||
$I->see('Hits: 0', ['class' => 'list-hits']);
|
||||
@ -127,10 +127,10 @@ class FrontendWeblinksCest
|
||||
// Click on the link, go back, and check that hits is 1
|
||||
$I->click(['link' => $title]);
|
||||
$I->amOnPage('index.php?option=com_weblinks');
|
||||
$I->comment('I open the uncategorised Weblink Category');
|
||||
$I->comment('I open the uncategorised Web Link Category');
|
||||
$I->waitForElement(['link' => 'Uncategorised'], 60);
|
||||
$I->click(['link' => 'Uncategorised']);
|
||||
$I->comment('I search the weblink: ' . $title);
|
||||
$I->comment('I search the web link: ' . $title);
|
||||
$I->waitForElement(['id' => 'filter-search'], 60);
|
||||
$I->fillField(['id' => 'filter-search'], $title);
|
||||
$I->pressKey(['id' => 'filter-search'], \Facebook\WebDriver\WebDriverKeys::ENTER);
|
||||
|
@ -16,11 +16,11 @@
|
||||
|
||||
# Wire up Apache to use Travis CI's php-fpm.
|
||||
<IfModule mod_fastcgi.c>
|
||||
AddHandler php5-fcgi .php
|
||||
Action php5-fcgi /php5-fcgi
|
||||
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
|
||||
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /tmp/php5-fpm.sock -pass-header Authorization
|
||||
AddHandler php%PHPVERSION%-fcgi .php
|
||||
Action php%PHPVERSION%-fcgi /php%PHPVERSION%-fcgi
|
||||
Alias /php%PHPVERSION%-fcgi /usr/lib/cgi-bin/php%PHPVERSION%-fcgi
|
||||
FastCgiExternalServer /usr/lib/cgi-bin/php%PHPVERSION%-fcgi -socket /tmp/php%PHPVERSION%-fpm.sock -pass-header Authorization
|
||||
</IfModule>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
</VirtualHost>
|
||||
</VirtualHost>
|
||||
|
19
tests/travis-php-fpm.sh
Normal file
19
tests/travis-php-fpm.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
owner="$1"
|
||||
phpversionname="$2"
|
||||
|
||||
file="/home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.conf"
|
||||
|
||||
cp /home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.conf.default /home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.conf
|
||||
if [ -f /home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.d/www.conf.default ]; then
|
||||
cp /home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.d/www.conf.default /home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.d/www.conf
|
||||
file=/home/$owner/.phpenv/versions/$phpversionname/etc/php-fpm.d/www.conf
|
||||
fi;
|
||||
|
||||
sed -e "s,listen = 127.0.0.1:9000,listen = /tmp/php${phpversionname:0:1}-fpm.sock,g" --in-place $file
|
||||
sed -e "s,;listen.owner = nobody,listen.owner = $owner,g" --in-place $file
|
||||
sed -e "s,;listen.group = nobody,listen.group = $owner,g" --in-place $file
|
||||
sed -e "s,;listen.mode = 0660,listen.mode = 0666,g" --in-place $file
|
||||
sed -e "s,user = nobody,;user = $owner,g" --in-place $file
|
||||
sed -e "s,group = nobody,;group = $owner,g" --in-place $file
|
Loading…
x
Reference in New Issue
Block a user