From 8296051937a9f3219bb0017acd17d3654cb8c876 Mon Sep 17 00:00:00 2001 From: franck Date: Wed, 17 Jul 2013 18:49:23 +0200 Subject: [PATCH] Implemented front-office login --- composer.lock | 265 ++- core/lib/Thelia/Action/Customer.php | 143 +- .../Admin/Controller/BaseAdminController.php | 5 +- .../Admin/Controller/SessionController.php | 11 +- core/lib/Thelia/Config/Resources/action.xml | 2 + core/lib/Thelia/Config/Resources/config.xml | 8 + core/lib/Thelia/Core/Event/TheliaEvents.php | 9 +- .../Core/EventListener/ViewListener.php | 2 - .../Core/HttpFoundation/Session/Session.php | 3 +- ...tomerUsernamePasswordFormAuthenticator.php | 2 +- .../Thelia/Core/Template/ParserContext.php | 62 + .../Smarty/Assets/SmartyAssetsManager.php | 2 +- .../Template/Smarty/Plugins/UrlGenerator.php | 28 +- .../Core/Template/Smarty/SmartyParser.php | 27 +- core/lib/Thelia/Form/AdminLogin.php | 1 - core/lib/Thelia/Form/BaseForm.php | 3 +- core/lib/Thelia/Form/CustomerLogin.php | 1 - core/lib/Thelia/Model/Base/Address.php | 52 +- core/lib/Thelia/Model/Base/AddressQuery.php | 34 +- core/lib/Thelia/Model/Customer.php | 5 +- core/lib/Thelia/Model/Map/AddressTableMap.php | 30 +- core/lib/Thelia/Tools/URL.php | 30 +- install/INSTALL-TODO.txt | 1 + install/thelia.sql | 2 +- local/config/schema.xml | 1852 ++++++++--------- templates/admin/default/home.html | 2 +- templates/admin/default/login.html | 4 +- .../bootstrap/css/bootstrap-responsive.css | 0 .../css/bootstrap-responsive.min.css | 0 .../assets/bootstrap/css/bootstrap.css | 0 .../assets/bootstrap/css/bootstrap.min.css | 0 .../img/glyphicons-halflings-white.png | Bin .../bootstrap/img/glyphicons-halflings.png | Bin .../assets/bootstrap/js/bootstrap.js | 0 .../assets/bootstrap/js/bootstrap.min.js | 0 .../assets/css/img/bg.jpg | Bin .../assets/css/style.less | 0 .../assets/img/logo-thelia-34px.png | Bin .../assets/img/test-background.jpg | Bin .../assets/js/jquery.min.js | 0 .../{smarty-sample => default}/category.html | 0 .../{smarty-sample => default}/connexion.html | 26 +- .../{smarty-sample => default}/i18n/en.php | 0 .../{smarty-sample => default}/i18n/fr.php | 0 templates/default/include1.html | 2 - .../{smarty-sample => default}/included.html | 0 .../includes/footer.html | 0 .../includes/footer.inc.tpl | 0 templates/default/includes/header.html | 25 + .../includes/header.inc.tpl | 0 .../includes/menu.tpl | 0 templates/default/index.html | 173 +- templates/default/login.html | 52 + templates/default/myaccount.html | 6 + .../pagination.html | 0 templates/default/subinclude1.html | 1 - templates/smarty-sample/includes/header.html | 11 - templates/smarty-sample/index.html | 151 -- 58 files changed, 1626 insertions(+), 1407 deletions(-) create mode 100644 core/lib/Thelia/Core/Template/ParserContext.php rename templates/{smarty-sample => default}/assets/bootstrap/css/bootstrap-responsive.css (100%) rename templates/{smarty-sample => default}/assets/bootstrap/css/bootstrap-responsive.min.css (100%) rename templates/{smarty-sample => default}/assets/bootstrap/css/bootstrap.css (100%) rename templates/{smarty-sample => default}/assets/bootstrap/css/bootstrap.min.css (100%) rename templates/{smarty-sample => default}/assets/bootstrap/img/glyphicons-halflings-white.png (100%) rename templates/{smarty-sample => default}/assets/bootstrap/img/glyphicons-halflings.png (100%) rename templates/{smarty-sample => default}/assets/bootstrap/js/bootstrap.js (100%) rename templates/{smarty-sample => default}/assets/bootstrap/js/bootstrap.min.js (100%) rename templates/{smarty-sample => default}/assets/css/img/bg.jpg (100%) rename templates/{smarty-sample => default}/assets/css/style.less (100%) rename templates/{smarty-sample => default}/assets/img/logo-thelia-34px.png (100%) rename templates/{smarty-sample => default}/assets/img/test-background.jpg (100%) rename templates/{smarty-sample => default}/assets/js/jquery.min.js (100%) rename templates/{smarty-sample => default}/category.html (100%) rename templates/{smarty-sample => default}/connexion.html (80%) rename templates/{smarty-sample => default}/i18n/en.php (100%) rename templates/{smarty-sample => default}/i18n/fr.php (100%) delete mode 100755 templates/default/include1.html rename templates/{smarty-sample => default}/included.html (100%) rename templates/{smarty-sample => default}/includes/footer.html (100%) rename templates/{smarty-sample => default}/includes/footer.inc.tpl (100%) create mode 100755 templates/default/includes/header.html rename templates/{smarty-sample => default}/includes/header.inc.tpl (100%) rename templates/{smarty-sample => default}/includes/menu.tpl (100%) create mode 100644 templates/default/login.html create mode 100644 templates/default/myaccount.html rename templates/{smarty-sample => default}/pagination.html (100%) delete mode 100755 templates/default/subinclude1.html delete mode 100755 templates/smarty-sample/includes/header.html delete mode 100755 templates/smarty-sample/index.html diff --git a/composer.lock b/composer.lock index 0e44951da..b49c21e6f 100755 --- a/composer.lock +++ b/composer.lock @@ -11,12 +11,12 @@ "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "v4.5.0" + "reference": "107b3055a10eb824701463602f77fbc8129180a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/v4.5.0", - "reference": "v4.5.0", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/107b3055a10eb824701463602f77fbc8129180a2", + "reference": "107b3055a10eb824701463602f77fbc8129180a2", "shasum": "" }, "require": { @@ -47,7 +47,7 @@ "keywords": [ "html" ], - "time": "2013-02-18 00:04:08" + "time": "2013-07-17 04:56:29" }, { "name": "ircmaxell/password-compat", @@ -94,12 +94,12 @@ "source": { "type": "git", "url": "https://github.com/kriswallsmith/assetic.git", - "reference": "82e8fc20a3b043b378a7efbda9e3d406d420f00e" + "reference": "f9f754dc7524acd6daf0bf510d22c055b4967e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/82e8fc20a3b043b378a7efbda9e3d406d420f00e", - "reference": "82e8fc20a3b043b378a7efbda9e3d406d420f00e", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/f9f754dc7524acd6daf0bf510d22c055b4967e08", + "reference": "f9f754dc7524acd6daf0bf510d22c055b4967e08", "shasum": "" }, "require": { @@ -114,9 +114,9 @@ "leafo/scssphp": "*", "leafo/scssphp-compass": "*", "mrclay/minify": "*", - "phpunit/phpunit": ">=3.7,<4.0", + "phpunit/phpunit": "~3.7", "ptachoire/cssembed": "*", - "twig/twig": ">=1.6,<2.0" + "twig/twig": "~1.6" }, "suggest": { "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", @@ -157,7 +157,7 @@ "compression", "minification" ], - "time": "2013-06-13 16:47:03" + "time": "2013-07-11 15:56:23" }, { "name": "leafo/lessphp", @@ -165,12 +165,12 @@ "source": { "type": "git", "url": "https://github.com/leafo/lessphp.git", - "reference": "ff86f2941c3f3d67d56acad2f8902ca57c73b359" + "reference": "366fb52798d4f120503af0703da11cba4ad06f8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/leafo/lessphp/zipball/ff86f2941c3f3d67d56acad2f8902ca57c73b359", - "reference": "ff86f2941c3f3d67d56acad2f8902ca57c73b359", + "url": "https://api.github.com/repos/leafo/lessphp/zipball/366fb52798d4f120503af0703da11cba4ad06f8d", + "reference": "366fb52798d4f120503af0703da11cba4ad06f8d", "shasum": "" }, "type": "library", @@ -198,7 +198,7 @@ ], "description": "lessphp is a compiler for LESS written in PHP.", "homepage": "http://leafo.net/lessphp/", - "time": "2013-05-22 17:52:29" + "time": "2013-07-09 16:25:09" }, { "name": "propel/propel", @@ -487,24 +487,24 @@ }, { "name": "symfony/class-loader", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/ClassLoader", "source": { "type": "git", "url": "https://github.com/symfony/ClassLoader.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/ClassLoader/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/finder": ">=2.0,<3.0" + "symfony/finder": "~2.0" }, "type": "library", "extra": { @@ -537,17 +537,17 @@ }, { "name": "symfony/config", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -580,21 +580,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2013-05-10 18:08:31" + "time": "2013-07-10 14:03:01" }, { "name": "symfony/console", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -627,21 +627,21 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2013-06-13 07:47:06" + "time": "2013-07-08 14:34:53" }, { "name": "symfony/dependency-injection", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -649,7 +649,7 @@ }, "require-dev": { "symfony/config": ">=2.2,<2.3-dev", - "symfony/yaml": ">=2.0,<3.0" + "symfony/yaml": "~2.0" }, "suggest": { "symfony/config": "2.2.*", @@ -686,24 +686,24 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/dependency-injection": ">=2.0,<3.0" + "symfony/dependency-injection": "~2.0" }, "suggest": { "symfony/dependency-injection": "2.2.*", @@ -740,17 +740,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -787,17 +787,17 @@ }, { "name": "symfony/finder", - "version": "v2.3.1", + "version": "v2.3.2", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "v2.3.1" + "reference": "v2.3.2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.1", - "reference": "v2.3.1", + "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.3.2", + "reference": "v2.3.2", "shasum": "" }, "require": { @@ -830,27 +830,27 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2013-06-02 12:05:51" + "time": "2013-07-01 12:17:23" }, { "name": "symfony/form", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Form", "source": { "type": "git", "url": "https://github.com/symfony/Form.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Form/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/event-dispatcher": ">=2.1,<3.0", - "symfony/locale": ">=2.0,<3.0", + "symfony/event-dispatcher": "~2.1", + "symfony/locale": "~2.0", "symfony/options-resolver": ">=2.1,<2.3-dev", "symfony/property-access": ">=2.2,<2.3-dev" }, @@ -889,21 +889,21 @@ ], "description": "Symfony Form Component", "homepage": "http://symfony.com", - "time": "2013-06-13 07:35:18" + "time": "2013-06-23 07:35:41" }, { "name": "symfony/http-foundation", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/HttpFoundation", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -939,37 +939,37 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "http://symfony.com", - "time": "2013-06-13 12:48:26" + "time": "2013-07-15 12:12:07" }, { "name": "symfony/http-kernel", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/HttpKernel", "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3", - "psr/log": ">=1.0,<2.0", - "symfony/event-dispatcher": ">=2.1,<3.0", + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1", "symfony/http-foundation": ">=2.2,<2.3-dev" }, "require-dev": { "symfony/browser-kit": "2.2.*", - "symfony/class-loader": ">=2.1,<3.0", - "symfony/config": ">=2.0,<3.0", + "symfony/class-loader": "~2.1", + "symfony/config": "~2.0", "symfony/console": "2.2.*", - "symfony/dependency-injection": ">=2.0,<3.0", - "symfony/finder": ">=2.0,<3.0", - "symfony/process": ">=2.0,<3.0", + "symfony/dependency-injection": "~2.0", + "symfony/finder": "~2.0", + "symfony/process": "~2.0", "symfony/routing": ">=2.2,<2.3-dev", "symfony/stopwatch": ">=2.2,<2.3-dev" }, @@ -1008,25 +1008,24 @@ ], "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", - "time": "2013-06-19 12:09:49" + "time": "2013-07-15 12:28:01" }, { "name": "symfony/icu", - "version": "v1.2.0", + "version": "v1.0.0", "target-dir": "Symfony/Component/Icu", "source": { "type": "git", "url": "https://github.com/symfony/Icu.git", - "reference": "v1.2.0" + "reference": "v1.0.0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.2.0", - "reference": "v1.2.0", + "url": "https://api.github.com/repos/symfony/Icu/zipball/v1.0.0", + "reference": "v1.0.0", "shasum": "" }, "require": { - "lib-icu": ">=4.4", "php": ">=5.3.3", "symfony/intl": ">=2.3,<3.0" }, @@ -1056,26 +1055,26 @@ "icu", "intl" ], - "time": "2013-06-03 18:32:58" + "time": "2013-06-03 18:32:07" }, { "name": "symfony/intl", - "version": "v2.3.1", + "version": "v2.3.2", "target-dir": "Symfony/Component/Intl", "source": { "type": "git", "url": "https://github.com/symfony/Intl.git", - "reference": "v2.3.1" + "reference": "v2.3.2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.1", - "reference": "v2.3.1", + "url": "https://api.github.com/repos/symfony/Intl/zipball/v2.3.2", + "reference": "v2.3.2", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/icu": ">=1.0-RC,<2.0" + "symfony/icu": "~1.0-RC" }, "require-dev": { "symfony/filesystem": ">=2.1" @@ -1133,21 +1132,21 @@ "l10n", "localization" ], - "time": "2013-05-18 11:21:22" + "time": "2013-07-08 13:00:35" }, { "name": "symfony/locale", - "version": "v2.3.1", + "version": "v2.3.2", "target-dir": "Symfony/Component/Locale", "source": { "type": "git", "url": "https://github.com/symfony/Locale.git", - "reference": "v2.3.1" + "reference": "v2.3.2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.1", - "reference": "v2.3.1", + "url": "https://api.github.com/repos/symfony/Locale/zipball/v2.3.2", + "reference": "v2.3.2", "shasum": "" }, "require": { @@ -1181,21 +1180,21 @@ ], "description": "Symfony Locale Component", "homepage": "http://symfony.com", - "time": "2013-04-11 09:29:25" + "time": "2013-07-01 12:24:43" }, { "name": "symfony/options-resolver", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/OptionsResolver", "source": { "type": "git", "url": "https://github.com/symfony/OptionsResolver.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -1237,17 +1236,17 @@ }, { "name": "symfony/process", - "version": "v2.3.1", + "version": "v2.3.2", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "v2.3.1" + "reference": "v2.3.2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.1", - "reference": "v2.3.1", + "url": "https://api.github.com/repos/symfony/Process/zipball/v2.3.2", + "reference": "v2.3.2", "shasum": "" }, "require": { @@ -1280,21 +1279,21 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2013-05-06 20:03:44" + "time": "2013-07-01 12:24:43" }, { "name": "symfony/property-access", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/PropertyAccess", "source": { "type": "git", "url": "https://github.com/symfony/PropertyAccess.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -1342,27 +1341,27 @@ }, { "name": "symfony/routing", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Routing", "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "doctrine/common": ">=2.2,<3.0", - "psr/log": ">=1.0,<2.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", "symfony/config": ">=2.2,<2.3-dev", - "symfony/yaml": ">=2.0,<3.0" + "symfony/yaml": "~2.0" }, "suggest": { "doctrine/common": "~2.2", @@ -1396,21 +1395,21 @@ ], "description": "Symfony Routing Component", "homepage": "http://symfony.com", - "time": "2013-05-10 16:49:00" + "time": "2013-06-23 06:56:04" }, { "name": "symfony/translation", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -1418,7 +1417,7 @@ }, "require-dev": { "symfony/config": ">=2.0,<2.3-dev", - "symfony/yaml": ">=2.2,<3.0" + "symfony/yaml": "~2.2" }, "suggest": { "symfony/config": "2.2.*", @@ -1455,28 +1454,28 @@ }, { "name": "symfony/validator", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Validator/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/translation": ">=2.0,<3.0" + "symfony/translation": "~2.0" }, "require-dev": { "symfony/config": ">=2.2,<2.3-dev", - "symfony/http-foundation": ">=2.1,<3.0", - "symfony/locale": ">=2.0,<3.0", - "symfony/yaml": ">=2.0,<3.0" + "symfony/http-foundation": "~2.1", + "symfony/locale": "~2.0", + "symfony/yaml": "~2.0" }, "suggest": { "doctrine/common": "~2.2", @@ -1512,21 +1511,21 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2013-06-02 12:05:41" + "time": "2013-07-02 07:41:45" }, { "name": "symfony/yaml", - "version": "v2.2.3", + "version": "v2.2.4", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "v2.2.3" + "reference": "v2.2.4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.3", - "reference": "v2.2.3", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.4", + "reference": "v2.2.4", "shasum": "" }, "require": { @@ -1559,7 +1558,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2013-05-10 18:08:31" + "time": "2013-07-11 09:28:01" } ], "packages-dev": [ @@ -1569,12 +1568,12 @@ "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "8b9bb44bbf864a63c2eece6744fc40240877b0c6" + "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/8b9bb44bbf864a63c2eece6744fc40240877b0c6", - "reference": "8b9bb44bbf864a63c2eece6744fc40240877b0c6", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/3613b1466d5e9518b83f87d828f93f962ff0f997", + "reference": "3613b1466d5e9518b83f87d828f93f962ff0f997", "shasum": "" }, "require": { @@ -1607,7 +1606,7 @@ "faker", "fixtures" ], - "time": "2013-07-08 09:31:33" + "time": "2013-07-15 16:26:12" }, { "name": "phpunit/php-code-coverage", diff --git a/core/lib/Thelia/Action/Customer.php b/core/lib/Thelia/Action/Customer.php index 0d95b54be..c4561964c 100755 --- a/core/lib/Thelia/Action/Customer.php +++ b/core/lib/Thelia/Action/Customer.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 */ @@ -17,7 +17,7 @@ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with this program. If not, see . */ +/* along with this program. If not, see . */ /* */ /*************************************************************************************/ @@ -39,30 +39,28 @@ use Thelia\Model\ConfigQuery; use Thelia\Tools\Redirect; use Symfony\Component\Validator\Exception\ValidatorException; use Thelia\Core\Security\Exception\AuthenticationException; +use Thelia\Core\Template\ParserContext; +use Thelia\Core\Security\Exception\UsernameNotFoundException; class Customer implements EventSubscriberInterface { /** * @var Thelia\Core\Security\SecurityContext */ - private $securityContext; + protected $securityContext; - public function __construct(SecurityContext $context) { - $this->securityContext = $context; + /** + * @var Thelia\Core\Template\ParserContext + */ + protected $parserContext; - $context->setContext(SecurityContext::CONTEXT_FRONT_OFFICE); + public function __construct(SecurityContext $securityContext, ParserContext $parserContext) { + $this->securityContext = $securityContext; + $this->parserContext = $parserContext; } - - private function getSecurityContext($context) { - $this->securityContext->setContext($context === false ? SecurityContext::CONTEXT_FRONT_OFFICE : $context); - - return $securityContext; - } - public function create(ActionEvent $event) { - $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CREATECUSTOMER, $event); $request = $event->getRequest(); @@ -94,25 +92,35 @@ class Customer implements EventSubscriberInterface $data["password"], $request->getSession()->getLang() ); + + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $event); + + // Connect the newly created user,and redirect to the success URL + $this->processSuccessfulLogin($event, $customer, $customerCreation, true); + } catch (\PropelException $e) { Tlog::getInstance()->error(sprintf('error during creating customer on action/createCustomer with message "%s"', $e->getMessage())); - $event->setFormError($customerCreation); + + $message = "Failed to create your account, please try again."; } - - //Customer is create, he is automatically connected - } else { - - $event->setFormError($customerCreation); + $message = "Missing or invalid data"; } } + else { + $message = "Wrong form method !"; + } - $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CREATECUSTOMER, $event); + $this->parserContext->set('customer_creation_error_message', $message); + + $event->setFormError($customerCreation); } public function modify(ActionEvent $event) { + $event->getDispatcher()->dispatch(TheliaEvents::BEFORE_CHANGECUSTOMER, $event); + $request = $event->getRequest(); $customerModification = new CustomerModification($request); @@ -140,15 +148,44 @@ class Customer implements EventSubscriberInterface $data["zipcode"], $data["country"] ); - } catch(\PropelException $e) { + + $event->getDispatcher()->dispatch(TheliaEvents::AFTER_CHANGECUSTOMER, $event); + + // Update the logged-in user, and redirect to the success URL (exits) + // We don-t send the login event, as the customer si already logged. + $this->processSuccessfulLogin($event, $customer, $customerModification); + } + catch(\PropelException $e) { + Tlog::getInstance()->error(sprintf('error during modifying customer on action/modifyCustomer with message "%s"', $e->getMessage())); - $event->setFormError($customerModification); + + $message = "Failed to change your account, please try again."; } - } else { - $event->setFormError($customerModification); + } + else { + $message = "Missing or invalid data"; } } + else { + $message = "Wrong form method !"; + } + $this->parserContext->set('customer_change_error_message', $message); + + $event->setFormError($customerModification); + } + + + /** + * Perform user logout. The user is redirected to the provided view, if any. + * + * @param ActionEvent $event + */ + public function logout(ActionEvent $event) + { + $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGOUT, $event); + + $this->getSecurityContext()->clear(); } /** @@ -170,39 +207,33 @@ class Customer implements EventSubscriberInterface try { $user = $authenticator->getAuthentifiedUser(); - // Success -> store user in security context - $this->getSecurityContext()->setUser($user); - - // Log authentication success - AdminLog::append("Authentication successufull", $request, $user); - - // Get the success URL to redirect the user to - $successUrl = $form->getForm()->get('success_url')->getData(); - - if (null == $successUrl) $successUrl = ConfigQuery::read('base_url', '/'); - - // Redirect to the success URL - return Redirect::exec(URL::absoluteUrl($successUrl)); - } + $this->processSuccessfulLogin($event, $user, $form); + } catch (ValidatorException $ex) { $message = "Missing or invalid information. Please check your input."; } + catch (UsernameNotFoundException $ex) { + $message = "This email address was not found."; + } catch (AuthenticationException $ex) { $message = "Login failed. Please check your username and password."; } catch (\Exception $ex) { - $message = sprintf("Unable to process your request. Please try again (%s).", $ex->getMessage()); + $message = sprintf("Unable to process your request. Please try again (%s in %s).", $ex->getMessage(), $ex->getFile()); } // Store the form name in session (see Form Smarty plugin to find usage of this parameter) $request->getSession()->setErrorFormName($form->getName()); + // Put the message in the ParserContext to make it available to the template + $this->parserContext->set('customer_login_error_message', $message); + // A this point, the same view is displayed again. } public function changePassword(ActionEvent $event) { - + // TODO } /** @@ -230,8 +261,36 @@ class Customer implements EventSubscriberInterface return array( "action.createCustomer" => array("create", 128), "action.modifyCustomer" => array("modify", 128), - "action.loginCustomer" => array("login", 128) + "action.loginCustomer" => array("login", 128), + "action.logoutCustomer" => array("logout", 128), ); } + /** + * Stores the current user in the security context, and redirect to the + * success_url. + * + * @param CustomerModel $user the logged user + */ + protected function processSuccessfulLogin(ActionEvent $event, CustomerModel $user, BaseForm $form, $sendLoginEvent = false) + { + // Success -> store user in security context + $this->getSecurityContext()->setUser($user); + + if ($sendLoginEvent) $event->getDispatcher()->dispatch(TheliaEvents::CUSTOMER_LOGIN, $event); + + // Redirect to the success URL + return Redirect::exec($form->getSuccessUrl()); + } + + /** + * Return the security context, beeing sure that we're in the CONTEXT_FRONT_OFFICE context + * + * @return SecurityContext the security context + */ + protected function getSecurityContext() { + $this->securityContext->setContext(SecurityContext::CONTEXT_FRONT_OFFICE); + + return $this->securityContext; + } } diff --git a/core/lib/Thelia/Admin/Controller/BaseAdminController.php b/core/lib/Thelia/Admin/Controller/BaseAdminController.php index 773f9cccc..e13f10da2 100755 --- a/core/lib/Thelia/Admin/Controller/BaseAdminController.php +++ b/core/lib/Thelia/Admin/Controller/BaseAdminController.php @@ -94,8 +94,9 @@ class BaseAdminController extends ContainerAware catch (AuthenticationException $ex) { // User is not authenticated, and templates requires authentication -> redirect to login page - // (see Thelia\Core\Template\Smarty\Plugins\Security) - Redirect::exec(URL::absoluteUrl('admin/login')); // FIXME shoud be a parameter + // We user login_tpl as a path, not a template. + + Redirect::exec(URL::absoluteUrl($ex->getLoginTemplate())); } } diff --git a/core/lib/Thelia/Admin/Controller/SessionController.php b/core/lib/Thelia/Admin/Controller/SessionController.php index d2febe089..115f9700c 100755 --- a/core/lib/Thelia/Admin/Controller/SessionController.php +++ b/core/lib/Thelia/Admin/Controller/SessionController.php @@ -44,7 +44,7 @@ class SessionController extends BaseAdminController { $this->getSecurityContext()->clear(); // Go back to login page. - return Redirect::exec(URL::absoluteUrl('admin/login')); + return Redirect::exec(URL::absoluteUrl('/admin/login')); // FIXME - should be a parameter } public function checkLoginAction() @@ -62,15 +62,10 @@ class SessionController extends BaseAdminController { $this->getSecurityContext()->setUser($user); // Log authentication success - AdminLog::append("Authentication successufull", $request, $user); - - // Get the success URL to redirect the user to - $successUrl = $form->getForm()->get('success_url')->getData(); - - if (null == $successUrl) $successUrl = 'admin/home'; + AdminLog::append("Authentication successuful", $request, $user); // Redirect to the success URL - return Redirect::exec(URL::absoluteUrl($successUrl)); + return Redirect::exec($form->getSuccessUrl()); } catch (ValidatorException $ex) { diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index 1fd380425..935faa8c3 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -20,7 +20,9 @@ + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 4315d2844..94cae432a 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -58,16 +58,24 @@ + + + + + + + false %kernel.environment% %kernel.debug% + diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 46dd89ee6..d570c22a1 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -48,9 +48,14 @@ final class TheliaEvents */ const INCLUSION = "thelia.include"; - const BEFORE_CREATECUSTOMER = "action.before_createcustomer"; + const CUSTOMER_LOGOUT = "action.customer_logout"; + const CUSTOMER_LOGIN = "action.customer_login"; - const AFTER_CREATECUSTOMER = "action.after_createcustomer"; + const BEFORE_CREATECUSTOMER = "action.before_createcustomer"; + const AFTER_CREATECUSTOMER = "action.after_createcustomer"; + + const BEFORE_CHANGECUSTOMER = "action.before_changecustomer"; + const AFTER_CHANGECUSTOMER = "action.after_changecustomer"; const CREATECUSTOMER_CUSTOMREF = "customer.creation.customref"; } diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index a67d7f0e2..2017fe6ae 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -90,8 +90,6 @@ class ViewListener implements EventSubscriberInterface // Redirect to the login template $event->setResponse(Redirect::exec(URL::viewUrl($ex->getLoginTemplate()))); } - - throw new \Exception("toto !"); } public function beforeKernelView(GetResponseForControllerResultEvent $event) diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index bf47310b2..ac684f6c6 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -27,6 +27,7 @@ use Symfony\Component\HttpFoundation\Session\Session as BaseSession; use Thelia\Core\Security\User\UserInterface; use Thelia\Form\BaseForm; use Thelia\Model\ConfigQuery; +use Thelia\Tools\URL; class Session extends BaseSession { @@ -109,7 +110,7 @@ class Session extends BaseSession { */ public function getReturnToUrl() { - return $this->get('return_to_url', ConfigQuery::read('base_url')); + return $this->get('return_to_url', URL::getIndexPage()); } } diff --git a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php index 1097edf5a..a5b1b32e4 100644 --- a/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php +++ b/core/lib/Thelia/Core/Security/Authentication/CustomerUsernamePasswordFormAuthenticator.php @@ -37,7 +37,7 @@ class CustomerUsernamePasswordFormAuthenticator extends UsernamePasswordFormAuth $loginForm, new CustomerUserProvider(), array( - 'username_field_name', 'email' + 'username_field_name' => 'email' ) ); } diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php new file mode 100644 index 000000000..8d1d50fdc --- /dev/null +++ b/core/lib/Thelia/Core/Template/ParserContext.php @@ -0,0 +1,62 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Template; + +use Thelia\Model\ConfigQuery; +use Thelia\Core\HttpFoundation\Request; +use Thelia\Tools\URL; +/** + * The parser context is an application-wide context, which stores var-value pairs. + * Theses pairs are injected in the parser and becomes available to the templates. + * + * @author Franck Allimant + */ +class ParserContext implements \IteratorAggregate +{ + private $store = array(); + + public function __construct(Request $request) { + + // Setup basic variables + $this + ->set('base_url' , ConfigQuery::read('base_url', '/')) + ->set('index_page' , URL::getIndexPage()) + ->set('return_to_url' , URL::absoluteUrl($request->getSession()->getReturnToUrl())) + ; + } + + public function set($name, $value) { + $this->store[$name] = $value; + + return $this; + } + + public function get($name) { + return $this->store[$name]; + } + + public function getIterator() { + return new \ArrayIterator( $this->store ); + } +} diff --git a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php index 5610785d8..1f8a3cb2e 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php +++ b/core/lib/Thelia/Core/Template/Smarty/Assets/SmartyAssetsManager.php @@ -73,7 +73,7 @@ class SmartyAssetsManager $url = $this->assetic_manager->asseticize( $asset_dir.'/'.$asset_file, $this->web_root."/".$this->path_relative_to_web_root, - URL::absoluteUrl($this->path_relative_to_web_root), + URL::absoluteUrl($this->path_relative_to_web_root, array(), true /* path only */), $assetType, $filters, $debug diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php index cef25cc33..c2c75dffc 100644 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php @@ -47,7 +47,7 @@ class UrlGenerator implements SmartyPluginInterface public function generateUrlFunction($params, &$smarty) { // the path to process - $path =trim($params['path']); + $path = trim($params['path']); return URL::absoluteUrl($path, $this->getArgsFromParam($params)); } @@ -61,10 +61,17 @@ class UrlGenerator implements SmartyPluginInterface */ public function generateViewUrlFunction($params, &$smarty) { - // the path to process + // the view name (without .html) $view = trim($params['view']); - return URL::viewUrl($view, $this->getArgsFromParam($params)); + // the related action (optionale) + $action = trim($params['action']); + + $args = $this->getArgsFromParam($params); + + if (! empty($action)) $args['action'] = $action; + + return URL::viewUrl($view, $args); } /** @@ -82,18 +89,6 @@ class UrlGenerator implements SmartyPluginInterface return array(); } - /** - * Process view url generator function - * - * @param array $params - * @param unknown $smarty - * @return string no text is returned. - */ - public function generateReturnToUrl($params, &$smarty) - { - return URL::absoluteUrl($this->request->getSession()->getReturnToUrl()); - } - /** * Define the various smarty plugins hendled by this class * @@ -103,8 +98,7 @@ class UrlGenerator implements SmartyPluginInterface { return array( new SmartyPluginDescriptor('function', 'url', $this, 'generateUrlFunction'), - new SmartyPluginDescriptor('function', 'viewurl', $this, 'generateViewUrlFunction'), - new SmartyPluginDescriptor('function', 'return_to_url', $this, 'generateReturnToUrl') + new SmartyPluginDescriptor('function', 'viewurl', $this, 'generateViewUrlFunction') ); } } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index e39094088..a1e63dbf8 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -12,6 +12,8 @@ use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\Smarty\SmartyPluginInterface; use Thelia\Core\Template\Exception\ResourceNotFoundException; +use Thelia\Core\Template\ParserContext; +use Thelia\Model\ConfigQuery; /** * @@ -23,7 +25,9 @@ class SmartyParser extends Smarty implements ParserInterface public $plugins = array(); - protected $request, $dispatcher; + protected $request; + protected $dispatcher; + protected $parserContext; protected $template = ""; @@ -36,12 +40,15 @@ class SmartyParser extends Smarty implements ParserInterface * @param string $env * @param bool $debug */ - public function __construct(Request $request, EventDispatcherInterface $dispatcher, $template = false, $env = "prod", $debug = false) + public function __construct( + Request $request, EventDispatcherInterface $dispatcher, ParserContext $parserContext, + $template = false, $env = "prod", $debug = false) { parent::__construct(); $this->request = $request; $this->dispatcher = $dispatcher; + $this->parserContext = $parserContext; // Configure basic Smarty parameters @@ -51,11 +58,11 @@ class SmartyParser extends Smarty implements ParserInterface $cache_dir = THELIA_ROOT . 'cache/'. $env .'/smarty/cache'; if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true); - $this->setTemplate($template ?: 'smarty-sample'); // FIXME: put this in configuration - $this->setCompileDir($compile_dir); $this->setCacheDir($cache_dir); + $this->setTemplate($template ?: ConfigQuery::read('active-template', 'default')); + $this->debugging = $debug; // Prevent smarty ErrorException: Notice: Undefined index bla bla bla... @@ -110,8 +117,13 @@ class SmartyParser extends Smarty implements ParserInterface * @param array $parameters an associative array of names / value pairs * @return string the rendered template text */ - public function render($realTemplateName, array $parameters) + public function render($realTemplateName, array $parameters = array()) { + // Assign the parserContext variables + foreach($this->parserContext as $var => $value) { + $this->assign($var, $value); + } + $this->assign($parameters); return $this->fetch($realTemplateName); @@ -126,11 +138,12 @@ class SmartyParser extends Smarty implements ParserInterface { try { $templateFile = $this->getTemplateFilePath(); - } catch(\RuntimeException $e) { + } + catch(\RuntimeException $e) { return new Response($e->getMessage(), "404"); } - return $this->fetch($templateFile); + return $this->render($templateFile); } /** diff --git a/core/lib/Thelia/Form/AdminLogin.php b/core/lib/Thelia/Form/AdminLogin.php index 6a96d4c78..5ed78a575 100755 --- a/core/lib/Thelia/Form/AdminLogin.php +++ b/core/lib/Thelia/Form/AdminLogin.php @@ -46,7 +46,6 @@ class AdminLogin extends BaseForm { ->add("remember_me", "checkbox", array( 'value' => 'yes' )) - ->add("success_url", "text") ; } diff --git a/core/lib/Thelia/Form/BaseForm.php b/core/lib/Thelia/Form/BaseForm.php index 40753b256..cebdd1f0b 100755 --- a/core/lib/Thelia/Form/BaseForm.php +++ b/core/lib/Thelia/Form/BaseForm.php @@ -31,6 +31,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfExtension; use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider; use Symfony\Component\Validator\Validation; use Thelia\Model\ConfigQuery; +use Thelia\Tools\URL; abstract class BaseForm { /** @@ -72,7 +73,7 @@ abstract class BaseForm { // If not already set, define the success_url field if (! $this->formBuilder->has('success_url')) { - $this->formBuilder->add("success_url", "text") + $this->formBuilder->add("success_url", "text"); } $this->form = $this->formBuilder->getForm(); diff --git a/core/lib/Thelia/Form/CustomerLogin.php b/core/lib/Thelia/Form/CustomerLogin.php index 64937cbf6..52357dbd6 100644 --- a/core/lib/Thelia/Form/CustomerLogin.php +++ b/core/lib/Thelia/Form/CustomerLogin.php @@ -46,7 +46,6 @@ class CustomerLogin extends BaseForm { ) )) ->add("remember_me", "checkbox") - ->add("success_url", "text") ; } diff --git a/core/lib/Thelia/Model/Base/Address.php b/core/lib/Thelia/Model/Base/Address.php index 208d43cdb..e0864f269 100755 --- a/core/lib/Thelia/Model/Base/Address.php +++ b/core/lib/Thelia/Model/Base/Address.php @@ -149,11 +149,11 @@ abstract class Address implements ActiveRecordInterface protected $cellphone; /** - * The value for the default field. + * The value for the is_default field. * Note: this column has a database default value of: 0 * @var int */ - protected $default; + protected $is_default; /** * The value for the created_at field. @@ -193,7 +193,7 @@ abstract class Address implements ActiveRecordInterface */ public function applyDefaultValues() { - $this->default = 0; + $this->is_default = 0; } /** @@ -618,14 +618,14 @@ abstract class Address implements ActiveRecordInterface } /** - * Get the [default] column value. + * Get the [is_default] column value. * * @return int */ - public function getDefault() + public function getIsDefault() { - return $this->default; + return $this->is_default; } /** @@ -992,25 +992,25 @@ abstract class Address implements ActiveRecordInterface } // setCellphone() /** - * Set the value of [default] column. + * Set the value of [is_default] column. * * @param int $v new value * @return \Thelia\Model\Address The current object (for fluent API support) */ - public function setDefault($v) + public function setIsDefault($v) { if ($v !== null) { $v = (int) $v; } - if ($this->default !== $v) { - $this->default = $v; - $this->modifiedColumns[] = AddressTableMap::DEFAULT; + if ($this->is_default !== $v) { + $this->is_default = $v; + $this->modifiedColumns[] = AddressTableMap::IS_DEFAULT; } return $this; - } // setDefault() + } // setIsDefault() /** * Sets the value of [created_at] column to a normalized version of the date/time value specified. @@ -1064,7 +1064,7 @@ abstract class Address implements ActiveRecordInterface */ public function hasOnlyDefaultValues() { - if ($this->default !== 0) { + if ($this->is_default !== 0) { return false; } @@ -1140,8 +1140,8 @@ abstract class Address implements ActiveRecordInterface $col = $row[TableMap::TYPE_NUM == $indexType ? 14 + $startcol : AddressTableMap::translateFieldName('Cellphone', TableMap::TYPE_PHPNAME, $indexType)]; $this->cellphone = (null !== $col) ? (string) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : AddressTableMap::translateFieldName('Default', TableMap::TYPE_PHPNAME, $indexType)]; - $this->default = (null !== $col) ? (int) $col : null; + $col = $row[TableMap::TYPE_NUM == $indexType ? 15 + $startcol : AddressTableMap::translateFieldName('IsDefault', TableMap::TYPE_PHPNAME, $indexType)]; + $this->is_default = (null !== $col) ? (int) $col : null; $col = $row[TableMap::TYPE_NUM == $indexType ? 16 + $startcol : AddressTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { @@ -1454,8 +1454,8 @@ abstract class Address implements ActiveRecordInterface if ($this->isColumnModified(AddressTableMap::CELLPHONE)) { $modifiedColumns[':p' . $index++] = 'CELLPHONE'; } - if ($this->isColumnModified(AddressTableMap::DEFAULT)) { - $modifiedColumns[':p' . $index++] = 'DEFAULT'; + if ($this->isColumnModified(AddressTableMap::IS_DEFAULT)) { + $modifiedColumns[':p' . $index++] = 'IS_DEFAULT'; } if ($this->isColumnModified(AddressTableMap::CREATED_AT)) { $modifiedColumns[':p' . $index++] = 'CREATED_AT'; @@ -1519,8 +1519,8 @@ abstract class Address implements ActiveRecordInterface case 'CELLPHONE': $stmt->bindValue($identifier, $this->cellphone, PDO::PARAM_STR); break; - case 'DEFAULT': - $stmt->bindValue($identifier, $this->default, PDO::PARAM_INT); + case 'IS_DEFAULT': + $stmt->bindValue($identifier, $this->is_default, PDO::PARAM_INT); break; case 'CREATED_AT': $stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR); @@ -1636,7 +1636,7 @@ abstract class Address implements ActiveRecordInterface return $this->getCellphone(); break; case 15: - return $this->getDefault(); + return $this->getIsDefault(); break; case 16: return $this->getCreatedAt(); @@ -1688,7 +1688,7 @@ abstract class Address implements ActiveRecordInterface $keys[12] => $this->getCountryId(), $keys[13] => $this->getPhone(), $keys[14] => $this->getCellphone(), - $keys[15] => $this->getDefault(), + $keys[15] => $this->getIsDefault(), $keys[16] => $this->getCreatedAt(), $keys[17] => $this->getUpdatedAt(), ); @@ -1785,7 +1785,7 @@ abstract class Address implements ActiveRecordInterface $this->setCellphone($value); break; case 15: - $this->setDefault($value); + $this->setIsDefault($value); break; case 16: $this->setCreatedAt($value); @@ -1832,7 +1832,7 @@ abstract class Address implements ActiveRecordInterface if (array_key_exists($keys[12], $arr)) $this->setCountryId($arr[$keys[12]]); if (array_key_exists($keys[13], $arr)) $this->setPhone($arr[$keys[13]]); if (array_key_exists($keys[14], $arr)) $this->setCellphone($arr[$keys[14]]); - if (array_key_exists($keys[15], $arr)) $this->setDefault($arr[$keys[15]]); + if (array_key_exists($keys[15], $arr)) $this->setIsDefault($arr[$keys[15]]); if (array_key_exists($keys[16], $arr)) $this->setCreatedAt($arr[$keys[16]]); if (array_key_exists($keys[17], $arr)) $this->setUpdatedAt($arr[$keys[17]]); } @@ -1861,7 +1861,7 @@ abstract class Address implements ActiveRecordInterface if ($this->isColumnModified(AddressTableMap::COUNTRY_ID)) $criteria->add(AddressTableMap::COUNTRY_ID, $this->country_id); if ($this->isColumnModified(AddressTableMap::PHONE)) $criteria->add(AddressTableMap::PHONE, $this->phone); if ($this->isColumnModified(AddressTableMap::CELLPHONE)) $criteria->add(AddressTableMap::CELLPHONE, $this->cellphone); - if ($this->isColumnModified(AddressTableMap::DEFAULT)) $criteria->add(AddressTableMap::DEFAULT, $this->default); + if ($this->isColumnModified(AddressTableMap::IS_DEFAULT)) $criteria->add(AddressTableMap::IS_DEFAULT, $this->is_default); if ($this->isColumnModified(AddressTableMap::CREATED_AT)) $criteria->add(AddressTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(AddressTableMap::UPDATED_AT)) $criteria->add(AddressTableMap::UPDATED_AT, $this->updated_at); @@ -1941,7 +1941,7 @@ abstract class Address implements ActiveRecordInterface $copyObj->setCountryId($this->getCountryId()); $copyObj->setPhone($this->getPhone()); $copyObj->setCellphone($this->getCellphone()); - $copyObj->setDefault($this->getDefault()); + $copyObj->setIsDefault($this->getIsDefault()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($makeNew) { @@ -2094,7 +2094,7 @@ abstract class Address implements ActiveRecordInterface $this->country_id = null; $this->phone = null; $this->cellphone = null; - $this->default = null; + $this->is_default = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; diff --git a/core/lib/Thelia/Model/Base/AddressQuery.php b/core/lib/Thelia/Model/Base/AddressQuery.php index c0b32975d..f9dc30efc 100755 --- a/core/lib/Thelia/Model/Base/AddressQuery.php +++ b/core/lib/Thelia/Model/Base/AddressQuery.php @@ -36,7 +36,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddressQuery orderByCountryId($order = Criteria::ASC) Order by the country_id column * @method ChildAddressQuery orderByPhone($order = Criteria::ASC) Order by the phone column * @method ChildAddressQuery orderByCellphone($order = Criteria::ASC) Order by the cellphone column - * @method ChildAddressQuery orderByDefault($order = Criteria::ASC) Order by the default column + * @method ChildAddressQuery orderByIsDefault($order = Criteria::ASC) Order by the is_default column * @method ChildAddressQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildAddressQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * @@ -55,7 +55,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddressQuery groupByCountryId() Group by the country_id column * @method ChildAddressQuery groupByPhone() Group by the phone column * @method ChildAddressQuery groupByCellphone() Group by the cellphone column - * @method ChildAddressQuery groupByDefault() Group by the default column + * @method ChildAddressQuery groupByIsDefault() Group by the is_default column * @method ChildAddressQuery groupByCreatedAt() Group by the created_at column * @method ChildAddressQuery groupByUpdatedAt() Group by the updated_at column * @@ -89,7 +89,7 @@ use Thelia\Model\Map\AddressTableMap; * @method ChildAddress findOneByCountryId(int $country_id) Return the first ChildAddress filtered by the country_id column * @method ChildAddress findOneByPhone(string $phone) Return the first ChildAddress filtered by the phone column * @method ChildAddress findOneByCellphone(string $cellphone) Return the first ChildAddress filtered by the cellphone column - * @method ChildAddress findOneByDefault(int $default) Return the first ChildAddress filtered by the default column + * @method ChildAddress findOneByIsDefault(int $is_default) Return the first ChildAddress filtered by the is_default column * @method ChildAddress findOneByCreatedAt(string $created_at) Return the first ChildAddress filtered by the created_at column * @method ChildAddress findOneByUpdatedAt(string $updated_at) Return the first ChildAddress filtered by the updated_at column * @@ -108,7 +108,7 @@ use Thelia\Model\Map\AddressTableMap; * @method array findByCountryId(int $country_id) Return ChildAddress objects filtered by the country_id column * @method array findByPhone(string $phone) Return ChildAddress objects filtered by the phone column * @method array findByCellphone(string $cellphone) Return ChildAddress objects filtered by the cellphone column - * @method array findByDefault(int $default) Return ChildAddress objects filtered by the default column + * @method array findByIsDefault(int $is_default) Return ChildAddress objects filtered by the is_default column * @method array findByCreatedAt(string $created_at) Return ChildAddress objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildAddress objects filtered by the updated_at column * @@ -199,7 +199,7 @@ abstract class AddressQuery extends ModelCriteria */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, TITLE, CUSTOMER_ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; + $sql = 'SELECT ID, TITLE, CUSTOMER_ID, CUSTOMER_TITLE_ID, COMPANY, FIRSTNAME, LASTNAME, ADDRESS1, ADDRESS2, ADDRESS3, ZIPCODE, CITY, COUNTRY_ID, PHONE, CELLPHONE, IS_DEFAULT, CREATED_AT, UPDATED_AT FROM address WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -776,16 +776,16 @@ abstract class AddressQuery extends ModelCriteria } /** - * Filter the query on the default column + * Filter the query on the is_default column * * Example usage: * - * $query->filterByDefault(1234); // WHERE default = 1234 - * $query->filterByDefault(array(12, 34)); // WHERE default IN (12, 34) - * $query->filterByDefault(array('min' => 12)); // WHERE default > 12 + * $query->filterByIsDefault(1234); // WHERE is_default = 1234 + * $query->filterByIsDefault(array(12, 34)); // WHERE is_default IN (12, 34) + * $query->filterByIsDefault(array('min' => 12)); // WHERE is_default > 12 * * - * @param mixed $default The value to use as filter. + * @param mixed $isDefault The value to use as filter. * Use scalar values for equality. * Use array values for in_array() equivalent. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. @@ -793,16 +793,16 @@ abstract class AddressQuery extends ModelCriteria * * @return ChildAddressQuery The current query, for fluid interface */ - public function filterByDefault($default = null, $comparison = null) + public function filterByIsDefault($isDefault = null, $comparison = null) { - if (is_array($default)) { + if (is_array($isDefault)) { $useMinMax = false; - if (isset($default['min'])) { - $this->addUsingAlias(AddressTableMap::DEFAULT, $default['min'], Criteria::GREATER_EQUAL); + if (isset($isDefault['min'])) { + $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['min'], Criteria::GREATER_EQUAL); $useMinMax = true; } - if (isset($default['max'])) { - $this->addUsingAlias(AddressTableMap::DEFAULT, $default['max'], Criteria::LESS_EQUAL); + if (isset($isDefault['max'])) { + $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault['max'], Criteria::LESS_EQUAL); $useMinMax = true; } if ($useMinMax) { @@ -813,7 +813,7 @@ abstract class AddressQuery extends ModelCriteria } } - return $this->addUsingAlias(AddressTableMap::DEFAULT, $default, $comparison); + return $this->addUsingAlias(AddressTableMap::IS_DEFAULT, $isDefault, $comparison); } /** diff --git a/core/lib/Thelia/Model/Customer.php b/core/lib/Thelia/Model/Customer.php index a6bd5f07c..38bdc1dab 100755 --- a/core/lib/Thelia/Model/Customer.php +++ b/core/lib/Thelia/Model/Customer.php @@ -15,6 +15,7 @@ use Thelia\Core\Security\User\UserInterface; use Propel\Runtime\Connection\ConnectionInterface; use Propel\Runtime\Propel; use Thelia\Model\Map\CustomerTableMap; +use Thelia\Core\Security\Role\Role; /** * Skeleton subclass for representing a row from the 'customer' table. @@ -87,7 +88,7 @@ class Customer extends BaseCustomer implements UserInterface ->setCellphone($cellphone) ->setZipcode($zipcode) ->setCountryId($countryId) - ->setDefault(1) + ->setIsDefault(1) ->setCustomer($this) ->save($con); @@ -114,7 +115,7 @@ class Customer extends BaseCustomer implements UserInterface protected function generateRef() { - return date("YmdHI"); + return date("YmdHisu"); } public function setPassword($password) diff --git a/core/lib/Thelia/Model/Map/AddressTableMap.php b/core/lib/Thelia/Model/Map/AddressTableMap.php index 5a360f08e..a67d383fb 100755 --- a/core/lib/Thelia/Model/Map/AddressTableMap.php +++ b/core/lib/Thelia/Model/Map/AddressTableMap.php @@ -145,9 +145,9 @@ class AddressTableMap extends TableMap const CELLPHONE = 'address.CELLPHONE'; /** - * the column name for the DEFAULT field + * the column name for the IS_DEFAULT field */ - const DEFAULT = 'address.DEFAULT'; + const IS_DEFAULT = 'address.IS_DEFAULT'; /** * the column name for the CREATED_AT field @@ -171,11 +171,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'Default', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'default', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'default', 'created_at', 'updated_at', ), + self::TYPE_PHPNAME => array('Id', 'Title', 'CustomerId', 'CustomerTitleId', 'Company', 'Firstname', 'Lastname', 'Address1', 'Address2', 'Address3', 'Zipcode', 'City', 'CountryId', 'Phone', 'Cellphone', 'IsDefault', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'title', 'customerId', 'customerTitleId', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'countryId', 'phone', 'cellphone', 'isDefault', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(AddressTableMap::ID, AddressTableMap::TITLE, AddressTableMap::CUSTOMER_ID, AddressTableMap::CUSTOMER_TITLE_ID, AddressTableMap::COMPANY, AddressTableMap::FIRSTNAME, AddressTableMap::LASTNAME, AddressTableMap::ADDRESS1, AddressTableMap::ADDRESS2, AddressTableMap::ADDRESS3, AddressTableMap::ZIPCODE, AddressTableMap::CITY, AddressTableMap::COUNTRY_ID, AddressTableMap::PHONE, AddressTableMap::CELLPHONE, AddressTableMap::IS_DEFAULT, AddressTableMap::CREATED_AT, AddressTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'TITLE', 'CUSTOMER_ID', 'CUSTOMER_TITLE_ID', 'COMPANY', 'FIRSTNAME', 'LASTNAME', 'ADDRESS1', 'ADDRESS2', 'ADDRESS3', 'ZIPCODE', 'CITY', 'COUNTRY_ID', 'PHONE', 'CELLPHONE', 'IS_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'title', 'customer_id', 'customer_title_id', 'company', 'firstname', 'lastname', 'address1', 'address2', 'address3', 'zipcode', 'city', 'country_id', 'phone', 'cellphone', 'is_default', 'created_at', 'updated_at', ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -186,11 +186,11 @@ class AddressTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'Default' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'default' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), - self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), - self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'default' => 15, 'created_at' => 16, 'updated_at' => 17, ), + self::TYPE_PHPNAME => array('Id' => 0, 'Title' => 1, 'CustomerId' => 2, 'CustomerTitleId' => 3, 'Company' => 4, 'Firstname' => 5, 'Lastname' => 6, 'Address1' => 7, 'Address2' => 8, 'Address3' => 9, 'Zipcode' => 10, 'City' => 11, 'CountryId' => 12, 'Phone' => 13, 'Cellphone' => 14, 'IsDefault' => 15, 'CreatedAt' => 16, 'UpdatedAt' => 17, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'title' => 1, 'customerId' => 2, 'customerTitleId' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'countryId' => 12, 'phone' => 13, 'cellphone' => 14, 'isDefault' => 15, 'createdAt' => 16, 'updatedAt' => 17, ), + self::TYPE_COLNAME => array(AddressTableMap::ID => 0, AddressTableMap::TITLE => 1, AddressTableMap::CUSTOMER_ID => 2, AddressTableMap::CUSTOMER_TITLE_ID => 3, AddressTableMap::COMPANY => 4, AddressTableMap::FIRSTNAME => 5, AddressTableMap::LASTNAME => 6, AddressTableMap::ADDRESS1 => 7, AddressTableMap::ADDRESS2 => 8, AddressTableMap::ADDRESS3 => 9, AddressTableMap::ZIPCODE => 10, AddressTableMap::CITY => 11, AddressTableMap::COUNTRY_ID => 12, AddressTableMap::PHONE => 13, AddressTableMap::CELLPHONE => 14, AddressTableMap::IS_DEFAULT => 15, AddressTableMap::CREATED_AT => 16, AddressTableMap::UPDATED_AT => 17, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'TITLE' => 1, 'CUSTOMER_ID' => 2, 'CUSTOMER_TITLE_ID' => 3, 'COMPANY' => 4, 'FIRSTNAME' => 5, 'LASTNAME' => 6, 'ADDRESS1' => 7, 'ADDRESS2' => 8, 'ADDRESS3' => 9, 'ZIPCODE' => 10, 'CITY' => 11, 'COUNTRY_ID' => 12, 'PHONE' => 13, 'CELLPHONE' => 14, 'IS_DEFAULT' => 15, 'CREATED_AT' => 16, 'UPDATED_AT' => 17, ), + self::TYPE_FIELDNAME => array('id' => 0, 'title' => 1, 'customer_id' => 2, 'customer_title_id' => 3, 'company' => 4, 'firstname' => 5, 'lastname' => 6, 'address1' => 7, 'address2' => 8, 'address3' => 9, 'zipcode' => 10, 'city' => 11, 'country_id' => 12, 'phone' => 13, 'cellphone' => 14, 'is_default' => 15, 'created_at' => 16, 'updated_at' => 17, ), self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ) ); @@ -225,7 +225,7 @@ class AddressTableMap extends TableMap $this->addColumn('COUNTRY_ID', 'CountryId', 'INTEGER', true, null, null); $this->addColumn('PHONE', 'Phone', 'VARCHAR', false, 20, null); $this->addColumn('CELLPHONE', 'Cellphone', 'VARCHAR', false, 20, null); - $this->addColumn('DEFAULT', 'Default', 'TINYINT', false, null, 0); + $this->addColumn('IS_DEFAULT', 'IsDefault', 'TINYINT', false, null, 0); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); } // initialize() @@ -405,7 +405,7 @@ class AddressTableMap extends TableMap $criteria->addSelectColumn(AddressTableMap::COUNTRY_ID); $criteria->addSelectColumn(AddressTableMap::PHONE); $criteria->addSelectColumn(AddressTableMap::CELLPHONE); - $criteria->addSelectColumn(AddressTableMap::DEFAULT); + $criteria->addSelectColumn(AddressTableMap::IS_DEFAULT); $criteria->addSelectColumn(AddressTableMap::CREATED_AT); $criteria->addSelectColumn(AddressTableMap::UPDATED_AT); } else { @@ -424,7 +424,7 @@ class AddressTableMap extends TableMap $criteria->addSelectColumn($alias . '.COUNTRY_ID'); $criteria->addSelectColumn($alias . '.PHONE'); $criteria->addSelectColumn($alias . '.CELLPHONE'); - $criteria->addSelectColumn($alias . '.DEFAULT'); + $criteria->addSelectColumn($alias . '.IS_DEFAULT'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); } diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index ae30d7280..4f8480eab 100644 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -27,19 +27,30 @@ use Thelia\Model\ConfigQuery; class URL { + public static function getIndexPage() { + return ConfigQuery::read('base_url', '/') . "index_dev.php"; // FIXME ! + } + /** - * Returns the Absolute URL for a given path relative to web root + * Returns the Absolute URL for a given path relative to web root. By default, + * the index.php (or index_dev.php) script name is added to the URL, use + * $path_only = true to get a path without the index script. * - * @param string $path the relative path - * @param mixed $parameters An array of parameters + * @param string $path the relative path + * @param array $parameters An array of parameters + * @param boolean $path_only if true, getIndexPage() will not be added * * @return string The generated URL */ - public static function absoluteUrl($path, array $parameters = array()) + public static function absoluteUrl($path, array $parameters = array(), $path_only = false) { // Already absolute ? - if (substr($path, 0, 4) != 'http') - $base = ConfigQuery::read('base_url', '/') . ltrim($path, '/'); + if (substr($path, 0, 4) != 'http') { + + $root = $path_only ? ConfigQuery::read('base_url', '/') : self::getIndexPage(); + + $base = $root . $path; + } else $base = $path; @@ -49,7 +60,9 @@ class URL $queryString = sprintf("%s=%s&", urlencode($name), urlencode($value)); } - if ('' !== $queryString = rtrim($queryString, "&")) $queryString = '?' . $queryString; + $sepChar = strstr($base, '?') === false ? '?' : '&'; + + if ('' !== $queryString = rtrim($queryString, "&")) $queryString = $sepChar . $queryString; return $base . $queryString; } @@ -63,7 +76,8 @@ class URL * @return string The generated URL */ public static function viewUrl($viewName, array $parameters = array()) { - $path = sprintf("%s?view=%s", ConfigQuery::read('base_url', '/'), $viewName); + + $path = sprintf("%s?view=%s", self::getIndexPage(), $viewName); return self::absoluteUrl($path, $parameters); } diff --git a/install/INSTALL-TODO.txt b/install/INSTALL-TODO.txt index 91662f2b7..772946a7c 100644 --- a/install/INSTALL-TODO.txt +++ b/install/INSTALL-TODO.txt @@ -7,3 +7,4 @@ Variables Config à initialiser: - base_admin_template : chemin du template admin relatif au repertoire template (ex. admin/default) - default_locale : la locale par défaut (ex. en_US), à utiliser pour les fichiers de traduction - asset_dir_from_web_root : le chemin relatif à /web du repertoires des assets (ex. assets) +- active_template: chemin du template front relatif au repertoire template (ex. default) diff --git a/install/thelia.sql b/install/thelia.sql index c7d750778..36b041e11 100755 --- a/install/thelia.sql +++ b/install/thelia.sql @@ -491,7 +491,7 @@ CREATE TABLE `address` `country_id` INTEGER NOT NULL, `phone` VARCHAR(20), `cellphone` VARCHAR(20), - `default` TINYINT DEFAULT 0, + `is_default` TINYINT DEFAULT 0, `created_at` DATETIME, `updated_at` DATETIME, PRIMARY KEY (`id`), diff --git a/local/config/schema.xml b/local/config/schema.xml index 4b9b99de6..7c005fd56 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,927 +1,927 @@ - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
+
diff --git a/templates/admin/default/home.html b/templates/admin/default/home.html index 79266eadb..ebd61a7d1 100755 --- a/templates/admin/default/home.html +++ b/templates/admin/default/home.html @@ -1,4 +1,4 @@ -{check_auth context="admin" roles="ROLE_ADMIN" login_url="login"} +{check_auth context="admin" roles="ROLE_ADMIN" login_tpl="/admin/login"} {$page_title={intl l='Home'}} {include file='includes/header.inc.html'} diff --git a/templates/admin/default/login.html b/templates/admin/default/login.html index 1f8146993..782073640 100755 --- a/templates/admin/default/login.html +++ b/templates/admin/default/login.html @@ -14,14 +14,14 @@

{intl l='Thelia Back Office'}

{form name="thelia.admin.login" success_url="home" error_url="login"} -
+ {if isset($message)}
{$message}
{/if} {form_hidden_fields form=$form} {form_field form=$form field='success_url'} - {* on success, redirect to /admin *} + {* on success, redirect to /admin *} {/form_field} {form_field form=$form field='username'} diff --git a/templates/smarty-sample/assets/bootstrap/css/bootstrap-responsive.css b/templates/default/assets/bootstrap/css/bootstrap-responsive.css similarity index 100% rename from templates/smarty-sample/assets/bootstrap/css/bootstrap-responsive.css rename to templates/default/assets/bootstrap/css/bootstrap-responsive.css diff --git a/templates/smarty-sample/assets/bootstrap/css/bootstrap-responsive.min.css b/templates/default/assets/bootstrap/css/bootstrap-responsive.min.css similarity index 100% rename from templates/smarty-sample/assets/bootstrap/css/bootstrap-responsive.min.css rename to templates/default/assets/bootstrap/css/bootstrap-responsive.min.css diff --git a/templates/smarty-sample/assets/bootstrap/css/bootstrap.css b/templates/default/assets/bootstrap/css/bootstrap.css similarity index 100% rename from templates/smarty-sample/assets/bootstrap/css/bootstrap.css rename to templates/default/assets/bootstrap/css/bootstrap.css diff --git a/templates/smarty-sample/assets/bootstrap/css/bootstrap.min.css b/templates/default/assets/bootstrap/css/bootstrap.min.css similarity index 100% rename from templates/smarty-sample/assets/bootstrap/css/bootstrap.min.css rename to templates/default/assets/bootstrap/css/bootstrap.min.css diff --git a/templates/smarty-sample/assets/bootstrap/img/glyphicons-halflings-white.png b/templates/default/assets/bootstrap/img/glyphicons-halflings-white.png similarity index 100% rename from templates/smarty-sample/assets/bootstrap/img/glyphicons-halflings-white.png rename to templates/default/assets/bootstrap/img/glyphicons-halflings-white.png diff --git a/templates/smarty-sample/assets/bootstrap/img/glyphicons-halflings.png b/templates/default/assets/bootstrap/img/glyphicons-halflings.png similarity index 100% rename from templates/smarty-sample/assets/bootstrap/img/glyphicons-halflings.png rename to templates/default/assets/bootstrap/img/glyphicons-halflings.png diff --git a/templates/smarty-sample/assets/bootstrap/js/bootstrap.js b/templates/default/assets/bootstrap/js/bootstrap.js similarity index 100% rename from templates/smarty-sample/assets/bootstrap/js/bootstrap.js rename to templates/default/assets/bootstrap/js/bootstrap.js diff --git a/templates/smarty-sample/assets/bootstrap/js/bootstrap.min.js b/templates/default/assets/bootstrap/js/bootstrap.min.js similarity index 100% rename from templates/smarty-sample/assets/bootstrap/js/bootstrap.min.js rename to templates/default/assets/bootstrap/js/bootstrap.min.js diff --git a/templates/smarty-sample/assets/css/img/bg.jpg b/templates/default/assets/css/img/bg.jpg similarity index 100% rename from templates/smarty-sample/assets/css/img/bg.jpg rename to templates/default/assets/css/img/bg.jpg diff --git a/templates/smarty-sample/assets/css/style.less b/templates/default/assets/css/style.less similarity index 100% rename from templates/smarty-sample/assets/css/style.less rename to templates/default/assets/css/style.less diff --git a/templates/smarty-sample/assets/img/logo-thelia-34px.png b/templates/default/assets/img/logo-thelia-34px.png similarity index 100% rename from templates/smarty-sample/assets/img/logo-thelia-34px.png rename to templates/default/assets/img/logo-thelia-34px.png diff --git a/templates/smarty-sample/assets/img/test-background.jpg b/templates/default/assets/img/test-background.jpg similarity index 100% rename from templates/smarty-sample/assets/img/test-background.jpg rename to templates/default/assets/img/test-background.jpg diff --git a/templates/smarty-sample/assets/js/jquery.min.js b/templates/default/assets/js/jquery.min.js similarity index 100% rename from templates/smarty-sample/assets/js/jquery.min.js rename to templates/default/assets/js/jquery.min.js diff --git a/templates/smarty-sample/category.html b/templates/default/category.html similarity index 100% rename from templates/smarty-sample/category.html rename to templates/default/category.html diff --git a/templates/smarty-sample/connexion.html b/templates/default/connexion.html similarity index 80% rename from templates/smarty-sample/connexion.html rename to templates/default/connexion.html index a2f9120dd..e5d8641cf 100755 --- a/templates/smarty-sample/connexion.html +++ b/templates/default/connexion.html @@ -1,7 +1,31 @@ {include file="includes/header.html"} {form name="thelia.customer.creation"} - +{* We use $index_page as form action to avoid mixing post and get data *} + + {* + The two fields below are not par of the Login form, they are here to defines + the action to process, and the view to render once the form is submited + *} + {* the action triggered by this form *} + {* the view to return to if the form cannot be validated *} + + {* + This field is common to all BaseForm instances (thus, this one), and defines + the URL the customer is redirected to once the form has been successfully + processed + *} + + {form_field form=$form field='success_url'} + {* the url the user is redirected to on login success *} + {/form_field} + + {* + customer_creation_error_message is defined in Customer action processor class, + and passed the parser through the ParserContext service. + *} + + {if isset($customer_creation_error_message)}
{$customer_creation_error_message}
{/if} {form_hidden_fields form=$form} diff --git a/templates/smarty-sample/i18n/en.php b/templates/default/i18n/en.php similarity index 100% rename from templates/smarty-sample/i18n/en.php rename to templates/default/i18n/en.php diff --git a/templates/smarty-sample/i18n/fr.php b/templates/default/i18n/fr.php similarity index 100% rename from templates/smarty-sample/i18n/fr.php rename to templates/default/i18n/fr.php diff --git a/templates/default/include1.html b/templates/default/include1.html deleted file mode 100755 index c4e876fb4..000000000 --- a/templates/default/include1.html +++ /dev/null @@ -1,2 +0,0 @@ -include 1 success
-#INCLUDE "subinclude1.html" diff --git a/templates/smarty-sample/included.html b/templates/default/included.html similarity index 100% rename from templates/smarty-sample/included.html rename to templates/default/included.html diff --git a/templates/smarty-sample/includes/footer.html b/templates/default/includes/footer.html similarity index 100% rename from templates/smarty-sample/includes/footer.html rename to templates/default/includes/footer.html diff --git a/templates/smarty-sample/includes/footer.inc.tpl b/templates/default/includes/footer.inc.tpl similarity index 100% rename from templates/smarty-sample/includes/footer.inc.tpl rename to templates/default/includes/footer.inc.tpl diff --git a/templates/default/includes/header.html b/templates/default/includes/header.html new file mode 100755 index 000000000..e18f75232 --- /dev/null +++ b/templates/default/includes/header.html @@ -0,0 +1,25 @@ + + + + {$page_title|default:{intl l="Thelia II"}} + + + {stylesheets file='../assets/css/*' filters='less,cssembed'} + + {/stylesheets} + + +
+{loop type="auth" name="customer_info_block" roles="ROLE_CUSTOMER" context="front"} +

Your are logged in ! Logout

+{/loop} + +{loop type="auth" name="admin_info_block" roles="ROLE_ADMIN" context="admin"} +

You are logged as administrator

+{/loop} + +{elseloop rel="customer_info_block"} +You are not logged in. Login now or create your account +{/elseloop} +
+
\ No newline at end of file diff --git a/templates/smarty-sample/includes/header.inc.tpl b/templates/default/includes/header.inc.tpl similarity index 100% rename from templates/smarty-sample/includes/header.inc.tpl rename to templates/default/includes/header.inc.tpl diff --git a/templates/smarty-sample/includes/menu.tpl b/templates/default/includes/menu.tpl similarity index 100% rename from templates/smarty-sample/includes/menu.tpl rename to templates/default/includes/menu.tpl diff --git a/templates/default/index.html b/templates/default/index.html index 0023dd36b..6ee109b9e 100755 --- a/templates/default/index.html +++ b/templates/default/index.html @@ -1,26 +1,151 @@ - - - - - - - -
TODO write content
- - #__COUNT__ - #TITLE
- nb child : #NB_CHILD

-
+{include file="includes/header.html"} +
- - test vrai - - test faux - -
- - Compteur = #INDEX
-
+{loop type="auth" name="auth_test" context="front" roles="ROLE_CUSTOMER"} -
- - +

Customer is authentified :-)

+{/loop} + +{elseloop rel="auth_test"} +

Customer is not authentified :-(

+{/elseloop} + +An image from asset directory : +{images file='assets/img/logo-thelia-34px.png'}{intl l='Thelia, solution e-commerce libre'}{/images} +
+ +
+{intl l='An internationalized string'} +
+ + +
+ jQuery data: +
+ +
+

Category loop example

+
    + {loop type="category" name="catloop1"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}, children: {$NB_CHILD} + {ifloop rel="inner1"} +
      + {loop type="category" name="inner1" parent="{$ID}"} +
    • Sub cat {$ID} (parent is {$PARENT}): {$TITLE}
    • + {/loop} +
    + {/ifloop} +
  • + {/loop} +
+
+ + + + +
+

Conditional example #1

+ + {ifloop rel="catloop2"} + Hey ! Loop catloop2 is not empty: +
    + {loop type="category" name="catloop2" parent="12"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} +
+ {/ifloop} + + {elseloop rel="catloop2"} +

Loop catloop2 is empty

+ {/elseloop} +
+ +
+

Conditional example #2

+ + {ifloop rel="catloop3"} + Loop catloop3 is not empty: +
    + {loop type="category" name="catloop3" parent="0"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} +
+ {/ifloop} + + {elseloop rel="catloop3"} +

Loop catloop3 is empty

+ {/elseloop} + + {elseloop rel="catloop2"} +

... but catloop2 is still empty :-)

+ {/elseloop} + +
+ +
+

Traditional for loop

+ {for $index=5 to 12 step 1} + Compteur = {$index}
+ {/for} +
+ + + +
+

Some pagination

+

PAGE 1

+
    + {loop type="category" name="catloopwithpagination1" limit="2" page="1"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} +
+

PAGE 2

+
    + {loop type="category" name="catloopwithpagination2" limit="2" page="2"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} +
+

PAGE 1000

+
    + + {loop type="category" name="catloopwithpagination1000" limit="2" page="1000"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} + + {elseloop rel="catloopwithpagination1000"} + NO RESULTS + {/elseloop} +
+
+ +
+

Some pagination with page choice

+ {assign var=current_page value=2} +

PAGE {$current_page} :

+
    + {loop type="category" name="catloopwithpaginationchoice" limit="2" page="{$current_page}"} +
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • + {/loop} +
+

page choice

+ {pageloop rel="catloopwithpaginationchoice"} + {if ${PAGE} != {$current_page}} + {if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10} + {$PAGE} + {/if} + {if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10} + ... + {/if} + {if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)} + {$PAGE} + {/if} + {else} + { {$PAGE} } + {/if} + {if {$PAGE} != {$LAST}} + - + {/if} + {/pageloop} +
+ +{include file="includes/footer.html"} \ No newline at end of file diff --git a/templates/default/login.html b/templates/default/login.html new file mode 100644 index 000000000..4e17a86aa --- /dev/null +++ b/templates/default/login.html @@ -0,0 +1,52 @@ +{include file="includes/header.html"} + +

