From 8743ac4a3ca23f5d3c949bdb329d7e052cd22688 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 7 Nov 2013 10:09:46 +0100 Subject: [PATCH 01/10] fix readme --- Readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Readme.md b/Readme.md index 2a3e9fece..93df8ab36 100755 --- a/Readme.md +++ b/Readme.md @@ -7,7 +7,6 @@ Thelia [Thelia](http://thelia.net/v2) is an open source tool for creating e-business websites and managing online content. This software is published under GPL. -Here is the current developping next major version. You can download this version for testing or see the code. Here is the most recent developed code for the next major version (v2). You can download this version for testing or having a look on the code (or anything you wish, respecting GPL). See http://thelia.net/v2 web site for more information. Most part of the code can possibly change, a large part will be refactor soon, graphical setup does not exist yet. From 1357ff20011c62ca40fb4b3d4b17ee96de8d4b22 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 7 Nov 2013 10:43:47 +0100 Subject: [PATCH 02/10] fix issue for loading default front template --- core/lib/Thelia/Core/Template/TemplateHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php index 10fe67a5b..b29837cbd 100644 --- a/core/lib/Thelia/Core/Template/TemplateHelper.php +++ b/core/lib/Thelia/Core/Template/TemplateHelper.php @@ -62,7 +62,7 @@ class TemplateHelper public function getActiveFrontTemplate() { return new TemplateDefinition( - ConfigQuery::read('active-admin-template', 'default'), + ConfigQuery::read('active-front-template', 'default'), TemplateDefinition::FRONT_OFFICE ); } From a793dc9f3e8162824aa76e6ee62f4dc632fd836b Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 7 Nov 2013 10:47:14 +0100 Subject: [PATCH 03/10] change variable name for active front template --- install/insert.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/insert.sql b/install/insert.sql index ea26fbd6f..c49f3e210 100755 --- a/install/insert.sql +++ b/install/insert.sql @@ -7,7 +7,7 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`date_format`,`time_format INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES ('session_config.default', '1', 1, 1, NOW(), NOW()), ('verifyStock', '1', 0, 0, NOW(), NOW()), -('active-template', 'default', 0, 0, NOW(), NOW()), +('active-front-template', 'default', 0, 0, NOW(), NOW()), ('active-admin-template', 'default', 0, 0, NOW(), NOW()), ('active-pdf-template', 'default', 0, 0, NOW(), NOW()), ('default_lang_without_translation', '1', 1, 1, NOW(), NOW()), From d2a9de682d0541846337caca86878d1a082d7511 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Thu, 7 Nov 2013 14:57:18 +0100 Subject: [PATCH 04/10] Fixed file list bug --- .../Thelia/Core/Template/TemplateHelper.php | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/core/lib/Thelia/Core/Template/TemplateHelper.php b/core/lib/Thelia/Core/Template/TemplateHelper.php index b29837cbd..f1a2ec8b9 100644 --- a/core/lib/Thelia/Core/Template/TemplateHelper.php +++ b/core/lib/Thelia/Core/Template/TemplateHelper.php @@ -130,7 +130,7 @@ class TemplateHelper */ public function walkDir($directory, $walkMode, Translator $translator, $currentLocale, &$strings) { - $num_files = 0; + $num_texts = 0; if ($walkMode == self::WALK_MODE_PHP) { $prefix = '\-\>[\s]*trans[\s]*\('; @@ -155,7 +155,7 @@ class TemplateHelper if ($fileInfo->isDot()) continue; - if ($fileInfo->isDir()) $num_files += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $strings); + if ($fileInfo->isDir()) $num_texts += $this->walkDir($fileInfo->getPathName(), $walkMode, $translator, $currentLocale, $strings); if ($fileInfo->isFile()) { @@ -186,18 +186,19 @@ class TemplateHelper $strings[$hash]['files'][] = $short_path; } } - else - $num_files++; + else { + $num_texts++; - // remove \' - $match = str_replace("\\'", "'", $match); + // remove \' + $match = str_replace("\\'", "'", $match); - $strings[$hash] = array( - 'files' => array($short_path), - 'text' => $match, - 'translation' => $translator->trans($match, array(), 'messages', $currentLocale, false), - 'dollar' => strstr($match, '$') !== false - ); + $strings[$hash] = array( + 'files' => array($short_path), + 'text' => $match, + 'translation' => $translator->trans($match, array(), 'messages', $currentLocale, false), + 'dollar' => strstr($match, '$') !== false + ); + } } } } @@ -205,7 +206,7 @@ class TemplateHelper } } - return $num_files; + return $num_texts; } catch (\UnexpectedValueException $ex) { echo $ex; From 528372855f83b543953b46259011c21467a1c511 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Thu, 7 Nov 2013 15:08:01 +0100 Subject: [PATCH 05/10] Refactired Modules classes and interface architecture --- core/lib/Thelia/Model/Module.php | 2 +- core/lib/Thelia/Module/BaseModule.php | 58 +++++++++++++++---- .../lib/Thelia/Module/BaseModuleInterface.php | 14 +++-- templates/admin/default/languages.html | 10 ++-- 4 files changed, 62 insertions(+), 22 deletions(-) diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php index d57df77fa..36ed8778e 100755 --- a/core/lib/Thelia/Model/Module.php +++ b/core/lib/Thelia/Model/Module.php @@ -32,4 +32,4 @@ class Module extends BaseModule { public function getI18nPath() { return $this->getBaseDir() . DS . "I18n"; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 15853a398..5a6aa103f 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -36,8 +36,9 @@ use Thelia\Exception\ModuleException; use Thelia\Model\Module; use Thelia\Model\ModuleImage; use Thelia\Model\ModuleQuery; +use Thelia\Core\HttpFoundation\Request; -abstract class BaseModule extends ContainerAware +class BaseModule extends ContainerAware implements BaseModuleInterface { const CLASSIC_MODULE_TYPE = 1; const DELIVERY_MODULE_TYPE = 2; @@ -48,10 +49,8 @@ abstract class BaseModule extends ContainerAware protected $reflected; - public function __construct() - { - - } + protected $dispatcher = null; + protected $request = null; public function activate($moduleModel = null) { @@ -102,7 +101,7 @@ abstract class BaseModule extends ContainerAware public function hasContainer() { - return null === $this->container; + return null !== $this->container; } public function getContainer() @@ -114,6 +113,41 @@ abstract class BaseModule extends ContainerAware return $this->container; } + + public function hasRequest() { + return null !== $this->request; + } + + public function setRequest(Request $request) { + $this->request = $request; + } + + public function getRequest() { + if ($this->hasRequest() === false) { + throw new \RuntimeException("Sorry, the request is not available in this context"); + } + + return $this->request; + } + + + public function hasDispatcher() { + return null !== $this->dispatcher; + } + + public function setDispatcher(EventDispatcherInterface $dispatcher) { + $this->dispatcher = $dispatcher; + } + + public function getDispatcher() { + if ($this->hasDispatcher() === false) { + throw new \RuntimeException("Sorry, the dispatcher is not available in this context"); + } + + return $this->dispatcher; + } + + public function setTitle(Module $module, $titles) { if (is_array($titles)) { @@ -226,6 +260,7 @@ abstract class BaseModule extends ContainerAware public function install(ConnectionInterface $con = null) { + // Implement this method to do something useful. } public function preActivation(ConnectionInterface $con = null) @@ -235,7 +270,7 @@ abstract class BaseModule extends ContainerAware public function postActivation(ConnectionInterface $con = null) { - + // Implement this method to do something useful. } public function preDeactivation(ConnectionInterface $con = null) @@ -245,12 +280,11 @@ abstract class BaseModule extends ContainerAware public function postDeactivation(ConnectionInterface $con = null) { - + // Implement this method to do something useful. } - public function destroy(ConnectionInterface $con = null) + public function destroy(ConnectionInterface $con = null, $deleteModuleData = false) { - + // Implement this method to do something useful. } - -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php index 5cfd98409..a8e4d27ec 100644 --- a/core/lib/Thelia/Module/BaseModuleInterface.php +++ b/core/lib/Thelia/Module/BaseModuleInterface.php @@ -28,9 +28,15 @@ use Symfony\Component\HttpFoundation\Request; interface BaseModuleInterface { - public function setRequest(Request $request); - public function getRequest(); + public function install(ConnectionInterface $con = null); - public function setDispatcher(EventDispatcherInterface $dispatcher); - public function getDispatcher(); + public function preActivation(ConnectionInterface $con = null); + + public function postActivation(ConnectionInterface $con = null); + + public function preDeactivation(ConnectionInterface $con = null); + + public function postDeactivation(ConnectionInterface $con = null); + + public function destroy(ConnectionInterface $con = null, $deleteModuleData = false); } diff --git a/templates/admin/default/languages.html b/templates/admin/default/languages.html index 73f2a656c..dc337efe2 100644 --- a/templates/admin/default/languages.html +++ b/templates/admin/default/languages.html @@ -21,9 +21,9 @@
- +
- + - - + + @@ -82,7 +82,7 @@ {/loop} - +
{intl l="Languages management"} @@ -98,13 +98,13 @@
- {foreach $choices as $choice} {/foreach}
- +
@@ -115,7 +115,7 @@
- +
{intl l="Using a domain or subdomain for each language"}
{form name="thelia.lang.url"} From 3945504387e2b8c5bec2e44d52e6fa2e29688991 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 7 Nov 2013 16:50:52 +0100 Subject: [PATCH 06/10] fix use statement in BaseModuleInterface --- core/lib/Thelia/Module/BaseModuleInterface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/core/lib/Thelia/Module/BaseModuleInterface.php b/core/lib/Thelia/Module/BaseModuleInterface.php index a8e4d27ec..694a4082c 100644 --- a/core/lib/Thelia/Module/BaseModuleInterface.php +++ b/core/lib/Thelia/Module/BaseModuleInterface.php @@ -23,6 +23,7 @@ namespace Thelia\Module; +use Propel\Runtime\Connection\ConnectionInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; From 6b0973a7ec28a9d2cf65aebcf96d36c084a6050c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 7 Nov 2013 16:53:49 +0100 Subject: [PATCH 07/10] change request class in BaseModule --- core/lib/Thelia/Module/BaseModule.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 5a6aa103f..4575f5aac 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -27,6 +27,8 @@ namespace Thelia\Module; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Propel; use Symfony\Component\DependencyInjection\ContainerAware; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Request; use Thelia\Model\Map\ModuleTableMap; use Thelia\Model\ModuleI18nQuery; use Thelia\Model\Map\ModuleImageTableMap; @@ -36,7 +38,7 @@ use Thelia\Exception\ModuleException; use Thelia\Model\Module; use Thelia\Model\ModuleImage; use Thelia\Model\ModuleQuery; -use Thelia\Core\HttpFoundation\Request; + class BaseModule extends ContainerAware implements BaseModuleInterface { From 9f211a5dcbf0af8e891e6d10c6c069d5fb16861c Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Thu, 7 Nov 2013 20:01:10 +0100 Subject: [PATCH 08/10] Fixed Issue #97 --- .../Thelia/Tests/Command/ModuleActivateCommandTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php index 680a487aa..d18c80a61 100755 --- a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php +++ b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php @@ -41,6 +41,9 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase $module = ModuleQuery::create()->findOne(); if (null !== $module) { + + $prev_activation_status = $module->getActivate(); + $application = new Application($this->getKernel()); $module->setActivate(BaseModule::IS_NOT_ACTIVATED); @@ -58,7 +61,12 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase "module" => $module->getCode(), )); - $this->assertEquals(BaseModule::IS_ACTIVATED, ModuleQuery::create()->findPk($module->getId())->getActivate()); + $activated = ModuleQuery::create()->findPk($module->getId())->getActivate(); + + // Restore activation status + $module->setActivate($prev_activation_status)->save(); + + $this->assertEquals(BaseModule::IS_ACTIVATED, $activated); } } From 85ea937570cc676dd9c19afb7835bbdd756cd957 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Fri, 8 Nov 2013 11:22:26 +0100 Subject: [PATCH 09/10] Optimisation of THELIA_* constants usage --- core/bootstrap.php | 4 ++-- core/lib/Thelia/Command/Install.php | 4 ++-- core/lib/Thelia/Core/Thelia.php | 2 +- core/lib/Thelia/Core/TheliaHttpKernel.php | 2 +- templates/admin/default/administrators.html | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/bootstrap.php b/core/bootstrap.php index 99a24db72..72c003da9 100755 --- a/core/bootstrap.php +++ b/core/bootstrap.php @@ -15,7 +15,7 @@ define('DS' , DIRECTORY_SEPARATOR); $loader = require __DIR__ . "/vendor/autoload.php"; -if (!file_exists(THELIA_ROOT . '/local/config/database.yml') && !defined('THELIA_INSTALL_MODE')) { +if (!file_exists(THELIA_CONF_DIR . 'database.yml') && !defined('THELIA_INSTALL_MODE')) { $sapi = php_sapi_name(); if (substr($sapi, 0, 3) == 'cli') { define('THELIA_INSTALL_MODE', true); @@ -24,4 +24,4 @@ if (!file_exists(THELIA_ROOT . '/local/config/database.yml') && !defined('THELIA header('location: '.$request->getSchemeAndHttpHost() . '/install'); exit; } -} +} \ No newline at end of file diff --git a/core/lib/Thelia/Command/Install.php b/core/lib/Thelia/Command/Install.php index 21ebdcfdc..71c97e9a1 100755 --- a/core/lib/Thelia/Command/Install.php +++ b/core/lib/Thelia/Command/Install.php @@ -180,8 +180,8 @@ class Install extends ContainerAwareCommand { $fs = new Filesystem(); - $sampleConfigFile = THELIA_ROOT . "/local/config/database.yml.sample"; - $configFile = THELIA_ROOT . "/local/config/database.yml"; + $sampleConfigFile = THELIA_CONF_DIR . "database.yml.sample"; + $configFile = THELIA_CONF_DIR . "database.yml"; $fs->copy($sampleConfigFile, $configFile, true); diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index c8cc02820..f4187b5a5 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -75,7 +75,7 @@ class Thelia extends Kernel } $definePropel = new DefinePropel(new DatabaseConfiguration(), - Yaml::parse(THELIA_ROOT . '/local/config/database.yml')); + Yaml::parse(THELIA_CONF_DIR . 'database.yml')); $serviceContainer = Propel::getServiceContainer(); $serviceContainer->setAdapterClass('thelia', 'mysql'); $manager = new ConnectionManagerSingle(); diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index 07dc15eed..94ad7f9de 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -215,7 +215,7 @@ class TheliaHttpKernel extends HttpKernel $storage = new Session\Storage\NativeSessionStorage(); if (Model\ConfigQuery::read("session_config.default")) { - $storage->setSaveHandler(new Session\Storage\Handler\NativeFileSessionHandler(Model\ConfigQuery::read("session_config.save_path", THELIA_ROOT . '/local/session/'))); + $storage->setSaveHandler(new Session\Storage\Handler\NativeFileSessionHandler(Model\ConfigQuery::read("session_config.save_path", THELIA_LOCAL_DIR . 'session/'))); } else { $handlerString = Model\ConfigQuery::read("session_config.handlers", 'Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler'); diff --git a/templates/admin/default/administrators.html b/templates/admin/default/administrators.html index c2b8fa521..a02846c0f 100644 --- a/templates/admin/default/administrators.html +++ b/templates/admin/default/administrators.html @@ -1,6 +1,6 @@ {extends file="admin-layout.tpl"} -{block name="page-title"}{intl l='Taxes rules'}{/block} +{block name="page-title"}{intl l='Back-office users'}{/block} {block name="check-resource"}admin.configuration.administrator{/block} {block name="check-access"}view{/block} @@ -9,12 +9,12 @@
{intl l="Login"}{intl l="FirstName"}{intl l="LastName"}{intl l="First Name"}{intl l="Last Name"} {intl l="Profile"} {intl l="Actions"}
From 422a80fcce8561bddf788c91b9128379d4a3c2e4 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Fri, 8 Nov 2013 11:26:06 +0100 Subject: [PATCH 10/10] module modification --- core/lib/Thelia/Action/Module.php | 26 ++- core/lib/Thelia/Config/Resources/form.xml | 2 + .../Thelia/Config/Resources/routing/admin.xml | 15 +- .../Controller/Admin/ModuleController.php | 153 ++++++++++++++++-- .../Thelia/Core/Event/Module/ModuleEvent.php | 103 ++++++++++++ core/lib/Thelia/Core/Event/TheliaEvents.php | 3 +- .../Core/Security/Resource/AdminResources.php | 2 +- .../Thelia/Core/Template/Loop/FolderPath.php | 6 +- .../Thelia/Form/ModuleModificationForm.php | 57 +++++-- core/lib/Thelia/Model/Module.php | 5 +- local/modules/FakeCB/Config/config.xml | 36 ----- local/modules/FakeCB/Config/module.xml | 18 --- local/modules/FakeCB/FakeCB.php | 88 ---------- local/modules/FakeCB/images/mastercard.png | Bin 3733 -> 0 bytes local/modules/FakeCB/images/visa.png | Bin 3158 -> 0 bytes templates/admin/default/configuration.html | 7 - .../admin/default/includes/module-block.html | 6 +- templates/admin/default/module-edit.html | 82 ++++++++++ templates/admin/default/modules.html | 8 +- 19 files changed, 424 insertions(+), 193 deletions(-) rename local/modules/FakeCB/Tests/FakeCBTest.php => core/lib/Thelia/Form/ModuleModificationForm.php (55%) delete mode 100755 local/modules/FakeCB/Config/config.xml delete mode 100644 local/modules/FakeCB/Config/module.xml delete mode 100755 local/modules/FakeCB/FakeCB.php delete mode 100755 local/modules/FakeCB/images/mastercard.png delete mode 100755 local/modules/FakeCB/images/visa.png create mode 100644 templates/admin/default/module-edit.html diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php index a994288d9..d27bedd1f 100644 --- a/core/lib/Thelia/Action/Module.php +++ b/core/lib/Thelia/Action/Module.php @@ -27,6 +27,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Filesystem\Filesystem; use Thelia\Core\Event\Cache\CacheEvent; use Thelia\Core\Event\Module\ModuleDeleteEvent; +use Thelia\Core\Event\Module\ModuleEvent; use Thelia\Core\Event\Module\ModuleToggleActivationEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Model\Map\ModuleTableMap; @@ -99,6 +100,28 @@ class Module extends BaseAction implements EventSubscriberInterface } } + /** + * @param ModuleEvent $event + */ + public function update(ModuleEvent $event) + { + if (null !== $module = ModuleQuery::create()->findPk($event->getId())) { + + $module + ->setDispatcher($this->getDispatcher()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setChapo($event->getChapo()) + ->setDescription($event->getDescription()) + ->setPostscriptum($event->getPostscriptum()) + ; + + $module->save(); + + $event->setModule($module); + } + } + protected function cacheClear() { $cacheEvent = new CacheEvent($this->container->getParameter('kernel.cache_dir')); @@ -130,7 +153,8 @@ class Module extends BaseAction implements EventSubscriberInterface { return array( TheliaEvents::MODULE_TOGGLE_ACTIVATION => array('toggleActivation', 128), - TheliaEvents::MODULE_DELETE => array('delete', 128) + TheliaEvents::MODULE_DELETE => array('delete', 128), + TheliaEvents::MODULE_UPDATE => array('update', 128), ); } } diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml index ecd530b69..dd21a9232 100644 --- a/core/lib/Thelia/Config/Resources/form.xml +++ b/core/lib/Thelia/Config/Resources/form.xml @@ -122,6 +122,8 @@ + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index a966b2608..52af62c45 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -925,16 +925,25 @@ - + Thelia\Controller\Admin\ModuleController::indexAction - + + Thelia\Controller\Admin\ModuleController::updateAction + \d+ + + + + Thelia\Controller\Admin\ModuleController::processUpdateAction + + + Thelia\Controller\Admin\ModuleController::toggleActivationAction \d+ - + Thelia\Controller\Admin\ModuleController::deleteAction diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index 53322949a..24f297cbf 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -23,12 +23,15 @@ namespace Thelia\Controller\Admin; +use Thelia\Core\Event\Module\ModuleEvent; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Module\ModuleDeleteEvent; use Thelia\Core\Event\Module\ModuleToggleActivationEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Security\AccessManager; +use Thelia\Form\ModuleModificationForm; +use Thelia\Model\ModuleQuery; use Thelia\Module\ModuleManagement; /** @@ -36,25 +39,155 @@ use Thelia\Module\ModuleManagement; * @package Thelia\Controller\Admin * @author Manuel Raynaud */ -class ModuleController extends BaseAdminController +class ModuleController extends AbstractCrudController { + public function __construct() + { + parent::__construct( + 'module', + null, + null, + + AdminResources::MODULE, + + null, + TheliaEvents::MODULE_UPDATE, + null + ); + } + + protected function getCreationForm() + { + return null; + } + + protected function getUpdateForm() + { + return new ModuleModificationForm($this->getRequest()); + } + + protected function getCreationEvent($formData) + { + return null; + } + + protected function getUpdateEvent($formData) + { + $event = new ModuleEvent(); + + $event->setLocale($formData['locale']); + $event->setId($formData['id']); + $event->setTitle($formData['title']); + $event->setChapo($formData['chapo']); + $event->setDescription($formData['description']); + $event->setPostscriptum($formData['postscriptum']); + + return $event; + } + + protected function getDeleteEvent() + { + return null; + } + + protected function eventContainsObject($event) + { + return $event->hasModule(); + } + + protected function hydrateObjectForm($object) + { + $object->setLocale($this->getCurrentEditionLocale()); + $data = array( + 'id' => $object->getId(), + 'locale' => $object->getLocale(), + 'title' => $object->getTitle(), + 'chapo' => $object->getChapo(), + 'description' => $object->getDescription(), + 'postscriptum' => $object->getPostscriptum(), + ); + + // Setup the object form + return new ModuleModificationForm($this->getRequest(), "form", $data); + } + + protected function getObjectFromEvent($event) + { + return $event->hasModule() ? $event->getModule() : null; + } + + protected function getExistingObject() + { + return ModuleQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('module_id')); + } + + + protected function getObjectLabel($object) + { + return $object->getTitle(); + } + + protected function getObjectId($object) + { + return $object->getId(); + } + + protected function getViewArguments() + { + return array(); + } + + protected function getRouteArguments($module_id = null) + { + return array( + 'module_id' => $module_id === null ? $this->getRequest()->get('module_id') : $module_id, + ); + } + + protected function renderListTemplate($currentOrder) + { + // We always return to the feature edition form + return $this->render( + 'modules', + array() + ); + } + + protected function renderEditionTemplate() + { + // We always return to the feature edition form + return $this->render('module-edit', array_merge($this->getViewArguments(), $this->getRouteArguments())); + } + + protected function redirectToEditionTemplate($request = null, $country = null) + { + // We always return to the module edition form + $this->redirectToRoute( + "admin.module.update", + $this->getViewArguments(), + $this->getRouteArguments() + ); + } + + protected function redirectToListTemplate() + { + $this->redirectToRoute( + "admin.module" + ); + } + public function indexAction() { if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::VIEW)) return $response; - $modulemanagement = new ModuleManagement(); - $modulemanagement->updateModules(); + $moduleManagement = new ModuleManagement(); + $moduleManagement->updateModules(); return $this->render("modules"); } - public function updateAction($module_id) - { - return $this->render("module-edit", array( - "module_id" => $module_id - )); - } - public function toggleActivationAction($module_id) { if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::UPDATE)) return $response; diff --git a/core/lib/Thelia/Core/Event/Module/ModuleEvent.php b/core/lib/Thelia/Core/Event/Module/ModuleEvent.php index 583a3afc9..7dc3f67e8 100644 --- a/core/lib/Thelia/Core/Event/Module/ModuleEvent.php +++ b/core/lib/Thelia/Core/Event/Module/ModuleEvent.php @@ -37,6 +37,109 @@ class ModuleEvent extends ActionEvent */ protected $module; + protected $id; + protected $locale; + protected $title; + protected $chapo; + protected $description; + protected $postscriptum; + + /** + * @param mixed $chapo + */ + public function setChapo($chapo) + { + $this->chapo = $chapo; + } + + /** + * @return mixed + */ + public function getChapo() + { + return $this->chapo; + } + + /** + * @param mixed $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return mixed + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $locale + */ + public function setLocale($locale) + { + $this->locale = $locale; + } + + /** + * @return mixed + */ + public function getLocale() + { + return $this->locale; + } + + /** + * @param mixed $postscriptum + */ + public function setPostscriptum($postscriptum) + { + $this->postscriptum = $postscriptum; + } + + /** + * @return mixed + */ + public function getPostscriptum() + { + return $this->postscriptum; + } + + /** + * @param mixed $title + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return mixed + */ + public function getTitle() + { + return $this->title; + } + public function __construct(Module $module = null) { $this->module = $module; diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 6dbe89e10..1dfcb673c 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -693,8 +693,9 @@ final class TheliaEvents const MODULE_TOGGLE_ACTIVATION = 'thelia.module.toggleActivation'; /** - * sent when a module is deleted + * module */ + const MODULE_UPDATE = 'thelia.module.update'; const MODULE_DELETE = 'thelia.module.delete'; /** diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index 834c2c628..e953b83aa 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -84,7 +84,7 @@ final class AdminResources const MESSAGE = "admin.configuration.message"; - const MODULE = "admin.configuration.module"; + const MODULE = "admin.module"; const ORDER = "admin.order"; diff --git a/core/lib/Thelia/Core/Template/Loop/FolderPath.php b/core/lib/Thelia/Core/Template/Loop/FolderPath.php index ce5ea9526..92c42f890 100644 --- a/core/lib/Thelia/Core/Template/Loop/FolderPath.php +++ b/core/lib/Thelia/Core/Template/Loop/FolderPath.php @@ -102,9 +102,9 @@ class FolderPath extends BaseI18nLoop implements ArraySearchLoopInterface if ($folder != null) { $results[] = array( - "ID" => $result->getId(), - "TITLE" => $result->getVirtualColumn('i18n_TITLE'), - "URL" => $result->getUrl($this->locale), + "ID" => $folder->getId(), + "TITLE" => $folder->getVirtualColumn('i18n_TITLE'), + "URL" => $folder->getUrl($this->locale), "LOCALE" => $this->locale, ); diff --git a/local/modules/FakeCB/Tests/FakeCBTest.php b/core/lib/Thelia/Form/ModuleModificationForm.php similarity index 55% rename from local/modules/FakeCB/Tests/FakeCBTest.php rename to core/lib/Thelia/Form/ModuleModificationForm.php index 20a68fc1d..5b65f5709 100755 --- a/local/modules/FakeCB/Tests/FakeCBTest.php +++ b/core/lib/Thelia/Form/ModuleModificationForm.php @@ -4,7 +4,7 @@ /* Thelia */ /* */ /* Copyright (c) OpenStudio */ -/* email : info@thelia.net */ +/* email : info@thelia.net */ /* web : http://www.thelia.net */ /* */ /* This program is free software; you can redistribute it and/or modify */ @@ -21,32 +21,55 @@ /* */ /*************************************************************************************/ -namespace FakeCB\Tests; +namespace Thelia\Form; -use FakeCB\FakeCB; -use Thelia\Tests\Module\BaseModuleTestor; +use Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Model\ModuleQuery; -/** - * - * @author Etienne Roudeix - * - */ -class FakeCBTest extends BaseModuleTestor +class ModuleModificationForm extends BaseForm { - public function getTestedClassName() + use StandardDescriptionFieldsTrait; + + protected function buildForm() { - return 'FakeCB\FakeCB'; + $this->addStandardDescFields(); + + $this->formBuilder + ->add("id", "hidden", array( + "required" => true, + "constraints" => array( + new Constraints\NotBlank(), + new Constraints\Callback( + array( + "methods" => array( + array($this, "verifyModuleId"), + ), + ) + ), + ), + "attr" => array( + "id" => "module_update_id", + ), + )) + ; } - public function getTestedInstance() + /** + * @return string the name of you form. This name must be unique + */ + public function getName() { - return new FakeCB(); + return "thelia_admin_module_modification"; } - public function testInstall() + public function verifyModuleId($value, ExecutionContextInterface $context) { - //$fakeCB = new FakeCB(); + $module = ModuleQuery::create() + ->findPk($value); - //$fakeCB->install(); + if (null === $module) { + $context->addViolation("Module ID not found"); + } } } diff --git a/core/lib/Thelia/Model/Module.php b/core/lib/Thelia/Model/Module.php index d57df77fa..b2518169d 100755 --- a/core/lib/Thelia/Model/Module.php +++ b/core/lib/Thelia/Model/Module.php @@ -4,8 +4,11 @@ namespace Thelia\Model; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Model\Base\Module as BaseModule; +use Thelia\Model\Tools\ModelEventDispatcherTrait; -class Module extends BaseModule { +class Module extends BaseModule +{ + use ModelEventDispatcherTrait; public function postSave(ConnectionInterface $con = null) { diff --git a/local/modules/FakeCB/Config/config.xml b/local/modules/FakeCB/Config/config.xml deleted file mode 100755 index 2430f5027..000000000 --- a/local/modules/FakeCB/Config/config.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/local/modules/FakeCB/Config/module.xml b/local/modules/FakeCB/Config/module.xml deleted file mode 100644 index 0beea57f4..000000000 --- a/local/modules/FakeCB/Config/module.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - FakeCB\FakeCB - - fake cb - - - simulation cb - - 1.0 - - Manuel Raynaud - mraynaud@openstudio.fr - - payment - 2.0.0 - alpha - diff --git a/local/modules/FakeCB/FakeCB.php b/local/modules/FakeCB/FakeCB.php deleted file mode 100755 index 58c8318da..000000000 --- a/local/modules/FakeCB/FakeCB.php +++ /dev/null @@ -1,88 +0,0 @@ -. */ -/* */ -/*************************************************************************************/ - -namespace FakeCB; - -use Propel\Runtime\Connection\ConnectionInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\Request; -use Thelia\Model\Base\ModuleImageQuery; -use Thelia\Module\BaseModule; -use Thelia\Module\PaymentModuleInterface; - -class FakeCB extends BaseModule implements PaymentModuleInterface -{ - protected $request; - protected $dispatcher; - - public function setRequest(Request $request) - { - $this->request = $request; - } - - public function getRequest() - { - return $this->request; - } - - public function setDispatcher(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - public function getDispatcher() - { - return $this->dispatcher; - } - - public function pay() - { - // TODO: Implement pay() method. - } - - - public function postActivation(ConnectionInterface $con = null) - { - /* insert the images from image folder if first module activation */ - $module = $this->getModuleModel(); - if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) { - $this->deployImageFolder($module, sprintf('%s/images', __DIR__)); - } - - /* set module title */ - $this->setTitle( - $module, - array( - "en_US" => "Credit Card", - "fr_FR" => "Carte de crédit", - ) - ); - } - - - public function getCode() - { - return 'FakeCB'; - } - -} diff --git a/local/modules/FakeCB/images/mastercard.png b/local/modules/FakeCB/images/mastercard.png deleted file mode 100755 index 28701c3dd2b033657d86bd5edb3d4e138cba8bf1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3733 zcmV;G4r=jhbLQ z!DZ^{_vYs2|NQgzy`Da6FY%F4^y7b^Dl_P5B^)g&zCT`B45>G1II_o=UoPG-xg zOVrfV&PPxC>(=I-ChhI*>`-3wyjz)>nA)c>u(-*qGf=RPQ26-x=H}bX*Yw_ck@NiZ z#=Fb)!dLT)miqeo`P=LM_5Gxxrr+P-=y^r>|NsB_{;zzP_3iBDRAtAow&uH3d^uI) z?ChPuSCiIL>&;O~(``sBIGR&tuFw*1)H{J2B%yH))2`1Sw)^7HNK#fI=yX4o7s z-ZnDwo1*2oWBt8f@$LKU$Y;%NOY`F6;K_`{*46*??fL)s=}Thc^6>NO%hf!O)=`JY_%&4ldZ>-42O;6y^$^yvTj`SZqf|NQ^w)yUB}8vDk?xQsrltFPih zQN_pH*tck~CO__^EZyt&!<*8=SElf`v2#}mj3DE$oE`SR}Z{P$01^Q=Si z+``cpBl^5k|NZ~Cu#e)QF#qlS?dj+J=Ignzx!_7x@BjDU(x%xCDCW=C>FMv>o1)Lo z&hO~#^|52|@$$zZJ?F7G|Nr{;@bT+cUFc0!@%jGg?(pKB8|mTalj+7dha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E$o44tM1g?@B_)X@t^9%F1 z+>)QmFZ=2|aLVq6!a~|Hi`{O=91hI>`o_bt@!n@vB<4iiPD=7VmgpU?^^xR--aY6W zH{*8b#)HGlJ#sQPg~lwJ*x~QjQEzuw;lS-Ujv3kw4&%hd>(~2bZE$>1xjuT~gRHO7 zZzn%^@UO)=^10z#7FSgG;unHF%D#E;gSA)cb4q=~F$$wdRs~LA275b(+i6Anh2O_D zH1Nv1Yc8Uvvn-fLcz0Y@d3$$oR&f2+-&`!kP&}kYmlIbJ_wucM(@xjBr2w=7(;4h` zhrxk)cm#Wd*EIZTQcbW&@Z9j()iqmYdjxO&OL@-P1&h%9pBkhd_*Zpni406`9}07eeau0taubts3! z;|&`&EFfUQgb6P~Qd58Wgw)hjcnFpR1i(5X9*@I8Q4WfUI0)NI4h)pY5UGPi(svrY z8p31sTVk#*lqpdxq{hwcK8CmQDZ3+QPq-6bc?54wzo zM|T6Bf{IWRtAf(eeYU`bRtJ0D3+jZq#hkx5D9?Fq4yubZ&`Sc!i`26y2teVmH6l9x za0Djw8G@xW%uw`xr-!6xtl+4?j-ebJuqoiHTBJ_YJIp;-Td-ik3r=2Pc;OZ2fg3kq z;ew@0U+funk;tI44Oj&SWDh8$LrxDOJ)uM*Cgu|Y=$6ux$VsZJ^~|_9XA}wp3?~%9 zk^`X-1%l&n;f9Y@9EURs;&9Oa9rSwMi-C^4-9dlAdQ5GrRZo$6woDG4D-tltAGr(b zQ|MoAG?UI3zQGk{Bhrh}O?vlwJqnh)nsI;T6v7hya w8BG^`>btAxe+f32`UAJC&lB42^SuBA04ep=Em8e-`2YX_07*qoM6N<$f^*sT)Bpeg diff --git a/templates/admin/default/configuration.html b/templates/admin/default/configuration.html index 6b4428b1a..dec253917 100644 --- a/templates/admin/default/configuration.html +++ b/templates/admin/default/configuration.html @@ -116,13 +116,6 @@ {module_include location='system_configuration_top'} - {loop type="auth" name="pcc1" role="ADMIN" resource="admin.configuration.module" access="VIEW"} - - {intl l='Modules activation'} - - - {/loop} - {loop type="auth" name="pcc2" role="ADMIN" resource="admin.configuration.variable" access="VIEW"} {intl l='System variables'} diff --git a/templates/admin/default/includes/module-block.html b/templates/admin/default/includes/module-block.html index 527e9bf6a..f11be5331 100644 --- a/templates/admin/default/includes/module-block.html +++ b/templates/admin/default/includes/module-block.html @@ -27,9 +27,9 @@
@@ -48,7 +48,7 @@ {/loop} {loop type="auth" name="can_delete" role="ADMIN" resource="admin.modules" access="DELETE"} - + {/loop} diff --git a/templates/admin/default/module-edit.html b/templates/admin/default/module-edit.html new file mode 100644 index 000000000..755a50826 --- /dev/null +++ b/templates/admin/default/module-edit.html @@ -0,0 +1,82 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Edit a module'}{/block} + +{block name="check-resource"}admin.module{/block} +{block name="check-access"}update{/block} + +{block name="main-content"} + +
+ +
+ + + + {loop type="module" name="module" id=$module_id backend_context="1" lang=$edit_language_id} + +
+
+ +
+ + {form name="thelia.admin.module.modification"} + + + + {include + file = "includes/inner-form-toolbar.html" + hide_submit_buttons = false + + page_url = {url path="/admin/module/update/$module_id"} + close_url = {url path="/admin/modules"} + } + + {* Be sure to get the product ID, even if the form could not be validated *} + + + {form_hidden_fields form=$form} + + {form_field form=$form field='success_url'} + + {/form_field} + + {if $form_error}
{$form_error_message}
{/if} + + {include file="includes/standard-description-form-fields.html" form=$form} + +
+
+
+ +
+

{intl l='Module created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}

+
+
+
+
+ + + {/form} +
+ +
+
+ + {/loop} + +
+ +
+ +{/block} + +{block name="javascript-initialization"} + + + +{/block} \ No newline at end of file diff --git a/templates/admin/default/modules.html b/templates/admin/default/modules.html index d82bce399..0eebed2b8 100644 --- a/templates/admin/default/modules.html +++ b/templates/admin/default/modules.html @@ -2,7 +2,7 @@ {block name="page-title"}{intl l='Modules'}{/block} -{block name="check-resource"}admin.configuration.module{/block} +{block name="check-resource"}admin.module{/block} {block name="check-access"}view{/block} {block name="main-content"} @@ -53,7 +53,7 @@ dialog_title = {intl l="Delete a module"} dialog_message = {intl l="Do you really want to delete this module ?"} - form_action = {url path='/admin/configuration/modules/delete'} + form_action = {url path='/admin/modules/delete'} form_content = {$smarty.capture.delete_module_dialog nofilter} } @@ -81,8 +81,8 @@ {/javascripts}