Merge branch 'master' into patch-1

This commit is contained in:
Tuan Pham Ngoc 2022-09-03 20:30:53 +07:00 committed by GitHub
commit e811a10547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 3957 additions and 1013 deletions

View File

@ -1,20 +1,51 @@
cache:
mount:
- vendor
- .git
build:
image: yveshoppe/joomla-systemtests:latest
commands:
- chmod a+x .drone/build.sh
- ./.drone/build.sh
- apache2ctl start
- service mysql start
- cd /tests/www
- export DISPLAY=:0
- Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 &
- sleep 3
- fluxbox > /dev/null 2>&1 &
- vendor/bin/robo run:tests
clone:
depth: 1
path: repo
---
kind: pipeline
name: default
steps:
- name: weblinks-codeception-tests
image: joomlaprojects/docker-systemtests:latest
commands:
- composer install
- chmod a+x .drone/build.sh
- ./.drone/build.sh
- apache2ctl start
- service mysql start
- cd /tests/www
- export DISPLAY=:0
- Xvfb -screen 0 1024x768x24 -ac +extension GLX +render -noreset > /dev/null 2>&1 &
- sleep 3
- fluxbox > /dev/null 2>&1 &
- vendor/bin/robo run:tests
- name: artifacts-system-tests
image: cschlosser/drone-ftps
depends_on: [ weblinks-codeception-tests ]
environment:
FTP_USERNAME:
from_secret: ftpusername
FTP_PASSWORD:
from_secret: ftppassword
PLUGIN_HOSTNAME: ci.joomla.org:21
PLUGIN_SRC_DIR: /tests/_output/
PLUGIN_DEST_DIR: /artifacts
PLUGIN_SECURE: false
PLUGIN_EXCLUDE: ^\.git/$
commands:
- export PLUGIN_DEST_DIR=$PLUGIN_DEST_DIR/$DRONE_REPO/$DRONE_BRANCH/$DRONE_PULL_REQUEST_$DRONE_BUILD_NUMBER/system-tests
- echo https://ci.joomla.org:444$PLUGIN_DEST_DIR
- /bin/upload.sh
when:
status:
- failure
volumes:
- name: weblinks_cache
host:
path: /tmp/weblinks_cache
---
kind: signature
hmac: 9346f0e74d2605ebe7bc9d33ad0588c1073ba3a9d9b254b71a7a85e219089449
...

View File

@ -1,5 +1,7 @@
sudo: true
language: php
services:
- xvfb
env:
global:
@ -8,29 +10,15 @@ env:
matrix:
fast_finish: true
include:
- php: 5.5
- php: 5.6
env: RUN_PHPCS="yes"
- php: 7.0
sudo: true
addons:
firefox: "47.0.1"
firefox: 'latest-esr'
- php: 7.1
- php: hhvm
sudo: true
dist: trusty
group: edge # Until the next stable image update sometime after 2016-12-01
addons:
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- mysql
- postgresql
allow_failures:
- php: hhvm
- php: 7.2
- php: 7.3
before_script:
# Forcing localhost in hosts file
@ -48,10 +36,6 @@ before_script:
- 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
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
# Fluxbox
- sudo apt-get install fluxbox -y --force-yes
- fluxbox &

32
CHANGELOG.md Normal file
View File

@ -0,0 +1,32 @@
# Changelog
#### 3.7.0
* Use correct database *2019-08-10*
* Move to namespaces *2019-08-10*
* First imageignores image float setting366 *2019-08-10*
* Changed language strings so that the parameter "image float" in the config is more concrete *2019-08-10*
* Improved the Batch view of com_weblinks *2019-08-10*
* add Jorobo Map Task To RoboFile *2019-08-10*
* makeSameAliasPossibleForDifferentLanguages *2019-08-10*
* mapping of new media files was not correct because of this you see the warning "JInstaller: :Install: File does not exist /var/www/html/weblinksecht/weblinks/tests/joomla/tmp/media/js" while installing *2019-08-10*
* Delete jed_update.xml *2019-08-10*
* xml code-style *2019-08-10*
* typo *2019-08-10*
* Serve updates through the downloads site *2019-08-10*
* Implementing full associations for single weblink *2019-08-10*
* Update composer *2019-08-10*
* Use correct database *2019-08-10*
* Move to namespaces *2019-08-10*
* First imageignores image float setting366 *2019-08-10*
* Changed language strings so that the parameter "image float" in the config is more concrete *2019-08-10*
* Improved the Batch view of com_weblinks *2019-08-10*
* add Jorobo Map Task To RoboFile *2019-08-10*
* makeSameAliasPossibleForDifferentLanguages *2019-08-10*
* mapping of new media files was not correct because of this you see the warning "JInstaller: :Install: File does not exist /var/www/html/weblinksecht/weblinks/tests/joomla/tmp/media/js" while installing *2019-08-10*
* Delete jed_update.xml *2019-08-10*
* xml code-style *2019-08-10*
* typo *2019-08-10*
* Serve updates through the downloads site *2019-08-10*
* Implementing full associations for single weblink *2019-08-10*
* Update composer *2019-08-10*

View File