{intl l='Please login'}

+ +{form name="thelia.customer.login" } +{* We use $index_page as form action to avoid mixing post and get data *} + + + {* + The two fields below are not par of the Login form, they are here to defines + the action to process, and the view to render once the form is submited + *} + {* the action triggered by this form *} + {* the view to return to if the form cannot be validated *} + + {* + This field is common to all BaseForm instances (thus, this one), and defines + the URL the customer is redirected to once the form has been successfully + processed + *} + + {form_field form=$form field='success_url'} + {* the url the user is redirected to on login success *} + {/form_field} + + {* + customer_login_error_message is defined in Customer action processor class, + and passed the parser through the ParserContext service. + *} + + {if isset($customer_login_error_message)}
{$customer_login_error_message}
{/if} + + {form_hidden_fields form=$form} + + {form_field form=$form field="email"} + {if #error}{#message}{/if} +
+ {/form_field} + + {form_field form=$form field='password'} +
+ {/form_field} + + {form_field form=$form field='remember_me'} + + {/form_field} + + +
+{/form} + +{include file='includes/footer.html'} \ No newline at end of file diff --git a/templates/default/myaccount.html b/templates/default/myaccount.html new file mode 100644 index 000000000..2b712f71d --- /dev/null +++ b/templates/default/myaccount.html @@ -0,0 +1,6 @@ +{check_auth context="front" roles="ROLE_CUSTOMER" login_tpl="login"} + +{$page_title="{intl l='My Account'}"} + +{include file="includes/header.html"} +{include file="includes/footer.html"} diff --git a/templates/smarty-sample/pagination.html b/templates/default/pagination.html similarity index 100% rename from templates/smarty-sample/pagination.html rename to templates/default/pagination.html diff --git a/templates/default/subinclude1.html b/templates/default/subinclude1.html deleted file mode 100755 index d777eec92..000000000 --- a/templates/default/subinclude1.html +++ /dev/null @@ -1 +0,0 @@ -subinclude1 success \ No newline at end of file diff --git a/templates/smarty-sample/includes/header.html b/templates/smarty-sample/includes/header.html deleted file mode 100755 index b48cbc770..000000000 --- a/templates/smarty-sample/includes/header.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - {$page_title|default:{intl l="Thelia II"}} - - - {stylesheets file='../assets/css/*' filters='less,cssembed'} - - {/stylesheets} - - \ No newline at end of file diff --git a/templates/smarty-sample/index.html b/templates/smarty-sample/index.html deleted file mode 100755 index 6ee109b9e..000000000 --- a/templates/smarty-sample/index.html +++ /dev/null @@ -1,151 +0,0 @@ -{include file="includes/header.html"} -
- -{loop type="auth" name="auth_test" context="front" roles="ROLE_CUSTOMER"} - -

Customer is authentified :-)

