├── templates └── .gitkeep ├── config ├── local │ └── .gitkeep ├── packages │ ├── dev │ │ └── config.yaml │ ├── prod │ │ └── config.yaml │ ├── test │ │ └── config.yaml │ └── security.yaml ├── routes.yaml ├── routes │ └── dev │ │ └── routes.yaml ├── bundles.php ├── services.yaml ├── preload.php ├── pimcore │ ├── constants.example.php │ ├── google-api-private-key.json.example │ ├── perspectives.example.php │ └── customviews.example.php └── config.yaml ├── src ├── WorkflowGui │ ├── Resources │ │ ├── views │ │ │ └── Workflow │ │ │ │ └── visualize.html.twig │ │ ├── public │ │ │ ├── css │ │ │ │ └── workflow_gui.css │ │ │ ├── img │ │ │ │ ├── workflow_white.svg │ │ │ │ └── workflow.svg │ │ │ └── js │ │ │ │ └── pimcore │ │ │ │ ├── workflow │ │ │ │ ├── support_strategy │ │ │ │ │ ├── abstract.js │ │ │ │ │ ├── service.js │ │ │ │ │ ├── expression.js │ │ │ │ │ └── simple.js │ │ │ │ ├── place_permission.js │ │ │ │ ├── panel.js │ │ │ │ ├── transition_notification.js │ │ │ │ ├── additional_field.js │ │ │ │ ├── place.js │ │ │ │ ├── global_action.js │ │ │ │ └── transition.js │ │ │ │ └── startup.js │ │ ├── config │ │ │ ├── services │ │ │ │ └── installer.yml │ │ │ ├── services.yml │ │ │ └── pimcore │ │ │ │ └── routing.yml │ │ └── translations │ │ │ └── admin.en.yml │ ├── Resolver │ │ ├── ConfigFileResolverInterface.php │ │ └── ConfigFileResolver.php │ ├── Repository │ │ ├── WorkflowRepositoryInterface.php │ │ └── WorkflowRepository.php │ ├── DependencyInjection │ │ └── WorkflowGuiExtension.php │ ├── Installer │ │ └── WorkflowGuiInstaller.php │ ├── WorkflowGuiBundle.php │ └── Controller │ │ └── WorkflowController.php └── Kernel.php ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── LICENSE.md ├── .env ├── composer.json ├── public ├── index.php └── .htaccess ├── .gitignore ├── docker-compose.yml ├── bin └── console ├── README.md └── gpl-3.0.txt /templates/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/local/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/views/Workflow/visualize.html.twig: -------------------------------------------------------------------------------- 1 | {{ image|raw }} 2 | -------------------------------------------------------------------------------- /config/packages/dev/config.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ../../config.yaml } 3 | -------------------------------------------------------------------------------- /config/packages/prod/config.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ../../config.yaml } 3 | -------------------------------------------------------------------------------- /config/routes.yaml: -------------------------------------------------------------------------------- 1 | _pimcore: 2 | resource: "@PimcoreCoreBundle/Resources/config/routing.yml" 3 | 4 | -------------------------------------------------------------------------------- /config/routes/dev/routes.yaml: -------------------------------------------------------------------------------- 1 | _pimcore_dev: 2 | resource: "@PimcoreCoreBundle/Resources/config/routing_dev.yml" 3 | -------------------------------------------------------------------------------- /config/bundles.php: -------------------------------------------------------------------------------- 1 | ['all' => true], 5 | ]; 6 | -------------------------------------------------------------------------------- /config/services.yaml: -------------------------------------------------------------------------------- 1 | parameters: 2 | secret: ThisTokenIsNotSoSecretChangeIt 3 | 4 | services: 5 | _defaults: 6 | autowire: true 7 | autoconfigure: true 8 | public: false 9 | -------------------------------------------------------------------------------- /config/preload.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /config/packages/test/config.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: ../dev/config.yaml } 3 | 4 | doctrine: 5 | dbal: 6 | connections: 7 | default: 8 | url: '%pimcore_test.db.dsn%' 9 | host: ~ 10 | port: ~ 11 | dbname: ~ 12 | user: ~ 13 | password: ~ 14 | 15 | parameters: 16 | pimcore_test.db.dsn: '%env(PIMCORE_TEST_DB_DSN)%' 17 | env(PIMCORE_TEST_DB_DSN): ~ 18 | pimcore.encryption.secret: 'def00000fc1e34a17a03e2ef85329325b0736a5941633f8062f6b0a1a20f416751af119256bea0abf83ac33ef656b3fff087e1ce71fa6b8810d7f854fe2781f3fe4507f6' 19 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # License 2 | Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . -------------------------------------------------------------------------------- /src/WorkflowGui/Resolver/ConfigFileResolverInterface.php: -------------------------------------------------------------------------------- 1 | addBundle(new \Youwe\Pimcore\WorkflowGui\WorkflowGuiBundle()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/WorkflowGui/Repository/WorkflowRepositoryInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/img/workflow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # In all environments, the following files are loaded if they exist, 2 | # the latter taking precedence over the former: 3 | # 4 | # * .env contains default values for the environment variables needed by the app 5 | # * .env.local uncommitted file with local overrides 6 | # * .env.$APP_ENV committed environment-specific defaults 7 | # * .env.$APP_ENV.local uncommitted environment-specific overrides 8 | # 9 | # Real environment variables win over .env files. 10 | # 11 | # DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. 12 | # 13 | # Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). 14 | # https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration 15 | 16 | ###> symfony/framework-bundle ### 17 | APP_ENV=dev 18 | PIMCORE_KERNEL_CLASS=Kernel 19 | 20 | #TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 21 | #TRUSTED_HOSTS='^(localhost|example\.com)$' 22 | ###< symfony/framework-bundle ### 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "youwe/workflow-gui", 3 | "type": "pimcore-bundle", 4 | "license": "GPL-3.0-or-later", 5 | "description": "Workflow Configuration UI for Pimcore", 6 | "keywords": [ 7 | "pimcore", 8 | "imports", 9 | "pimcore-plugin", 10 | "pimcore-bundle" 11 | ], 12 | "homepage": "https://github.com/YouweGit/pimcore-workflow-gui", 13 | "authors": [ 14 | { 15 | "name": "Dominik Pfaffenbauer", 16 | "email": "dominik@pfaffenbauer.at", 17 | "homepage": "https://www.pfaffenbauer.at/", 18 | "role": "Developer" 19 | } 20 | ], 21 | "require": { 22 | "php": "^8.0", 23 | "pimcore/pimcore": "^10.6.0 || ^11.0" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "Youwe\\Pimcore\\WorkflowGui\\": "src/WorkflowGui" 28 | } 29 | }, 30 | "autoload-dev": { 31 | "classmap": [ 32 | "src/Kernel.php" 33 | ] 34 | }, 35 | "extra": { 36 | "pimcore": { 37 | "bundles": [ 38 | "Youwe\\Pimcore\\WorkflowGui\\WorkflowGuiBundle" 39 | ] 40 | }, 41 | "branch-alias": { 42 | "dev-master": "2.0-dev" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/config/services.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: 'services/installer.yml' } 3 | 4 | services: 5 | Youwe\Pimcore\WorkflowGui\Resolver\ConfigFileResolver: 6 | arguments: 7 | - '%workflow_gui.config%' 8 | 9 | Youwe\Pimcore\WorkflowGui\Repository\WorkflowRepository: 10 | arguments: 11 | - '@Youwe\Pimcore\WorkflowGui\Resolver\ConfigFileResolver' 12 | 13 | Youwe\Pimcore\WorkflowGui\Controller\WorkflowController: 14 | arguments: 15 | - '@Youwe\Pimcore\WorkflowGui\Repository\WorkflowRepository' 16 | - '@Youwe\Pimcore\WorkflowGui\Resolver\ConfigFileResolver' 17 | - '@kernel' 18 | - '@Pimcore\Cache\Symfony\CacheClearer' 19 | - '@translator' 20 | tags: ['controller.service_arguments', 'container.service_subscriber'] 21 | calls: 22 | - { method: setContainer, arguments: [ '@Psr\Container\ContainerInterface' ] } 23 | - { method: setTokenResolver, arguments: [ '@Pimcore\Security\User\TokenStorageUserResolver' ] } 24 | - { method: setPimcoreSerializer, arguments: [ '@pimcore.serializer' ] } 25 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | handle($request); 36 | $response->send(); 37 | 38 | $kernel->terminate($request, $response); 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # remove the following ignores for your project 2 | /config/pimcore/constants.php 3 | 4 | # symfony default 5 | /.web-server-pid 6 | /build/ 7 | /phpunit.xml 8 | /public/bundles/ 9 | 10 | # local config 11 | /.env.local 12 | /.env.local.php 13 | /.env.*.local 14 | !/config/local 15 | /config/local/* 16 | !config/local/.gitkeep 17 | 18 | # pimcore legacy (remove this for your own development) 19 | !/legacy 20 | /legacy/* 21 | !legacy/.gitkeep 22 | !legacy/bundle 23 | 24 | /var/* 25 | !/var/.gitkeep 26 | !/var/classes/ 27 | /var/classes/DataObject 28 | 29 | !/var/config 30 | /var/config/system.yml 31 | /var/config/debug-mode.php 32 | /var/config/maintenance.php 33 | 34 | # project specific recommendations 35 | /var/config/tag-manager.php 36 | 37 | /public/var/ 38 | /web/var/ 39 | /public/sitemap*.xml 40 | 41 | # PHP-CS-Fixer 42 | /.php_cs 43 | /.php_cs.cache 44 | 45 | # composer 46 | /vendor/ 47 | 48 | # PhpStorm / IDEA 49 | .idea 50 | # NetBeans 51 | nbproject 52 | 53 | .DS_Store 54 | .DS_Store\? 55 | ._* 56 | .Spotlight-V100 57 | .Trashes 58 | Icon\? 59 | *.sublime-workspace 60 | *.sublime-project 61 | .idea/ 62 | composer.lock 63 | docker-compose.yml 64 | config/local 65 | var/classes 66 | var/config 67 | test.csv 68 | web 69 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/support_strategy/abstract.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.support_strategy.abstract'); 15 | pimcore.plugin.workflow.support_strategy.abstract = Class.create({ 16 | getSettingsForm: function (id, data) { 17 | this.form = new Ext.form.Panel({ 18 | defaults: { 19 | width: '100%', 20 | labelWidth: 200 21 | }, 22 | items: this.getSettingsItems(id, data) 23 | }); 24 | 25 | return this.form; 26 | }, 27 | 28 | isValid: function() { 29 | return this.form.isValid(); 30 | }, 31 | 32 | getData: function () { 33 | return this.getFormData(this.form); 34 | }, 35 | }); 36 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resolver/ConfigFileResolver.php: -------------------------------------------------------------------------------- 1 | exists(dirname($this->configFile))) { 32 | $fs->mkdir(dirname($this->configFile)); 33 | } 34 | 35 | if (!$fs->exists($this->configFile)) { 36 | $fs->touch($this->configFile); 37 | } 38 | 39 | return $this->configFile; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/WorkflowGui/DependencyInjection/WorkflowGuiExtension.php: -------------------------------------------------------------------------------- 1 | load('services.yml'); 30 | 31 | $container->setParameter('workflow_gui.config', $container->getParameter('kernel.project_dir').'/var/bundles/workflow-gui/workflow.yml'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/support_strategy/service.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.support_strategy.service'); 15 | pimcore.plugin.workflow.support_strategy.service = Class.create(pimcore.plugin.workflow.support_strategy.abstract, { 16 | getSettingsItems: function (id, data) { 17 | return [{ 18 | xtype: 'textfield', 19 | fieldLabel: t('workflow_support_strategy_service'), 20 | name: 'service', 21 | allowBlank: false, 22 | value: data.hasOwnProperty('support_strategy') ? data.support_strategy.service : '' 23 | }]; 24 | }, 25 | 26 | getFormData: function (panel) { 27 | var form = panel.getForm(); 28 | var fieldValues = form.getFieldValues(); 29 | 30 | return { 31 | service: fieldValues['service'] 32 | }; 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | redis: 4 | image: redis 5 | 6 | db: 7 | image: mariadb:10.6 8 | container_name: workflow-gui--mariadb 9 | working_dir: /application 10 | command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_general_ci] 11 | volumes: 12 | - workflow-gui--4-database:/var/lib/mysql 13 | environment: 14 | - MYSQL_ROOT_PASSWORD=ROOT 15 | - MYSQL_DATABASE=pimcore 16 | - MYSQL_USER=pimcore 17 | - MYSQL_PASSWORD=pimcore 18 | 19 | adminer: 20 | image: adminer 21 | ports: 22 | - 2002:8080 23 | 24 | php: 25 | image: pimcore/pimcore:PHP8.0-apache 26 | container_name: workflow-gui--php 27 | volumes: 28 | - .:/var/www/html:cached 29 | - .docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini 30 | ports: 31 | - "2000:80" 32 | - "2001:443" 33 | depends_on: 34 | - db 35 | 36 | php-debug: 37 | image: pimcore/pimcore:PHP8.0-apache-debug 38 | container_name: workflow-gui--debug-php 39 | volumes: 40 | - .:/var/www/html:cached 41 | - .docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini 42 | ports: 43 | - "2006:80" 44 | depends_on: 45 | - db 46 | environment: 47 | - PHP_DEBUG=1 48 | - PHP_IDE_CONFIG="serverName=localhost" 49 | 50 | volumes: 51 | workflow-gui--4-database: 52 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/config/pimcore/routing.yml: -------------------------------------------------------------------------------- 1 | workflow_gui.admin.list: 2 | path: /admin/workflow/list 3 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::listAction } 4 | 5 | workflow_gui.admin.get: 6 | path: /admin/workflow/get 7 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::getAction } 8 | 9 | workflow_gui.admin.clone: 10 | path: /admin/workflow/clone 11 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::cloneAction } 12 | 13 | workflow_gui.admin.save: 14 | path: /admin/workflow/save 15 | methods: [POST] 16 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::saveAction } 17 | 18 | workflow_gui.admin.delete: 19 | path: /admin/workflow/delete 20 | methods: [POST] 21 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::deleteAction } 22 | 23 | workflow_gui.admin.visualize: 24 | path: /admin/workflow/visualize 25 | methods: [GET] 26 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::visualizeAction } 27 | 28 | workflow_gui.admin.visualize_image: 29 | path: /admin/workflow/visualize_image 30 | methods: [GET] 31 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::visualizeImageAction } 32 | 33 | workflow_gui.roles.search: 34 | path: /admin/workflow/roles/search 35 | defaults: { _controller: Youwe\Pimcore\WorkflowGui\Controller\WorkflowController::searchRolesAction } 36 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getParameterOption(['--env', '-e'], null, true)) { 36 | putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); 37 | } 38 | 39 | if ($input->hasParameterOption('--no-debug', true)) { 40 | putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); 41 | } 42 | 43 | /** @var \Pimcore\Kernel $kernel */ 44 | $kernel = \Pimcore\Bootstrap::startupCli(); 45 | $application = new \Pimcore\Console\Application($kernel); 46 | $application->run(); 47 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/startup.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.WorkflowGuiBundle.startup'); 15 | 16 | pimcore.plugin.WorkflowGuiBundle.startup = { 17 | addMenuItem: function () { 18 | var user = pimcore.globalmanager.get('user'); 19 | var perspectiveCfg = pimcore.globalmanager.get('perspective'); 20 | 21 | if (user.isAllowed('workflow_gui') && perspectiveCfg.inToolbar('settings.workflow_gui')) { 22 | var settingsMenu = new Ext.Action({ 23 | text: t('workflows'), 24 | icon: '/bundles/pimcoreadmin/img/flat-white-icons/workflow.svg', 25 | handler : this.showWorkflows 26 | }); 27 | 28 | layoutToolbar.settingsMenu.add(settingsMenu); 29 | } 30 | }, 31 | 32 | showWorkflows: function () { 33 | try { 34 | pimcore.globalmanager.get('workflows').activate(); 35 | } 36 | catch (e) { 37 | pimcore.globalmanager.add('workflows', new pimcore.plugin.workflow.panel()); 38 | } 39 | }, 40 | }; 41 | 42 | document.addEventListener(pimcore.events.pimcoreReady, function () { 43 | pimcore.plugin.WorkflowGuiBundle.startup.addMenuItem(); 44 | }); 45 | 46 | -------------------------------------------------------------------------------- /src/WorkflowGui/Installer/WorkflowGuiInstaller.php: -------------------------------------------------------------------------------- 1 | addPermissionToPanel(); 29 | $this->markInstalled(); 30 | } 31 | 32 | public function uninstall(): void 33 | { 34 | $this->removePermissionFromPanel(); 35 | $this->markUninstalled(); 36 | } 37 | 38 | private function addPermissionToPanel(): void 39 | { 40 | $permissionDefinition = new Permission\Definition(); 41 | $permissionDefinition->setKey(self::WORKFLOW_GUI); 42 | $permissionDefinition->save(); 43 | } 44 | 45 | private function removePermissionFromPanel(): void 46 | { 47 | $state = Db::get()->prepare("DELETE FROM `users_permission_definitions` WHERE `key` = :key"); 48 | $state->bindValue("key", self::WORKFLOW_GUI); 49 | $state->execute(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/support_strategy/expression.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.support_strategy.expression'); 15 | pimcore.plugin.workflow.support_strategy.expression = Class.create(pimcore.plugin.workflow.support_strategy.abstract, { 16 | getSettingsItems: function (id, data) { 17 | return [{ 18 | xtype: 'textfield', 19 | fieldLabel: t('workflow_support_strategy_class'), 20 | name: 'class', 21 | allowBlank: false, 22 | value: data.hasOwnProperty('support_strategy') && data.support_strategy.hasOwnProperty('arguments') ? data.support_strategy.arguments[0] : '' 23 | }, { 24 | xtype: 'textfield', 25 | fieldLabel: t('workflow_support_strategy_expression'), 26 | name: 'expression', 27 | allowBlank: false, 28 | value: data.hasOwnProperty('support_strategy') && data.support_strategy.hasOwnProperty('arguments') ? data.support_strategy.arguments[1] : '' 29 | }]; 30 | }, 31 | 32 | getFormData: function (panel) { 33 | var form = panel.getForm(); 34 | var fieldValues = form.getFieldValues(); 35 | 36 | return { 37 | type: 'expression', 38 | arguments: [ 39 | fieldValues['class'], 40 | fieldValues['expression'] 41 | ] 42 | }; 43 | }, 44 | }); 45 | -------------------------------------------------------------------------------- /config/pimcore/google-api-private-key.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "type": "service_account", 3 | "project_id": "api-project-73893596983", 4 | "private_key_id": "e2afe72839dbf9f39e33aad363907a9ebd563bf9", 5 | "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDAifl1kWlxgHM/\nGHILhcrOi7TF4ASPO6aXxeSpOivieUVeuIx7kWxNLUsgtqRaTAXApXSAxnLglhS4\nKqaxP3VpGHlyA2ec1gnalziq4liAoTuzqk6tcqfkw0s+M6Mqio0JTDkljYsPVgDj\nrCVOqgK6tU+74ya816EkWfWvA/m/h1llWDWboIoCH04MSb9zT6IEXCaE8U3kXMZW\ntOYmn7sEwRGAkAgIZoMJYT1ORvy0ctObk+UZzFNeJXLI2eXVfkC3YoHZvTouucS3\n9arYmcdqi/92QZl6MA8qGUrkzFKb2PlnXi2A6lxbXLvnHjom3k4s9BYvpUmhBpqr\n4q2WWrmDAgMBAAECggEAEcYq80GDPGkhOnflP08Qk9St0X6GrTpSfLxWCZFHL9cG\nImJjBZ09JDrELrbtoTBXb5tWj/TB8h2ot/+n98Dl89fAjlfmHsJbkoRXRN80UFuS\nCVn1fWmSOjoVHh7iNzEnJ+6Tb/YLGlVUK7BemU50hgvq2mtzzgcR5ysu1QNG8PlC\ncVkgjOCz0rMyyPeqhnVCQWLyczk1kyhTthyxQu8hZ+IR1XdFLW1tiKKV+9bZX7HV\nRVbYHuiFEM0Teb62yKEbAzUyPzln4DJsCTjtC1gqtQrLsKWy40t0mWSqj4hXEJbx\nepYBo5MHaW2T/FpjGsJ22jixs77bXYXrwh9T609AYQKBgQD5RqFOJBMznSmkdF1K\nRlgN4XG4JFiJQSzsEABbQ6nLnraXRoIZLMqGNT9RZhjjksey+DOGQjhyLW2XcByl\ntwva/VX2maVkizsrRQUTr4AjeYdhbxnXG6Yn9LSu8dgipzWwP3l008vBUlQR9qSN\nZ4x6MTHgzeclOx/dA45hU40t+QKBgQDFu4xs1zamDgDa7LOxmEjgRj1J+uNgVm7y\nzL0ze0ZRRTo4PIvqxCRIZhxk/eTtnBMCi6z7VHYtIWT+hGY6/AIGwsHBequiHfBU\naFISHR3I9Rnpn9mqzPa9SCB8SirU8OnyhD6WQBcd2dqmpEtSUOXxkwIbIOTa1xRN\nGa9bIObyWwKBgQC5Is32nTBtqxIchBgta+VGGeQ94TCob/GPOasqHSzkf/IYlFNX\noz6fQrjOGcfubTtIHrMVyeTmV/sG+EsugK6bbIAF8MM303iUgGRu5G+E6WO057EH\nZA+ZqVLwg8oEoq9rQRlRvWOdJyotVUONihR5RERJNGOx8SGPIm8Cte0q8QKBgQCM\n+w7BX6T4Oo3DifcJDeIP/iSexcIuoxHSDcZsmV1mfqxnAkxkY9rWv+9I1nnOLHSl\nYP9B51OnE+NVUQMu1RWAyoWpNJSBL0V2eTbi8V2WNaN3HmDs1dyq0m1PEPZ/AxJa\nto2FRUb2IqkyHXwSwdlhJ4bd3tMtcSJpYoHTwJ7JdwKBgDPCBLDir1qz2ZgBOmTv\nTcCB3rOVTrS6hGPkHgosmKiAtNqD4mjKgHMI9mcQENtr/BrXpNiO0VtM72VhJuxE\npe2WF8TWYtGNa2yIJOsUmY5DrL+2UJd0cig+/IcMi1nKjWQloQ0rpoBrN2TZRPGM\nGS3o3ymJ1tlfWOvl7Fq4G6RH\n-----END PRIVATE KEY-----\n", 6 | "client_email": "73893596983@developer.gserviceaccount.com", 7 | "client_id": "73893596983.apps.googleusercontent.com", 8 | "auth_uri": "https://accounts.google.com/o/oauth2/auth", 9 | "token_uri": "https://accounts.google.com/o/oauth2/token", 10 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", 11 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/73893596983%40developer.gserviceaccount.com" 12 | } 13 | -------------------------------------------------------------------------------- /src/WorkflowGui/Repository/WorkflowRepository.php: -------------------------------------------------------------------------------- 1 | processConfiguration(); 33 | } 34 | 35 | public function find($id): array 36 | { 37 | $all = $this->findAll(); 38 | $filtered = array_filter( 39 | $all, 40 | function ($key) use ($id) { 41 | return $id === $key; 42 | }, 43 | ARRAY_FILTER_USE_KEY 44 | ); 45 | 46 | return reset($filtered); 47 | } 48 | 49 | public function updateConfig(callable $workflowsRewriter): void 50 | { 51 | $config = $this->loadConfig(); 52 | $config['pimcore']['workflows'] = $workflowsRewriter($config['pimcore']['workflows'] ?? []); 53 | $this->storeConfig($config); 54 | } 55 | 56 | protected function processConfiguration(): array 57 | { 58 | $config = $this->loadConfig(); 59 | 60 | $configuration = new Configuration(); 61 | $processor = new Processor(); 62 | 63 | $config = $processor->processConfiguration($configuration, $config ?? []); 64 | 65 | return $config['workflows']; 66 | } 67 | 68 | protected function loadConfig(): array 69 | { 70 | return Yaml::parse( 71 | file_get_contents($this->configFileResolver->getConfigPath()) 72 | ) ?? []; 73 | } 74 | 75 | protected function storeConfig(array $config): void 76 | { 77 | file_put_contents( 78 | $this->configFileResolver->getConfigPath(), 79 | Yaml::dump($config, 100) 80 | ); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /config/packages/security.yaml: -------------------------------------------------------------------------------- 1 | security: 2 | providers: 3 | pimcore_admin: 4 | id: Pimcore\Bundle\AdminBundle\Security\User\UserProvider 5 | 6 | firewalls: 7 | dev: 8 | pattern: ^/(_(profiler|wdt)|css|images|js)/ 9 | security: false 10 | 11 | # Pimcore WebDAV HTTP basic // DO NOT CHANGE! 12 | pimcore_admin_webdav: 13 | pattern: ^/admin/asset/webdav 14 | provider: pimcore_admin 15 | http_basic: ~ 16 | 17 | # Pimcore admin form login // DO NOT CHANGE! 18 | pimcore_admin: 19 | anonymous: ~ 20 | pattern: ^/admin(/.*)?$ 21 | # admin firewall is stateless as we open the admin 22 | # session on demand for non-blocking parallel requests 23 | stateless: true 24 | provider: pimcore_admin 25 | logout: 26 | path: /admin/logout 27 | target: /admin/login 28 | success_handler: Pimcore\Bundle\AdminBundle\Security\LogoutSuccessHandler 29 | guard: 30 | entry_point: Pimcore\Bundle\AdminBundle\Security\Guard\AdminAuthenticator 31 | authenticators: 32 | - Pimcore\Bundle\AdminBundle\Security\Guard\AdminAuthenticator 33 | two_factor: 34 | auth_form_path: /admin/login/2fa # Path or route name of the two-factor form 35 | check_path: /admin/login/2fa-verify # Path or route name of the two-factor code check 36 | default_target_path: /admin # Where to redirect by default after successful authentication 37 | always_use_default_target_path: false # If it should always redirect to default_target_path 38 | auth_code_parameter_name: _auth_code # Name of the parameter for the two-factor authentication code 39 | trusted_parameter_name: _trusted # Name of the parameter for the trusted device option 40 | multi_factor: false # If ALL active two-factor methods need to be fulfilled (multi-factor authentication) 41 | 42 | 43 | access_control: 44 | # Pimcore admin ACl // DO NOT CHANGE! 45 | - { path: ^/admin/settings/display-custom-logo, roles: IS_AUTHENTICATED_ANONYMOUSLY } 46 | - { path: ^/admin/login/2fa-verify, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS} 47 | - { path: ^/admin/login/2fa, roles: IS_AUTHENTICATED_2FA_IN_PROGRESS} 48 | - { path: ^/admin/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 49 | - { path: ^/admin/login/(login|lostpassword|deeplink|csrf-token)$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 50 | - { path: ^/admin, roles: ROLE_PIMCORE_USER } 51 | 52 | role_hierarchy: 53 | # Pimcore admin // DO NOT CHANGE! 54 | ROLE_PIMCORE_ADMIN: [ROLE_PIMCORE_USER] 55 | -------------------------------------------------------------------------------- /src/WorkflowGui/WorkflowGuiBundle.php: -------------------------------------------------------------------------------- 1 | container->get(WorkflowGuiInstaller::class); 47 | } 48 | 49 | public function getJsPaths(): array 50 | { 51 | return [ 52 | '/bundles/workflowgui/js/pimcore/startup.js', 53 | '/bundles/workflowgui/js/pimcore/workflow/panel.js', 54 | '/bundles/workflowgui/js/pimcore/workflow/item.js', 55 | '/bundles/workflowgui/js/pimcore/workflow/place.js', 56 | '/bundles/workflowgui/js/pimcore/workflow/place_permission.js', 57 | '/bundles/workflowgui/js/pimcore/workflow/transition.js', 58 | '/bundles/workflowgui/js/pimcore/workflow/transition_notification.js', 59 | '/bundles/workflowgui/js/pimcore/workflow/global_action.js', 60 | '/bundles/workflowgui/js/pimcore/workflow/additional_field.js', 61 | '/bundles/workflowgui/js/pimcore/workflow/support_strategy/abstract.js', 62 | '/bundles/workflowgui/js/pimcore/workflow/support_strategy/simple.js', 63 | '/bundles/workflowgui/js/pimcore/workflow/support_strategy/expression.js', 64 | '/bundles/workflowgui/js/pimcore/workflow/support_strategy/service.js', 65 | ]; 66 | } 67 | 68 | public function getCssPaths(): array 69 | { 70 | return [ 71 | '/bundles/workflowgui/css/workflow_gui.css' 72 | ]; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/support_strategy/simple.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.support_strategy.simple'); 15 | pimcore.plugin.workflow.support_strategy.simple = Class.create(pimcore.plugin.workflow.support_strategy.abstract, { 16 | getSettingsItems: function (id, data) { 17 | var addMetaData = function (value) { 18 | 19 | if(typeof value != "string") { 20 | value = ""; 21 | } 22 | 23 | var count = this.metaDataPanel.query("button").length+1; 24 | 25 | var compositeField = new Ext.form.FieldContainer({ 26 | layout: 'hbox', 27 | fieldLabel: t('workflow_support_strategy_class'), 28 | allowBlank: false, 29 | items: [{ 30 | xtype: "textfield", 31 | value: value, 32 | width: "95%", 33 | name: "class_" + count, 34 | }] 35 | }); 36 | 37 | compositeField.add({ 38 | xtype: "button", 39 | iconCls: "pimcore_icon_delete", 40 | handler: function (compositeField, el) { 41 | this.metaDataPanel.remove(compositeField); 42 | this.metaDataPanel.updateLayout(); 43 | }.bind(this, compositeField) 44 | }); 45 | 46 | this.metaDataPanel.add(compositeField); 47 | this.metaDataPanel.updateLayout(); 48 | }.bind(this); 49 | 50 | this.metaDataPanel = new Ext.form.Panel({ 51 | autoHeight:true, 52 | border: false, 53 | items: [{ 54 | xtype: "toolbar", 55 | style: "margin-bottom: 10px;", 56 | items: ["->", { 57 | xtype: 'button', 58 | iconCls: "pimcore_icon_add", 59 | handler: addMetaData 60 | }] 61 | }] 62 | }); 63 | 64 | try { 65 | if(data.hasOwnProperty('supports') && data.supports.length > 0) { 66 | for(var r=0; r < data.supports.length; r++) { 67 | addMetaData(data.supports[r]); 68 | } 69 | } 70 | } catch (e) {} 71 | 72 | return [this.metaDataPanel]; 73 | }, 74 | 75 | getFormData: function (panel) { 76 | var form = panel.getForm(); 77 | var fieldValues = form.getFieldValues(), 78 | classes = []; 79 | Object.keys(fieldValues).forEach(function(key) { 80 | classes.push(fieldValues[key]); 81 | }); 82 | 83 | return Ext.Array.unique(classes); 84 | }, 85 | }); 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pimcore - Workflow GUI 2 | 3 | ## Requirements 4 | - Pimcore 10.6.x - 11.x 5 | 6 | Workflow GUI adds a User Interface for configuring Pimcore Workflows. 7 | 8 | ## Getting started 9 | ### Pimcore 10.6 10 | * Install via composer ```composer require youwe/workflow-gui``` 11 | * Enable via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:enable WorkflowGuiBundle``` 12 | * Install via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:install WorkflowGuiBundle``` 13 | * Make sure that the Bundles generated config is loaded (config/config.yaml): ```../var/bundles/workflow-gui/workflow.yml``` 14 | 15 | ### Pimcore 11 16 | * Install via composer ```composer require youwe/workflow-gui``` 17 | * Make sure the bundle is enabled in the `config/bundles.php` file. The following lines should be added: 18 | ```php 19 | return [ 20 | // ... 21 | Youwe\Pimcore\WorkflowGui\WorkflowGuiBundle::class => ['all' => true], 22 | // ... 23 | ]; 24 | ``` 25 | * Install via command-line (or inside the pimcore extension manager): ```bin/console pimcore:bundle:install WorkflowGuiBundle``` 26 | * Make sure that the Bundles generated config is loaded (config/config.yaml): ```../var/bundles/workflow-gui/workflow.yml``` 27 | 28 | ## Example workflow 29 | Put the workflow below in the following location ``var/bundles/workflow-gui/workflow.yml`` and change the class ``Pimcore\Model\DataObject\Test`` to the dataobject you want to apply it to. 30 | ```yaml 31 | pimcore: 32 | workflows: 33 | exampleWorkflow: 34 | enabled: true 35 | priority: 1 36 | label: 'Example workflow' 37 | initial_markings: placeA 38 | type: workflow 39 | audit_trail: 40 | enabled: true 41 | marking_store: 42 | type: state_table 43 | support_strategy: 44 | type: expression 45 | arguments: 46 | - Pimcore\Model\DataObject\Test 47 | - is_fully_authenticated() 48 | places: 49 | placeA: 50 | visibleInHeader: true 51 | title: 'Place A' 52 | label: 'Place A' 53 | color: '#eb0058' 54 | placeB: 55 | title: 'Place B' 56 | visibleInHeader: true 57 | label: 'Place B' 58 | color: '#00800f' 59 | transitions: 60 | placeAtoB: 61 | from: 62 | - placeA 63 | to: 64 | - placeB 65 | options: 66 | label: 'Place A to B' 67 | changePublishedState: no_change 68 | notes: 69 | commentEnabled: false 70 | additionalFields: { } 71 | globalActions: { } 72 | 73 | ``` 74 | 75 | ## Configuration 76 | 77 | * Inside your project, go to settings -> Workflows 78 | * Click in Add Workflow and enter the name of the new Workflow 79 | * At the Settings tab, the Label property is a required field 80 | * At the Supports tab, the Class property is a required field 81 | * At the Places tab, the Places are a required field 82 | * At the Transitions tab, the Transitions are a required field 83 | 84 | For more information about the available options and description of the fields, go to the following URL: 85 | [Pimcore-Documentation/WorkflowManagement/ConfigurationDetails](https://pimcore.com/docs/5.x/Development_Documentation/Workflow_Management/Configuration_Details/index.html) 86 | 87 | ## Workflow History 88 | 89 | In the "Notes & Events" tab, there is a list with every action used on the object via the Workflow module. 90 | 91 | ## Workflow Overview 92 | 93 | If workflows are configured for a Pimcore element, an additional tab with workflow details like all configured workflows, their current places, and a workflow graph is added to Pimcore element detail page. 94 | 95 | To render the graph, ```Graphviz``` is needed as an additional system requirement. 96 | -------------------------------------------------------------------------------- /config/config.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: services.yaml } 3 | - { resource: 'local/' } 4 | - { resource: '../var/bundles/workflow-gui/workflow.yml' } 5 | 6 | 7 | pimcore: 8 | 9 | # IMPORTANT Notice! 10 | # Following there are only some examples listed, for a full list of possible options, please run the following command: 11 | # ./bin/console debug:config pimcore 12 | # you can also filter them by path, eg. 13 | # ./bin/console debug:config pimcore assets 14 | # or even more specific: 15 | # ./bin/console debug:config pimcore assets.image 16 | 17 | 18 | #### TRANSLATIONS 19 | # translations: 20 | # case_insensitive: true 21 | 22 | #### FEATURE FLAGS 23 | # flags: 24 | # zend_date: true 25 | 26 | #### CLASS OVERRIDES EXAMPLES 27 | # models: 28 | # class_overrides: 29 | # 'Pimcore\Model\DataObject\News': 'App\Model\DataObject\News' 30 | # 'Pimcore\Model\DataObject\News\Listing': 'App\Model\DataObject\News\Listing' 31 | # 'Pimcore\Model\DataObject\Folder': 'App\Model\DataObject\Folder' 32 | # 'Pimcore\Model\Asset\Folder': 'App\Model\Asset\Folder' 33 | # 'Pimcore\Model\Asset\Image': 'App\Model\Asset\Image' 34 | # 'Pimcore\Model\Document\Page': 'App\Model\Document\Page' 35 | # 'Pimcore\Model\Document\Link': 'App\Model\Document\Link' 36 | # 'Pimcore\Model\Document\Listing': 'App\Model\Document\Listing' 37 | 38 | 39 | #### CUSTOM DOCUMENT EDITABLES 40 | # documents: 41 | # allow_trailing_slash: 'yes' 42 | # generate_preview: false 43 | # tags: 44 | # map: 45 | # markdown: \App\Model\Document\Tag\Markdown 46 | 47 | 48 | #### CUSTOM OBJECT DATA TYPES 49 | # objects: 50 | # class_definitions: 51 | # data: 52 | # map: 53 | # myDataType: \App\Model\DataObject\Data\MyDataType 54 | 55 | 56 | #### ASSET CUSTOM SETTINGS 57 | # assets: 58 | # icc_rgb_profile: '' 59 | # icc_cmyk_profile: '' 60 | # versions: 61 | # use_hardlinks: false 62 | # image: 63 | # low_quality_image_preview: 64 | # enabled: false 65 | # generator: imagick 66 | # thumbnails: 67 | # webp_auto_support: false 68 | 69 | 70 | #### SYSTEM SETTINGS 71 | 72 | # general: 73 | # timezone: Europe/Berlin 74 | # path_variable: '' 75 | # instance_identifier: '' 76 | # services: 77 | # google: 78 | # client_id: 73893596983.apps.googleusercontent.com 79 | # email: 73893596983@developer.gserviceaccount.com 80 | # simple_api_key: AIzaSyCo9Wj49hYJWW2WgOju4iMYNTvdcBxmyQ8 81 | # browser_api_key: AIzaSyBJX16kWAmUVEz1c1amzp2iKqAfumbcoQQ 82 | # full_page_cache: 83 | # enabled: false 84 | # lifetime: null 85 | # exclude_cookie: '' 86 | # exclude_patterns: '' 87 | # httpclient: 88 | # adapter: Socket # use 'Proxy' for custom proxy configuration 89 | # proxy_host: '' 90 | # proxy_port: '' 91 | # proxy_user: '' 92 | # proxy_pass: '' 93 | # email: 94 | # sender: 95 | # name: 'Pimcore Demo' 96 | # email: demo@pimcore.com 97 | # return: 98 | # name: '' 99 | # email: '' 100 | # newsletter: 101 | # use_specific: false # set true to use the following options for newsletter delivery 102 | # sender: 103 | # name: '' 104 | # email: '' 105 | # return: 106 | # name: '' 107 | # email: '' 108 | 109 | # applicationlog: 110 | # mail_notification: 111 | # send_log_summary: false 112 | # filter_priority: null 113 | # mail_receiver: '' 114 | # archive_treshold: '30' 115 | # archive_alternative_database: '' 116 | 117 | #### SYMFONY OVERRIDES 118 | framework: 119 | 120 | #### DEFINE LOCATION OF MANIFEST WHEN WORKING WITH SYMFONY ENCORE 121 | # assets: 122 | # json_manifest_path: '%kernel.project_dir%/public/build/manifest.json' 123 | 124 | #### USE CUSTOM CACHE POOL 125 | # cache: 126 | # pools: 127 | # pimcore.cache.pool: 128 | # public: true 129 | # tags: true 130 | # default_lifetime: 31536000 # 1 year 131 | # adapter: pimcore.cache.adapter.redis_tag_aware 132 | # provider: 'redis://localhost' # Redis DNS, see: https://symfony.com/doc/current/components/cache/adapters/redis_adapter.html#configure-the-connection 133 | 134 | #### USE SESSION HANDLER CONFIGURED IN php.ini 135 | # session: 136 | # handler_id: null 137 | 138 | #### SYMFONY MAILER TRANSPORTS 139 | # mailer: 140 | # transports: 141 | # main: smtp://user:pass@smtp.example.com:port 142 | # pimcore_newsletter: smtp://user:pass@smtp.example.com:port 143 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/place_permission.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.place_permission'); 15 | pimcore.plugin.workflow.place_permission = Class.create({ 16 | initialize: function (permissionStore, permission) { 17 | this.permissionStore = permissionStore; 18 | 19 | this.window = new Ext.window.Window({ 20 | title: t('workflow_place_permission'), 21 | items: this.getSettings(permission), 22 | modal: true, 23 | resizeable: false, 24 | layout: 'fit', 25 | width: 600, 26 | height: 500 27 | }); 28 | 29 | this.window.show(); 30 | }, 31 | 32 | getPermissionCheckbox: function (permission, name) { 33 | return { 34 | xtype: 'combobox', 35 | fieldLabel: t('workflow_place_permission_' + name), 36 | name: name, 37 | store: Ext.data.ArrayStore({ 38 | fields: ['type'], 39 | data: [ 40 | [null, 'not configured'], 41 | [true, 'yes'], 42 | [false, 'no'] 43 | ] 44 | }), 45 | value: permission.get(name), 46 | displayField: 'type', 47 | valueField: 'type' 48 | }; 49 | }, 50 | 51 | getSettings: function (permission) { 52 | this.settingsForm = new Ext.form.Panel({ 53 | bodyStyle: 'padding:20px 5px 20px 5px;', 54 | border: false, 55 | autoScroll: true, 56 | forceLayout: true, 57 | defaults: { 58 | width: '100%', 59 | labelWidth: 200 60 | }, 61 | items: [ 62 | { 63 | xtype: 'textfield', 64 | name: 'condition', 65 | value: permission.get('condition'), 66 | fieldLabel: t('workflow_place_permission_condition'), 67 | }, 68 | this.getPermissionCheckbox(permission, 'save'), 69 | this.getPermissionCheckbox(permission, 'publish'), 70 | this.getPermissionCheckbox(permission, 'unpublish'), 71 | this.getPermissionCheckbox(permission, 'delete'), 72 | this.getPermissionCheckbox(permission, 'rename'), 73 | this.getPermissionCheckbox(permission, 'view'), 74 | this.getPermissionCheckbox(permission, 'settings'), 75 | this.getPermissionCheckbox(permission, 'versions'), 76 | this.getPermissionCheckbox(permission, 'properties'), 77 | this.getPermissionCheckbox(permission, 'modify'), 78 | { 79 | xtype: 'textfield', 80 | name: 'objectLayout', 81 | value: permission.get('objectLayout'), 82 | fieldLabel: t('workflow_place_permission_object_layout') 83 | }, 84 | ], 85 | buttons: [ 86 | { 87 | text: t('save'), 88 | handler: function (btn) { 89 | var formValues = this.settingsForm.getForm().getFieldValues(); 90 | 91 | var notEmptyValues = Object.keys(formValues).filter(function(key) { 92 | var actualValue = formValues[key]; 93 | 94 | return !((key === 'condition' && !actualValue) || actualValue === null); 95 | }); 96 | 97 | if (notEmptyValues.length === 0) { 98 | Ext.Msg.alert(t('workflow_place_permission'), t('workflow_place_permission_invalid')); 99 | return; 100 | } 101 | 102 | if (this.settingsForm.isValid()) { 103 | 104 | 105 | permission.set(formValues); 106 | permission.commit(); 107 | 108 | this.permissionStore.add(permission); 109 | 110 | this.window.close(); 111 | } 112 | }.bind(this), 113 | iconCls: 'pimcore_icon_apply' 114 | } 115 | ], 116 | }); 117 | 118 | return this.settingsForm; 119 | } 120 | }); 121 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/translations/admin.en.yml: -------------------------------------------------------------------------------- 1 | workflows: 'Workflows' 2 | workflow_settings: 'Settings' 3 | workflow_settings_supports: 'Supports' 4 | workflow_settings_places: 'Places' 5 | workflow_settings_transitions: 'Transitions' 6 | workflow_settings_global_actions: 'Global Actions' 7 | workflow_saved_successfully: 'Workflow saved successful' 8 | workflow_add: 'Add Workflow' 9 | workflow_problem_opening_workflow: 'Problem opening the a new Workflow' 10 | workflow_enter_the_name: 'Enter the Name of the new Workflow' 11 | workflow_problem_creating_workflow: 'Problem adding a new Workflow' 12 | workflow_name: 'Name' 13 | workflow_enabled: 'Enabled' 14 | workflow_priority: 'Priority' 15 | workflow_label: 'Label' 16 | workflow_type: 'Type' 17 | workflow_type_workflow: 'Workflow' 18 | workflow_type_state_machine: 'State Machine' 19 | workflow_audit_trail: 'Audit Trail' 20 | workflow_audit_trail_enabled: 'Enabled' 21 | workflow_marking_store: 'Marking Store' 22 | workflow_marking_store_type: 'Type' 23 | workflow_marking_store_service: 'Service' 24 | workflow_marking_store_arguments: 'Marking Store Arguments' 25 | workflow_marking_store_argument: 'Argument' 26 | workflow_support_strategy: 'Support Strategy' 27 | workflow_support_strategy_service: 'Service' 28 | workflow_support_strategy_type: 'Type' 29 | workflow_support_strategy_class: 'Class' 30 | workflow_support_strategy_expression: 'Expression' 31 | workflow_invalid: 'Workflow is invalid' 32 | workflow_invalid_detail: 'Your current Workflow configuration is invalid' 33 | workflow_places: 'Places' 34 | workflow_place: 'Place' 35 | workflow_place_settings: 'Place Settings' 36 | workflow_enter_place_id: 'Enter Place ID' 37 | workflow_place_id: 'Id' 38 | workflow_place_label: 'Label' 39 | workflow_place_title: 'Title' 40 | workflow_place_color: 'Color' 41 | workflow_place_color_inverted: 'Color inverted' 42 | workflow_place_visible_in_header: 'Visible in Header' 43 | workflow_place_with_id_already_exists: 'Place with ID already exists' 44 | workflow_transitions: 'Transitions' 45 | workflow_transition: 'Transition' 46 | workflow_enter_transition_id: 'Enter Transition ID' 47 | workflow_transition_id: 'Id' 48 | workflow_transition_with_id_already_exists: 'Transition with ID already exists' 49 | workflow_transition_from: 'From' 50 | workflow_transition_to: 'To' 51 | workflow_transition_settings: 'Settings' 52 | workflow_transition_options: 'Options' 53 | workflow_transition_label: 'Label' 54 | workflow_transition_guard: 'Guard' 55 | workflow_transition_note_comment_enabled: 'Comment enabled' 56 | workflow_transition_note_comment_required: 'Comment required' 57 | workflow_transition_notes: 'Notes' 58 | workflow_transition_note_comment_setter: 'Setter Fn' 59 | workflow_transition_note_comment_getter: 'Getter Fn' 60 | workflow_transition_note_type: 'Type' 61 | workflow_transition_note_title: 'Title' 62 | workflow_transition_icon_class: 'Icon Class' 63 | workflow_transition_change_publish_state: 'Change Publish State' 64 | workflow_transition_notifications: 'Notifications' 65 | workflow_transition_notification: 'Notification' 66 | workflow_transition_notification_condition: 'Condition' 67 | workflow_transition_notification_channel_types: 'Channel Types' 68 | workflow_transition_notification_mail_type: 'Mail Type' 69 | workflow_transition_notification_mail_path: 'Mail Path' 70 | workflow_transition_notification_notify_users: 'Notify Users' 71 | workflow_transition_notification_notify_roles: 'Notify Roles' 72 | workflow_global_action_id: 'Id' 73 | workflow_enter_global_action_id: 'Enter Global Action Id' 74 | workflow_global_action_with_id_already_exists: 'Global Action with Id already exists' 75 | workflow_global_actions: 'Global Actions' 76 | workflow_global_action: 'Global Action' 77 | workflow_global_action_settings: 'Global Action Settings' 78 | workflow_global_action_notes: 'Global Action Notes' 79 | workflow_global_action_icon_class: 'Icon Class' 80 | workflow_global_action_guard: 'Guard' 81 | workflow_global_action_to: 'To' 82 | workflow_global_action_note_comment_enabled: 'Comment enabled' 83 | workflow_global_action_note_comment_required: 'Comment required' 84 | workflow_global_action_note_comment_setter: 'Setter Fn' 85 | workflow_global_action_note_comment_getter: 'Getter Fn' 86 | workflow_global_action_note_type: 'Type' 87 | workflow_global_action_note_title: 'Title' 88 | workflow_place_permission: 'Permission' 89 | workflow_place_permissions: 'Permission' 90 | workflow_place_permission_condition: 'Condition' 91 | workflow_place_permission_save: 'Save' 92 | workflow_place_permission_publish: 'Publish' 93 | workflow_place_permission_unpublish: 'Unpublish' 94 | workflow_place_permission_delete: 'Delete' 95 | workflow_place_permission_rename: 'Rename' 96 | workflow_place_permission_view: 'View' 97 | workflow_place_permission_settings: 'Settings' 98 | workflow_place_permission_versions: 'Versions' 99 | workflow_place_permission_properties: 'Properties' 100 | workflow_place_permission_modify: 'Modify' 101 | workflow_place_permission_object_layout: 'Object Layout' 102 | workflow_place_permission_invalid: 'Permission Configuration is invalid, please provide at least one entry' 103 | workflow_additional_field: 'Additional Field' 104 | workflow_additional_fields: 'Additional Fields' 105 | workflow_additional_field_settings: 'Additional Field Settings' 106 | workflow_additional_field_name: 'Name' 107 | workflow_additional_field_type: 'Field Type' 108 | workflow_additional_field_title: 'Title' 109 | workflow_additional_field_required: 'Required' 110 | workflow_additional_field_setter_function: 'Setter Function' 111 | workflow_additional_field_type_settings: 'Field Type Settings' 112 | workflow_initial_marking: 'Initial Markings' 113 | workflow_gui: 'Workflow GUI' 114 | workflow_problem_creating_workflow_invalid_characters: 'Please use only these characters: "a-z", "A-Z" and "_"' 115 | workflow_gui_workflow_with_name_already_exists: 'Workflow with bane already exists' 116 | workflow_gui_clone: 'Clone' 117 | workflow_gui_enable_message: 'Please enable and save the workflow to display graph visualization.' 118 | workflow_gui_not_found: 'Workflow can not be found.' 119 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/panel.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.panel'); 15 | pimcore.plugin.workflow.panel = Class.create({ 16 | 17 | initialize: function () { 18 | this.panels = {}; 19 | this.getTabPanel(); 20 | }, 21 | 22 | getTabPanel: function () { 23 | 24 | if (!this.panel) { 25 | this.panel = new Ext.Panel({ 26 | id: 'pimcore_workflows', 27 | title: t('workflows'), 28 | iconCls: 'pimcore_icon_workflow_action', 29 | border: false, 30 | layout: 'border', 31 | closable: true, 32 | items: [this.getWorkflowTree(), this.getEditPanel()] 33 | }); 34 | 35 | this.panel.on('destroy', function () { 36 | pimcore.globalmanager.remove('workflows'); 37 | }.bind(this)); 38 | 39 | var tabPanel = Ext.getCmp('pimcore_panel_tabs'); 40 | tabPanel.add(this.panel); 41 | tabPanel.setActiveItem('pimcore_workflows'); 42 | 43 | this.panel.updateLayout(); 44 | pimcore.layout.refresh(); 45 | } 46 | 47 | return this.panel; 48 | }, 49 | 50 | getWorkflowTree: function () { 51 | if (!this.grid) { 52 | var store = Ext.create('Ext.data.Store', { 53 | autoLoad: true, 54 | proxy: { 55 | type: 'ajax', 56 | url: '/admin/workflow/list', 57 | reader: { 58 | type: 'json', 59 | fields: [{ 60 | name: 'id', 61 | label: 'label' 62 | }] 63 | } 64 | } 65 | }); 66 | 67 | this.grid = Ext.create('Ext.grid.Panel', { 68 | store: store, 69 | region: 'west', 70 | autoScroll: true, 71 | animate: false, 72 | containerScroll: true, 73 | width: 200, 74 | split: true, 75 | listeners: this.getGridListeners(), 76 | hideHeaders: true, 77 | columns: [{ 78 | dataIndex: 'label', 79 | flex: 1, 80 | }], 81 | tbar: { 82 | items: [ 83 | { 84 | text: t('workflow_add'), 85 | iconCls: 'pimcore_icon_add', 86 | handler: this.addField.bind(this) 87 | } 88 | ] 89 | } 90 | }); 91 | } 92 | 93 | return this.grid; 94 | }, 95 | 96 | getGridListeners: function () { 97 | var treeNodeListeners = { 98 | 'itemclick': this.onTreeNodeClick.bind(this), 99 | 'itemcontextmenu': this.onTreeNodeContextmenu.bind(this), 100 | 'beforeitemappend': function (thisNode, newChildNode, index, eOpts) { 101 | newChildNode.data.qtip = t('id') + ': ' + newChildNode.data.id; 102 | } 103 | }; 104 | 105 | return treeNodeListeners; 106 | }, 107 | 108 | getEditPanel: function () { 109 | if (!this.editPanel) { 110 | this.editPanel = new Ext.TabPanel({ 111 | activeTab: 0, 112 | items: [], 113 | region: 'center' 114 | }); 115 | } 116 | 117 | return this.editPanel; 118 | }, 119 | 120 | openWorkflow: function (id) { 121 | try { 122 | var workflowPanelKey = 'workflow_' + id; 123 | if (this.panels[workflowPanelKey]) { 124 | this.panels[workflowPanelKey].activate(); 125 | } else { 126 | Ext.Ajax.request({ 127 | url: '/admin/workflow/get', 128 | params: { 129 | id: id 130 | }, 131 | success: function (response) { 132 | var data = Ext.decode(response.responseText); 133 | 134 | if (!data || !data.success) { 135 | Ext.Msg.alert(t('workflow_add'), t('workflow_problem_opening_workflow')); 136 | } else { 137 | var workflowPanel = new pimcore.plugin.workflow.item(id, data.data, this, workflowPanelKey); 138 | this.panels[workflowPanelKey] = workflowPanel; 139 | } 140 | }.bind(this) 141 | }); 142 | } 143 | } catch (e) { 144 | console.log(e); 145 | } 146 | 147 | }, 148 | 149 | onTreeNodeClick: function (tree, record, item, index, e, eOpts) { 150 | this.openWorkflow(record.data.id); 151 | }, 152 | 153 | addField: function () { 154 | Ext.MessageBox.prompt(t('workflow_add'), t('workflow_enter_the_name'), 155 | this.addFieldComplete.bind(this), null, null, ''); 156 | }, 157 | 158 | onTreeNodeContextmenu: function (tree, record, item, index, e, eOpts) { 159 | e.stopEvent(); 160 | 161 | tree.select(); 162 | 163 | var menu = new Ext.menu.Menu(); 164 | menu.add(new Ext.menu.Item({ 165 | text: t('delete'), 166 | iconCls: 'pimcore_icon_delete', 167 | handler: this.deleteField.bind(this, tree, record) 168 | })); 169 | 170 | 171 | menu.showAt(e.pageX, e.pageY); 172 | }, 173 | 174 | addFieldComplete: function (button, value, object) { 175 | if (button === 'ok' && value.length > 1) { 176 | if (value.match(/^[a-zA-Z_]+$/)) { 177 | new pimcore.plugin.workflow.item(value, {}, this); 178 | } 179 | else { 180 | Ext.Msg.alert(t('workflow_add'), t('workflow_problem_creating_workflow_invalid_characters')); 181 | } 182 | } else if (button == 'cancel') { 183 | 184 | } else { 185 | Ext.Msg.alert(t('workflow_add'), t('workflow_problem_creating_workflow')); 186 | } 187 | }, 188 | 189 | deleteField: function (grid, record) { 190 | Ext.Ajax.request({ 191 | url: '/admin/workflow/delete', 192 | method: 'post', 193 | params: { 194 | id: record.data.id 195 | } 196 | }); 197 | 198 | this.getEditPanel().removeAll(); 199 | 200 | grid.store.remove(record); 201 | }, 202 | 203 | activate: function () { 204 | Ext.getCmp('pimcore_panel_tabs').setActiveItem('pimcore_workflows'); 205 | } 206 | }); 207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | # Use the front controller as index file. It serves as a fallback solution when 2 | # every other rewrite/redirect fails (e.g. in an aliased environment without 3 | # mod_rewrite). Additionally, this reduces the matching process for the 4 | # start page (path "/") because otherwise Apache will apply the rewriting rules 5 | # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). 6 | DirectoryIndex index.php 7 | 8 | # By default, Apache does not evaluate symbolic links if you did not enable this 9 | # feature in your server configuration. Uncomment the following line if you 10 | # install assets as symlinks or if you experience problems related to symlinks 11 | # when compiling LESS/Sass/CoffeScript assets. 12 | # Options FollowSymlinks 13 | 14 | # Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve 15 | # to the front controller "/index.php" but be rewritten to "/index.php/index". 16 | 17 | Options -MultiViews 18 | 19 | 20 | # mime types 21 | AddType video/mp4 .mp4 22 | AddType video/webm .webm 23 | AddType image/webp .webp 24 | AddType image/jpeg .pjpeg 25 | 26 | Options +SymLinksIfOwnerMatch 27 | 28 | # Use UTF-8 encoding for anything served text/plain or text/html 29 | AddDefaultCharset utf-8 30 | 31 | RewriteEngine On 32 | 33 | 34 | 35 | Header always unset X-Content-Type-Options 36 | 37 | 38 | 39 | # Determine the RewriteBase automatically and set it as environment variable. 40 | # If you are using Apache aliases to do mass virtual hosting or installed the 41 | # project in a subdirectory, the base path will be prepended to allow proper 42 | # resolution of the index.php file and to redirect to the correct URI. It will 43 | # work in environments without path prefix as well, providing a safe, one-size 44 | # fits all solution. But as you do not need it in this case, you can comment 45 | # the following 2 lines to eliminate the overhead. 46 | RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 47 | RewriteRule ^(.*) - [E=BASE:%1] 48 | 49 | # Sets the HTTP_AUTHORIZATION header removed by Apache 50 | RewriteCond %{HTTP:Authorization} . 51 | RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 52 | 53 | # Redirect to URI without front controller to prevent duplicate content 54 | # (with and without `/index.php`). Only do this redirect on the initial 55 | # rewrite by Apache and not on subsequent cycles. Otherwise we would get an 56 | # endless redirect loop (request -> rewrite to front controller -> 57 | # redirect -> request -> ...). 58 | # So in case you get a "too many redirects" error or you always get redirected 59 | # to the start page because your Apache does not expose the REDIRECT_STATUS 60 | # environment variable, you have 2 choices: 61 | # - disable this feature by commenting the following 2 lines or 62 | # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the 63 | # following RewriteCond (best solution) 64 | RewriteCond %{ENV:REDIRECT_STATUS} ^$ 65 | RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L] 66 | 67 | 68 | RewriteCond %{REQUEST_URI} ^/(fpm|server)-(info|status|ping) 69 | RewriteRule . - [L] 70 | 71 | 72 | # restrict access to dotfiles 73 | RewriteCond %{REQUEST_FILENAME} -d [OR] 74 | RewriteCond %{REQUEST_FILENAME} -l [OR] 75 | RewriteCond %{REQUEST_FILENAME} -f 76 | RewriteRule /\.|^\.(?!well-known/) - [F,L] 77 | 78 | # ASSETS: check if request method is GET (because of WebDAV) and if the requested file (asset) exists on the filesystem, if both match, deliver the asset directly 79 | RewriteCond %{REQUEST_METHOD} ^(GET|HEAD) 80 | RewriteCond %{DOCUMENT_ROOT}/var/assets%{REQUEST_URI} -f 81 | RewriteRule ^(.*)$ /var/assets%{REQUEST_URI} [PT,L] 82 | 83 | # Thumbnails 84 | RewriteCond %{REQUEST_URI} .*/(image|video)-thumb__[\d]+__.* 85 | RewriteCond %{DOCUMENT_ROOT}/var/tmp/thumbnails%{REQUEST_URI} -f 86 | RewriteRule ^(.*)$ /var/tmp/thumbnails%{REQUEST_URI} [PT,L] 87 | 88 | # cache-buster rule for scripts & stylesheets embedded using view helpers 89 | RewriteRule ^cache-buster\-[\d]+/(.*) $1 [PT,L] 90 | 91 | # If the requested filename exists, simply serve it. 92 | # We only want to let Apache serve files and not directories. 93 | RewriteCond %{REQUEST_FILENAME} -f 94 | RewriteRule ^ - [L] 95 | 96 | # Rewrite all other queries to the front controller. 97 | RewriteRule ^ %{ENV:BASE}/index.php [L] 98 | 99 | 100 | 101 | 102 | ########################################## 103 | ### OPTIONAL PERFORMANCE OPTIMIZATIONS ### 104 | ########################################## 105 | 106 | 107 | # Force compression for mangled headers. 108 | # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping 109 | 110 | 111 | SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 112 | RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 113 | 114 | 115 | 116 | # Compress all output labeled with one of the following MIME-types 117 | # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` 118 | # and can remove the `` and `` lines 119 | # as `AddOutputFilterByType` is still in the core directives). 120 | 121 | AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json \ 122 | application/vnd.ms-fontobject application/x-font-ttf application/rss+xml \ 123 | application/x-web-app-manifest+json application/xhtml+xml \ 124 | application/xml font/opentype image/svg+xml image/x-icon \ 125 | text/css text/html text/plain text/x-component text/xml text/javascript 126 | 127 | 128 | 129 | 130 | ExpiresActive on 131 | ExpiresDefault "access plus 31536000 seconds" 132 | 133 | # specific overrides 134 | #ExpiresByType text/css "access plus 1 year" 135 | 136 | 137 | 138 | # pimcore mod_pagespeed integration 139 | # pimcore automatically disables mod_pagespeed in the following situations: debug-mode on, /admin, preview, editmode, ... 140 | # if you want to disable pagespeed for specific actions in pimcore you can use $this->disableBrowserCache() in your action 141 | RewriteCond %{REQUEST_URI} ^/(mod_)?pagespeed_(statistics|message|console|beacon|admin|global_admin) 142 | RewriteRule . - [L] 143 | 144 | ModPagespeed Off 145 | AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html 146 | ModPagespeedModifyCachingHeaders off 147 | ModPagespeedRewriteLevel PassThrough 148 | # low risk filters 149 | ModPagespeedEnableFilters remove_comments,recompress_images 150 | # low and moderate filters, recommended filters, but can cause problems 151 | ModPagespeedEnableFilters lazyload_images,extend_cache_images,inline_preview_images,sprite_images 152 | ModPagespeedEnableFilters combine_css,rewrite_css,move_css_to_head,flatten_css_imports,extend_cache_css,prioritize_critical_css 153 | ModPagespeedEnableFilters extend_cache_scripts,combine_javascript,canonicalize_javascript_libraries,rewrite_javascript 154 | # high risk 155 | #ModPagespeedEnableFilters defer_javascript,local_storage_cache 156 | 157 | -------------------------------------------------------------------------------- /config/pimcore/perspectives.example.php: -------------------------------------------------------------------------------- 1 | [ // this is the config for the default view 5 | 'iconCls' => 'pimcore_icon_perspective', 6 | 'elementTree' => [ 7 | [ 8 | 'type' => 'documents', // document tree 9 | 'position' => 'left', 10 | 'expanded' => false, // there can be only one expanded view on each side 11 | 'hidden' => false, 12 | 'sort' => -3 // trees with lower values are shown first 13 | ], 14 | [ 15 | 'type' => 'assets', 16 | 'position' => 'left', 17 | 'expanded' => false, 18 | 'hidden' => false, 19 | 'sort' => -2 20 | ], 21 | [ 22 | 'type' => 'objects', 23 | 'position' => 'left', 24 | 'expanded' => false, 25 | 'hidden' => false, 26 | 'sort' => -1 27 | ] 28 | 29 | ], 30 | 'dashboards' => [ // this is the standard setting for the welcome screen 31 | 'predefined' => [ 32 | 'welcome' => [ // internal key of the dashboard 33 | 'positions' => [ 34 | [ // left column 35 | [ 36 | 'id' => 1, 37 | 'type' => 'pimcore.layout.portlets.modificationStatistic', 38 | 'config' => null // additional config 39 | ], 40 | [ 41 | 'id' => 2, 42 | 'type' => 'pimcore.layout.portlets.modifiedAssets', 43 | 'config' => null 44 | ] 45 | ], 46 | [ 47 | [ 48 | 'id' => 3, 49 | 'type' => 'pimcore.layout.portlets.modifiedObjects', 50 | 'config' => null 51 | ], 52 | [ 53 | 'id' => 4, 54 | 'type' => 'pimcore.layout.portlets.modifiedDocuments', 55 | 'config' => null 56 | ] 57 | ] 58 | ] 59 | ] 60 | ] 61 | ] 62 | 63 | ], 64 | 'Alternative view' => [ 65 | 'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/biohazard.svg', 66 | 'toolbar' => [ 67 | 'file' => 1, 68 | 'extras' => [ 69 | 'hidden' => false, 70 | 'items' => [ 71 | 'systemtools' => [ 72 | 'items' => [ 73 | 'fileexplorer' => false 74 | ] 75 | ], 76 | 'update' => false, 77 | 'maintenance' => false 78 | ] 79 | 80 | ], 81 | 'marketing' => [ // hide the marketing menu 82 | 'hidden' => 1 83 | ], 84 | 'settings' => [ 85 | 'items' => [ 86 | 'cache' => [ 87 | 'items' => [ 88 | 'clearAll' => 0 // hide "Clear All" but show the other Cache menu entries 89 | ] 90 | ] 91 | ] 92 | ], 93 | 'search' => [ 94 | 'items' => [ 95 | 'objects' => false 96 | ] 97 | ] 98 | ], 99 | 'elementTree' => [ 100 | [ 101 | 'type' => 'documents', 102 | 'position' => 'left', 103 | 'expanded' => false, 104 | 'hidden' => true, // hide the document tree 105 | 'sort' => 3 // show it on the bottom 106 | ], 107 | [ 108 | 'type' => 'assets', 109 | 'position' => 'right', // show the asset tree on the right side 110 | 'expanded' => false, // expand it 111 | 'hidden' => false, 112 | 'sort' => -2 113 | ], 114 | [ 115 | 'type' => 'objects', 116 | 'position' => 'left', 117 | 'expanded' => true, 118 | 'hidden' => false, 119 | 'sort' => -1 120 | ], 121 | [ 122 | 'type' => 'customview', // include custom view 123 | 'position' => 'right', 124 | 'sort' => -10, // show it on the top 125 | 'expanded' => true, 126 | 'id' => 2, // show alternative document tree on the right side 127 | 'treeContextMenu' => [ // hide the "Add document" tree context menu 128 | 'document' => [ 129 | 'items' => [ 130 | 'add' => 0, 131 | 'cut' => 0, 132 | 'rename' => 0, 133 | 'addBlankDocument' => false, // Hides the '> Blank' default document 134 | ] 135 | ] 136 | ] 137 | ], 138 | ], 139 | 'dashboards' => [ // this is the standard setting for the welcome screen 140 | 'disabledPortlets' => [ // disallows access to the given portlets 141 | 'pimcore.layout.portlets.modificationStatistic' => 1, 142 | 'pimcore.layout.portlets.feed' => 1 143 | ], 144 | 'predefined' => [ 145 | 'welcome' => [ // internal key of the dashboard 146 | 'positions' => [ 147 | [ // left column 148 | ], 149 | [ // only show modified objects in the right column 150 | [ 151 | 'id' => 3, 152 | 'type' => 'pimcore.layout.portlets.modifiedObjects', 153 | 'config' => null 154 | ] 155 | ] 156 | ] 157 | ] 158 | ] 159 | ] 160 | ], 161 | 'Assets only' => [ 162 | 'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/webcam.svg', 163 | 'elementTree' => [ 164 | [ 165 | 'type' => 'assets', 166 | 'position' => 'left', // show the asset tree on the right side 167 | 'expanded' => false, // expand it 168 | 'hidden' => false, 169 | 'sort' => -2 170 | ] 171 | ] 172 | ] 173 | ]; 174 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/transition_notification.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.transition_notification'); 15 | pimcore.plugin.workflow.transition_notification = Class.create({ 16 | initialize: function (notificationStore, notification) { 17 | this.notificationStore = notificationStore; 18 | 19 | this.window = new Ext.window.Window({ 20 | title: t('workflow_transition_notification'), 21 | items: this.getSettings(notification), 22 | modal: true, 23 | resizeable: false, 24 | layout: 'fit', 25 | width: 600, 26 | height: 500 27 | }); 28 | 29 | this.window.show(); 30 | }, 31 | 32 | getUserCombobox: function (value) { 33 | var store = new Ext.data.Store({ 34 | proxy: { 35 | type: 'ajax', 36 | url: '/admin/user/search', 37 | reader: { 38 | type: 'json', 39 | rootProperty: 'users' 40 | } 41 | }, 42 | fields: ["id", 'name', "email", "firstname", "lastname"] 43 | }); 44 | store.load(); 45 | 46 | var resultTpl = new Ext.XTemplate( 47 | '
', 48 | '', 49 | '