@ -1,10 +1,12 @@
# Weblinks for Joomla! Travis:
# Weblinks for Joomla!
Travis: [![Travis Build Status](https://travis-ci.org/joomla-extensions/weblinks.svg?branch=master)](https://travis-ci.org/joomla-extensions/weblinks)
Build Status
---------------------
| Drone-CI |
| ------------- |
| [![Build Status](https://ci.joomla.org/api/badges/joomla-extensions/weblinks/status.svg)](https://ci.joomla.org/joomla-extensions/weblinks) |
Drone: [![Drone Build Status](http://213.160.72.75/api/badges/joomla-extensions/weblinks/status.svg)](http://213.160.72.75/joomla-extensions/weblinks)
This repo is meant to hold the decoupled com_weblinks component and related code.
Weblinks for Joomla! provides a component and accompanying extensions to create a directory of weblinks.
# How to test a PR
@ -221,7 +223,7 @@ skipClone = false
cmsPath = tests/joomla-cms3
; If you want to clone a different branch, you can set it here
branch = staging
branch = 3.10-dev
; (Linux / Mac only) If you want to set a different owner for the CMS root folder, you can set it here.
localUser =
@ -258,13 +260,13 @@ The tests in Weblinks Extension use Codeception Testing Framework, if you want t
This is not required, and if in doubt you can just skip this section, but there may be some specific use cases when you need (or want) to override the default behaviour of RoboFile.php. To do this, copy `RoboFile.dist.ini` to `RoboFile.ini` and add options in INI format, one per line, e.g.
skipClone = true
cmsPath = tests/joomla-cms3
cmsPath = tests/joomla
The currently available options are as follows:
* `skipClone`: set to `true` to avoid the cms repo being deleted and re-cloned at each test execution. Useful to save time and bandwidth while you're debugging your test environment. But please be aware that if you don't refresh the repo you'll have to manually check the `installation` folder is present and the `configuration.php` is not.
* `cmsPath`: set to the local path (absolute or relative) where you'd like the test website to be installed. Default is `tests/joomla-cms3`.
* `branch`: set to whatever existing branch from the `joomla-cms` project if you want to clone that specific branch. Default is `staging`.
* `branch`: set to whatever existing branch from the `joomla-cms` project if you want to clone that specific branch. Default is `3.10-dev`.
## Additional options

View File

@ -7,7 +7,7 @@ skipClone = false
cmsPath = tests/joomla
; If you want to clone a different branch, you can set it here
branch = staging
branch = 3.10-dev
; (Linux / Mac only) If you want to set a different owner for the CMS root folder, you can set it here.
localUser = www-data

View File

@ -12,6 +12,10 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\Jorobo\Tasks\loadTasks as loadReleaseTasks;
use Joomla\Testing\Robo\Tasks\loadTasks as loadTestingTasks;
use Robo\Tasks;
require_once 'vendor/autoload.php';
if (!defined('JPATH_BASE'))
@ -26,11 +30,11 @@ if (!defined('JPATH_BASE'))
*
* @since 1.0
*/
class RoboFile extends \Robo\Tasks
class RoboFile extends Tasks
{
// Load tasks from composer, see composer.json
use \joomla_projects\robo\loadTasks;
use \Joomla\Jorobo\Tasks\loadTasks;
use loadTestingTasks;
use loadReleaseTasks;
/**
* File extension for executables
@ -77,22 +81,13 @@ class RoboFile extends \Robo\Tasks
/**
* Get the executable extension according to Operating System
*
* @return void
* @return string
*/
private function getExecutableExtension()
{
if ($this->isWindows())
{
// 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 '.exe';
}
return '';
@ -102,10 +97,11 @@ class RoboFile extends \Robo\Tasks
* Executes all the Selenium System Tests in a suite on your machine
*
* @param array $opts Array of configuration options:
* - 'use-htaccess': renames and enable embedded Joomla .htaccess file
* - 'env': set a specific environment to get configuration from
* - 'use-htaccess': renames and enable embedded Joomla .htaccess file
* - 'env': set a specific environment to get configuration from
*
* @return mixed
* @throws \Codeception\Exception\ConfigurationException
*/
public function runTests($opts = ['use-htaccess' => false, 'env' => 'desktop'])
{
@ -166,6 +162,8 @@ class RoboFile extends \Robo\Tasks
* @param string $suite Optional name of the suite containing the tests, Acceptance by default.
*
* @return mixed
* @throws ReflectionException
* @throws \Codeception\Exception\ConfigurationException
*/
public function runTest($pathToTestFile = null, $suite = 'acceptance')
{
@ -205,8 +203,8 @@ class RoboFile extends \Robo\Tasks
}
$this->say('');
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
$test = $tests[$testNumber];
$testNumber = $this->ask('Type the number of the test in the list that you want to run...');
$test = $tests[$testNumber];
}
$pathToTestFile = 'tests/' . $suite . '/' . $test;
@ -215,7 +213,7 @@ class RoboFile extends \Robo\Tasks
require 'tests/' . $suite . '/' . $test;
// Logic to fetch the class name from the file name
$fileName = explode("/", $test);
$fileName = explode("/", $test);
$className = explode(".", $fileName[1]);
// If the selected file is cest only than we will give the option to execute individual methods, we don't need this in cept file
@ -245,7 +243,7 @@ class RoboFile extends \Robo\Tasks
$this->say('');
$methodNumber = $this->ask('Please choose the method in the test that you would want to run...');
$method = $methods[$methodNumber];
$method = $methods[$methodNumber];
}
if (isset($method) && $method != 'All')
@ -400,7 +398,7 @@ class RoboFile extends \Robo\Tasks
*/
private function buildGitCloneCommand()
{
$branch = empty($this->configuration->branch) ? 'staging' : $this->configuration->branch;
$branch = empty($this->configuration->branch) ? '3.10-dev' : $this->configuration->branch;
return "git" . $this->executableExtension . " clone -b $branch --single-branch --depth 1 https://github.com/joomla/joomla-cms.git tests/cache";
}
@ -441,26 +439,23 @@ class RoboFile extends \Robo\Tasks
* Runs Selenium Standalone Server.
*
* @return void
* @throws \Codeception\Exception\ConfigurationException
*/
public function runSelenium()
{
if (!$this->isWindows())
{
$this->_exec("vendor/bin/selenium-server-standalone " . $this->getWebDriver() . ' >> selenium.log 2>&1 &');
}
else
{
$this->_exec('START java.exe -jar' . $this->getWebDriver() .
' vendor\joomla-projects\selenium-server-standalone\bin\selenium-server-standalone.jar ');
}
if ($this->isWindows())
{
// TODO: Move this logic to the selenium standalone server task in the parent joomla repo
$this->_exec('START java.exe -jar ' . $this->getWebDriver() .
' .\\vendor\\joomla-projects\\selenium-server-standalone\\bin\\selenium-server-standalone.jar ');
sleep(3);
}
else
{
$this->taskWaitForSeleniumStandaloneServer()
$this->taskSeleniumStandaloneServer()
->setWebdriver($this->getWebdriver())
->runSelenium()
->waitForSelenium()
->run()
->stopOnFail();
}
@ -498,7 +493,12 @@ class RoboFile extends \Robo\Tasks
public function killSelenium($host = 'localhost', $port = '4444')
{
$this->say('Trying to kill the selenium server.');
$this->_exec("curl http://$host:$port/selenium-server/driver/?cmd=shutDownSeleniumServer");
$this->taskSeleniumStandaloneServer()
->setUrl("http://$host:$port")
->killSelenium()
->run()
->stopOnFail();
}
/**
@ -589,6 +589,7 @@ class RoboFile extends \Robo\Tasks
* @return string the webdriver string to use with selenium
*
* @since version
* @throws \Codeception\Exception\ConfigurationException
*/
public function getWebdriver()
{
@ -627,8 +628,8 @@ class RoboFile extends \Robo\Tasks
else
{
$this->yell(
print_r($codeceptMainConfig) .
'No driver for your browser. Check your browser in acceptance.suite.yml and the webDrivers in codeception.yml');
print_r($codeceptMainConfig) .
'No driver for your browser. Check your browser in acceptance.suite.yml and the webDrivers in codeception.yml');
// We can't do anything without a driver, exit
exit(1);
@ -699,9 +700,9 @@ class RoboFile extends \Robo\Tasks
*
* @param String $target The target joomla instance
*
* @return void
* @since __DEPLOY_VERSION__
*
* @return void
*/
public function map($target)
{

View File

@ -10,16 +10,14 @@ settings:
memory_limit: 1024M
webdrivers:
firefox:
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\gecko\geckodriver64.exe
mac: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/gecko/geckodriver_mac
linux: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/gecko/geckodriver_linux_64
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\gecko\windows\geckodriver64.exe
mac: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/gecko/mac/geckodriver
linux: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/gecko/linux/geckodriver
chrome:
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\chrome\chromedriver.exe
mac: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/chrome/chromedriver_mac
linux: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/chrome/chromedriver_linux_64
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\chrome\windows\chromedriver.exe
mac: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/chrome/mac/chromedriver
linux: vendor/joomla-projects/selenium-server-standalone/bin/webdrivers/chrome/linux/chromedriver
internet explorer:
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\internet-explorer32\IEDriverServer.exe
MicrosoftEdge:
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\edge\MicrosoftWebDriver.exe
MicrosoftEdgeInsiders:
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\edge-insiders\MicrosoftWebDriver.exe
windows: vendor\joomla-projects\selenium-server-standalone\bin\webdrivers\edge\msedgedriver64.exe

View File

@ -1,23 +1,25 @@
{
"name" : "joomla-extensions/weblinks",
"description": "The Open Source PHP Framework for creating complex Joomla extensions",
"license" : "GPL-2.0+",
"license" : "GPL-2.0-or-later",
"config": {
"platform": {
"php": "5.5.33"
"php": "5.6.0"
}
},
"require" : {
"php": ">=5.3.10"
"php": "^5.3.10|^7.0"
},
"require-dev": {
"codeception/codeception": "^2.2",
"joomla-projects/joomla-browser": "v3.6.5.1",
"php": ">=5.6",
"codeception/codeception": "^3",
"phpunit/phpunit": "^5.7.27",
"joomla-projects/joomla-browser": "^3.9",
"consolidation/robo": "^1.0.0",
"joomla-projects/robo": "~0",
"joomla-projects/selenium-server-standalone": "v3.1.0",
"joomla-projects/joomla-testing-robo": "~1.0",
"joomla-projects/selenium-server-standalone": "^3.14",
"fzaninotto/faker": "^1.6",
"joomla-projects/jorobo": "~0.6",
"Behat/Gherkin": "^4.4.1"
"joomla-projects/jorobo": "~0.7",
"behat/gherkin": "^4.4.1"
}
}

4185
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
extension = weblinks
version = 3.7.0
version = 3.9.0
source = src
target = package
@ -32,7 +32,7 @@ text = "
* @package Joomla.Administrator
* @subpackage Weblinks
*
* @copyright Copyright (C) 2005 - ##YEAR## Open Source Matters, Inc. All rights reserved.
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
"

View File

@ -5,12 +5,40 @@
<description>Joomla! CMS Weblinks Package</description>
<element>pkg_weblinks</element>
<type>package</type>
<version>3.6.0</version>
<version>3.7.0</version>
<client>site</client>
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks/releases/tag/3.6.0</infourl>
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks/releases/tag/3.7.0</infourl>
<downloads>
<downloadurl type="full" format="zip">https://downloads.joomla.org/extensions/weblinks/3-6-0/pkg-weblinks-3.6.0.zip</downloadurl>
<downloadurl type="full" format="zip">https://downloads.joomla.org/extensions/weblinks/3-7-0/pkg-weblinks-3.7.0.zip</downloadurl>
</downloads>
<targetplatform name="joomla" version="3.[6789]" />
<targetplatform name="joomla" version="3.[678]" />
</update>
<update>
<name>Weblinks Extension Package</name>
<description>Joomla! CMS Weblinks Package</description>
<element>pkg_weblinks</element>
<type>package</type>
<version>3.9.0</version>
<client>site</client>
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks/releases/tag/3.9.0</infourl>
<downloads>
<downloadurl type="full" format="zip">https://downloads.joomla.org/extensions/weblinks/3-9-0/pkg-weblinks-3.9.0.zip</downloadurl>
</downloads>
<sha512>99baa8a622da239b2a0b84414836c494e68b5ff2d1eba2030fccc9d929645a45f7a2459ce2261846a10922f4b77bc6e0f26d34adc1afffb62e51fe45e8f44b53</sha512>
<targetplatform name="joomla" version="((3\.(9|10))|(4\.[01]))" />
</update>
<update>
<name>Weblinks Extension Package</name>
<description>Joomla! CMS Weblinks Package</description>
<element>pkg_weblinks</element>
<type>package</type>
<version>4.0.1</version>
<client>site</client>
<infourl title="Weblinks Extension Package">https://github.com/joomla-extensions/weblinks/releases/tag/4.0.1</infourl>
<downloads>
<downloadurl type="full" format="zip">https://downloads.joomla.org/extensions/weblinks/4-0-1/pkg-weblinks-4.0.1.zip</downloadurl>
</downloads>
<sha512>8e6ac146d9bf907971a25728f4ed6cfad900ab51d1bf33a157f11b42bfcb8b7dfbc6c21c9eeebfe2cf572220db33f73fa29807f3d350220ed4e73b09866dcdad</sha512>
<targetplatform name="joomla" version="4\.[012]" />
</update>
</updates>

14
renovate.json Normal file
View File

@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":preserveSemverRanges",
":disableMajorUpdates"
],
"versioning": "semver",
"dependencyDashboard": true,
"lockFileMaintenance": { "enabled": true },
"composerIgnorePlatformReqs": ["ext-*", "lib-*"],
"rangeStrategy": "update-lockfile",
"baseBranches": ["master", "4.0-dev"]
}

View File

@ -146,14 +146,17 @@ class WeblinksHelper extends JHelperContent
{
$item->count_published = $weblink->count;
}
if ($weblink->state == 0)
{
$item->count_unpublished = $weblink->count;
}
if ($weblink->state == 2)
{
$item->count_archived = $weblink->count;
}
if ($weblink->state == -2)
{
$item->count_trashed = $weblink->count;

View File

@ -65,7 +65,8 @@ class JFormFieldModal_Weblink extends JFormField
function jSelectWeblink_" . $this->id . "(id, title, catid, object, url, language) {
window.processModalSelect('Weblink', '" . $this->id . "', id, title, catid, object, url, language);
}
");
"
);
$scriptSelect[$this->id] = true;
}
}
@ -94,6 +95,7 @@ class JFormFieldModal_Weblink extends JFormField
->from($db->quoteName('#__weblinks'))
->where($db->quoteName('id') . ' = ' . (int) $value);
$db->setQuery($query);
try
{
$title = $db->loadResult();
@ -103,6 +105,7 @@ class JFormFieldModal_Weblink extends JFormField
JError::raiseWarning(500, $e->getMessage());
}
}
$title = empty($title) ? JText::_('COM_WEBLINKS_SELECT_A_WEBLINK') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current weblink display field.
@ -122,6 +125,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
. '</a>';
}
// New weblink button
if ($allowNew)
{
@ -135,6 +139,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
. '</a>';
}
// Edit weblink button
if ($allowEdit)
{
@ -148,6 +153,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
. '</a>';
}
// Clear weblink button
if ($allowClear)
{
@ -159,6 +165,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
. '</a>';
}
$html .= '</span>';
// Select weblink modal
@ -236,10 +243,12 @@ class JFormFieldModal_Weblink extends JFormField
)
);
}
// Note: class='required' for client side validation.
$class = $this->required ? ' class="required modal-value"' : '';
$html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
. '" data-text="' . htmlspecialchars(JText::_('COM_WEBLINKS_SELECT_A_WEBLINK', true), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';
return $html;
}

View File

@ -38,6 +38,7 @@
label="JCATEGORY"
description="COM_WEBLINKS_FIELD_CATEGORY_DESC"
extension="com_weblinks"
addfieldprefix="Joomla\Component\Categories\Administrator\Field"
required="true"
default=""
/>

View File

@ -155,6 +155,12 @@ class WeblinksModelWeblink extends JModelAdmin
$form->setFieldAttribute('publish_down', 'filter', 'unset');
}
// Don't allow to change the created_by user if not allowed to access com_users.
if (!JFactory::getUser()->authorise('core.manage', 'com_users'))
{
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
return $form;
}