-{/loop} - -{elseloop rel="auth_test"} -

Customer is not authentified :-(

-{/elseloop} - -An image from asset directory : -{images file='assets/img/logo-thelia-34px.png'}{intl l='Thelia, solution e-commerce libre'}{/images} -
- -
-{intl l='An internationalized string'} -
- - -
- jQuery data: -
- -
-

Category loop example

-
    - {loop type="category" name="catloop1"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}, children: {$NB_CHILD} - {ifloop rel="inner1"} -
      - {loop type="category" name="inner1" parent="{$ID}"} -
    • Sub cat {$ID} (parent is {$PARENT}): {$TITLE}
    • - {/loop} -
    - {/ifloop} -
  • - {/loop} -
-
- - - - -
-

Conditional example #1

- - {ifloop rel="catloop2"} - Hey ! Loop catloop2 is not empty: -
    - {loop type="category" name="catloop2" parent="12"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} -
- {/ifloop} - - {elseloop rel="catloop2"} -

Loop catloop2 is empty

- {/elseloop} -
- -
-

Conditional example #2

- - {ifloop rel="catloop3"} - Loop catloop3 is not empty: -
    - {loop type="category" name="catloop3" parent="0"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} -
- {/ifloop} - - {elseloop rel="catloop3"} -

Loop catloop3 is empty

- {/elseloop} - - {elseloop rel="catloop2"} -

... but catloop2 is still empty :-)

