diff --git a/.gitignore b/.gitignore index 55e06f6078..6a72e5e047 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,9 @@ # Local System Files (i.e. cache, logs, etc.) # /administrator/cache +/administrator/logs /cache -/logs +/installation/cache /tmp /configuration.php /.htaccess @@ -131,3 +132,13 @@ Desktop.ini /libraries/vendor/symfony/yaml/composer.json /libraries/vendor/symfony/yaml/phpunit.xml.dist /libraries/vendor/symfony/yaml/README.md +/libraries/vendor/simplepie/simplepie/demo +/libraries/vendor/simplepie/simplepie/tests +/libraries/vendor/simplepie/simplepie/README.markdown +/libraries/vendor/simplepie/simplepie/phpunit.xml.dist +/libraries/vendor/simplepie/simplepie/.gitignore +/libraries/vendor/simplepie/simplepie/.travis.yml +/libraries/vendor/simplepie/simplepie/compatibility_test +/libraries/vendor/simplepie/simplepie/build +/libraries/vendor/simplepie/simplepie/idn/ReadMe.txt +/libraries/vendor/simplepie/simplepie/composer.json diff --git a/.travis.yml b/.travis.yml index 6aafc4336c..df5689d5a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - INSTALL_REDIS="yes" matrix: + fast_finish: true include: - php: 5.3 env: INSTALL_APC="yes" @@ -20,7 +21,20 @@ matrix: - php: 7.0 env: INSTALL_APCU="yes" INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled apcu_bc install until https://github.com/travis-ci/travis-ci/issues/5207 is resolved - php: hhvm - env: INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" INSTALL_REDIS="no" # Disabled items that currently do not work in travis-ci hhvm + sudo: true + dist: trusty + group: edge # until the next update + addons: + apt: + packages: + - mysql-server-5.6 + - mysql-client-core-5.6 + - mysql-client-5.6 + services: + - mysql + - postgresql + - redis-server + env: INSTALL_APCU_BC_BETA="no" INSTALL_MEMCACHE="no" INSTALL_MEMCACHED="no" # Disabled items that currently do not work in travis-ci hhvm allow_failures: - php: hhvm @@ -33,8 +47,10 @@ before_script: # Make sure all dev dependencies are installed - composer install # Set up databases for testing - - mysql -e 'create database joomla_ut;' - - mysql joomla_ut < tests/unit/schema/mysql.sql + - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then mysql -e 'create database joomla_ut;'; fi + - if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then mysql joomla_ut < tests/unit/schema/mysql.sql; fi + - if [[ $TRAVIS_PHP_VERSION = hhvm ]]; then mysql -u root -e 'create database joomla_ut;'; fi + - if [[ $TRAVIS_PHP_VERSION = hhvm ]]; then mysql -u root joomla_ut < tests/unit/schema/mysql.sql; fi - psql -c 'create database joomla_ut;' -U postgres - psql -d joomla_ut -a -f tests/unit/schema/postgresql.sql # Set up Apache @@ -46,7 +62,8 @@ before_script: - if [[ $INSTALL_APCU == "yes" && $TRAVIS_PHP_VERSION = 5.* ]]; then printf "\n" | pecl install apcu-4.0.10 && phpenv config-add build/travis/phpenv/apcu-$TRAVIS_PHP_VERSION.ini; fi - if [[ $INSTALL_APCU == "yes" && $TRAVIS_PHP_VERSION = 7.* ]]; then printf "\n" | pecl install apcu-beta && phpenv config-add build/travis/phpenv/apcu-$TRAVIS_PHP_VERSION.ini; fi - if [[ $INSTALL_APCU_BC_BETA == "yes" ]]; then printf "\n" | pecl install apcu_bc-beta; fi - - if [[ $INSTALL_REDIS == "yes" ]]; then phpenv config-add build/travis/phpenv/redis.ini; fi + - if [[ $INSTALL_REDIS == "yes" && $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-add build/travis/phpenv/redis.ini; fi + - if [[ $INSTALL_REDIS == "yes" && $TRAVIS_PHP_VERSION = hhvm ]]; then cat build/travis/phpenv/redis.ini >> /etc/hhvm/php.ini; fi # Xvfb - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" diff --git a/README.md b/README.md index 6ade44bbbb..e069380e9e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ What is this? --------------------- * This is a Joomla! 3.x installation/upgrade package. * Joomla's [Official website](https://www.joomla.org). -* Joomla! 3.5 [version history](https://docs.joomla.org/Joomla_3.5_version_history). +* Joomla! 3.6 [version history](https://docs.joomla.org/Joomla_3.6_version_history). * Detailed changes are in the [changelog](https://github.com/joomla/joomla-cms/commits/master). What is Joomla? @@ -49,7 +49,7 @@ Is it easy to change the layout display? Ready to install Joomla? --------------------- -* Check the [minimum requirements](https://www.joomla.org/technical-requirements.html). +* Check the [minimum requirements](https://www.joomla.org/about-joomla/technical-requirements.html). * How do you [install Joomla](https://docs.joomla.org/Installing_Joomla!)? * You could start your Joomla! experience by [building your site on a local test server](https://docs.joomla.org/Installing_Joomla_locally). When ready, it can be moved to an on-line hosting account of your choice. diff --git a/README.txt b/README.txt index 741ce6ac10..72b246a63c 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ 1- What is this? * This is a Joomla! installation/upgrade package to version 3.x * Joomla! Official site: https://www.joomla.org - * Joomla! 3.5 version history - https://docs.joomla.org/Joomla_3.5_version_history + * Joomla! 3.6 version history - https://docs.joomla.org/Joomla_3.6_version_history * Detailed changes in the Changelog: https://github.com/joomla/joomla-cms/commits/master 2- What is Joomla? @@ -33,7 +33,7 @@ * There are lots of ready made templates that you can download. 8- Ready to install Joomla? - * See minimum requirements here: https://www.joomla.org/technical-requirements.html + * See minimum requirements here: https://www.joomla.org/about-joomla/technical-requirements.html * How do you install Joomla! ? - https://docs.joomla.org/Installing_Joomla! * Start your Joomla experience building your site with a local test server. When ready it can be moved to an on-line hosting account of your choice. diff --git a/administrator/components/com_admin/models/sysinfo.php b/administrator/components/com_admin/models/sysinfo.php index e618573e93..e13a05092e 100644 --- a/administrator/components/com_admin/models/sysinfo.php +++ b/administrator/components/com_admin/models/sysinfo.php @@ -102,7 +102,7 @@ class AdminModelSysInfo extends JModelLegacy 'session.save_path', 'upload_tmp_dir', 'User/Group', - 'open_basedir' + 'open_basedir', ), 'other' => array( 'db', @@ -126,7 +126,7 @@ class AdminModelSysInfo extends JModelLegacy 'sitename', 'smtphost', 'tmp_path', - 'open_basedir' + 'open_basedir', ) ); @@ -274,7 +274,7 @@ public function &getConfig() $registry = new Registry(new JConfig); $this->config = $registry->toArray(); - $hidden = array('host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass'); + $hidden = array('host', 'user', 'password', 'ftp_user', 'ftp_pass', 'smtpuser', 'smtppass',); foreach ($hidden as $key) { @@ -312,7 +312,7 @@ public function &getInfo() 'sapi_name' => php_sapi_name(), 'version' => $version->getLongVersion(), 'platform' => $platform->getLongVersion(), - 'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "" + 'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "", ); return $this->info; @@ -464,10 +464,11 @@ public function getExtensions() $installed[$extension->name] = array( 'name' => $extension->name, 'type' => $extension->type, + 'state' => $extension->enabled ? JText::_('JENABLED') : JText::_('JDISABLED'), 'author' => 'unknown', 'version' => 'unknown', 'creationDate' => 'unknown', - 'authorUrl' => 'unknown' + 'authorUrl' => 'unknown', ); $manifest = json_decode($extension->manifest_cache); @@ -481,7 +482,7 @@ public function getExtensions() 'author' => $manifest->author, 'version' => $manifest->version, 'creationDate' => $manifest->creationDate, - 'authorUrl' => $manifest->authorUrl + 'authorUrl' => $manifest->authorUrl, ); $installed[$extension->name] = array_merge($installed[$extension->name], $extraData); @@ -524,7 +525,10 @@ public function getDirectory($public = false) continue; } - $this->addDirectory('administrator/language/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/language/' . $folder->getFilename()); + $this->addDirectory( + 'administrator/language/' . $folder->getFilename(), + JPATH_ADMINISTRATOR . '/language/' . $folder->getFilename() + ); } // List all manifests folders @@ -537,7 +541,10 @@ public function getDirectory($public = false) continue; } - $this->addDirectory('administrator/manifests/' . $folder->getFilename(), JPATH_ADMINISTRATOR . '/manifests/' . $folder->getFilename()); + $this->addDirectory( + 'administrator/manifests/' . $folder->getFilename(), + JPATH_ADMINISTRATOR . '/manifests/' . $folder->getFilename() + ); } $this->addDirectory('administrator/modules', JPATH_ADMINISTRATOR . '/modules'); @@ -557,7 +564,10 @@ public function getDirectory($public = false) continue; } - $this->addDirectory('images/' . $folder->getFilename(), JPATH_SITE . '/' . $cparams->get('image_path') . '/' . $folder->getFilename()); + $this->addDirectory( + 'images/' . $folder->getFilename(), + JPATH_SITE . '/' . $cparams->get('image_path') . '/' . $folder->getFilename() + ); } $this->addDirectory('language', JPATH_SITE . '/language'); @@ -610,13 +620,29 @@ public function getDirectory($public = false) if ($public) { - $this->addDirectory('log', $registry->get('log_path', JPATH_ROOT . '/log'), 'COM_ADMIN_LOG_DIRECTORY'); - $this->addDirectory('tmp', $registry->get('tmp_path', JPATH_ROOT . '/tmp'), 'COM_ADMIN_TEMP_DIRECTORY'); + $this->addDirectory( + 'log', + $registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'), + 'COM_ADMIN_LOG_DIRECTORY' + ); + $this->addDirectory( + 'tmp', + $registry->get('tmp_path', JPATH_ROOT . '/tmp'), + 'COM_ADMIN_TEMP_DIRECTORY' + ); } else { - $this->addDirectory($registry->get('log_path', JPATH_ROOT . '/log'), $registry->get('log_path', JPATH_ROOT . '/log'), 'COM_ADMIN_LOG_DIRECTORY'); - $this->addDirectory($registry->get('tmp_path', JPATH_ROOT . '/tmp'), $registry->get('tmp_path', JPATH_ROOT . '/tmp'), 'COM_ADMIN_TEMP_DIRECTORY'); + $this->addDirectory( + $registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'), + $registry->get('log_path', JPATH_ADMINISTRATOR . '/logs'), + 'COM_ADMIN_LOG_DIRECTORY' + ); + $this->addDirectory( + $registry->get('tmp_path', JPATH_ROOT . '/tmp'), + $registry->get('tmp_path', JPATH_ROOT . '/tmp'), + 'COM_ADMIN_TEMP_DIRECTORY' + ); } return $this->directories; @@ -635,7 +661,7 @@ public function getDirectory($public = false) */ private function addDirectory($name, $path, $message = '') { - $this->directories[$name] = array('writable' => is_writable($path), 'message' => $message); + $this->directories[$name] = array('writable' => is_writable($path), 'message' => $message,); } /** @@ -692,7 +718,7 @@ protected function parsePhpInfo($html) // 3cols if (preg_match($p2, $val, $matchs)) { - $r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3])); + $r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3]),); } // 2cols elseif (preg_match($p3, $val, $matchs)) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index ca7c12d30e..37fd7aa329 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -36,7 +36,7 @@ public function update($installer) $this->clearRadCache(); $this->updateAssets(); $this->clearStatsCache(); - $this->convertTablesToUtf8mb4(); + $this->convertTablesToUtf8mb4(true); $this->cleanJoomlaCache(); // VERY IMPORTANT! THIS METHOD SHOULD BE CALLED LAST, SINCE IT COULD @@ -235,13 +235,13 @@ protected function updateManifestCaches() array('component', 'com_config', '', 1), array('component', 'com_redirect', '', 1), array('component', 'com_users', '', 1), + array('component', 'com_finder', '', 1), array('component', 'com_tags', '', 1), array('component', 'com_contenthistory', '', 1), array('component', 'com_postinstall', '', 1), + array('component', 'com_joomlaupdate', '', 1), // Libraries - array('library', 'phpmailer', '', 0), - array('library', 'simplepie', '', 0), array('library', 'phputf8', '', 0), array('library', 'joomla', '', 0), array('library', 'idna_convert', '', 0), @@ -341,6 +341,9 @@ protected function updateManifestCaches() array('plugin', 'updatenotification', 'system', 0), array('plugin', 'module', 'editors-xtd', 0), array('plugin', 'stats', 'system', 0), + array('plugin', 'packageinstaller','installer',0), + array('plugin', 'folderinstaller','installer', 0), + array('plugin', 'urlinstaller','installer', 0), // Templates array('template', 'beez3', '', 0), @@ -356,7 +359,7 @@ protected function updateManifestCaches() array('file', 'joomla', '', 0), // Packages - // None in core at this time + array('package', 'pkg_en-GB', '', 0), ); // Attempt to refresh manifest caches @@ -1409,6 +1412,18 @@ public function deleteUnexistingFiles() '/libraries/joomla/document/xml/xml.php', '/administrator/components/com_installer/views/languages/tmpl/default_filter.php', '/administrator/components/com_joomlaupdate/helpers/download.php', + // Joomla 3.6.0 + '/libraries/simplepie/README.txt', + '/libraries/simplepie/simplepie.php', + '/libraries/simplepie/LICENSE.txt', + '/libraries/simplepie/idn/LICENCE', + '/libraries/simplepie/idn/ReadMe.txt', + '/libraries/simplepie/idn/idna_convert.class.php', + '/libraries/simplepie/idn/npdata.ser', + '/administrator/manifests/libraries/simplepie.xml', + '/administrator/templates/isis/js/jquery.js', + '/administrator/templates/isis/js/bootstrap.min.js', + '/media/system/js/permissions.min.js', ); // TODO There is an issue while deleting folders using the ftp mode @@ -1502,6 +1517,9 @@ public function deleteUnexistingFiles() '/libraries/joomla/document/opensearch', '/libraries/joomla/document/raw', '/libraries/joomla/document/xml', + // Joomla 3.6 + '/libraries/simplepie/idn', + '/libraries/simplepie', ); jimport('joomla.filesystem.file'); @@ -1617,8 +1635,8 @@ public function flushSessions() $session = JFactory::getSession(); /** - * Restarting the Session require a new login for the current user so lets check if we have a active session - * and only if not restart it. + * Restarting the Session require a new login for the current user so lets check if we have an active session + * and only restart it if not. * For B/C reasons we need to use getState as isActive is not available in 2.5 */ if ($session->getState() !== 'active') @@ -1666,32 +1684,27 @@ public function flushSessions() /** * Converts the site's database tables to support UTF-8 Multibyte. * - * Note that this is a modified of InstallerModelDatabase::convertTablesToUtf8mb4() - * that doesn't use JDatabase functions introduced in 3.5.0 which would cause errors - * when upgrading from a version before 3.5.0 + * @param boolean $doDbFixMsg Flag if message to be shown to check db fix * * @return void * * @since 3.5 */ - private function convertTablesToUtf8mb4() + public function convertTablesToUtf8mb4($doDbFixMsg = false) { $db = JFactory::getDbo(); // This is only required for MySQL databases - $name = $db->getName(); + $serverType = $db->getServerType(); - if (stristr($name, 'mysql') === false) + if ($serverType != 'mysql') { return; } - // Check if utf8mb4 is supported and set required conversion status - $utf8mb4Support = false; - - if ($this->serverClaimsUtf8mb4Support($name)) + // Set required conversion status + if ($db->hasUTF8mb4Support()) { - $utf8mb4Support = true; $converted = 2; } else @@ -1710,7 +1723,14 @@ private function convertTablesToUtf8mb4() } catch (Exception $e) { - JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED'), 'error'); + // Render the error message from the Exception object + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + + if ($doDbFixMsg) + { + // Show an error message telling to check database problems + JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED'), 'error'); + } return; } @@ -1757,15 +1777,9 @@ private function convertTablesToUtf8mb4() { foreach ($queries2 as $query2) { - // Downgrade the query if utf8mb4 isn't supported - if (!$utf8mb4Support) - { - $query2 = $this->convertUtf8mb4QueryToUtf8($query2); - } - try { - $db->setQuery($query2)->execute(); + $db->setQuery($db->convertUtf8mb4QueryToUtf8($query2))->execute(); } catch (Exception $e) { @@ -1778,8 +1792,7 @@ private function convertTablesToUtf8mb4() } } - // Show if there was some error - if ($converted == 0) + if ($doDbFixMsg && $converted == 0) { // Show an error message telling to check database problems JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED'), 'error'); @@ -1790,89 +1803,6 @@ private function convertTablesToUtf8mb4() . ' SET ' . $db->quoteName('converted') . ' = ' . $converted . ';')->execute(); } - /** - * Does the database server claim to have support for UTF-8 Multibyte (utf8mb4) collation? - * - * This is a modified version of the function in JDatabase::serverClaimsUtf8mb4Support() - it is - * duplicated here for people upgrading from a version lower than 3.5.0 through extension manager - * which will still have the old database driver loaded at this point. - * - * @param string $format The type of database connection. - * - * @return boolean - * - * @since 3.5.0 - */ - private function serverClaimsUtf8mb4Support($format) - { - $db = JFactory::getDbo(); - - switch ($format) - { - case 'mysql': - $client_version = mysql_get_client_info(); - $server_version = $db->getVersion(); - break; - case 'mysqli': - $client_version = mysqli_get_client_info(); - $server_version = $db->getVersion(); - break; - case 'pdomysql': - $client_version = $db->getOption(PDO::ATTR_CLIENT_VERSION); - $server_version = $db->getOption(PDO::ATTR_SERVER_VERSION); - break; - default: - $client_version = false; - $server_version = false; - } - - if ($client_version && version_compare($server_version, '5.5.3', '>=')) - { - if (strpos($client_version, 'mysqlnd') !== false) - { - $client_version = preg_replace('/^\D+([\d.]+).*/', '$1', $client_version); - - return version_compare($client_version, '5.0.9', '>='); - } - else - { - return version_compare($client_version, '5.5.3', '>='); - } - } - - return false; - } - - /** - * Downgrade a CREATE TABLE or ALTER TABLE query from utf8mb4 (UTF-8 Multibyte) to plain utf8. Used when the server - * doesn't support UTF-8 Multibyte. - * - * This is a modified version of the function in JDatabase::convertUtf8mb4QueryToUtf8() - it is duplicated here for - * people upgrading from a version lower than 3.5.0 through extension manager which will still have the old database - * driver loaded at this point. This is missing the check for utf8mb4 in JDatabaseDriver we make this check in the - * updater elsewhere. - * - * @param string $query The query to convert - * - * @return string The converted query - * - * @since 3.5 - */ - private function convertUtf8mb4QueryToUtf8($query) - { - // If it's not an ALTER TABLE or CREATE TABLE command there's nothing to convert - $beginningOfQuery = substr($query, 0, 12); - $beginningOfQuery = strtoupper($beginningOfQuery); - - if (!in_array($beginningOfQuery, array('ALTER TABLE ', 'CREATE TABLE'))) - { - return $query; - } - - // Replace utf8mb4 with utf8 - return str_replace('utf8mb4', 'utf8', $query); - } - /** * This method clean the Joomla Cache using the method `clean` from the com_cache model * diff --git a/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-10-30.sql b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-10-30.sql index a3fbadebb3..299347e6d5 100644 --- a/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-10-30.sql +++ b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2015-10-30.sql @@ -1 +1 @@ -UPDATE `#__menu` SET `title` = 'com_contact_contacts' WHERE `id` = 8; +UPDATE `#__menu` SET `title` = 'com_contact_contacts' WHERE `client_id` = 1 AND `level` = 2 AND `title` = 'com_contact'; diff --git a/administrator/components/com_admin/sql/updates/mysql/3.5.0-2016-03-01.sql b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2016-03-01.sql index 38ab528a6c..ff8c69105f 100644 --- a/administrator/components/com_admin/sql/updates/mysql/3.5.0-2016-03-01.sql +++ b/administrator/components/com_admin/sql/updates/mysql/3.5.0-2016-03-01.sql @@ -1,5 +1,12 @@ ALTER TABLE `#__redirect_links` DROP INDEX `idx_link_old`; ALTER TABLE `#__redirect_links` MODIFY `old_url` VARCHAR(2048) NOT NULL; -ALTER TABLE `#__redirect_links` MODIFY `new_url` VARCHAR(2048) NOT NULL; + +-- +-- The following statement had to be modified for 3.6.0 by removing the +-- NOT NULL, which was wrong because not consistent with new install. +-- See also 3.6.0-2016-04-06.sql for updating 3.5.0 or 3.5.1 +-- +ALTER TABLE `#__redirect_links` MODIFY `new_url` VARCHAR(2048); + ALTER TABLE `#__redirect_links` MODIFY `referer` VARCHAR(2048) NOT NULL; ALTER TABLE `#__redirect_links` ADD INDEX `idx_old_url` (`old_url`(100)); diff --git a/administrator/components/com_admin/sql/updates/mysql/3.5.2-2016-04-01.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-01.sql similarity index 70% rename from administrator/components/com_admin/sql/updates/mysql/3.5.2-2016-04-01.sql rename to administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-01.sql index 3a607f8bb3..0ac34df324 100644 --- a/administrator/components/com_admin/sql/updates/mysql/3.5.2-2016-04-01.sql +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-01.sql @@ -1,3 +1,7 @@ +-- Rename update site names +UPDATE `#__update_sites` SET `name` = 'Joomla! Core' WHERE `name` = 'Joomla Core' AND `type` = 'collection'; +UPDATE `#__update_sites` SET `name` = 'Joomla! Extension Directory' WHERE `name` = 'Joomla Extension Directory' AND `type` = 'collection'; + UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/core/list.xml' WHERE `name` = 'Joomla! Core' AND `type` = 'collection'; UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/jed/list.xml' WHERE `name` = 'Joomla! Extension Directory' AND `type` = 'collection'; UPDATE `#__update_sites` SET `location` = 'https://update.joomla.org/language/translationlist_3.xml' WHERE `name` = 'Accredited Joomla! Translations' AND `type` = 'collection'; diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-06.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-06.sql new file mode 100644 index 0000000000..e7df517ad4 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-06.sql @@ -0,0 +1 @@ +ALTER TABLE `#__redirect_links` MODIFY `new_url` VARCHAR(2048); diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-08.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-08.sql new file mode 100644 index 0000000000..6714529c32 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-08.sql @@ -0,0 +1,14 @@ +-- Insert the missing en-GB package extension. +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) + VALUES (802, 'English (United Kingdom)', 'package', 'pkg_en-GB', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); + +-- Change update site extension id to the new extension. +UPDATE `#__update_sites_extensions` +SET `extension_id` = 802 +WHERE `update_site_id` IN ( + SELECT `update_site_id` + FROM `#__update_sites` + WHERE `name` = 'Accredited Joomla! Translations' + AND `type` = 'collection' + ) +AND `extension_id` = 600; diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-09.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-09.sql new file mode 100644 index 0000000000..95678415b6 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-04-09.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__menu_types +-- + +ALTER TABLE `#__menu_types` ADD COLUMN `asset_id` INT(11) NOT NULL AFTER `id`; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-05-06.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-05-06.sql new file mode 100644 index 0000000000..a53c9b18e4 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-05-06.sql @@ -0,0 +1,5 @@ +DELETE FROM `#__extensions` WHERE `type` = 'library' AND `element` = 'simplepie'; +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(455, 'plg_installer_packageinstaller', 'plugin', 'packageinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 1, 0), +(456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 2, 0), +(457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 3, 0); diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-01.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-01.sql new file mode 100644 index 0000000000..511d7cbac1 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-01.sql @@ -0,0 +1 @@ +UPDATE `#__extensions` SET `protected` = 1, `enabled` = 1 WHERE `name` = 'com_ajax'; diff --git a/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-05.sql b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-05.sql new file mode 100644 index 0000000000..4fcc47c42f --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.6.0-2016-06-05.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__languages +-- + +ALTER TABLE `#__languages` ADD COLUMN `asset_id` INT(11) NOT NULL AFTER `lang_id`; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-10-30.sql b/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-10-30.sql index ce62b18de2..ae4b418e3b 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-10-30.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/3.5.0-2015-10-30.sql @@ -1 +1 @@ -UPDATE "#__menu" SET "title" = 'com_contact_contacts' WHERE "id" = 8; +UPDATE "#__menu" SET "title" = 'com_contact_contacts' WHERE "client_id" = 1 AND "level" = 2 AND "title" = 'com_contact'; diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.5.2-2016-04-01.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-01.sql similarity index 70% rename from administrator/components/com_admin/sql/updates/postgresql/3.5.2-2016-04-01.sql rename to administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-01.sql index ff3d61ce21..50d35bbd85 100644 --- a/administrator/components/com_admin/sql/updates/postgresql/3.5.2-2016-04-01.sql +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-01.sql @@ -1,3 +1,7 @@ +-- Rename update site names +UPDATE "#__update_sites" SET "name" = 'Joomla! Core' WHERE "name" = 'Joomla Core' AND "type" = 'collection'; +UPDATE "#__update_sites" SET "name" = 'Joomla! Extension Directory' WHERE "name" = 'Joomla Extension Directory' AND "type" = 'collection'; + UPDATE "#__update_sites" SET "location" = 'https://update.joomla.org/core/list.xml' WHERE "name" = 'Joomla! Core' AND "type" = 'collection'; UPDATE "#__update_sites" SET "location" = 'https://update.joomla.org/jed/list.xml' WHERE "name" = 'Joomla! Extension Directory' AND "type" = 'collection'; UPDATE "#__update_sites" SET "location" = 'https://update.joomla.org/language/translationlist_3.xml' WHERE "name" = 'Accredited Joomla! Translations' AND "type" = 'collection'; diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-08.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-08.sql new file mode 100644 index 0000000000..a9b1bfea26 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-08.sql @@ -0,0 +1,12 @@ +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(802, 'English (United Kingdom)', 'package', 'pkg_en-GB', '', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); + +UPDATE "#__update_sites_extensions" +SET "extension_id" = 802 +WHERE "update_site_id" IN ( + SELECT "update_site_id" + FROM "#__update_sites" + WHERE "name" = 'Accredited Joomla! Translations' + AND "type" = 'collection' + ) +AND "extension_id" = 600; diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-09.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-09.sql new file mode 100644 index 0000000000..31b785b059 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-04-09.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__menu_types +-- + +ALTER TABLE "#__menu_types" ADD COLUMN "asset_id" bigint DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-05-06.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-05-06.sql new file mode 100644 index 0000000000..9d58322a88 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-05-06.sql @@ -0,0 +1,6 @@ +DELETE FROM "#__extensions" WHERE "type" = 'library' AND "element" = 'simplepie'; + +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(455, 'plg_installer_packageinstaller', 'plugin', 'packageinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 1, 0), +(456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 2, 0), +(457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 3, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-01.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-01.sql new file mode 100644 index 0000000000..a8c3f145ab --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-01.sql @@ -0,0 +1 @@ +UPDATE "#__extensions" SET "protected" = 1, "enabled" = 1 WHERE "name" = 'com_ajax'; diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-05.sql b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-05.sql new file mode 100644 index 0000000000..3d4aac8976 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.6.0-2016-06-05.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__languages +-- + +ALTER TABLE "#__languages" ADD COLUMN "asset_id" bigint DEFAULT 0 NOT NULL; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-10-30.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-10-30.sql index c652a5057f..48ddf71b98 100644 --- a/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-10-30.sql +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2015-10-30.sql @@ -1 +1 @@ -UPDATE [#__menu] SET [title] = 'com_contact_contacts' WHERE [id] = 8; +UPDATE [#__menu] SET [title] = 'com_contact_contacts' WHERE [client_id] = 1 AND [level] = 2 AND [title] = 'com_contact'; diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2016-03-01.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2016-03-01.sql index e0a8f66108..898025eaf9 100644 --- a/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2016-03-01.sql +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.5.0-2016-03-01.sql @@ -1,6 +1,13 @@ ALTER TABLE [#__redirect_links] DROP CONSTRAINT [#__redirect_links$idx_link_old]; ALTER TABLE [#__redirect_links] ALTER COLUMN [old_url] [nvarchar](2048) NOT NULL; -ALTER TABLE [#__redirect_links] ALTER COLUMN [new_url] [nvarchar](2048) NOT NULL; + +-- +-- The following statement had to be modified for 3.6.0 by removing the +-- NOT NULL, which was wrong because not consistent with new install. +-- See also 3.6.0-2016-04-06.sql for updating 3.5.0 or 3.5.1 +-- +ALTER TABLE [#__redirect_links] ALTER COLUMN [new_url] [nvarchar](2048); + ALTER TABLE [#__redirect_links] ALTER COLUMN [referer] [nvarchar](2048) NOT NULL; CREATE NONCLUSTERED INDEX [idx_old_url] ON [#__redirect_links] ( diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.5.2-2016-04-01.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-01.sql similarity index 70% rename from administrator/components/com_admin/sql/updates/sqlazure/3.5.2-2016-04-01.sql rename to administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-01.sql index 59d5fb4c38..45dcf467e5 100644 --- a/administrator/components/com_admin/sql/updates/sqlazure/3.5.2-2016-04-01.sql +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-01.sql @@ -1,3 +1,7 @@ +-- Rename update site names +UPDATE [#__update_sites] SET [name] = 'Joomla! Core' WHERE [name] = 'Joomla Core' AND [type] = 'collection'; +UPDATE [#__update_sites] SET [name] = 'Joomla! Extension Directory' WHERE [name] = 'Joomla Extension Directory' AND [type] = 'collection'; + UPDATE [#__update_sites] SET [location] = 'https://update.joomla.org/core/list.xml' WHERE [name] = 'Joomla! Core' AND [type] = 'collection'; UPDATE [#__update_sites] SET [location] = 'https://update.joomla.org/jed/list.xml' WHERE [name] = 'Joomla! Extension Directory' AND [type] = 'collection'; UPDATE [#__update_sites] SET [location] = 'https://update.joomla.org/language/translationlist_3.xml' WHERE [name] = 'Accredited Joomla! Translations' AND [type] = 'collection'; diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-06.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-06.sql new file mode 100644 index 0000000000..fe7dc8e6b9 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-06.sql @@ -0,0 +1 @@ +ALTER TABLE [#__redirect_links] ALTER COLUMN [new_url] [nvarchar](2048); diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-08.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-08.sql new file mode 100644 index 0000000000..c900ed2e98 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-08.sql @@ -0,0 +1,16 @@ +SET IDENTITY_INSERT [#__extensions] ON; + +INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) +SELECT 802, 'English (United Kingdom)', 'package', 'pkg_en-GB', '', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0; + +SET IDENTITY_INSERT [#__extensions] OFF; + +UPDATE [#__update_sites_extensions] +SET [extension_id] = 802 +WHERE [update_site_id] IN ( + SELECT [update_site_id] + FROM [#__update_sites] + WHERE [name] = 'Accredited Joomla! Translations' + AND [type] = 'collection' + ) +AND [extension_id] = 600; diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-09.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-09.sql new file mode 100644 index 0000000000..33fab71ec6 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-04-09.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__menu_types +-- + +ALTER TABLE [#__menu_types] ADD [asset_id] [bigint] NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-05-06.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-05-06.sql new file mode 100644 index 0000000000..481dc74ae0 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-05-06.sql @@ -0,0 +1,11 @@ +DELETE FROM [#__extensions] WHERE [type] = "library" AND [element] = "simplepie"; +SET IDENTITY_INSERT #__extensions ON; + +INSERT INTO #__extensions ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state]) +SELECT 455, 'plg_installer_packageinstaller', 'plugin', 'packageinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 1, 0 +UNION ALL +SELECT 456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 2, 0 +UNION ALL +SELECT 457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 3, 0; + +SET IDENTITY_INSERT #__extensions OFF; \ No newline at end of file diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-01.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-01.sql new file mode 100644 index 0000000000..3a547b5537 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-01.sql @@ -0,0 +1 @@ +UPDATE [#__extensions] SET [protected] = 1, [enabled] = 1 WHERE [name] = 'com_ajax'; diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-05.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-05.sql new file mode 100644 index 0000000000..9355db71a3 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.6.0-2016-06-05.sql @@ -0,0 +1,5 @@ +-- +-- Add ACL check for to #__languages +-- + +ALTER TABLE [#__languages] ADD [asset_id] [bigint] NOT NULL DEFAULT 0; \ No newline at end of file diff --git a/administrator/components/com_admin/views/help/view.html.php b/administrator/components/com_admin/views/help/view.html.php index ea30135a52..c24445530c 100644 --- a/administrator/components/com_admin/views/help/view.html.php +++ b/administrator/components/com_admin/views/help/view.html.php @@ -69,7 +69,7 @@ class AdminViewHelp extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_admin/views/profile/tmpl/edit.php b/administrator/components/com_admin/views/profile/tmpl/edit.php index 1e75bf73e8..7e7c15d950 100644 --- a/administrator/components/com_admin/views/profile/tmpl/edit.php +++ b/administrator/components/com_admin/views/profile/tmpl/edit.php @@ -34,7 +34,7 @@
'account')); ?> - + form->getFieldset('user_details') as $field) : ?>
label; ?>
diff --git a/administrator/components/com_admin/views/profile/view.html.php b/administrator/components/com_admin/views/profile/view.html.php index 88a556cfaa..1599098639 100644 --- a/administrator/components/com_admin/views/profile/view.html.php +++ b/administrator/components/com_admin/views/profile/view.html.php @@ -45,7 +45,7 @@ class AdminViewProfile extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_admin/views/sysinfo/tmpl/default.php b/administrator/components/com_admin/views/sysinfo/tmpl/default.php index 0cc9d6a344..301b38be75 100644 --- a/administrator/components/com_admin/views/sysinfo/tmpl/default.php +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default.php @@ -19,23 +19,23 @@
'site')); ?> - + loadTemplate('system'); ?> - + loadTemplate('phpsettings'); ?> - + loadTemplate('config'); ?> - + loadTemplate('directory'); ?> - + loadTemplate('phpinfo'); ?> diff --git a/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php index 359622981a..41c6db9e28 100644 --- a/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php @@ -105,7 +105,7 @@ - info['useragent']); ?> + info['useragent'], ENT_COMPAT, 'UTF-8'); ?> diff --git a/administrator/components/com_admin/views/sysinfo/view.html.php b/administrator/components/com_admin/views/sysinfo/view.html.php index ea3f5d2b0a..ca49f48397 100644 --- a/administrator/components/com_admin/views/sysinfo/view.html.php +++ b/administrator/components/com_admin/views/sysinfo/view.html.php @@ -61,7 +61,7 @@ class AdminViewSysinfo extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_admin/views/sysinfo/view.json.php b/administrator/components/com_admin/views/sysinfo/view.json.php index ac787f1bb2..f13a8f766b 100644 --- a/administrator/components/com_admin/views/sysinfo/view.json.php +++ b/administrator/components/com_admin/views/sysinfo/view.json.php @@ -21,7 +21,7 @@ class AdminViewSysinfo extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 3.5 */ diff --git a/administrator/components/com_admin/views/sysinfo/view.text.php b/administrator/components/com_admin/views/sysinfo/view.text.php index e71c9bf622..bab9fcdc3b 100644 --- a/administrator/components/com_admin/views/sysinfo/view.text.php +++ b/administrator/components/com_admin/views/sysinfo/view.text.php @@ -21,7 +21,7 @@ class AdminViewSysinfo extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 3.5 */ diff --git a/administrator/components/com_banners/access.xml b/administrator/components/com_banners/access.xml index 7f3ace116e..d81db5fbe7 100644 --- a/administrator/components/com_banners/access.xml +++ b/administrator/components/com_banners/access.xml @@ -1,18 +1,72 @@
- - - - - - - + + + + + + + + + + + + + +
- - - - + + + + + + +
diff --git a/administrator/components/com_banners/banners.xml b/administrator/components/com_banners/banners.xml index bcb02355da..2769e45714 100644 --- a/administrator/components/com_banners/banners.xml +++ b/administrator/components/com_banners/banners.xml @@ -35,14 +35,38 @@ Note that all & must be escaped to & for the file to be valid XML and be parsed by the installer --> - com_banners_banners - com_banners_categories - com_banners_clients - com_banners_tracks + + com_banners_banners + + + com_banners_categories + + + com_banners_clients + + + com_banners_tracks + access.xml diff --git a/administrator/components/com_banners/config.xml b/administrator/components/com_banners/config.xml index 2c9f298c95..c81c7627c4 100644 --- a/administrator/components/com_banners/config.xml +++ b/administrator/components/com_banners/config.xml @@ -1,48 +1,46 @@ -
+ description="COM_BANNERS_FIELDSET_CONFIG_CLIENT_OPTIONS_DESC" + > + - - - - - + + + + + - - + > + + + > @@ -51,34 +49,35 @@ name="metakey_prefix" type="text" label="COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL" - description="COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC" /> - + description="COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC" + />
-
- + description="COM_BANNERS_FIELDSET_CONFIG_BANNER_OPTIONS_DESC" + > + - - + + - +
@@ -95,6 +94,7 @@ filter="rules" validate="rules" component="com_banners" - section="component" /> + section="component" + />
diff --git a/administrator/components/com_banners/models/banner.php b/administrator/components/com_banners/models/banner.php index be1048ac96..16e3b8e6cb 100644 --- a/administrator/components/com_banners/models/banner.php +++ b/administrator/components/com_banners/models/banner.php @@ -358,7 +358,7 @@ protected function loadFormData() // Prime some default values. if ($this->getState('banner.id') == 0) { - $filters = (array) $app->getUserState('com_banners.banners.filter'); + $filters = (array) $app->getUserState('com_banners.banners.filter'); $filterCatId = isset($filters['category_id']) ? $filters['category_id'] : null; $data->set('catid', $app->input->getInt('catid', $filterCatId)); @@ -486,6 +486,31 @@ public function save($data) { $input = JFactory::getApplication()->input; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_banners'); + } + + // Save New Category + if ($catid == 0) + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = 'com_banners'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + // Alter the name for save as copy if ($input->get('task') == 'save2copy') { @@ -496,8 +521,8 @@ public function save($data) if ($data['name'] == $origTable->name) { list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']); - $data['name'] = $name; - $data['alias'] = $alias; + $data['name'] = $name; + $data['alias'] = $alias; } else { diff --git a/administrator/components/com_banners/models/banners.php b/administrator/components/com_banners/models/banners.php index dd675b1687..52ecdd2a5d 100644 --- a/administrator/components/com_banners/models/banners.php +++ b/administrator/components/com_banners/models/banners.php @@ -49,6 +49,7 @@ public function __construct($config = array()) 'client_id', 'category_id', 'published', + 'level', 'c.level', ); } @@ -95,53 +96,54 @@ protected function getListQuery() $query->select( $this->getState( 'list.select', - 'a.id AS id,' . - 'a.name AS name,' . - 'a.alias AS alias,' . - 'a.checked_out AS checked_out,' . - 'a.checked_out_time AS checked_out_time,' . - 'a.catid AS catid,' . - 'a.clicks AS clicks,' . - 'a.metakey AS metakey,' . - 'a.sticky AS sticky,' . - 'a.impmade AS impmade,' . - 'a.imptotal AS imptotal,' . - 'a.state AS state,' . - 'a.ordering AS ordering,' . - 'a.purchase_type AS purchase_type,' . - 'a.language,' . - 'a.publish_up,' . - 'a.publish_down' + 'a.id AS id,' + . 'a.name AS name,' + . 'a.alias AS alias,' + . 'a.checked_out AS checked_out,' + . 'a.checked_out_time AS checked_out_time,' + . 'a.catid AS catid,' + . 'a.clicks AS clicks,' + . 'a.metakey AS metakey,' + . 'a.sticky AS sticky,' + . 'a.impmade AS impmade,' + . 'a.imptotal AS imptotal,' + . 'a.state AS state,' + . 'a.ordering AS ordering,' + . 'a.purchase_type AS purchase_type,' + . 'a.language,' + . 'a.publish_up,' + . 'a.publish_down' ) ); - $query->from($db->quoteName('#__banners') . ' AS a'); + $query->from($db->quoteName('#__banners', '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'); + ->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON l.lang_code = 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 uc.id = a.checked_out'); // Join over the categories. - $query->select('c.title AS category_title') - ->join('LEFT', '#__categories AS c ON c.id = a.catid'); + $query->select($db->quoteName('c.title', 'category_title')) + ->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON c.id = a.catid'); // Join over the clients. - $query->select('cl.name AS client_name,cl.purchase_type as client_purchase_type') - ->join('LEFT', '#__banner_clients AS cl ON cl.id = a.cid'); + $query->select($db->quoteName('cl.name', 'client_name')) + ->select($db->quoteName('cl.purchase_type', 'client_purchase_type')) + ->join('LEFT', $db->quoteName('#__banner_clients', 'cl') . ' ON cl.id = a.cid'); // Filter by published 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. @@ -149,7 +151,7 @@ protected function getListQuery() if (is_numeric($categoryId)) { - $query->where('a.catid = ' . (int) $categoryId); + $query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId); } // Filter by client. @@ -157,7 +159,7 @@ protected function getListQuery() if (is_numeric($clientId)) { - $query->where('a.cid = ' . (int) $clientId); + $query->where($db->quoteName('a.cid') . ' = ' . (int) $clientId); } // Filter by search in title @@ -167,7 +169,7 @@ protected function getListQuery() { if (stripos($search, 'id:') === 0) { - $query->where('a.id = ' . (int) substr($search, 3)); + $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } else { @@ -179,14 +181,20 @@ protected function getListQuery() // 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)); + } + + // Filter on the level. + if ($level = $this->getState('filter.level')) + { + $query->where($db->quoteName('c.level') . ' <= ' . (int) $level); } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'ordering'); + $orderCol = $this->state->get('list.ordering', 'a.name'); $orderDirn = $this->state->get('list.direction', 'ASC'); - if ($orderCol == 'ordering' || $orderCol == 'category_title') + if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = 'c.title ' . $orderDirn . ', a.ordering'; } @@ -220,7 +228,9 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.category_id'); + $id .= ':' . $this->getState('filter.client_id'); $id .= ':' . $this->getState('filter.language'); + $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } @@ -256,11 +266,12 @@ public function getTable($type = 'Banner', $prefix = 'BannersTable', $config = a protected function populateState($ordering = 'a.name', $direction = 'asc') { // Load the filter state. - $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search')); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $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', '')); - $this->setState('filter.client_id', $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '')); - $this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '')); + $this->setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd')); + $this->setState('filter.client_id', $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '', 'cmd')); + $this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '', 'string')); + $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); // Load the parameters. $this->setState('params', JComponentHelper::getParams('com_banners')); diff --git a/administrator/components/com_banners/models/clients.php b/administrator/components/com_banners/models/clients.php index 34594a3fa3..81d483a8ca 100644 --- a/administrator/components/com_banners/models/clients.php +++ b/administrator/components/com_banners/models/clients.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Methods supporting a list of banner records. * @@ -35,8 +37,7 @@ public function __construct($config = array()) 'state', 'a.state', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', - 'nbanners', - 'purchase_type' + 'purchase_type', 'a.purchase_type' ); } @@ -58,8 +59,9 @@ public function __construct($config = array()) protected function populateState($ordering = 'a.name', $direction = 'asc') { // Load the filter state. - $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search')); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string')); + $this->setState('filter.purchase_type', $this->getUserStateFromRequest($this->context . '.filter.purchase_type', 'filter_purchase_type')); // Load the parameters. $this->setState('params', JComponentHelper::getParams('com_banners')); @@ -83,8 +85,8 @@ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.state'); + $id .= ':' . $this->getState('filter.purchase_type'); return parent::getStoreId($id); } @@ -97,7 +99,7 @@ protected function getStoreId($id = '') protected function getListQuery() { // Create a new query object. - $db = $this->getDbo(); + $db = $this->getDbo(); $query = $db->getQuery(true); $defaultPurchase = JComponentHelper::getParams('com_banners')->get('purchase_type', 3); @@ -106,14 +108,14 @@ protected function getListQuery() $query->select( $this->getState( 'list.select', - 'a.id AS id,' . - 'a.name AS name,' . - 'a.contact AS contact,' . - 'a.checked_out AS checked_out,' . - 'a.checked_out_time AS checked_out_time, ' . - 'a.state AS state,' . - 'a.metakey AS metakey,' . - 'a.purchase_type as purchase_type' + 'a.id AS id,' + . 'a.name AS name,' + . 'a.contact AS contact,' + . 'a.checked_out AS checked_out,' + . 'a.checked_out_time AS checked_out_time, ' + . 'a.state AS state,' + . 'a.metakey AS metakey,' + . 'a.purchase_type as purchase_type' ) ); @@ -172,16 +174,136 @@ protected function getListQuery() } } - $ordering = $this->getState('list.ordering', 'ordering'); + // Add the list ordering clause. + $query->order($db->escape($this->getState('list.ordering', 'a.name')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); + + return $query; + } + + /** + * Overrides the getItems method to attach additional metrics to the list. + * + * @return mixed An array of data items on success, false on failure. + * + * @since 3.6 + */ + public function getItems() + { + // Get a storage key. + $store = $this->getStoreId('getItems'); - if ($ordering == 'nbanners') + // Try to load the data from internal storage. + if (!empty($this->cache[$store])) { - $ordering = 'COUNT(b.id)'; + return $this->cache[$store]; } - // Add the list ordering clause. - $query->order($db->escape($ordering) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); + // Load the list items. + $items = parent::getItems(); - return $query; + // If emtpy or an error, just return. + if (empty($items)) + { + return array(); + } + + // Getting the following metric by joins is WAY TOO SLOW. + // Faster to do three queries for very large banner trees. + + // Get the clients in the list. + $db = $this->getDbo(); + $clientIds = ArrayHelper::getColumn($items, 'id'); + + // Quote the strings. + $clientIds = implode( + ',', + array_map(array($db, 'quote'), $clientIds) + ); + + // Get the published banners count. + $query = $db->getQuery(true) + ->select('cid, COUNT(cid) AS count_published') + ->from('#__banners') + ->where('state = 1') + ->where('cid IN (' . $clientIds . ')') + ->group('cid'); + + $db->setQuery($query); + + try + { + $countPublished = $db->loadAssocList('cid', 'count_published'); + } + catch (RuntimeException $e) + { + $this->setError($e->getMessage()); + + return false; + } + + // Get the unpublished banners count. + $query->clear('where') + ->where('state = 0') + ->where('cid IN (' . $clientIds . ')'); + $db->setQuery($query); + + try + { + $countUnpublished = $db->loadAssocList('cid', 'count_published'); + } + catch (RuntimeException $e) + { + $this->setError($e->getMessage()); + + return false; + } + + // Get the trashed banners count. + $query->clear('where') + ->where('state = -2') + ->where('cid IN (' . $clientIds . ')'); + $db->setQuery($query); + + try + { + $countTrashed = $db->loadAssocList('cid', 'count_published'); + } + catch (RuntimeException $e) + { + $this->setError($e->getMessage()); + + return false; + } + + // Get the archived banners count. + $query->clear('where') + ->where('state = 2') + ->where('cid IN (' . $clientIds . ')'); + $db->setQuery($query); + + try + { + $countArchived = $db->loadAssocList('cid', 'count_published'); + } + catch (RuntimeException $e) + { + $this->setError($e->getMessage()); + + return false; + } + + // Inject the values back into the array. + foreach ($items as $item) + { + $item->count_published = isset($countPublished[$item->id]) ? $countPublished[$item->id] : 0; + $item->count_unpublished = isset($countUnpublished[$item->id]) ? $countUnpublished[$item->id] : 0; + $item->count_trashed = isset($countTrashed[$item->id]) ? $countTrashed[$item->id] : 0; + $item->count_archived = isset($countArchived[$item->id]) ? $countArchived[$item->id] : 0; + } + + // Add the items to the internal cache. + $this->cache[$store] = $items; + + return $this->cache[$store]; } } diff --git a/administrator/components/com_banners/models/forms/banner.xml b/administrator/components/com_banners/models/forms/banner.xml index b4d5607f64..0a6cc912ca 100644 --- a/administrator/components/com_banners/models/forms/banner.xml +++ b/administrator/components/com_banners/models/forms/banner.xml @@ -1,221 +1,376 @@ -
+
- + - + size="40" + required="true" + /> - + size="40" + hint="JFIELD_ALIAS_PLACEHOLDER" + /> - + addfieldpath="/administrator/components/com_categories/models/fields" + allowAdd="true" + default="" + /> - + size="1" + default="1" + > - + table="#__banners" + /> - + - - + - - - + + + - + - +
-
+
- + - + - + - + - + filter="unset" + /> - + - + - +
-
+
- + default="0" + class="btn-group btn-group-yesno" + >
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + description="COM_BANNERS_FIELD_TRACKIMPRESSION_DESC" + default="0" + > + - - + +
-
+
- + - + class="btn-group btn-group-yesno" + default="0" + > - + description="COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC" + />
- - - - - - - + /> + + + + + +
- +
diff --git a/administrator/components/com_banners/models/forms/client.xml b/administrator/components/com_banners/models/forms/client.xml index 0ff3a5bedb..d568ab1aee 100644 --- a/administrator/components/com_banners/models/forms/client.xml +++ b/administrator/components/com_banners/models/forms/client.xml @@ -1,38 +1,62 @@
-
- +
+ - + class="input-xxlarge input-large-text" + size="40" + required="true" + /> - + - + - + - - - - - - - - + > + + + + + + - + default="0" + class="chzn-color" + > - + > @@ -80,36 +108,45 @@
-
- - +
+ - + > - - + description="COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_DESC" + />
- - - + rows="5" + cols="80" + />
diff --git a/administrator/components/com_banners/models/forms/download.xml b/administrator/components/com_banners/models/forms/download.xml index 688c8a129d..fbaed4e8e8 100644 --- a/administrator/components/com_banners/models/forms/download.xml +++ b/administrator/components/com_banners/models/forms/download.xml @@ -1,19 +1,24 @@
- - + > - - + />
diff --git a/administrator/components/com_banners/models/forms/filter_banners.xml b/administrator/components/com_banners/models/forms/filter_banners.xml index d9a85cdc9c..5ef151967f 100644 --- a/administrator/components/com_banners/models/forms/filter_banners.xml +++ b/administrator/components/com_banners/models/forms/filter_banners.xml @@ -4,11 +4,11 @@ + + + + JOPTION_SELECT_LANGUAGE + + + + - - + + @@ -81,13 +98,14 @@ + diff --git a/administrator/components/com_banners/models/forms/filter_clients.xml b/administrator/components/com_banners/models/forms/filter_clients.xml index 83f7b1fdbb..1552335b63 100644 --- a/administrator/components/com_banners/models/forms/filter_clients.xml +++ b/administrator/components/com_banners/models/forms/filter_clients.xml @@ -4,11 +4,11 @@ + - + > @@ -37,8 +40,8 @@ name="fullordering" type="list" label="JGLOBAL_SORT_BY" - statuses="*,0,1,2,-2" description="JGLOBAL_SORT_BY" + statuses="*,0,1,2,-2" onchange="this.form.submit();" default="a.name ASC" > @@ -47,22 +50,21 @@ - - - - - - + + + + + diff --git a/administrator/components/com_banners/models/forms/filter_tracks.xml b/administrator/components/com_banners/models/forms/filter_tracks.xml index 462fdacaf5..a3cd61f8ad 100644 --- a/administrator/components/com_banners/models/forms/filter_tracks.xml +++ b/administrator/components/com_banners/models/forms/filter_tracks.xml @@ -4,10 +4,11 @@ + + + COM_BANNERS_TYPE1 + + + + + + JDATE_ASC + setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd')); $this->setState('filter.client_id', $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '', 'cmd')); $this->setState('filter.type', $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'cmd')); + $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); $this->setState('filter.begin', $this->getUserStateFromRequest($this->context . '.filter.begin', 'filter_begin', '', 'string')); $this->setState('filter.end', $this->getUserStateFromRequest($this->context . '.filter.end', 'filter_end', '', 'string')); @@ -97,7 +99,7 @@ protected function getListQuery() $query->select($db->quoteName(array('a.track_date', 'a.track_type', 'a.count'))) ->select($db->quoteName('b.name', 'banner_name')) ->select($db->quoteName('cl.name', 'client_name')) - ->select($db->quoteName('cat.title', 'category_title')); + ->select($db->quoteName('c.title', 'category_title')); // From tracks table. $query->from($db->quoteName('#__banner_tracks', 'a')); @@ -109,7 +111,7 @@ protected function getListQuery() $query->join('LEFT', $db->quoteName('#__banner_clients', 'cl') . ' ON ' . $db->quoteName('cl.id') . ' = ' . $db->quoteName('b.cid')); // Join with the category. - $query->join('LEFT', $db->quoteName('#__categories', 'cat') . ' ON ' . $db->quoteName('cat.id') . ' = ' . $db->quoteName('b.catid')); + $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('b.catid')); // Filter by type. $type = $this->getState('filter.type'); @@ -152,6 +154,12 @@ protected function getListQuery() $query->where($db->quoteName('a.track_date') . ' <= ' . $db->quote($end)); } + // Filter on the level. + if ($level = $this->getState('filter.level')) + { + $query->where($db->quoteName('c.level') . ' <= ' . (int) $level); + } + // Filter by search in banner name or client name. $search = $this->getState('filter.search'); @@ -190,7 +198,7 @@ public function delete() if ($allow) { // Delete tracks from this banner - $db = $this->getDbo(); + $db = $this->getDbo(); $query = $db->getQuery(true) ->delete($db->quoteName('#__banner_tracks')); @@ -366,7 +374,7 @@ protected function getCategoryName() if ($categoryId) { - $db = $this->getDbo(); + $db = $this->getDbo(); $query = $db->getQuery(true) ->select('title') ->from($db->quoteName('#__categories')) @@ -403,7 +411,7 @@ protected function getClientName() if ($clientId) { - $db = $this->getDbo(); + $db = $this->getDbo(); $query = $db->getQuery(true) ->select('name') ->from($db->quoteName('#__banner_clients')) @@ -462,21 +470,21 @@ public function getContent() { if (!isset($this->content)) { - $this->content = '"' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_NAME')) . '","' . - str_replace('"', '""', JText::_('COM_BANNERS_HEADING_CLIENT')) . '","' . - str_replace('"', '""', JText::_('JCATEGORY')) . '","' . - str_replace('"', '""', JText::_('COM_BANNERS_HEADING_TYPE')) . '","' . - str_replace('"', '""', JText::_('COM_BANNERS_HEADING_COUNT')) . '","' . - str_replace('"', '""', JText::_('JDATE')) . '"' . "\n"; + $this->content = '"' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_NAME')) . '","' + . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_CLIENT')) . '","' + . str_replace('"', '""', JText::_('JCATEGORY')) . '","' + . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_TYPE')) . '","' + . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_COUNT')) . '","' + . str_replace('"', '""', JText::_('JDATE')) . '"' . "\n"; foreach ($this->getItems() as $item) { - $this->content .= '"' . str_replace('"', '""', $item->name) . '","' . - str_replace('"', '""', $item->client_name) . '","' . - str_replace('"', '""', $item->category_title) . '","' . - str_replace('"', '""', ($item->track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION') : JText::_('COM_BANNERS_CLICK'))) . '","' . - str_replace('"', '""', $item->count) . '","' . - str_replace('"', '""', $item->track_date) . '"' . "\n"; + $this->content .= '"' . str_replace('"', '""', $item->name) . '","' + . str_replace('"', '""', $item->client_name) . '","' + . str_replace('"', '""', $item->category_title) . '","' + . str_replace('"', '""', ($item->track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION') : JText::_('COM_BANNERS_CLICK'))) . '","' + . str_replace('"', '""', $item->count) . '","' + . str_replace('"', '""', $item->track_date) . '"' . "\n"; } if ($this->getState('compressed')) diff --git a/administrator/components/com_banners/tables/banner.php b/administrator/components/com_banners/tables/banner.php index f853ec9b76..dfa2ab822c 100644 --- a/administrator/components/com_banners/tables/banner.php +++ b/administrator/components/com_banners/tables/banner.php @@ -65,11 +65,16 @@ public function check() $this->name = htmlspecialchars_decode($this->name, ENT_QUOTES); // Set alias - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + if (trim($this->alias) == '') + { + $this->alias = $this->name; + } + + $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language); - if (empty($this->alias)) + if (trim(str_replace('-', '', $this->alias)) == '') { - $this->alias = JApplicationHelper::stringURLSafe($this->name); + $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); } // Check the publish down date is not earlier than publish up. diff --git a/administrator/components/com_banners/tables/client.php b/administrator/components/com_banners/tables/client.php index ae0e62f1fe..998e63d878 100644 --- a/administrator/components/com_banners/tables/client.php +++ b/administrator/components/com_banners/tables/client.php @@ -86,10 +86,10 @@ public function publish($pks = null, $state = 1, $userId = 0) // Update the publishing state for rows with the given primary keys. $this->_db->setQuery( - 'UPDATE ' . $this->_db->quoteName($this->_tbl) . - ' SET ' . $this->_db->quoteName('state') . ' = ' . (int) $state . - ' WHERE (' . $where . ')' . - $checkin + 'UPDATE ' . $this->_db->quoteName($this->_tbl) + . ' SET ' . $this->_db->quoteName('state') . ' = ' . (int) $state + . ' WHERE (' . $where . ')' + . $checkin ); try diff --git a/administrator/components/com_banners/views/banner/tmpl/edit.php b/administrator/components/com_banners/views/banner/tmpl/edit.php index 2a16281941..4c299b4588 100644 --- a/administrator/components/com_banners/views/banner/tmpl/edit.php +++ b/administrator/components/com_banners/views/banner/tmpl/edit.php @@ -11,7 +11,7 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) @@ -23,12 +23,12 @@ }; jQuery(document).ready(function ($){ $("#jform_type").on("change", function (a, params) { - + var v = typeof(params) !== "object" ? $("#jform_type").val() : params.selected; - + var img_url = $("#image, #url"); var custom = $("#custom"); - + switch (v) { case "0": // Image @@ -53,7 +53,7 @@
'details')); ?> - +
form->getControlGroup('type'); ?> @@ -74,11 +74,11 @@
- + form->getControlGroups('otherparams'); ?> - +
diff --git a/administrator/components/com_banners/views/banner/view.html.php b/administrator/components/com_banners/views/banner/view.html.php index e6c289e23f..3c522f4369 100644 --- a/administrator/components/com_banners/views/banner/view.html.php +++ b/administrator/components/com_banners/views/banner/view.html.php @@ -44,7 +44,7 @@ class BannersViewBanner extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_banners/views/banners/tmpl/default.php b/administrator/components/com_banners/views/banners/tmpl/default.php index 0c8054c753..a87a929e44 100644 --- a/administrator/components/com_banners/views/banners/tmpl/default.php +++ b/administrator/components/com_banners/views/banners/tmpl/default.php @@ -20,8 +20,6 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $canOrder = $user->authorise('core.edit.state', 'com_banners.category'); -$archived = $this->state->get('filter.state') == 2 ? true : false; -$trashed = $this->state->get('filter.state') == -2 ? true : false; $saveOrder = $listOrder == 'a.ordering'; if ($saveOrder) @@ -30,7 +28,6 @@ JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } ?> -
sidebar; ?> @@ -100,6 +97,7 @@
state, $i, 'banners.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - escape($item->name)); + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'banners'); + JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'banners'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); + } ?>
diff --git a/administrator/components/com_banners/views/client/tmpl/edit.php b/administrator/components/com_banners/views/client/tmpl/edit.php index 172c0bc4cb..267cb45d17 100644 --- a/administrator/components/com_banners/views/client/tmpl/edit.php +++ b/administrator/components/com_banners/views/client/tmpl/edit.php @@ -31,7 +31,7 @@
'general')); ?> - item->id) ? JText::_('COM_BANNERS_NEW_CLIENT', true) : JText::_('COM_BANNERS_EDIT_CLIENT', true)); ?> + item->id) ? JText::_('COM_BANNERS_NEW_CLIENT') : JText::_('COM_BANNERS_EDIT_CLIENT')); ?>
- + form->getControlGroups('metadata'); ?> diff --git a/administrator/components/com_banners/views/client/view.html.php b/administrator/components/com_banners/views/client/view.html.php index cc3e9f6b73..2d03c7b037 100644 --- a/administrator/components/com_banners/views/client/view.html.php +++ b/administrator/components/com_banners/views/client/view.html.php @@ -51,7 +51,7 @@ class BannersViewClient extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_banners/views/clients/tmpl/default.php b/administrator/components/com_banners/views/clients/tmpl/default.php index 8449a6ad38..3fc6d49893 100644 --- a/administrator/components/com_banners/views/clients/tmpl/default.php +++ b/administrator/components/com_banners/views/clients/tmpl/default.php @@ -20,10 +20,7 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $params = (isset($this->state->params)) ? $this->state->params : new JObject; -$archived = $this->state->get('filter.state') == 2 ? true : false; -$trashed = $this->state->get('filter.state') == -2 ? true : false; ?> -
sidebar; ?> @@ -51,13 +48,22 @@ - + + + + + + + - - + + + + + - + @@ -66,7 +72,7 @@ - + pagination->getListFooter(); ?> @@ -85,16 +91,14 @@
state, $i, 'clients.', $canChange); ?> - escape($item->name)); + if ($canChange) + { + JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'clients'); + JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'clients'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); + } ?>
@@ -114,8 +118,21 @@ contact; ?> - - nbanners; ?> + + " href="id . '&filter[published]=1'); ?>"> + count_published; ?> + + + " href="id . '&filter[published]=0'); ?>"> + count_unpublished; ?> + + + " href="id . '&filter[published]=2'); ?>"> + count_archived; ?> + + + " href="id . '&filter[published]=-2'); ?>"> + count_trashed; ?> purchase_type < 0): ?> diff --git a/administrator/components/com_banners/views/clients/view.html.php b/administrator/components/com_banners/views/clients/view.html.php index c5f7e0e3a3..29f4b8aa4b 100644 --- a/administrator/components/com_banners/views/clients/view.html.php +++ b/administrator/components/com_banners/views/clients/view.html.php @@ -44,7 +44,7 @@ class BannersViewClients extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -128,12 +128,12 @@ protected function addToolbar() protected function getSortFields() { return array( - 'a.status' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), - 'contact' => JText::_('COM_BANNERS_HEADING_CONTACT'), + 'a.status' => JText::_('JSTATUS'), + 'a.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), + 'contact' => JText::_('COM_BANNERS_HEADING_CONTACT'), 'client_name' => JText::_('COM_BANNERS_HEADING_CLIENT'), - 'nbanners' => JText::_('COM_BANNERS_HEADING_ACTIVE'), - 'a.id' => JText::_('JGRID_HEADING_ID') + 'nbanners' => JText::_('COM_BANNERS_HEADING_ACTIVE'), + 'a.id' => JText::_('JGRID_HEADING_ID') ); } } diff --git a/administrator/components/com_banners/views/download/view.html.php b/administrator/components/com_banners/views/download/view.html.php index 3066e0c966..407370c0d5 100644 --- a/administrator/components/com_banners/views/download/view.html.php +++ b/administrator/components/com_banners/views/download/view.html.php @@ -28,7 +28,7 @@ class BannersViewDownload extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_banners/views/tracks/view.html.php b/administrator/components/com_banners/views/tracks/view.html.php index 77dbf721a1..0135cafaa5 100644 --- a/administrator/components/com_banners/views/tracks/view.html.php +++ b/administrator/components/com_banners/views/tracks/view.html.php @@ -44,7 +44,7 @@ class BannersViewTracks extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -104,7 +104,6 @@ protected function addToolbar() JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_TRACKS'); JHtmlSidebar::setAction('index.php?option=com_banners&view=tracks'); - } /** @@ -117,10 +116,10 @@ protected function addToolbar() protected function getSortFields() { return array( - 'b.name' => JText::_('COM_BANNERS_HEADING_NAME'), - 'cl.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), + 'b.name' => JText::_('COM_BANNERS_HEADING_NAME'), + 'cl.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), 'track_type' => JText::_('COM_BANNERS_HEADING_TYPE'), - 'count' => JText::_('COM_BANNERS_HEADING_COUNT'), + 'count' => JText::_('COM_BANNERS_HEADING_COUNT'), 'track_date' => JText::_('JDATE') ); } diff --git a/administrator/components/com_cache/controller.php b/administrator/components/com_cache/controller.php index b5db29dc36..24854f3407 100644 --- a/administrator/components/com_cache/controller.php +++ b/administrator/components/com_cache/controller.php @@ -96,6 +96,44 @@ public function delete() $this->setRedirect('index.php?option=com_cache'); } + /** + * Method to delete all cache groups. + * + * @return void + * + * @since 3.6.0 + */ + public function deleteAll() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $app = JFactory::getApplication(); + $model = $this->getModel('cache'); + $data = $model->getCache()->getAll(); + $allCleared = true; + + foreach ($data as $cache) + { + if ((int) $model->clean($cache->group) !== 1) + { + $app->enqueueMessage(JText::sprintf('COM_CACHE_EXPIRED_ITEMS_DELETE_ERROR', $cache->group), 'error'); + $allCleared = false; + } + } + + if ($allCleared) + { + $app->enqueueMessage(JText::_('COM_CACHE_MSG_ALL_CACHE_GROUPS_CLEARED'), 'message'); + } + else + { + $app->enqueueMessage(JText::_('COM_CACHE_MSG_SOME_CACHE_GROUPS_CLEARED'), 'warning'); + } + + $this->setRedirect('index.php?option=com_cache&view=cache'); + } + /** * Purge the cache. * diff --git a/administrator/components/com_cache/models/forms/filter_cache.xml b/administrator/components/com_cache/models/forms/filter_cache.xml index c458d0989a..28888b4235 100644 --- a/administrator/components/com_cache/models/forms/filter_cache.xml +++ b/administrator/components/com_cache/models/forms/filter_cache.xml @@ -13,8 +13,8 @@ diff --git a/administrator/components/com_cache/views/cache/view.html.php b/administrator/components/com_cache/views/cache/view.html.php index 7256632c1f..c995c4b8ec 100644 --- a/administrator/components/com_cache/views/cache/view.html.php +++ b/administrator/components/com_cache/views/cache/view.html.php @@ -33,7 +33,7 @@ class CacheViewCache extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -77,6 +77,7 @@ protected function addToolbar() } JToolbarHelper::custom('delete', 'delete.png', 'delete_f2.png', 'JTOOLBAR_DELETE', true); + JToolbarHelper::custom('deleteAll', 'delete.png', 'delete_f2.png', 'JTOOLBAR_DELETE_ALL', false); JToolbarHelper::divider(); if (JFactory::getUser()->authorise('core.admin', 'com_cache')) diff --git a/administrator/components/com_cache/views/purge/view.html.php b/administrator/components/com_cache/views/purge/view.html.php index b6b3fcc65c..2075833e91 100644 --- a/administrator/components/com_cache/views/purge/view.html.php +++ b/administrator/components/com_cache/views/purge/view.html.php @@ -21,7 +21,7 @@ class CacheViewPurge extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_categories/categories.xml b/administrator/components/com_categories/categories.xml index 16b1b1d1e4..2570edb438 100644 --- a/administrator/components/com_categories/categories.xml +++ b/administrator/components/com_categories/categories.xml @@ -25,5 +25,3 @@ - - diff --git a/administrator/components/com_categories/controllers/categories.php b/administrator/components/com_categories/controllers/categories.php index d3bb231a75..354b68857c 100644 --- a/administrator/components/com_categories/controllers/categories.php +++ b/administrator/components/com_categories/controllers/categories.php @@ -139,4 +139,25 @@ public function delete() $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&extension=' . $extension, false)); } + + /** + * Check in of one or more records. + * + * Overrides JControllerAdmin::checkin to redirect to URL with extension. + * + * @return boolean True on success + * + * @since 3.6.0 + */ + public function checkin() + { + // Process parent checkin method. + $result = parent::checkin(); + + // Overrride the redirect Uri. + $redirectUri = 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&extension=' . $this->input->get('extension', '', 'CMD'); + $this->setRedirect(JRoute::_($redirectUri, false), $this->message, $this->messageType); + + return $result; + } } diff --git a/administrator/components/com_categories/helpers/categories.php b/administrator/components/com_categories/helpers/categories.php index 60c74bcbc9..e4589f6704 100644 --- a/administrator/components/com_categories/helpers/categories.php +++ b/administrator/components/com_categories/helpers/categories.php @@ -109,4 +109,50 @@ public static function getAssociations($pk, $extension = 'com_content') return $associations; } + + /** + * Check if Category ID exists otherwise assign to ROOT category. + * + * @param mixed $catid Name or ID of category. + * @param string $extension Extension that triggers this function + * + * @return int $catid Category ID. + */ + public static function validateCategoryId($catid, $extension) + { + JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables'); + + $categoryTable = JTable::getInstance('Category'); + + $data = array(); + $data['id'] = $catid; + $data['extension'] = $extension; + + if (!$categoryTable->load($data)) + { + $catid = 0; + } + + return (int) $catid; + } + + /** + * Create new Category from within item view. + * + * @param array $data Array of data for new category. + * + * @return integer. + */ + public static function createCategory($data) + { + JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/models'); + JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_categories/tables'); + + $categoryModel = JModelLegacy::getInstance('Category', 'CategoriesModel'); + $categoryModel->save($data); + + $catid = $categoryModel->getState('category.id'); + + return $catid; + } } diff --git a/administrator/components/com_categories/models/categories.php b/administrator/components/com_categories/models/categories.php index ea37d06f26..ec1246bd62 100644 --- a/administrator/components/com_categories/models/categories.php +++ b/administrator/components/com_categories/models/categories.php @@ -234,11 +234,6 @@ protected function getListQuery() { $query->where('a.id = ' . (int) substr($search, 3)); } - elseif (stripos($search, 'author:') === 0) - { - $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); - $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); - } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index 9789b17e9e..ad352f6d00 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -20,6 +20,14 @@ */ class JFormFieldCategoryEdit extends JFormFieldList { + /** + * To allow creation of new categories. + * + * @var int + * @since 3.6 + */ + protected $allowAdd; + /** * A flexible category list that respects access controls * @@ -28,6 +36,77 @@ class JFormFieldCategoryEdit extends JFormFieldList */ public $type = 'CategoryEdit'; + /** + * Method to attach a JForm object to the field. + * + * @param SimpleXMLElement $element The SimpleXMLElement object representing the tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * + * @return boolean True on success. + * + * @see JFormField::setup() + * @since 3.2 + */ + public function setup(SimpleXMLElement $element, $value, $group = null) + { + $return = parent::setup($element, $value, $group); + + if ($return) + { + $this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : ''; + } + + return $return; + } + + /** + * Method to get certain otherwise inaccessible properties from the form field object. + * + * @param string $name The property name for which to the the value. + * + * @return mixed The property value or null. + * + * @since 3.6 + */ + public function __get($name) + { + switch ($name) + { + case 'allowAdd': + return $this->$name; + } + + return parent::__get($name); + } + + /** + * Method to set certain otherwise inaccessible properties of the form field object. + * + * @param string $name The property name for which to the the value. + * @param mixed $value The value of the property. + * + * @return void + * + * @since 3.6 + */ + public function __set($name, $value) + { + $value = (string) $value; + + switch ($name) + { + case 'allowAdd': + $value = (string) $value; + $this->$name = ($value === 'true' || $value === $name || $value === '1'); + break; + default: + parent::__set($name, $value); + } + } + /** * Method to get a list of categories that respects access controls and can be used for * either category assignment or parent category assignment in edit screens. @@ -244,4 +323,85 @@ protected function getOptions() // Merge any additional options in the XML definition. return array_merge(parent::getOptions(), $options); } + + /** + * Method to get the field input markup for a generic list. + * Use the multiple attribute to enable multiselect. + * + * @return string The field input markup. + * + * @since 3.6 + */ + protected function getInput() + { + $html = array(); + $class = array(); + $attr = ''; + + // Initialize some field attributes. + $class[] = !empty($this->class) ? $this->class : ''; + + if ($this->allowAdd) + { + $customGroupText = JText::_('JGLOBAL_CUSTOM_CATEGORY'); + + $class[] = 'chzn-custom-value'; + $attr .= ' data-custom_group_text="' . $customGroupText . '" ' + . 'data-no_results_text="' . JText::_('JGLOBAL_ADD_CUSTOM_CATEGORY') . '" ' + . 'data-placeholder="' . JText::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY') . '" '; + } + + if ($class) + { + $attr .= 'class="' . implode(' ', $class) . '"'; + } + + $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; + $attr .= $this->multiple ? ' multiple' : ''; + $attr .= $this->required ? ' required aria-required="true"' : ''; + $attr .= $this->autofocus ? ' autofocus' : ''; + + // To avoid user's confusion, readonly="true" should imply disabled="true". + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true') + { + $attr .= ' disabled="disabled"'; + } + + // Initialize JavaScript field attributes. + $attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : ''; + + // Get the field options. + $options = (array) $this->getOptions(); + + // Create a read-only list (no name) with hidden input(s) to store the value(s). + if ((string) $this->readonly == '1' || (string) $this->readonly == 'true') + { + $html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id); + + // E.g. form field type tag sends $this->value as array + if ($this->multiple && is_array($this->value)) + { + if (!count($this->value)) + { + $this->value[] = ''; + } + + foreach ($this->value as $value) + { + $html[] = ''; + } + } + else + { + $html[] = ''; + } + } + else + // Create a regular list. + { + $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); + } + + return implode($html); + } } diff --git a/administrator/components/com_categories/models/fields/modal/category.php b/administrator/components/com_categories/models/fields/modal/category.php index b0e8b5fb9d..6adf6db29c 100644 --- a/administrator/components/com_categories/models/fields/modal/category.php +++ b/administrator/components/com_categories/models/fields/modal/category.php @@ -19,7 +19,7 @@ class JFormFieldModal_Category extends JFormField /** * The form field type. * - * @var string + * @var string * @since 1.6 */ protected $type = 'Modal_Category'; @@ -27,7 +27,7 @@ class JFormFieldModal_Category extends JFormField /** * Method to get the field input markup. * - * @return string The field input markup. + * @return string The field input markup. * * @since 1.6 */ @@ -48,6 +48,9 @@ protected function getInput() // Load language JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR); + // The active category id field. + $value = (int) $this->value > 0 ? (int) $this->value : ''; + // Build the script. $script = array(); @@ -58,7 +61,11 @@ protected function getInput() if ($allowEdit) { - $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' if (id == "' . (int) $this->value . '") {'; + $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' } else {'; + $script[] = ' jQuery("#' . $this->id . '_edit").addClass("hidden");'; + $script[] = ' }'; } if ($allowClear) @@ -66,7 +73,12 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jQuery("#modalCategory-' . $this->id . '").modal("hide");'; + $script[] = ' jQuery("#categorySelect' . $this->id . 'Modal").modal("hide");'; + $script[] = ' }'; + + // Edit button script + $script[] = ' function jEditCategory_' . $value . '(title) {'; + $script[] = ' document.getElementById("' . $this->id . '_name").value = title;'; $script[] = ' }'; // Clear button script @@ -93,21 +105,31 @@ protected function getInput() // Setup variables for display. $html = array(); - $link = 'index.php?option=com_categories&view=categories&layout=modal&tmpl=component&extension=' - . $extension . '&function=jSelectCategory_' . $this->id; + + $linkCategories = 'index.php?option=com_categories&view=categories&layout=modal&tmpl=component' + . '&extension=' . $extension + . '&function=jSelectCategory_' . $this->id; + + $linkCategory = 'index.php?option=com_categories&view=category&layout=modal&tmpl=component' + . '&task=category.edit' + . '&function=jEditCategory_' . $value; if (isset($this->element['language'])) { - $link .= '&forcedLanguage=' . $this->element['language']; + $linkCategories .= '&forcedLanguage=' . $this->element['language']; + $linkCategory .= '&forcedLanguage=' . $this->element['language']; } - if ((int) $this->value > 0) + $urlSelect = $linkCategories . '&' . JSession::getFormToken() . '=1'; + $urlEdit = $linkCategory . '&id=' . $value . '&' . JSession::getFormToken() . '=1'; + + if ($value) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('title')) ->from($db->quoteName('#__categories')) - ->where($db->quoteName('id') . ' = ' . (int) $this->value); + ->where($db->quoteName('id') . ' = ' . (int) $value); $db->setQuery($query); try @@ -127,21 +149,16 @@ protected function getInput() $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - // The active category id field. - if (0 == (int) $this->value) - { - $value = ''; - } - else - { - $value = (int) $this->value; - } - // The current category display field. $html[] = ''; - $html[] = ''; - $html[] = 'id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />'; + + // Select category button + $html[] = '' . ' ' . JText::_('JSELECT') . ''; @@ -151,32 +168,21 @@ protected function getInput() { $html[] = '' - . '' . JText::_('JACTION_EDIT') + . ' id="' . $this->id . '_edit"' + . ' data-toggle="modal"' + . ' role="button"' + . ' href="#categoryEdit' . $value . 'Modal"' + . ' title="' . JHtml::tooltipText('COM_CATEGORIES_EDIT_CATEGORY') . '">' + . ' ' . JText::_('JACTION_EDIT') . ''; } - $html[] = JHtml::_( - 'bootstrap.renderModal', - 'modalCategory-' . $this->id, - array( - 'url' => $link . '&' . JSession::getFormToken() . '=1"', - 'title' => JText::_('COM_CATEGORIES_SELECT_A_CATEGORY'), - 'width' => '800px', - 'height' => '300px', - 'footer' => '' - ) - ); - // Clear category button if ($allowClear) { $html[] = '' . '' . JText::_('JCLEAR') . ''; @@ -184,13 +190,50 @@ protected function getInput() $html[] = ''; - // Note: class='required' for client side validation - $class = ''; + // Select category modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'categorySelect' . $this->id . 'Modal', + array( + 'title' => JText::_('COM_CATEGORIES_SELECT_A_CATEGORY'), + 'url' => $urlSelect, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '', + ) + ); - if ($this->required) - { - $class = ' class="required modal-value"'; - } + // Edit category modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'categoryEdit' . $value . 'Modal', + array( + 'title' => JText::_('COM_CATEGORIES_EDIT_CATEGORY'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $urlEdit, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', + ) + ); + + // Note: class='required' for client side validation + $class = $this->required ? ' class="required modal-value"' : ''; $html[] = ''; diff --git a/administrator/components/com_categories/models/forms/category.xml b/administrator/components/com_categories/models/forms/category.xml index b13683b368..1b41ed27ac 100644 --- a/administrator/components/com_categories/models/forms/category.xml +++ b/administrator/components/com_categories/models/forms/category.xml @@ -1,48 +1,56 @@ + + readonly="true" + /> + readonly="true" + /> + filter="unset" + /> + description="COM_CATEGORIES_FIELD_PARENT_DESC" + /> + filter="unset" + /> + filter="unset" + /> + filter="unset" + /> + readonly="true" + /> + type="hidden" + /> + required="true" + /> + /> + size="45" + maxlength="255" + /> + size="40" + maxlength="255" + /> + hide="readmore,pagebreak" + /> + > + + /> + + filter="unset" + /> + filter="unset" + /> + description="JFIELD_ACCESS_DESC" + /> + cols="40" + /> + cols="40" + /> + /> + readonly="true" + /> + filter="unset" + /> + readonly="true" + /> + description="COM_CATEGORIES_FIELD_LANGUAGE_DESC" + > - - + /> + section="category" + /> -
+ +
+ useglobal="true" + /> + description="COM_CATEGORIES_FIELD_IMAGE_DESC" + /> - + size="20" + />
-
+ +
+ + size="30" + /> - + > diff --git a/administrator/components/com_categories/models/forms/filter_categories.xml b/administrator/components/com_categories/models/forms/filter_categories.xml index 1243ce89b5..3dd53359d3 100644 --- a/administrator/components/com_categories/models/forms/filter_categories.xml +++ b/administrator/components/com_categories/models/forms/filter_categories.xml @@ -1,14 +1,16 @@ + + + + + JOPTION_SELECT_LANGUAGE + + JOPTION_SELECT_MAX_LEVELS + + @@ -85,13 +93,14 @@ + diff --git a/administrator/components/com_categories/views/categories/tmpl/default.php b/administrator/components/com_categories/views/categories/tmpl/default.php index 522457b4ea..4a4d02636c 100644 --- a/administrator/components/com_categories/views/categories/tmpl/default.php +++ b/administrator/components/com_categories/views/categories/tmpl/default.php @@ -18,16 +18,17 @@ JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); -$app = JFactory::getApplication(); -$user = JFactory::getUser(); -$userId = $user->get('id'); -$extension = $this->escape($this->state->get('filter.extension')); -$listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); -$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); -$parts = explode('.', $extension); -$component = $parts[0]; -$section = null; +$app = JFactory::getApplication(); +$user = JFactory::getUser(); +$userId = $user->get('id'); +$extension = $this->escape($this->state->get('filter.extension')); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); +$parts = explode('.', $extension); +$component = $parts[0]; +$section = null; +$columns = 7; if (count($parts) > 1) { @@ -41,8 +42,6 @@ } } -$columns = 7; - if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component'; @@ -185,10 +184,23 @@ id); ?> - published, $i, 'categories.', $canChange); ?> +
+ published, $i, 'categories.', $canChange); ?> + published === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'categories'); + JHtml::_('actionsdropdown.' . ((int) $item->published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'categories'); + + // Render dropdown list + echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); + } + ?> +
- —', $item->level - 1) ?> + $item->level)); ?> checked_out) : ?> editor, $item->checked_out_time, 'categories.', $canCheckin); ?> diff --git a/administrator/components/com_categories/views/categories/tmpl/modal.php b/administrator/components/com_categories/views/categories/tmpl/modal.php index b6e243d5c0..b10924e8ae 100644 --- a/administrator/components/com_categories/views/categories/tmpl/modal.php +++ b/administrator/components/com_categories/views/categories/tmpl/modal.php @@ -20,113 +20,125 @@ // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); + JHtml::_('behavior.core'); -JHtml::_('bootstrap.tooltip'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('formbehavior.chosen', 'select'); +// Special case for the search field tooltip. +$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); +JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); + $extension = $this->escape($this->state->get('filter.extension')); $function = $app->input->getCmd('function', 'jSelectCategory'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
- - $this)); ?> - items)) : ?> -
- -
- - - - - - - - - - - - - - - - - - 'icon-trash', - 0 => 'icon-unpublish', - 1 => 'icon-publish', - 2 => 'icon-archive', - ); - ?> - items as $i => $item) : ?> - language && JLanguageMultilang::isEnabled()) - { - $tag = strlen($item->language); - if ($tag == 5) - { - $lang = substr($item->language, 0, 2); - } - elseif ($tag == 6) +
+ + + + $this)); ?> + +
+ + items)) : ?> +
+ +
+ +
- - - - - - - - - -
- pagination->getListFooter(); ?> -
+ + + + + + + + + + + + + + + + 'icon-trash', + 0 => 'icon-unpublish', + 1 => 'icon-publish', + 2 => 'icon-archive', + ); + ?> + items as $i => $item) : ?> + language && JLanguageMultilang::isEnabled()) { - $lang = substr($item->language, 0, 3); + $tag = strlen($item->language); + if ($tag == 5) + { + $lang = substr($item->language, 0, 2); + } + elseif ($tag == 6) + { + $lang = substr($item->language, 0, 3); + } + else + { + $lang = ""; + } } - else + elseif (!JLanguageMultilang::isEnabled()) { $lang = ""; } - } - elseif (!JLanguageMultilang::isEnabled()) - { - $lang = ""; - } - ?> - - - - - - - - - -
+ + + + + + + + + +
+ pagination->getListFooter(); ?> +
- - - —', $item->level - 1); ?> - - escape($item->title); ?> - - - escape($item->access_level); ?> - - language == '*') : ?> - - - 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'); ?> - - - id; ?> -
- - - - - - + ?> + + + + + + $item->level)); ?> + + escape($item->title); ?> + + + + escape($item->access_level); ?> + + + language == '*') : ?> + + + 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'); ?> + + + + id; ?> + + + + + + + + + + + + - + +
diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php index 986deb245d..98539bb275 100644 --- a/administrator/components/com_categories/views/categories/view.html.php +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -70,7 +70,7 @@ class CategoriesViewCategories extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_categories/views/category/tmpl/edit.php b/administrator/components/com_categories/views/category/tmpl/edit.php index 648e0c3038..71086a67b1 100644 --- a/administrator/components/com_categories/views/category/tmpl/edit.php +++ b/administrator/components/com_categories/views/category/tmpl/edit.php @@ -31,6 +31,11 @@ jQuery("#permissions-sliders select").attr("disabled", "disabled"); ' . $this->form->getField("description")->save() . ' Joomla.submitform(task, document.getElementById("item-form")); + + if (task !== "category.apply") + { + window.parent.jQuery("#categoryEdit' . $this->item->id . 'Modal").modal("hide"); + } } }; '); @@ -38,16 +43,20 @@ // Fieldsets to not automatically render by /layouts/joomla/edit/params.php $this->ignore_fieldsets = array('jmetadata', 'item_associations'); +// In case of modal +$isModal = $input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal ? '&tmpl=component' : ''; ?> -
+
'general')); ?> - +
form->getLabel('description'); ?> @@ -59,7 +68,7 @@
- +
@@ -70,14 +79,16 @@
- - + + loadTemplate('associations'); ?> + + canDo->get('core.admin')) : ?> - + form->getInput('rules'); ?> diff --git a/administrator/components/com_categories/views/category/tmpl/modal.php b/administrator/components/com_categories/views/category/tmpl/modal.php index c56c4f0f62..28203343ec 100644 --- a/administrator/components/com_categories/views/category/tmpl/modal.php +++ b/administrator/components/com_categories/views/category/tmpl/modal.php @@ -9,96 +9,24 @@ defined('_JEXEC') or die; -// Include the component HTML helpers. -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); -JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select'); +$function = JFactory::getApplication()->input->getCmd('function', 'jEditCategory_' . (int) $this->item->id); -$app = JFactory::getApplication(); -$input = $app->input; - -$assoc = JLanguageAssociations::isEnabled(); - -JFactory::getDocument()->addScriptDeclaration(" - Joomla.submitbutton = function(task) - { - if (task == 'category.cancel' || document.formvalidator.isValid(document.getElementById('item-form'))) - { - " . $this->form->getField('description')->save() . " - - if (window.opener && (task == 'category.save' || task == 'category.cancel')) - { - window.opener.document.closeEditWindow = self; - window.opener.setTimeout('window.document.closeEditWindow.close()', 1000); - } - - Joomla.submitform(task, document.getElementById('item-form')); +// Function to update input title when changed +JFactory::getDocument()->addScriptDeclaration(' + function jEditCategoryModal() { + if (window.parent && document.formvalidator.isValid(document.getElementById("item-form"))) { + return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value); } - }; -"); - -// Fieldsets to not automatically render by /layouts/joomla/edit/params.php -$this->ignore_fieldsets = array('jmetadata', 'item_associations'); + } +'); ?> -
- -
- - - -
- -
-
- - - + + + -
- 'general')); ?> - - -
-
- form->getLabel('description'); ?> - form->getInput('description'); ?> -
-
- -
-
- - - -
-
- -
-
- -
-
- - - - - - - canDo->get('core.admin')) : ?> - - form->getInput('rules'); ?> - - - - - - - - form->getInput('extension'); ?> - - -
- +
+ setLayout('edit'); ?> + loadTemplate(); ?>
diff --git a/administrator/components/com_categories/views/category/view.html.php b/administrator/components/com_categories/views/category/view.html.php index 8afb511250..37fe2c8fb2 100644 --- a/administrator/components/com_categories/views/category/view.html.php +++ b/administrator/components/com_categories/views/category/view.html.php @@ -56,7 +56,7 @@ class CategoriesViewCategory extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_checkin/checkin.xml b/administrator/components/com_checkin/checkin.xml index ac1b240d73..c45959fbbd 100644 --- a/administrator/components/com_checkin/checkin.xml +++ b/administrator/components/com_checkin/checkin.xml @@ -2,6 +2,7 @@ com_checkin Joomla! Project + April 2006 (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org diff --git a/administrator/components/com_config/controller/application/save.php b/administrator/components/com_config/controller/application/save.php index 550cd04198..a2e3ced9f6 100644 --- a/administrator/components/com_config/controller/application/save.php +++ b/administrator/components/com_config/controller/application/save.php @@ -35,14 +35,14 @@ public function execute() // Check for request forgeries. if (!JSession::checkToken()) { - $this->app->enqueueMessage(JText::_('JINVALID_TOKEN')); + $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error'); $this->app->redirect('index.php'); } // Check if the user is authorized to do this. if (!JFactory::getUser()->authorise('core.admin')) { - $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); + $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $this->app->redirect('index.php'); } @@ -104,7 +104,7 @@ public function execute() } // Set the success message. - $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS')); + $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'), 'message'); // Set the redirect based on the task. switch ($this->options[3]) diff --git a/administrator/components/com_config/controller/application/sendtestmail.php b/administrator/components/com_config/controller/application/sendtestmail.php index fd70e3ca4b..56070cc987 100644 --- a/administrator/components/com_config/controller/application/sendtestmail.php +++ b/administrator/components/com_config/controller/application/sendtestmail.php @@ -24,22 +24,27 @@ class ConfigControllerApplicationSendtestmail extends JControllerBase */ public function execute() { + // Send json mime type. + $this->app->mimeType = 'application/json'; + $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet); + $this->app->sendHeaders(); + + // Check if user token is valid. if (!JSession::checkToken('get')) { - $this->app->enqueueMessage(JText::_('JINVALID_TOKEN')); - $this->app->redirect('index.php'); + $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error'); + echo new JResponseJson; + $this->app->close(); } + // Check if the user is authorized to do this. if (!JFactory::getUser()->authorise('core.admin')) { - $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); - $this->app->redirect('index.php'); + $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + echo new JResponseJson; + $this->app->close(); } - $this->app->mimeType = 'application/json'; - $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet); - $this->app->sendHeaders(); - $model = new ConfigModelApplication; echo new JResponseJson($model->sendTestMail()); $this->app->close(); diff --git a/administrator/components/com_config/controller/application/store.php b/administrator/components/com_config/controller/application/store.php index c6b9fbfe3d..42b653695c 100644 --- a/administrator/components/com_config/controller/application/store.php +++ b/administrator/components/com_config/controller/application/store.php @@ -24,33 +24,21 @@ class ConfigControllerApplicationStore extends JControllerBase */ public function execute() { - // Check if the user is authorized to do this. - if (!JFactory::getUser()->authorise('core.admin')) - { - $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); - $this->app->redirect('index.php'); - } + // Send json mime type. + $this->app->mimeType = 'application/json'; + $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet); + $this->app->sendHeaders(); - // Get Post DATA - $permissions = array( - 'component' => $this->input->get->get('comp'), - 'action' => $this->input->get->get('action'), - 'rule' => $this->input->get->get('rule'), - 'value' => $this->input->get->get('value'), - 'title' => $this->input->get->get('title', '', 'RAW') - ); - - if (!(substr($permissions['component'], -6) == '.false')) + // Check if user token is valid. + if (!JSession::checkToken('get')) { - // Load Permissions from Session and send to Model - $model = new ConfigModelApplication; - $response = $model->storePermissions($permissions); - - echo new JResponseJson(json_encode($response)); - } - else - { - echo new JResponseJson(json_encode(false), 0); + $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error'); + echo new JResponseJson; + $this->app->close(); } + + $model = new ConfigModelApplication; + echo new JResponseJson($model->storePermissions()); + $this->app->close(); } } diff --git a/administrator/components/com_config/controller/component/save.php b/administrator/components/com_config/controller/component/save.php index e8ef75ecb3..4abc6c1c2c 100644 --- a/administrator/components/com_config/controller/component/save.php +++ b/administrator/components/com_config/controller/component/save.php @@ -36,7 +36,7 @@ public function execute() // Check for request forgeries. if (!JSession::checkToken()) { - $this->app->enqueueMessage(JText::_('JINVALID_TOKEN')); + $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'), 'error'); $this->app->redirect('index.php'); } @@ -53,7 +53,7 @@ public function execute() // Check if the user is authorised to do this. if (!$user->authorise('core.admin', $option) && !$user->authorise('core.options', $option)) { - $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')); + $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $this->app->redirect('index.php'); } @@ -114,7 +114,7 @@ public function execute() switch ($this->options[3]) { case 'apply': - $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS')); + $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'), 'message'); $this->app->redirect(JRoute::_('index.php?option=com_config&view=component&component=' . $option . $redirect, false)); break; diff --git a/administrator/components/com_config/model/application.php b/administrator/components/com_config/model/application.php index ba9d509739..ffc280cf40 100644 --- a/administrator/components/com_config/model/application.php +++ b/administrator/components/com_config/model/application.php @@ -366,15 +366,90 @@ private function writeConfigFile(Registry $config) * * @param string $permission Need an array with Permissions (component, rule, value and title) * - * @return boolean True on success, false on failure. + * @return array A list of result data. * * @since 3.5 */ - public function storePermissions($permission) + public function storePermissions($permission = null) { + $app = JFactory::getApplication(); + $user = JFactory::getUser(); + + if (is_null($permission)) + { + // Get data from input. + $permission = array( + 'component' => $app->input->get('comp'), + 'action' => $app->input->get('action'), + 'rule' => $app->input->get('rule'), + 'value' => $app->input->get('value'), + 'title' => $app->input->get('title', '', 'RAW') + ); + } + + // We are creating a new item so we don't have an item id so don't allow. + if (substr($permission['component'], -6) === '.false') + { + $app->enqueueMessage(JText::_('JLIB_RULES_SAVE_BEFORE_CHANGE_PERMISSIONS'), 'error'); + + return false; + } + + // Check if the user is authorized to do this. + if (!$user->authorise('core.admin', $permission['component'])) + { + $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); + + return false; + } + + // Check if changed group has Super User permissions. + $isSuperUserGroupBefore = JAccess::checkGroup($permission['rule'], 'core.admin'); + + // Check if current user belongs to changed group. + $currentUserBelongsToGroup = in_array((int) $permission['rule'], $user->groups) ? true : false; + + // Get current user groups tree. + $currentUserGroupsTree = JAccess::getGroupsByUser($user->id, true); + + // Check if current user belongs to changed group. + $currentUserSuperUser = $user->authorise('core.admin'); + + // If user is not Super User cannot change the permissions of a group it belongs to. + if (!$currentUserSuperUser && $currentUserBelongsToGroup) + { + $app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_OWN_GROUPS'), 'error'); + + return false; + } + + // If user is not Super User cannot change the permissions of a group it belongs to. + if (!$currentUserSuperUser && in_array((int) $permission['rule'], $currentUserGroupsTree)) + { + $app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_OWN_PARENT_GROUPS'), 'error'); + + return false; + } + + // If user is not Super User cannot change the permissions of a Super User Group. + if (!$currentUserSuperUser && $isSuperUserGroupBefore && !$currentUserBelongsToGroup) + { + $app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_CHANGE_SUPER_USER'), 'error'); + + return false; + } + + // If user is not Super User cannot change the Super User permissions in any group it belongs to. + if ($isSuperUserGroupBefore && $currentUserBelongsToGroup && $permission['action'] === 'core.admin') + { + $app->enqueueMessage(JText::_('JLIB_USER_ERROR_CANNOT_DEMOTE_SELF'), 'error'); + + return false; + } + try { - // Load the current settings for this component + // Load the current settings for this component. $query = $this->db->getQuery(true) ->select($this->db->quoteName(array('name', 'rules'))) ->from($this->db->quoteName('#__assets')) @@ -384,81 +459,242 @@ public function storePermissions($permission) // Load the results as a list of stdClass objects (see later for more options on retrieving data). $results = $this->db->loadAssocList(); + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); - if (empty($results)) - { - $data = array(); - $data[$permission['action']] = array(); - $data[$permission['action']] = array($permission['rule'] => $permission['value']); + return false; + } - $rules = new JAccessRules($data); - $asset = JTable::getInstance('asset'); - $asset->rules = (string) $rules; - $asset->name = (string) $permission['component']; - $asset->title = (string) $permission['title']; + // No record found, let's create one. + if (empty($results)) + { + $data = array(); + $data[$permission['action']] = array($permission['rule'] => $permission['value']); - if (!$asset->check() || !$asset->store()) - { - JFactory::getApplication()->enqueueMessage(JText::_('SOME_ERROR_CODE'), 'error'); + $rules = new JAccessRules($data); + $asset = JTable::getInstance('asset'); + $asset->rules = (string) $rules; + $asset->name = (string) $permission['component']; + $asset->title = (string) $permission['title']; - return false; - } + // Get the parent asset id so we have a correct tree. + $parentAsset = JTable::getInstance('Asset'); - return true; + if (strpos($asset->name, '.') !== false) + { + $assetParts = explode('.', $asset->name); + $parentAsset->loadByName($assetParts[0]); + $parentAssetId = $parentAsset->id; } else { - // Decode the rule settings - $temp = json_decode($results[0]['rules'], true); + $parentAssetId = $parentAsset->getRootId(); + } + + $asset->setLocation($parentAssetId, 'last-child'); + + if (!$asset->check() || !$asset->store()) + { + $app->enqueueMessage(JText::_('JLIB_UNKNOWN'), 'error'); - // Check if a new value is to be set - if (isset($permission['value'])) + return false; + } + } + else + { + // Decode the rule settings. + $temp = json_decode($results[0]['rules'], true); + + // Check if a new value is to be set. + if (isset($permission['value'])) + { + // Check if we already have an action entry. + if (!isset($temp[$permission['action']])) + { + $temp[$permission['action']] = array(); + } + + // Check if we already have a rule entry. + if (!isset($temp[$permission['action']][$permission['rule']])) { - // Check if we already have an action entry - if (!isset($temp[$permission['action']])) - { - $temp[$permission['action']] = array(); - } - - // Check if we already have a rule entry - if (!isset($temp[$permission['action']][$permission['rule']])) - { - $temp[$permission['action']][$permission['rule']] = array(); - } - - // Set the new permission - $temp[$permission['action']][$permission['rule']] = intval($permission['value']); - - // Check if we have an inherited setting - if (strlen($permission['value']) == 0) - { - unset($temp[$permission['action']][$permission['rule']]); - } + $temp[$permission['action']][$permission['rule']] = array(); } - else + + // Set the new permission. + $temp[$permission['action']][$permission['rule']] = (int) $permission['value']; + + // Check if we have an inherited setting. + if (strlen($permission['value']) === 0) { - // There is no value so remove the action as it's not needed - unset($temp[$permission['action']]); + unset($temp[$permission['action']][$permission['rule']]); } - // Store the new permissions - $temp = json_encode($temp); + } + else + { + // There is no value so remove the action as it's not needed. + unset($temp[$permission['action']]); + } + + // Store the new permissions. + try + { $query = $this->db->getQuery(true) ->update($this->db->quoteName('#__assets')) - ->set('rules = ' . $this->db->quote($temp)) + ->set($this->db->quoteName('rules') . ' = ' . $this->db->quote(json_encode($temp))) ->where($this->db->quoteName('name') . ' = ' . $this->db->quote($permission['component'])); - $this->db->setQuery($query); - - $result = $this->db->execute(); + $this->db->setQuery($query)->execute(); + } + catch (Exception $e) + { + $app->enqueueMessage($e->getMessage(), 'error'); - return (bool) $result; + return false; } } + + // All checks done. + $result = array( + 'text' => '', + 'class' => '', + 'result' => true, + ); + + // Show the current effective calculated permission considering current group, path and cascade. + + try + { + // Get the asset id by the name of the component. + $query = $this->db->getQuery(true) + ->select($this->db->quoteName('id')) + ->from($this->db->quoteName('#__assets')) + ->where($this->db->quoteName('name') . ' = ' . $this->db->quote($permission['component'])); + + $this->db->setQuery($query); + + $assetId = (int) $this->db->loadResult(); + + // Get the group parent id of the current group. + $query = $this->db->getQuery(true) + ->select($this->db->quoteName('parent_id')) + ->from($this->db->quoteName('#__usergroups')) + ->where($this->db->quoteName('id') . ' = ' . (int) $permission['rule']); + + $this->db->setQuery($query); + + $parentGroupId = (int) $this->db->loadResult(); + + // Count the number of child groups of the current group. + $query = $this->db->getQuery(true) + ->select('COUNT(' . $this->db->quoteName('id') . ')') + ->from($this->db->quoteName('#__usergroups')) + ->where($this->db->quoteName('parent_id') . ' = ' . (int) $permission['rule']); + + $this->db->setQuery($query); + + $totalChildGroups = (int) $this->db->loadResult(); + } catch (Exception $e) { - return $e->getMessage(); + $app->enqueueMessage($e->getMessage(), 'error'); + + return false; + } + + // Clear access statistics. + JAccess::clearStatics(); + + // After current group permission is changed we need to check again if the group has Super User permissions. + $isSuperUserGroupAfter = JAccess::checkGroup($permission['rule'], 'core.admin'); + + // Get the rule for just this asset (non-recursive) and get the actual setting for the action for this group. + $assetRule = JAccess::getAssetRules($assetId)->allow($permission['action'], $permission['rule']); + + // Get the group, group parent id, and group global config recursive calculated permission for the chosen action. + $inheritedGroupRule = JAccess::checkGroup($permission['rule'], $permission['action'], $assetId); + $inheritedGroupGlobalRule = JAccess::checkGroup($permission['rule'], $permission['action']); + $inheritedParentGroupRule = JAccess::checkGroup($parentGroupId, $permission['action'], $assetId); + + // Current group is a Super User group, so calculated setting is "Allowed (Super User)". + if ($isSuperUserGroupAfter) + { + $result['class'] = 'label label-success'; + $result['text'] = '' . JText::_('JLIB_RULES_ALLOWED_ADMIN'); + } + // Not super user. + else + { + // First get the real recursive calculated setting and add (Inherited) to it. + + // If recursive calculated setting is "Denied" or null. Calculated permission is "Not Allowed (Inherited)". + if ($inheritedGroupRule === null || $inheritedGroupRule === false) + { + $result['class'] = 'label label-important'; + $result['text'] = JText::_('JLIB_RULES_NOT_ALLOWED_INHERITED'); + } + // If recursive calculated setting is "Allowed". Calculated permission is "Allowed (Inherited)". + else + { + $result['class'] = 'label label-success'; + $result['text'] = JText::_('JLIB_RULES_ALLOWED_INHERITED'); + } + + // Second part: Overwrite the calculated permissions labels if there is an explicity permission in the current group. + + // If there is an explicity permission "Not Allowed". Calculated permission is "Not Allowed". + if ($assetRule === false) + { + $result['class'] = 'label label-important'; + $result['text'] = JText::_('JLIB_RULES_NOT_ALLOWED'); + } + // If there is an explicity permission is "Allowed". Calculated permission is "Allowed". + elseif ($assetRule === true) + { + $result['class'] = 'label label-success'; + $result['text'] = JText::_('JLIB_RULES_ALLOWED'); + } + + // Third part: Overwrite the calculated permissions labels for special cases. + + // User in in global config Root (Public)? + $isGlobalConfig = (empty($permission['component']) || $permission['component'] === 'root.1') ? true : false; + + // Global configuration with "Not Set" permission. Calculated permission is "Not Allowed (Default)". + if (empty($parentGroupId) && $isGlobalConfig === true && $assetRule === null) + { + $result['class'] = 'label label-important'; + $result['text'] = JText::_('JLIB_RULES_NOT_ALLOWED_DEFAULT'); + } + // Component/item root level with explicit "Denied" permission at Global configuration. Calculated permission is "Not Allowed (Locked)". + elseif (empty($parentGroupId) && $isGlobalConfig === false && $inheritedParentGroupRule === null && $inheritedGroupGlobalRule === false) + { + $result['class'] = 'label label-important'; + $result['text'] = '' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED'); + } + // Some parent group has an explicit "Denied". Calculated permission is "Not Allowed (Locked)". + elseif ($inheritedParentGroupRule === false) + { + $result['class'] = 'label label-important'; + $result['text'] = '' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED'); + } + } + + // If removed or added super user from group, we need to refresh the page to recalculate all settings. + if ($isSuperUserGroupBefore != $isSuperUserGroupAfter) + { + $app->enqueueMessage(JText::_('JLIB_RULES_NOTICE_RECALCULATE_GROUP_PERMISSIONS'), 'notice'); + } + + // If this group has child groups, we need to refresh the page to recalculate the child settings. + if ($totalChildGroups > 0) + { + $app->enqueueMessage(JText::_('JLIB_RULES_NOTICE_RECALCULATE_GROUP_CHILDS_PERMISSIONS'), 'notice'); } + + return $result; } /** @@ -486,14 +722,25 @@ public function sendTestMail() $app->set('mailer', $input->get('mailer')); $app->set('mailonline', $input->get('mailonline')); + $mail = JFactory::getMailer(); + // Prepare email and send try to send it $mailSubject = JText::sprintf('COM_CONFIG_SENDMAIL_SUBJECT', $app->get('sitename')); - $mailBody = JText::sprintf('COM_CONFIG_SENDMAIL_BODY', JText::_('COM_CONFIG_SENDMAIL_METHOD_' . strtoupper($app->get('mailer')))); + $mailBody = JText::sprintf('COM_CONFIG_SENDMAIL_BODY', JText::_('COM_CONFIG_SENDMAIL_METHOD_' . strtoupper($mail->Mailer))); - if (JFactory::getMailer()->sendMail($app->get('mailfrom'), $app->get('fromname'), $app->get('mailfrom'), $mailSubject, $mailBody) === true) + if ($mail->sendMail($app->get('mailfrom'), $app->get('fromname'), $app->get('mailfrom'), $mailSubject, $mailBody) === true) { - $methodName = JText::_('COM_CONFIG_SENDMAIL_METHOD_' . strtoupper($app->get('mailer'))); - $app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS', $app->get('mailfrom'), $methodName), 'success'); + $methodName = JText::_('COM_CONFIG_SENDMAIL_METHOD_' . strtoupper($mail->Mailer)); + + // If JMail send the mail using PHP Mail as fallback. + if ($mail->Mailer != $app->get('mailer')) + { + $app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS_FALLBACK', $app->get('mailfrom'), $methodName), 'warning'); + } + else + { + $app->enqueueMessage(JText::sprintf('COM_CONFIG_SENDMAIL_SUCCESS', $app->get('mailfrom'), $methodName), 'success'); + } return true; } diff --git a/administrator/components/com_config/model/field/filters.php b/administrator/components/com_config/model/field/filters.php index a229dd0d3b..f3f776b392 100644 --- a/administrator/components/com_config/model/field/filters.php +++ b/administrator/components/com_config/model/field/filters.php @@ -79,14 +79,14 @@ protected function getInput() $group_filter['filter_attributes'] = !empty($group_filter['filter_attributes']) ? $group_filter['filter_attributes'] : ''; $html[] = ' '; - $html[] = ' '; - $html[] = ' ' . str_repeat('|—', $group->level) . $group->text; - $html[] = ' '; + $html[] = ' '; + $html[] = ' ' . JLayoutHelper::render('joomla.html.treeprefix', array('level' => $group->level + 1)) . $group->text; + $html[] = ' '; $html[] = ' '; $html[] = ' '; $html[] = ' '; diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index a6242254cd..d68509812b 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -20,7 +20,8 @@ default="" label="COM_CONFIG_FIELD_CACHE_HANDLER_LABEL" description="COM_CONFIG_FIELD_CACHE_HANDLER_DESC" - filter="word"> + filter="word" + showon="caching:1,2"> @@ -68,7 +70,7 @@ default="0" label="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_DESC" - showon="cache_handler:memcache" + showon="caching:1,2[AND]cache_handler:memcache" filter="integer"> @@ -80,7 +82,7 @@ default="localhost" label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC" - showon="cache_handler:memcache" + showon="caching:1,2[AND]cache_handler:memcache" filter="string" size="25" /> @@ -90,7 +92,7 @@ default="11211" label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC" - showon="cache_handler:memcache" + showon="caching:1,2[AND]cache_handler:memcache" filter="integer" size="5" /> @@ -101,7 +103,7 @@ default="1" label="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_PERSISTENT_DESC" - showon="cache_handler:memcached" + showon="caching:1,2[AND]cache_handler:memcached" filter="integer"> @@ -114,7 +116,7 @@ default="0" label="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_COMPRESSION_DESC" - showon="cache_handler:memcached" + showon="caching:1,2[AND]cache_handler:memcached" filter="integer"> @@ -126,7 +128,7 @@ default="localhost" label="COM_CONFIG_FIELD_MEMCACHE_HOST_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_HOST_DESC" - showon="cache_handler:memcached" + showon="caching:1,2[AND]cache_handler:memcached" filter="string" size="25" /> @@ -136,7 +138,7 @@ default="11211" label="COM_CONFIG_FIELD_MEMCACHE_PORT_LABEL" description="COM_CONFIG_FIELD_MEMCACHE_PORT_DESC" - showon="cache_handler:memcached" + showon="caching:1,2[AND]cache_handler:memcached" filter="integer" size="5" /> @@ -148,7 +150,7 @@ label="COM_CONFIG_FIELD_REDIS_PERSISTENT_LABEL" description="COM_CONFIG_FIELD_REDIS_PERSISTENT_DESC" filter="integer" - showon="cache_handler:redis"> + showon="caching:1,2[AND]cache_handler:redis"> @@ -160,7 +162,7 @@ label="COM_CONFIG_FIELD_REDIS_HOST_LABEL" description="COM_CONFIG_FIELD_REDIS_HOST_DESC" filter="string" - showon="cache_handler:redis" + showon="caching:1,2[AND]cache_handler:redis" size="25" /> @@ -190,7 +192,7 @@ label="COM_CONFIG_FIELD_REDIS_DB_LABEL" description="COM_CONFIG_FIELD_REDIS_DB_DESC" filter="integer" - showon="cache_handler:redis" + showon="caching:1,2[AND]cache_handler:redis" size="4" />
@@ -408,28 +410,32 @@
+ + class="btn-group btn-group-yesno" + default="1" + filter="integer" + > - - - + name="massmailoff" + type="radio" + label="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_LABEL" + description="COM_CONFIG_FIELD_MAIL_MASSMAILOFF_DESC" + class="btn-group btn-group-yesno" + default="0" + filter="integer" + showon="mailonline:1" + > + + + validate="email" + showon="mailonline:1" + /> + size="30" + showon="mailonline:1" + /> - - + name="mailer" + type="list" + label="COM_CONFIG_FIELD_MAIL_MAILER_LABEL" + description="COM_CONFIG_FIELD_MAIL_MAILER_DESC" + default="mail" + filter="word" + showon="mailonline:1" + > + + + + size="30" + /> - - - + name="smtphost" + type="text" + label="COM_CONFIG_FIELD_MAIL_SMTP_HOST_LABEL" + description="COM_CONFIG_FIELD_MAIL_SMTP_HOST_DESC" + default="localhost" + showon="mailonline:1[AND]mailer:smtp" + filter="string" + size="30" + /> + + + default="none" + showon="mailonline:1[AND]mailer:smtp" + filter="word" + > + name="smtpauth" + type="radio" + label="COM_CONFIG_FIELD_MAIL_SMTP_AUTH_LABEL" + description="COM_CONFIG_FIELD_MAIL_SMTP_AUTH_DESC" + class="btn-group btn-group-yesno" + default="0" + showon="mailonline:1[AND]mailer:smtp" + filter="integer" + > + + + + size="30" + /> + size="30" + /> -
+ filter="integer" + showon="sef:1"> @@ -639,7 +660,8 @@ default="0" label="COM_CONFIG_FIELD_SEF_SUFFIX_LABEL" description="COM_CONFIG_FIELD_SEF_SUFFIX_DESC" - filter="integer"> + filter="integer" + showon="sef:1"> @@ -651,7 +673,8 @@ default="0" label="COM_CONFIG_FIELD_UNICODESLUGS_LABEL" description="COM_CONFIG_FIELD_UNICODESLUGS_DESC" - filter="integer"> + filter="integer" + showon="sef:1"> @@ -815,7 +838,8 @@ default="1" label="COM_CONFIG_FIELD_SITE_DISPLAY_MESSAGE_LABEL" description="COM_CONFIG_FIELD_SITE_DISPLAY_MESSAGE_DESC" - filter="integer"> + filter="integer" + showon="offline:1"> @@ -828,13 +852,15 @@ description="COM_CONFIG_FIELD_OFFLINE_MESSAGE_DESC" filter="safehtml" cols="60" - rows="2" /> + rows="2" + showon="offline:1[AND]display_offline_message:1" /> + description="COM_CONFIG_FIELD_OFFLINE_IMAGE_DESC" + showon="offline:1" /> J30 + + userIsSuperAdmin = $user->authorise('core.admin'); - // Add strings for translations in Javascript. - JText::script('COM_CONFIG_SENDMAIL_JS_ERROR_CONNECTION_ABORT'); - JText::script('COM_CONFIG_SENDMAIL_JS_ERROR_NO_CONTENT'); - JText::script('COM_CONFIG_SENDMAIL_JS_ERROR_OTHER'); - JText::script('COM_CONFIG_SENDMAIL_JS_ERROR_PARSE'); - JText::script('COM_CONFIG_SENDMAIL_JS_ERROR_TIMEOUT'); - $this->addToolbar(); return parent::render(); diff --git a/administrator/components/com_config/view/application/tmpl/default.php b/administrator/components/com_config/view/application/tmpl/default.php index f3f39a8181..90032a746e 100644 --- a/administrator/components/com_config/view/application/tmpl/default.php +++ b/administrator/components/com_config/view/application/tmpl/default.php @@ -16,6 +16,12 @@ JHtml::_('bootstrap.tooltip'); JHtml::_('formbehavior.chosen', 'select'); +// Load JS message titles +JText::script('ERROR'); +JText::script('WARNING'); +JText::script('NOTICE'); +JText::script('MESSAGE'); + JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { diff --git a/administrator/components/com_config/view/application/tmpl/default_mail.php b/administrator/components/com_config/view/application/tmpl/default_mail.php index 002cdc3af5..4ae388305e 100644 --- a/administrator/components/com_config/view/application/tmpl/default_mail.php +++ b/administrator/components/com_config/view/application/tmpl/default_mail.php @@ -10,14 +10,27 @@ defined('_JEXEC') or die; JHtml::script('system/sendtestmail.js', false, true); -JFactory::getDocument()->addScriptDeclaration(' - var sendtestmail_url = "' . addslashes(JUri::base()) . 'index.php?option=com_config&task=config.sendtestmail.application&format=json&' . JSession::getFormToken() . '=1"; - '); + +// Load JavaScript message titles +JText::script('ERROR'); +JText::script('WARNING'); +JText::script('NOTICE'); +JText::script('MESSAGE'); + +// Add strings for JavaScript error translations. +JText::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT'); +JText::script('JLIB_JS_AJAX_ERROR_NO_CONTENT'); +JText::script('JLIB_JS_AJAX_ERROR_OTHER'); +JText::script('JLIB_JS_AJAX_ERROR_PARSE'); +JText::script('JLIB_JS_AJAX_ERROR_TIMEOUT'); + +// Ajax request data. +$ajaxUri = JRoute::_('index.php?option=com_config&task=config.sendtestmail.application&format=json&' . JSession::getFormToken() . '=1'); $this->name = JText::_('COM_CONFIG_MAIL_SETTINGS'); $this->fieldsname = 'mail'; echo JLayoutHelper::render('joomla.content.options_default', $this); -echo ''; diff --git a/administrator/components/com_config/view/component/tmpl/default.php b/administrator/components/com_config/view/component/tmpl/default.php index 088b53e9f3..61bf9db7bf 100644 --- a/administrator/components/com_config/view/component/tmpl/default.php +++ b/administrator/components/com_config/view/component/tmpl/default.php @@ -17,6 +17,12 @@ JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); +// Load JS message titles +JText::script('ERROR'); +JText::script('WARNING'); +JText::script('NOTICE'); +JText::script('MESSAGE'); + JFactory::getDocument()->addScriptDeclaration( ' Joomla.submitbutton = function(task) @@ -47,8 +53,23 @@
diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index 6a571a8d52..45da91208d 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -1,13 +1,15 @@ -
+ > - + default="hide" + > - - + + @@ -43,218 +44,244 @@ - + default="0" + class="btn-group btn-group-yesno" + > - + description="COM_CONTACT_FIELD_PRESENTATION_DESC" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="0" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + class="btn-group btn-group-yesno" + > - - - + + + default="0" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + > - + default="10" + showon="show_articles:1" + > @@ -272,132 +299,171 @@ - + class="btn-group btn-group-yesno" + > - + class="btn-group btn-group-yesno" + > - - + - + - + - + - + + description="COM_CONTACT_FIELD_SHOW_TAGS_DESC" + id="show_tags" + default="1" + class="btn-group btn-group-yesno" + > -
-
- + + - - - + default="0" + > + + + - + label="COM_CONTACT_FIELD_ICONS_ADDRESS_LABEL" + description="COM_CONTACT_FIELD_ICONS_ADDRESS_DESC" + hide_none="1" + showon="contact_icons:0" + /> - + label="COM_CONTACT_FIELD_ICONS_EMAIL_LABEL" + description="COM_CONTACT_FIELD_ICONS_EMAIL_DESC" + hide_none="1" + showon="contact_icons:0" + /> - + description="COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC" + hide_none="1" + showon="contact_icons:0" + /> - + label="COM_CONTACT_FIELD_ICONS_MOBILE_LABEL" + description="COM_CONTACT_FIELD_ICONS_MOBILE_DESC" + hide_none="1" + showon="contact_icons:0" + /> - + label="COM_CONTACT_FIELD_ICONS_FAX_LABEL" + description="COM_CONTACT_FIELD_ICONS_FAX_DESC" + hide_none="1" + showon="contact_icons:0" + /> - + description="COM_CONTACT_FIELD_ICONS_MISC_DESC" + hide_none="1" + showon="contact_icons:0" + />
-
+
- - + > - + > - + description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" + default="-1" + > @@ -449,67 +523,84 @@ - + showon="maxLevel:-1,1,2,3,4,5" + > - + showon="maxLevel:-1,1,2,3,4,5" + > - + default="1" + class="btn-group btn-group-yesno" + > - + class="btn-group btn-group-yesno" + >
-
- + + + default="1" + class="btn-group btn-group-yesno" + > - + description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" + default="-1" + > + @@ -517,318 +608,384 @@ - + showon="maxLevelcat:-1,1,2,3,4,5" + > - - + showon="maxLevelcat:-1,1,2,3,4,5" + > - + default="1" + class="btn-group btn-group-yesno" + > -
-
+ > + - - + + - + > - + > - + + + + + + default="1" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="1" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_headings:1" + > - + + + + - - - - - - - - - + + + - - - - - + + + +
-
+ > - - + + - + default="1" + class="btn-group btn-group-yesno" + > - + default="1" + class="btn-group btn-group-yesno" + showon="show_email_form:1" + > - - - - + default="1" + class="btn-group btn-group-yesno" + showon="show_email_form:1" + > - + default="0" + class="btn-group btn-group-yesno" + showon="show_email_form:1" + > - + description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC" + size="30" + showon="show_email_form:1" + />
-
+ > - - + description="JGLOBAL_SHOW_FEED_LINK_DESC" + default="1" + class="btn-group btn-group-yesno" + > + + -
-
+ > - + section="component" + />
- diff --git a/administrator/components/com_contact/models/contact.php b/administrator/components/com_contact/models/contact.php index 8b0f79dbf5..a53da18198 100644 --- a/administrator/components/com_contact/models/contact.php +++ b/administrator/components/com_contact/models/contact.php @@ -384,6 +384,31 @@ public function save($data) { $input = JFactory::getApplication()->input; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_contact'); + } + + // Save New Category + if ($catid == 0) + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = 'com_contact'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + // Alter the name for save as copy if ($input->get('task') == 'save2copy') { diff --git a/administrator/components/com_contact/models/contacts.php b/administrator/components/com_contact/models/contacts.php index b3262f5f08..5510d2dcf3 100644 --- a/administrator/components/com_contact/models/contacts.php +++ b/administrator/components/com_contact/models/contacts.php @@ -49,6 +49,7 @@ public function __construct($config = array()) 'publish_down', 'a.publish_down', 'ul.name', 'linked_user', 'tag', + 'level', 'c.level', ); $assoc = JLanguageAssociations::isEnabled(); @@ -98,6 +99,7 @@ protected function populateState($ordering = 'a.name', $direction = 'asc') $this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', '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', null, 'int')); // List state information. parent::populateState($ordering, $direction); @@ -131,6 +133,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.language'); $id .= ':' . $this->getState('filter.tag'); + $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } @@ -244,7 +247,8 @@ protected function getListQuery() 'l.image' , 'uc.name' , 'ag.title' , - 'c.title' + 'c.title', + 'c.level' ) ) ); @@ -296,13 +300,6 @@ protected function getListQuery() { $query->where('a.id = ' . (int) substr($search, 3)); } - elseif (stripos($search, 'author:') === 0) - { - $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); - $query->where( - '(' . $db->quoteName('uc.name') . ' LIKE ' . $search . ' OR ' . $db->quoteName('uc.username') . ' LIKE ' . $search . ')' - ); - } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); @@ -332,6 +329,12 @@ protected function getListQuery() ); } + // Filter on the level. + if ($level = $this->getState('filter.level')) + { + $query->where('c.level <= ' . (int) $level); + } + // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.name'); $orderDirn = $this->state->get('list.direction', 'asc'); diff --git a/administrator/components/com_contact/models/fields/modal/contact.php b/administrator/components/com_contact/models/fields/modal/contact.php index e127419c43..b48268086d 100644 --- a/administrator/components/com_contact/models/fields/modal/contact.php +++ b/administrator/components/com_contact/models/fields/modal/contact.php @@ -19,7 +19,7 @@ class JFormFieldModal_Contact extends JFormField /** * The form field type. * - * @var string + * @var string * @since 1.6 */ protected $type = 'Modal_Contact'; @@ -27,7 +27,7 @@ class JFormFieldModal_Contact extends JFormField /** * Method to get the field input markup. * - * @return string The field input markup. + * @return string The field input markup. * * @since 1.6 */ @@ -39,8 +39,8 @@ protected function getInput() // Load language JFactory::getLanguage()->load('com_contact', JPATH_ADMINISTRATOR); - // Load the javascript - JHtml::_('bootstrap.tooltip'); + // The active contact id field. + $value = (int) $this->value > 0 ? (int) $this->value : ''; // Build the script. $script = array(); @@ -52,7 +52,11 @@ protected function getInput() if ($allowEdit) { - $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' if (id == "' . (int) $this->value . '") {'; + $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' } else {'; + $script[] = ' jQuery("#' . $this->id . '_edit").addClass("hidden");'; + $script[] = ' }'; } if ($allowClear) @@ -60,7 +64,7 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jQuery("#modalContact' . $this->id . '").modal("hide");'; + $script[] = ' jQuery("#contactSelect' . $this->id . 'Modal").modal("hide");'; if ($this->required) { @@ -70,6 +74,11 @@ protected function getInput() $script[] = ' }'; + // Edit button script + $script[] = ' function jEditContact_' . $value . '(name) {'; + $script[] = ' document.getElementById("' . $this->id . '_name").value = name;'; + $script[] = ' }'; + // Clear button script static $scriptClear; @@ -94,21 +103,30 @@ protected function getInput() // Setup variables for display. $html = array(); - $link = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component&function=jSelectContact_' . $this->id; + + $linkContacts = 'index.php?option=com_contact&view=contacts&layout=modal&tmpl=component' + . '&function=jSelectContact_' . $this->id; + + $linkContact = 'index.php?option=com_contact&view=contact&layout=modal&tmpl=component' + . '&task=contact.edit' + . '&function=jEditContact_' . $value; if (isset($this->element['language'])) { - $link .= '&forcedLanguage=' . $this->element['language']; + $linkContacts .= '&forcedLanguage=' . $this->element['language']; + $linkContact .= '&forcedLanguage=' . $this->element['language']; } - // Get the title of the linked chart - if ((int) $this->value > 0) + $urlSelect = $linkContacts . '&' . JSession::getFormToken() . '=1'; + $urlEdit = $linkContact . '&id=' . $value . '&' . JSession::getFormToken() . '=1'; + + if ($value) { - $db = JFactory::getDbo(); + $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('name')) ->from($db->quoteName('#__contact_details')) - ->where('id = ' . (int) $this->value); + ->where($db->quoteName('id') . ' = ' . (int) $value); $db->setQuery($query); try @@ -128,46 +146,31 @@ protected function getInput() $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - // The active contact id field. - if (0 == (int) $this->value) - { - $value = ''; - } - else - { - $value = (int) $this->value; - } - // The current contact display field. $html[] = ''; - $html[] = ''; - $html[] = 'id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />'; + + // Select contact button + $html[] = '' . ' ' . JText::_('JSELECT') . ''; - $html[] = JHtml::_( - 'bootstrap.renderModal', - 'modalContact' . $this->id, - array( - 'url' => $link . '&' . JSession::getFormToken() . '=1"', - 'title' => JText::_('COM_CONTACT_CHANGE_CONTACT'), - 'width' => '800px', - 'height' => '300px', - 'footer' => '' - ) - ); - - // Edit contact button. + // Edit contact button if ($allowEdit) { $html[] = '' - . '' . JText::_('JACTION_EDIT') + . ' id="' . $this->id . '_edit"' + . ' data-toggle="modal"' + . ' role="button"' + . ' href="#contactEdit' . $value . 'Modal"' + . ' title="' . JHtml::tooltipText('COM_CONTACT_EDIT_CONTACT') . '">' + . ' ' . JText::_('JACTION_EDIT') . ''; } @@ -175,8 +178,8 @@ protected function getInput() if ($allowClear) { $html[] = '' . '' . JText::_('JCLEAR') . ''; @@ -184,13 +187,50 @@ protected function getInput() $html[] = ''; - // Note: class='required' for client side validation. - $class = ''; + // Select contact modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'contactSelect' . $this->id . 'Modal', + array( + 'title' => JText::_('COM_CONTACT_CHANGE_CONTACT'), + 'url' => $urlSelect, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '', + ) + ); - if ($this->required) - { - $class = ' class="required modal-value"'; - } + // Edit contact modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'contactEdit' . $value . 'Modal', + array( + 'title' => JText::_('COM_CONTACT_EDIT_CONTACT'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $urlEdit, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', + ) + ); + + // Note: class='required' for client side validation. + $class = $this->required ? ' class="required modal-value"' : ''; $html[] = ''; diff --git a/administrator/components/com_contact/models/forms/contact.xml b/administrator/components/com_contact/models/forms/contact.xml index 726ef91c12..99de8f4a92 100644 --- a/administrator/components/com_contact/models/forms/contact.xml +++ b/administrator/components/com_contact/models/forms/contact.xml @@ -1,17 +1,21 @@
-
- + + - - - - - - - - - + + + + - - - + /> - + - + - + - + - + - - + /> - - - - - - + > - + class="btn-group btn-group-yesno" + > - - + /> - - - - + default="0" + > + + + - - - + description="COM_CONTACT_FIELD_ICONS_TELEPHONE_DESC" + hide_none="1" + /> - - -
+
- + description="COM_CONTACT_EDIT_DETAILS" + /> - + hide_none="1" + /> - - - - - - - - - - - - - + size="30" + /> - +
- + > - - + + - - - - - + > + + + + - + description="COM_CONTACT_FIELD_PRESENTATION_DESC" + > - + class="chzn-color" + > - + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + class="chzn-color" + > - + > - + default="" + > @@ -562,93 +690,115 @@ - + class="chzn-color" + > - + - - - - - - - + /> - - - + + />
-
- - + + class="chzn-color" + > - + class="chzn-color" + > - - - + - - + description="COM_CONTACT_FIELD_EMAIL_BANNED_SUBJECT_DESC" + rows="3" + cols="30" + /> - + + class="chzn-color" + > - + class="chzn-color" + > - + description="COM_CONTACT_FIELD_CONFIG_REDIRECT_DESC" + size="30" + />
+ -
- + + + > @@ -747,24 +914,35 @@ - - + size="20" + />
- - - + filter="unset" + /> + diff --git a/administrator/components/com_contact/models/forms/filter_contacts.xml b/administrator/components/com_contact/models/forms/filter_contacts.xml index a51f93ffb3..7e9433bbb5 100755 --- a/administrator/components/com_contact/models/forms/filter_contacts.xml +++ b/administrator/components/com_contact/models/forms/filter_contacts.xml @@ -1,13 +1,16 @@
+ + + + + + JOPTION_SELECT_LANGUAGE + + + + + + + @@ -82,20 +105,31 @@ - - + + + diff --git a/administrator/components/com_contact/tables/contact.php b/administrator/components/com_contact/tables/contact.php index 5fe794904a..ee6c1ed309 100644 --- a/administrator/components/com_contact/tables/contact.php +++ b/administrator/components/com_contact/tables/contact.php @@ -228,7 +228,7 @@ public function generateAlias() $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language); if (trim(str_replace('-', '', $this->alias)) == '') { diff --git a/administrator/components/com_contact/views/contact/tmpl/edit.php b/administrator/components/com_contact/views/contact/tmpl/edit.php index 1d72371606..28e330d9e9 100644 --- a/administrator/components/com_contact/views/contact/tmpl/edit.php +++ b/administrator/components/com_contact/views/contact/tmpl/edit.php @@ -13,9 +13,12 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); +JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); $app = JFactory::getApplication(); +$input = $app->input; + $assoc = JLanguageAssociations::isEnabled(); JFactory::getDocument()->addScriptDeclaration(' @@ -25,22 +28,32 @@ { ' . $this->form->getField("misc")->save() . ' Joomla.submitform(task, document.getElementById("contact-form")); + + if (task !== "contact.apply") + { + window.parent.jQuery("#contactEdit' . $this->item->id . 'Modal").modal("hide"); + } } }; '); // Fieldsets to not automatically render by /layouts/joomla/edit/params.php $this->ignore_fieldsets = array('details', 'item_associations', 'jmetadata'); + +// In case of modal +$isModal = $input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal ? '&tmpl=component' : ''; ?> - +
'details')); ?> - item->id) ? JText::_('COM_CONTACT_NEW_CONTACT', true) : JText::_('COM_CONTACT_EDIT_CONTACT', true)); ?> + item->id) ? JText::_('COM_CONTACT_NEW_CONTACT') : JText::_('COM_CONTACT_EDIT_CONTACT')); ?>
@@ -72,7 +85,7 @@
- +
form->renderField('misc'); ?> @@ -80,7 +93,7 @@
- +
@@ -93,10 +106,12 @@ - - + + loadTemplate('associations'); ?> + + diff --git a/administrator/components/com_contact/views/contact/tmpl/edit_params.php b/administrator/components/com_contact/views/contact/tmpl/edit_params.php index 9f7d2cacca..6cef8b8f8b 100644 --- a/administrator/components/com_contact/views/contact/tmpl/edit_params.php +++ b/administrator/components/com_contact/views/contact/tmpl/edit_params.php @@ -12,7 +12,7 @@ $fieldSets = $this->form->getFieldsets('params'); foreach ($fieldSets as $name => $fieldSet) : $paramstabs = 'params-' . $name; - echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label, true)); + echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label)); if (isset($fieldSet->description) && trim($fieldSet->description)) : echo '

' . $this->escape(JText::_($fieldSet->description)) . '

'; diff --git a/administrator/components/com_contact/views/contact/tmpl/modal.php b/administrator/components/com_contact/views/contact/tmpl/modal.php index 557bce1356..6756467558 100644 --- a/administrator/components/com_contact/views/contact/tmpl/modal.php +++ b/administrator/components/com_contact/views/contact/tmpl/modal.php @@ -9,115 +9,24 @@ defined('_JEXEC') or die; -// Include the component HTML helpers. -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); -JHtml::_('behavior.formvalidator'); -JHtml::_('formbehavior.chosen', 'select'); - -$app = JFactory::getApplication(); - -$input = $app->input; -$assoc = JLanguageAssociations::isEnabled(); +$function = JFactory::getApplication()->input->getCmd('function', 'jEditContact_' . (int) $this->item->id); +// Function to update input title when changed JFactory::getDocument()->addScriptDeclaration(' - Joomla.submitbutton = function(task) - { - if (task == "contact.cancel" || document.formvalidator.isValid(document.getElementById("contact-form"))) - { - ' . $this->form->getField('misc')->save() . ' - - if (window.opener && (task == "contact.save" || task == "contact.cancel")) - { - window.opener.document.closeEditWindow = self; - window.opener.setTimeout("window.document.closeEditWindow.close()", 1000); - } - - Joomla.submitform(task, document.getElementById("contact-form")); + function jEditContactModal() { + if (window.parent && document.formvalidator.isValid(document.getElementById("contact-form"))) { + return window.parent.' . $this->escape($function) . '(document.getElementById("jform_name").value); } - }; + } '); - -// Fieldsets to not automatically render by /layouts/joomla/edit/params.php -$this->ignore_fieldsets = array('details', 'display', 'email', 'item_associations'); ?> -
+ + + -
- - - +
+ setLayout('edit'); ?> + loadTemplate(); ?>
- -
-
- - - - - -
- 'details')); ?> - - item->id) ? JText::_('COM_CONTACT_NEW_CONTACT', true) : JText::_('COM_CONTACT_EDIT_CONTACT', true)); ?> -
-
-
-
- form->renderField('user_id'); ?> - form->renderField('image'); ?> - form->renderField('con_position'); ?> - form->renderField('email_to'); ?> - form->renderField('address'); ?> - form->renderField('suburb'); ?> - form->renderField('state'); ?> - form->renderField('postcode'); ?> - form->renderField('country'); ?> -
-
- form->renderField('telephone'); ?> - form->renderField('mobile'); ?> - form->renderField('fax'); ?> - form->renderField('webpage'); ?> - form->renderField('sortname1'); ?> - form->renderField('sortname2'); ?> - form->renderField('sortname3'); ?> -
-
-
-
- -
-
- - - -
-
- form->renderField('misc'); ?> -
-
- - - -
-
- -
-
- -
-
- - - - - - - - - -
- - - diff --git a/administrator/components/com_contact/views/contact/tmpl/modal_params.php b/administrator/components/com_contact/views/contact/tmpl/modal_params.php index 9f7d2cacca..6cef8b8f8b 100644 --- a/administrator/components/com_contact/views/contact/tmpl/modal_params.php +++ b/administrator/components/com_contact/views/contact/tmpl/modal_params.php @@ -12,7 +12,7 @@ $fieldSets = $this->form->getFieldsets('params'); foreach ($fieldSets as $name => $fieldSet) : $paramstabs = 'params-' . $name; - echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label, true)); + echo JHtml::_('bootstrap.addTab', 'myTab', $paramstabs, JText::_($fieldSet->label)); if (isset($fieldSet->description) && trim($fieldSet->description)) : echo '

' . $this->escape(JText::_($fieldSet->description)) . '

'; diff --git a/administrator/components/com_contact/views/contacts/tmpl/default.php b/administrator/components/com_contact/views/contacts/tmpl/default.php index 45a206fd20..ba70da05ed 100644 --- a/administrator/components/com_contact/views/contacts/tmpl/default.php +++ b/administrator/components/com_contact/views/contacts/tmpl/default.php @@ -19,8 +19,6 @@ $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$archived = $this->state->get('filter.published') == 2 ? true : false; -$trashed = $this->state->get('filter.published') == -2 ? true : false; $saveOrder = $listOrder == 'a.ordering'; $assoc = JLanguageAssociations::isEnabled(); @@ -129,16 +127,13 @@
published, $i, 'contacts.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - escape($item->name)); + published === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'contacts'); + JHtml::_('actionsdropdown.' . ((int) $item->published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'contacts'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); + } ?>
diff --git a/administrator/components/com_contact/views/contacts/tmpl/modal.php b/administrator/components/com_contact/views/contacts/tmpl/modal.php index 046cea6fed..6279cb306c 100644 --- a/administrator/components/com_contact/views/contacts/tmpl/modal.php +++ b/administrator/components/com_contact/views/contacts/tmpl/modal.php @@ -14,118 +14,128 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.core'); -JHtml::_('bootstrap.tooltip'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('formbehavior.chosen', 'select'); +// Special case for the search field tooltip. +$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); +JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); + $app = JFactory::getApplication(); $function = $app->input->getCmd('function', 'jSelectContact'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
-
- $this)); ?> - items)) : ?> -
- -
- - - - - - - - - - - - - - - - - - - 'icon-trash', - 0 => 'icon-unpublish', - 1 => 'icon-publish', - 2 => 'icon-archive', - ); - ?> - items as $i => $item) : ?> - language && JLanguageMultilang::isEnabled()) - { - $tag = strlen($item->language); - if ($tag == 5) +
+ + + + $this)); ?> + + items)) : ?> +
+ +
+ +
- - - - - - - - - - - -
- pagination->getListFooter(); ?> -
+ + + + + + + + + + + + + + + + + 'icon-trash', + 0 => 'icon-unpublish', + 1 => 'icon-publish', + 2 => 'icon-archive', + ); + ?> + items as $i => $item) : ?> + language && JLanguageMultilang::isEnabled()) { - $lang = substr($item->language, 0, 2); + $tag = strlen($item->language); + if ($tag == 5) + { + $lang = substr($item->language, 0, 2); + } + elseif ($tag == 6) + { + $lang = substr($item->language, 0, 3); + } + else { + $lang = ""; + } } - elseif ($tag == 6) + elseif (!JLanguageMultilang::isEnabled()) { - $lang = substr($item->language, 0, 3); - } - else { $lang = ""; } - } - elseif (!JLanguageMultilang::isEnabled()) - { - $lang = ""; - } - ?> - - - - - - - - - - -
+ + + + + + + + + + + +
+ pagination->getListFooter(); ?> +
- - - - escape($item->name); ?> -
- escape($item->category_title); ?> -
-
- linked_user)) : ?> - linked_user; ?> - - - escape($item->access_level); ?> - - language == '*') : ?> - - - 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'); ?> - - - id; ?> -
- - - - -
+ ?> + + + + + + + escape($item->name); ?> +
+ escape($item->category_title); ?> +
+ + + linked_user)) : ?> + linked_user; ?> + + + + escape($item->access_level); ?> + + + language == '*') : ?> + + + 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'); ?> + + + + id; ?> + + + + + + + + + + + + +
diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 3fad987605..b58cb44866 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -31,7 +31,8 @@ class="btn-group btn-group-yesno" default="1" label="JGLOBAL_LINKED_TITLES_LABEL" - description="JGLOBAL_LINKED_TITLES_DESC"> + description="JGLOBAL_LINKED_TITLES_DESC" + showon="show_title:1"> @@ -58,6 +59,17 @@ + + + + + + default="1" + showon="show_category:1"> @@ -97,7 +110,8 @@ class="btn-group btn-group-yesno" label="JGLOBAL_LINK_PARENT_CATEGORY_LABEL" description="JGLOBAL_LINK_PARENT_CATEGORY_DESC" - default="1"> + default="1" + showon="show_parent_category:1"> @@ -125,7 +139,8 @@ class="btn-group btn-group-yesno" label="JGLOBAL_LINK_AUTHOR_LABEL" description="JGLOBAL_LINK_AUTHOR_DESC" - default="0"> + default="0" + showon="show_author:1"> @@ -201,7 +216,8 @@ class="btn-group btn-group-yesno" label="JGLOBAL_SHOW_READMORE_TITLE_LABEL" description="JGLOBAL_SHOW_READMORE_TITLE_DESC" - default="1"> + default="1" + showon="show_readmore:1"> @@ -212,6 +228,7 @@ label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL" description="JGLOBAL_SHOW_READMORE_LIMIT_DESC" default="100" + showon="show_readmore:1[AND]show_readmore_title:1" /> + default="1" + showon="show_icons:1"> @@ -259,7 +277,8 @@ class="btn-group btn-group-yesno" label="JGLOBAL_SHOW_EMAIL_ICON_LABEL" description="JGLOBAL_SHOW_EMAIL_ICON_DESC" - default="1"> + default="1" + showon="show_icons:1"> @@ -337,6 +356,7 @@ label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" default="10" + showon="save_history:1" /> @@ -385,6 +406,7 @@ description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="Parent" filter="int" + showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > @@ -398,6 +420,7 @@ description="COM_CONTENT_URL_FIELD_BROWSERNAV_DESC" default="Parent" filter="int" + showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" > @@ -414,7 +437,9 @@ name="float_intro" type="list" label="COM_CONTENT_FLOAT_INTRO_LABEL" - description="COM_CONTENT_FLOAT_DESC"> + description="COM_CONTENT_FLOAT_DESC" + showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" + > @@ -423,7 +448,9 @@ name="float_fulltext" type="list" label="COM_CONTENT_FLOAT_FULLTEXT_LABEL" - description="COM_CONTENT_FLOAT_DESC"> + description="COM_CONTENT_FLOAT_DESC" + showon="show_urls_images_backend:1[OR]show_urls_images_frontend:1" + > @@ -575,6 +602,7 @@ description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" label="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_LABEL" > + @@ -589,6 +617,7 @@ default="0" label="JGLOBAL_SHOW_EMPTY_CATEGORIES_LABEL" description="COM_CONTENT_SHOW_EMPTY_CATEGORIES_DESC" + showon="maxLevelcat:-1,1,2,3,4,5" > @@ -600,6 +629,7 @@ default="1" label="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_LABEL" description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC" + showon="maxLevelcat:-1,1,2,3,4,5" > @@ -709,6 +739,7 @@ + + description="JGLOBAL_DATE_FORMAT_DESC" + showon="list_show_date:created,modified,published" + /> @@ -829,7 +863,9 @@ class="btn-group btn-group-yesno" default="1" label="JGLOBAL_PAGINATION_RESULTS_LABEL" - description="JGLOBAL_PAGINATION_RESULTS_DESC"> + description="JGLOBAL_PAGINATION_RESULTS_DESC" + showon="show_pagination:1,2" + > @@ -866,7 +902,9 @@ type="list" label="JGLOBAL_FEED_SUMMARY_LABEL" description="JGLOBAL_FEED_SUMMARY_DESC" - default="0"> + default="0" + showon="show_feed_link:1" + > diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php index 2c18255e73..01656c6429 100644 --- a/administrator/components/com_content/models/article.php +++ b/administrator/components/com_content/models/article.php @@ -493,6 +493,31 @@ public function save($data) $data['images'] = (string) $registry; } + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_content'); + } + + // Save New Category + if ($catid == 0) + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = 'com_content'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + if (isset($data['urls']) && is_array($data['urls'])) { $check = $input->post->get('jform', array(), 'array'); @@ -778,7 +803,7 @@ protected function cleanCache($group = null, $client_id = 0) * * @return void * - * @since 3.5.2 + * @since 3.6.0 */ public function hit() { diff --git a/administrator/components/com_content/models/featured.php b/administrator/components/com_content/models/featured.php index 2603f53772..1292491004 100644 --- a/administrator/components/com_content/models/featured.php +++ b/administrator/components/com_content/models/featured.php @@ -171,6 +171,11 @@ protected function getListQuery($resolveFKs = true) { $query->where('a.id = ' . (int) substr($search, 3)); } + elseif (stripos($search, 'author:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); + $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); + } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); diff --git a/administrator/components/com_content/models/fields/modal/article.php b/administrator/components/com_content/models/fields/modal/article.php index fbefc0d441..764a17bb96 100644 --- a/administrator/components/com_content/models/fields/modal/article.php +++ b/administrator/components/com_content/models/fields/modal/article.php @@ -19,7 +19,7 @@ class JFormFieldModal_Article extends JFormField /** * The form field type. * - * @var string + * @var string * @since 1.6 */ protected $type = 'Modal_Article'; @@ -27,7 +27,7 @@ class JFormFieldModal_Article extends JFormField /** * Method to get the field input markup. * - * @return string The field input markup. + * @return string The field input markup. * * @since 1.6 */ @@ -39,6 +39,9 @@ protected function getInput() // Load language JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR); + // The active article id field. + $value = (int) $this->value > 0 ? (int) $this->value : ''; + // Build the script. $script = array(); @@ -49,7 +52,11 @@ protected function getInput() if ($allowEdit) { - $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' if (id == "' . $value . '") {'; + $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' } else {'; + $script[] = ' jQuery("#' . $this->id . '_edit").addClass("hidden");'; + $script[] = ' }'; } if ($allowClear) @@ -57,7 +64,7 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jQuery("#modalArticle' . $this->id . '").modal("hide");'; + $script[] = ' jQuery("#articleSelect' . $this->id . 'Modal").modal("hide");'; if ($this->required) { @@ -67,6 +74,11 @@ protected function getInput() $script[] = ' }'; + // Edit button script + $script[] = ' function jEditArticle_' . $value . '(title) {'; + $script[] = ' document.getElementById("' . $this->id . '_name").value = title;'; + $script[] = ' }'; + // Clear button script static $scriptClear; @@ -91,20 +103,30 @@ protected function getInput() // Setup variables for display. $html = array(); - $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_' . $this->id; + + $linkArticles = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component' + . '&function=jSelectArticle_' . $this->id; + + $linkArticle = 'index.php?option=com_content&view=article&layout=modal&tmpl=component' + . '&task=article.edit' + . '&function=jEditArticle_' . $value; if (isset($this->element['language'])) { - $link .= '&forcedLanguage=' . $this->element['language']; + $linkArticles .= '&forcedLanguage=' . $this->element['language']; + $linkArticle .= '&forcedLanguage=' . $this->element['language']; } - if ((int) $this->value > 0) + $urlSelect = $linkArticles . '&' . JSession::getFormToken() . '=1'; + $urlEdit = $linkArticle . '&id=' . $value . '&' . JSession::getFormToken() . '=1'; + + if ($value) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('title')) ->from($db->quoteName('#__content')) - ->where($db->quoteName('id') . ' = ' . (int) $this->value); + ->where($db->quoteName('id') . ' = ' . (int) $value); $db->setQuery($query); try @@ -121,67 +143,97 @@ protected function getInput() { $title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE'); } - $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - - // The active article id field. - if (0 == (int) $this->value) - { - $value = ''; - } - else - { - $value = (int) $this->value; - } - $url = $link . '&' . JSession::getFormToken() . '=1'; + $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The current article display field. $html[] = ''; - $html[] = ''; - $html[] = '' - . ' ' - . JText::_('JSELECT') . ''; + $html[] = ''; + + // Select article button + $html[] = '' + . ' ' . JText::_('JSELECT') + . ''; // Edit article button if ($allowEdit) { - $html[] = '' . JText::_('JACTION_EDIT') . ''; + $html[] = '' + . ' ' . JText::_('JACTION_EDIT') + . ''; } // Clear article button if ($allowClear) { - $html[] = ''; + $html[] = '' + . '' . JText::_('JCLEAR') + . ''; } $html[] = ''; - // The class='required' for client side validation - $class = ''; - - if ($this->required) - { - $class = ' class="required modal-value"'; - } - - $html[] = ''; + // Select article modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'articleSelect' . $this->id . 'Modal', + array( + 'title' => JText::_('COM_CONTENT_CHANGE_ARTICLE'), + 'url' => $urlSelect, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '', + ) + ); + // Edit article modal $html[] = JHtml::_( 'bootstrap.renderModal', - 'modalArticle' . $this->id, + 'articleEdit' . $value . 'Modal', array( - 'url' => $url, - 'title' => JText::_('COM_CONTENT_CHANGE_ARTICLE'), - 'width' => '800px', - 'height' => '300px', - 'footer' => '' + 'title' => JText::_('COM_CONTENT_EDIT_ARTICLE'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $urlEdit, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', ) ); + + // Note: class='required' for client side validation. + $class = $this->required ? ' class="required modal-value"' : ''; + + $html[] = ''; + return implode("\n", $html); } diff --git a/administrator/components/com_content/models/forms/article.xml b/administrator/components/com_content/models/forms/article.xml index 1ed973d17f..e3d3df72a2 100644 --- a/administrator/components/com_content/models/forms/article.xml +++ b/administrator/components/com_content/models/forms/article.xml @@ -42,9 +42,13 @@ JTRASHED - @@ -201,6 +205,17 @@ + + + + + + diff --git a/administrator/components/com_content/models/forms/filter_featured.xml b/administrator/components/com_content/models/forms/filter_featured.xml index ae1c6a4bc4..1982c54a48 100644 --- a/administrator/components/com_content/models/forms/filter_featured.xml +++ b/administrator/components/com_content/models/forms/filter_featured.xml @@ -4,10 +4,9 @@ + + - - diff --git a/administrator/components/com_content/views/article/tmpl/edit.php b/administrator/components/com_content/views/article/tmpl/edit.php index 063d502d73..a39fe36477 100644 --- a/administrator/components/com_content/views/article/tmpl/edit.php +++ b/administrator/components/com_content/views/article/tmpl/edit.php @@ -14,7 +14,7 @@ JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); $this->configFieldsets = array('editorConfig'); $this->hiddenFieldsets = array('basic-limited'); @@ -25,6 +25,7 @@ $app = JFactory::getApplication(); $input = $app->input; + $assoc = JLanguageAssociations::isEnabled(); // This checks if the config options have ever been saved. If they haven't they will fall back to the original settings. @@ -68,20 +69,29 @@ jQuery("#permissions-sliders select").attr("disabled", "disabled"); ' . $this->form->getField('articletext')->save() . ' Joomla.submitform(task, document.getElementById("item-form")); + + if (task !== "article.apply") + { + window.parent.jQuery("#articleEdit' . (int) $this->item->id . 'Modal").modal("hide"); + } } }; '); +// In case of modal +$isModal = $input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal ? '&tmpl=component' : ''; ?> -
+
'general')); ?> - +
@@ -96,7 +106,7 @@ show_publishing_options == 1) : ?> - +
@@ -110,7 +120,7 @@ show_urls_images_backend == 1) : ?> - +
form->getControlGroup('images'); ?> @@ -127,23 +137,25 @@ - - - loadTemplate('associations'); ?> + + + loadTemplate('associations'); ?> + + show_options = $params->show_article_options; ?> canDo->get('core.admin')) : ?> - + form->renderFieldset('editorConfig'); ?> canDo->get('core.admin')) : ?> - + form->getInput('rules'); ?> @@ -153,7 +165,5 @@ - - -
+
diff --git a/administrator/components/com_content/views/article/tmpl/modal.php b/administrator/components/com_content/views/article/tmpl/modal.php index 1c6a5c2b06..2352299cea 100644 --- a/administrator/components/com_content/views/article/tmpl/modal.php +++ b/administrator/components/com_content/views/article/tmpl/modal.php @@ -9,163 +9,24 @@ defined('_JEXEC') or die; -// Include the component HTML helpers. -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); +$function = JFactory::getApplication()->input->getCmd('function', 'jEditArticle_' . (int) $this->item->id); -JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select'); - -$this->configFieldsets = array('editorConfig'); -$this->hiddenFieldsets = array('basic-limited'); -$this->ignore_fieldsets = array('jmetadata', 'item_associations'); - -// Create shortcut to parameters. -$params = $this->state->get('params'); - -$app = JFactory::getApplication(); -$input = $app->input; -$assoc = JLanguageAssociations::isEnabled(); - -// This checks if the config options have ever been saved. If they haven't they will fall back to the original settings. -$params = json_decode($params); -$editoroptions = isset($params->show_publishing_options); - -if (!$editoroptions) -{ - $params->show_publishing_options = '1'; - $params->show_article_options = '1'; - $params->show_urls_images_backend = '0'; - $params->show_urls_images_frontend = '0'; -} - -// Check if the article uses configuration settings besides global. If so, use them. -if (isset($this->item->attribs['show_publishing_options']) && $this->item->attribs['show_publishing_options'] != '') -{ - $params->show_publishing_options = $this->item->attribs['show_publishing_options']; -} - -if (isset($this->item->attribs['show_article_options']) && $this->item->attribs['show_article_options'] != '') -{ - $params->show_article_options = $this->item->attribs['show_article_options']; -} - -if (isset($this->item->attribs['show_urls_images_frontend']) && $this->item->attribs['show_urls_images_frontend'] != '') -{ - $params->show_urls_images_frontend = $this->item->attribs['show_urls_images_frontend']; -} - -if (isset($this->item->attribs['show_urls_images_backend']) && $this->item->attribs['show_urls_images_backend'] != '') -{ - $params->show_urls_images_backend = $this->item->attribs['show_urls_images_backend']; -} - +// Function to update input title when changed JFactory::getDocument()->addScriptDeclaration(' - Joomla.submitbutton = function(task) - { - if (task == "article.cancel" || document.formvalidator.isValid(document.getElementById("item-form"))) - { - ' . $this->form->getField('articletext')->save() . ' - if (window.opener && (task == "article.save" || task == "article.cancel")) - { - window.opener.document.closeEditWindow = self; - window.opener.setTimeout("window.document.closeEditWindow.close()", 1000); - } - - Joomla.submitform(task, document.getElementById("item-form")); + function jEditArticleModal() { + if (window.parent && document.formvalidator.isValid(document.getElementById("item-form"))) { + return window.parent.' . $this->escape($function) . '(document.getElementById("jform_title").value); } - }; + } '); - ?> + + +
- -
- - - + setLayout('edit'); ?> + loadTemplate(); ?>
- -
-
- -
- - -
- 'general')); ?> - - -
-
-
- form->getInput('articletext'); ?> -
-
-
- -
-
- - - - show_publishing_options == 1) : ?> - -
-
- -
-
- -
-
- - - - - show_urls_images_backend == 1) : ?> - -
-
- form->getControlGroup('images'); ?> - form->getGroup('images') as $field) : ?> - getControlGroup(); ?> - -
-
- form->getGroup('urls') as $field) : ?> - getControlGroup(); ?> - -
-
- - - - - - - - show_options = $params->show_article_options; ?> - - - canDo->get('core.admin')) : ?> - - form->renderFieldset('editorConfig'); ?> - - - - canDo->get('core.admin')) : ?> - - form->getInput('rules'); ?> - - - - - - - - -
-
diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php index 8dc74b058c..9f58183127 100644 --- a/administrator/components/com_content/views/article/view.html.php +++ b/administrator/components/com_content/views/article/view.html.php @@ -27,7 +27,7 @@ class ContentViewArticle extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_content/views/articles/tmpl/default.php b/administrator/components/com_content/views/articles/tmpl/default.php index 1e37da6461..9b2876b9a3 100644 --- a/administrator/components/com_content/views/articles/tmpl/default.php +++ b/administrator/components/com_content/views/articles/tmpl/default.php @@ -20,8 +20,6 @@ $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$archived = $this->state->get('filter.published') == 2 ? true : false; -$trashed = $this->state->get('filter.published') == -2 ? true : false; $saveOrder = $listOrder == 'a.ordering'; $columns = 10; @@ -136,16 +134,13 @@
state, $i, 'articles.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> featured, $i, $canChange); ?> - escape($item->title)); + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'articles'); + JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'articles'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); + } ?>
diff --git a/administrator/components/com_content/views/articles/tmpl/modal.php b/administrator/components/com_content/views/articles/tmpl/modal.php index dc6a5deabf..9365c667e9 100644 --- a/administrator/components/com_content/views/articles/tmpl/modal.php +++ b/administrator/components/com_content/views/articles/tmpl/modal.php @@ -18,26 +18,33 @@ require_once JPATH_ROOT . '/components/com_content/helpers/route.php'; +// Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); + JHtml::_('behavior.core'); -JHtml::_('bootstrap.tooltip'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('formbehavior.chosen', 'select'); +// Special case for the search field tooltip. +$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); +JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); + $function = $app->input->getCmd('function', 'jSelectArticle'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
-
+
+ + $this)); ?>
items)) : ?> -
- -
+
+ +
@@ -48,7 +55,7 @@ - - @@ -113,7 +120,7 @@ - - @@ -136,5 +143,6 @@ - - + + + diff --git a/administrator/components/com_content/views/featured/tmpl/default.php b/administrator/components/com_content/views/featured/tmpl/default.php index 8fed5a83c9..cbc40e0bb0 100644 --- a/administrator/components/com_content/views/featured/tmpl/default.php +++ b/administrator/components/com_content/views/featured/tmpl/default.php @@ -20,32 +20,39 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $canOrder = $user->authorise('core.edit.state', 'com_content.article'); -$archived = $this->state->get('filter.published') == 2 ? true : false; -$trashed = $this->state->get('filter.published') == -2 ? true : false; $saveOrder = $listOrder == 'fp.ordering'; + +if ($saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_content&task=featured.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); +} ?> sidebar)) : ?> -
- sidebar; ?> -
-
- -
- - $this)); - ?> - items)) : ?> -
- -
+
+ sidebar; ?> +
+
-
+ @@ -57,7 +64,7 @@ +
escape($item->access_level); ?> + language == '*'): ?> @@ -123,7 +130,7 @@ created, JText::_('DATE_FORMAT_LC4')); ?> + id; ?>
- +
+ + $this)); + ?> + items)) : ?> +
+ +
+ +
+ + @@ -55,12 +62,6 @@ - @@ -80,122 +81,123 @@ - - + + - - - items); ?> - items as $i => $item) : - $item->max_ordering = 0; - $ordering = ($listOrder == 'fp.ordering'); - $assetId = 'com_content.article.' . $item->id; - $canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid); - $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); - $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; - $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; - ?> - - - + items); ?> + items as $i => $item) : + $item->max_ordering = 0; + $ordering = ($listOrder == 'fp.ordering'); + $assetId = 'com_content.article.' . $item->id; + $canCreate = $user->authorise('core.create', 'com_content.category.' . $item->catid); + $canEdit = $user->authorise('core.edit', 'com_content.article.' . $item->id); + $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; + $canChange = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin; + ?> + + - + + - + - - - - - - - + + + + + + + + - -
+ + - - - items, 'filesave.png', 'featured.saveorder'); ?> - -
pagination->getListFooter(); ?>
- id); ?> - -
- state, $i, 'articles.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - featured, $i, $canChange); ?> + +
escape($item->title)); + if (!$canChange) + { + $iconClass = ' inactive'; + } + elseif (!$saveOrder) + { + $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } ?> - - -
- checked_out) : ?> - editor, $item->checked_out_time, 'articles.', $canCheckin); ?> - - language == '*') : ?> - - - language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> - - - - escape($item->title); ?> - - escape($item->title); ?> + + + + + - - escape($item->alias)); ?> - -
- escape($item->category_title); ?> +
+ id); ?> + +
+ state, $i, 'articles.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> + featured, $i, $canChange); ?> + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'articles'); + JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'articles'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); + } + ?>
- -
- -
- - pagination->orderUpIcon($i, true, 'featured.orderup', 'JLIB_HTML_MOVE_UP', $ordering); ?> - pagination->orderDownIcon($i, $count, true, 'featured.orderdown', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> - - pagination->orderUpIcon($i, true, 'featured.orderdown', 'JLIB_HTML_MOVE_UP', $ordering); ?> - pagination->orderDownIcon($i, $count, true, 'featured.orderup', 'JLIB_HTML_MOVE_DOWN', $ordering); ?> +
+
+ checked_out) : ?> + editor, $item->checked_out_time, 'articles.', $canCheckin); ?> - + language == '*') : ?> + + + language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + + escape($item->title); ?> + + escape($item->title); ?> + + + escape($item->alias)); ?> + +
+ escape($item->category_title); ?> +
- - ordering; ?> - -
- escape($item->access_level); ?> - - created_by_alias) : ?> - escape($item->author_name); ?> -
escape($item->created_by_alias)); ?>
- - escape($item->author_name); ?> - -
- language == '*'):?> - - - 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'); ?> - - - created, JText::_('DATE_FORMAT_LC4')); ?> - - hits; ?> - - id; ?> -
+ escape($item->access_level); ?> + + created_by_alias) : ?> + escape($item->author_name); ?> +

escape($item->created_by_alias)); ?>

+ + escape($item->author_name); ?> + +
+ language == '*'):?> + + + 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'); ?> + + + created, JText::_('DATE_FORMAT_LC4')); ?> + + hits; ?> + + id; ?> +
- + + + - - - - -
+ + + + +
diff --git a/administrator/components/com_contenthistory/views/compare/tmpl/compare.php b/administrator/components/com_contenthistory/views/compare/tmpl/compare.php index 6364b4a754..cd57201884 100644 --- a/administrator/components/com_contenthistory/views/compare/tmpl/compare.php +++ b/administrator/components/com_contenthistory/views/compare/tmpl/compare.php @@ -62,7 +62,7 @@ $value) : ?> value == $object2->$name->value) ? 'items-equal' : 'items-not-equal'; ?> - value)): ?> + value)) : ?> label; ?> value as $subName => $subValue): ?> @@ -71,8 +71,8 @@ value == $newSubValue) ? 'items-equal' : 'items-not-equal'; ?>   label; ?> - value); ?> - + value, ENT_COMPAT, 'UTF-8'); ?> + value; ?> @@ -84,7 +84,7 @@ label; ?> value); ?> $name->value = is_object($object2->$name->value) ? json_encode($object2->$name->value) : $object2->$name->value; ?> - $name->value); ?> + $name->value, ENT_COMPAT, 'UTF-8'); ?> value; ?> $name->value; ?> diff --git a/administrator/components/com_cpanel/views/cpanel/view.html.php b/administrator/components/com_cpanel/views/cpanel/view.html.php index e69ca44711..189ec63c6d 100644 --- a/administrator/components/com_cpanel/views/cpanel/view.html.php +++ b/administrator/components/com_cpanel/views/cpanel/view.html.php @@ -28,7 +28,7 @@ class CpanelViewCpanel extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_finder/config.xml b/administrator/components/com_finder/config.xml index a54556f66d..a821957fbd 100644 --- a/administrator/components/com_finder/config.xml +++ b/administrator/components/com_finder/config.xml @@ -31,7 +31,9 @@ default="255" filter="integer" label="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_LABEL" - description="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_DESCRIPTION" /> + description="COM_FINDER_CONFIG_DESCRIPTION_LENGTH_DESCRIPTION" + showon="show_description:1" + /> + description="COM_FINDER_CONFIG_SHOW_ADVANCED_TIPS_DESCRIPTION" + showon="show_advanced:1" + > @@ -106,7 +110,9 @@ class="btn-group btn-group-yesno" default="0" label="COM_FINDER_CONFIG_EXPAND_ADVANCED_LABEL" - description="COM_FINDER_CONFIG_EXPAND_ADVANCED_DESCRIPTION"> + description="COM_FINDER_CONFIG_EXPAND_ADVANCED_DESCRIPTION" + showon="show_advanced:1" + > @@ -116,7 +122,9 @@ class="btn-group btn-group-yesno" default="0" label="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_LABEL" - description="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_DESCRIPTION"> + description="COM_FINDER_CONFIG_SHOW_DATE_FILTERS_DESCRIPTION" + showon="show_advanced:1" + > @@ -243,7 +251,9 @@ type="list" default="snowball" label="COM_FINDER_CONFIG_STEMMER_LABEL" - description="COM_FINDER_CONFIG_STEMMER_DESCRIPTION" > + description="COM_FINDER_CONFIG_STEMMER_DESCRIPTION" + showon="stem:1" + > diff --git a/administrator/components/com_finder/controllers/filter.php b/administrator/components/com_finder/controllers/filter.php index d45e24cad9..4432466220 100644 --- a/administrator/components/com_finder/controllers/filter.php +++ b/administrator/components/com_finder/controllers/filter.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Indexer controller class for Finder. * @@ -144,7 +146,7 @@ public function save($key = null, $urlVar = null) // Get and sanitize the filter data. $validData['data'] = $input->post->get('t', array(), 'array'); $validData['data'] = array_unique($validData['data']); - JArrayHelper::toInteger($validData['data']); + $validData['data'] = ArrayHelper::toInteger($validData['data']); // Remove any values of zero. if (array_search(0, $validData['data'], true)) diff --git a/administrator/components/com_finder/controllers/indexer.json.php b/administrator/components/com_finder/controllers/indexer.json.php index 59691469f8..31e8215a63 100644 --- a/administrator/components/com_finder/controllers/indexer.json.php +++ b/administrator/components/com_finder/controllers/indexer.json.php @@ -251,7 +251,7 @@ public function optimize() /** * Method to handle a send a JSON response. The body parameter - * can be a Exception object for when an error has occurred or + * can be an Exception object for when an error has occurred or * a JObject for a good response. * * @param mixed $data JObject on success, Exception on error. [optional] diff --git a/administrator/components/com_finder/helpers/finder.php b/administrator/components/com_finder/helpers/finder.php index f8e389be79..a847ef4f12 100644 --- a/administrator/components/com_finder/helpers/finder.php +++ b/administrator/components/com_finder/helpers/finder.php @@ -50,6 +50,35 @@ public static function addSubmenu($vName) ); } + /** + * Gets the finder system plugin extension id. + * + * @return int The finder system plugin extension id. + * + * @since 3.6.0 + */ + public static function getFinderPluginId() + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('content')) + ->where($db->quoteName('element') . ' = ' . $db->quote('finder')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + + return $result; + } + /** * Gets a list of the actions that can be performed. * diff --git a/administrator/components/com_finder/helpers/html/finder.php b/administrator/components/com_finder/helpers/html/finder.php index cdf4f7eb08..00731fff5d 100644 --- a/administrator/components/com_finder/helpers/html/finder.php +++ b/administrator/components/com_finder/helpers/html/finder.php @@ -11,6 +11,8 @@ JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php'); +use Joomla\Utilities\ArrayHelper; + /** * HTML behavior class for Finder. * @@ -75,31 +77,39 @@ public static function mapslist() // Load the finder types. $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->select('title AS text, id AS value') + ->select($db->quoteName('title', 'text')) + ->select($db->quoteName('id', 'value')) ->from($db->quoteName('#__finder_taxonomy')) - ->where($db->quoteName('parent_id') . ' = 1') - ->order('ordering, title ASC'); + ->where($db->quoteName('parent_id') . ' = 1'); $db->setQuery($query); try { - $rows = $db->loadObjectList(); + $branches = $db->loadObjectList(); } catch (RuntimeException $e) { - return; + JError::raiseWarning(500, $db->getMessage()); + } + + // Translate. + foreach ($branches as $branch) + { + $key = FinderHelperLanguage::branchPlural($branch->text); + $branch->translatedText = $lang->hasKey($key) ? JText::_($key) : $branch->text; } + // Order by title. + $branches = ArrayHelper::sortObjects($branches, 'translatedText', 1, true, true); + // Compile the options. $options = array(); - $options[] = JHtml::_('select.option', '1', JText::_('COM_FINDER_MAPS_SELECT_BRANCH')); + $options[] = JHtml::_('select.option', '', JText::_('COM_FINDER_MAPS_SELECT_BRANCH')); - foreach ($rows as $row) + // Convert the values to options. + foreach ($branches as $branch) { - $key = $lang->hasKey(FinderHelperLanguage::branchPlural($row->text)) - ? FinderHelperLanguage::branchPlural($row->text) : $row->text; - $string = JText::sprintf('COM_FINDER_ITEM_X_ONLY', JText::_($key)); - $options[] = JHtml::_('select.option', $row->value, $string); + $options[] = JHtml::_('select.option', $branch->value, $branch->translatedText); } return $options; diff --git a/administrator/components/com_finder/helpers/indexer/adapter.php b/administrator/components/com_finder/helpers/indexer/adapter.php index 3f07c68075..c822d30343 100644 --- a/administrator/components/com_finder/helpers/indexer/adapter.php +++ b/administrator/components/com_finder/helpers/indexer/adapter.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + JLoader::register('FinderIndexer', __DIR__ . '/indexer.php'); JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php'); JLoader::register('FinderIndexerResult', __DIR__ . '/result.php'); @@ -551,7 +553,7 @@ protected function getItem($id) $row = $this->db->loadAssoc(); // Convert the item to a result object. - $item = JArrayHelper::toObject($row, 'FinderIndexerResult'); + $item = ArrayHelper::toObject((array) $row, 'FinderIndexerResult'); // Set the item type. $item->type_id = $this->type_id; @@ -586,7 +588,7 @@ protected function getItems($offset, $limit, $query = null) foreach ($rows as $row) { // Convert the item to a result object. - $item = JArrayHelper::toObject($row, 'FinderIndexerResult'); + $item = ArrayHelper::toObject((array) $row, 'FinderIndexerResult'); // Set the item type. $item->type_id = $this->type_id; @@ -921,7 +923,7 @@ protected function translateState($item, $category = null) case 2: return 1; - // All other states should return a unpublished state + // All other states should return an unpublished state default: case 0: return 0; diff --git a/administrator/components/com_finder/helpers/indexer/helper.php b/administrator/components/com_finder/helpers/indexer/helper.php index 79d501ae9c..d340bc88fe 100644 --- a/administrator/components/com_finder/helpers/indexer/helper.php +++ b/administrator/components/com_finder/helpers/indexer/helper.php @@ -440,22 +440,14 @@ public static function getContentExtras(FinderIndexerResult &$item) // Load the finder plugin group. JPluginHelper::importPlugin('finder'); - try - { - // Trigger the event. - $results = $dispatcher->trigger('onPrepareFinderContent', array(&$item)); + // Trigger the event. + $results = $dispatcher->trigger('onPrepareFinderContent', array(&$item)); - // Check the returned results. This is for plugins that don't throw - // exceptions when they encounter serious errors. - if (in_array(false, $results)) - { - throw new Exception($dispatcher->getError(), 500); - } - } - catch (Exception $e) + // Check the returned results. This is for plugins that don't throw + // exceptions when they encounter serious errors. + if (in_array(false, $results)) { - // Handle a caught exception. - throw $e; + throw new Exception($dispatcher->getError(), 500); } return true; diff --git a/administrator/components/com_finder/helpers/indexer/query.php b/administrator/components/com_finder/helpers/indexer/query.php index f95d4e0c23..2e530888a8 100644 --- a/administrator/components/com_finder/helpers/indexer/query.php +++ b/administrator/components/com_finder/helpers/indexer/query.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; JLoader::register('FinderIndexerHelper', __DIR__ . '/helper.php'); JLoader::register('FinderIndexerTaxonomy', __DIR__ . '/taxonomy.php'); @@ -379,7 +380,7 @@ public function getExcludedTermIds() // Sanitize the terms. $results = array_unique($results); - JArrayHelper::toInteger($results); + $results = ArrayHelper::toInteger($results); return $results; } @@ -421,7 +422,7 @@ public function getIncludedTermIds() foreach ($results as $key => $value) { $results[$key] = array_unique($results[$key]); - JArrayHelper::toInteger($results[$key]); + $results[$key] = ArrayHelper::toInteger($results[$key]); } return $results; @@ -462,7 +463,7 @@ public function getRequiredTermIds() foreach ($results as $key => $value) { $results[$key] = array_unique($results[$key]); - JArrayHelper::toInteger($results[$key]); + $results[$key] = ArrayHelper::toInteger($results[$key]); } return $results; @@ -521,7 +522,7 @@ protected function processStaticTaxonomy($filterId) // Remove duplicates and sanitize. $filters = explode(',', $return->data); $filters = array_unique($filters); - JArrayHelper::toInteger($filters); + $filters = ArrayHelper::toInteger($filters); // Remove any values of zero. if (array_search(0, $filters, true) !== false) @@ -585,7 +586,7 @@ protected function processDynamicTaxonomy($filters) // Remove duplicates and sanitize. $filters = array_unique($filters); - JArrayHelper::toInteger($filters); + $filters = ArrayHelper::toInteger($filters); // Remove any values of zero. if (array_search(0, $filters, true) !== false) diff --git a/administrator/components/com_finder/helpers/language.php b/administrator/components/com_finder/helpers/language.php index 3d47afb42b..b738729acc 100644 --- a/administrator/components/com_finder/helpers/language.php +++ b/administrator/components/com_finder/helpers/language.php @@ -55,6 +55,35 @@ public static function branchSingular($branchName) return 'PLG_FINDER_QUERY_FILTER_BRANCH_S_' . $return; } + /** + * Method to return the language name for a language taxonomy branch. + * + * @param string $branchName Language branch name. + * + * @return string The language title. + * + * @since 3.6.0 + */ + public static function branchLanguageTitle($branchName) + { + $title = $branchName; + + if ($branchName == '*') + { + $title = JText::_('JALL_LANGUAGE'); + } + else + { + $languages = JLanguageHelper::getLanguages('lang_code'); + if (isset($languages[$branchName])) + { + $title = $languages[$branchName]->title; + } + } + + return $title; + } + /** * Method to load Smart Search component language file. * diff --git a/administrator/components/com_finder/models/fields/contentmap.php b/administrator/components/com_finder/models/fields/contentmap.php new file mode 100644 index 0000000000..f0e8a81915 --- /dev/null +++ b/administrator/components/com_finder/models/fields/contentmap.php @@ -0,0 +1,123 @@ +getQuery(true); + $levelQuery->select('title AS branch_title, 1 as level') + ->select($db->quoteName('id')) + ->from($db->quoteName('#__finder_taxonomy')) + ->where($db->quoteName('parent_id') . ' = 1'); + $levelQuery2 = $db->getQuery(true); + $levelQuery2->select('b.title AS branch_title, 2 as level') + ->select($db->quoteName('a.id')) + ->from($db->quoteName('#__finder_taxonomy', 'a')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('a.parent_id') . ' = ' . $db->qn('b.id')) + ->where($db->quoteName('a.parent_id') . ' NOT IN (0, 1)'); + + $levelQuery->union($levelQuery2); + + // Main query. + $query = $db->getQuery(true) + ->select($db->quoteName('a.title', 'text')) + ->select($db->quoteName('a.id', 'value')) + ->select($db->quoteName('d.level')) + ->from($db->quoteName('#__finder_taxonomy', 'a')) + ->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->qn('d.id') . ' = ' . $db->qn('a.id')) + ->where($db->quoteName('a.parent_id') . ' <> 0') + ->order('d.branch_title ASC, d.level ASC, a.title ASC'); + + $db->setQuery($query); + + try + { + $contentMap = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + return; + } + + // Build the grouped list array. + if ($contentMap) + { + $lang = JFactory::getLanguage(); + + foreach ($contentMap as $branch) + { + if ((int) $branch->level === 1) + { + $name = $branch->text; + } + else + { + $levelPrefix = str_repeat('- ', max(0, $branch->level - 1)); + + if (trim($name, '**') == 'Language') + { + $text = FinderHelperLanguage::branchLanguageTitle($branch->text); + } + else + { + $key = FinderHelperLanguage::branchSingular($branch->text); + $text = $lang->hasKey($key) ? JText::_($key) : $branch->text; + } + + // Initialize the group if necessary. + if (!isset($groups[$name])) + { + $groups[$name] = array(); + } + + $groups[$name][] = JHtml::_('select.option', $branch->value, $levelPrefix . $text); + } + } + } + + // Merge any additional groups in the XML definition. + $groups = array_merge(parent::getGroups(), $groups); + + return $groups; + } +} diff --git a/administrator/components/com_finder/models/fields/contenttypes.php b/administrator/components/com_finder/models/fields/contenttypes.php new file mode 100644 index 0000000000..a14ebf5afc --- /dev/null +++ b/administrator/components/com_finder/models/fields/contenttypes.php @@ -0,0 +1,84 @@ +getQuery(true) + ->select($db->quoteName('id', 'value')) + ->select($db->quoteName('title', 'text')) + ->from($db->quoteName('#__finder_types')); + + // Get the options. + $db->setQuery($query); + + try + { + $contentTypes = $db->loadObjectList(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $db->getMessage()); + } + + // Translate. + foreach ($contentTypes as $contentType) + { + $key = FinderHelperLanguage::branchSingular($contentType->text); + $contentType->translatedText = $lang->hasKey($key) ? JText::_($key) : $contentType->text; + } + + // Order by title. + $contentTypes = ArrayHelper::sortObjects($contentTypes, 'translatedText', 1, true, true); + + // Convert the values to options. + foreach ($contentTypes as $contentType) + { + $options[] = JHtml::_('select.option', $contentType->value, $contentType->translatedText); + } + + // Merge any additional options in the XML definition. + $options = array_merge(parent::getOptions(), $options); + + return $options; + } +} diff --git a/administrator/components/com_finder/models/filters.php b/administrator/components/com_finder/models/filters.php index 036d1f16f6..0a0dd21cab 100644 --- a/administrator/components/com_finder/models/filters.php +++ b/administrator/components/com_finder/models/filters.php @@ -55,31 +55,33 @@ protected function getListQuery() // Select all fields from the table. $query->select('a.*') - ->from($db->quoteName('#__finder_filters') . ' AS a'); + ->from($db->quoteName('#__finder_filters', 'a')); // Join over the users for the checked out user. - $query->select('uc.name AS editor') - ->join('LEFT', $db->quoteName('#__users') . ' AS uc ON uc.id=a.checked_out'); + $query->select($db->quoteName('uc.name', 'editor')) + ->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON ' . $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out')); // Join over the users for the author. - $query->select('ua.name AS user_name') - ->join('LEFT', $db->quoteName('#__users') . ' AS ua ON ua.id = a.created_by'); + $query->select($db->quoteName('ua.name', 'user_name')) + ->join('LEFT', $db->quoteName('#__users', 'ua') . ' ON ' . $db->quoteName('ua.id') . ' = ' . $db->quoteName('a.created_by')); // Check for a search filter. - if ($this->getState('filter.search')) + if ($search = $this->getState('filter.search')) { - $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($this->getState('filter.search')), true) . '%')); - $query->where('( a.title LIKE ' . $search . ' )'); + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where($db->quoteName('a.title') . ' LIKE ' . $search); } // If the model is set to check item state, add to the query. - if (is_numeric($this->getState('filter.state'))) + $state = $this->getState('filter.state'); + + if (is_numeric($state)) { - $query->where('a.state = ' . (int) $this->getState('filter.state')); + $query->where($db->quoteName('a.state') . ' = ' . (int) $state); } // Add the list ordering clause. - $query->order($db->escape($this->getState('list.ordering', 'a.title') . ' ' . $db->escape($this->getState('list.direction')))); + $query->order($db->escape($this->getState('list.ordering', 'a.title') . ' ' . $db->escape($this->getState('list.direction', 'ASC')))); return $query; } @@ -116,20 +118,17 @@ protected function getStoreId($id = '') * * @since 2.5 */ - 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); - - $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); - $this->setState('filter.state', $state); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); + $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); // Load the parameters. $params = JComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. - parent::populateState('a.title', 'asc'); + parent::populateState($ordering, $direction); } } diff --git a/administrator/components/com_finder/models/forms/filter_filters.xml b/administrator/components/com_finder/models/forms/filter_filters.xml index 4c5dedc916..f125a445c8 100644 --- a/administrator/components/com_finder/models/forms/filter_filters.xml +++ b/administrator/components/com_finder/models/forms/filter_filters.xml @@ -1,32 +1,51 @@
- - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/administrator/components/com_finder/models/forms/filter_index.xml b/administrator/components/com_finder/models/forms/filter_index.xml index 9b6976b57c..5553ea5292 100644 --- a/administrator/components/com_finder/models/forms/filter_index.xml +++ b/administrator/components/com_finder/models/forms/filter_index.xml @@ -20,15 +20,22 @@ + + +
-
- + type="status" + filter="0,1" + label="COM_FINDER_FILTER_PUBLISHED" + description="COM_FINDER_FILTER_PUBLISHED_DESC" + onchange="this.form.submit();" + > - - + + + + + + + + + + diff --git a/administrator/components/com_finder/models/index.php b/administrator/components/com_finder/models/index.php index 8c88afebd2..2690f8376c 100644 --- a/administrator/components/com_finder/models/index.php +++ b/administrator/components/com_finder/models/index.php @@ -51,6 +51,7 @@ public function __construct($config = array()) 't.title', 't_title', 'url', 'l.url', 'indexdate', 'l.indexdate', + 'content_map', ); } @@ -190,6 +191,15 @@ protected function getListQuery() $query->where($db->quoteName('l.type_id') . ' = ' . (int) $type); } + // Check the map filter. + $contentMapId = $this->getState('filter.content_map'); + + if (is_numeric($contentMapId)) + { + $query->join('INNER', $db->quoteName('#__finder_taxonomy_map', 'm') . ' ON ' . $db->quoteName('m.link_id') . ' = ' . $db->quoteName('l.link_id')) + ->where($db->quoteName('m.node_id') . ' = ' . (int) $contentMapId); + } + // Check for state filter. $state = $this->getState('filter.state'); @@ -275,6 +285,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.type'); + $id .= ':' . $this->getState('filter.content_map'); return parent::getStoreId($id); } @@ -284,7 +295,7 @@ protected function getStoreId($id = '') * * @return int The total of indexed items. * - * @since 3.5.2 + * @since 3.6.0 */ public function getTotalIndexed() { @@ -377,6 +388,7 @@ protected function populateState($ordering = 'l.title', $direction = 'asc') $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); $this->setState('filter.type', $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'cmd')); + $this->setState('filter.content_map', $this->getUserStateFromRequest($this->context . '.filter.content_map', 'filter_content_map', '', 'cmd')); // Load the parameters. $params = JComponentHelper::getParams('com_finder'); diff --git a/administrator/components/com_finder/models/maps.php b/administrator/components/com_finder/models/maps.php index 71335abc7e..c60e7383a4 100644 --- a/administrator/components/com_finder/models/maps.php +++ b/administrator/components/com_finder/models/maps.php @@ -31,7 +31,9 @@ public function __construct($config = array()) $config['filter_fields'] = array( 'state', 'a.state', 'title', 'a.title', - 'branch' + 'branch', + 'branch_title', 'd.branch_title', + 'level', 'd.level', ); } @@ -157,50 +159,112 @@ public function delete(&$pks) protected function getListQuery() { $db = $this->getDbo(); + $query = $db->getQuery(true); // Select all fields from the table. $query->select('a.*') - ->from($db->quoteName('#__finder_taxonomy') . ' AS a'); + ->select('s.count_published') + ->select('s.count_unpublished') + ->from($db->quoteName('#__finder_taxonomy', 'a')) + ->where($db->quoteName('a.parent_id') . ' <> 0'); // Self-join to get children. $query->select('COUNT(b.id) AS num_children') - ->join('LEFT', $db->quoteName('#__finder_taxonomy') . ' AS b ON b.parent_id=a.id'); - - // Join to get the map links - $query->select('COUNT(c.node_id) AS num_nodes') - ->join('LEFT', $db->quoteName('#__finder_taxonomy_map') . ' AS c ON c.node_id=a.id') - ->group('a.id, a.parent_id, a.title, a.state, a.access, a.ordering'); + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('b.parent_id') . ' = ' . $db->qn('a.id')); + + // Join to get the map links. + $stateSubQuery1 = $db->getQuery(true); + $stateSubQuery1->select($db->quoteName('mp.node_id')) + ->select('COUNT(mp.node_id) AS count_published') + ->from($db->quoteName('#__finder_links', 'lp')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy_map', 'mp') . ' ON ' . $db->qn('lp.link_id') . ' = ' . $db->qn('mp.link_id')) + ->where($db->quoteName('lp.published') . ' = 1') + ->group($db->quoteName('mp.node_id')); + + $stateSubQuery2 = $db->getQuery(true); + $stateSubQuery2->select($db->quoteName('mu.node_id')) + ->select('COUNT(mu.node_id) AS count_unpublished') + ->from($db->quoteName('#__finder_links', 'lu')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy_map', 'mu') . ' ON ' . $db->qn('lu.link_id') . ' = ' . $db->qn('mu.link_id')) + ->where($db->quoteName('lu.published') . ' = 0') + ->group($db->quoteName('mu.node_id')); + + $stateQuery = $db->getQuery(true); + $stateQuery->select('s1.*') + ->select('s2.count_unpublished') + ->from('(' . $stateSubQuery1 . ') AS s1') + ->join('LEFT', '(' . $stateSubQuery2 . ') AS s2 ON ' . $db->qn('s1.node_id') . ' = ' . $db->qn('s2.node_id')); + + $query->join('LEFT', '(' . $stateQuery . ') AS s ON ' . $db->qn('s.node_id') . ' = ' . $db->qn('a.id')); + + // Calculate levels. + $levelQuery = $db->getQuery(true); + $levelQuery->select('title AS branch_title, 1 as level') + ->select($db->quoteName('id')) + ->from($db->quoteName('#__finder_taxonomy')) + ->where($db->quoteName('parent_id') . ' = 1'); + $levelQuery2 = $db->getQuery(true); + $levelQuery2->select('b.title AS branch_title, 2 as level') + ->select($db->quoteName('a.id')) + ->from($db->quoteName('#__finder_taxonomy', 'a')) + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('a.parent_id') . ' = ' . $db->qn('b.id')) + ->where($db->quoteName('a.parent_id') . ' NOT IN (0, 1)'); + + $levelQuery->union($levelQuery2); + + // Join to get the levels. + $query->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->qn('d.id') . ' = ' . $db->qn('a.id')); + + // Group + $query->group('a.id, a.parent_id, a.title, a.state, a.access, a.ordering'); + + // Self-join to get the parent title. + $query->select('e.title AS parent_title') + ->join('LEFT', $db->quoteName('#__finder_taxonomy', 'e') . ' ON ' . $db->quoteName('e.id') . ' = ' . $db->quoteName('a.parent_id')); // If the model is set to check item state, add to the query. - if (is_numeric($this->getState('filter.state'))) + $state = $this->getState('filter.state'); + + if (is_numeric($state)) + { + $query->where($db->quoteName('a.state') . ' = ' . (int) $state); + } + + // Filter over level. + $level = $this->getState('filter.level'); + + if (is_numeric($level) && (int) $level === 1) { - $query->where('a.state = ' . (int) $this->getState('filter.state')); + $query->where($db->quoteName('d.level') . ' = 1'); } // Filter the maps over the branch if set. - $branch_id = $this->getState('filter.branch'); + $branchId = $this->getState('filter.branch'); - if (!empty($branch_id)) + if (is_numeric($branchId)) { - $query->where('a.parent_id = ' . (int) $branch_id); + $query->where($db->quoteName('a.parent_id') . ' = ' . (int) $branchId); } // Filter the maps over the search string if set. - $search = $this->getState('filter.search'); - - if (!empty($search)) + if ($search = $this->getState('filter.search')) { - $query->where('a.title LIKE ' . $db->quote('%' . $search . '%')); + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where($db->quoteName('a.title') . ' LIKE ' . $search); } // Handle the list ordering. - $ordering = $this->getState('list.ordering'); - $direction = $this->getState('list.direction'); + $listOrdering = $db->escape($this->getState('list.ordering', 'd.branch_title')); + $listDirn = $db->escape($this->getState('list.direction', 'ASC')); - if (!empty($ordering)) + if ($listOrdering == 'd.branch_title') + { + $query->order('d.branch_title ' . $listDirn . ', d.level ASC, a.title ' . $listDirn); + } + elseif ($listOrdering == 'a.state') { - $query->order($db->escape($ordering) . ' ' . $db->escape($direction)); + $query->order('a.state ' . $listDirn . ', d.branch_title ' . $listDirn . ', d.level ASC'); } return $query; @@ -222,9 +286,10 @@ protected function getListQuery() protected function getStoreId($id = '') { // Compile the store id. - $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.branch'); + $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } @@ -255,24 +320,20 @@ public function getTable($type = 'Map', $prefix = 'FinderTable', $config = array * * @since 2.5 */ - protected function populateState($ordering = null, $direction = null) + protected function populateState($ordering = 'd.branch_title', $direction = 'asc') { // Load the filter state. - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); - $this->setState('filter.state', $state); - - $branch = $this->getUserStateFromRequest($this->context . '.filter.branch', 'filter_branch', '1', 'string'); - $this->setState('filter.branch', $branch); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); + $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); + $this->setState('filter.branch', $this->getUserStateFromRequest($this->context . '.filter.branch', 'filter_branch', '', 'cmd')); + $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); // Load the parameters. $params = JComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. - parent::populateState('a.title', 'asc'); + parent::populateState($ordering, $direction); } /** diff --git a/administrator/components/com_finder/tables/filter.php b/administrator/components/com_finder/tables/filter.php index 03133c41ca..9b1ed5606f 100644 --- a/administrator/components/com_finder/tables/filter.php +++ b/administrator/components/com_finder/tables/filter.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\Registry\Registry; +use Joomla\Utilities\ArrayHelper; /** * Filter table class for the Finder package. @@ -79,13 +80,19 @@ public function check() $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); } - // Check the end date is not earlier than start up. - if ($this->d2 > $this->_db->getNullDate() && $this->d2 < $this->d1) + $params = new Registry($this->params); + + $nullDate = $this->_db->getNullDate(); + $d1 = $params->get('d1', $nullDate); + $d2 = $params->get('d2', $nullDate); + + // Check the end date is not earlier than the start date. + if ($d2 > $nullDate && $d2 < $d1) { // Swap the dates. - $temp = $this->d1; - $this->d1 = $this->d2; - $this->d2 = $temp; + $params->set('d1', $d2); + $params->set('d2', $d1); + $this->params = (string) $params; } return true; @@ -110,7 +117,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $k = $this->_tbl_key; // Sanitize input. - JArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); $userId = (int) $userId; $state = (int) $state; diff --git a/administrator/components/com_finder/tables/map.php b/administrator/components/com_finder/tables/map.php index b9d524c683..c59a79da59 100644 --- a/administrator/components/com_finder/tables/map.php +++ b/administrator/components/com_finder/tables/map.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * Map table class for the Finder package. * @@ -47,7 +49,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $k = $this->_tbl_key; // Sanitize input. - JArrayHelper::toInteger($pks); + $pks = ArrayHelper::toInteger($pks); $state = (int) $state; // If there are no primary keys set check to see if the instance key is set. diff --git a/administrator/components/com_finder/views/filter/tmpl/edit.php b/administrator/components/com_finder/views/filter/tmpl/edit.php index 779ca58397..81ae0ae535 100644 --- a/administrator/components/com_finder/views/filter/tmpl/edit.php +++ b/administrator/components/com_finder/views/filter/tmpl/edit.php @@ -65,7 +65,7 @@
'details')); ?> - +
total > 0) : ?> @@ -87,7 +87,7 @@
- +
diff --git a/administrator/components/com_finder/views/filters/tmpl/default.php b/administrator/components/com_finder/views/filters/tmpl/default.php index c7a62fef1b..89ae36bf08 100644 --- a/administrator/components/com_finder/views/filters/tmpl/default.php +++ b/administrator/components/com_finder/views/filters/tmpl/default.php @@ -37,61 +37,56 @@ }; '); ?> - - + sidebar)) : ?>
sidebar; ?>
+ +
+ + $this)); ?> +
+ items)) : ?> +
+ +
-
- - $this)); ?> - - - - - items) == 0) : ?> - - + + - - + + items as $i => $item) : $canCreate = $user->authorise('core.create', 'com_finder'); @@ -99,11 +94,13 @@ $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0; $canChange = $user->authorise('core.edit.state', 'com_finder') && $canCheckin; ?> - + - @@ -133,19 +127,10 @@ - - - - -
+ - + + - + + - + - + - + - +
- total == 0) : ?> - - - - - - - +
+ pagination->getListFooter(); ?>
filter_id); ?> + state, $i, 'filters.', $canChange); ?> + checked_out) : ?> editor, $item->checked_out_time, 'filters.', $canCheckin); ?> @@ -115,9 +112,6 @@ escape($item->title); ?> - state, $i, 'filters.', $canChange); ?> - created_by_alias ? $item->created_by_alias : $item->user_name; ?>
- pagination->getListFooter(); ?> -
- + - -
diff --git a/administrator/components/com_finder/views/filters/view.html.php b/administrator/components/com_finder/views/filters/view.html.php index fe8802584c..c08a3269cf 100644 --- a/administrator/components/com_finder/views/filters/view.html.php +++ b/administrator/components/com_finder/views/filters/view.html.php @@ -28,11 +28,11 @@ class FinderViewFilters extends JViewLegacy public function display($tpl = null) { // Load the view data. - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->total = $this->get('Total'); - $this->state = $this->get('State'); - $this->filterForm = $this->get('FilterForm'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->total = $this->get('Total'); + $this->state = $this->get('State'); + $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); FinderHelper::addSubmenu('filters'); @@ -78,6 +78,7 @@ protected function addToolbar() { JToolbarHelper::publishList('filters.publish'); JToolbarHelper::unpublishList('filters.unpublish'); + JToolbarHelper::checkin('filters.checkin'); JToolbarHelper::divider(); } diff --git a/administrator/components/com_finder/views/index/tmpl/default.php b/administrator/components/com_finder/views/index/tmpl/default.php index 60077d73f2..5d9d5017a1 100644 --- a/administrator/components/com_finder/views/index/tmpl/default.php +++ b/administrator/components/com_finder/views/index/tmpl/default.php @@ -93,7 +93,7 @@ - + pagination->getListFooter(); ?> diff --git a/administrator/components/com_finder/views/index/view.html.php b/administrator/components/com_finder/views/index/view.html.php index 99e6c724e8..46f3587764 100644 --- a/administrator/components/com_finder/views/index/view.html.php +++ b/administrator/components/com_finder/views/index/view.html.php @@ -52,7 +52,8 @@ public function display($tpl = null) if (!$this->pluginState['plg_content_finder']->enabled) { - JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED'), 'warning'); + $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . FinderHelper::getFinderPluginId()); + JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED', $link), 'warning'); } elseif ($this->get('TotalIndexed') === 0) { diff --git a/administrator/components/com_finder/views/maps/tmpl/default.php b/administrator/components/com_finder/views/maps/tmpl/default.php index 8731b990dc..d3d9fcf912 100644 --- a/administrator/components/com_finder/views/maps/tmpl/default.php +++ b/administrator/components/com_finder/views/maps/tmpl/default.php @@ -12,10 +12,11 @@ JHtml::_('formbehavior.chosen', 'select'); JHtml::_('bootstrap.tooltip'); -$listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); - -$lang = JFactory::getLanguage(); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$lang = JFactory::getLanguage(); +$branchFilter = $this->escape($this->state->get('filter.branch')); +$colSpan = $branchFilter ? 5 : 6; JText::script('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'); JFactory::getDocument()->addScriptDeclaration(' @@ -36,8 +37,7 @@ }; '); ?> - -
+ sidebar)) : ?>
sidebar; ?> @@ -47,83 +47,112 @@
$this)); ?> +
+ items)) : ?> +
+ +
+ - + + + - + - - items) == 0) : ?> - - - - - state->get('filter.branch') != 1) : ?> - - + + - - + + authorise('core.manage', 'com_finder'); ?> items as $i => $item) : ?> - - + + + + + + - - - - -
+ + + - + + + - + + + + + + +
- -
- - +
+ pagination->getListFooter(); ?>
id); ?> - title); - $title = $lang->hasKey($key) ? JText::_($key) : $item->title; - ?> - state->get('filter.branch') == 1 && $item->num_children) : ?> - - escape($title); ?> - - escape(($title == '*') ? JText::_('JALL_LANGUAGE') : $title); ?> - - num_children > 0) : ?> - (num_children; ?>) - num_nodes > 0) : ?> - (num_nodes; ?>) - - escape(trim($title, '**')) == 'Language' && JLanguageMultilang::isEnabled()) : ?> - - - state, $i, 'maps.', $canChange, 'cb'); ?> + parent_title, '**') == 'Language') + { + $title = FinderHelperLanguage::branchLanguageTitle($item->title); + } + else + { + $key = FinderHelperLanguage::branchSingular($item->title); + $title = $lang->hasKey($key) ? JText::_($key) : $item->title; + } + ?> + num_children === 0) : ?> + + + + escape(trim($title, '**')) == 'Language' && JLanguageMultilang::isEnabled()) : ?> + + + + num_children !== 0) : ?> + + ">num_children; ?> + + - + + + num_children === 0) : ?> + " title="" href="id); ?>"> + count_published; ?> + + - + + + num_children === 0) : ?> + " title="" href="id); ?>"> + count_unpublished; ?> + + - + +
- pagination->getListFooter(); ?> -
- - - - - +
+ + + diff --git a/administrator/components/com_finder/views/maps/view.html.php b/administrator/components/com_finder/views/maps/view.html.php index 999b839228..f14f475eca 100644 --- a/administrator/components/com_finder/views/maps/view.html.php +++ b/administrator/components/com_finder/views/maps/view.html.php @@ -33,11 +33,11 @@ public function display($tpl = null) FinderHelperLanguage::loadPluginLanguage(); // Load the view data. - $this->items = $this->get('Items'); - $this->total = $this->get('Total'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); - $this->filterForm = $this->get('FilterForm'); + $this->items = $this->get('Items'); + $this->total = $this->get('Total'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); FinderHelper::addSubmenu('maps'); diff --git a/administrator/components/com_installer/controllers/updatesites.php b/administrator/components/com_installer/controllers/updatesites.php index 9ce438c7a5..81b9e50ccc 100644 --- a/administrator/components/com_installer/controllers/updatesites.php +++ b/administrator/components/com_installer/controllers/updatesites.php @@ -32,6 +32,8 @@ public function __construct($config = array()) $this->registerTask('unpublish', 'publish'); $this->registerTask('publish', 'publish'); + $this->registerTask('delete', 'delete'); + $this->registerTask('rebuild', 'rebuild'); } /** @@ -73,4 +75,50 @@ public function publish() $this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites', false)); } + + /** + * Deletes an update site (if supported). + * + * @return void + * + * @since 3.6 + * + * @throws Exception on error + */ + public function delete() + { + // Check for request forgeries. + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $ids = $this->input->get('cid', array(), 'array'); + + if (empty($ids)) + { + throw new Exception(JText::_('COM_INSTALLER_ERROR_NO_UPDATESITES_SELECTED'), 500); + } + + // Delete the records. + $this->getModel('Updatesites')->delete($ids); + + $this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites', false)); + } + + /** + * Rebuild update sites tables. + * + * @return void + * + * @since 3.6 + */ + public function rebuild() + { + // Check for request forgeries. + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Rebuild the update sites. + $this->getModel('Updatesites')->rebuild(); + + $this->setRedirect(JRoute::_('index.php?option=com_installer&view=updatesites', false)); + } + } diff --git a/administrator/components/com_installer/models/database.php b/administrator/components/com_installer/models/database.php index 66ac0d92bc..808991ea46 100644 --- a/administrator/components/com_installer/models/database.php +++ b/administrator/components/com_installer/models/database.php @@ -56,9 +56,6 @@ protected function populateState($ordering = null, $direction = null) */ public function fix() { - // Prepare the utf8mb4 conversion check table - $this->prepareUtf8mb4StatusTable(); - if (!$changeSet = $this->getItems()) { return false; @@ -79,7 +76,7 @@ public function fix() if (count($statusArray['error']) == 0) { - $this->convertTablesToUtf8mb4(); + $installer->convertTablesToUtf8mb4(false); } } @@ -265,114 +262,6 @@ public function fixDefaultTextFilters() } } - /** - * Converts the site's database tables to support UTF-8 Multibyte - * - * @return void - * - * @since 3.5 - */ - public function convertTablesToUtf8mb4() - { - $db = JFactory::getDbo(); - - // Get the SQL file to convert the core tables. Yes, this is hardcoded because we have all sorts of index - // conversions and funky things we can't automate in core tables without an actual SQL file. - $serverType = $db->getServerType(); - - if ($serverType != 'mysql') - { - return; - } - - // Set required conversion status - if ($db->hasUTF8mb4Support()) - { - $converted = 2; - } - else - { - $converted = 1; - } - - // Check conversion status in database - $db->setQuery('SELECT ' . $db->quoteName('converted') - . ' FROM ' . $db->quoteName('#__utf8_conversion') - ); - - try - { - $convertedDB = $db->loadResult(); - } - catch (Exception $e) - { - JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); - - return; - } - - // Nothing to do, saved conversion status from DB is equal to required - if ($convertedDB == $converted) - { - return; - } - - // Step 1: Drop indexes later to be added again with column lengths limitations at step 2 - $fileName1 = JPATH_ADMINISTRATOR . "/components/com_admin/sql/others/$serverType/utf8mb4-conversion-01.sql"; - - if (is_file($fileName1)) - { - $fileContents1 = @file_get_contents($fileName1); - $queries1 = $db->splitSql($fileContents1); - - if (!empty($queries1)) - { - foreach ($queries1 as $query1) - { - try - { - $db->setQuery($query1)->execute(); - } - catch (Exception $e) - { - // If the query fails we will go on. It just means the index to be dropped does not exist. - } - } - } - } - - // Step 2: Perform the index modifications and conversions - $fileName2 = JPATH_ADMINISTRATOR . "/components/com_admin/sql/others/$serverType/utf8mb4-conversion-02.sql"; - - if (is_file($fileName2)) - { - $fileContents2 = @file_get_contents($fileName2); - $queries2 = $db->splitSql($fileContents2); - - if (!empty($queries2)) - { - foreach ($queries2 as $query2) - { - try - { - $db->setQuery($db->convertUtf8mb4QueryToUtf8($query2))->execute(); - } - catch (Exception $e) - { - $converted = 0; - - // Still render the error message from the Exception object - JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); - } - } - } - } - - // Set flag in database if the update is done. - $db->setQuery('UPDATE ' . $db->quoteName('#__utf8_conversion') - . ' SET ' . $db->quoteName('converted') . ' = ' . $converted . ';')->execute(); - } - /** * Prepare the table to save the status of utf8mb4 conversion * Make sure it contains 1 initialized record if there is not diff --git a/administrator/components/com_installer/models/discover.php b/administrator/components/com_installer/models/discover.php index 88d1c6ad88..2b02c55e49 100644 --- a/administrator/components/com_installer/models/discover.php +++ b/administrator/components/com_installer/models/discover.php @@ -137,6 +137,7 @@ protected function getListQuery() public function discover() { // Purge the list of discovered extensions and fetch them again. + $this->purge(); $results = JInstaller::getInstance()->discover(); // Get all templates, including discovered ones diff --git a/administrator/components/com_installer/models/extension.php b/administrator/components/com_installer/models/extension.php index 80960e56f3..f9b17cc682 100644 --- a/administrator/components/com_installer/models/extension.php +++ b/administrator/components/com_installer/models/extension.php @@ -75,7 +75,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $this->translate($result); // Process searching. - if (!empty($search)) + if (!empty($search) && stripos($search, 'id:') !== 0) { $escapedSearchString = $this->refineSearchStringToRegex($search, '/'); diff --git a/administrator/components/com_installer/models/forms/filter_discover.xml b/administrator/components/com_installer/models/forms/filter_discover.xml index 2eb4f75849..8f21ab2d8e 100644 --- a/administrator/components/com_installer/models/forms/filter_discover.xml +++ b/administrator/components/com_installer/models/forms/filter_discover.xml @@ -6,8 +6,8 @@ diff --git a/administrator/components/com_installer/models/forms/filter_manage.xml b/administrator/components/com_installer/models/forms/filter_manage.xml index 8d16b8ef08..8fc27e3d64 100644 --- a/administrator/components/com_installer/models/forms/filter_manage.xml +++ b/administrator/components/com_installer/models/forms/filter_manage.xml @@ -6,8 +6,8 @@ setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); - // Recall the 'Install from Directory' path. - $path = $app->getUserStateFromRequest($this->_context . '.install_directory', 'install_directory', $app->get('tmp_path')); - $this->setState('install.directory', $path); parent::populateState(); } @@ -138,6 +135,41 @@ public function install() return false; } + // Get an installer instance. + $installer = JInstaller::getInstance(); + + /* + * Check for a Joomla core package. + * To do this we need to set the source path to find the manifest (the same first step as JInstaller::install()) + * + * This must be done before the unpacked check because JInstallerHelper::detectType() returns a boolean false since the manifest + * can't be found in the expected location. + */ + if (is_array($package) && isset($package['dir']) && is_dir($package['dir'])) + { + $installer->setPath('source', $package['dir']); + + if (!$installer->findManifest()) + { + // If a manifest isn't found at the source, this may be a Joomla package; check the package directory for the Joomla manifest + if (file_exists($package['dir'] . '/administrator/manifests/files/joomla.xml')) + { + // We have a Joomla package + if (in_array($installType, array('upload', 'url'))) + { + JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); + } + + $app->enqueueMessage( + JText::sprintf('COM_INSTALLER_UNABLE_TO_INSTALL_JOOMLA_PACKAGE', JRoute::_('index.php?option=com_joomlaupdate')), + 'warning' + ); + + return false; + } + } + } + // Was the package unpacked? if (!$package || !$package['type']) { @@ -151,9 +183,6 @@ public function install() return false; } - // Get an installer instance. - $installer = JInstaller::getInstance(); - // Install the package. if (!$installer->install($package['dir'])) { diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index d8a63821d0..3cd4661cfc 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -52,13 +52,11 @@ public function __construct($config = array()) // Get the extension_id of the en-GB package. $db = $this->getDbo(); $extQuery = $db->getQuery(true); - $extType = 'language'; - $extElem = 'en-GB'; $extQuery->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('type') . ' = ' . $db->quote($extType)) - ->where($db->quoteName('element') . ' = ' . $db->quote($extElem)) + ->where($db->quoteName('type') . ' = ' . $db->quote('package')) + ->where($db->quoteName('element') . ' = ' . $db->quote('pkg_en-GB')) ->where($db->quoteName('client_id') . ' = 0'); $db->setQuery($extQuery); @@ -121,12 +119,11 @@ protected function _getListQuery() // This where clause will avoid to list languages already installed. $query->where($db->quoteName('extension_id') . ' = 0'); - // Filter by search in title - $search = $this->getState('filter.search'); - if (!empty($search)) + // Filter by search in title and language tag. + if ($search = $this->getState('filter.search')) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); - $query->where('(LOWER(name) LIKE ' . strtolower($search) . ')'); + $query->where('(LOWER(name) LIKE ' . strtolower($search) . ' OR LOWER(element) LIKE ' . strtolower($search) . ')'); } // Add the list ordering clause. @@ -304,7 +301,7 @@ public function install($lids) } // Package installed successfully. - $app->enqueueMessage(JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', $language->name)); + $app->enqueueMessage(JText::sprintf('COM_INSTALLER_INSTALL_LANGUAGE_SUCCESS', $language->name)); // Cleanup the install files in tmp folder. if (!is_file($package['packagefile'])) @@ -321,7 +318,7 @@ public function install($lids) } /** - * Gets the manifest file of a selected language from a the language list in a update server. + * Gets the manifest file of a selected language from a the language list in an update server. * * @param int $uid the id of the language in the #__updates table * diff --git a/administrator/components/com_installer/models/updatesites.php b/administrator/components/com_installer/models/updatesites.php index 859a387692..d806da9bcf 100644 --- a/administrator/components/com_installer/models/updatesites.php +++ b/administrator/components/com_installer/models/updatesites.php @@ -120,6 +120,255 @@ public function publish(&$eid = array(), $value = 1) return $result; } + /** + * Deletes an update site. + * + * @param array $ids Extension ids to delete. + * + * @return void + * + * @since 3.6 + * + * @throws Exception on ACL error + */ + public function delete($ids = array()) + { + $user = JFactory::getUser(); + + if (!$user->authorise('core.delete', 'com_installer')) + { + throw new Exception(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), 403); + } + + // Ensure eid is an array of extension ids + if (!is_array($ids)) + { + $ids = array($ids); + } + + $db = JFactory::getDbo(); + $app = JFactory::getApplication(); + + $count = 0; + + // Gets the update site names. + $query = $db->getQuery(true) + ->select($db->qn(array('update_site_id', 'name'))) + ->from($db->qn('#__update_sites')) + ->where($db->qn('update_site_id') . ' IN (' . implode(', ', $ids) . ')'); + $db->setQuery($query); + $updateSitesNames = $db->loadObjectList('update_site_id'); + + // Gets Joomla core update sites Ids. + $joomlaUpdateSitesIds = $this->getJoomlaUpdateSitesIds(); + + // Enable the update site in the table and store it in the database + foreach ($ids as $i => $id) + { + // Don't allow to delete Joomla Core update sites. + if (in_array((int) $id, $joomlaUpdateSitesIds)) + { + $app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_DELETE_CANNOT_DELETE', $updateSitesNames[$id]->name), 'error'); + continue; + } + + // Delete the update site from all tables. + try + { + $query = $db->getQuery(true) + ->delete($db->qn('#__update_sites')) + ->where($db->qn('update_site_id') . ' = ' . (int) $id); + $db->setQuery($query); + $db->execute(); + + $query = $db->getQuery(true) + ->delete($db->qn('#__update_sites_extensions')) + ->where($db->qn('update_site_id') . ' = ' . (int) $id); + $db->setQuery($query); + $db->execute(); + + $query = $db->getQuery(true) + ->delete($db->qn('#__updates')) + ->where($db->qn('update_site_id') . ' = ' . (int) $id); + $db->setQuery($query); + $db->execute(); + + $count++; + } + catch (RuntimeException $e) + { + $app->enqueueMessage(JText::sprintf('COM_INSTALLER_MSG_UPDATESITES_DELETE_ERROR', $updateSitesNames[$id]->name, $e->getMessage()), 'error'); + } + } + + if ($count > 0) + { + $app->enqueueMessage(JText::plural('COM_INSTALLER_MSG_UPDATESITES_N_DELETE_UPDATESITES_DELETED', $count), 'message'); + } + } + + /** + * Rebuild update sites tables. + * + * @return void + * + * @since 3.6 + * + * @throws Exception on ACL error + */ + public function rebuild() + { + $user = JFactory::getUser(); + + if (!$user->authorise('core.admin', 'com_installer')) + { + throw new Exception(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_NOT_PERMITTED'), 403); + } + + $db = JFactory::getDbo(); + $app = JFactory::getApplication(); + + $clients = array(JPATH_SITE, JPATH_ADMINISTRATOR); + $extensionGroupFolders = array('components', 'modules', 'plugins', 'templates', 'language', 'manifests'); + + $pathsToSearch = array(); + + // Identifies which folders to search for manifest files. + foreach ($clients as $clientPath) + { + foreach ($extensionGroupFolders as $extensionGroupFolderName) + { + // Components, modules, plugins, templates, languages and manifest (files, libraries, etc) + if ($extensionGroupFolderName != 'plugins') + { + foreach (glob($clientPath . '/' . $extensionGroupFolderName . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $extensionFolderPath) + { + array_push($pathsToSearch, $extensionFolderPath); + } + } + + // Plugins (another directory level is needed) + else + { + foreach (glob($clientPath . '/' . $extensionGroupFolderName . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $pluginGroupFolderPath) + { + foreach (glob($pluginGroupFolderPath . '/*', GLOB_NOSORT | GLOB_ONLYDIR) as $extensionFolderPath) + { + array_push($pathsToSearch, $extensionFolderPath); + } + } + } + } + } + + // Gets Joomla core update sites Ids. + $joomlaUpdateSitesIds = implode(', ', $this->getJoomlaUpdateSitesIds()); + + // Delete from all tables (except joomla core update sites). + $query = $db->getQuery(true) + ->delete($db->qn('#__update_sites')) + ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + $db->setQuery($query); + $db->execute(); + + $query = $db->getQuery(true) + ->delete($db->qn('#__update_sites_extensions')) + ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + $db->setQuery($query); + $db->execute(); + + $query = $db->getQuery(true) + ->delete($db->qn('#__updates')) + ->where($db->qn('update_site_id') . ' NOT IN (' . $joomlaUpdateSitesIds . ')'); + $db->setQuery($query); + $db->execute(); + + $count = 0; + + // Search for updateservers in manifest files inside the folders to search. + foreach ($pathsToSearch as $extensionFolderPath) + { + $tmpInstaller = new JInstaller; + + $tmpInstaller->setPath('source', $extensionFolderPath); + + // Main folder manifests (higher priority) + $parentXmlfiles = JFolder::files($tmpInstaller->getPath('source'), '.xml$', false, true); + + // Search for children manifests (lower priority) + $allXmlFiles = JFolder::files($tmpInstaller->getPath('source'), '.xml$', 1, true); + + // Create an unique array of files ordered by priority + $xmlfiles = array_unique(array_merge($parentXmlfiles, $allXmlFiles)); + + if (!empty($xmlfiles)) + { + foreach ($xmlfiles as $file) + { + // Is it a valid Joomla installation manifest file? + $manifest = $tmpInstaller->isManifest($file); + + if (!is_null($manifest)) + { + $query = $db->getQuery(true) + ->select($db->qn('extension_id')) + ->from($db->qn('#__extensions')) + ->where($db->qn('name') . ' = ' . $db->q($manifest->name)) + ->where($db->qn('type') . ' = ' . $db->q($manifest['type'])) + ->where($db->qn('state') . ' != -1'); + $db->setQuery($query); + $eid = (int) $db->loadResult(); + + if ($eid && $manifest->updateservers) + { + // Set the manifest object and path + $tmpInstaller->manifest = $manifest; + $tmpInstaller->setPath('manifest', $file); + + // Load the extension plugin (if not loaded yet). + JPluginHelper::importPlugin('extension', 'joomla'); + + // Fire the onExtensionAfterUpdate + JEventDispatcher::getInstance()->trigger('onExtensionAfterUpdate', array('installer' => $tmpInstaller, 'eid' => $eid)); + + $count++; + } + } + } + } + } + + if ($count > 0) + { + $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_SUCCESS'), 'message'); + } + else + { + $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_UPDATESITES_REBUILD_WARNING'), 'warning'); + } + } + + /** + * Fetch the Joomla update sites ids. + * + * @return array Array with joomla core update site ids. + * + * @since 3.6 + */ + protected function getJoomlaUpdateSitesIds() + { + $db = JFactory::getDbo(); + + // Fetch the Joomla core Joomla update sites ids. + $query = $db->getQuery(true); + $query->select($db->qn('update_site_id')) + ->from($db->qn('#__update_sites')) + ->where($db->qn('location') . ' LIKE \'%update.joomla.org%\''); + $db->setQuery($query); + + return $db->loadColumn(); + } + /** * Method to get the database query * diff --git a/administrator/components/com_installer/views/database/tmpl/default.php b/administrator/components/com_installer/views/database/tmpl/default.php index ce099998fe..71f1600441 100644 --- a/administrator/components/com_installer/views/database/tmpl/default.php +++ b/administrator/components/com_installer/views/database/tmpl/default.php @@ -63,7 +63,7 @@ - +
    diff --git a/administrator/components/com_installer/views/install/tmpl/default.php b/administrator/components/com_installer/views/install/tmpl/default.php index ec4292e782..e9a715e810 100644 --- a/administrator/components/com_installer/views/install/tmpl/default.php +++ b/administrator/components/com_installer/views/install/tmpl/default.php @@ -15,38 +15,6 @@ JFactory::getDocument()->addScriptDeclaration( ' - Joomla.submitbutton = function() { - var form = document.getElementById("adminForm"); - - // do field validation - if (form.install_package.value == "") { - alert("' . JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE', true) . '"); - } - else - { - jQuery("#loading").css("display", "block"); - - form.installtype.value = "upload"; - form.submit(); - } - }; - - Joomla.submitbutton3 = function() { - var form = document.getElementById("adminForm"); - - // do field validation - if (form.install_directory.value == "") { - alert("' . JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_DIRECTORY', true) . '"); - } - else - { - jQuery("#loading").css("display", "block"); - - form.installtype.value = "folder"; - form.submit(); - } - }; - Joomla.submitbutton4 = function() { var form = document.getElementById("adminForm"); @@ -57,7 +25,7 @@ else { jQuery("#loading").css("display", "block"); - + form.installtype.value = "url"; form.submit(); } @@ -65,22 +33,23 @@ Joomla.submitbuttonInstallWebInstaller = function() { var form = document.getElementById("adminForm"); - + form.install_url.value = "https://appscdn.joomla.org/webapps/jedapps/webinstaller.xml"; - + Joomla.submitbutton4(); }; // Add spindle-wheel for installations: jQuery(document).ready(function($) { var outerDiv = $("#installer-install"); - + $("#loading") .css("top", outerDiv.position().top - $(window).scrollTop()) - .css("left", outerDiv.position().left - $(window).scrollLeft()) - .css("width", outerDiv.width()) - .css("height", outerDiv.height()) + .css("left", "0") + .css("width", "100%") + .css("height", "100%") .css("display", "none") + .css("margin-top", "-10px"); }); ' ); @@ -93,10 +62,9 @@ opacity: 0.8; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity = 80); filter: alpha(opacity = 80); - margin: -10px -50px 0 -50px; overflow: hidden; } - + .j-jed-message { margin-bottom: 40px; line-height: 2em; @@ -107,92 +75,83 @@ ?> + +
    - sidebar)) : ?> +
    + sidebar)) : ?>
    sidebar; ?>
    - -
    - - - - showMessage) : ?> - loadTemplate('message'); ?> - showJedAndWebInstaller) : ?> -
    - × -

      

    - -
    - - - - 'upload')); ?> - - trigger('onInstallerViewBeforeFirstTab', array()); ?> - - -
    - -
    - -
    - -
    -
    -
    - -
    -
    - - - -
    - -
    - -
    - -
    -
    -
    - -
    -
    - - - -
    - -
    - -
    - -
    -
    -
    - + +
    + + + showMessage) : ?> + loadTemplate('message'); ?> + showJedAndWebInstaller) : ?> +
    + +

    +

    +
    -
    - - - trigger('onInstallerViewAfterLastTab', array()); ?> + + + + trigger('onInstallerViewBeforeFirstTab', array()); ?> + + trigger('onInstallerAddInstallationTab', array()); ?> + + +
    + +
    + + + + trigger('onInstallerViewAfterLastTab', array()); ?> + + + enqueueMessage(JText::_('COM_INSTALLER_NO_INSTALLATION_PLUGINS_FOUND'), 'warning'); ?> + ftp) : ?> - - loadTemplate('ftp'); ?> + + loadTemplate('ftp'); ?> - + + + - - - - - -
    -
    + +
    +
    +
    diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 6693d9cf16..46287b8344 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -16,6 +16,18 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); +// Add spindle-wheel for language installation. +JFactory::getDocument()->addScriptDeclaration(' +jQuery(document).ready(function($) { + Joomla.loadingLayer("load"); + $("#adminForm").on("submit", function(e) { + if (document.getElementsByName("task")[0].value == "languages.install") + { + Joomla.loadingLayer("show"); + } + }); +}); +'); ?>
    diff --git a/administrator/components/com_installer/views/updatesites/view.html.php b/administrator/components/com_installer/views/updatesites/view.html.php index 6985bc8195..66087e240c 100644 --- a/administrator/components/com_installer/views/updatesites/view.html.php +++ b/administrator/components/com_installer/views/updatesites/view.html.php @@ -79,6 +79,17 @@ protected function addToolbar() JToolbarHelper::divider(); } + if ($canDo->get('core.delete')) + { + JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'updatesites.delete', 'JTOOLBAR_DELETE'); + JToolbarHelper::divider(); + } + + if ($canDo->get('core.admin') || $canDo->get('core.options')) + { + JToolbarHelper::custom('updatesites.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false); + } + JHtmlSidebar::setAction('index.php?option=com_installer&view=updatesites'); parent::addToolbar(); diff --git a/administrator/components/com_joomlaupdate/config.xml b/administrator/components/com_joomlaupdate/config.xml index 83bc895a4b..f5bcf5a66d 100644 --- a/administrator/components/com_joomlaupdate/config.xml +++ b/administrator/components/com_joomlaupdate/config.xml @@ -29,6 +29,7 @@ length="50" label="COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_LABEL" description="COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_DESC" + showon="updatesource:custom" />
diff --git a/administrator/components/com_joomlaupdate/controllers/update.php b/administrator/components/com_joomlaupdate/controllers/update.php index 8886883c9d..7e18a68bf4 100644 --- a/administrator/components/com_joomlaupdate/controllers/update.php +++ b/administrator/components/com_joomlaupdate/controllers/update.php @@ -156,7 +156,7 @@ public function purge() * * @return void * - * @since 3.5.2 + * @since 3.6.0 */ public function upload() { @@ -191,7 +191,7 @@ public function upload() * * @return array * - * @since 3.5.2 + * @since 3.6.0 */ public function captive() { @@ -225,7 +225,7 @@ public function captive() * * @return array * - * @since 3.5.2 + * @since 3.6.0 */ public function confirm() { diff --git a/administrator/components/com_joomlaupdate/joomlaupdate.xml b/administrator/components/com_joomlaupdate/joomlaupdate.xml index 36f165206f..71604e6a54 100644 --- a/administrator/components/com_joomlaupdate/joomlaupdate.xml +++ b/administrator/components/com_joomlaupdate/joomlaupdate.xml @@ -7,7 +7,7 @@ GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org - 3.5.2 + 3.6.0 COM_JOOMLAUPDATE_XML_DESCRIPTION js diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index 9636ba3fb3..4f9af0181b 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -807,7 +807,7 @@ public function cleanUp() * * @return void * - * @since 3.5.2 + * @since 3.6.0 */ public function upload() { @@ -893,7 +893,7 @@ public function upload() * * @return bool * - * @since 3.5.2 + * @since 3.6.0 */ public function captiveLogin($credentials) { @@ -931,7 +931,7 @@ public function captiveLogin($credentials) * * @return bool * - * @since 3.5.2 + * @since 3.6.0 */ public function captiveFileExists() { @@ -952,7 +952,7 @@ public function captiveFileExists() * * @return void * - * @since 3.5.2 + * @since 3.6.0 */ public function removePackageFiles() { diff --git a/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php b/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php index e4ab4a09e6..102b92f901 100644 --- a/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php +++ b/administrator/components/com_joomlaupdate/views/default/tmpl/default_upload.php @@ -34,10 +34,11 @@ $("#loading") .css("top", outerDiv.position().top - $(window).scrollTop()) - .css("left", outerDiv.position().left - $(window).scrollLeft()) - .css("width", outerDiv.width()) - .css("height", outerDiv.height()) + .css("left", "0") + .css("width", "100%") + .css("height", "100%") .css("display", "none") + .css("margin-top", "-10px"); }); JS; @@ -49,10 +50,9 @@ #loading { background: rgba(255, 255, 255, .8) url('$ajaxLoaderImage') 50% 15% no-repeat; position: fixed; - opacity: 0.8; + opacity: 1; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity = 80); filter: alpha(opacity = 80); - margin: -10px -50px 0 -50px; overflow: hidden; } CSS; diff --git a/administrator/components/com_joomlaupdate/views/default/view.html.php b/administrator/components/com_joomlaupdate/views/default/view.html.php index 0c8d41ea8e..a498dccad8 100644 --- a/administrator/components/com_joomlaupdate/views/default/view.html.php +++ b/administrator/components/com_joomlaupdate/views/default/view.html.php @@ -21,7 +21,7 @@ class JoomlaupdateViewDefault extends JViewLegacy * * @var array * - * @since 3.5.2 + * @since 3.6.0 */ protected $updateInfo = null; @@ -30,7 +30,7 @@ class JoomlaupdateViewDefault extends JViewLegacy * * @var string * - * @since 3.5.2 + * @since 3.6.0 */ protected $methodSelect = null; @@ -39,7 +39,7 @@ class JoomlaupdateViewDefault extends JViewLegacy * * @var string * - * @since 3.5.2 + * @since 3.6.0 */ protected $methodSelectUpload = null; @@ -87,7 +87,7 @@ public function display($tpl = null) if (!is_null($this->updateInfo['object'])) { - // Show the message if a update is found. + // Show the message if an update is found. JFactory::getApplication()->enqueueMessage(JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE'), 'notice'); } diff --git a/administrator/components/com_joomlaupdate/views/upload/view.html.php b/administrator/components/com_joomlaupdate/views/upload/view.html.php index b4b600ffd3..cfa2105572 100644 --- a/administrator/components/com_joomlaupdate/views/upload/view.html.php +++ b/administrator/components/com_joomlaupdate/views/upload/view.html.php @@ -12,7 +12,7 @@ /** * Joomla! Update's Update View * - * @since 3.5.2 + * @since 3.6.0 */ class JoomlaupdateViewUpload extends JViewLegacy { @@ -23,7 +23,7 @@ class JoomlaupdateViewUpload extends JViewLegacy * * @return void * - * @since 3.5.2 + * @since 3.6.0 */ public function display($tpl = null) { diff --git a/administrator/components/com_languages/helpers/html/languages.php b/administrator/components/com_languages/helpers/html/languages.php index 32f619f6dd..01468df548 100644 --- a/administrator/components/com_languages/helpers/html/languages.php +++ b/administrator/components/com_languages/helpers/html/languages.php @@ -47,7 +47,7 @@ public static function id($rowNum, $language) . ' type="radio"' . ' id="cb' . $rowNum . '"' . ' name="cid"' - . ' value="' . htmlspecialchars($language) . '"' + . ' value="' . htmlspecialchars($language, ENT_COMPAT, 'UTF-8') . '"' . ' onclick="Joomla.isChecked(this.checked);"' . ' title="' . ($rowNum + 1) . '"' . '/>'; diff --git a/administrator/components/com_languages/languages.xml b/administrator/components/com_languages/languages.xml index 57438e3d61..7cbcf5ec06 100644 --- a/administrator/components/com_languages/languages.xml +++ b/administrator/components/com_languages/languages.xml @@ -2,7 +2,7 @@ com_languages Joomla! Project - 2006 + April 2006 (C) 2005 - 2016 Open Source Matters. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org diff --git a/administrator/components/com_languages/models/forms/filter_installed.xml b/administrator/components/com_languages/models/forms/filter_installed.xml index e49edea639..d8e79adece 100644 --- a/administrator/components/com_languages/models/forms/filter_installed.xml +++ b/administrator/components/com_languages/models/forms/filter_installed.xml @@ -13,8 +13,8 @@ diff --git a/administrator/components/com_languages/models/installed.php b/administrator/components/com_languages/models/installed.php index c9117dfb07..52c8dbd337 100644 --- a/administrator/components/com_languages/models/installed.php +++ b/administrator/components/com_languages/models/installed.php @@ -326,7 +326,7 @@ protected function getLanguageList() // Create a new db object. $db = $this->getDbo(); $query = $db->getQuery(true); - $client = $this->getState('filter.client_id'); + $client = $this->getState('client_id'); $type = "language"; // Select field element from the extensions table. diff --git a/administrator/components/com_languages/views/language/tmpl/edit.php b/administrator/components/com_languages/views/language/tmpl/edit.php index 68a5787647..4c8e4f2a98 100644 --- a/administrator/components/com_languages/views/language/tmpl/edit.php +++ b/administrator/components/com_languages/views/language/tmpl/edit.php @@ -47,7 +47,7 @@
'details')); ?> - + form->renderField('title'); ?> form->renderField('title_native'); ?> form->renderField('lang_code'); ?> @@ -72,11 +72,11 @@ form->renderField('lang_id'); ?> - + form->renderFieldset('metadata'); ?> - + form->renderFieldset('site_name'); ?> diff --git a/administrator/components/com_languages/views/languages/tmpl/default.php b/administrator/components/com_languages/views/languages/tmpl/default.php index 5bd2314365..a17be0afe7 100644 --- a/administrator/components/com_languages/views/languages/tmpl/default.php +++ b/administrator/components/com_languages/views/languages/tmpl/default.php @@ -48,28 +48,28 @@ - + - + - + - + - + - + - + - + @@ -129,19 +129,19 @@ - + escape($item->title_native); ?> - + escape($item->lang_code); ?> escape($item->sef); ?> - + image . '.gif', $item->image, array('title' => $item->image), true); ?> escape($item->image); ?> - + escape($item->access_level); ?> diff --git a/administrator/components/com_media/models/manager.php b/administrator/components/com_media/models/manager.php index 25d51b050a..e2b9598374 100644 --- a/administrator/components/com_media/models/manager.php +++ b/administrator/components/com_media/models/manager.php @@ -101,7 +101,7 @@ public function getFolderList($base = null) // so both string and integer are supported. if ($asset == 0) { - $asset = htmlspecialchars(json_encode(trim($input->get('asset', 0, 'cmd')))); + $asset = htmlspecialchars(json_encode(trim($input->get('asset', 0, 'cmd'))), ENT_COMPAT, 'UTF-8'); } $author = $input->get('author', 0, 'integer'); diff --git a/administrator/components/com_media/views/images/tmpl/default.php b/administrator/components/com_media/views/images/tmpl/default.php index 8e4c09beb2..eef3d264c1 100644 --- a/administrator/components/com_media/views/images/tmpl/default.php +++ b/administrator/components/com_media/views/images/tmpl/default.php @@ -56,7 +56,7 @@
-
diff --git a/administrator/components/com_media/views/images/view.html.php b/administrator/components/com_media/views/images/view.html.php index 248bd9b5d6..cb8fd82521 100644 --- a/administrator/components/com_media/views/images/view.html.php +++ b/administrator/components/com_media/views/images/view.html.php @@ -21,7 +21,7 @@ class MediaViewImages extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ diff --git a/administrator/components/com_media/views/imageslist/view.html.php b/administrator/components/com_media/views/imageslist/view.html.php index 5ced441d84..e46e8e14e5 100644 --- a/administrator/components/com_media/views/imageslist/view.html.php +++ b/administrator/components/com_media/views/imageslist/view.html.php @@ -21,7 +21,7 @@ class MediaViewImagesList extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ diff --git a/administrator/components/com_media/views/media/view.html.php b/administrator/components/com_media/views/media/view.html.php index e39372fcf9..1011e75d27 100644 --- a/administrator/components/com_media/views/media/view.html.php +++ b/administrator/components/com_media/views/media/view.html.php @@ -21,7 +21,7 @@ class MediaViewMedia extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ @@ -74,7 +74,7 @@ protected function addToolbar() // Set the titlebar text JToolbarHelper::title(JText::_('COM_MEDIA'), 'images mediamanager'); - // Add a upload button + // Add an upload button if ($user->authorise('core.create', 'com_media')) { // Instantiate a new JLayoutFile instance and render the layout diff --git a/administrator/components/com_media/views/medialist/view.html.php b/administrator/components/com_media/views/medialist/view.html.php index 80c1c1a9c8..ae897dcd06 100644 --- a/administrator/components/com_media/views/medialist/view.html.php +++ b/administrator/components/com_media/views/medialist/view.html.php @@ -21,7 +21,7 @@ class MediaViewMediaList extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.0 */ diff --git a/administrator/components/com_menus/access.xml b/administrator/components/com_menus/access.xml index c59379a6f7..c709842eec 100644 --- a/administrator/components/com_menus/access.xml +++ b/administrator/components/com_menus/access.xml @@ -9,4 +9,11 @@ +
+ + + + + +
diff --git a/administrator/components/com_menus/config.xml b/administrator/components/com_menus/config.xml index 3151de5453..8ab0f8abed 100644 --- a/administrator/components/com_menus/config.xml +++ b/administrator/components/com_menus/config.xml @@ -28,6 +28,7 @@ type="text" label="COM_MENUS_ITEM_FIELD_PAGE_HEADING_LABEL" description="COM_MENUS_ITEM_FIELD_PAGE_HEADING_DESC" + showon="show_page_heading:1" /> input->getCmd('menutype', isset($data['menutype']) ? $data['menutype'] : ''); + + $menutypeID = 0; + + // Load menutype ID + if ($menuType) + { + $menutypeID = (int) $this->getMenuTypeId($menuType); + } + + return $user->authorise('core.create', 'com_menus.menu.' . $menutypeID); + } + + /** + * Method to check if you edit a record. + * + * Extended classes can override this if necessary. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key; default is id. + * + * @return boolean + * + * @since 3.6 + */ + protected function allowEdit($data = array(), $key = 'id') + { + $user = JFactory::getUser(); + + $menutypeID = 0; + + if (isset($data[$key])) + { + $model = $this->getModel(); + $item = $model->getItem($data[$key]); + + if (!empty($item->menutype)) + { + $menutypeID = (int) $this->getMenuTypeId($item->menutype); + } + } + + return $user->authorise('core.edit', 'com_menus.menu.' . (int) $menutypeID); + } + + /** + * Loads the menutype ID by a given menutype string + * + * @param string $menutype The given menutype + * + * @return integer + * + * @since 3.6 + */ + protected function getMenuTypeId($menutype) + { + $model = $this->getModel(); + $table = $model->getTable('MenuType', 'JTable'); + + $table->load(array('menutype' => $menutype)); + + return (int) $table->id; + } + /** * Method to add a new menu item. * @@ -86,6 +165,14 @@ public function cancel($key = null) // Clear the ancillary data from the session. $app->setUserState($context . '.type', null); $app->setUserState($context . '.link', null); + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend() + . '&menutype=' . $app->getUserState('com_menus.items.menutype'), false + ) + ); } return $result; @@ -134,13 +221,27 @@ public function save($key = null, $urlVar = null) $app = JFactory::getApplication(); $model = $this->getModel('Item', '', array()); + $table = $model->getTable(); $data = $this->input->post->get('jform', array(), 'array'); $task = $this->getTask(); $context = 'com_menus.edit.item'; - $recordId = $this->input->getInt('id'); + + // Determine the name of the primary key for the data. + if (empty($key)) + { + $key = $table->getKeyName(); + } + + // To avoid data collisions the urlVar may be different from the primary key. + if (empty($urlVar)) + { + $urlVar = $key; + } + + $recordId = $this->input->getInt($urlVar); // Populate the row id from the session. - $data['id'] = $recordId; + $data[$key] = $recordId; // The save2copy task needs to be handled slightly differently. if ($task == 'save2copy') @@ -160,6 +261,22 @@ public function save($key = null, $urlVar = null) $task = 'apply'; } + // Access check. + if (!$this->allowSave($data, $key)) + { + $this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); + $this->setMessage($this->getError(), 'error'); + + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . $this->getRedirectToListAppend(), false + ) + ); + + return false; + } + // Validate the posted data. // This post is made up of two forms, one for the item and one for params. $form = $model->getForm($data); @@ -271,7 +388,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $editUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId); - $this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'warning'); + $this->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error'); $this->setRedirect(JRoute::_($editUrl, false)); return false; @@ -326,7 +443,12 @@ public function save($key = null, $urlVar = null) $app->setUserState('com_menus.edit.item.link', null); // Redirect to the list screen. - $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend() + . '&menutype=' . $app->getUserState('com_menus.items.menutype'), false + ) + ); break; } diff --git a/administrator/components/com_menus/controllers/items.php b/administrator/components/com_menus/controllers/items.php index a9bcdb99f1..420f9b8da4 100644 --- a/administrator/components/com_menus/controllers/items.php +++ b/administrator/components/com_menus/controllers/items.php @@ -120,6 +120,8 @@ public function setDefault() // Check for request forgeries JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN')); + $app = JFactory::getApplication(); + // Get items to publish from the request. $cid = $this->input->get('cid', array(), 'array'); $data = array('setDefault' => 1, 'unsetDefault' => 0); @@ -158,6 +160,135 @@ public function setDefault() } } - $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . $app->getUserState('com_menus.items.menutype'), false + ) + ); + } + + /** + * Method to publish a list of items + * + * @return void + * + * @since 3.6.0 + */ + public function publish() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + + // Get items to publish from the request. + $cid = JFactory::getApplication()->input->get('cid', array(), 'array'); + $data = array('publish' => 1, 'unpublish' => 0, 'trash' => -2, 'report' => -3); + $task = $this->getTask(); + $value = JArrayHelper::getValue($data, $task, 0, 'int'); + + if (empty($cid)) + { + JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror'); + } + else + { + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + JArrayHelper::toInteger($cid); + + // Publish the items. + try + { + $model->publish($cid, $value); + $errors = $model->getErrors(); + + if ($value == 1) + { + if ($errors) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::plural($this->text_prefix . '_N_ITEMS_FAILED_PUBLISHING', count($cid)), 'error'); + } + else + { + $ntext = $this->text_prefix . '_N_ITEMS_PUBLISHED'; + } + } + elseif ($value == 0) + { + $ntext = $this->text_prefix . '_N_ITEMS_UNPUBLISHED'; + } + else + { + $ntext = $this->text_prefix . '_N_ITEMS_TRASHED'; + } + + $this->setMessage(JText::plural($ntext, count($cid))); + } + catch (Exception $e) + { + $this->setMessage($e->getMessage(), 'error'); + } + } + + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&menutype=' . + JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ) + ); + } + + /** + * Check in of one or more records. + * + * @return boolean True on success + * + * @since 3.6.0 + */ + public function checkin() + { + // Check for request forgeries. + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $ids = JFactory::getApplication()->input->post->get('cid', array(), 'array'); + + $model = $this->getModel(); + $return = $model->checkin($ids); + + if ($return === false) + { + // Checkin failed. + $message = JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ), + $message, + 'error' + ); + + return false; + } + else + { + // Checkin succeeded. + $message = JText::plural($this->text_prefix . '_N_ITEMS_CHECKED_IN', count($ids)); + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . '&view=' . $this->view_list + . '&menutype=' . JFactory::getApplication()->getUserState('com_menus.items.menutype'), + false + ), + $message + ); + + return true; + } } } diff --git a/administrator/components/com_menus/controllers/menus.php b/administrator/components/com_menus/controllers/menus.php index 79a76bb56c..01c7d64001 100644 --- a/administrator/components/com_menus/controllers/menus.php +++ b/administrator/components/com_menus/controllers/menus.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\Utilities\ArrayHelper; + /** * The Menu List Controller * @@ -49,7 +51,7 @@ public function getModel($name = 'Menu', $prefix = 'MenusModel', $config = array } /** - * Remove a item. + * Remove an item. * * @return void * @@ -60,30 +62,44 @@ public function delete() // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - // Get items to remove from the request. - $cid = $this->input->get('cid', array(), 'array'); + $user = JFactory::getUser(); + $app = JFactory::getApplication(); + $cids = (array) $this->input->get('cid', array(), 'array'); - if (!is_array($cid) || count($cid) < 1) + if (count($cids) < 1) { - JError::raiseWarning(500, JText::_('COM_MENUS_NO_MENUS_SELECTED')); + $app->enqueueMessage(JText::_('COM_MENUS_NO_MENUS_SELECTED'), 'notice'); } else { - // Get the model. - $model = $this->getModel(); - - // Make sure the item ids are integers - jimport('joomla.utilities.arrayhelper'); - JArrayHelper::toInteger($cid); - - // Remove the items. - if (!$model->delete($cid)) + // Access checks. + foreach ($cids as $i => $id) { - $this->setMessage($model->getError()); + if (!$user->authorise('core.delete', 'com_menus.menu.' . (int) $id)) + { + // Prune items that you can't change. + unset($cids[$i]); + $app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), 'error'); + } } - else + + if (count($cids) > 0) { - $this->setMessage(JText::plural('COM_MENUS_N_MENUS_DELETED', count($cid))); + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + $cids = ArrayHelper::toInteger($cids); + + // Remove the items. + if (!$model->delete($cids)) + { + $this->setMessage($model->getError()); + } + else + { + $this->setMessage(JText::plural('COM_MENUS_N_MENUS_DELETED', count($cids))); + } } } diff --git a/administrator/components/com_menus/helpers/menus.php b/administrator/components/com_menus/helpers/menus.php index 91f9276b2c..38488fd790 100644 --- a/administrator/components/com_menus/helpers/menus.php +++ b/administrator/components/com_menus/helpers/menus.php @@ -148,16 +148,16 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, { $db = JFactory::getDbo(); $query = $db->getQuery(true) - ->select('DISTINCT(a.id) AS value, - a.title AS text, - a.alias, - a.level, - a.menutype, - a.type, - a.published, - a.template_style_id, - a.checked_out, - a.language, + ->select('DISTINCT(a.id) AS value, + a.title AS text, + a.alias, + a.level, + a.menutype, + a.type, + a.published, + a.template_style_id, + a.checked_out, + a.language, a.lft') ->from('#__menu AS a') ->join('LEFT', $db->quoteName('#__menu') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); @@ -284,6 +284,7 @@ public static function getAssociations($pk) { $langAssociations = JLanguageAssociations::getAssociations('com_menus', '#__menu', 'com_menus.item', $pk, 'id', '', ''); $associations = array(); + foreach ($langAssociations as $langAssociation) { $associations[$langAssociation->language] = $langAssociation->id; diff --git a/administrator/components/com_menus/layouts/joomla/menu/edit_modules.php b/administrator/components/com_menus/layouts/joomla/menu/edit_modules.php new file mode 100644 index 0000000000..172230c5e7 --- /dev/null +++ b/administrator/components/com_menus/layouts/joomla/menu/edit_modules.php @@ -0,0 +1,70 @@ +getForm(); +$input = $app->input; +$component = $input->getCmd('option', 'com_content'); + +if ($component == 'com_categories') +{ + $extension = $input->getCmd('extension', 'com_content'); + $parts = explode('.', $extension); + $component = $parts[0]; +} + +$saveHistory = JComponentHelper::getParams($component)->get('save_history', 0); + +$fields = $displayData->get('fields') ?: array( + array('parent', 'parent_id'), + array('published', 'state', 'enabled'), + array('category', 'catid'), + 'featured', + 'sticky', + 'access', + 'language', + 'tags', + 'note', + 'version_note', +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +if (!$saveHistory) +{ + $hiddenFields[] = 'version_note'; +} + +$html = array(); +$html[] = '
    '; + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + $html[] = '
  • ' . $form->renderField($f) . '
  • '; + break; + } + } +} + +$html[] = '
'; + +echo implode('', $html); diff --git a/administrator/components/com_menus/models/fields/menutype.php b/administrator/components/com_menus/models/fields/menutype.php index 94a412f0f6..078b599126 100644 --- a/administrator/components/com_menus/models/fields/menutype.php +++ b/administrator/components/com_menus/models/fields/menutype.php @@ -90,12 +90,14 @@ function jSelectPosition_' . $this->id . '(name) { 'bootstrap.renderModal', 'menuTypeModal', array( - 'url' => $link, - 'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'), - 'width' => '800px', - 'height' => '300px', - 'footer' => '' + 'url' => $link, + 'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'), + 'width' => '800px', + 'height' => '300px', + 'modalWidth' => '80', + 'bodyHeight' => '70', + 'footer' => '' ) ); $html[] = ' + accesstype="manage" + > + +
JSTATUS_DESC + + diff --git a/administrator/components/com_menus/models/forms/filter_menus.xml b/administrator/components/com_menus/models/forms/filter_menus.xml index 1817dc31ae..9356ab179a 100644 --- a/administrator/components/com_menus/models/forms/filter_menus.xml +++ b/administrator/components/com_menus/models/forms/filter_menus.xml @@ -4,8 +4,8 @@ diff --git a/administrator/components/com_menus/models/forms/item.xml b/administrator/components/com_menus/models/forms/item.xml index 8ba474d827..bb4b79469a 100644 --- a/administrator/components/com_menus/models/forms/item.xml +++ b/administrator/components/com_menus/models/forms/item.xml @@ -28,10 +28,6 @@ hint="JFIELD_ALIAS_PLACEHOLDER" size="40"/> - - + size="1" + > + + JSHOW + + + + +
diff --git a/administrator/components/com_menus/models/forms/menu.xml b/administrator/components/com_menus/models/forms/menu.xml index 5fba348f5e..a10aac513c 100644 --- a/administrator/components/com_menus/models/forms/menu.xml +++ b/administrator/components/com_menus/models/forms/menu.xml @@ -9,6 +9,11 @@ filter="int" readonly="true"/> + + + +
diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index 6c69478ad8..e45a8af7d6 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -90,6 +90,8 @@ class MenusModelItem extends JModelAdmin */ protected function canDelete($record) { + $user = JFactory::getUser(); + if (!empty($record->id)) { if ($record->published != -2) @@ -97,8 +99,38 @@ protected function canDelete($record) return; } - return parent::canDelete($record); + $menuTypeId = 0; + + if (!empty($record->menutype)) + { + $menuTypeId = $this->getMenuTypeId($record->menutype); + } + + return $user->authorise('core.delete', 'com_menus.menu.' . (int) $menuTypeId); + } + } + + /** + * Method to test whether the state of a record can be edited. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. + * + * @since 3.6 + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + + $menuTypeId = 0; + + if (!empty($record->menutype)) + { + $menuTypeId = $this->getMenuTypeId($record->menutype); } + + return $user->authorise('core.edit.state', 'com_menus.menu.' . (int) $menuTypeId); } /** @@ -159,7 +191,9 @@ protected function batchCopy($value, $pks, $contexts) // Check that user has create permission for menus $user = JFactory::getUser(); - if (!$user->authorise('core.create', 'com_menus')) + $menuTypeId = (int) $this->getMenuTypeId($menuType); + + if (!$user->authorise('core.create', 'com_menus.menu.' . $menuTypeId)) { $this->setError(JText::_('COM_MENUS_BATCH_MENU_ITEM_CANNOT_CREATE')); @@ -350,14 +384,16 @@ protected function batchMove($value, $pks, $contexts) // Check that user has create and edit permission for menus $user = JFactory::getUser(); - if (!$user->authorise('core.create', 'com_menus')) + $menuTypeId = (int) $this->getMenuTypeId($menuType); + + if (!$user->authorise('core.create', 'com_menus.menu.' . $menuTypeId)) { $this->setError(JText::_('COM_MENUS_BATCH_MENU_ITEM_CANNOT_CREATE')); return false; } - if (!$user->authorise('core.edit', 'com_menus')) + if (!$user->authorise('core.edit', 'com_menus.menu.' . $menuTypeId)) { $this->setError(JText::_('COM_MENUS_BATCH_MENU_ITEM_CANNOT_EDIT')); @@ -512,6 +548,11 @@ public function getForm($data = array(), $loadData = true) return false; } + if ($loadData) + { + $data = $this->loadFormData(); + } + // Modify the form based on access controls. if (!$this->canEditState((object) $data)) { @@ -525,6 +566,11 @@ public function getForm($data = array(), $loadData = true) $form->setFieldAttribute('published', 'filter', 'unset'); } + // Filter available menues + $action = $this->getState('item.id') > 0 ? 'edit' : 'create'; + + $form->setFieldAttribute('menutype', 'accesstype', $action); + return $form; } @@ -550,6 +596,13 @@ protected function loadFormData() $data['access'] = (isset($filters['access']) ? $filters['access'] : null); } + if (isset($data['menutype']) && !$this->getState('item.menutypeid')) + { + $menuTypeId = (int) $this->getMenuTypeId($data['menutype']); + + $this->setState('item.menutypeid', $menuTypeId); + } + $this->preprocessData('com_menus.item', $data); return $data; @@ -685,6 +738,21 @@ public function getItem($pk = null) // Note that all request arguments become reserved parameter names. $result->request = $args; $result->params = array_merge($result->params, $args); + + // Special case for the Login menu item. + // Display the login or logout redirect URL fields if not empty + if ($table->link == 'index.php?option=com_users&view=login') + { + if (!empty($result->params['login_redirect_url'])) + { + $result->params['loginredirectchoice'] = '0'; + } + + if (!empty($result->params['logout_redirect_url'])) + { + $result->params['logoutredirectchoice'] = '0'; + } + } } if ($table->type == 'alias') @@ -855,13 +923,25 @@ protected function populateState() $menuType = $app->getUserState('com_menus.edit.item.menutype'); - if ($app->input->getString('menutype', false)) + if ($forcedMenuType = $app->input->get('menutype', '', 'string')) { - $menuType = $app->input->getString('menutype', 'mainmenu'); + $menuType = $forcedMenuType; + + // Set the menu type on the list view state, so we return to this menu after saving. + $app->setUserState('com_menus.items.menutype', $forcedMenuType); } $this->setState('item.menutype', $menuType); + $menuTypeId = 0; + + if ($menuType) + { + $menuTypeId = $this->getMenuTypeId($menuType); + } + + $this->setState('item.menutypeid', $menuTypeId); + if (!($type = $app->getUserState('com_menus.edit.item.type'))) { $type = $app->input->get('type'); @@ -884,6 +964,24 @@ protected function populateState() $this->setState('params', $params); } + /** + * Loads the menutype ID by a given menutype string + * + * @param string $menutype The given menutype + * + * @return integer + * + * @since 3.6 + */ + protected function getMenuTypeId($menutype) + { + $table = $this->getTable('MenuType', 'JTable'); + + $table->load(array('menutype' => $menutype)); + + return (int) $table->id; + } + /** * Method to preprocess the form. * diff --git a/administrator/components/com_menus/models/items.php b/administrator/components/com_menus/models/items.php index 525740eedf..e85a977b36 100644 --- a/administrator/components/com_menus/models/items.php +++ b/administrator/components/com_menus/models/items.php @@ -74,6 +74,7 @@ public function __construct($config = array()) protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('administrator'); + $user = JFactory::getUser(); $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id'); $this->setState('filter.parent_id', $parentId); @@ -93,38 +94,52 @@ protected function populateState($ordering = null, $direction = null) $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level'); $this->setState('filter.level', $level); - $menuType = $app->input->getString('menutype', null); + $currentMenuType = $app->getUserState($this->context . '.menutype', ''); + $menuType = $app->input->getString('menutype', $currentMenuType); + + // If selected menu type different from current menu type reset pagination to 0 + if ($menuType != $currentMenuType) + { + $app->input->set('limitstart', 0); + } if ($menuType) { - if ($menuType != $app->getUserState($this->context . '.menutype')) + $db = $this->getDbo(); + $query = $db->getQuery(true) + ->select($db->qn(array('id', 'title'))) + ->from($db->qn('#__menu_types')) + ->where($db->qn('menutype') . ' = ' . $db->q($menuType)); + + $menuTypeItem = $db->setQuery($query)->loadObject(); + + // Check if menu type exists. + if (!$menuTypeItem) + { + $this->setError(JText::_('COM_MENUS_ERROR_MENUTYPE_NOT_FOUND')); + } + // Check if menu type was changed and if valid agains ACL + elseif ($user->authorise('core.manage', 'com_menus.menu.' . $menuTypeItem->id)) { $app->setUserState($this->context . '.menutype', $menuType); - $app->input->set('limitstart', 0); + $this->setState('menutypetitle', !empty($menuTypeItem->title) ? $menuTypeItem->title : ''); + $this->setState('menutypeid', !empty($menuTypeItem->id) ? $menuTypeItem->id : ''); + } + // Nope, not valid + else + { + $this->setError(JText::_('JERROR_ALERTNOAUTHOR')); } } else { - $menuType = $app->getUserState($this->context . '.menutype'); - - if (!$menuType) - { - $menuType = $this->getDefaultMenuType(); - } + $app->setUserState($this->context . '.menutype', ''); + $this->setState('menutypetitle', ''); + $this->setState('menutypeid', ''); } $this->setState('filter.menutype', $menuType); - // Get menutype title - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('title') - ->from($db->quoteName('#__menu_types')) - ->where($db->quoteName('menutype') . " = " . $db->quote($menuType)); - $db->setQuery($query); - $menuTypeTitle = $db->loadResult(); - $this->setState('menutypetitle', $menuTypeTitle); - $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); @@ -162,29 +177,6 @@ protected function getStoreId($id = '') return parent::getStoreId($id); } - /** - * Finds the default menu type. - * - * In the absence of better information, this is the first menu ordered by title. - * - * @return string The default menu type - * - * @since 1.6 - */ - protected function getDefaultMenuType() - { - // Create a new query object. - $db = $this->getDbo(); - $query = $db->getQuery(true) - ->select('menutype') - ->from('#__menu_types') - ->order('title'); - $db->setQuery($query, 0, 1); - $menuType = $db->loadResult(); - - return $menuType; - } - /** * Builds an SQL query to load the list data. * @@ -307,16 +299,45 @@ protected function getListQuery() if (!empty($parentId)) { - $query->where('p.id = ' . (int) $parentId); + $query->where('a.parent_id = ' . (int) $parentId); } // Filter the items over the menu id if set. $menuType = $this->getState('filter.menutype'); - if (!empty($menuType)) + // "" means all + if ($menuType == '') + { + // Load all menu types we have manage access + $query2 = $this->getDbo()->getQuery(true) + ->select($this->getDbo()->qn(array('id', 'menutype'))) + ->from('#__menu_types') + ->order('title'); + + $menuTypes = $this->getDbo()->setQuery($query2)->loadObjectList(); + + $types = array(); + + foreach ($menuTypes as $type) + { + if ($user->authorise('core.manage', 'com_menus.menu.' . (int) $type->id)) + { + $types[] = $query->q($type->menutype); + } + } + + $query->where('a.menutype IN(' . implode(',', $types) . ')'); + } + // Default behavior => load all items from a specific menu + elseif (strlen($menuType)) { $query->where('a.menutype = ' . $db->quote($menuType)); } + // Empty menu type => error + else + { + $query->where('1 != 1'); + } // Filter on the access level. if ($access = $this->getState('filter.access')) diff --git a/administrator/components/com_menus/models/menu.php b/administrator/components/com_menus/models/menu.php index 7634dacf56..facb74f037 100644 --- a/administrator/components/com_menus/models/menu.php +++ b/administrator/components/com_menus/models/menu.php @@ -50,7 +50,7 @@ protected function canDelete($record) } /** - * Method to test whether a record can be deleted. + * Method to test whether the state of a record can be edited. * * @param object $record A record object. * diff --git a/administrator/components/com_menus/views/item/tmpl/edit.php b/administrator/components/com_menus/views/item/tmpl/edit.php index d475e0e0c4..462335edd9 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit.php +++ b/administrator/components/com_menus/views/item/tmpl/edit.php @@ -88,15 +88,10 @@ 'details')); ?> - +
item->type == 'alias') - { - echo $this->form->getControlGroup('aliastip'); - } - echo $this->form->getControlGroup('type'); if ($this->item->type == 'alias') @@ -151,14 +146,14 @@ item->type !== 'alias' && $this->item->type !== 'url' && $this->item->type !== 'separator' && $this->item->type !== 'heading') : ?> - + loadTemplate('associations'); ?> modules)) : ?> - + loadTemplate('modules'); ?> diff --git a/administrator/components/com_menus/views/item/tmpl/edit_modules.php b/administrator/components/com_menus/views/item/tmpl/edit_modules.php index cb0416b126..6eea8070cc 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit_modules.php +++ b/administrator/components/com_menus/views/item/tmpl/edit_modules.php @@ -20,20 +20,32 @@ menuId = parseInt(' . $this->item->id . '); jQuery(document).ready(function() { - jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules1\']", function (event) { + jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules_assigned1\']", function (event) { jQuery(".table tr.no").hide(); }); - jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules0\']", function (event) { + jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules_assigned0\']", function (event) { jQuery(".table tr.no").show(); }); + jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules_published1\']", function (event) { + jQuery(".table tr.unpublished").hide(); + }); + jQuery(document).on("click", "input:radio[id^=\'jform_toggle_modules_published0\']", function (event) { + jQuery(".table tr.unpublished").show(); + }); }); '); +JFactory::getDocument()->addStyleDeclaration(' +ul.horizontal-buttons li { + display: inline-block; + padding-right: 10%; +} +'); ?> fields = array('toggle_modules'); +$this->fields = array('toggle_modules_assigned','toggle_modules_published'); -echo JLayoutHelper::render('joomla.edit.global', $this); ?> +echo JLayoutHelper::render('joomla.menu.edit_modules', $this); ?> @@ -50,22 +62,31 @@ + modules as $i => &$module) : ?> - menuid)) : ?> - except || $module->menuid < 0) : ?> - - - - - - - + menuid)) : ?> + except || $module->menuid < 0) : ?> + + + + + + + + published) : ?> + + + + + + id . 'Modal', + 'moduleEdit' . $module->id . 'Modal', array( - 'url' => $link, - 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), - 'height' => '300px', - 'width' => '800px', + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'backdrop' => 'static', + 'keyboard' => false, 'closeButton' => false, - 'footer' => '' - . '' + 'url' => $link, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', ) ); ?> diff --git a/administrator/components/com_menus/views/item/view.html.php b/administrator/components/com_menus/views/item/view.html.php index bc80dee274..1d8b4900d3 100644 --- a/administrator/components/com_menus/views/item/view.html.php +++ b/administrator/components/com_menus/views/item/view.html.php @@ -47,12 +47,21 @@ class MenusViewItem extends JViewLegacy */ public function display($tpl = null) { + $user = JFactory::getUser(); + $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->modules = $this->get('Modules'); $this->levels = $this->get('ViewLevels'); $this->state = $this->get('State'); - $this->canDo = JHelperContent::getActions('com_menus'); + $this->canDo = JHelperContent::getActions('com_menus', 'menu', (int) $this->state->get('item.menutypeid')); + + // Check if we're allowed to edit this item + // No need to check for create, because then the moduletype select is empty + if (!empty($this->item->id) && !$this->canDo->get('core.edit')) + { + throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403); + } // Check for errors. if (count($errors = $this->get('Errors'))) diff --git a/administrator/components/com_menus/views/items/tmpl/default.php b/administrator/components/com_menus/views/items/tmpl/default.php index e0e659a1c1..1494409bbf 100644 --- a/administrator/components/com_menus/views/items/tmpl/default.php +++ b/administrator/components/com_menus/views/items/tmpl/default.php @@ -16,26 +16,33 @@ JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); -$user = JFactory::getUser(); -$app = JFactory::getApplication(); -$userId = $user->get('id'); -$listOrder = $this->escape($this->state->get('list.ordering')); -$listDirn = $this->escape($this->state->get('list.direction')); -$ordering = ($listOrder == 'a.lft'); -$canOrder = $user->authorise('core.edit.state', 'com_menus'); -$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); +$user = JFactory::getUser(); +$app = JFactory::getApplication(); +$userId = $user->get('id'); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +$ordering = ($listOrder == 'a.lft'); +$canOrder = $user->authorise('core.edit.state', 'com_menus'); +$saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); +$menuTypeId = (int) $this->state->get('menutypeid'); +$menuType = (string) $app->getUserState('com_menus.items.menutype', '', 'string'); -if ($saveOrder) +if ($saveOrder && $menuType) { $saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true); } $assoc = JLanguageAssociations::isEnabled(); -$colSpan = ($assoc) ? 9 : 8; +$colSpan = ($assoc) ? 10 : 9; + +if ($menuType == '') +{ + $colSpan--; +} ?> - +sidebar)) : ?>
sidebar; ?> @@ -56,10 +63,12 @@
+ +
id . '&tmpl=component&view=module&layout=modal'; ?> - + escape($module->title); ?> @@ -99,19 +120,39 @@ + published):?> + + + + + + + + +
- - + + + @@ -99,10 +111,10 @@ items as $i => $item) : $orderkey = array_search($item->id, $this->ordering[$item->parent_id]); - $canCreate = $user->authorise('core.create', 'com_menus'); - $canEdit = $user->authorise('core.edit', 'com_menus'); + $canCreate = $user->authorise('core.create', 'com_menus.menu.' . $menuTypeId); + $canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $menuTypeId); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0; - $canChange = $user->authorise('core.edit.state', 'com_menus') && $canCheckin; + $canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $menuTypeId) && $canCheckin; // Get the parents of item for sorting if ($item->level > 1) @@ -133,26 +145,28 @@ } ?> - + if (!$canChange) + { + $iconClass = ' inactive'; + } + elseif (!$saveOrder) + { + $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); + } + ?> + + + + + + + + @@ -160,7 +174,8 @@ published, $i, $canChange, 'cb'); ?> + @@ -99,17 +99,20 @@ items as $i => $item) : - $canCreate = $user->authorise('core.create', 'com_menus'); - $canEdit = $user->authorise('core.edit', 'com_menus'); - $canChange = $user->authorise('core.edit.state', 'com_menus'); + $canEdit = $user->authorise('core.edit', 'com_menus.menu.' . (int) $item->id); + $canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id); ?> - diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index fb0601ea93..b505fe4550 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -16,7 +16,7 @@ /** * Form Field class for the Joomla Framework. * - * @since 3.5.2 + * @since 3.6.0 */ class JFormFieldMessageStates extends JFormFieldList { @@ -24,7 +24,7 @@ class JFormFieldMessageStates extends JFormFieldList * The form field type. * * @var string - * @since 3.5.2 + * @since 3.6.0 */ protected $type = 'MessageStates'; @@ -33,7 +33,7 @@ class JFormFieldMessageStates extends JFormFieldList * * @return array The field option objects. * - * @since 3.5.2 + * @since 3.6.0 */ protected function getOptions() { diff --git a/administrator/components/com_messages/models/forms/filter_messages.xml b/administrator/components/com_messages/models/forms/filter_messages.xml index 77753c310e..719e73a21b 100644 --- a/administrator/components/com_messages/models/forms/filter_messages.xml +++ b/administrator/components/com_messages/models/forms/filter_messages.xml @@ -4,8 +4,8 @@ @@ -15,7 +15,7 @@ @@ -44,6 +44,17 @@ > + + + + position = $position; - // Alter the title if necessary - $data = $this->generateNewTitle(0, $table->title, $table->position); - $table->title = $data['0']; - - // Unpublish the moved module - $table->published = 0; - if (!$table->store()) { $this->setError($table->getError()); @@ -534,6 +527,10 @@ public function getForm($data = array(), $loadData = true) $id = JArrayHelper::getValue($data, 'id'); } + // Add the default fields directory + $baseFolder = ($clientId) ? JPATH_ADMINISTRATOR : JPATH_SITE; + JForm::addFieldPath($baseFolder . '/modules' . '/' . $module . '/field'); + // These variables are used to add data from the plugin XML files. $this->setState('item.client_id', $clientId); $this->setState('item.module', $module); diff --git a/administrator/components/com_modules/models/modules.php b/administrator/components/com_modules/models/modules.php index 0f44d2b427..9be3631314 100644 --- a/administrator/components/com_modules/models/modules.php +++ b/administrator/components/com_modules/models/modules.php @@ -48,6 +48,7 @@ public function __construct($config = array()) 'position', 'a.position', 'pages', 'name', 'e.name', + 'menuitem', ); } @@ -82,6 +83,7 @@ protected function populateState($ordering = 'a.position', $direction = 'asc') $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.position', $this->getUserStateFromRequest($this->context . '.filter.position', 'filter_position', '', 'string')); $this->setState('filter.module', $this->getUserStateFromRequest($this->context . '.filter.module', 'filter_module', '', 'string')); + $this->setState('filter.menuitem', $this->getUserStateFromRequest($this->context . '.filter.menuitem', 'filter_menuitem', '', 'cmd')); $this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', 'cmd')); // If in modal layout on the frontend, state and language are always forced. @@ -136,6 +138,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.position'); $id .= ':' . $this->getState('filter.module'); + $id .= ':' . $this->getState('filter.menuitem'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.language'); @@ -331,6 +334,44 @@ protected function getListQuery() $query->where($db->quoteName('a.module') . ' = ' . $db->quote($module)); } + // Filter by menuitem id (only for site client). + if ((int) $clientId === 0 && $menuItemId = $this->getState('filter.menuitem')) + { + // If user selected the modules not assigned to any page (menu item). + if ((int) $menuItemId === -1) + { + $query->having('MIN(' . $db->quoteName('mm.menuid') . ') IS NULL'); + } + // If user selected the modules assigned to some particlar page (menu item). + else + { + // Modules in "All" pages. + $subQuery1 = $db->getQuery(true); + $subQuery1->select('MIN(' . $db->quoteName('menuid') . ')') + ->from($db->quoteName('#__modules_menu')) + ->where($db->quoteName('moduleid') . ' = ' . $db->quoteName('a.id')); + + // Modules in "Selected" pages that have the chosen menu item id. + $subQuery2 = $db->getQuery(true); + $subQuery2->select($db->quoteName('moduleid')) + ->from($db->quoteName('#__modules_menu')) + ->where($db->quoteName('menuid') . ' = ' . (int) $menuItemId); + + // Modules in "All except selected" pages that doesn't have the chosen menu item id. + $subQuery3 = $db->getQuery(true); + $subQuery3->select($db->quoteName('moduleid')) + ->from($db->quoteName('#__modules_menu')) + ->where($db->quoteName('menuid') . ' = -' . (int) $menuItemId); + + // Filter by modules assigned to the selected menu item. + $query->where('( + (' . $subQuery1 . ') = 0 + OR ((' . $subQuery1 . ') > 0 AND ' . $db->quoteName('a.id') . ' IN (' . $subQuery2 . ')) + OR ((' . $subQuery1 . ') < 0 AND ' . $db->quoteName('a.id') . ' NOT IN (' . $subQuery3 . ')) + )'); + } + } + // Filter by search in title or note or id:. $search = $this->getState('filter.search'); if (!empty($search)) diff --git a/administrator/components/com_modules/models/positions.php b/administrator/components/com_modules/models/positions.php index 4f247cb86f..e972fe1c17 100644 --- a/administrator/components/com_modules/models/positions.php +++ b/administrator/components/com_modules/models/positions.php @@ -60,15 +60,17 @@ protected function populateState($ordering = null, $direction = null) $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); - $clientId = $app->input->getInt('client_id', 0); - $this->setState('filter.client_id', $clientId); - $template = $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template', '', 'string'); $this->setState('filter.template', $template); $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'string'); $this->setState('filter.type', $type); + // Special case for the client id. + $clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int'); + $clientId = (!in_array((int) $clientId, array (0, 1))) ? 0 : (int) $clientId; + $this->setState('client_id', $clientId); + // Load the parameters. $params = JComponentHelper::getParams('com_modules'); $this->setState('params', $params); @@ -91,7 +93,7 @@ public function getItems() $lang = JFactory::getLanguage(); $search = $this->getState('filter.search'); $state = $this->getState('filter.state'); - $clientId = $this->getState('filter.client_id'); + $clientId = $this->getState('client_id'); $filter_template = $this->getState('filter.template'); $type = $this->getState('filter.type'); $ordering = $this->getState('list.ordering'); diff --git a/administrator/components/com_modules/views/module/tmpl/edit.php b/administrator/components/com_modules/views/module/tmpl/edit.php index f035b20ce4..3da9af9292 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit.php +++ b/administrator/components/com_modules/views/module/tmpl/edit.php @@ -48,9 +48,11 @@ var updPosition = jQuery('#jform_position').chosen().val(), updTitle = jQuery('#jform_title').val(), updMenus = jQuery('#jform_assignment').chosen().val(), + updStatus = jQuery('#jform_published').chosen().val(), updAccess = jQuery('#jform_access').chosen().val(), tmpMenu = jQuery('#menus-" . $this->item->id . "', parent.document), tmpRow = jQuery('#tr-" . $this->item->id . "', parent.document); + tmpStatus = jQuery('#status-" . $this->item->id . "', parent.document); window.parent.inMenus = new Array(); window.parent.numMenus = jQuery(':input[name=\"jform[assigned][]\"]').length; @@ -118,27 +120,49 @@ if (!tmpRow.hasClass('no') || tmpRow.hasClass('')) { tmpRow.addClass('no'); } } } - + if (updStatus == 1) { + tmpStatus.html('" . JText::_("JYES") . "'); + if (tmpRow.hasClass('unpublished')) { tmpRow.removeClass('unpublished '); } + } + if (updStatus == 0) { + tmpStatus.html('" . JText::_("JNO") . "'); + if (!tmpRow.hasClass('unpublished') || tmpRow.hasClass('')) { tmpRow.addClass('unpublished'); } + } + if (updStatus == -2) { + tmpStatus.html('" . JText::_("JTrashed") . "'); + if (!tmpRow.hasClass('unpublished') || tmpRow.hasClass('')) { tmpRow.addClass('unpublished'); } + } + if (document.formvalidator.isValid(document.getElementById('module-form'))) { jQuery('#title-" . $this->item->id . "', parent.document).text(updTitle); jQuery('#position-" . $this->item->id . "', parent.document).text(updPosition); jQuery('#access-" . $this->item->id . "', parent.document).html(parent.viewLevels[updAccess]); + } } - window.parent.jQuery('#module" . $this->item->id . "Modal').modal('hide'); + } + + if (task !== 'module.apply') + { + window.parent.jQuery('#module" . ((int) $this->item->id == 0 ? 'Add' : 'Edit' . (int) $this->item->id) . "Modal').modal('hide'); } } };"; JFactory::getDocument()->addScriptDeclaration($script); +// In case of modal +$isModal = JFactory::getApplication()->input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal ? '&tmpl=component' : ''; ?> -
+ +
'general')); ?> - +
@@ -180,7 +204,7 @@

- +

@@ -231,19 +255,19 @@ - + item->client_id == 0) : ?> - + loadTemplate('assignment'); ?> canDo->get('core.admin')) : ?> - + form->getInput('rules'); ?> diff --git a/administrator/components/com_modules/views/module/tmpl/modal.php b/administrator/components/com_modules/views/module/tmpl/modal.php index 162eaeaf80..2c38f757c2 100644 --- a/administrator/components/com_modules/views/module/tmpl/modal.php +++ b/administrator/components/com_modules/views/module/tmpl/modal.php @@ -9,18 +9,13 @@ defined('_JEXEC') or die; -// This code is needed for proper check out in case of modal close -JFactory::getDocument()->addScriptDeclaration(' - window.parent.jQuery(".modal").on("hidden", function () { - if (typeof window.parent.jQuery("#module' . $this->item->id . 'Modal iframe").contents().find("#closeBtn") !== "undefined") { - window.parent.jQuery("#module' . $this->item->id . 'Modal iframe").contents().find("#closeBtn").click(); - } - }); -'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); ?> + -setLayout('edit'); -echo $this->loadTemplate(); +
+ setLayout('edit'); ?> + loadTemplate(); ?> +
diff --git a/administrator/components/com_modules/views/modules/tmpl/default.php b/administrator/components/com_modules/views/modules/tmpl/default.php index 499a59f6df..065a581e57 100644 --- a/administrator/components/com_modules/views/modules/tmpl/default.php +++ b/administrator/components/com_modules/views/modules/tmpl/default.php @@ -13,16 +13,17 @@ JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); +$clientId = (int) $this->state->get('client_id', 0); $user = JFactory::getUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$trashed = $this->state->get('filter.state') == -2 ? true : false; $saveOrder = ($listOrder == 'a.ordering'); if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_modules&task=modules.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'moduleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } +$colSpan = $clientId === 1 ? 9 : 10; ?> sidebar)) : ?> @@ -63,9 +64,11 @@
+ + @@ -79,7 +82,7 @@ - @@ -122,12 +125,20 @@ enabled > 0) : ?> published, $i, 'modules.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - - - - - - escape($item->title)); ?> + published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'modules'); + } + if ($canCreate || $canChange) + { + echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); + } + ?> @@ -140,7 +151,7 @@ editor, $item->checked_out_time, 'modules.', $canCheckin); ?> - + escape($item->title); ?>escape($item->title); ?> @@ -167,10 +178,11 @@ + - + diff --git a/administrator/components/com_modules/views/modules/tmpl/modal.php b/administrator/components/com_modules/views/modules/tmpl/modal.php index 36e8c81578..6027d68184 100644 --- a/administrator/components/com_modules/views/modules/tmpl/modal.php +++ b/administrator/components/com_modules/views/modules/tmpl/modal.php @@ -15,9 +15,13 @@ } JHtml::_('behavior.core'); -JHtml::_('bootstrap.tooltip'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('formbehavior.chosen', 'select'); +// Special case for the search field tooltip. +$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); +JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); + $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $editor = JFactory::getApplication()->input->get('editor', '', 'cmd'); @@ -36,8 +40,9 @@ window.parent.jModalClose(); };'); ?> - -
+
+ +
@@ -152,5 +157,5 @@ -
- + +
diff --git a/administrator/components/com_modules/views/modules/view.html.php b/administrator/components/com_modules/views/modules/view.html.php index 4a79311c8e..4881bdd0f5 100644 --- a/administrator/components/com_modules/views/modules/view.html.php +++ b/administrator/components/com_modules/views/modules/view.html.php @@ -27,7 +27,7 @@ class ModulesViewModules extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ @@ -151,6 +151,11 @@ protected function addToolbar() } JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER'); + + if (JHtmlSidebar::getEntries()) + { + $this->sidebar = JHtmlSidebar::render(); + } } /** diff --git a/administrator/components/com_modules/views/positions/tmpl/modal.php b/administrator/components/com_modules/views/positions/tmpl/modal.php index e0b013860b..d1cc5b633a 100644 --- a/administrator/components/com_modules/views/positions/tmpl/modal.php +++ b/administrator/components/com_modules/views/positions/tmpl/modal.php @@ -17,7 +17,7 @@ $lang = JFactory::getLanguage(); $ordering = $this->escape($this->state->get('list.ordering')); $direction = $this->escape($this->state->get('list.direction')); -$clientId = $this->state->get('filter.client_id'); +$clientId = $this->state->get('client_id'); $state = $this->state->get('filter.state'); $template = $this->state->get('filter.template'); $type = $this->state->get('filter.type'); diff --git a/administrator/components/com_newsfeeds/config.xml b/administrator/components/com_newsfeeds/config.xml index 1378535a31..3091aff7bc 100644 --- a/administrator/components/com_newsfeeds/config.xml +++ b/administrator/components/com_newsfeeds/config.xml @@ -1,13 +1,15 @@ -
+ description="COM_NEWSFEEDS_FIELD_CONFIG_NEWSFEED_SETTINGS_DESC" + > @@ -30,64 +32,69 @@ + description="COM_NEWSFEEDS_FIELD_SHOW_FEED_IMAGE_DESC" + id="show_feed_image" + default="1" + class="btn-group btn-group-yesno" + > + description="COM_NEWSFEEDS_FIELD_SHOW_FEED_DESCRIPTION_DESC" + id="show_feed_description" + default="1" + class="btn-group btn-group-yesno" + > + description="COM_NEWSFEEDS_FIELD_SHOW_ITEM_DESCRIPTION_DESC" + id="show_item_description" + default="1" + class="btn-group btn-group-yesno" + > + description="COM_NEWSFEEDS_FIELD_CHARACTER_COUNT_DESC" + id="feed_character_count" + default="0" + size="6" + /> + id="feed_display_order" + > @@ -96,42 +103,47 @@ name="float_first" type="list" label="COM_NEWSFEEDS_FLOAT_LABEL" - description="COM_NEWSFEEDS_FLOAT_DESC"> - - - + description="COM_NEWSFEEDS_FLOAT_DESC" + > + + + + - - - + description="COM_NEWSFEEDS_FLOAT_DESC" + > + + + + description="COM_NEWSFEEDS_FIELD_SHOW_TAGS_DESC" + id="show_tags" + default="1" + class="btn-group btn-group-yesno" + > -
+ description="COM_NEWSFEEDS_FIELD_CONFIG_CATEGORY_SETTINGS_DESC" + > - + class="btn-group btn-group-yesno" + > + description="JGLOBAL_SHOW_CATEGORY_DESCRIPTION_DESC" + id="show_description" + default="1" + class="btn-group btn-group-yesno" + > @@ -164,20 +179,22 @@ - - - + default="1" + class="btn-group btn-group-yesno" + > + + + - + > @@ -187,184 +204,207 @@ - + class="btn-group btn-group-yesno" + showon="maxLevel:-1,1,2,3,4,5" + > - + default="1" + class="btn-group btn-group-yesno" + showon="maxLevel:-1,1,2,3,4,5" + > + id="show_cat_items" + default="1" + class="btn-group btn-group-yesno" + > - + class="btn-group btn-group-yesno" + > -
-
+ description="COM_NEWSFEEDS_CATEGORIES_DESC" + > - + default="1" + class="btn-group btn-group-yesno" + > - + description="JGLOBAL_MAXIMUM_CATEGORY_LEVELS_DESC" + default="-1" + > + - - + default="0" + class="btn-group btn-group-yesno" + showon="maxLevelcat:-1,1,2,3,4,5" + > - + description="JGLOBAL_SHOW_SUBCATEGORIES_DESCRIPTION_DESC" + default="1" + class="btn-group btn-group-yesno" + showon="maxLevelcat:-1,1,2,3,4,5" + > - + description="COM_NEWSFEEDS_FIELD_SHOW_CAT_ITEMS_DESC" + default="1" + class="btn-group btn-group-yesno" + > -
+ description="COM_NEWSFEEDS_FIELD_CONFIG_LIST_SETTINGS_DESC" + > - - + + + default="1" + class="btn-group btn-group-yesno" + > + id="show_headings" + default="1" + class="btn-group btn-group-yesno" + > + id="show_articles" + default="1" + class="btn-group btn-group-yesno" + > + id="show_link" + default="1" + class="btn-group btn-group-yesno" + > - + default="2" + > @@ -373,15 +413,15 @@ + default="1" + class="btn-group btn-group-yesno" + showon="show_pagination:1,2" + > -
+ section="component" + />
diff --git a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php index 388eae05cb..06d4e80333 100644 --- a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php @@ -19,7 +19,7 @@ class JFormFieldModal_Newsfeed extends JFormField /** * The form field type. * - * @var string + * @var string * @since 1.6 */ protected $type = 'Modal_Newsfeed'; @@ -27,7 +27,7 @@ class JFormFieldModal_Newsfeed extends JFormField /** * Method to get the field input markup. * - * @return string The field input markup. + * @return string The field input markup. * * @since 1.6 */ @@ -39,8 +39,8 @@ protected function getInput() // Load language JFactory::getLanguage()->load('com_newsfeeds', JPATH_ADMINISTRATOR); - // Load the javascript - JHtml::_('bootstrap.tooltip'); + // The active newsfeed id field. + $value = (int) $this->value > 0 ? (int) $this->value : ''; // Build the script. $script = array(); @@ -52,7 +52,11 @@ protected function getInput() if ($allowEdit) { - $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' if (id == "' . (int) $this->value . '") {'; + $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");'; + $script[] = ' } else {'; + $script[] = ' jQuery("#' . $this->id . '_edit").addClass("hidden");'; + $script[] = ' }'; } if ($allowClear) @@ -60,7 +64,7 @@ protected function getInput() $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");'; } - $script[] = ' jQuery("#modalNewsfeed' . $this->id . '").modal("hide");'; + $script[] = ' jQuery("#newsfeedSelect' . $this->id . 'Modal").modal("hide");'; if ($this->required) { @@ -70,6 +74,11 @@ protected function getInput() $script[] = ' }'; + // Edit button script + $script[] = ' function jEditNewsfeed_' . $value . '(name) {'; + $script[] = ' document.getElementById("' . $this->id . '_name").value = name;'; + $script[] = ' }'; + // Clear button script static $scriptClear; @@ -79,8 +88,8 @@ protected function getInput() $script[] = ' function jClearNewsfeed(id) {'; $script[] = ' document.getElementById(id + "_id").value = "";'; - $script[] = ' document.getElementById(id + "_name").value = "' . - htmlspecialchars(JText::_('COM_NEWSFEEDS_SELECT_A_FEED', true), ENT_COMPAT, 'UTF-8') . '";'; + $script[] = ' document.getElementById(id + "_name").value = "' + . htmlspecialchars(JText::_('COM_NEWSFEEDS_SELECT_A_FEED', true), ENT_COMPAT, 'UTF-8') . '";'; $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");'; $script[] = ' if (document.getElementById(id + "_edit")) {'; $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");'; @@ -94,21 +103,30 @@ protected function getInput() // Setup variables for display. $html = array(); - $link = 'index.php?option=com_newsfeeds&view=newsfeeds&layout=modal&tmpl=component&function=jSelectNewsfeed_' . $this->id; + + $linkNewsfeeds = 'index.php?option=com_newsfeeds&view=newsfeeds&layout=modal&tmpl=component' + . '&function=jSelectNewsfeed_' . $this->id; + + $linkNewsfeed = 'index.php?option=com_newsfeeds&view=newsfeed&layout=modal&tmpl=component' + . '&task=newsfeed.edit' + . '&function=jEditNewsfeed_' . $value; if (isset($this->element['language'])) { - $link .= '&forcedLanguage=' . $this->element['language']; + $linkNewsfeeds .= '&forcedLanguage=' . $this->element['language']; + $linkNewsfeed .= '&forcedLanguage=' . $this->element['language']; } - // Get the title of the linked chart - if ((int) $this->value > 0) + $urlSelect = $linkNewsfeeds . '&' . JSession::getFormToken() . '=1'; + $urlEdit = $linkNewsfeed . '&id=' . $value . '&' . JSession::getFormToken() . '=1'; + + if ($value) { - $db = JFactory::getDbo(); + $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('name')) ->from($db->quoteName('#__newsfeeds')) - ->where($db->quoteName('id') . ' = ' . (int) $this->value); + ->where($db->quoteName('id') . ' = ' . (int) $value); $db->setQuery($query); try @@ -125,66 +143,94 @@ protected function getInput() { $title = JText::_('COM_NEWSFEEDS_SELECT_A_FEED'); } - $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); - // The active newsfeed id field. - if (0 == (int) $this->value) - { - $value = ''; - } - else - { - $value = (int) $this->value; - } + $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The current newsfeed display field. $html[] = ''; - $html[] = ''; - - $html[] = 'id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />'; + + // Select newsfeed button + $html[] = '' . ' ' . JText::_('JSELECT') . ''; - $html[] = JHtml::_( - 'bootstrap.renderModal', - 'modalNewsfeed' . $this->id, - array( - 'url' => $link . '&' . JSession::getFormToken() . '=1"', - 'title' => JText::_('COM_NEWSFEEDS_CHANGE_FEED_BUTTON'), - 'width' => '800px', - 'height' => '300px', - 'footer' => '' - ) - ); - // Edit newsfeed button if ($allowEdit) { - $html[] = '' . JText::_('JACTION_EDIT') . ''; + $html[] = '' + . ' ' . JText::_('JACTION_EDIT') + . ''; } // Clear newsfeed button if ($allowClear) { - $html[] = ''; + $html[] = '' + . '' . JText::_('JCLEAR') + . ''; } $html[] = ''; - // Add class='required' for client side validation - $class = ''; + // Select newsfeed modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'newsfeedSelect' . $this->id . 'Modal', + array( + 'title' => JText::_('COM_NEWSFEEDS_SELECT_A_FEED'), + 'url' => $urlSelect, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '', + ) + ); - if ($this->required) - { - $class = ' class="required modal-value"'; - } + // Edit newsfeed modal + $html[] = JHtml::_( + 'bootstrap.renderModal', + 'newsfeedEdit' . $value . 'Modal', + array( + 'title' => JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $urlEdit, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', + ) + ); + + // Add class='required' for client side validation + $class = $this->required ? ' class="required modal-value"' : ''; $html[] = ''; diff --git a/administrator/components/com_newsfeeds/models/forms/filter_newsfeeds.xml b/administrator/components/com_newsfeeds/models/forms/filter_newsfeeds.xml index b3ecf2708a..60f597b38c 100644 --- a/administrator/components/com_newsfeeds/models/forms/filter_newsfeeds.xml +++ b/administrator/components/com_newsfeeds/models/forms/filter_newsfeeds.xml @@ -1,12 +1,16 @@
+ + + + + + JOPTION_SELECT_LANGUAGE + + + + + + + COM_NEWSFEEDS_NUM_ARTICLES_HEADING_DESC - - + + + diff --git a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml index 01ded71875..a712d04783 100644 --- a/administrator/components/com_newsfeeds/models/forms/newsfeed.xml +++ b/administrator/components/com_newsfeeds/models/forms/newsfeed.xml @@ -1,258 +1,433 @@ +
- - + + + required="true" + /> - - - - - - - + /> + + + + + + - - + allowAdd="true" + default="" + /> - + > - - + /> - - + /> - + size="60" + required="true" + filter="url" + /> - + default="5" + size="2" + required="true" + /> - + default="3600" + size="4" + required="true" + /> - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - -
- - + size="6" + readonly="true" + filter="unset" + /> + + + + + + + + + + + + + + + +
+ + + + - - - - + + - - + + + + + + + + - - - -
-
+
+ + + + +
+
- + default="5" + size="2" + required="true" + /> - + default="3600" + size="4" + required="true" + /> - - - - + default="0" + > + + + + - + > - + > - + > - + + + /> - + > @@ -278,13 +455,15 @@ +
- + @@ -292,18 +471,27 @@ - +
- - + filter="unset" + />
diff --git a/administrator/components/com_newsfeeds/models/newsfeed.php b/administrator/components/com_newsfeeds/models/newsfeed.php index 73ab821ad5..728a90dfe9 100644 --- a/administrator/components/com_newsfeeds/models/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/newsfeed.php @@ -302,6 +302,31 @@ public function save($data) { $input = JFactory::getApplication()->input; + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_newsfeeds'); + } + + // Save New Category + if ($catid == 0) + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = 'com_newsfeeds'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + // Alter the name for save as copy if ($input->get('task') == 'save2copy') { @@ -393,11 +418,11 @@ protected function prepareTable($table) $user = JFactory::getUser(); $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); - $table->alias = JApplicationHelper::stringURLSafe($table->alias); + $table->alias = JApplicationHelper::stringURLSafe($table->alias, $table->language); if (empty($table->alias)) { - $table->alias = JApplicationHelper::stringURLSafe($table->name); + $table->alias = JApplicationHelper::stringURLSafe($table->name, $table->language); } if (empty($table->id)) diff --git a/administrator/components/com_newsfeeds/models/newsfeeds.php b/administrator/components/com_newsfeeds/models/newsfeeds.php index 9b5cb87e45..fb5ca49e8e 100644 --- a/administrator/components/com_newsfeeds/models/newsfeeds.php +++ b/administrator/components/com_newsfeeds/models/newsfeeds.php @@ -45,6 +45,7 @@ public function __construct($config = array()) 'cache_time', 'a.cache_time', 'numarticles', 'tag', + 'level', 'c.level', ); $assoc = JLanguageAssociations::isEnabled(); @@ -94,6 +95,7 @@ protected function populateState($ordering = 'a.name', $direction = 'asc') $this->setState('filter.access', $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', '', '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', null, 'int')); // Load the parameters. $params = JComponentHelper::getParams('com_newsfeeds'); @@ -129,6 +131,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.language'); $id .= ':' . $this->getState('filter.tag'); + $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } @@ -155,30 +158,30 @@ protected function getListQuery() ' a.published, a.access, a.ordering, a.language, a.publish_up, a.publish_down' ) ); - $query->from($db->quoteName('#__newsfeeds') . ' AS a'); + $query->from($db->quoteName('#__newsfeeds', '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'); + ->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON l.lang_code = 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'); + ->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON uc.id=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'); + ->join('LEFT', $db->quoteName('#__viewlevels', 'ag') . ' ON ag.id = 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 c.id = a.catid'); // Join over the associations. $assoc = JLanguageAssociations::isEnabled(); if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association') + $query->select('COUNT(asso2.id)>1 AS association') ->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context=' . $db->quote('com_newsfeeds.item')) ->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key') ->group('a.id, l.title, l.image, uc.name, ag.title, c.title'); @@ -187,14 +190,14 @@ protected function getListQuery() // 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. @@ -202,11 +205,11 @@ protected function getListQuery() if (is_numeric($published)) { - $query->where('a.published = ' . (int) $published); + $query->where($db->quoteName('a.published') . ' = ' . (int) $published); } elseif ($published === '') { - $query->where('(a.published IN (0, 1))'); + $query->where($db->quoteName('a.published') . ' IN (0, 1)'); } // Filter by category. @@ -214,7 +217,13 @@ protected function getListQuery() 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 @@ -224,7 +233,7 @@ protected function getListQuery() { if (stripos($search, 'id:') === 0) { - $query->where('a.id = ' . (int) substr($search, 3)); + $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } else { @@ -236,7 +245,7 @@ protected function getListQuery() // 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)); } // Filter by a single tag. @@ -253,8 +262,8 @@ protected function getListQuery() } // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering'); - $orderDirn = $this->state->get('list.direction'); + $orderCol = $this->state->get('list.ordering', 'a.name'); + $orderDirn = $this->state->get('list.direction', 'ASC'); if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { diff --git a/administrator/components/com_newsfeeds/newsfeeds.xml b/administrator/components/com_newsfeeds/newsfeeds.xml index a071a841fd..4575df016a 100644 --- a/administrator/components/com_newsfeeds/newsfeeds.xml +++ b/administrator/components/com_newsfeeds/newsfeeds.xml @@ -62,4 +62,3 @@ - diff --git a/administrator/components/com_newsfeeds/tables/newsfeed.php b/administrator/components/com_newsfeeds/tables/newsfeed.php index 4f6fea867f..a982e6a45f 100644 --- a/administrator/components/com_newsfeeds/tables/newsfeed.php +++ b/administrator/components/com_newsfeeds/tables/newsfeed.php @@ -56,7 +56,7 @@ public function check() $this->alias = $this->name; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language); if (trim(str_replace('-', '', $this->alias)) == '') { diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php index be8755566f..59ac6d0916 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/edit.php @@ -9,38 +9,49 @@ defined('_JEXEC') or die; -// Include the HTML helpers. +// Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 )); -$app = JFactory::getApplication(); +$app = JFactory::getApplication(); $input = $app->input; + $assoc = JLanguageAssociations::isEnabled(); -JFactory::getDocument()->addScriptDeclaration(" +JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { - if (task == 'newsfeed.cancel' || document.formvalidator.isValid(document.getElementById('newsfeed-form'))) { - Joomla.submitform(task, document.getElementById('newsfeed-form')); + if (task == "newsfeed.cancel" || document.formvalidator.isValid(document.getElementById("newsfeed-form"))) { + Joomla.submitform(task, document.getElementById("newsfeed-form")); + + if (task !== "newsfeed.apply") + { + window.parent.jQuery("#newsfeedEdit' . $this->item->id . 'Modal").modal("hide"); + } } }; -"); +'); // Fieldsets to not automatically render by /layouts/joomla/edit/params.php $this->ignore_fieldsets = array('images', 'jbasic', 'jmetadata', 'item_associations'); +// In case of modal +$isModal = $input->get('layout') == 'modal' ? true : false; +$layout = $isModal ? 'modal' : 'edit'; +$tmpl = $isModal ? '&tmpl=component' : ''; ?> -
+ +
'details')); ?> - item->id) ? JText::_('COM_NEWSFEEDS_NEW_NEWSFEED', true) : JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED', true)); ?> + item->id) ? JText::_('COM_NEWSFEEDS_NEW_NEWSFEED') : JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED')); ?>
@@ -54,7 +65,7 @@
- +
form->getControlGroup('images'); ?> @@ -65,7 +76,7 @@
- +
@@ -76,18 +87,18 @@
- - + loadTemplate('display'); ?> - - - + + loadTemplate('associations'); ?> + + diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/modal.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/modal.php index 5760f03748..f709c15db2 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/modal.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/modal.php @@ -9,100 +9,24 @@ defined('_JEXEC') or die; -// Include the HTML helpers. -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); -JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.keepalive'); -JHtml::_('formbehavior.chosen', 'select'); +$function = JFactory::getApplication()->input->getCmd('function', 'jEditNewsfeed_' . (int) $this->item->id); -$app = JFactory::getApplication(); -$input = $app->input; -$assoc = JLanguageAssociations::isEnabled(); - -JFactory::getDocument()->addScriptDeclaration(" - Joomla.submitbutton = function(task) - { - if (task == 'newsfeed.cancel' || document.formvalidator.isValid(document.getElementById('newsfeed-form'))) - { - if (window.opener && (task == 'newsfeed.save' || task == 'newsfeed.cancel')) - { - window.opener.document.closeEditWindow = self; - window.opener.setTimeout('window.document.closeEditWindow.close()', 1000); - } - - Joomla.submitform(task, document.getElementById('newsfeed-form')); +// Function to update input title when changed +JFactory::getDocument()->addScriptDeclaration(' + function jEditNewsfeedModal() { + if (window.parent && document.formvalidator.isValid(document.getElementById("newsfeed-form"))) { + return window.parent.' . $this->escape($function) . '(document.getElementById("jform_name").value); } - }; -"); - -$this->ignore_fieldsets = array('jbasic', 'item_associations'); + } +'); ?> -
+ + + -
- - - +
+ setLayout('edit'); ?> + loadTemplate(); ?>
- -
-
- - - - -
- 'details')); ?> - - item->id) ? JText::_('COM_NEWSFEEDS_NEW_NEWSFEED', true) : JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED', true)); ?> -
-
-
- form->getControlGroup('link'); ?> - form->getControlGroup('description'); ?> -
-
-
- -
-
- - - -
-
- form->getControlGroup('images'); ?> - form->getGroup('images') as $field) : ?> - getControlGroup(); ?> - -
-
- - - -
-
- -
-
- -
-
- - - - loadTemplate('display'); ?> - - - - - - - - - -
- - - diff --git a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php index a7346b64f1..9e94b7e558 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php @@ -45,7 +45,7 @@ class NewsfeedsViewNewsfeed extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php index 22ee135928..959d6ba920 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php @@ -21,8 +21,6 @@ $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$archived = $this->state->get('filter.published') == 2 ? true : false; -$trashed = $this->state->get('filter.published') == -2 ? true : false; $canOrder = $user->authorise('core.edit.state', 'com_newsfeeds.category'); $saveOrder = $listOrder == 'a.ordering'; $assoc = JLanguageAssociations::isEnabled(); @@ -52,10 +50,10 @@
- - + + + + @@ -68,6 +77,9 @@ + +
- + + - - - - - - - id); ?> - |—', $item->level - 1) ?> + $item->level)); ?> + checked_out) : ?> editor, $item->checked_out_time, 'items.', $canCheckin); ?> @@ -181,12 +196,15 @@ escape($item->note));?> -
- —', $item->level - 1) ?> - +
+ + escape($item->item_type); ?>
+ escape($item->menutype); ?> + type == 'component') : ?> language == '*' || $item->home == '0') : ?> diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_body.php b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php index d049812194..5e78225003 100644 --- a/administrator/components/com_menus/views/items/tmpl/default_batch_body.php +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_body.php @@ -13,8 +13,9 @@ JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE')) ); $published = $this->state->get('filter.published'); +$menuType = JFactory::getApplication()->getUserState('com_menus.items.menutype'); ?> - +
@@ -36,7 +37,7 @@
@@ -45,4 +46,9 @@
-
\ No newline at end of file + + +
+

+
+ diff --git a/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php index b891924f71..0ee724dbba 100644 --- a/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php +++ b/administrator/components/com_menus/views/items/tmpl/default_batch_footer.php @@ -8,10 +8,13 @@ */ defined('_JEXEC') or die; +$menuType = JFactory::getApplication()->getUserState('com_menus.items.menutype'); ?> - \ No newline at end of file + + + diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index f13fc5ac9d..065d587cd9 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -47,6 +47,7 @@ class MenusViewItems extends JViewLegacy */ public function display($tpl = null) { + $user = JFactory::getUser(); $lang = JFactory::getLanguage(); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -236,7 +237,9 @@ public function display($tpl = null) */ protected function addToolbar() { - $canDo = JHelperContent::getActions('com_menus'); + $menutypeId = (int) $this->state->get('menutypeid'); + + $canDo = JHelperContent::getActions('com_menus', 'menu', (int) $menutypeId); $user = JFactory::getUser(); // Get the menu title @@ -245,7 +248,14 @@ protected function addToolbar() // Get the toolbar object instance $bar = JToolbar::getInstance('toolbar'); - JToolbarHelper::title(JText::sprintf('COM_MENUS_VIEW_ITEMS_MENU_TITLE', $menuTypeTitle), 'list menumgr'); + if ($menuTypeTitle) + { + JToolbarHelper::title(JText::sprintf('COM_MENUS_VIEW_ITEMS_MENU_TITLE', $menuTypeTitle), 'list menumgr'); + } + else + { + JToolbarHelper::title(JText::_('COM_MENUS_VIEW_ITEMS_ALL_TITLE'), 'list menumgr'); + } if ($canDo->get('core.create')) { diff --git a/administrator/components/com_menus/views/menu/tmpl/edit.php b/administrator/components/com_menus/views/menu/tmpl/edit.php index 5d9d391ebf..8c2993f3a1 100644 --- a/administrator/components/com_menus/views/menu/tmpl/edit.php +++ b/administrator/components/com_menus/views/menu/tmpl/edit.php @@ -29,9 +29,12 @@ }; "); ?> - -
- + + +
+ 'details')); ?> + +
form->getLabel('title'); ?> @@ -56,7 +59,18 @@ form->getInput('description'); ?>
-
- - + + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + + + + + + diff --git a/administrator/components/com_menus/views/menu/view.html.php b/administrator/components/com_menus/views/menu/view.html.php index d51925a3e9..f4dbeba7e3 100644 --- a/administrator/components/com_menus/views/menu/view.html.php +++ b/administrator/components/com_menus/views/menu/view.html.php @@ -31,6 +31,12 @@ class MenusViewMenu extends JViewLegacy */ protected $state; + /** + * + * @var JObject + */ + protected $canDo; + /** * Display the view * @@ -46,6 +52,8 @@ public function display($tpl = null) $this->item = $this->get('Item'); $this->state = $this->get('State'); + $this->canDo = JHelperContent::getActions('com_menus', 'menu', $this->item->id); + // Check for errors. if (count($errors = $this->get('Errors'))) { @@ -71,14 +79,13 @@ protected function addToolbar() $input->set('hidemainmenu', true); $isNew = ($this->item->id == 0); - $canDo = JHelperContent::getActions('com_menus'); JToolbarHelper::title(JText::_($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'list menu'); // If a new item, can save the item. Allow users with edit permissions to apply changes to prevent returning to grid. - if ($isNew && $canDo->get('core.create')) + if ($isNew && $this->canDo->get('core.create')) { - if ($canDo->get('core.edit')) + if ($this->canDo->get('core.edit')) { JToolbarHelper::apply('menu.apply'); } @@ -87,14 +94,14 @@ protected function addToolbar() } // If user can edit, can save the item. - if (!$isNew && $canDo->get('core.edit')) + if (!$isNew && $this->canDo->get('core.edit')) { JToolbarHelper::apply('menu.apply'); JToolbarHelper::save('menu.save'); } // If the user can create new items, allow them to see Save & New - if ($canDo->get('core.create')) + if ($this->canDo->get('core.create')) { JToolbarHelper::save2new('menu.save2new'); } diff --git a/administrator/components/com_menus/views/menus/tmpl/default.php b/administrator/components/com_menus/views/menus/tmpl/default.php index 1869404c99..189e54f126 100644 --- a/administrator/components/com_menus/views/menus/tmpl/default.php +++ b/administrator/components/com_menus/views/menus/tmpl/default.php @@ -85,7 +85,7 @@ -
+
id); ?> + escape($item->title); ?> + + escape($item->title); ?> +
: @@ -121,16 +124,31 @@
- - count_published; ?> + + + count_published; ?> + + + count_published; ?> + - - count_unpublished; ?> + + + count_unpublished; ?> + + + count_unpublished; ?> + - - count_trashed; ?> + + + count_trashed; ?> + + + count_trashed; ?> + modules[$item->menutype])) : ?> @@ -144,7 +162,7 @@
  • id . '&return=' . $return . '&tmpl=component&layout=modal'); ?> - + escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?> escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?> @@ -158,39 +176,60 @@ id . '&return=' . $return . '&tmpl=component&layout=modal'); ?> id . 'Modal', + 'moduleEdit' . $module->id . 'Modal', array( - 'url' => $link, - 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), - 'height' => '300px', - 'width' => '800px', - 'footer' => '' - . '' + 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $link, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', ) ); ?> - menutype); ?> - + menutype . '&tmpl=component&layout=modal'); ?> + $link, - 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'), - 'height' => '500px', - 'width' => '800px', - 'footer' => '' + 'title' => JText::_('COM_MENUS_ADD_MENU_MODULE'), + 'backdrop' => 'static', + 'keyboard' => false, + 'closeButton' => false, + 'url' => $link, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'footer' => '' + . '' + . '', ) ); ?>
  • + id; ?>
    + pagination->getListFooter(); ?>
    name;?> pages; ?> escape($item->access_level); ?>
    - - diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php index 1ee123de45..139db4d59c 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/modal.php @@ -14,111 +14,121 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.core'); -JHtml::_('bootstrap.tooltip'); +JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('formbehavior.chosen', 'select'); +// Special case for the search field tooltip. +$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); +JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); + $app = JFactory::getApplication(); $function = $app->input->getCmd('function', 'jSelectNewsfeed'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
    - - $this)); ?> - items)) : ?> -
    - -
    - -
    + + @@ -127,16 +125,13 @@
    published, $i, 'newsfeeds.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> - escape($item->name)); + published === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'newsfeeds'); + JHtml::_('actionsdropdown.' . ((int) $item->published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'newsfeeds'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); + } ?>
    - - - - - - - - - - - - - - - - 'icon-trash', - 0 => 'icon-unpublish', - 1 => 'icon-publish', - 2 => 'icon-archive', - ); - ?> - items as $i => $item) : ?> - language && JLanguageMultilang::isEnabled()) - { - $tag = strlen($item->language); - if ($tag == 5) +
    + + + + $this)); ?> + + items)) : ?> +
    + +
    + +
    - - - - - - - - - -
    - pagination->getListFooter(); ?> -
    + + + + + + + + + + + + + + + + 'icon-trash', + 0 => 'icon-unpublish', + 1 => 'icon-publish', + 2 => 'icon-archive', + ); + ?> + items as $i => $item) : ?> + language && JLanguageMultilang::isEnabled()) { - $lang = substr($item->language, 0, 2); + $tag = strlen($item->language); + if ($tag == 5) + { + $lang = substr($item->language, 0, 2); + } + elseif ($tag == 6) + { + $lang = substr($item->language, 0, 3); + } + else { + $lang = ""; + } } - elseif ($tag == 6) + elseif (!JLanguageMultilang::isEnabled()) { - $lang = substr($item->language, 0, 3); - } - else { $lang = ""; } - } - elseif (!JLanguageMultilang::isEnabled()) - { - $lang = ""; - } - ?> - - - - - - - - - -
    + + + + + + + + + +
    + pagination->getListFooter(); ?> +
    - - - - escape($item->name); ?> -
    - escape($item->category_title); ?> -
    -
    - escape($item->access_level); ?> - - language == '*'):?> - - - 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'); ?> - - - id; ?> -
    - - - - - - + ?> + + + + + + + escape($item->name); ?> +
    + escape($item->category_title); ?> +
    + + + escape($item->access_level); ?> + + + language == '*'):?> + + + 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'); ?> + + + + id; ?> + + + + + + + + + + + + + +
    diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php index 203c4dcef1..8cf3e3bbe1 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php @@ -45,7 +45,7 @@ class NewsfeedsViewNewsfeeds extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_plugins/models/forms/filter_plugins.xml b/administrator/components/com_plugins/models/forms/filter_plugins.xml index 7e984eb4bd..9c92446eb0 100644 --- a/administrator/components/com_plugins/models/forms/filter_plugins.xml +++ b/administrator/components/com_plugins/models/forms/filter_plugins.xml @@ -6,7 +6,7 @@ diff --git a/administrator/components/com_plugins/models/plugin.php b/administrator/components/com_plugins/models/plugin.php index e1d76df586..8acc1e79d3 100644 --- a/administrator/components/com_plugins/models/plugin.php +++ b/administrator/components/com_plugins/models/plugin.php @@ -81,6 +81,9 @@ public function getForm($data = array(), $loadData = true) $element = JArrayHelper::getValue($data, 'element', '', 'cmd'); } + // Add the default fields directory + JForm::addFieldPath(JPATH_PLUGINS . '/' . $folder . '/' . $element . '/field'); + // These variables are used to add data from the plugin XML files. $this->setState('item.folder', $folder); $this->setState('item.element', $element); diff --git a/administrator/components/com_plugins/views/plugin/tmpl/edit.php b/administrator/components/com_plugins/views/plugin/tmpl/edit.php index f74ca0bb6d..1c530004a4 100644 --- a/administrator/components/com_plugins/views/plugin/tmpl/edit.php +++ b/administrator/components/com_plugins/views/plugin/tmpl/edit.php @@ -30,7 +30,7 @@ 'general')); ?> - +
    @@ -75,7 +75,7 @@

    - +

    @@ -125,7 +125,7 @@ - + diff --git a/administrator/components/com_plugins/views/plugin/view.html.php b/administrator/components/com_plugins/views/plugin/view.html.php index 4d146d18b4..2b62ea4ada 100644 --- a/administrator/components/com_plugins/views/plugin/view.html.php +++ b/administrator/components/com_plugins/views/plugin/view.html.php @@ -27,7 +27,7 @@ class PluginsViewPlugin extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_plugins/views/plugins/tmpl/default.php b/administrator/components/com_plugins/views/plugins/tmpl/default.php index f6a7c8848e..ae3c4418c9 100644 --- a/administrator/components/com_plugins/views/plugins/tmpl/default.php +++ b/administrator/components/com_plugins/views/plugins/tmpl/default.php @@ -50,10 +50,10 @@ - + - + @@ -107,7 +107,7 @@ - + extension_id); ?> diff --git a/administrator/components/com_plugins/views/plugins/view.html.php b/administrator/components/com_plugins/views/plugins/view.html.php index e1f996e926..c05dd7915f 100644 --- a/administrator/components/com_plugins/views/plugins/view.html.php +++ b/administrator/components/com_plugins/views/plugins/view.html.php @@ -27,7 +27,7 @@ class PluginsViewPlugins extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_redirect/controllers/links.php b/administrator/components/com_redirect/controllers/links.php index ae6245592b..823d8daed4 100644 --- a/administrator/components/com_redirect/controllers/links.php +++ b/administrator/components/com_redirect/controllers/links.php @@ -62,7 +62,7 @@ public function activate() * * @return void. * - * @since 3.5.2 + * @since 3.6.0 */ public function duplicateUrls() { diff --git a/administrator/components/com_redirect/helpers/redirect.php b/administrator/components/com_redirect/helpers/redirect.php index 6e7297bb2b..624f14aa36 100644 --- a/administrator/components/com_redirect/helpers/redirect.php +++ b/administrator/components/com_redirect/helpers/redirect.php @@ -84,7 +84,7 @@ public static function isEnabled() $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('enabled')) - ->from('#__extensions') + ->from($db->quoteName('#__extensions')) ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) ->where($db->quoteName('element') . ' = ' . $db->quote('redirect')); $db->setQuery($query); @@ -101,6 +101,35 @@ public static function isEnabled() return $result; } + /** + * Gets the redirect system plugin extension id. + * + * @return int The redirect system plugin extension id. + * + * @since 3.6.0 + */ + public static function getRedirectPluginId() + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('extension_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) + ->where($db->quoteName('element') . ' = ' . $db->quote('redirect')); + $db->setQuery($query); + + try + { + $result = (int) $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + + return $result; + } + /** * Checks whether the option "Collect URLs" is enabled for the output message * diff --git a/administrator/components/com_redirect/models/forms/filter_links.xml b/administrator/components/com_redirect/models/forms/filter_links.xml index eb4a006222..a54890a890 100644 --- a/administrator/components/com_redirect/models/forms/filter_links.xml +++ b/administrator/components/com_redirect/models/forms/filter_links.xml @@ -4,8 +4,8 @@ + + + COM_REDIRECT_HEADING_CREATED_DATE_DESC + + diff --git a/administrator/components/com_redirect/models/link.php b/administrator/components/com_redirect/models/link.php index fc82df4332..d27c141218 100644 --- a/administrator/components/com_redirect/models/link.php +++ b/administrator/components/com_redirect/models/link.php @@ -207,7 +207,7 @@ public function activate(&$pks, $url, $comment = null) * * @return boolean Returns true on success, false on failure. * - * @since 3.5.2 + * @since 3.6.0 */ public function duplicateUrls(&$pks, $url, $comment = null) { diff --git a/administrator/components/com_redirect/models/links.php b/administrator/components/com_redirect/models/links.php index 9fd85fa29a..8cc8203f72 100644 --- a/administrator/components/com_redirect/models/links.php +++ b/administrator/components/com_redirect/models/links.php @@ -36,6 +36,7 @@ public function __construct($config = array()) 'hits', 'a.hits', 'created_date', 'a.created_date', 'published', 'a.published', + 'header', 'a.header', 'http_status', ); } @@ -87,6 +88,7 @@ protected function populateState($ordering = 'a.old_url', $direction = 'asc') // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string')); + $this->setState('filter.http_status', $this->getUserStateFromRequest($this->context . '.filter.http_status', 'filter_http_status', '', 'cmd')); // Load the parameters. $params = JComponentHelper::getParams('com_redirect'); @@ -114,6 +116,7 @@ protected function getStoreId($id = '') // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); + $id .= ':' . $this->getState('filter.http_status'); return parent::getStoreId($id); } @@ -149,7 +152,13 @@ protected function getListQuery() } elseif ($state === '') { - $query->where($db->quoteName('a.published') . ' IN (0,1,2)'); + $query->where($db->quoteName('a.published') . ' IN (0,1)'); + } + + // Filter the items over the HTTP status code header. + if ($httpStatusCode = $this->getState('filter.http_status')) + { + $query->where($db->quoteName('a.header') . ' = ' . (int) $httpStatusCode); } // Filter the items over the search string if set. diff --git a/administrator/components/com_redirect/views/link/tmpl/edit.php b/administrator/components/com_redirect/views/link/tmpl/edit.php index 5b0a79b043..5e6d9e4ab0 100644 --- a/administrator/components/com_redirect/views/link/tmpl/edit.php +++ b/administrator/components/com_redirect/views/link/tmpl/edit.php @@ -31,7 +31,7 @@
    'basic')); ?> - item->id) ? JText::_('COM_REDIRECT_NEW_LINK', true) : JText::sprintf('COM_REDIRECT_EDIT_LINK', $this->item->id, array('jsSafe' => true))); ?> + item->id) ? JText::_('COM_REDIRECT_NEW_LINK') : JText::sprintf('COM_REDIRECT_EDIT_LINK', $this->item->id)); ?> form->renderField('old_url'); ?> form->renderField('new_url'); ?> form->renderField('published'); ?> diff --git a/administrator/components/com_redirect/views/links/tmpl/default.php b/administrator/components/com_redirect/views/links/tmpl/default.php index 8c17020674..1e94b7ae46 100755 --- a/administrator/components/com_redirect/views/links/tmpl/default.php +++ b/administrator/components/com_redirect/views/links/tmpl/default.php @@ -53,6 +53,9 @@ + + + @@ -60,7 +63,7 @@ - + pagination->getListFooter(); ?> @@ -68,13 +71,24 @@ items as $i => $item) : $canEdit = $user->authorise('core.edit', 'com_redirect'); + $canChange = $user->authorise('core.edit.state', 'com_redirect'); ?> id); ?> - published, $i); ?> +
    + published, $i); ?> + published === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'links'); + JHtml::_('actionsdropdown.' . ((int) $item->published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'links'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->old_url)); + } + ?> +
    @@ -96,6 +110,9 @@ hits; ?> + + header; ?> + id; ?> diff --git a/administrator/components/com_redirect/views/links/tmpl/default_batch.php b/administrator/components/com_redirect/views/links/tmpl/default_batch.php index e2812e5bd4..4b41951d3f 100644 --- a/administrator/components/com_redirect/views/links/tmpl/default_batch.php +++ b/administrator/components/com_redirect/views/links/tmpl/default_batch.php @@ -27,7 +27,7 @@
    @@ -306,6 +309,7 @@ filter="integer" label="COM_TAGS_LIST_MAX_CHARACTERS_LABEL" description="COM_TAGS_LIST_MAX_CHARACTERS_DESC" + showon="all_tags_show_tag_descripion:1" /> diff --git a/administrator/components/com_tags/models/forms/filter_tags.xml b/administrator/components/com_tags/models/forms/filter_tags.xml index a1300c2f95..96d3292c9e 100644 --- a/administrator/components/com_tags/models/forms/filter_tags.xml +++ b/administrator/components/com_tags/models/forms/filter_tags.xml @@ -4,7 +4,8 @@ where('a.id = ' . (int) substr($search, 3)); } - elseif (stripos($search, 'author:') === 0) - { - $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); - $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); - } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); diff --git a/administrator/components/com_tags/tables/tag.php b/administrator/components/com_tags/tables/tag.php index 57933449fe..85bfa970dd 100644 --- a/administrator/components/com_tags/tables/tag.php +++ b/administrator/components/com_tags/tables/tag.php @@ -96,7 +96,7 @@ public function check() $this->alias = $this->title; } - $this->alias = JApplicationHelper::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language); if (trim(str_replace('-', '', $this->alias)) == '') { @@ -242,7 +242,7 @@ public function store($updateNulls = false) } // Verify that the alias is unique - $table = JTable::getInstance('Tag', 'TagsTable'); + $table = JTable::getInstance('Tag', 'TagsTable', array('dbo' => $this->_db)); if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) { diff --git a/administrator/components/com_tags/views/tag/tmpl/edit.php b/administrator/components/com_tags/views/tag/tmpl/edit.php index 71dc264fa9..b6379950b6 100644 --- a/administrator/components/com_tags/views/tag/tmpl/edit.php +++ b/administrator/components/com_tags/views/tag/tmpl/edit.php @@ -34,7 +34,7 @@
    'details')); ?> - +
    @@ -47,7 +47,7 @@
    - +
    diff --git a/administrator/components/com_tags/views/tag/view.html.php b/administrator/components/com_tags/views/tag/view.html.php index 75169cc5c9..7cc5411f91 100644 --- a/administrator/components/com_tags/views/tag/view.html.php +++ b/administrator/components/com_tags/views/tag/view.html.php @@ -29,7 +29,7 @@ class TagsViewTag extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_tags/views/tags/tmpl/default.php b/administrator/components/com_tags/views/tags/tmpl/default.php index ea3b962369..e4164b6280 100644 --- a/administrator/components/com_tags/views/tags/tmpl/default.php +++ b/administrator/components/com_tags/views/tags/tmpl/default.php @@ -54,7 +54,7 @@ - + @@ -140,16 +140,24 @@ id); ?> - published, $i, 'tags.', $canChange);?> +
    + published, $i, 'tags.', $canChange); ?> + published === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'tags'); + JHtml::_('actionsdropdown.' . ((int) $item->published === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'tags'); + echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); + } + ?> +
    - level > 0): ?> - —', $item->level - 1) ?> - + $item->level)); ?> checked_out) : ?> editor, $item->checked_out_time, 'tags.', $canCheckin); ?> - + escape($item->title); ?> diff --git a/administrator/components/com_tags/views/tags/view.html.php b/administrator/components/com_tags/views/tags/view.html.php index 18e2990e57..f230249185 100644 --- a/administrator/components/com_tags/views/tags/view.html.php +++ b/administrator/components/com_tags/views/tags/view.html.php @@ -27,7 +27,7 @@ class TagsViewTags extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_templates/config.xml b/administrator/components/com_templates/config.xml index 152ed50e86..9e4fd325a9 100644 --- a/administrator/components/com_templates/config.xml +++ b/administrator/components/com_templates/config.xml @@ -44,7 +44,7 @@ name="source_formats" type="text" label="COM_TEMPLATES_CONFIG_SOURCE_LABEL" description="COM_TEMPLATES_CONFIG_SOURCE_DESC" - default="txt,less,ini,xml,js,php,css" + default="txt,less,ini,xml,js,php,css,sass,scss" extension="com_templates" /> diff --git a/administrator/components/com_templates/helpers/templates.php b/administrator/components/com_templates/helpers/templates.php index 737c80c6cc..498a655c10 100644 --- a/administrator/components/com_templates/helpers/templates.php +++ b/administrator/components/com_templates/helpers/templates.php @@ -83,17 +83,20 @@ public static function getTemplateOptions($clientId = '*') $db = JFactory::getDbo(); $query = $db->getQuery(true); + $query->select($db->quoteName('element', 'value')) + ->select($db->quoteName('name', 'text')) + ->select($db->quoteName('extension_id', 'e_id')) + ->from($db->quoteName('#__extensions')) + ->where($db->quoteName('type') . ' = ' . $db->quote('template')) + ->where($db->quoteName('enabled') . ' = 1') + ->order($db->quoteName('client_id') . ' ASC') + ->order($db->quoteName('name') . ' ASC'); + if ($clientId != '*') { - $query->where('client_id=' . (int) $clientId); + $query->where($db->quoteName('client_id') . ' = ' . (int) $clientId); } - $query->select('element as value, name as text, extension_id as e_id') - ->from('#__extensions') - ->where('type = ' . $db->quote('template')) - ->where('enabled = 1') - ->order('client_id') - ->order('name'); $db->setQuery($query); $options = $db->loadObjectList(); diff --git a/administrator/components/com_templates/layouts/joomla/searchtools/default.php b/administrator/components/com_templates/layouts/joomla/searchtools/default.php new file mode 100644 index 0000000000..9242feeed2 --- /dev/null +++ b/administrator/components/com_templates/layouts/joomla/searchtools/default.php @@ -0,0 +1,41 @@ +addStyleDeclaration(" + /* Fixed filter field in search bar */ + .js-stools .js-stools-client_id { + float: left; + margin-right: 10px; + min-width: 220px; + } + html[dir=rtl] .js-stools .js-stools-client_id { + float: right; + margin-left: 10px + margin-right: 0; + } + .js-stools .js-stools-container-bar .js-stools-field-filter .chzn-container { + padding: 3px 0; + } + "); + + // Client selector doesn't have to activate the filter bar. + unset($data['view']->activeFilters['client_id']); +} + +// Display the main joomla layout. +echo JLayoutHelper::render('joomla.searchtools.default', $data, null, array('component' => 'none')); diff --git a/administrator/components/com_templates/layouts/joomla/searchtools/default/bar.php b/administrator/components/com_templates/layouts/joomla/searchtools/default/bar.php new file mode 100644 index 0000000000..66d6d44f6f --- /dev/null +++ b/administrator/components/com_templates/layouts/joomla/searchtools/default/bar.php @@ -0,0 +1,26 @@ +filterForm->getField('client_id'); +?> +
    + input; ?> +
    + 'none')); diff --git a/administrator/components/com_templates/models/fields/templatename.php b/administrator/components/com_templates/models/fields/templatename.php index 28933654d5..00e7522445 100644 --- a/administrator/components/com_templates/models/fields/templatename.php +++ b/administrator/components/com_templates/models/fields/templatename.php @@ -37,10 +37,13 @@ class JFormFieldTemplateName extends JFormFieldList */ public function getOptions() { - $app = JFactory::getApplication(); - $clientId = $app->getUserStateFromRequest('com_templates.styles.filter.client_id', 'filter_client_id', '*'); + // Get the client_id filter from the user state. + $clientId = JFactory::getApplication()->getUserStateFromRequest('com_templates.styles.client_id', 'client_id', '0', 'string'); + + // Get the templates for the selected client_id. $options = TemplatesHelper::getTemplateOptions($clientId); + // Merge into the parent options. return array_merge(parent::getOptions(), $options); } } diff --git a/administrator/components/com_templates/models/forms/filter_styles.xml b/administrator/components/com_templates/models/forms/filter_styles.xml index fb69ee4683..814de39ec5 100644 --- a/administrator/components/com_templates/models/forms/filter_styles.xml +++ b/administrator/components/com_templates/models/forms/filter_styles.xml @@ -1,7 +1,14 @@
    - + + + + - + + COM_TEMPLATES_HEADING_STYLE_DESC - - diff --git a/administrator/components/com_templates/models/forms/filter_templates.xml b/administrator/components/com_templates/models/forms/filter_templates.xml index 75153f6838..ea0e71fa3e 100644 --- a/administrator/components/com_templates/models/forms/filter_templates.xml +++ b/administrator/components/com_templates/models/forms/filter_templates.xml @@ -1,7 +1,14 @@
    - + + + + - - - JGLOBAL_SORT_BY - - setState('item.client_id', $clientId); $this->setState('item.template', $template); diff --git a/administrator/components/com_templates/models/styles.php b/administrator/components/com_templates/models/styles.php index 9b6cfb3761..9d984ebf8e 100644 --- a/administrator/components/com_templates/models/styles.php +++ b/administrator/components/com_templates/models/styles.php @@ -31,9 +31,9 @@ public function __construct($config = array()) $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', - 'client_id', 'a.client_id', 'template', 'a.template', 'home', 'a.home', + 'menuitem', ); } @@ -55,14 +55,14 @@ public function __construct($config = array()) protected function populateState($ordering = 'a.template', $direction = 'asc') { // Load the filter state. - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); + $this->setState('filter.template', $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template', '', 'string')); + $this->setState('filter.menuitem', $this->getUserStateFromRequest($this->context . '.filter.menuitem', 'filter_menuitem', '', 'cmd')); - $template = $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template'); - $this->setState('filter.template', $template); - - $clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', null); - $this->setState('filter.client_id', $clientId); + // Special case for the client id. + $clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int'); + $clientId = (!in_array($clientId, array (0, 1))) ? 0 : $clientId; + $this->setState('client_id', $clientId); // Load the parameters. $params = JComponentHelper::getParams('com_templates'); @@ -86,9 +86,10 @@ protected function populateState($ordering = 'a.template', $direction = 'asc') protected function getStoreId($id = '') { // Compile the store id. + $id .= ':' . $this->getState('client_id'); $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.template'); - $id .= ':' . $this->getState('filter.client_id'); + $id .= ':' . $this->getState('filter.menuitem'); return parent::getStoreId($id); } @@ -100,6 +101,8 @@ protected function getStoreId($id = '') */ protected function getListQuery() { + $clientId = (int) $this->getState('client_id'); + // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); @@ -111,44 +114,74 @@ protected function getListQuery() 'a.id, a.template, a.title, a.home, a.client_id, l.title AS language_title, l.image as image' ) ); - $query->from($db->quoteName('#__template_styles') . ' AS a'); + $query->from($db->quoteName('#__template_styles', 'a')) + ->where($db->quoteName('a.client_id') . ' = ' . $clientId); // Join on menus. $query->select('COUNT(m.template_style_id) AS assigned') - ->join('LEFT', '#__menu AS m ON m.template_style_id = a.id') + ->join('LEFT', $db->quoteName('#__menu', 'm') . ' ON ' . $db->quoteName('m.template_style_id') . ' = ' . $db->quoteName('a.id')) ->group('a.id, a.template, a.title, a.home, a.client_id, l.title, l.image, e.extension_id'); - // Join over the language - $query->join('LEFT', '#__languages AS l ON l.lang_code = a.home'); + // Join over the language. + $query->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON ' . $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.home')); - // Filter by extension enabled - $query->select('extension_id AS e_id') - ->join('LEFT', '#__extensions AS e ON e.element = a.template AND e.client_id = a.client_id') - ->where('e.enabled = 1') - ->where('e.type=' . $db->quote('template')); + // Filter by extension enabled. + $query->select($db->quoteName('extension_id', 'e_id')) + ->join('LEFT', $db->quoteName('#__extensions', 'e') . ' ON e.element = a.template AND e.client_id = a.client_id') + ->where($db->quoteName('e.enabled') . ' = 1') + ->where($db->quoteName('e.type') . ' = ' . $db->quote('template')); // Filter by template. if ($template = $this->getState('filter.template')) { - $query->where('a.template = ' . $db->quote($template)); + $query->where($db->quoteName('a.template') . ' = ' . $db->quote($template)); } - // Filter by client. - $clientId = $this->getState('filter.client_id'); + // Filter by menuitem. + $menuItemId = $this->getState('filter.menuitem'); - if (is_numeric($clientId)) + if ($clientId === 0 && is_numeric($menuItemId)) { - $query->where('a.client_id = ' . (int) $clientId); + // If user selected the templates styles that are not assigned to any page. + if ((int) $menuItemId === -1) + { + // Only custom template styles overrides not assigned to any menu item. + $query->where($db->quoteName('a.home') . ' = ' . $db->quote(0)) + ->where($db->quoteName('m.id') . ' IS NULL'); + } + // If user selected the templates styles assigned to particular pages. + else + { + // Subquery to get the language of the selected menu item. + $menuItemLanguageSubQuery = $db->getQuery(true); + $menuItemLanguageSubQuery->select($db->quoteName('language')) + ->from($db->quoteName('#__menu')) + ->where($db->quoteName('id') . ' = ' . $menuItemId); + + // Subquery to get the language of the selected menu item. + $templateStylesMenuItemsSubQuery = $db->getQuery(true); + $templateStylesMenuItemsSubQuery->select($db->quoteName('id')) + ->from($db->quoteName('#__menu')) + ->where($db->quoteName('template_style_id') . ' = ' . $db->quoteName('a.id')); + + // Main query where clause. + $query->where('(' . + // Default template style (fallback template style to all menu items). + $db->quoteName('a.home') . ' = ' . $db->quote(1) . ' OR ' . + // Default template style for specific language (fallback template style to the selected menu item language). + $db->quoteName('a.home') . ' IN (' . $menuItemLanguageSubQuery . ') OR ' . + // Custom template styles override (only if assigned to the selected menu item). + '(' . $db->quoteName('a.home') . ' = ' . $db->quote(0) . ' AND ' . $menuItemId . ' IN (' . $templateStylesMenuItemsSubQuery . '))' . + ')'); + } } - // Filter by search in title - $search = $this->getState('filter.search'); - - if (!empty($search)) + // Filter by search in title. + if ($search = $this->getState('filter.search')) { if (stripos($search, 'id:') === 0) { - $query->where('a.id = ' . (int) substr($search, 3)); + $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } else { diff --git a/administrator/components/com_templates/models/template.php b/administrator/components/com_templates/models/template.php index 99a61f6e61..582d4f478f 100644 --- a/administrator/components/com_templates/models/template.php +++ b/administrator/components/com_templates/models/template.php @@ -125,16 +125,10 @@ public function getDirectoryTree($dir) } else { - $ext = pathinfo($dir . $value, PATHINFO_EXTENSION); - $params = JComponentHelper::getParams('com_templates'); - $imageTypes = explode(',', $params->get('image_formats')); - $sourceTypes = explode(',', $params->get('source_formats')); - $fontTypes = explode(',', $params->get('font_formats')); - $archiveTypes = explode(',', $params->get('compressed_formats')); + $ext = pathinfo($dir . $value, PATHINFO_EXTENSION); + $allowedFormat = $this->checkFormat($ext); - $types = array_merge($imageTypes, $sourceTypes, $fontTypes, $archiveTypes); - - if (in_array($ext, $types)) + if ($allowedFormat == true) { $relativePath = str_replace($this->element, '', $dir); $info = $this->getFile('/' . $relativePath, $value); @@ -524,6 +518,7 @@ public function save($data) return false; } + // Get the extension of the changed file. $explodeArray = explode('.', $fileName); $ext = end($explodeArray); @@ -858,6 +853,14 @@ public function createFile($name, $type, $location) return false; } + // Check if the format is allowed and will be showed in the backend + $check = $this->checkFormat($type); + + // Add a message if we are not allowed to show this file in the backend. + if (!$check) + { + $app->enqueueMessage(JText::sprintf('COM_TEMPLATES_WARNING_FORMAT_WILL_NOT_BE_VISIBLE', $type), 'warning'); + } return true; } @@ -1329,7 +1332,7 @@ public function getArchive() } /** - * Extract contents of a archive file. + * Extract contents of an archive file. * * @param string $file The name and location of the file * @@ -1386,4 +1389,29 @@ public function extractArchive($file) } } } + + /** + * Check if the extension is allowed and will be shown in the template manager + * + * @param string $ext The extension to check if it is allowed + * + * @return boolean true if the extension is allowed false otherwise + * + * @since 3.6.0 + */ + protected function checkFormat($ext) + { + if (!isset($this->allowedFormats)) + { + $params = JComponentHelper::getParams('com_templates'); + $imageTypes = explode(',', $params->get('image_formats')); + $sourceTypes = explode(',', $params->get('source_formats')); + $fontTypes = explode(',', $params->get('font_formats')); + $archiveTypes = explode(',', $params->get('compressed_formats')); + + $this->allowedFormats = array_merge($imageTypes, $sourceTypes, $fontTypes, $archiveTypes); + } + + return in_array($ext, $this->allowedFormats); + } } diff --git a/administrator/components/com_templates/models/templates.php b/administrator/components/com_templates/models/templates.php index d54ea32b82..2818dbf3ee 100644 --- a/administrator/components/com_templates/models/templates.php +++ b/administrator/components/com_templates/models/templates.php @@ -37,9 +37,7 @@ public function __construct($config = array()) 'checked_out_time', 'a.checked_out_time', 'state', 'a.state', 'enabled', 'a.enabled', - 'access', 'a.access', 'access_level', 'ordering', 'a.ordering', - 'client_id', 'a.client_id', ); } @@ -86,27 +84,17 @@ protected function getListQuery() 'a.extension_id, a.name, a.element, a.client_id' ) ); - $query->from($db->quoteName('#__extensions') . ' AS a'); + $query->from($db->quoteName('#__extensions', 'a')) + ->where($db->quoteName('a.client_id') . ' = ' . (int) $this->getState('client_id')) + ->where($db->quoteName('a.enabled') . ' = 1') + ->where($db->quoteName('a.type') . ' = ' . $db->quote('template')); - // Filter by extension enabled and extension type. - $query->where('a.enabled = 1')->where('a.type = ' . $db->quote('template')); - - // Filter by client. - $clientId = $this->getState('filter.client_id'); - - if (is_numeric($clientId)) - { - $query->where('a.client_id = ' . (int) $clientId); - } - - // Filter by search in title - $search = $this->getState('filter.search'); - - if (!empty($search)) + // Filter by search in title. + if ($search = $this->getState('filter.search')) { if (stripos($search, 'id:') === 0) { - $query->where('a.id = ' . (int) substr($search, 3)); + $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } else { @@ -137,8 +125,8 @@ protected function getListQuery() protected function getStoreId($id = '') { // Compile the store id. + $id .= ':' . $this->getState('client_id'); $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.client_id'); return parent::getStoreId($id); } @@ -158,11 +146,12 @@ protected function getStoreId($id = '') protected function populateState($ordering = 'a.element', $direction = 'asc') { // Load the filter state. - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); - $clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', null); - $this->setState('filter.client_id', $clientId); + // Special case for the client id. + $clientId = (int) $this->getUserStateFromRequest($this->context . '.client_id', 'client_id', 0, 'int'); + $clientId = (!in_array($clientId, array (0, 1))) ? 0 : $clientId; + $this->setState('client_id', $clientId); // Load the parameters. $params = JComponentHelper::getParams('com_templates'); diff --git a/administrator/components/com_templates/views/style/tmpl/edit.php b/administrator/components/com_templates/views/style/tmpl/edit.php index c2ac6025b8..f09d53d3d9 100644 --- a/administrator/components/com_templates/views/style/tmpl/edit.php +++ b/administrator/components/com_templates/views/style/tmpl/edit.php @@ -33,7 +33,7 @@
    'details')); ?> - +
    @@ -53,7 +53,7 @@ ?>

    - +

    @@ -80,7 +80,7 @@ - + @@ -92,7 +92,7 @@ ?> authorise('core.edit', 'com_menu') && $this->item->client_id == 0 && $this->canDo->get('core.edit.state')) : ?> - + loadTemplate('assignment'); ?> diff --git a/administrator/components/com_templates/views/style/tmpl/edit_assignment.php b/administrator/components/com_templates/views/style/tmpl/edit_assignment.php index 6fb4ee775f..c0daf57be4 100644 --- a/administrator/components/com_templates/views/style/tmpl/edit_assignment.php +++ b/administrator/components/com_templates/views/style/tmpl/edit_assignment.php @@ -12,7 +12,7 @@ // Initiasile related data. require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'; $menuTypes = MenusHelper::getMenuLinks(); -$user = JFactory::getUser(); +$user = JFactory::getUser(); ?>
    @@ -26,19 +26,21 @@
  • - -
    title ? $type->title : $type->menutype; ?>
    + +
    title ? $type->title : $type->menutype; ?>
    + + links as $link) : ?> + + - links as $link) : ?> - -
  • +
    diff --git a/administrator/components/com_templates/views/style/view.html.php b/administrator/components/com_templates/views/style/view.html.php index aa157a8a63..e49858eca1 100644 --- a/administrator/components/com_templates/views/style/view.html.php +++ b/administrator/components/com_templates/views/style/view.html.php @@ -42,7 +42,7 @@ class TemplatesViewStyle extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_templates/views/style/view.json.php b/administrator/components/com_templates/views/style/view.json.php index 15d93b36b0..7712d6ae6f 100644 --- a/administrator/components/com_templates/views/style/view.json.php +++ b/administrator/components/com_templates/views/style/view.json.php @@ -42,7 +42,7 @@ class TemplatesViewStyle extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ diff --git a/administrator/components/com_templates/views/styles/tmpl/default.php b/administrator/components/com_templates/views/styles/tmpl/default.php index 927b7251ed..6872368f4c 100644 --- a/administrator/components/com_templates/views/styles/tmpl/default.php +++ b/administrator/components/com_templates/views/styles/tmpl/default.php @@ -17,8 +17,10 @@ JHtml::_('formbehavior.chosen', 'select'); $user = JFactory::getUser(); +$clientId = (int) $this->state->get('client_id', 0); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); +$colSpan = $clientId === 1 ? 5 : 6; ?> sidebar)) : ?> @@ -39,32 +41,31 @@ - - - - - - - - @@ -81,7 +82,7 @@ - - - - diff --git a/administrator/components/com_templates/views/styles/view.html.php b/administrator/components/com_templates/views/styles/view.html.php index 3e4fe15e44..ed7e006ca0 100644 --- a/administrator/components/com_templates/views/styles/view.html.php +++ b/administrator/components/com_templates/views/styles/view.html.php @@ -27,7 +27,7 @@ class TemplatesViewStyles extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -65,7 +65,15 @@ protected function addToolbar() { $canDo = JHelperContent::getActions('com_templates'); - JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_STYLES'), 'eye thememanager'); + // Set the title. + if ((int) $this->get('State')->get('client_id') === 1) + { + JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_STYLES_ADMIN'), 'eye thememanager'); + } + else + { + JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_STYLES_SITE'), 'eye thememanager'); + } if ($canDo->get('core.edit.state')) { diff --git a/administrator/components/com_templates/views/template/tmpl/default.php b/administrator/components/com_templates/views/template/tmpl/default.php index 27540dedbd..4e7d98c7b7 100644 --- a/administrator/components/com_templates/views/template/tmpl/default.php +++ b/administrator/components/com_templates/views/template/tmpl/default.php @@ -167,7 +167,7 @@ function clearCoords() } ?> 'editor')); ?> - +
    type == 'file'): ?> @@ -305,7 +305,7 @@ function clearCoords()
    - +
    @@ -370,7 +370,7 @@ function clearCoords()
    - + loadTemplate('description');?> diff --git a/administrator/components/com_templates/views/template/tmpl/default_modal_file_body.php b/administrator/components/com_templates/views/template/tmpl/default_modal_file_body.php index 083243ecd9..cc5de0f5d8 100644 --- a/administrator/components/com_templates/views/template/tmpl/default_modal_file_body.php +++ b/administrator/components/com_templates/views/template/tmpl/default_modal_file_body.php @@ -26,6 +26,8 @@ + + diff --git a/administrator/components/com_templates/views/template/tmpl/readonly.php b/administrator/components/com_templates/views/template/tmpl/readonly.php index 7ac3b758e4..a7bc08e1e5 100644 --- a/administrator/components/com_templates/views/template/tmpl/readonly.php +++ b/administrator/components/com_templates/views/template/tmpl/readonly.php @@ -18,7 +18,7 @@ ?> 'description')); ?> - + loadTemplate('description');?> diff --git a/administrator/components/com_templates/views/template/view.html.php b/administrator/components/com_templates/views/template/view.html.php index 900480947c..637723aa03 100644 --- a/administrator/components/com_templates/views/template/view.html.php +++ b/administrator/components/com_templates/views/template/view.html.php @@ -91,7 +91,7 @@ class TemplatesViewTemplate extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -185,7 +185,7 @@ protected function addToolbar() // Only show file edit buttons for global SuperUser if ($isSuperUser) { - // Add a Apply and save button + // Add an Apply and save button if ($this->type == 'file') { JToolbarHelper::apply('template.apply'); diff --git a/administrator/components/com_templates/views/templates/tmpl/default.php b/administrator/components/com_templates/views/templates/tmpl/default.php index efbc6a0bb3..b52fd467a4 100644 --- a/administrator/components/com_templates/views/templates/tmpl/default.php +++ b/administrator/components/com_templates/views/templates/tmpl/default.php @@ -26,7 +26,7 @@ sidebar; ?>
    - $this)); ?> + $this, 'options' => array('filterButton' => false))); ?>
    items)) : ?>
    @@ -37,14 +37,11 @@
    - @@ -58,7 +55,7 @@ - @@ -72,20 +69,15 @@ - element, $item->client_id); ?> diff --git a/administrator/components/com_templates/views/templates/view.html.php b/administrator/components/com_templates/views/templates/view.html.php index a0725c02ee..84583f7521 100644 --- a/administrator/components/com_templates/views/templates/view.html.php +++ b/administrator/components/com_templates/views/templates/view.html.php @@ -45,7 +45,7 @@ class TemplatesViewTemplates extends JViewLegacy * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return mixed A string if successful, otherwise a Error object. + * @return mixed A string if successful, otherwise an Error object. * * @since 1.6 */ @@ -85,7 +85,15 @@ protected function addToolbar() { $canDo = JHelperContent::getActions('com_templates'); - JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES'), 'eye thememanager'); + // Set the title. + if ((int) $this->get('State')->get('client_id') === 1) + { + JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN'), 'eye thememanager'); + } + else + { + JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_TEMPLATES_SITE'), 'eye thememanager'); + } if ($canDo->get('core.admin') || $canDo->get('core.options')) { diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index ff96888a13..a2c325002d 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -17,7 +17,8 @@ type="usergrouplist" default="2" label="COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_LABEL" - description="COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_DESC"> + description="COM_USERS_CONFIG_FIELD_NEW_USER_TYPE_DESC" + showon="allowUserRegistration:1"> + description="COM_USERS_CONFIG_FIELD_FRONTEND_LANG_DESC" + showon="frontend_userparams:1" + > @@ -196,6 +199,7 @@ label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" default="5" + showon="save_history:1" /> diff --git a/administrator/components/com_users/helpers/users.php b/administrator/components/com_users/helpers/users.php index 145cf38ac1..90e76467d7 100644 --- a/administrator/components/com_users/helpers/users.php +++ b/administrator/components/com_users/helpers/users.php @@ -221,4 +221,37 @@ public static function getTwoFactorMethods() return $options; } + + /** + * Get a list of the User Groups for Viewing Access Levels + * + * @param string $rules User Groups in JSON format + * + * @return string $groups Comma separated list of User Groups + * + * @since 3.6 + */ + public static function getVisibleByGroups($rules) + { + $rules = json_decode($rules); + + if (!$rules) + { + return false; + } + + $rules = implode(',', $rules); + + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('a.title AS text') + ->from('#__usergroups as a') + ->where('a.id IN (' . $rules . ')'); + $db->setQuery($query); + + $groups = $db->loadColumn(); + $groups = implode(', ', $groups); + + return $groups; + } } diff --git a/administrator/components/com_users/models/debuggroup.php b/administrator/components/com_users/models/debuggroup.php index c6c32c343d..dd9ed7526d 100644 --- a/administrator/components/com_users/models/debuggroup.php +++ b/administrator/components/com_users/models/debuggroup.php @@ -24,7 +24,7 @@ class UsersModelDebuggroup extends JModelList * @param array $config An optional associative array of configuration settings. * * @see JController - * @since 3.5.2 + * @since 3.6.0 */ public function __construct($config = array()) { diff --git a/administrator/components/com_users/models/debuguser.php b/administrator/components/com_users/models/debuguser.php index fcaf690ea1..94e155af43 100644 --- a/administrator/components/com_users/models/debuguser.php +++ b/administrator/components/com_users/models/debuguser.php @@ -24,7 +24,7 @@ class UsersModelDebugUser extends JModelList * @param array $config An optional associative array of configuration settings. * * @see JController - * @since 3.5.2 + * @since 3.6.0 */ public function __construct($config = array()) { diff --git a/administrator/components/com_users/models/fields/components.php b/administrator/components/com_users/models/fields/components.php index 670903a933..80372bc387 100644 --- a/administrator/components/com_users/models/fields/components.php +++ b/administrator/components/com_users/models/fields/components.php @@ -14,7 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @since 3.5.2 + * @since 3.6.0 */ class JFormFieldComponents extends JFormFieldList { @@ -22,7 +22,7 @@ class JFormFieldComponents extends JFormFieldList * The form field type. * * @var string - * @since 3.5.2 + * @since 3.6.0 */ protected $type = 'Components'; @@ -31,7 +31,7 @@ class JFormFieldComponents extends JFormFieldList * * @return array The field option objects * - * @since 3.5.2 + * @since 3.6.0 */ protected function getOptions() { diff --git a/administrator/components/com_users/models/fields/levels.php b/administrator/components/com_users/models/fields/levels.php index 45f02a8bf3..a3b9a9bf10 100644 --- a/administrator/components/com_users/models/fields/levels.php +++ b/administrator/components/com_users/models/fields/levels.php @@ -14,7 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @since 3.5.2 + * @since 3.6.0 */ class JFormFieldLevels extends JFormFieldList { @@ -22,7 +22,7 @@ class JFormFieldLevels extends JFormFieldList * The form field type. * * @var string - * @since 3.5.2 + * @since 3.6.0 */ protected $type = 'Levels'; @@ -31,7 +31,7 @@ class JFormFieldLevels extends JFormFieldList * * @return array The field option objects * - * @since 3.5.2 + * @since 3.6.0 */ protected function getOptions() { diff --git a/administrator/components/com_users/models/forms/filter_notes.xml b/administrator/components/com_users/models/forms/filter_notes.xml index cc0248769c..b4895e2e1a 100644 --- a/administrator/components/com_users/models/forms/filter_notes.xml +++ b/administrator/components/com_users/models/forms/filter_notes.xml @@ -25,6 +25,19 @@ > + + + JGLOBAL_SORT_BY - - + + diff --git a/administrator/components/com_users/models/forms/filter_users.xml b/administrator/components/com_users/models/forms/filter_users.xml index f719e3be70..991e94cfbf 100644 --- a/administrator/components/com_users/models/forms/filter_users.xml +++ b/administrator/components/com_users/models/forms/filter_users.xml @@ -35,6 +35,15 @@ > + + + where('a.user_id = ' . $userId); } + // Filter on the level. + if ($level = $this->getState('filter.level')) + { + $query->where($db->quoteName('c.level') . ' <= ' . (int) $level); + } + // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.review_time')) . ' ' . $db->escape($this->getState('list.direction', 'DESC'))); @@ -156,6 +162,7 @@ protected function getStoreId($id = '') $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.category_id'); $id .= ':' . $this->getState('filter.user_id'); + $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } @@ -206,6 +213,7 @@ protected function populateState($ordering = 'a.review_time', $direction = 'desc $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')); $this->setState('filter.user_id', $this->getUserStateFromRequest($this->context . '.filter.user_id', 'filter_user_id')); + $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); parent::populateState($ordering, $direction); } diff --git a/administrator/components/com_users/models/user.php b/administrator/components/com_users/models/user.php index a94e483997..0a2f517bce 100644 --- a/administrator/components/com_users/models/user.php +++ b/administrator/components/com_users/models/user.php @@ -33,7 +33,7 @@ public function __construct($config = array()) 'event_after_save' => 'onUserAfterSave', 'event_before_delete' => 'onUserBeforeDelete', 'event_before_save' => 'onUserBeforeSave', - 'events_map' => array('save' => 'user', 'delete' => 'user') + 'events_map' => array('save' => 'user', 'delete' => 'user', 'validate' => 'user') ), $config ); @@ -205,6 +205,19 @@ public function save($data) $user = JUser::getInstance($pk); $my = JFactory::getUser(); + $iAmSuperAdmin = $my->authorise('core.admin'); + + // User cannot modify own user groups + if ((int) $user->id == (int) $my->id && !$iAmSuperAdmin) + { + if ($data['groups'] != null) + { + // Form was probably tampered with + JFactory::getApplication()->enqueueMessage(JText::_('COM_USERS_USERS_ERROR_CANNOT_EDIT_OWN_GROUP'), 'warning'); + + $data['groups'] = null; + } + } if ($data['block'] && $pk == $my->id && !$my->block) { @@ -214,8 +227,6 @@ public function save($data) } // Make sure that we are not removing ourself from Super Admin group - $iAmSuperAdmin = $my->authorise('core.admin'); - if ($iAmSuperAdmin && $my->get('id') == $pk) { // Check that at least one of our new groups is Super Admin diff --git a/administrator/components/com_users/models/users.php b/administrator/components/com_users/models/users.php index c479166258..b8ae260e1b 100644 --- a/administrator/components/com_users/models/users.php +++ b/administrator/components/com_users/models/users.php @@ -43,6 +43,7 @@ public function __construct($config = array()) 'active', 'group_id', 'range', + 'lastvisitrange', 'state', ); } @@ -78,6 +79,9 @@ protected function populateState($ordering = 'a.name', $direction = 'asc') $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); $this->setState('filter.group_id', $this->getUserStateFromRequest($this->context . '.filter.group_id', 'filter_group_id', null, 'int')); $this->setState('filter.range', $this->getUserStateFromRequest($this->context . '.filter.range', 'filter_range', '', 'cmd')); + $this->setState( + 'filter.lastvisitrange', $this->getUserStateFromRequest($this->context . '.filter.lastvisitrange', 'filter_lastvisitrange', '', 'cmd') + ); $groups = json_decode(base64_decode($app->input->get('groups', '', 'BASE64'))); @@ -368,59 +372,48 @@ protected function getListQuery() // Apply the range filter. if ($range) { - // Get UTC for now. - $dNow = new JDate; - $dStart = clone $dNow; + $dates = $this->buildDateRange($range); - switch ($range) + if ($dates['dNow'] === false) + { + $query->where( + $db->qn('a.registerDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) + ); + } + else { - case 'past_week': - $dStart->modify('-7 day'); - break; - - case 'past_1month': - $dStart->modify('-1 month'); - break; - - case 'past_3month': - $dStart->modify('-3 month'); - break; - - case 'past_6month': - $dStart->modify('-6 month'); - break; - - case 'post_year': - case 'past_year': - $dStart->modify('-1 year'); - break; - - case 'today': - // Ranges that need to align with local 'days' need special treatment. - $app = JFactory::getApplication(); - $offset = $app->get('offset'); - - // Reset the start time to be the beginning of today, local time. - $dStart = new JDate('now', $offset); - $dStart->setTime(0, 0, 0); - - // Now change the timezone back to UTC. - $tz = new DateTimeZone('GMT'); - $dStart->setTimezone($tz); - break; + $query->where( + $db->qn('a.registerDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) . + ' AND ' . $db->qn('a.registerDate') . ' <= ' . $db->quote($dates['dNow']->format('Y-m-d H:i:s')) + ); } + } + + // Add filter for registration ranges select list + $lastvisitrange = $this->getState('filter.lastvisitrange'); - if ($range == 'post_year') + // Apply the range filter. + if ($lastvisitrange) + { + $dates = $this->buildDateRange($lastvisitrange); + + if (is_string($dates['dStart'])) + { + $query->where( + $db->qn('a.lastvisitDate') . ' = ' . $db->quote($dates['dStart']) + ); + } + elseif ($dates['dNow'] === false) { $query->where( - $db->qn('a.registerDate') . ' < ' . $db->quote($dStart->format('Y-m-d H:i:s')) + $db->qn('a.lastvisitDate') . ' < ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) ); } else { $query->where( - $db->qn('a.registerDate') . ' >= ' . $db->quote($dStart->format('Y-m-d H:i:s')) . - ' AND ' . $db->qn('a.registerDate') . ' <= ' . $db->quote($dNow->format('Y-m-d H:i:s')) + $db->qn('a.lastvisitDate') . ' >= ' . $db->quote($dates['dStart']->format('Y-m-d H:i:s')) . + ' AND ' . $db->qn('a.lastvisitDate') . ' <= ' . $db->quote($dates['dNow']->format('Y-m-d H:i:s')) ); } } @@ -439,6 +432,67 @@ protected function getListQuery() return $query; } + /** + * Construct the date range to filter on. + * + * @param string $range The textual range to construct the filter for. + * + * @return string The date range to filter on. + * + * @since 3.6.0 + */ + private function buildDateRange($range) + { + // Get UTC for now. + $dNow = new JDate; + $dStart = clone $dNow; + + switch ($range) + { + case 'past_week': + $dStart->modify('-7 day'); + break; + + case 'past_1month': + $dStart->modify('-1 month'); + break; + + case 'past_3month': + $dStart->modify('-3 month'); + break; + + case 'past_6month': + $dStart->modify('-6 month'); + break; + + case 'post_year': + $dNow = false; + case 'past_year': + $dStart->modify('-1 year'); + break; + + case 'today': + // Ranges that need to align with local 'days' need special treatment. + $app = JFactory::getApplication(); + $offset = $app->get('offset'); + + // Reset the start time to be the beginning of today, local time. + $dStart = new JDate('now', $offset); + $dStart->setTime(0, 0, 0); + + // Now change the timezone back to UTC. + $tz = new DateTimeZone('GMT'); + $dStart->setTimezone($tz); + break; + case 'never': + $dNow = false; + $dStart = $this->_db->getNullDate(); + break; + } + + return array('dNow' => $dNow, 'dStart' => $dStart); + } + /** * SQL server change * diff --git a/administrator/components/com_users/views/debuggroup/tmpl/default.php b/administrator/components/com_users/views/debuggroup/tmpl/default.php index 5ee78b508a..e0620c34b4 100644 --- a/administrator/components/com_users/views/debuggroup/tmpl/default.php +++ b/administrator/components/com_users/views/debuggroup/tmpl/default.php @@ -66,8 +66,7 @@ escape($item->title); ?> actions as $action) : ?> escape($item->title); ?> actions as $action) : ?> "> - @@ -105,7 +105,7 @@ - diff --git a/administrator/components/com_users/views/levels/tmpl/default.php b/administrator/components/com_users/views/levels/tmpl/default.php index e9555b3744..5e930b933c 100644 --- a/administrator/components/com_users/views/levels/tmpl/default.php +++ b/administrator/components/com_users/views/levels/tmpl/default.php @@ -57,14 +57,17 @@ - + - @@ -108,7 +111,10 @@ escape($item->title); ?> - + diff --git a/administrator/components/com_users/views/notes/tmpl/default.php b/administrator/components/com_users/views/notes/tmpl/default.php index 46ec75742b..74069b8f16 100644 --- a/administrator/components/com_users/views/notes/tmpl/default.php +++ b/administrator/components/com_users/views/notes/tmpl/default.php @@ -14,11 +14,10 @@ JHtml::_('formbehavior.chosen', 'select'); $user = JFactory::getUser(); -$canEdit = $user->authorise('core.edit', 'com_users'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> - +sidebar)) : ?>
    sidebar; ?> @@ -40,81 +39,85 @@
    - - - - - - - - items as $i => $item) : ?> - authorise('core.edit.state', 'com_users'); ?> + items as $i => $item) : + $canEdit = $user->authorise('core.edit', 'com_users.category.' . $item->catid); + $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0; + $canChange = $user->authorise('core.edit.state', 'com_users.category.' . $item->catid) && $canCheckin; + $subject = $item->subject ? $item->subject : JText::_('COM_USERS_EMPTY_SUBJECT'); + ?> - - - - -
    +   + + - + + + - - + + +
    + pagination->getListFooter(); ?>
    preview && $item->client_id == '0') : ?> - + client_id == '1') : ?> @@ -106,24 +107,27 @@ image . '.gif', $item->language_title, array('title' => $item->language_title), true);?> - assigned > 0) : ?> - + + + home == '1') : ?> + + home != '0' && $item->home != '1') : ?> + escape($item->language_title)); ?> + assigned > 0) : ?> + escape($item->assigned)); ?> -   + - client_id == 0 ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); ?> - + + + id; ?>
    -   + - -
    + pagination->getListFooter(); ?>
    name)); ?> -

    +

    preview && $item->client_id == '0') : ?> - - + client_id == '1') : ?> - - + -

    -
    - client_id == 0 ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); ?> + escape($item->xmldata->get('version')); ?> @@ -95,16 +87,15 @@ xmldata->get('author')) : ?> -

    escape($author); ?>

    +
    escape($author); ?>
    xmldata->get('authorEmail')) : ?> -

    escape($email); ?>

    +
    escape($email); ?>
    xmldata->get('authorUrl')) : ?> -

    - escape($url); ?>

    +
    - |—', $item->level); ?> - escape($item->name); ?> + $item->level + 1)) . $this->escape($item->name); ?> - |—', $item->level); ?> - escape($item->name); ?> + $item->level + 1)) . $this->escape($item->name); ?> +
    - |—', $item->level); ?> + $item->level + 1)); ?> escape($item->title); ?> @@ -125,7 +125,7 @@ " href="id . '&filter[state]=1'); ?>"> count_disabled; ?> + id; ?>
    + + +
    + pagination->getListFooter(); ?>
    + + rules); ?> + id; ?>
    + - - + - + + + +
    + pagination->getListFooter(); ?>
    id); ?> - state, $i, 'notes.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> +
    + state, $i, 'notes.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> + state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'notes'); + JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'notes'); + echo JHtml::_('actionsdropdown.render', $this->escape($subject)); + } + ?> +
    checked_out) : ?> - editor, $item->checked_out_time); ?> + editor, $item->checked_out_time, 'notes.', $canCheckin); ?> + subject ? $this->escape($item->subject) : JText::_('COM_USERS_EMPTY_SUBJECT'); ?> - - escape($item->user_name); ?> - - escape($item->user_name); ?> - - - subject) : ?> - escape($item->subject); ?> + escape($subject); ?> - + escape($subject); ?> +
    + escape($item->category_title); ?> +
    - catid && $item->cparams->get('image')) : ?> - cparams->get('image')); ?> - - escape($item->category_title); ?> + + escape($item->user_name); ?> + review_time !== JFactory::getDbo()->getNullDate()) : ?> review_time, JText::_('DATE_FORMAT_LC4')); ?> + id; ?>
    +
    diff --git a/administrator/components/com_users/views/notes/view.html.php b/administrator/components/com_users/views/notes/view.html.php index 85683edd98..3cdfc3e18d 100644 --- a/administrator/components/com_users/views/notes/view.html.php +++ b/administrator/components/com_users/views/notes/view.html.php @@ -126,7 +126,7 @@ protected function addToolbar() JToolbarHelper::checkin('notes.checkin'); } - if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) + if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolbarHelper::divider(); diff --git a/administrator/components/com_users/views/user/tmpl/edit.php b/administrator/components/com_users/views/user/tmpl/edit.php index 68f35cd837..f0b678dbb2 100644 --- a/administrator/components/com_users/views/user/tmpl/edit.php +++ b/administrator/components/com_users/views/user/tmpl/edit.php @@ -52,7 +52,7 @@
    'details')); ?> - + form->getFieldset('user_details') as $field) : ?>
    @@ -69,41 +69,18 @@ grouplist) : ?> - + loadTemplate('groups'); ?> name == 'user_details') : - continue; - endif; + $this->ignore_fieldsets = array('user_details'); + echo JLayoutHelper::render('joomla.edit.params', $this); ?> - name, JText::_($fieldset->label, true)); ?> - form->getFieldset($fieldset->name) as $field) : ?> - hidden) : ?> -
    -
    - input; ?> -
    -
    - -
    -
    - label; ?> -
    -
    - input; ?> -
    -
    - - - - tfaform) && $this->item->id): ?> - +
    +
    +
    + canDo->get('core.admin')) : ?> +
    + item->id, array('useCookie' => 1)); ?> + + +
    + + form->getLabel('rules'); ?> + form->getInput('rules'); ?> +
    + +
    + -
    +
    diff --git a/administrator/templates/hathor/html/com_menus/menus/default.php b/administrator/templates/hathor/html/com_menus/menus/default.php index ade1d6264b..f500642b3a 100644 --- a/administrator/templates/hathor/html/com_menus/menus/default.php +++ b/administrator/templates/hathor/html/com_menus/menus/default.php @@ -99,14 +99,19 @@ $canCreate = $user->authorise('core.create', 'com_menus'); $canEdit = $user->authorise('core.edit', 'com_menus'); $canChange = $user->authorise('core.edit.state', 'com_menus'); + $canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id); ?> id); ?> - + + escape($item->title); ?> + + escape($item->title); ?> +

    ( id).' title='.$this->escape($item->description).'">'. diff --git a/administrator/templates/hathor/html/com_modules/positions/modal.php b/administrator/templates/hathor/html/com_modules/positions/modal.php index 9aad317f52..bd081d7edd 100644 --- a/administrator/templates/hathor/html/com_modules/positions/modal.php +++ b/administrator/templates/hathor/html/com_modules/positions/modal.php @@ -15,7 +15,7 @@ $lang = JFactory::getLanguage(); $ordering = $this->escape($this->state->get('list.ordering')); $direction = $this->escape($this->state->get('list.direction')); -$clientId = $this->state->get('filter.client_id'); +$clientId = $this->state->get('client_id'); $state = $this->state->get('filter.state'); $template = $this->state->get('filter.template'); $type = $this->state->get('filter.type'); diff --git a/administrator/templates/hathor/html/com_templates/styles/default.php b/administrator/templates/hathor/html/com_templates/styles/default.php index 080a533841..eb04811e8a 100644 --- a/administrator/templates/hathor/html/com_templates/styles/default.php +++ b/administrator/templates/hathor/html/com_templates/styles/default.php @@ -39,16 +39,15 @@

    + + + - - -
    -