View File

@ -153,7 +153,8 @@ class Com_WeblinksInstallerScript
. $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()"}}') . ', '
"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",
@ -161,7 +162,8 @@ class Com_WeblinksInstallerScript
"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":{}}') . ', '
"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",
@ -170,7 +172,8 @@ class Com_WeblinksInstallerScript
"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"} ]}')
{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'
)
);
$db->setQuery($query);
@ -189,7 +192,8 @@ class Com_WeblinksInstallerScript
. $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()"}}') . ', '
"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",
@ -198,7 +202,8 @@ class Com_WeblinksInstallerScript
"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"}}') . ', '
"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",
@ -209,7 +214,8 @@ class Com_WeblinksInstallerScript
"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"}]}')
"displayColumn":"title"}]}'
)
);
$db->setQuery($query);

View File

@ -38,8 +38,11 @@ class WeblinksTableWeblink extends JTable
// Set the published column alias
$this->setColumnAlias('published', 'state');
JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
if (version_compare(JVERSION, '4.0', '<') == 1)
{
JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
}
}
/**
@ -91,9 +94,10 @@ class WeblinksTableWeblink extends JTable
}
// Verify that the alias is unique
$table = JTable::getInstance('Weblink', 'WeblinksTable');
$table = JTable::getInstance('Weblink', 'WeblinksTable', array('dbo' => $this->getDbo()));
if ($table->load(array('language' => $this->language, 'alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0))
if ($table->load(array('language' => $this->language, 'alias' => $this->alias, 'catid' => $this->catid))
&& ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_WEBLINKS_ERROR_UNIQUE_ALIAS'));
@ -126,6 +130,7 @@ class WeblinksTableWeblink extends JTable
if (trim($this->title) == '')
{
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
return false;
}
@ -194,6 +199,6 @@ class WeblinksTableWeblink extends JTable
$this->metakey = implode(", ", $clean_keys);
}
return true;
return parent::check();
}
}

View File

@ -49,8 +49,8 @@ $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=c
<div class="row-fluid">
<div class="span9">
<div class="form-vertical">
<?php echo $this->form->getControlGroup('url'); ?>
<?php echo $this->form->getControlGroup('description'); ?>
<?php echo $this->form->renderField('url'); ?>
<?php echo $this->form->renderField('description'); ?>
</div>
</div>
<div class="span3">
@ -62,9 +62,9 @@ $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=c
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'images', JText::_('JGLOBAL_FIELDSET_IMAGE_OPTIONS', true)); ?>
<div class="row-fluid">
<div class="span6">
<?php echo $this->form->getControlGroup('images'); ?>
<?php echo $this->form->renderField('images'); ?>
<?php foreach ($this->form->getGroup('images') as $field) : ?>
<?php echo $field->getControlGroup(); ?>
<?php echo $field->renderField(); ?>
<?php endforeach; ?>
</div>
</div>

View File

@ -42,7 +42,7 @@ class WeblinksViewWeblink extends JViewLegacy
return false;
}
// If we are forcing a language in modal (used for associations).
if ($this->getLayout() === 'modal' && $forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd'))
{
@ -88,15 +88,23 @@ class WeblinksViewWeblink extends JViewLegacy
JToolbarHelper::apply('weblink.apply');
JToolbarHelper::save('weblink.save');
}
if (!$checkedOut && (count($user->getAuthorisedCategories('com_weblinks', 'core.create'))))
{
JToolbarHelper::save2new('weblink.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && (count($user->getAuthorisedCategories('com_weblinks', 'core.create')) > 0))
{
JToolbarHelper::save2copy('weblink.save2copy');
}
if (JLanguageAssociations::isEnabled() && JComponentHelper::isEnabled('com_associations'))
{
JToolbarHelper::custom('weblink.editAssociations', 'contract', 'contract', 'JTOOLBAR_ASSOCIATIONS', false, false);
}
if (empty($this->item->id))
{
JToolbarHelper::cancel('weblink.cancel');

View File

@ -47,6 +47,7 @@ class WeblinksViewWeblinks extends JViewLegacy
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
@ -93,7 +94,7 @@ class WeblinksViewWeblinks extends JViewLegacy
$user = JFactory::getUser();
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
$bar = JToolbar::getInstance('toolbar');
JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS'), 'link weblinks');
@ -129,7 +130,7 @@ class WeblinksViewWeblinks extends JViewLegacy
if ($user->authorise('core.create', 'com_weblinks') && $user->authorise('core.edit', 'com_weblinks')
&& $user->authorise('core.edit.state', 'com_weblinks'))
{
JHtml::_('bootstrap.modal', 'collapseModal');
JHtml::_('bootstrap.renderModal', 'collapseModal');
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button

View File

@ -65,9 +65,9 @@ COM_WEBLINKS_FIELD_SECOND_LABEL="Second Image"
COM_WEBLINKS_FIELD_SELECT_CATEGORY_DESC="Select a web links category to display."
COM_WEBLINKS_FIELD_SELECT_CATEGORY_LABEL="Select a Category"
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_DESC="Show the tags for a category."
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Show Tags"
COM_WEBLINKS_FIELD_SHOW_CAT_TAGS_LABEL="Category Tags"
COM_WEBLINKS_FIELD_SHOW_TAGS_DESC="Show the tags for a web link."
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Show Tags"
COM_WEBLINKS_FIELD_SHOW_TAGS_LABEL="Tags"
COM_WEBLINKS_FIELD_STATE_DESC="Set publication status."
COM_WEBLINKS_FIELD_TARGET_DESC="Target browser window when the link is selected."
COM_WEBLINKS_FIELD_TARGET_LABEL="Target"

View File

@ -19,8 +19,6 @@ class Pkg_WeblinksInstallerScript extends JInstallerScript
/**
* Extension script constructor.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function __construct()

View File

@ -92,7 +92,7 @@ class WeblinksModelCategories extends JModelList
*/
public function getItems()
{
if (!count($this->_items))
if ($this->_items === null)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();

View File

@ -186,7 +186,7 @@ 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))
{

View File

@ -63,7 +63,7 @@ class WeblinksModelWeblink extends JModelItem
/**
* Method to get an object.
*
* @param integer $id The id of the object to get.
* @param integer $pk The id of the object to get.
*
* @return mixed Object on success, false on failure.
*/
@ -191,7 +191,7 @@ class WeblinksModelWeblink extends JModelItem
/**
* Method to increment the hit counter for the weblink
*
* @param integer $id Optional ID of the weblink.
* @param integer $pk Optional ID of the weblink.
*
* @return boolean True on success
*/

View File

@ -65,7 +65,7 @@ class WeblinksRouter extends JComponentRouterBase
}
// Are we dealing with an weblink that is attached to a menu item?
if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
if (isset($query['view']) && ($mView == $query['view']) && isset($query['id']) && ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
@ -74,7 +74,7 @@ class WeblinksRouter extends JComponentRouterBase
return $segments;
}
if (isset($view) and ($view == 'category' or $view == 'weblink'))
if (isset($view) && ($view == 'category' || $view == 'weblink'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{

View File

@ -53,6 +53,7 @@ class WeblinksViewCategories extends JViewCategories
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}

View File

@ -33,9 +33,9 @@ if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
<dl class="weblink-count"><dt>
<?php echo JText::_('COM_WEBLINKS_NUM'); ?></dt>
<dd><?php echo $child->numitems; ?></dd>

View File

@ -13,9 +13,6 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.framework');
// Create a shortcut for params.
$params = &$this->item->params;
// Get the user object.
$user = JFactory::getUser();
@ -29,143 +26,144 @@ $listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<?php if (empty($this->items)) : ?>
<p> <?php echo JText::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
<?php else : ?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('filter_field') != 'hide' || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field') != 'hide') : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search"><?php echo JText::_('COM_WEBLINKS_FILTER_LABEL') . '&#160;'; ?></label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
</div>
<?php endif; ?>
<fieldset class="filters btn-toolbar">
<?php if ($this->params->get('filter_field') != 'hide') : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search"><?php echo JText::_('COM_WEBLINKS_FILTER_LABEL') . '&#160;'; ?></label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_WEBLINKS_FILTER_SEARCH_DESC'); ?>" />
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group pull-right">
<label for="limit" class="element-invisible">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p><?php echo JText::_('COM_WEBLINKS_NO_WEBLINKS'); ?></p>
<?php else : ?>
<ul class="category list-striped list-condensed">
<?php foreach ($this->items as $i => $item) : ?>
<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<?php if ($this->items[$i]->state == 0) : ?>
<li class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
<?php else : ?>
<li class="cat-list-row<?php echo $i % 2; ?>" >
<li class="cat-list-row<?php echo $i % 2; ?>">
<?php endif; ?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<span class="list-hits badge badge-info pull-right">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
<?php if ($canEdit) : ?>
<span class="list-edit pull-left width-50">
<?php echo JHtml::_('icon.edit', $item, $params); ?>
</span>
<?php endif; ?>
<div class="list-title">
<?php if ($this->params->get('icons', 1) == 0) : ?>
<?php echo JText::_('COM_WEBLINKS_LINK'); ?>
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
<?php if (!$this->params->get('link_icons')) : ?>
<?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?>
<?php else: ?>
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . JText::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php if ($this->params->get('show_link_hits', 1)) : ?>
<span class="list-hits badge badge-info pull-right">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
<?php endif; ?>
<?php // Compute the correct link ?>
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
<?php $link = $item->link; ?>
<?php $width = $item->params->get('width'); ?>
<?php $height = $item->params->get('height'); ?>
<?php if ($width == null || $height == null) : ?>
<?php $width = 600; ?>
<?php $height = 500; ?>
<?php endif; ?>
<?php if ($this->items[$i]->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php
switch ($item->params->get('target', $this->params->get('target')))
{
case 1:
// Open in a new window
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
case 2:
// Open in a popup window
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
echo "<a href=\"$link\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\">" .
$this->escape($item->title) . '</a>';
break;
case 3:
// Open in a modal window
JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . ' </a>';
break;
default:
// Open in parent window
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . ' </a>';
break;
}
?>
</div>
<?php $tagsData = $item->tags->getItemTags('com_weblinks.weblink', $item->id); ?>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($tagsData); ?>
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) and ($item->description != '')) : ?>
<?php $images = json_decode($item->images); ?>
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
<?php if ($images->image_first_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
<?php if ($canEdit) : ?>
<span class="list-edit pull-left width-50">
<?php echo JHtml::_('icon.edit', $item, $item->params); ?>
</span>
<?php endif; ?>
<div class="list-title">
<?php if ($this->params->get('icons', 1) == 0) : ?>
<?php echo JText::_('COM_WEBLINKS_LINK'); ?>
<?php elseif ($this->params->get('icons', 1) == 1) : ?>
<?php if (!$this->params->get('link_icons')) : ?>
<?php echo JHtml::_('image', 'system/weblink.png', JText::_('COM_WEBLINKS_LINK'), null, true); ?>
<?php else: ?>
<?php echo '<img src="' . $this->params->get('link_icons') . '" alt="' . JText::_('COM_WEBLINKS_LINK') . '" />'; ?>
<?php endif; ?>
<?php endif; ?>
<?php // Compute the correct link ?>
<?php $menuclass = 'category' . $this->pageclass_sfx; ?>
<?php $link = $item->link; ?>
<?php $width = $item->params->get('width', 600); ?>
<?php $height = $item->params->get('height', 500); ?>
<?php if ($this->items[$i]->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php
switch ($item->params->get('target', $this->params->get('target')))
{
case 1:
// Open in a new window
echo '<a href="' . $link . '" target="_blank" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
case 2:
// Open in a popup window
$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' . $this->escape($width) . ',height=' . $this->escape($height) . '';
echo '<a href="'. $link .'" onclick="window.open(this.href, \'targetWindow\', \'' . $attribs . '\'); return false;">' .
$this->escape($item->title) . '</a>';
break;
case 3:
// Open in a modal window
JHtml::_('behavior.modal', 'a.modal');
echo '<a class="modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x:' . $this->escape($width) . ', y:' . $this->escape($height) . '}}">' .
$this->escape($item->title) . '</a>';
break;
default:
// Open in parent window
echo '<a href="' . $link . '" class="' . $menuclass . '" rel="nofollow">' .
$this->escape($item->title) . '</a>';
break;
}
?>
</div>
<?php if ($this->params->get('show_tags', 1) && !empty($item->tags->itemTags)) : ?>
<?php echo JLayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>
<?php endif; ?>
<?php if (($this->params->get('show_link_description')) && ($item->description != '')) : ?>
<?php $images = json_decode($item->images); ?>
<?php if (isset($images->image_first) && !empty($images->image_first)) : ?>
<?php $imgfloat = $images->float_first ?: $this->params->get('float_first'); ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_first_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_first_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_first); ?>"
alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"
/>
</div>
<?php endif; ?>
<?php if (isset($images->image_second) && !empty($images->image_second)) : ?>
<?php $imgfloat = $images->float_second ?: $this->params->get('float_second'); ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image">
<img
<?php if ($images->image_second_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_second); ?>"
alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"
/>
</div>
<?php endif; ?>
<?php echo $item->description; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_first); ?>" alt="<?php echo htmlspecialchars($images->image_first_alt); ?>"/> </div>
<?php endif; ?>
<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
<?php if ($images->image_second_caption) : ?>
<?php echo 'class="caption" title="' . htmlspecialchars($images->image_second_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo htmlspecialchars($images->image_second); ?>" alt="<?php echo htmlspecialchars($images->image_second_alt); ?>"/> </div>
<?php endif; ?>
<?php echo $item->description; ?>
<?php endif; ?>
</li>
<?php endif;?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php // Code to add a link to submit a weblink. ?>
<?php if ($this->params->get('show_pagination')) : ?>
<?php if ($this->params->get('show_pagination')) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</form>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
</form>

View File

@ -44,7 +44,7 @@ class WeblinksViewCategory extends JViewCategory
$temp = new JRegistry;
$temp->loadString($item->params);
$item->params = clone($this->params);
$item->params = clone $this->params;
$item->params->merge($temp);
}
@ -86,7 +86,7 @@ class WeblinksViewCategory extends JViewCategory
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();
while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1)
while ($category !== null && $category->id !== 'root' && ($menu->query['option'] != 'com_weblinks' || $id != $category->id))
{
$path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();

View File

@ -83,7 +83,7 @@ class ModWeblinksHelper
$model->setState(
'list.select',
'a.*, c.published AS c_published,' . $case_when1 . ',' . $case_when2
'a.*, c.description AS c_description, c.published AS c_published,' . $case_when1 . ',' . $case_when2
);
$model->setState('filter.c.published', 1);
@ -110,6 +110,6 @@ class ModWeblinksHelper
return $items;
}
return;
return array();
}
}