{name} - {firstname} {lastname}

', 50 | '{email} ID: {id}', 51 | '
' 52 | ); 53 | 54 | return Ext.create('Ext.form.ComboBox', { 55 | store: store, 56 | name: 'notifyUsers', 57 | displayField: 'name', 58 | valueField: 'name', 59 | loadingText: t('searching'), 60 | fieldLabel: t('workflow_transition_notification_notify_users'), 61 | minChars: 1, 62 | tpl: resultTpl, 63 | triggerAction: 'all', 64 | multiSelect: true, 65 | value: value, 66 | listeners: { 67 | afterrender: function () { 68 | this.focus(true, 500); 69 | } 70 | } 71 | }); 72 | }, 73 | 74 | getRolesCombobox: function (value) { 75 | var store = new Ext.data.Store({ 76 | proxy: { 77 | type: 'ajax', 78 | url: '/admin/workflow/roles/search', 79 | reader: { 80 | type: 'json', 81 | rootProperty: 'roles' 82 | } 83 | }, 84 | fields: ["id", 'name'] 85 | }); 86 | store.load(); 87 | 88 | var resultTpl = new Ext.XTemplate( 89 | '
', 90 | '

{name}

', 91 | 'ID: {id}', 92 | '
' 93 | ); 94 | 95 | return Ext.create('Ext.form.ComboBox', { 96 | store: store, 97 | name: 'notifyRoles', 98 | displayField: 'name', 99 | valueField: 'name', 100 | loadingText: t('searching'), 101 | fieldLabel: t('workflow_transition_notification_notify_roles'), 102 | minChars: 1, 103 | tpl: resultTpl, 104 | triggerAction: 'all', 105 | multiSelect: true, 106 | value: value, 107 | listeners: { 108 | afterrender: function () { 109 | this.focus(true, 500); 110 | } 111 | } 112 | }); 113 | }, 114 | 115 | getSettings: function (notification) { 116 | this.settingsForm = new Ext.form.Panel({ 117 | bodyStyle: 'padding:20px 5px 20px 5px;', 118 | border: false, 119 | autoScroll: true, 120 | forceLayout: true, 121 | defaults: { 122 | width: '100%', 123 | labelWidth: 200 124 | }, 125 | items: [ 126 | { 127 | xtype: 'textfield', 128 | name: 'condition', 129 | value: notification.get('condition'), 130 | fieldLabel: t('workflow_transition_notification_condition'), 131 | }, 132 | this.getUserCombobox(notification.get('notifyUsers')), 133 | this.getRolesCombobox(notification.get('notifyRoles')), 134 | { 135 | xtype: 'multiselect', 136 | fieldLabel: t('workflow_transition_notification_channel_types'), 137 | name: 'channelType', 138 | store: Ext.data.ArrayStore({ 139 | fields: ['type'], 140 | data: [ 141 | ['mail'], 142 | ['pimcore_notification'], 143 | ] 144 | }), 145 | value: notification.get('channelType') ? notification.get('channelType') : 'mail', 146 | displayField: 'type', 147 | valueField: 'type', 148 | allowBlank: false 149 | }, 150 | { 151 | xtype: 'combobox', 152 | fieldLabel: t('workflow_transition_notification_mail_type'), 153 | name: 'mailType', 154 | store: Ext.data.ArrayStore({ 155 | fields: ['type'], 156 | data: [ 157 | ['template'], 158 | ['pimcore_document'], 159 | ] 160 | }), 161 | value: notification.get('mailType') ? notification.get('mailType') : 'template', 162 | displayField: 'type', 163 | valueField: 'type', 164 | allowBlank: false 165 | }, 166 | { 167 | xtype: 'textfield', 168 | fieldLabel: t('workflow_transition_notification_mail_path'), 169 | name: 'mailPath', 170 | value: notification.get('mailPath'), 171 | } 172 | ], 173 | buttons: [ 174 | { 175 | text: t('save'), 176 | handler: function (btn) { 177 | if (this.settingsForm.isValid()) { 178 | var formValues = this.settingsForm.getForm().getFieldValues(); 179 | 180 | notification.set(formValues); 181 | notification.commit(); 182 | 183 | this.notificationStore.add(notification); 184 | 185 | this.window.close(); 186 | } 187 | }.bind(this), 188 | iconCls: 'pimcore_icon_apply' 189 | } 190 | ], 191 | }); 192 | 193 | return this.settingsForm; 194 | } 195 | }); 196 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/additional_field.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.additional_field'); 15 | pimcore.plugin.workflow.additional_field = Class.create({ 16 | initialize: function (store, field) { 17 | this.store = store; 18 | 19 | this.window = new Ext.window.Window({ 20 | title: t('workflow_additional_field') + ': ' + field.getId(), 21 | items: this.getSettings(field), 22 | modal: true, 23 | resizeable: false, 24 | layout: 'fit', 25 | width: 600, 26 | height: 500 27 | }); 28 | 29 | this.window.show(); 30 | }, 31 | 32 | getFieldTypeDialog: function (type, name, settings) { 33 | this.fieldTypeSettingsData = new pimcore.object.classes.data[type](null, settings); 34 | this.fieldTypeSettingsData.datax.name = name; 35 | 36 | var layout = this.fieldTypeSettingsData.getLayout(); 37 | layout.setTitle(null); 38 | layout.setBodyStyle('border-top:none;'); 39 | 40 | this.fieldTypeSettingsData.specificPanel.setTitle(null); 41 | 42 | this.fieldTypeSettingsData.standardSettingsForm.hide(); 43 | this.fieldTypeSettingsData.layoutSettingsForm.hide(); 44 | 45 | this.fieldTypeSettings.add(layout); 46 | }, 47 | 48 | getSettings: function (field) { 49 | this.fieldTypeSettings = new Ext.Panel({}); 50 | 51 | this.settingsForm = new Ext.form.Panel({ 52 | defaults: { 53 | width: '100%', 54 | labelWidth: 200 55 | }, 56 | items: [ 57 | { 58 | xtype: 'textfield', 59 | name: 'name', 60 | value: field.get('name'), 61 | fieldLabel: t('workflow_additional_field_name'), 62 | allowBlank: false, 63 | listeners: { 64 | change: function (input, value) { 65 | if (this.fieldTypeSettingsData) { 66 | this.fieldTypeSettingsData.datax.name = value; 67 | } 68 | }.bind(this) 69 | } 70 | }, 71 | { 72 | xtype: 'combobox', 73 | itemId: 'markingStoreType', 74 | fieldLabel: t('workflow_additional_field_type'), 75 | name: 'fieldType', 76 | store: Ext.data.ArrayStore({ 77 | fields: ['type'], 78 | data: [ 79 | ['input'], 80 | ['textarea'], 81 | ['select'], 82 | ['datetime'], 83 | ['date'], 84 | ['user'], 85 | ['checkbox'] 86 | ] 87 | }), 88 | value: field.get("fieldType"), 89 | displayField: 'type', 90 | valueField: 'type', 91 | allowBlank: false, 92 | listeners: { 93 | change: function (cmb, value) { 94 | this.fieldTypeSettings.removeAll(); 95 | 96 | if (value) { 97 | this.getFieldTypeDialog(value, cmb.up('form').down('[name="name"]').getValue(), field.get('fieldTypeSettings')); 98 | } 99 | }.bind(this), 100 | afterrender: function (cmb) { 101 | if (cmb.getValue()) { 102 | this.getFieldTypeDialog(cmb.getValue(), cmb.up('form').down('[name="name"]').getValue(), field.get('fieldTypeSettings')); 103 | } 104 | }.bind(this) 105 | } 106 | }, 107 | { 108 | xtype: 'textfield', 109 | name: 'title', 110 | value: field.get('title'), 111 | fieldLabel: t('workflow_additional_field_title'), 112 | }, 113 | { 114 | xtype: 'checkbox', 115 | name: 'required', 116 | value: field.get('required'), 117 | fieldLabel: t('workflow_additional_field_required'), 118 | }, 119 | { 120 | xtype: 'textfield', 121 | name: 'setterFn', 122 | value: field.get('setterFn'), 123 | fieldLabel: t('workflow_additional_field_setter_function'), 124 | }, 125 | ] 126 | }); 127 | 128 | this.settingsPanel = new Ext.Panel({ 129 | border: false, 130 | autoScroll: true, 131 | padding: 10, 132 | defaults: { 133 | width: '100%', 134 | labelWidth: 200 135 | }, 136 | items: [ 137 | { 138 | xtype: 'fieldset', 139 | title: t('workflow_additional_field_settings'), 140 | defaults: { 141 | width: '100%', 142 | labelWidth: 200 143 | }, 144 | items: this.settingsForm 145 | }, 146 | { 147 | xtype: 'fieldset', 148 | title: t('workflow_additional_field_type_settings'), 149 | defaults: { 150 | width: '100%', 151 | labelWidth: 200 152 | }, 153 | items: this.fieldTypeSettings 154 | }, 155 | ], 156 | buttons: [ 157 | { 158 | text: t('save'), 159 | handler: function (btn) { 160 | if (this.settingsForm.isValid()) { 161 | if (!this.fieldTypeSettingsData) { 162 | return; 163 | } 164 | 165 | this.fieldTypeSettingsData.applyData(); 166 | 167 | var fieldTypeSettings = this.fieldTypeSettingsData.getData(); 168 | 169 | console.log(fieldTypeSettings); 170 | 171 | var formValues = this.settingsForm.getForm().getFieldValues(); 172 | var storeRecord = this.store.getById(formValues['id']); 173 | 174 | if (storeRecord && storeRecord !== field) { 175 | Ext.Msg.alert(t('workflow_additional_field_name'), t('workflow_additional_field_with_name_already_exists')); 176 | return; 177 | } 178 | 179 | this.store.remove(field); 180 | 181 | field.data = {}; 182 | field.set(formValues); 183 | field.set('fieldTypeSettings', fieldTypeSettings); 184 | field.commit(); 185 | 186 | this.store.add(field); 187 | 188 | this.window.close(); 189 | } 190 | }.bind(this), 191 | iconCls: 'pimcore_icon_apply' 192 | } 193 | ], 194 | }); 195 | 196 | return this.settingsPanel; 197 | } 198 | }); 199 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/place.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.place'); 15 | pimcore.plugin.workflow.place = Class.create({ 16 | initialize: function (store, place) { 17 | this.store = store; 18 | 19 | this.permissionsStore = new Ext.data.ArrayStore({ 20 | model: 'WorkflowGUI.Place.Permission', 21 | }); 22 | 23 | this.permissionsStore.setData(place.get('permissions') ? place.get('permissions') : []); 24 | 25 | this.window = new Ext.window.Window({ 26 | title: t('workflow_place') + ': ' + place.getId(), 27 | items: this.getSettings(place), 28 | modal: true, 29 | resizeable: false, 30 | layout: 'fit', 31 | width: 600, 32 | height: 500 33 | }); 34 | 35 | this.window.show(); 36 | }, 37 | 38 | getSettings: function (place) { 39 | this.permissionSettings = new Ext.Panel({ 40 | defaults: { 41 | width: '100%', 42 | labelWidth: 200 43 | }, 44 | items: [ 45 | { 46 | xtype: 'grid', 47 | margin: '0 0 15 0', 48 | store: this.permissionsStore, 49 | columns: [ 50 | { 51 | xtype: 'gridcolumn', 52 | dataIndex: 'condition', 53 | text: t('workflow_place_permission_condition'), 54 | flex: 1 55 | }, 56 | { 57 | menuDisabled: true, 58 | sortable: false, 59 | xtype: 'actioncolumn', 60 | width: 60, 61 | items: [{ 62 | iconCls: 'pimcore_icon_edit', 63 | tooltip: t('edit'), 64 | handler: function (grid, rowIndex, colIndex) { 65 | new pimcore.plugin.workflow.place_permission(this.permissionsStore, grid.store.getAt(rowIndex)); 66 | }.bind(this) 67 | }, { 68 | iconCls: 'pimcore_icon_delete', 69 | tooltip: t('delete'), 70 | handler: function (grid, rowIndex, colIndex) { 71 | grid.store.removeAt(rowIndex); 72 | }.bind(this) 73 | }] 74 | }, 75 | ], 76 | tbar: [ 77 | { 78 | text: t('add'), 79 | handler: function (btn) { 80 | var record = new WorkflowGUI.Place.Permission(); 81 | 82 | new pimcore.plugin.workflow.place_permission(this.permissionsStore, record); 83 | }.bind(this), 84 | iconCls: 'pimcore_icon_add' 85 | } 86 | ] 87 | } 88 | ] 89 | }); 90 | 91 | this.settingsForm = new Ext.form.Panel({ 92 | bodyStyle: 'padding:20px 5px 20px 5px;', 93 | border: false, 94 | autoScroll: true, 95 | forceLayout: true, 96 | fieldDefaults: { 97 | labelWidth: 150 98 | }, 99 | items: [ 100 | { 101 | xtype: 'textfield', 102 | name: 'id', 103 | value: place.getId(), 104 | fieldLabel: t('workflow_place_id'), 105 | allowBlank: false, 106 | regex: /^[a-zA-Z_]+$/ 107 | }, 108 | { 109 | xtype: 'textfield', 110 | name: 'label', 111 | value: place.get('label'), 112 | fieldLabel: t('workflow_place_label'), 113 | }, 114 | { 115 | xtype: 'textfield', 116 | name: 'title', 117 | value: place.get('title'), 118 | fieldLabel: t('workflow_place_title'), 119 | }, 120 | { 121 | xtype: 'colorfield', 122 | name: 'color', 123 | value: (place.get('color')) ? place.get('color') : 'CCCCCC', 124 | fieldLabel: t('workflow_place_color'), 125 | }, 126 | { 127 | xtype: 'checkbox', 128 | name: 'colorInverted', 129 | value: place.get('colorInverted'), 130 | fieldLabel: t('workflow_place_color_inverted'), 131 | }, 132 | { 133 | xtype: 'checkbox', 134 | name: 'visibleInHeader', 135 | value: place.get('visibleInHeader'), 136 | fieldLabel: t('workflow_place_visible_in_header'), 137 | }, 138 | this.permissionSettings 139 | ] 140 | }); 141 | 142 | 143 | this.settingsPanel = new Ext.Panel({ 144 | border: false, 145 | autoScroll: true, 146 | padding: 10, 147 | defaults: { 148 | width: '100%', 149 | labelWidth: 200 150 | }, 151 | items: [ 152 | { 153 | xtype: 'fieldset', 154 | title: t('workflow_place_settings'), 155 | defaults: { 156 | width: '100%', 157 | labelWidth: 200 158 | }, 159 | items: this.settingsForm 160 | }, 161 | { 162 | xtype: 'fieldset', 163 | title: t('workflow_place_permissions'), 164 | defaults: { 165 | width: '100%', 166 | labelWidth: 200 167 | }, 168 | items: this.permissionSettings 169 | } 170 | ], 171 | buttons: [ 172 | { 173 | text: t('save'), 174 | handler: function (btn) { 175 | if (this.settingsForm.isValid()) { 176 | var formValues = this.settingsForm.getForm().getFieldValues(); 177 | var storeRecord = this.store.getById(formValues['id']); 178 | var permissions = this.permissionsStore.getRange(); 179 | 180 | if (storeRecord && storeRecord !== place) { 181 | Ext.Msg.alert(t('workflow_place_id'), t('workflow_place_with_id_already_exists')); 182 | return; 183 | } 184 | 185 | permissions = permissions.map(function (record) { 186 | var data = record.data; 187 | 188 | delete data['id']; 189 | 190 | return data; 191 | }); 192 | 193 | if (formValues.color) { 194 | formValues.color = '#' + formValues.color; 195 | } 196 | 197 | place.set('permissions', permissions); 198 | place.set(formValues); 199 | place.commit(); 200 | 201 | this.window.close(); 202 | } 203 | }.bind(this), 204 | iconCls: 'pimcore_icon_apply' 205 | } 206 | ], 207 | }); 208 | 209 | return this.settingsPanel; 210 | } 211 | }); 212 | -------------------------------------------------------------------------------- /config/pimcore/customviews.example.php: -------------------------------------------------------------------------------- 1 | [ 5 | [ 6 | 'treetype' => 'object', // element type is "object" 7 | 'name' => 'Articles', // display name 8 | 'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/reading.svg', // tree icon 9 | 'id' => 1, // unique (!!!) custom view ID 10 | 'rootfolder' => '/blog', // root node 11 | 'showroot' => false, // show root node or just children? 12 | 'classes' => '', // allowed classes to add; use class ids; comma-separated 13 | 'position' => 'right', // left or right accordion 14 | 'sort' => '1', // sort priority. lower values are shown first (prio for standard trees is -3 docs,-2 assets,-1 objects) 15 | 'expanded' => true, // tree is expanded by default (there can be only one expanded tree on each side) 16 | 'having' => "o_type = \"folder\" || o5.title NOT LIKE '%magnis%'", // SQL having clause 17 | 'joins' => [ // Joins in Zend_DB_Select-like syntax 18 | [ 19 | 'type' => 'left', 20 | 'name' => ['o5' => 'object_localized_5_en'], 21 | 'condition' => 'objects.o_id = o5.oo_id', 22 | 'columns' => ['o5' => 'title'] 23 | ] 24 | ], 25 | 'where' => '', // SQL where condition 26 | 'treeContextMenu' => [ 27 | 'object' => [ 28 | 'items' => [ 29 | 'add' => 0, // hide "Add Object" , "Add Variant" 30 | 'addFolder' => 0, // hide "Add Folder" 31 | 'importCsv' => 0, // hide "Import From CSV" 32 | 'paste' => 0, // hide "Paste" 33 | 'copy' => 0, // hide "Copy" 34 | 'cut' => 0, // hide "Cut" 35 | 'publish' => 0, // hide "Publish" 36 | 'unpublish' => 0, // hide "Unpublish" 37 | 'delete' => 1, // show "Delete" (redundant as this is the default) 38 | 'rename' => 0, // hide "Rename" 39 | 'searchAndMove' => 0, // hide "Search And Move" 40 | 'lock' => 0, // hide "Lock" 41 | 'unlock' => 0, // hide "Unlock" 42 | 'lockAndPropagate' => 0, // hide "Lock and Propagate" 43 | 'unlockAndPropagete' => 0, // hide "Unlock and Propagate" 44 | 'reload' => 0, // hide reload 45 | 'changeChildrenSortBy' => 0 // hide "Sort Children By" 46 | ] 47 | ] 48 | ] 49 | ], 50 | [ 51 | 'treetype' => 'document', // document view 52 | 'name' => 'Basic Examples', 53 | 'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/text.svg', 54 | 'id' => 2, // again, unique ID 55 | 'rootfolder' => '/en/basic-examples', 56 | 'showroot' => true, 57 | 'position' => 'right', // show it in the right accordion 58 | 'sort' => '-10', 59 | 'expanded' => true, // expand the tree panel 60 | 'treeContextMenu' => [ 61 | 'document' => [ 62 | 'items' => [ 63 | 'add' => 0, // hide all the "Add *" stuff 64 | 'addSnippet' => 0, // hide "Add Snippet" 65 | 'addLink' => 0, // hide "Add Link" 66 | 'addEmail' => 0, // hide "Add Email" 67 | 'addNewsletter' => 0, // hide "Add Newsletter" 68 | 'addHardlink' => 0, // hide "Add Hardlink" 69 | 'addFolder' => 0, // hide "Add Folder" 70 | 'paste' => 0, // hide all the "Paste" options 71 | 'pasteCut' => 0, // hide "Paste Cut element" 72 | 'copy' => 0, // hide "Copy" 73 | 'cut' => 0, // hide "Cut" 74 | 'rename' => 0, // hide "Rename" 75 | 'unpublish' => 0, // hide "Unpublish" 76 | 'publish' => 0, // hide "Publish" 77 | 'delete' => 0, // hide "Delete" 78 | 'open' => 0, // hide "Open" 79 | 'convert' => 0, // hide "Convert" 80 | 'searchAndMove' => 0, // hide "Search And Move" 81 | 'useAsSite' => 0, // hide "Use As Site" 82 | 'editSite' => 0, // hide "Edit Site" 83 | 'removeSite' => 0, // hide "Remove Site" 84 | 'lock' => 0, // hide "Lock" 85 | 'unlock' => 0, // hide "Unlock" 86 | 'lockAndPropagate' => 0, // hide "UnlockAndPropagate" 87 | 'unlockAndPropagate' => 0, // hide "Lock And Propagate" 88 | 'reload' => 1 // show "Reload" (redundant, visible by default anyway) 89 | ] 90 | ] 91 | ] 92 | ], 93 | [ 94 | 'treetype' => 'asset', // asset view 95 | 'name' => 'Panama', 96 | 'icon' => '/bundles/pimcoreadmin/img/flat-color-icons/stack_of_photos.svg', 97 | 'id' => 3, 98 | 'rootfolder' => '/examples/panama', 99 | 'showroot' => true, 100 | 'position' => 'right', 101 | 'sort' => '-15', // show in on the top 102 | 'expanded' => false, 103 | 'treeContextMenu' => [ 104 | 'asset' => [ 105 | 'items' => [ 106 | 'add' => [ 107 | // "hidden" => 1, // hide "Add asset" menu (including subentries) 108 | 'items' => [ 109 | 'upload' => 0, // hide "Upload" 110 | // "uploadCompatibility" => 0, // hide "Upload Compatibility Mode" 111 | // "uploadZip" => 0, // hide "Upload ZIP Archive" 112 | // "importFromServer" => 0, // don't show "Import from Server" 113 | 'uploadFromUrl' => 0 // hide "Upload From URL" 114 | ] 115 | ], 116 | 'addFolder' => 1, // show (!) "Add Folder" (shown by default anyway) 117 | 'rename' => 0, // hide "Rename" 118 | // "copy" => 0, // hide "Copy" 119 | // "cut" => 0, // hide "Cut" 120 | 'paste' => 0, // hide "Paste" 121 | 'pasteCut' => 0, // hide "Paste cut element" 122 | 'delete' => 0, // hide "Delete" 123 | 'searchAndMove' => 0, // hide "Search And Move" 124 | 'lock' => 0, // hide "Lock" 125 | 'unlock' => 0, // hide "Unlock" 126 | 'lockAndPropagate' => 0, // hide "Lock and propagate" 127 | 'unlockAndPropagate' => 0, // hide "Unlock and propagate" 128 | 'reload' => [ // show reload (shown by default anyway) 129 | 'hidden' => false 130 | ] 131 | ] 132 | ] 133 | ] 134 | ] 135 | ] 136 | ]; 137 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/global_action.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.global_action'); 15 | pimcore.plugin.workflow.global_action = Class.create({ 16 | initialize: function (store, placesStore, globalAction) { 17 | this.store = store; 18 | this.placesStore = placesStore; 19 | 20 | this.additionalFieldsStore = new Ext.data.ArrayStore({ 21 | model: 'WorkflowGUI.AdditionalField', 22 | }); 23 | 24 | this.additionalFieldsStore.setData(globalAction.get('additionalFields')); 25 | 26 | this.window = new Ext.window.Window({ 27 | title: t('workflow_global_action') + ': ' + globalAction.getId(), 28 | items: this.getSettings(globalAction), 29 | modal: true, 30 | resizeable: false, 31 | layout: 'fit', 32 | width: 600, 33 | height: 500 34 | }); 35 | 36 | this.window.show(); 37 | }, 38 | 39 | getSettings: function (globalAction) { 40 | var notes = globalAction.get('notes') ? globalAction.get('notes') : {}; 41 | 42 | this.additionalFieldsSettings = new Ext.Panel({ 43 | defaults: { 44 | width: '100%', 45 | labelWidth: 200 46 | }, 47 | items: [ 48 | { 49 | xtype: 'grid', 50 | margin: '0 0 15 0', 51 | title: t('workflow_additional_fields'), 52 | store: this.additionalFieldsStore, 53 | columns: [ 54 | { 55 | xtype: 'gridcolumn', 56 | dataIndex: 'name', 57 | text: t('workflow_additional_field_name'), 58 | flex: 1 59 | }, 60 | { 61 | menuDisabled: true, 62 | sortable: false, 63 | xtype: 'actioncolumn', 64 | width: 60, 65 | items: [{ 66 | iconCls: 'pimcore_icon_edit', 67 | tooltip: t('edit'), 68 | handler: function (grid, rowIndex, colIndex) { 69 | new pimcore.plugin.workflow.additional_field(this.additionalFieldsStore, grid.store.getAt(rowIndex)); 70 | }.bind(this) 71 | }, { 72 | iconCls: 'pimcore_icon_delete', 73 | tooltip: t('delete'), 74 | handler: function (grid, rowIndex, colIndex) { 75 | grid.store.removeAt(rowIndex); 76 | }.bind(this) 77 | }] 78 | }, 79 | ], 80 | tbar: [ 81 | { 82 | text: t('add'), 83 | handler: function (btn) { 84 | var record = new WorkflowGUI.AdditionalField(); 85 | 86 | new pimcore.plugin.workflow.additional_field(this.additionalFieldsStore, record); 87 | }.bind(this), 88 | iconCls: 'pimcore_icon_add' 89 | } 90 | ] 91 | } 92 | ] 93 | }); 94 | 95 | this.notesForm = new Ext.form.Panel({ 96 | defaults: { 97 | width: '100%', 98 | labelWidth: 200 99 | }, 100 | items: [ 101 | { 102 | xtype: 'checkbox', 103 | name: 'commentEnabled', 104 | value: notes.hasOwnProperty('commentEnabled') ? notes.commentEnabled : false, 105 | fieldLabel: t('workflow_global_action_note_comment_enabled'), 106 | allowBlank: false, 107 | listeners: { 108 | change: function (checkbox, newValue) { 109 | if (newValue) { 110 | this.notesForm.down('#innerNotes').show(); 111 | this.notesForm.down('#innerNotes').enable(); 112 | } else { 113 | this.notesForm.down('#innerNotes').hide(); 114 | this.notesForm.down('#innerNotes').disable(); 115 | } 116 | }.bind(this) 117 | } 118 | }, 119 | { 120 | xtype: 'container', 121 | itemId: 'innerNotes', 122 | defaults: { 123 | width: '100%', 124 | labelWidth: 200 125 | }, 126 | hidden: !(notes.hasOwnProperty('commentEnabled') ? notes.commentEnabled : false), 127 | disabled: !(notes.hasOwnProperty('commentEnabled') ? notes.commentEnabled : false), 128 | items: [ 129 | { 130 | xtype: 'checkbox', 131 | name: 'commentRequired', 132 | value: notes.hasOwnProperty('commentRequired') ? notes.commentRequired : false, 133 | fieldLabel: t('workflow_global_action_note_comment_required'), 134 | allowBlank: false, 135 | }, 136 | { 137 | xtype: 'textfield', 138 | name: 'commentSetterFn', 139 | value: notes.hasOwnProperty('commentSetterFn') ? notes.commentSetterFn : '', 140 | fieldLabel: t('workflow_global_action_note_comment_setter') 141 | }, 142 | { 143 | xtype: 'textfield', 144 | name: 'commentGetterFn', 145 | value: notes.hasOwnProperty('commentGetterFn') ? notes.commentGetterFn : '', 146 | fieldLabel: t('workflow_global_action_note_comment_getter') 147 | }, 148 | { 149 | xtype: 'textfield', 150 | name: 'type', 151 | value: notes.hasOwnProperty('type') ? notes.type : '', 152 | fieldLabel: t('workflow_global_action_note_type') 153 | }, 154 | { 155 | xtype: 'textfield', 156 | name: 'title', 157 | value: notes.hasOwnProperty('title') ? notes.title : '', 158 | fieldLabel: t('workflow_global_action_note_title') 159 | }, 160 | this.additionalFieldsSettings 161 | ] 162 | } 163 | ] 164 | }); 165 | 166 | this.settingsForm = new Ext.form.Panel({ 167 | defaults: { 168 | width: '100%', 169 | labelWidth: 200 170 | }, 171 | items: [ 172 | { 173 | xtype: 'textfield', 174 | name: 'id', 175 | value: globalAction.getId(), 176 | fieldLabel: t('workflow_global_action_id'), 177 | allowBlank: false, 178 | regex: /^[a-zA-Z_]+$/ 179 | }, 180 | { 181 | xtype: 'textfield', 182 | name: 'iconClass', 183 | value: globalAction.get('iconClass'), 184 | fieldLabel: t('workflow_global_action_icon_class'), 185 | }, 186 | { 187 | xtype: 'textfield', 188 | name: 'guard', 189 | value: globalAction.get('guard'), 190 | fieldLabel: t('workflow_global_action_guard'), 191 | }, 192 | { 193 | xtype: 'combobox', 194 | name: 'to', 195 | fieldLabel: t('workflow_global_action_to'), 196 | store: this.placesStore, 197 | value: globalAction.get('to'), 198 | displayField: 'label', 199 | valueField: 'id', 200 | multiSelect: true, 201 | queryMode: 'local', 202 | }, 203 | ] 204 | }); 205 | 206 | this.settingsPanel = new Ext.Panel({ 207 | border: false, 208 | autoScroll: true, 209 | padding: 10, 210 | defaults: { 211 | width: '100%', 212 | labelWidth: 200 213 | }, 214 | items: [ 215 | { 216 | xtype: 'fieldset', 217 | title: t('workflow_global_action_settings'), 218 | defaults: { 219 | width: '100%', 220 | labelWidth: 200 221 | }, 222 | items: this.settingsForm 223 | }, 224 | { 225 | xtype: 'fieldset', 226 | title: t('workflow_global_action_notes'), 227 | defaults: { 228 | width: '100%', 229 | labelWidth: 200 230 | }, 231 | items: this.notesForm 232 | }, 233 | ], 234 | buttons: [ 235 | { 236 | text: t('save'), 237 | handler: function (btn) { 238 | if (this.settingsForm.isValid()) { 239 | var formValues = this.settingsForm.getForm().getFieldValues(); 240 | var notesValues = this.notesForm.getForm().getFieldValues(); 241 | var storeRecord = this.store.getById(formValues['id']); 242 | var additionalFields = this.additionalFieldsStore.getRange(); 243 | 244 | if (storeRecord && storeRecord !== globalAction) { 245 | Ext.Msg.alert(t('workflow_global_action_id'), t('workflow_global_action_with_id_already_exists')); 246 | return; 247 | } 248 | 249 | additionalFields = additionalFields.map(function(record) { 250 | var data = record.data; 251 | 252 | delete data['id']; 253 | 254 | return data; 255 | }); 256 | 257 | this.store.remove(globalAction); 258 | 259 | if (!formValues['guard']) { 260 | delete formValues['guard']; 261 | } 262 | 263 | notesValues['additionalFields'] = additionalFields; 264 | 265 | globalAction.data = {}; 266 | globalAction.set(formValues); 267 | globalAction.set('notes', notesValues); 268 | globalAction.commit(); 269 | 270 | this.store.add(globalAction); 271 | 272 | this.window.close(); 273 | } 274 | }.bind(this), 275 | iconCls: 'pimcore_icon_apply' 276 | } 277 | ], 278 | }); 279 | 280 | return this.settingsPanel; 281 | } 282 | }); 283 | -------------------------------------------------------------------------------- /src/WorkflowGui/Controller/WorkflowController.php: -------------------------------------------------------------------------------- 1 | isGrantedOr403(); 52 | 53 | $workflows = $this->repository->findAll(); 54 | 55 | $results = []; 56 | foreach ($workflows as $id => $workflow) { 57 | $results[] = [ 58 | 'id' => $id, 59 | 'label' => $workflow['label'], 60 | ]; 61 | } 62 | 63 | return $this->json($results); 64 | } 65 | 66 | public function getAction(Request $request): JsonResponse 67 | { 68 | $this->isGrantedOr403(); 69 | 70 | $id = $request->get('id'); 71 | $workflow = $this->repository->find($id); 72 | 73 | if (!$workflow) { 74 | throw new NotFoundHttpException(); 75 | } 76 | 77 | return $this->json(['success' => true, 'data' => $workflow]); 78 | } 79 | 80 | public function cloneAction(Request $request): JsonResponse 81 | { 82 | $this->isGrantedOr403(); 83 | 84 | $id = $request->get('id'); 85 | $name = $request->get('name'); 86 | $workflow = $this->repository->find($id); 87 | $workflowByName = $this->repository->find($name); 88 | 89 | if (!$workflow) { 90 | throw new NotFoundHttpException(); 91 | } 92 | 93 | if ($workflowByName) { 94 | return $this->json([ 95 | 'success' => false, 96 | 'message' => $this->translator->trans('workflow_gui_workflow_with_name_already_exists'), 97 | ]); 98 | } 99 | 100 | $this->repository->updateConfig(function (array $workflows) use ($id, $name): array { 101 | $workflows[$name] = $workflows[$id]; 102 | return $workflows; 103 | }); 104 | $this->cacheClearer->clear($this->kernel->getEnvironment()); 105 | 106 | return $this->json(['success' => true, 'id' => $name]); 107 | } 108 | 109 | public function saveAction(Request $request): JsonResponse 110 | { 111 | $this->isGrantedOr403(); 112 | 113 | $id = $request->get('id'); 114 | $newId = $request->get('newId'); 115 | $newConfiguration = $this->decodeJson($request->get('data')); 116 | 117 | $newConfiguration = $this->sanitizeConfiguration($newConfiguration); 118 | $testConfig = $newConfiguration; 119 | 120 | //Test Configuration 121 | $configuration = new Configuration(); 122 | $processor = new Processor(); 123 | 124 | try { 125 | $processor->processConfiguration($configuration, [ 126 | 'pimcore' => 127 | [ 128 | 'workflows' => [ 129 | $newId => $testConfig, 130 | ], 131 | ], 132 | ] 133 | ); 134 | } catch (\Throwable $ex) { 135 | return $this->json(['success' => false, 'message' => $ex->getMessage()]); 136 | } 137 | 138 | $this->repository->updateConfig(function (array $workflows) use ($id, $newId, $newConfiguration): array { 139 | if (isset($workflows[$id])) { 140 | unset($workflows[$id]); 141 | } 142 | 143 | $workflows[$newId] = $newConfiguration; 144 | return $workflows; 145 | }); 146 | $this->cacheClearer->clear($this->kernel->getEnvironment()); 147 | 148 | $workflow = $this->repository->find($id); 149 | 150 | return $this->json(['success' => true, 'data' => $workflow]); 151 | } 152 | 153 | public function deleteAction(Request $request): JsonResponse 154 | { 155 | $this->isGrantedOr403(); 156 | 157 | $id = $request->get('id'); 158 | 159 | $this->repository->updateConfig(function (array $workflows) use ($id): array { 160 | if (isset($workflows[$id])) { 161 | unset($workflows[$id]); 162 | } 163 | return $workflows; 164 | }); 165 | $this->cacheClearer->clear($this->kernel->getEnvironment()); 166 | 167 | return $this->json(['success' => true]); 168 | } 169 | 170 | public function searchRolesAction(Request $request): JsonResponse 171 | { 172 | $this->isGrantedOr403(); 173 | 174 | $q = '%'.$request->get('query').'%'; 175 | 176 | $list = new User\Role\Listing(); 177 | $list->setCondition('name LIKE ?', [$q]); 178 | $list->setOrder('ASC'); 179 | $list->setOrderKey('name'); 180 | $list->load(); 181 | 182 | $roles = []; 183 | if (is_array($list->getRoles())) { 184 | 185 | /** @var User\Role $role */ 186 | foreach ($list->getRoles() as $role) { 187 | if ($role instanceof User\Role && $role->getId()) { 188 | $roles[] = [ 189 | 'id' => $role->getId(), 190 | 'name' => $role->getName(), 191 | ]; 192 | } 193 | } 194 | } 195 | 196 | return $this->jsonResponse([ 197 | 'success' => true, 198 | 'roles' => $roles, 199 | ]); 200 | } 201 | 202 | protected function isGrantedOr403(): void 203 | { 204 | $user = $this->getPimcoreUser(); 205 | 206 | if (null === $user) { 207 | throw new AccessDeniedException(); 208 | } 209 | 210 | if ($user->isAllowed('workflow_gui')) { 211 | return; 212 | } 213 | 214 | throw new AccessDeniedException(); 215 | } 216 | 217 | protected function sanitizeConfiguration($configuration): array 218 | { 219 | if (isset($configuration['places'])) { 220 | foreach ($configuration['places'] as $placeKey => &$placeConfig) { 221 | if (isset($placeConfig['color'])) { 222 | if (substr($placeConfig['color'], 0, 1) !== '#') { 223 | $placeConfig['color'] = '#'.$placeConfig['color']; 224 | } 225 | } 226 | foreach ($placeConfig as $placeConfigKey => $value) { 227 | if (!$value) { 228 | unset($placeConfig[$placeConfigKey]); 229 | } 230 | } 231 | 232 | if (isset($placeConfig['permissions'])) { 233 | foreach ($placeConfig['permissions'] as $permissionIndex => &$permissionConfig) { 234 | foreach ($permissionConfig as $permissionKey => $permissionValue) { 235 | if ($permissionValue === null || ($permissionKey === 'condition' && !$permissionValue)) { 236 | unset($permissionConfig[$permissionKey]); 237 | } 238 | } 239 | 240 | if (count($permissionConfig) === 0) { 241 | unset ($placeConfig['permissions'][$permissionIndex]); 242 | } 243 | } 244 | 245 | if (count($placeConfig['permissions']) === 0) { 246 | unset($placeConfig['permissions']); 247 | } 248 | } 249 | } 250 | } 251 | 252 | if (isset($configuration['transitions'])) { 253 | foreach ($configuration['transitions'] as $transitionKey => &$transitionConfig) { 254 | if (isset($transitionConfig['options'])) { 255 | foreach ($transitionConfig['options'] as $transitionOptionConfigKey => $value) { 256 | if (!$value) { 257 | unset($transitionConfig['options'][$transitionOptionConfigKey]); 258 | } 259 | } 260 | 261 | if (isset($transitionConfig['options']['notes']['additionalFields'])) { 262 | foreach ($transitionConfig['options']['notes']['additionalFields'] as &$additionalField) { 263 | if (!$additionalField['setterFn']) { 264 | unset ($additionalField['setterFn']); 265 | } 266 | 267 | if (!$additionalField['title']) { 268 | unset ($additionalField['title']); 269 | } 270 | 271 | if (!$additionalField['required']) { 272 | unset ($additionalField['required']); 273 | } 274 | } 275 | } 276 | } 277 | } 278 | } 279 | 280 | return $configuration; 281 | } 282 | 283 | public function visualizeAction(Request $request): Response 284 | { 285 | $this->isGrantedOr403(); 286 | 287 | try { 288 | return $this->render( 289 | '@WorkflowGui/Workflow/visualize.html.twig', 290 | [ 291 | 'image' => $this->getVisualization($request->get('workflow'), 'svg'), 292 | ] 293 | ); 294 | } catch (\Throwable $e) { 295 | return new Response($e->getMessage()); 296 | } 297 | } 298 | 299 | public function visualizeImageAction(Request $request): Response 300 | { 301 | $this->isGrantedOr403(); 302 | 303 | try { 304 | $image = $this->getVisualization($request->get('workflow'), 'png'); 305 | 306 | $response = new Response(); 307 | 308 | // Set headers 309 | $response->headers->set('Cache-Control', 'private'); 310 | $response->headers->set('Content-type', 'image/png'); 311 | $response->headers->set('Content-length', strlen($image)); 312 | 313 | // Send headers before outputting anything 314 | $response->sendHeaders(); 315 | 316 | $response->setContent($image); 317 | 318 | return $response; 319 | } catch (\Throwable $e) { 320 | return new Response($e->getMessage()); 321 | } 322 | } 323 | 324 | private function getVisualization($workflow, $format): string 325 | { 326 | $php = Console::getExecutable('php'); 327 | $dot = Console::getExecutable('dot'); 328 | 329 | if (!$php) { 330 | throw new \InvalidArgumentException($this->translator->trans('workflow_cmd_not_found', ['php'], 'admin')); 331 | } 332 | 333 | if (!$dot) { 334 | throw new \InvalidArgumentException($this->translator->trans('workflow_cmd_not_found', ['dot'], 'admin')); 335 | } 336 | 337 | $workflowRepository = $this->repository->find($workflow); 338 | 339 | if ($workflowRepository === null) { 340 | throw new \InvalidArgumentException($this->translator->trans('workflow_gui_not_found', [], 'admin')); 341 | } 342 | 343 | if (!$workflowRepository['enabled'] ?? false) { 344 | throw new \InvalidArgumentException($this->translator->trans('workflow_gui_enable_message', [], 'admin')); 345 | } 346 | 347 | $cmd = $php.' '.PIMCORE_PROJECT_ROOT.'/bin/console --env="${:arg_environment}" pimcore:workflow:dump "${:arg_workflow}" | '.$dot.' -T"${:arg_format}"'; 348 | 349 | $process = Process::fromShellCommandline($cmd); 350 | $process->run(null, [ 351 | 'arg_environment' => $this->kernel->getEnvironment(), 352 | 'arg_workflow' => $workflow, 353 | 'arg_format' => $format, 354 | ]); 355 | 356 | return $process->getOutput(); 357 | } 358 | } 359 | -------------------------------------------------------------------------------- /src/WorkflowGui/Resources/public/js/pimcore/workflow/transition.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Workflow Pimcore Plugin 3 | * 4 | * LICENSE 5 | * 6 | * This source file is subject to the GNU General Public License version 3 (GPLv3) 7 | * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt 8 | * files that are distributed with this source code. 9 | * 10 | * @copyright Copyright (c) 2018-2019 Youwe (https://www.youwe.nl) 11 | * @license https://github.com/YouweGit/pimcore-workflow-gui/blob/master/LICENSE.md GNU General Public License version 3 (GPLv3) 12 | */ 13 | 14 | pimcore.registerNS('pimcore.plugin.workflow.transition'); 15 | pimcore.plugin.workflow.transition = Class.create({ 16 | initialize: function (store, placesStore, transition) { 17 | var options = transition.get('options') ? transition.get('options') : {}; 18 | 19 | this.store = store; 20 | this.placesStore = placesStore; 21 | 22 | this.notificationStore = new Ext.data.ArrayStore({ 23 | model: 'WorkflowGUI.Transition.Notification', 24 | }); 25 | 26 | this.notificationStore.setData(options.hasOwnProperty('notificationSettings') ? options.notificationSettings : []); 27 | 28 | this.additionalFieldsStore = new Ext.data.ArrayStore({ 29 | model: 'WorkflowGUI.AdditionalField', 30 | }); 31 | 32 | this.additionalFieldsStore.setData(options.hasOwnProperty('notes') && options.notes.hasOwnProperty('additionalFields') ? options.notes.additionalFields : []); 33 | 34 | this.window = new Ext.window.Window({ 35 | title: t('workflow_transition') + ': ' + transition.getId(), 36 | items: this.getSettings(transition), 37 | modal: true, 38 | resizeable: false, 39 | layout: 'fit', 40 | width: 600, 41 | height: 500 42 | }); 43 | 44 | this.window.show(); 45 | }, 46 | 47 | getSettings: function (transition) { 48 | var options = transition.get('options') ? transition.get('options') : {}; 49 | var optionNotes = options.hasOwnProperty('notes') ? options.notes : {}; 50 | 51 | this.optionsForm = new Ext.form.Panel({ 52 | defaults: { 53 | width: '100%', 54 | labelWidth: 200 55 | }, 56 | items: [ 57 | { 58 | xtype: 'textfield', 59 | name: 'label', 60 | value: options.hasOwnProperty('label') ? options.label : '', 61 | fieldLabel: t('workflow_transition_label'), 62 | allowBlank: false, 63 | }, 64 | { 65 | xtype: 'textfield', 66 | name: 'iconClass', 67 | value: options.hasOwnProperty('iconClass') ? options.iconClass : '', 68 | fieldLabel: t('workflow_transition_icon_class'), 69 | }, 70 | { 71 | xtype: 'combobox', 72 | fieldLabel: t('workflow_transition_change_publish_state'), 73 | name: 'changePublishedState', 74 | store: Ext.data.ArrayStore({ 75 | fields: ['type'], 76 | data: [ 77 | ['no_change'], 78 | ['save_version'], 79 | ['force_unpublished'], 80 | ['force_published'], 81 | ] 82 | }), 83 | value: options.hasOwnProperty('changePublishedState') ? options.changePublishedState : 'no_change', 84 | displayField: 'type', 85 | valueField: 'type', 86 | allowBlank: false 87 | }, 88 | ] 89 | }); 90 | 91 | 92 | this.additionalFieldsSettings = new Ext.Panel({ 93 | defaults: { 94 | width: '100%', 95 | labelWidth: 200 96 | }, 97 | items: [ 98 | { 99 | xtype: 'grid', 100 | margin: '0 0 15 0', 101 | title: t('workflow_additional_fields'), 102 | store: this.additionalFieldsStore, 103 | columns: [ 104 | { 105 | xtype: 'gridcolumn', 106 | dataIndex: 'name', 107 | text: t('workflow_additional_field_name'), 108 | flex: 1, 109 | regex: /[^A-Za-z0-9_]+/, 110 | }, 111 | { 112 | menuDisabled: true, 113 | sortable: false, 114 | xtype: 'actioncolumn', 115 | width: 60, 116 | items: [{ 117 | iconCls: 'pimcore_icon_edit', 118 | tooltip: t('edit'), 119 | handler: function (grid, rowIndex, colIndex) { 120 | new pimcore.plugin.workflow.additional_field(this.additionalFieldsStore, grid.store.getAt(rowIndex)); 121 | }.bind(this) 122 | }, { 123 | iconCls: 'pimcore_icon_delete', 124 | tooltip: t('delete'), 125 | handler: function (grid, rowIndex, colIndex) { 126 | grid.store.removeAt(rowIndex); 127 | }.bind(this) 128 | }] 129 | }, 130 | ], 131 | tbar: [ 132 | { 133 | text: t('add'), 134 | handler: function (btn) { 135 | var record = new WorkflowGUI.AdditionalField(); 136 | 137 | new pimcore.plugin.workflow.additional_field(this.additionalFieldsStore, record); 138 | }.bind(this), 139 | iconCls: 'pimcore_icon_add' 140 | } 141 | ] 142 | } 143 | ] 144 | }); 145 | 146 | this.notesForm = new Ext.form.Panel({ 147 | defaults: { 148 | width: '100%', 149 | labelWidth: 200 150 | }, 151 | items: [ 152 | { 153 | xtype: 'checkbox', 154 | name: 'commentEnabled', 155 | value: optionNotes.hasOwnProperty('commentEnabled') ? optionNotes.commentEnabled : false, 156 | fieldLabel: t('workflow_transition_note_comment_enabled'), 157 | allowBlank: false, 158 | listeners: { 159 | change: function (checkbox, newValue) { 160 | if (newValue) { 161 | this.notesForm.down('#innerNotes').show(); 162 | this.notesForm.down('#innerNotes').enable(); 163 | } else { 164 | this.notesForm.down('#innerNotes').hide(); 165 | this.notesForm.down('#innerNotes').disable(); 166 | } 167 | }.bind(this) 168 | } 169 | }, 170 | { 171 | xtype: 'container', 172 | itemId: 'innerNotes', 173 | defaults: { 174 | width: '100%', 175 | labelWidth: 200 176 | }, 177 | hidden: !(optionNotes.hasOwnProperty('commentEnabled') ? optionNotes.commentEnabled : false), 178 | disabled: !(optionNotes.hasOwnProperty('commentEnabled') ? optionNotes.commentEnabled : false), 179 | items: [ 180 | { 181 | xtype: 'checkbox', 182 | name: 'commentRequired', 183 | value: optionNotes.hasOwnProperty('commentRequired') ? optionNotes.commentRequired : false, 184 | fieldLabel: t('workflow_transition_note_comment_required'), 185 | allowBlank: false, 186 | }, 187 | { 188 | xtype: 'textfield', 189 | name: 'commentSetterFn', 190 | value: optionNotes.hasOwnProperty('commentSetterFn') ? optionNotes.commentSetterFn : '', 191 | fieldLabel: t('workflow_transition_note_comment_setter') 192 | }, 193 | { 194 | xtype: 'textfield', 195 | name: 'commentGetterFn', 196 | value: optionNotes.hasOwnProperty('commentGetterFn') ? optionNotes.commentGetterFn : '', 197 | fieldLabel: t('workflow_transition_note_comment_getter') 198 | }, 199 | { 200 | xtype: 'textfield', 201 | name: 'type', 202 | value: optionNotes.hasOwnProperty('type') ? optionNotes.type : '', 203 | fieldLabel: t('workflow_transition_note_type') 204 | }, 205 | { 206 | xtype: 'textfield', 207 | name: 'title', 208 | value: optionNotes.hasOwnProperty('title') ? optionNotes.title : '', 209 | fieldLabel: t('workflow_transition_note_title') 210 | }, 211 | this.additionalFieldsSettings 212 | ] 213 | } 214 | ] 215 | }); 216 | 217 | this.settingsForm = new Ext.form.Panel({ 218 | defaults: { 219 | width: '100%', 220 | labelWidth: 200 221 | }, 222 | items: [ 223 | { 224 | xtype: 'textfield', 225 | name: 'id', 226 | value: transition.getId(), 227 | fieldLabel: t('workflow_transition_id'), 228 | allowBlank: false, 229 | regex: /^[a-zA-Z_]+$/ 230 | }, 231 | 232 | { 233 | xtype: 'textfield', 234 | name: 'guard', 235 | value: transition.get('guard'), 236 | fieldLabel: t('workflow_transition_guard'), 237 | }, 238 | { 239 | xtype: 'combobox', 240 | name: 'from', 241 | fieldLabel: t('workflow_transition_from'), 242 | store: this.placesStore, 243 | value: transition.get('from'), 244 | displayField: 'label', 245 | valueField: 'id', 246 | multiSelect: true, 247 | queryMode: 'local', 248 | }, 249 | { 250 | xtype: 'combobox', 251 | name: 'to', 252 | fieldLabel: t('workflow_transition_to'), 253 | store: this.placesStore, 254 | value: transition.get('to'), 255 | displayField: 'label', 256 | valueField: 'id', 257 | multiSelect: true, 258 | queryMode: 'local', 259 | }, 260 | ] 261 | }); 262 | 263 | this.notificationSettings = new Ext.Panel({ 264 | defaults: { 265 | width: '100%', 266 | labelWidth: 200 267 | }, 268 | items: [ 269 | { 270 | xtype: 'grid', 271 | itemId: 'placesGrid', 272 | margin: '0 0 15 0', 273 | store: this.notificationStore, 274 | columns: [ 275 | { 276 | xtype: 'gridcolumn', 277 | dataIndex: 'condition', 278 | text: t('workflow_transition_notification_condition'), 279 | flex: 1 280 | }, 281 | { 282 | menuDisabled: true, 283 | sortable: false, 284 | xtype: 'actioncolumn', 285 | width: 60, 286 | items: [{ 287 | iconCls: 'pimcore_icon_edit', 288 | tooltip: t('edit'), 289 | handler: function (grid, rowIndex, colIndex) { 290 | new pimcore.plugin.workflow.transition_notification(this.notificationStore, grid.store.getAt(rowIndex)); 291 | }.bind(this) 292 | }, { 293 | iconCls: 'pimcore_icon_delete', 294 | tooltip: t('delete'), 295 | handler: function (grid, rowIndex, colIndex) { 296 | grid.store.removeAt(rowIndex); 297 | }.bind(this) 298 | }] 299 | }, 300 | ], 301 | tbar: [ 302 | { 303 | text: t('add'), 304 | handler: function (btn) { 305 | var record = new WorkflowGUI.Transition.Notification(); 306 | 307 | new pimcore.plugin.workflow.transition_notification(this.notificationStore, record); 308 | }.bind(this), 309 | iconCls: 'pimcore_icon_add' 310 | } 311 | ] 312 | } 313 | ] 314 | }); 315 | 316 | this.settingsPanel = new Ext.Panel({ 317 | border: false, 318 | autoScroll: true, 319 | padding: 10, 320 | defaults: { 321 | width: '100%', 322 | labelWidth: 200 323 | }, 324 | items: [ 325 | { 326 | xtype: 'fieldset', 327 | title: t('workflow_transition_settings'), 328 | defaults: { 329 | width: '100%', 330 | labelWidth: 200 331 | }, 332 | items: this.settingsForm 333 | }, 334 | { 335 | xtype: 'fieldset', 336 | title: t('workflow_transition_options'), 337 | defaults: { 338 | width: '100%', 339 | labelWidth: 200 340 | }, 341 | items: this.optionsForm 342 | }, 343 | { 344 | xtype: 'fieldset', 345 | title: t('workflow_transition_notes'), 346 | defaults: { 347 | width: '100%', 348 | labelWidth: 200 349 | }, 350 | items: this.notesForm 351 | }, 352 | { 353 | xtype: 'fieldset', 354 | title: t('workflow_transition_notifications'), 355 | defaults: { 356 | width: '100%', 357 | labelWidth: 200 358 | }, 359 | items: this.notificationSettings 360 | } 361 | ], 362 | buttons: [ 363 | { 364 | text: t('save'), 365 | handler: function (btn) { 366 | if (this.settingsForm.isValid()) { 367 | var formValues = this.settingsForm.getForm().getFieldValues(); 368 | var optionsValues = this.optionsForm.getForm().getFieldValues(); 369 | var notesValues = this.notesForm.getForm().getFieldValues(); 370 | var additionalFields = this.additionalFieldsStore.getRange(); 371 | var storeRecord = this.store.getById(formValues['id']); 372 | var notifications = this.notificationStore.getRange(); 373 | 374 | if (storeRecord && storeRecord !== transition) { 375 | Ext.Msg.alert(t('workflow_transition_id'), t('workflow_transition_with_id_already_exists')); 376 | return; 377 | } 378 | 379 | notifications = notifications.map(function(record) { 380 | var data = record.data; 381 | 382 | delete data['id']; 383 | 384 | return data; 385 | }); 386 | 387 | additionalFields = additionalFields.map(function(record) { 388 | var data = record.data; 389 | 390 | delete data['id']; 391 | 392 | return data; 393 | }); 394 | 395 | this.store.remove(transition); 396 | 397 | notesValues['additionalFields'] = additionalFields; 398 | 399 | optionsValues['notes'] = notesValues; 400 | optionsValues['notificationSettings'] = notifications; 401 | 402 | if (!formValues['guard']) { 403 | delete formValues['guard']; 404 | } 405 | 406 | transition.data = {}; 407 | transition.set(formValues); 408 | transition.set('options', optionsValues); 409 | transition.commit(); 410 | 411 | this.store.add(transition); 412 | 413 | this.window.close(); 414 | } 415 | }.bind(this), 416 | iconCls: 'pimcore_icon_apply' 417 | } 418 | ], 419 | }); 420 | 421 | return this.settingsPanel; 422 | } 423 | }); 424 | -------------------------------------------------------------------------------- /gpl-3.0.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------