- {/elseloop} - -
- -
-

Traditional for loop

- {for $index=5 to 12 step 1} - Compteur = {$index}
- {/for} -
- - - -
-

Some pagination

-

PAGE 1

-
    - {loop type="category" name="catloopwithpagination1" limit="2" page="1"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} -
-

PAGE 2

-
    - {loop type="category" name="catloopwithpagination2" limit="2" page="2"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} -
-

PAGE 1000

-
    - - {loop type="category" name="catloopwithpagination1000" limit="2" page="1000"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} - - {elseloop rel="catloopwithpagination1000"} - NO RESULTS - {/elseloop} -
-
- -
-

Some pagination with page choice

- {assign var=current_page value=2} -

PAGE {$current_page} :

-
    - {loop type="category" name="catloopwithpaginationchoice" limit="2" page="{$current_page}"} -
  • {$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}
  • - {/loop} -
-

page choice

- {pageloop rel="catloopwithpaginationchoice"} - {if ${PAGE} != {$current_page}} - {if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10} - {$PAGE} - {/if} - {if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10} - ... - {/if} - {if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)} - {$PAGE} - {/if} - {else} - { {$PAGE} } - {/if} - {if {$PAGE} != {$LAST}} - - - {/if} - {/pageloop} -
- -{include file="includes/footer.html"} \ No newline at end of file