View File

@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.7.0</version>
<version>##VERSION##</version>
<description>PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION</description>
<files>
##FILES##

View File

@ -12,7 +12,7 @@ defined('JPATH_BASE') or die;
use Joomla\Registry\Registry;
// Load the base adapter.
require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php';
JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php');
/**
* Smart Search adapter for Joomla Web Links.
@ -139,7 +139,7 @@ class PlgFinderWeblinks extends FinderIndexerAdapter
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle web links here. We need to handle front end and back end editing.
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form' )
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form')
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)

View File

@ -175,12 +175,12 @@ class PlgSearchWeblinks extends JPlugin
$case_when1 .= $c_id . ' END as catslug';
$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')
->join('INNER', '#__categories as c ON c.id = a.catid')
->where('(' . $where . ') AND a.state IN (' . implode(',', $state) . ') AND c.published = 1 AND c.access IN (' . $groups . ')')
->order($order);
->select($query->concatenate(array($db->quote($searchWeblinks), 'c.title'), " / ") . ' AS section')
->select('\'1\' AS browsernav')
->from('#__weblinks AS a')
->join('INNER', '#__categories as c ON c.id = a.catid')
->where('(' . $where . ') AND a.state IN (' . implode(',', $state) . ') AND c.published = 1 AND c.access IN (' . $groups . ')')
->order($order);
// Filter by language.
if (JFactory::getApplication()->isClient('site') && JLanguageMultilang::isEnabled())

View File

@ -38,7 +38,7 @@ class PlgSystemWeblinks extends JPlugin
/**
* Method to add statistics information to Administrator control panel.
*
* @param string $extension The extension requesting information.
* @param string $extension The extension requesting information.
*
* @return array containing statistical information.
*

View File

@ -11,5 +11,5 @@ I am going to "try to archive a weblink category"
I click toolbar button "archive"
I wait for element "['id' => 'system-message-container']"," '60"
I expect to "see a success message after Archiving the category"
I see "1 category successfully archived."," ['id' => 'system-message-container']"
I see "1 category archived."," ['id' => 'system-message-container']"

View File

@ -13,5 +13,5 @@ I wait for text "Category Manager: Add A New Weblinks Category"," '60"," ['css'
I fill field "['id' => 'jform_title']"," $this->categoryTitle"
I click toolbar button "Save & Close"
I expect to "see a success message after saving the category"
I see "Category successfully saved"," ['id' => 'system-message-container']"
I see "Category saved"," ['id' => 'system-message-container']"

View File

@ -12,5 +12,5 @@ I am going to "try to delete a Weblinks Category"
I click toolbar button "Empty trash"
I wait for element "['id' => 'system-message-container']"," '60"
I expect to "see a success message after Deleting the category"
I see "1 category successfully deleted."," ['id' => 'system-message-container']"
I see "1 category deleted."," ['id' => 'system-message-container']"

View File

@ -11,5 +11,5 @@ I am going to "try to publish a Weblinks Category"
I click toolbar button "publish"
I wait for element "['id' => 'system-message-container']"," '60"
I expect to "see a success message after publishing the category"
I see "1 category successfully published."," ['id' => 'system-message-container']"
I see "1 category published."," ['id' => 'system-message-container']"

View File

@ -12,5 +12,5 @@ I am going to "try to delete a Weblinks Category"
I click toolbar button "Trash"
I wait for element "['id' => 'system-message-container']"," '60"
I expect to "see a success message after Trashing the category"
I see "1 category successfully trashed."," ['id' => 'system-message-container']"
I see "1 category trashed."," ['id' => 'system-message-container']"

View File

@ -11,5 +11,5 @@ I am going to "try to unpublish a Weblinks Category"
I click toolbar button "unpublish"
I wait for element "['id' => 'system-message-container']"," '60"
I expect to "See a success message after unpublishing the category"
I see "1 category successfully unpublished"," ['id' => 'system-message-container']"
I see "1 category unpublished"," ['id' => 'system-message-container']"

View File

@ -17,39 +17,15 @@ namespace Step\Acceptance;
*
* @since 1.4
*/
class category extends \AcceptanceTester
class Category extends \AcceptanceTester
{
/**
* Function to create a Category in Joomla!
*
* @param String $categoryName Name of the Category which is to be created
*
* @return void
*/
public function createCategory($categoryName)
{
$I = $this;
$I->am('Administrator');
$I->amOnPage('administrator/index.php?option=com_categories&extension=com_weblinks');
$I->waitForText('Weblinks: Categories', '30', ['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', '30', ['css' => 'h1']);
$I->fillField(['id' => 'jform_title'], $categoryName);
$I->clickToolbarButton('Save & Close');
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
}
/**
* Function to Trash a Category in Joomla!
*
* @param String $categoryName Name of the category which is to be trashed
* @param String $categoryName Name of the category which is to be trashed
*
* @return void
* @throws \Exception
*/
public function trashCategory($categoryName)
{
@ -66,9 +42,10 @@ class category extends \AcceptanceTester
/**
* Function to Delete a Category in Joomla!
*
* @param String $categoryName Name of the category which is to be deleted
* @param String $categoryName Name of the category which is to be deleted
*
* @return void
* @throws \Exception
*/
public function deleteCategory($categoryName)
{

View File

@ -11,15 +11,16 @@ namespace Step\Acceptance;
* @package Step\Acceptance
* @link http://codeception.com/docs/06-ReusingTestCode#StepObjects
*/
class weblink extends \AcceptanceTester
class Weblink extends \AcceptanceTester
{
/**
* Creates a weblink
*
* @param string $title The title for the weblink
* @param string $url The url for the weblink
* @param string $countClicks If not null, we set the "Count Clicks" weblink property to the given value.
* @param string $title The title for the weblink
* @param string $url The url for the weblink
* @param string $countClicks If not null, we set the "Count Clicks" weblink property to the given value.
*
* @throws \Exception
*/
public function createWeblink($title, $url, $countClicks = null)
{
@ -75,4 +76,4 @@ class weblink extends \AcceptanceTester
$I->waitForText('Web Links','30',['css' => 'h1']);
$I->waitForText('1 web link successfully deleted.', 30, ['id' => 'system-message-container']);
}
}
}

View File

@ -1,4 +1,3 @@
<?php
// Here you can initialize variables that will be available to your tests
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__.DIRECTORY_SEPARATOR.'_steps');

View File

@ -1,5 +1,7 @@
<?php
use Step\Acceptance\Category;
/**
* @package Joomla.Administrator
* @subpackage com_weblinks
@ -43,7 +45,7 @@ class AdministratorCategoriesCest
$I->see('Invalid field: Title', ['id' => 'system-message-container']);
}
public function administratorCreateCategory(\Step\Acceptance\category $I)
public function administratorCreateCategory(Category $I)
{
$I->am('Administrator');
$I->wantToTest('create a Category in /administrator/');
@ -62,13 +64,13 @@ class AdministratorCategoriesCest
$I->fillField(['id' => 'jform_title'], $this->categoryTitle);
$I->clickToolbarButton('Save & Close');
$I->expectTo('see a success message after saving the category');
$I->see('Category successfully saved', ['id' => 'system-message-container']);
$I->see('Category saved', ['id' => 'system-message-container']);
}
/**
* @depends administratorCreateCategory
*/
public function administratorPublishCategory(\Step\Acceptance\category $I)
public function administratorPublishCategory(Category $I)
{
$I->am('Administrator');
@ -84,13 +86,13 @@ class AdministratorCategoriesCest
$I->clickToolbarButton('publish');
$I->waitForElement(['id' => 'system-message-container'], '60');
$I->expectTo('see a success message after publishing the category');
$I->see('1 category successfully published.', ['id' => 'system-message-container']);
$I->see('0 categories published.', ['id' => 'system-message-container']);
}
/**
* @depends administratorPublishCategory
*/
public function administratorUnpublishCategory(\Step\Acceptance\category $I)
public function administratorUnpublishCategory(Category $I)
{
$I->am('Administrator');
$I->wantToTest('Unpublish a Category in /administrator/');
@ -105,13 +107,13 @@ class AdministratorCategoriesCest
$I->clickToolbarButton('unpublish');
$I->waitForElement(['id' => 'system-message-container'], '60');
$I->expectTo('See a success message after unpublishing the category');
$I->see('1 category successfully unpublished', ['id' => 'system-message-container']);
$I->see('1 category unpublished', ['id' => 'system-message-container']);
}
/**
* @depends administratorUnpublishCategory
*/
public function administratorArchiveCategory(\Step\Acceptance\category $I)
public function administratorArchiveCategory(Category $I)
{
$I->am('Administrator');
$I->wantToTest('Archiving a Category in /administrator/');
@ -126,13 +128,13 @@ class AdministratorCategoriesCest
$I->clickToolbarButton('archive');
$I->waitForElement(['id' => 'system-message-container'], '60');
$I->expectTo('see a success message after Archiving the category');
$I->see('1 category successfully archived.', ['id' => 'system-message-container']);
$I->see('1 category archived.', ['id' => 'system-message-container']);
}
/**
* @depends administratorArchiveCategory
*/
public function administratorTrashCategory(\Step\Acceptance\category $I)
public function administratorTrashCategory(Category $I)
{
$I->am('Administrator');
$I->wantToTest('Trashing a Category in /administrator/');
@ -148,13 +150,13 @@ class AdministratorCategoriesCest
$I->clickToolbarButton('Trash');
$I->waitForElement(['id' => 'system-message-container'], '60');
$I->expectTo('see a success message after Trashing the category');
$I->see('1 category successfully trashed.', ['id' => 'system-message-container']);
$I->see('1 category trashed.', ['id' => 'system-message-container']);
}
/**
* @depends administratorTrashCategory
*/
public function administratorDeleteCategory(\Step\Acceptance\category $I)
public function administratorDeleteCategory(Category $I)
{
$I->am('Administrator');
$I->wantToTest('Deleting a Category in /administrator/');
@ -171,10 +173,10 @@ class AdministratorCategoriesCest
$I->acceptPopup();
$I->waitForElement(['id' => 'system-message-container'], '60');
$I->expectTo('see a success message after Deleting the category');
$I->see('1 category successfully deleted.', ['id' => 'system-message-container']);
$I->see('1 category deleted.', ['id' => 'system-message-container']);
}
public function administratorVerifyAvailableTabs(\Step\Acceptance\category $I)
public function administratorVerifyAvailableTabs(Category $I)
{
$I->am('Administrator');
$I->wantToTest('Category Edit View Tabs');

View File

@ -35,7 +35,7 @@ class AdministratorSmartSearchCest
$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']);
$I->see('Configuration saved', ['id' => 'system-message-container']);
}
public function administratorEnableContentPlugin(\Step\Acceptance\weblink $I)
@ -53,8 +53,8 @@ class AdministratorSmartSearchCest
$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']);
$I->waitForText('Plugin saved.', 30, ['id' => 'system-message-container']);
$I->see('Plugin saved.', ['id' => 'system-message-container']);
}
/**
@ -74,8 +74,8 @@ class AdministratorSmartSearchCest
$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']);
$I->waitForText('Plugin saved.', 30, ['id' => 'system-message-container']);
$I->see('Plugin saved.', ['id' => 'system-message-container']);
}
/**
@ -95,8 +95,8 @@ class AdministratorSmartSearchCest
$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']);
$I->waitForText('All items have been deleted', 30, ['class' => 'alert-message']);
$I->see('All items have been deleted', ['class' => 'alert-message']);
}
public function administratorCreateWeblink(\Step\Acceptance\weblink $I, $scenario)
@ -145,7 +145,7 @@ class AdministratorSmartSearchCest
$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']);
$I->waitForText('Plugin disabled', 30, ['class' => 'alert-message']);
}
/**
@ -166,7 +166,7 @@ class AdministratorSmartSearchCest
$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']);
$I->waitForText('Plugin disabled', 30, ['class' => 'alert-message']);
}
public function cleanUp(\Step\Acceptance\weblink $I, $scenario)

View File

@ -7,6 +7,8 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Step\Acceptance\Weblink;
/**
* Acceptance cest object class for admin steps
*
@ -37,7 +39,7 @@ class AdministratorWeblinksCest
*
* @return void
*/
public function administratorVerifyAvailableTabs(\Step\Acceptance\weblink $I)
public function administratorVerifyAvailableTabs(Weblink $I)
{
$I->am('Administrator');
$I->wantToTest('Weblinks Edit View Tabs');
@ -49,7 +51,7 @@ class AdministratorWeblinksCest
$I->waitForText('Web Links', '30', ['css' => 'h1']);
$I->clickToolbarButton('New');
$I->waitForText('Web Link: New', '30', ['css' => 'h1']);
$I->verifyAvailableTabs(['New Web Link', 'Images', 'Publishing', 'Options', 'Metadata']);
$I->verifyAvailableTabs(['New Web Link', 'Images', 'Publishing', 'Options']);
}
/**
@ -61,7 +63,7 @@ class AdministratorWeblinksCest
*
* @return void
*/
public function administratorCreateWeblink(\Step\Acceptance\weblink $I)
public function administratorCreateWeblink(Weblink $I)
{
$I->am('Administrator');
$I->wantToTest('Weblink creation in /administrator/');