diff --git a/.craftplugin b/.craftplugin index c5df0389..c61e5c62 100644 --- a/.craftplugin +++ b/.craftplugin @@ -1,7 +1,7 @@ { "pluginName": "Translations for Craft", "pluginDescription": "Drive global growth with simplified translation workflows.", - "pluginVersion": "2.2.2", + "pluginVersion": "3.0.0-beta.1", "pluginAuthorName": "Acclaro", "pluginVendorName": "Acclaro", "pluginAuthorUrl": "http://www.acclaro.com/", diff --git a/CHANGELOG.md b/CHANGELOG.md index 9718c139..ad58b16a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,32 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 3.0.0-beta.1 - 2022-07-12 + +### Fixed +- An issue where `New translations` button on entry index page remains active on switching entry groups. +- An issue where deleting draft from `globalsetdraft/assetdraft` detail page was removing order file. + +### Updated +- Craft minimum version from 3.7.33 to 4.0.0 +- Category draft's custom logic with craft's native code. (Craft now supports category drafts) +- Download TM files action disabled by default. + +### Added +- Support for Craft 4. +- Logging in webhook flow for api orders. + +### Removed +- Removed unsused `editDraftAssets`. +- Removed `translations_categorydrafts` table. + +### Chore +- Code refactoring and cleanup. + ## 2.2.2 - 2022-07-06 ### Fixed -- An issue where order fails to open when `previewUrl` length exceeds 255 chars. (#341) +- An issue where order fails to open when `previewUrl` length exceeds 255 chars. (#341) ### Updated - Removed the use of `filetype` param in API order sync call. @@ -56,7 +78,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed - Plugin uninstallation bug (https://github.com/AcclaroInc/craft-translations/pull/313) - + ## 2.1.3 - 2022-02-21 ### Fixed @@ -512,7 +534,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Removed - Removed `UpdateDraftFromXML` -- Truncate `translations_files` and `translations_orders` tables to be compliant with new Craft draft service +- Truncate `translations_files` and `translations_orders` tables to be compliant with new Craft draft service ## 1.1.1 - 2019-07-03 ### Added diff --git a/README.md b/README.md index 8e556e48..592b64df 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ The Translations plugin provides a simple way to translate your content from sta *Need support for a specific plugin? [Contact us](http://www.acclaro.com/translation-services-cost/?utm_campaign=Craft%20Plugin%20Store&utm_source=Craft%20Plugin%20Store%20Listing%20-%20Third%20Party%20Plugins%20Quote&utm_medium=Listing) for a quote.* ## ⚠️ System Requirements -- Craft CMS 3.7.33 or later. -- PHP 7.2+ +- Craft CMS 4.0.0 or later. +- PHP 8.0.2+ - PHP [DOM](https://docs.craftcms.com/v3/requirements.html#optional-php-extensions) Extension - Craft [Multi-site](https://craftcms.com/docs/3.x/sites.html) configuration @@ -49,7 +49,7 @@ The license fee for this plugin is $999.00 via the Craft Plugin Store. Annual li We offer a 30-day money back guarantee for the software plugin purchase if you are not satisfied. ### Terms -Prior to download, installation and use of the Translation Plugin for Craft on a public site, site owners are required to purchase the plugin from the Craft plugin store or submit payment directly to Acclaro for purchases outside of the store. +Prior to download, installation and use of the Translation Plugin for Craft on a public site, site owners are required to purchase the plugin from the Craft plugin store or submit payment directly to Acclaro for purchases outside of the store. Any usage of the plugin either on production or in a sandbox environment indicates your acceptance of the legal terms described in the [Craft Software License](https://craftcms.github.io/license/). Any usage of Acclaro Translation Service API integrations indicates acceptance of the terms and conditions as set forth in the [Acclaro User Agreement](https://my.acclaro.com/p.php/useragreement) and [Privacy Policy](https://www.acclaro.com/privacy-policy/). diff --git a/composer.json b/composer.json index 24bda982..fb24fb27 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,9 @@ } ], "require": { - "craftcms/cms": "^3.7.36", - "guzzlehttp/guzzle": "^6.5.8|^7.0", - "php": ">=7.2.0", - "sebastian/diff": "^3.0", + "craftcms/cms": "^4.0.0", + "guzzlehttp/guzzle": "^7.0", + "php": "^8.0.2", "composer/composer": "^2.1.9", "spatie/guzzle-rate-limiter-middleware": "^2.0" }, diff --git a/composer.lock b/composer.lock index 868683bc..ea6ae3aa 100644 --- a/composer.lock +++ b/composer.lock @@ -2409,6 +2409,11 @@ "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -2771,29 +2776,29 @@ }, { "name": "sebastian/diff", - "version": "3.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2825,7 +2830,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" }, "funding": [ { @@ -2833,7 +2838,7 @@ "type": "github" } ], - "time": "2020-11-30T07:59:04+00:00" + "time": "2020-10-26T13:10:38+00:00" }, { "name": "seld/cli-prompt", @@ -3154,15 +3159,14 @@ "symfony/string": "^5.1|^6.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2", @@ -3244,7 +3248,7 @@ "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { @@ -3311,7 +3315,7 @@ "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-php80": "^1.16" @@ -4321,12 +4325,14 @@ "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" }, "conflict": { "symfony/translation-contracts": ">=3.0" @@ -5840,11 +5846,1065 @@ "time": "2021-12-30T08:48:48+00:00" } ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, + "packages-dev": [ + { + "name": "craftcms/rector", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/craftcms/rector.git", + "reference": "af3ecee2ce6b8344fc6fdc6d82a5b2b2dc3d7eeb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/craftcms/rector/zipball/af3ecee2ce6b8344fc6fdc6d82a5b2b2dc3d7eeb", + "reference": "af3ecee2ce6b8344fc6fdc6d82a5b2b2dc3d7eeb", + "shasum": "" + }, + "require": { + "php": "^8.0.2", + "rector/rector": "dev-main", + "symplify/package-builder": "^10.1" + }, + "require-dev": { + "craftcms/cms": "^4.0.0-alpha", + "craftcms/ecs": "dev-main", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5", + "symfony/var-exporter": "^6.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "craft\\rector\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Rector sets to automate Craft CMS upgrades", + "support": { + "issues": "https://github.com/craftcms/rector/issues", + "source": "https://github.com/craftcms/rector/tree/main" + }, + "time": "2022-04-21T18:49:21+00:00" + }, + { + "name": "nette/neon", + "version": "v3.3.3", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "22e384da162fab42961d48eb06c06d3ad0c11b95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/22e384da162fab42961d48eb06c06d3ad0c11b95", + "reference": "22e384da162fab42961d48eb06c06d3ad0c11b95", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.1" + }, + "require-dev": { + "nette/tester": "^2.0", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.7" + }, + "bin": [ + "bin/neon-lint" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍸 Nette NEON: encodes and decodes NEON file format.", + "homepage": "https://ne-on.org", + "keywords": [ + "export", + "import", + "neon", + "nette", + "yaml" + ], + "support": { + "issues": "https://github.com/nette/neon/issues", + "source": "https://github.com/nette/neon/tree/v3.3.3" + }, + "time": "2022-03-10T02:04:26+00:00" + }, + { + "name": "nette/utils", + "version": "v3.2.7", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99", + "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", + "shasum": "" + }, + "require": { + "php": ">=7.2 <8.2" + }, + "conflict": { + "nette/di": "<3.0.6" + }, + "require-dev": { + "nette/tester": "~2.0", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v3.2.7" + }, + "time": "2022-01-24T11:29:14+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.5.7", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac", + "reference": "7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.5.7" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-04-20T12:20:27+00:00" + }, + { + "name": "rector/rector", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "af205b10a4db7c7c3f148d27126611133d974d6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/af205b10a4db7c7c3f148d27126611133d974d6a", + "reference": "af205b10a4db7c7c3f148d27126611133d974d6a", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.5.6" + }, + "conflict": { + "phpstan/phpdoc-parser": "<1.2", + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-laravel": "*", + "rector/rector-nette": "*", + "rector/rector-phpoffice": "*", + "rector/rector-phpunit": "*", + "rector/rector-prefixed": "*", + "rector/rector-symfony": "*" + }, + "default-branch": true, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.12-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/main" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-22T00:49:25+00:00" + }, + { + "name": "symfony/config", + "version": "v6.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "22850bfdd2b6090568ad05dece6843c859d933b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/22850bfdd2b6090568ad05dece6843c859d933b7", + "reference": "22850bfdd2b6090568ad05dece6843c859d933b7", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/filesystem": "^5.4|^6.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php81": "^1.22" + }, + "conflict": { + "symfony/finder": "<4.4" + }, + "require-dev": { + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/yaml": "^5.4|^6.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/config/tree/v6.0.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-03-22T16:12:04+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v6.0.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "3e8a405fcc2eaf4eadb25b5e259ad9bf90499848" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/3e8a405fcc2eaf4eadb25b5e259ad9bf90499848", + "reference": "3e8a405fcc2eaf4eadb25b5e259ad9bf90499848", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php81": "^1.22", + "symfony/service-contracts": "^1.1.6|^2.0|^3.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2", + "symfony/config": "<5.4", + "symfony/finder": "<5.4", + "symfony/proxy-manager-bridge": "<5.4", + "symfony/yaml": "<5.4" + }, + "provide": { + "psr/container-implementation": "1.1|2.0", + "symfony/service-implementation": "1.1|2.0|3.0" + }, + "require-dev": { + "symfony/config": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows you to standardize and centralize the way objects are constructed in your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/dependency-injection/tree/v6.0.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-03-08T15:43:52+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.25.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:11+00:00" + }, + { + "name": "symplify/autowire-array-parameter", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/autowire-array-parameter.git", + "reference": "ec1cc9a9649eb1ec47eca68942fe665a6ce656e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/autowire-array-parameter/zipball/ec1cc9a9649eb1ec47eca68942fe665a6ce656e8", + "reference": "ec1cc9a9649eb1ec47eca68942fe665a6ce656e8", + "shasum": "" + }, + "require": { + "nette/utils": "^3.2", + "php": ">=8.0", + "symfony/dependency-injection": "^6.0", + "symplify/package-builder": "^10.2.2" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/composer-json-manipulator": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/easy-testing": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/smart-file-system": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/symplify-kernel": "<10.2.2", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\AutowireArrayParameter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Autowire array parameters for your Symfony applications", + "support": { + "source": "https://github.com/symplify/autowire-array-parameter/tree/10.2.2" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-17T10:40:31+00:00" + }, + { + "name": "symplify/composer-json-manipulator", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/composer-json-manipulator.git", + "reference": "29e4fb846636e0a3b7aae601aa1eac2f68a103c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/composer-json-manipulator/zipball/29e4fb846636e0a3b7aae601aa1eac2f68a103c9", + "reference": "29e4fb846636e0a3b7aae601aa1eac2f68a103c9", + "shasum": "" + }, + "require": { + "nette/utils": "^3.2", + "php": ">=8.0", + "symfony/config": "^6.0", + "symfony/dependency-injection": "^6.0", + "symfony/filesystem": "^6.0", + "symplify/package-builder": "^10.2.2", + "symplify/smart-file-system": "^10.2.2", + "symplify/symplify-kernel": "^10.2.2" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/autowire-array-parameter": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/easy-testing": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/symplify-kernel": "<9.4.70", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\ComposerJsonManipulator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Package to load, merge and save composer.json file(s)", + "support": { + "source": "https://github.com/symplify/composer-json-manipulator/tree/10.2.2" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-17T10:40:52+00:00" + }, + { + "name": "symplify/easy-testing", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/easy-testing.git", + "reference": "6ff0dda15ab96be196c9eb29eb1db427d0e0637d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/easy-testing/zipball/6ff0dda15ab96be196c9eb29eb1db427d0e0637d", + "reference": "6ff0dda15ab96be196c9eb29eb1db427d0e0637d", + "shasum": "" + }, + "require": { + "nette/utils": "^3.2", + "php": ">=8.0", + "symfony/console": "^6.0", + "symfony/dependency-injection": "^6.0", + "symfony/finder": "^6.0", + "symplify/package-builder": "^10.2.2", + "symplify/smart-file-system": "^10.2.2", + "symplify/symplify-kernel": "^10.2.2" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/autowire-array-parameter": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/composer-json-manipulator": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "bin": [ + "bin/easy-testing" + ], + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\EasyTesting\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Testing made easy", + "support": { + "source": "https://github.com/symplify/easy-testing/tree/10.2.2" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-17T10:40:56+00:00" + }, + { + "name": "symplify/package-builder", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/package-builder.git", + "reference": "b2634f45928f07999ad2ac352de6cf4413410cc7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/package-builder/zipball/b2634f45928f07999ad2ac352de6cf4413410cc7", + "reference": "b2634f45928f07999ad2ac352de6cf4413410cc7", + "shasum": "" + }, + "require": { + "nette/neon": "^3.3.2", + "nette/utils": "^3.2", + "php": ">=8.0", + "sebastian/diff": "^4.0", + "symfony/config": "^6.0", + "symfony/console": "^6.0", + "symfony/dependency-injection": "^6.0", + "symfony/finder": "^6.0", + "symplify/easy-testing": "^10.2.2", + "symplify/symplify-kernel": "^10.2.2" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/autowire-array-parameter": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/composer-json-manipulator": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/smart-file-system": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\PackageBuilder\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.", + "support": { + "source": "https://github.com/symplify/package-builder/tree/10.2.2" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-17T10:41:12+00:00" + }, + { + "name": "symplify/smart-file-system", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/smart-file-system.git", + "reference": "126cd1916dce01f0fef44a3d432194d5d3ad6fe1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/smart-file-system/zipball/126cd1916dce01f0fef44a3d432194d5d3ad6fe1", + "reference": "126cd1916dce01f0fef44a3d432194d5d3ad6fe1", + "shasum": "" + }, + "require": { + "nette/utils": "^3.2", + "php": ">=8.0", + "symfony/filesystem": "^6.0", + "symfony/finder": "^6.0" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/autowire-array-parameter": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/composer-json-manipulator": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/easy-testing": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/package-builder": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/symplify-kernel": "<10.2.2", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "nette/finder": "^2.5", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\SmartFileSystem\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Sanitized FileInfo with safe getRealPath() and other handy methods", + "support": { + "source": "https://github.com/symplify/smart-file-system/tree/10.2.2" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-04-17T10:41:31+00:00" + }, + { + "name": "symplify/symplify-kernel", + "version": "10.2.2", + "source": { + "type": "git", + "url": "https://github.com/symplify/symplify-kernel.git", + "reference": "b2d1e8279528975a96ddeb3f5b59b1b22be15e59" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/symplify-kernel/zipball/b2d1e8279528975a96ddeb3f5b59b1b22be15e59", + "reference": "b2d1e8279528975a96ddeb3f5b59b1b22be15e59", + "shasum": "" + }, + "require": { + "php": ">=8.0", + "symfony/console": "^6.0", + "symfony/dependency-injection": "^6.0", + "symplify/autowire-array-parameter": "^10.2.2", + "symplify/composer-json-manipulator": "^10.2.2", + "symplify/package-builder": "^10.2.2", + "symplify/smart-file-system": "^10.2.2", + "webmozart/assert": "^1.10" + }, + "conflict": { + "symplify/amnesia": "<10.2.2", + "symplify/astral": "<10.2.2", + "symplify/coding-standard": "<10.2.2", + "symplify/config-transformer": "<10.2.2", + "symplify/easy-ci": "<10.2.2", + "symplify/easy-coding-standard": "<10.2.2", + "symplify/easy-parallel": "<10.2.2", + "symplify/easy-testing": "<10.2.2", + "symplify/git-wrapper": "<10.2.2", + "symplify/latte-phpstan-compiler": "<10.2.2", + "symplify/monorepo-builder": "<10.2.2", + "symplify/neon-config-dumper": "<10.2.2", + "symplify/php-config-printer": "<10.2.2", + "symplify/phpstan-extensions": "<10.2.2", + "symplify/phpstan-latte-rules": "<10.2.2", + "symplify/phpstan-rules": "<10.2.2", + "symplify/rule-doc-generator": "<10.2.2", + "symplify/rule-doc-generator-contracts": "<10.2.2", + "symplify/skipper": "<10.2.2", + "symplify/symfony-static-dumper": "<10.2.2", + "symplify/template-phpstan-compiler": "<10.2.2", + "symplify/vendor-patches": "<10.2.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "10.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\SymplifyKernel\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Internal Kernel for Symplify packages", + "support": { + "source": "https://github.com/symplify/symplify-kernel/tree/10.2.2" + }, + "time": "2022-04-17T10:41:30+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": { + "craftcms/rector": 20 + }, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=7.2.0" diff --git a/src/Constants.php b/src/Constants.php index 0552db8c..0977fc21 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -5,7 +5,7 @@ class Constants { const PLUGIN_SCHEMA_VERSION = '1.3.9'; - const CRAFT_MIN_VERSION = '3.7.36'; + const CRAFT_MIN_VERSION = '4.0.0'; const WORD_COUNT_LIMIT = 2000; const PLUGIN_HANDLE = 'translations'; @@ -146,7 +146,6 @@ class Constants const TABLE_TRANSLATORS = '{{%translations_translators}}'; const TABLE_TRANSLATIONS = '{{%translations_translations}}'; const TABLE_GLOBAL_SET_DRAFT = '{{%translations_globalsetdrafts}}'; - const TABLE_CATEGORY_DRAFT = '{{%translations_categorydrafts}}'; const TABLE_ASSET_DRAFT = '{{%translations_assetdrafts}}'; // Job Descriptions @@ -266,7 +265,12 @@ class Constants 'newism\fields\fields\Embed', 'newism\fields\fields\PersonName', 'newism\fields\fields\Gender', - 'ether\seo\fields\SeoField' + 'ether\seo\fields\SeoField', + 'ether\notes\Field', + 'amici\SuperDynamicFields\fields\SueprDynamicDropdownField', + 'amici\SuperDynamicFields\fields\SueprDynamicRadioField', + 'amici\SuperDynamicFields\fields\SueprDynamicCheckboxesField', + 'amici\SuperDynamicFields\fields\SueprDynamicMultiSelectField', ]; const UNRELATED_FIELD_TYPES = [ @@ -276,6 +280,7 @@ class Constants 'craft\fields\Lightswitch', 'craft\fields\Time', 'craft\fields\Url', - 'craft\fields\Users' + 'craft\fields\Users', + 'craft\fields\Money', ]; } diff --git a/src/Translations.php b/src/Translations.php index 3b0ec813..7b7a8073 100644 --- a/src/Translations.php +++ b/src/Translations.php @@ -11,38 +11,37 @@ namespace acclaro\translations; use Craft; -use craft\events\RegisterUserPermissionsEvent; -use craft\services\UserPermissions; +use yii\web\User; use yii\base\Event; use craft\base\Plugin; use craft\web\UrlManager; +use craft\services\Sites; use craft\elements\Entry; +use craft\services\Drafts; use craft\services\Plugins; use craft\events\ModelEvent; use craft\helpers\UrlHelper; use craft\events\DraftEvent; use craft\services\Elements; use craft\events\PluginEvent; -use craft\services\Drafts; +use craft\services\UserPermissions; +use craft\events\DeleteSiteEvent; +use craft\events\DeleteElementEvent; use craft\events\RegisterUrlRulesEvent; use craft\events\RegisterComponentTypesEvent; -use craft\events\DeleteElementEvent; +use craft\events\RegisterUserPermissionsEvent; +use craft\console\Application as ConsoleApplication; + use acclaro\translations\Constants; use acclaro\translations\services\App; use acclaro\translations\elements\Order; use acclaro\translations\base\PluginTrait; -use craft\console\Application as ConsoleApplication; use acclaro\translations\assetbundles\EntryAssets; use acclaro\translations\assetbundles\CategoryAssets; use acclaro\translations\assetbundles\Assets; use acclaro\translations\assetbundles\UniversalAssets; -use acclaro\translations\assetbundles\EditDraftAssets; use acclaro\translations\assetbundles\GlobalSetAssets; use acclaro\translations\services\job\DeleteDrafts; -use craft\errors\MigrationException; -use craft\events\DeleteSiteEvent; -use craft\services\Sites; -use yii\web\User; class Translations extends Plugin { @@ -63,24 +62,18 @@ class Translations extends Plugin */ public static $view; - /** - * @var bool - */ - public $hasCpSection = true; - - /** - * @var bool - */ - public $hasCpSettings = true; - - /** - * @var string - */ - public $schemaVersion = Constants::PLUGIN_SCHEMA_VERSION; - // Public Methods // ========================================================================= + public function __construct($id, $parent = null, array $config = []) + { + $this->schemaVersion = Constants::PLUGIN_SCHEMA_VERSION; + $this->hasCpSettings = true; + $this->hasCpSection = true; + + parent::__construct($id, $parent, $config); + } + /** * @inheritdoc */ @@ -125,10 +118,6 @@ function () { Drafts::class, Drafts::EVENT_BEFORE_APPLY_DRAFT, function (DraftEvent $event) { - // Craft::debug( - // 'Drafts::EVENT_BEFORE_PUBLISH_DRAFT', - // __METHOD__ - // ); Craft::info( Craft::t( 'translations', @@ -215,7 +204,7 @@ function (PluginEvent $event) { /** * @inheritdoc */ - public function uninstall() + public function uninstall(): void { // Let's clean up the drafts table $drafts = self::$plugin->fileRepository->getAllDraftIds(); @@ -226,21 +215,13 @@ public function uninstall() ])); } - if (($migration = $this->createInstallMigration()) !== null) { - try { - $this->getMigrator()->migrateDown($migration); - } catch (MigrationException $e) { - return false; - } - } - $this->afterUninstall(); - return null; + parent::uninstall(); } /** * @inheritdoc */ - public function getCpNavItem() + public function getCpNavItem(): ?array { $subNavs = []; $navItem = parent::getCpNavItem(); @@ -288,18 +269,18 @@ public function getCpNavItem() /** * @inheritdoc */ - public function getSettingsResponse() + public function getSettingsResponse(): mixed { // Just redirect to the plugin settings page Craft::$app->getResponse()->redirect(UrlHelper::cpUrl(Constants::URL_SETTINGS)); } - protected function createSettingsModel() + protected function createSettingsModel(): ?\craft\base\Model { return new \acclaro\translations\models\Settings(); } - protected function settingsHtml() + protected function settingsHtml(): ?string { return \Craft::$app->getView()->renderTemplate('translations/settings/general', [ 'settings' => $this->getSettings() @@ -382,7 +363,6 @@ private function _registerCpRoutes() // Asset, Category, Global-set Controllers 'translations/assets//drafts/' => 'translations/asset/edit-draft', - 'translations/categories///drafts/' => 'translations/category/edit-draft', 'translations/globals//drafts/' => 'translations/global-set/edit-draft', ]); } @@ -396,10 +376,6 @@ private function _includeResources($path) if (preg_match('#^entries(/|$)#', $path)) { $this->_includeEntryResources(); - - if (isset(Craft::$app->getRequest()->getQueryParams()['draftId'])) { - $this->_includeEditDraftResource(Craft::$app->getRequest()->getQueryParams()['draftId']); - } } if (preg_match('#^categories(/|$)#', $path, $match)) { @@ -446,20 +422,6 @@ private function _includeUniversalResources() self::$view->registerJs("$(function(){ Craft.Translations.ShowCompleteOrdersIndicator.init({$numberOfCompleteOrders}); });"); } - private function _includeEditDraftResource($draftId) - { - $response = Translations::$plugin->draftRepository->isTranslationDraft($draftId); - - // If this is a translation draft, load the JS - if (!empty($response)) { - self::$view->registerAssetBundle(EditDraftAssets::class); - - $response = json_encode($response); - - self::$view->registerJs("$(function(){ Craft.Translations.ApplyTranslations.init({$draftId}, {$response}); });"); - } - } - private function _includeEntryResources() { $orders = array(); @@ -579,14 +541,13 @@ private function _onBeforePublishDraft(Event $event) $action = end($action); $applyDraftActions = [ - 'apply-drafts', - 'save-draft-and-publish', + 'apply-draft', // Apply from entry detail page + 'save-draft-and-publish', // Apply from order detail page 'publish-draft', 'run', ]; - if(!empty($response) && !in_array($action, $applyDraftActions)) { - + if (!empty($response) && !in_array($action, $applyDraftActions)) { Craft::$app->getSession()->setError(Translations::$plugin->translator->translate('app', 'Unable to publish translation draft.')); $path = $craft->request->getFullPath(); $params = $craft->request->getQueryParams(); @@ -634,14 +595,15 @@ private function _onDeleteElement(Event $event) if ($currentFile) { $order = self::$plugin->orderRepository->getOrderById($currentFile->orderId); - if ($order) { - $order->logActivity(Translations::$plugin->translator->translate('app', 'Draft ' . $event->element->draftId . ' deleted.')); - Translations::$plugin->orderRepository->saveOrder($order); - } + $currentFile->status = Constants::FILE_STATUS_CANCELED; - $currentFile->status = Constants::FILE_STATUS_CANCELED; + self::$plugin->fileRepository->saveFile($currentFile); - self::$plugin->fileRepository->saveFile($currentFile); + if ($order) { + $order->logActivity(self::$plugin->translator->translate('app', 'Draft ' . $event->element->draftId . ' deleted.')); + $order->status = self::$plugin->orderRepository->getNewStatus($order); + self::$plugin->orderRepository->saveOrder($order); + } } } } @@ -651,7 +613,7 @@ private function _onDeleteElement(Event $event) $event->hardDelete = true; } - if ($order = Translations::$plugin->orderRepository->isTranslationOrder($event->element->id) && $event->hardDelete) { + if ($order = self::$plugin->orderRepository->isTranslationOrder($event->element->id) && $event->hardDelete) { $drafts = []; /** @var Order|null $order */ foreach ($order->getFiles() as $file) { @@ -684,12 +646,15 @@ protected function installCpEventListeners() UserPermissions::class, UserPermissions::EVENT_REGISTER_PERMISSIONS, function (RegisterUserPermissionsEvent $event) { - Craft::debug( + Craft::info( '['. __METHOD__ .'] UserPermissions::EVENT_REGISTER_PERMISSIONS', 'translations' ); // Register our custom permissions - $event->permissions[Craft::t('translations', 'Translations')] = $this->customAdminCpPermissions(); + $event->permissions[] = [ + 'heading' => Craft::t('translations', 'Translations'), + 'permissions' => $this->customAdminCpPermissions(), + ]; } ); } diff --git a/src/assetbundles/NewAndModifiedAssets.php b/src/assetbundles/NewAndModifiedAssets.php index aff8a6dc..3d73a7f6 100644 --- a/src/assetbundles/NewAndModifiedAssets.php +++ b/src/assetbundles/NewAndModifiedAssets.php @@ -27,9 +27,10 @@ public function init() $this->js = [ 'js/RecentlyModified.js', 'js/diff2html.min.js', + 'js/OrderEntries.js', 'js/RecentEntries.js', ]; - + $this->css = [ 'css/diff2html.min.css', ]; diff --git a/src/assetbundles/src/css/Translations.css b/src/assetbundles/src/css/Translations.css index 56a4245d..ad43601c 100644 --- a/src/assetbundles/src/css/Translations.css +++ b/src/assetbundles/src/css/Translations.css @@ -200,10 +200,6 @@ margin: 0 0 2em; } -/* #import-tool { - margin-left: 10px; -} */ - .margin-right-10{ margin-right: 10px; } @@ -214,8 +210,8 @@ } .utility-status .progressbar { - left: 75%; - width: 25%; + left: 50%; + width: 50%; transform: translateX(-50%) translateY(-50%); } @@ -241,7 +237,6 @@ .translations-complete-orders-indicator { float: right; - /* display: inline-block; */ padding: 0; min-height: 22px; border: none; @@ -395,7 +390,6 @@ body.ltr .widget[data-type="acclaro\\translations\\widgets\\NewAndModifiedEntrie } #recently-modified-widget tr.sel .view-diff { - margin-right: 10px; transition: all 0.05s ease-in-out; } @@ -408,7 +402,6 @@ body.ltr .widget[data-type="acclaro\\translations\\widgets\\NewAndModifiedEntrie } #recent-entries-widget tr.sel .view-diff-entry { - margin-right: 10px; transition: all 0.05s ease-in-out; } @@ -637,7 +630,7 @@ body.ltr .widget[data-type="acclaro\\translations\\widgets\\NewAndModifiedEntrie } #translations-dashboard .buttons { - margin: 0 0 14px; + margin: 10px 0 14px; } .btngroup-container { diff --git a/src/assetbundles/src/js/AddEntriesToTranslationOrder.js b/src/assetbundles/src/js/AddEntriesToTranslationOrder.js index c30bdda6..370dffcf 100644 --- a/src/assetbundles/src/js/AddEntriesToTranslationOrder.js +++ b/src/assetbundles/src/js/AddEntriesToTranslationOrder.js @@ -15,21 +15,33 @@ Craft.Translations.AddEntriesToTranslationOrder = { $btn: null, $createNewLink: null, + $sidebar: null, isEditEntryScreen: function() { - return $('form#main-form input[type=hidden][name=action][value="entries/save-entry"]').length > 0 || - $('form#main-form input[type=hidden][name=action][value="entry-revisions/publish-draft"]').length > 0; + return $('form#main-form input[type=hidden][name=action][value="elements/save"]').length > 0; + }, + + isCreateEntryScreen: function() { + return $('form#main-form input[type=hidden][name=action][value="elements/apply-draft"]').length > 0; + }, + + isRevertRevisionScreen: function(){ + return $('form input[type=hidden][name=action][value="elements/revert"]').length > 0; + }, + + isEditDraftScreen: function(){ + return $('form#main-form input[type=hidden][name=action][value="elements/save-draft"]').length > 0; }, getEditEntryId: function() { - var entryId = $('form#main-form input[type=hidden][name=entryId]').val(); + var entryId = $('form#main-form input[type=hidden][name=elementId]').val(); if(!entryId) { entryId = $('form#main-form input[type=hidden][name=sourceId]').val(); } return entryId; }, - + updateSelectedEntries: function() { var entries = []; @@ -67,13 +79,13 @@ Craft.Translations.AddEntriesToTranslationOrder = { // Figure out the initial locale var $option = localeMenu.$options.filter('.sel:first'); - + if ($option.length === 0) { $option = localeMenu.$options.first(); } - + var siteId = $option.data('site-id').toString(); - + return siteId; }, @@ -100,6 +112,7 @@ Craft.Translations.AddEntriesToTranslationOrder = { } var self = this; + this.$sidebar = $('#sidebar'); this.data = data; @@ -129,18 +142,18 @@ Craft.Translations.AddEntriesToTranslationOrder = { } if (this.isEditEntryScreen()) { - $settings = document.getElementById('settings'); + $settings = $('#slug-field').closest('div.meta'); - $settings.insertBefore($btncontainer, $settings.firstChild); + $settings.prepend($btncontainer); var $headinggroup = $('
', {'class': 'heading'}).html(''); var $inputgroup = $('
', {'class': 'input ltr'}); - + $headinggroup.appendTo($btncontainer); $inputgroup.appendTo($btncontainer); $btngroup.appendTo($inputgroup); - } else { - $btngroup.insertBefore('#header #action-button'); + } else if(! (this.isRevertRevisionScreen() || this.isEditDraftScreen() || this.isCreateEntryScreen())) { + $btngroup.insertBefore('header#header > div:last'); } this.$btn = $('', { @@ -162,7 +175,7 @@ Craft.Translations.AddEntriesToTranslationOrder = { this.$btn.appendTo($btngroup); - this.$menubtn.appendTo($btngroup); + ($('
').append(this.$menubtn)).appendTo($btngroup); this.$menubtn.on('click', function(e) { e.preventDefault(); @@ -324,6 +337,12 @@ Craft.Translations.AddEntriesToTranslationOrder = { $form.submit(); }); + + // This prevent the new translation button from remaining enabled when user selects an entry and changes entry group from side bar + this.$sidebar.on('click', 'li', function () { + $(self.$btn[0]).toggleClass('disabled', true); + $(self.$menubtn[0]).toggleClass('disabled', true); + }); } }; diff --git a/src/assetbundles/src/js/ApplyTranslations.js b/src/assetbundles/src/js/ApplyTranslations.js deleted file mode 100644 index ce5650f2..00000000 --- a/src/assetbundles/src/js/ApplyTranslations.js +++ /dev/null @@ -1,91 +0,0 @@ -(function($) { - -if (typeof Craft.Translations === 'undefined') { - Craft.Translations = {}; -} - -function isDraftEdit() { - $url = window.location.href; - return $url.includes("&draftId="); -} - -Craft.Translations.ApplyTranslations = { - init: function(draftId, file) { - // Disable default Craft publishing on Translation drafts - window.draftEditor.settings.canUpdateSource = false; - $("#publish-changes-btn-container :input[type='button']").disable(); - $("#publish-changes-btn-container :input[type='button']").attr('disabled', true); - - if (!isDraftEdit()) { - $("#publish-draft-btn-container :input[type='button']").disable(); - $("#publish-draft-btn-container :input[type='button']").attr('disabled', true); - } - - $("a[data-action='entry-revisions/publish-draft']").addClass("disabled"); - $("a[data-action='entry-revisions/publish-draft']").attr("disabled", true); - - // Create the Apply Translations button - // var $applyTranslationsContainer = document.createElement('div'); - // $applyTranslationsContainer.id = "apply-translations"; - // $applyTranslationsContainer.className = "field"; - - // var $btngroup = $('
', {'class': 'apply-translations'}).css('float', 'right'); - - // $settings = document.getElementById('settings'); - // if (!isDraftEdit()) { - // $settings.insertBefore($applyTranslationsContainer, $settings.firstChild); - // } - // var $headinggroup = $('
', {'class': 'heading'}).html(''); - // var $inputgroup = $('
', {'class': 'input ltr'}); - - // $headinggroup.appendTo($applyTranslationsContainer); - // $inputgroup.appendTo($applyTranslationsContainer); - // $btngroup.appendTo($inputgroup); - - // this.$btn = $('', { - // 'class': 'btn submit', - // 'href': '', - // 'text': Craft.t('app', 'Apply Translations') - // }); - - // $(this.$btn).disable(); - // $(this.$btn).attr('disabled', true); - // $(this.$btn).on("click", function (e) { - // e.preventDefault(); - // }); - - // this.$btn.appendTo($btngroup); - - // // Check to make sure we're in the right target site and the draft is ready to be applied - // if (file.targetSite == window.draftEditor.settings.siteId && file.status == 'complete') { - // // reactivate the button - // $(this.$btn).enable(); - // $(this.$btn).attr('disabled', false); - - // $(this.$btn).one("click", function (e) { - // e.preventDefault(); - // $(".apply-translations > a").addClass("disabled"); - // $(".apply-translations > a").html(""); - // $(".apply-translations .submit").width(122); - // $(".apply-translations > a").toggleClass("spinner"); - - // var fileData = { - // fileId: file.id, - // }; - - // Craft.postActionRequest('translations/files/apply-translation-draft', fileData, function(response, textStatus) { - // if (textStatus === 'success' && response.success) { - // console.log(response.data); - // Craft.cp.displayNotice(Craft.t('app', 'Translations applied.')); - // window.location.reload(); - // } else { - // Craft.cp.displayNotice(Craft.t('app', 'Couldn’t apply translations.')); - // window.location.reload(); - // } - // }); - // }); - // } - }, -}; - -})(jQuery); diff --git a/src/assetbundles/src/js/AssetsTranslations.js b/src/assetbundles/src/js/AssetsTranslations.js index bb94163d..44c37f72 100644 --- a/src/assetbundles/src/js/AssetsTranslations.js +++ b/src/assetbundles/src/js/AssetsTranslations.js @@ -29,7 +29,7 @@ Craft.Translations.AssetsTranslations = { }, isEditAssetScreen: function() { - return $('form#main-form input[type=hidden][name=action][value="assets/save-asset"]').length > 0; + return $('form#main-form input[type=hidden][name=action][value="elements/save"]').length > 0; }, getEditAssetId: function() { @@ -87,7 +87,6 @@ Craft.Translations.AssetsTranslations = { addTranslationOrderButton: function(orders, assetId) { var self = this; assetId = this.getEditAssetId(); - //var sourceSite = $('form#main-form input[type=hidden][name=siteId]').val(); var $btncontainer = document.createElement('div'); $btncontainer.id = "translations-field"; @@ -96,7 +95,7 @@ Craft.Translations.AssetsTranslations = { var $btngroup = $('
', {'class': 'btngroup translations-dropdown'}); if (this.isEditAssetScreen()) { - $settings = document.getElementById('settings'); + $settings = document.getElementById('new-filename-field').closest('div.meta'); $settings.insertBefore($btncontainer, $settings.firstChild); var $headinggroup = $('
', {'class': 'heading'}).html(''); var $inputgroup = $('
', {'class': 'input ltr'}); @@ -105,7 +104,7 @@ Craft.Translations.AssetsTranslations = { $inputgroup.appendTo($btncontainer); $btngroup.appendTo($inputgroup); } else { - $btngroup.insertBefore('#header #action-button'); + $btngroup.insertBefore('header#header > div:last'); } diff --git a/src/assetbundles/src/js/CategoryTranslations.js b/src/assetbundles/src/js/CategoryTranslations.js index 17c7bd04..9ebf3993 100644 --- a/src/assetbundles/src/js/CategoryTranslations.js +++ b/src/assetbundles/src/js/CategoryTranslations.js @@ -20,11 +20,16 @@ Craft.Translations.CategoryTranslations = { }, isEditCategoryScreen: function() { - return $('form#main-form input[type=hidden][name=action][value="categories/save-category"]').length > 0; + return $('form#main-form input[type=hidden][name=action][value="elements/save"]').length > 0 || + $('form#main-form input[type=hidden][name=action][value="elements/save-draft"]').length > 0; }, getEditCategoryId: function() { - return $('form#main-form input[type=hidden][name=sourceId]').val(); + return $('form#main-form input[type=hidden][name=elementId]').val(); + }, + + isCreatingFresh: function() { + return $('form#main-form input[type=hidden][name=fresh]').val(); }, updateSelectedCategories: function() { @@ -78,25 +83,24 @@ Craft.Translations.CategoryTranslations = { initAddToTranslationOrderButton: function(orders, categoryId) { var self = this; - //var sourceSite = $('form#main-form input[type=hidden][name=siteId]').val(); - var $btncontainer = document.createElement('div'); - $btncontainer.id = "translations-field"; - $btncontainer.className = "field"; + $btncontainer.id = "translations-field"; + $btncontainer.className = "field"; var $btngroup = $('
', {'class': 'btngroup translations-dropdown'}); if (this.isEditCategoryScreen()) { - $settings = document.getElementById('settings'); - $settings.insertBefore($btncontainer, $settings.firstChild); + $settings = $('#slug-field').closest('div.meta') + + $settings.prepend($btncontainer); var $headinggroup = $('
', {'class': 'heading'}).html(''); var $inputgroup = $('
', {'class': 'input ltr'}); $headinggroup.appendTo($btncontainer); $inputgroup.appendTo($btncontainer); $btngroup.appendTo($inputgroup); - } else { - $btngroup.insertBefore('#header #action-button'); + } else if (!this.isCreatingFresh()) { + $btngroup.insertBefore('#header #action-buttons'); } diff --git a/src/assetbundles/src/js/CustomExporters.js b/src/assetbundles/src/js/CustomExporters.js index d92526e0..2376896d 100644 --- a/src/assetbundles/src/js/CustomExporters.js +++ b/src/assetbundles/src/js/CustomExporters.js @@ -11,6 +11,7 @@ $toolbar: null, $elementType: null, $action: null, + $sidebar: null, init: function(buttonId) { this.$exportBtn = $('#' + buttonId); @@ -19,10 +20,38 @@ this.$search = this.$toolbar.find('.search:first input:first'); this.$elementType = "acclaro\\translations\\elements\\Order"; this.action = "translations/export/export-files"; + this.$sidebar = $('#sidebar'); this.addListener(this.$exportBtn, 'click', '_showExportHud'); }, + hasSelections: function() { + return $('#content tbody tr.sel').length > 0; + }, + + getOrders: function($selected = false) { + if ($selected) { + return $('#content tbody tr.sel'); + } else { + return $('#content tbody tr'); + } + }, + + getOrderIds: function($selected = false) { + var $ids = ''; + $orders = this.getOrders($selected); + + $orders.each(function() { + $ids += String($(this).data('id')) + ','; + }); + + return $ids.replace(/,\s*$/, ""); + }, + + isTrashed: function () { + return this.$toolbar.find('.statusmenubtn').text() === 'Trashed' || this.$toolbar.find('form#craft-elements-actions-Restore-actiontrigger').length > 0; + }, + getViewParams: function() { var criteria = { @@ -30,12 +59,29 @@ search: this.$search.val(), }; + if (this.$sidebar.find('.sel').data('key') != 'all') { + $status = this.$sidebar.find('.sel').data('key'); + criteria['status'] = $status.replace(/-/g, ' '); + } + + if (this.isTrashed()) { + criteria['trashed'] = true; + } + var params = { criteria: criteria, elementType: this.$elementType, action: this.action, }; + if (this.hasSelections()) { + params['orderIds'] = this.getOrderIds(true); + } + + if (Craft.csrfTokenValue) { + params[Craft.csrfTokenName] = Craft.csrfTokenValue; + } + return params; }, @@ -50,7 +96,7 @@ {"label": "Raw data (fastest)", "value": "Raw"}, {"label": "Expanded", "value": "Expanded"}, ]; - + var $typeField = Craft.ui.createSelectField({ label: Craft.t('app', 'Export Type'), options: typeOptions, @@ -73,11 +119,12 @@ min: 1 }).appendTo($form); - $('