From 7e251d72655e0f489d0ccec999b4430d2785cdc1 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 15 Apr 2014 17:40:40 +0200 Subject: [PATCH 01/10] Fixed country edition (never go back to list after edit...) --- templates/backOffice/default/countries.html | 30 +++++++++++-------- .../backOffice/default/country-edit.html | 10 +++++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/templates/backOffice/default/countries.html b/templates/backOffice/default/countries.html index 6682097b0..35c6e37a8 100644 --- a/templates/backOffice/default/countries.html +++ b/templates/backOffice/default/countries.html @@ -125,12 +125,24 @@ {/form_field} - {form_field form=$form field='title'} -
- - -
- {/form_field} + {loop type="lang" name="current-edit-lang" default_only="1"} + + {form_field form=$form field='title'} +
+ +
+ + {intl l=$TITLE} +
+
{intl l="Enter here the value in the default language (%title)" title=$TITLE}
+
+ {/form_field} + + {form_field form=$form field='locale'} + + {/form_field} + + {/loop} {form_field form=$form field='area'}
@@ -161,12 +173,6 @@
{/form_field} - {loop type="lang" name="default-lang" default_only="1"} - - {form_field form=$form field='locale'} - - {/form_field} - {/loop} {module_include location='country_create_form'} diff --git a/templates/backOffice/default/country-edit.html b/templates/backOffice/default/country-edit.html index 0eaa7fd4c..b3177a1ee 100644 --- a/templates/backOffice/default/country-edit.html +++ b/templates/backOffice/default/country-edit.html @@ -32,7 +32,13 @@ {form name="thelia.admin.country.modification"}
- {include file = "includes/inner-form-toolbar.html"} + {include + file = "includes/inner-form-toolbar.html" + hide_submit_buttons = false + + page_url = {url path="/admin/configuration/country/update/$ID"} + close_url = {url path="/admin/configuration/countries"} + }
{* Be sure to get the country ID, even if the form could not be validated *} @@ -41,7 +47,7 @@ {form_hidden_fields form=$form} {form_field form=$form field='success_url'} - + {/form_field} {form_field form=$form field='locale'} From 87ed08dc6fd41e624e9f458b4c07d67813e5e6b6 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 15 Apr 2014 17:41:33 +0200 Subject: [PATCH 02/10] Fixes #293, #294 --- .../Thelia/Config/Resources/routing/admin.xml | 4 ++++ .../Controller/Admin/HomeController.php | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 7173fa8ce..d9951780e 100644 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -16,6 +16,10 @@ Thelia\Controller\Admin\HomeController::defaultAction + + Thelia\Controller\Admin\HomeController::getLatestTheliaVersion + + Thelia\Controller\Admin\HomeController::loadStatsAjaxAction diff --git a/core/lib/Thelia/Controller/Admin/HomeController.php b/core/lib/Thelia/Controller/Admin/HomeController.php index eb7a9a2ab..21391ecc3 100644 --- a/core/lib/Thelia/Controller/Admin/HomeController.php +++ b/core/lib/Thelia/Controller/Admin/HomeController.php @@ -23,6 +23,7 @@ namespace Thelia\Controller\Admin; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\AccessManager; use Thelia\Model\CustomerQuery; use Thelia\Model\OrderQuery; @@ -39,6 +40,26 @@ class HomeController extends BaseAdminController return $this->render('home'); } + /** + * Get the latest available Thelia version from the Thelia web site. + * + * @return Thelia\Core\HttpFoundation\Response the response + */ + public function getLatestTheliaVersion() + { + if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response; + + // get the latest version + $version = @file_get_contents("http://thelia.net/version.php"); + + if ($version === false) + $version = $this->getTranslator()->trans("Not found"); + else if (! preg_match("/^[0-9.]*$/", $version)) + $version = $this->getTranslator()->trans("Unavailable"); + + return Response::create($version); + } + public function loadStatsAjaxAction() { if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, array(), AccessManager::VIEW)) return $response; From 2a6152827dd5c61b8fa9cf68ceedf28894240d60 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 15 Apr 2014 17:43:11 +0200 Subject: [PATCH 03/10] Fixes #295 --- core/lib/Thelia/Core/Security/Resource/AdminResources.php | 2 ++ install/insert.sql | 8 +++++--- templates/backOffice/default/admin-layout.tpl | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index 4d8d8ad90..7ab9e0373 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -80,6 +80,8 @@ final class AdminResources const FOLDER = "admin.folder"; + const HOME = "admin.home"; + const LANGUAGE = "admin.configuration.language"; const MAILING_SYSTEM = "admin.configuration.mailing-system"; diff --git a/install/insert.sql b/install/insert.sql index 0dd73f6ad..2baa971ad 100644 --- a/install/insert.sql +++ b/install/insert.sql @@ -1270,7 +1270,8 @@ INSERT INTO resource (`id`, `code`, `created_at`, `updated_at`) VALUES (22, 'admin.configuration.tax', NOW(), NOW()), (23, 'admin.configuration.template', NOW(), NOW()), (24, 'admin.configuration.system-log', NOW(), NOW()), -(25, 'admin.cache', NOW(), NOW()); +(25, 'admin.cache', NOW(), NOW()), +(26, 'admin.home', NOW(), NOW()); /** generated with command : php Thelia thelia:generate-resources --output sql-i18n @@ -1325,8 +1326,9 @@ INSERT INTO resource_i18n (`id`, `locale`, `title`) VALUES (24, 'en_US', 'Configuration / System Log'), (24, 'fr_FR', 'Configuration / Logs système'), (25, 'en_US', 'Configuration / Cache'), -(25, 'fr_FR', 'Configuration / Cache'); - +(25, 'fr_FR', 'Configuration / Cache'), +(26, 'en_US', 'Back-office home page'), +(26, 'fr_FR', 'Page d''acceuil de l''administration'); INSERT INTO `message` (`id`, `name`, `secured`, `created_at`, `updated_at`, `version`, `version_created_at`, `version_created_by`) VALUES (1, 'order_confirmation', NULL, NOW(), NOW(), 2, NOW(), NULL), diff --git a/templates/backOffice/default/admin-layout.tpl b/templates/backOffice/default/admin-layout.tpl index 0c054b2ad..e45fad512 100644 --- a/templates/backOffice/default/admin-layout.tpl +++ b/templates/backOffice/default/admin-layout.tpl @@ -190,7 +190,7 @@ {/loop} - {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.config" access="VIEW"} + {loop name="menu-auth-config" type="auth" role="ADMIN" resource="admin.configuration.area" access="VIEW"}
  • {intl l="Configuration"}
  • From 0f87055f119078ac7f3a3e950072111b4d25ff3b Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 15 Apr 2014 17:43:59 +0200 Subject: [PATCH 04/10] Imporved permission management on home page --- templates/backOffice/default/home.html | 130 +++++++++++++++---------- 1 file changed, 79 insertions(+), 51 deletions(-) diff --git a/templates/backOffice/default/home.html b/templates/backOffice/default/home.html index 0204fe4c7..4eefb609a 100644 --- a/templates/backOffice/default/home.html +++ b/templates/backOffice/default/home.html @@ -8,6 +8,7 @@ {module_include location='home_top'} + {loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"}
    @@ -36,57 +37,78 @@
    - + {/loop}
    -
    -
    -
    {intl l="Shop Informations"}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {intl l="Customers"} - {count type="customer" current="false" backend_context="1"} -
    {intl l="Categories"} - {count type="category" visible="*" backend_context="1"} -
    {intl l="Products"} - {count type="product" visible="*" backend_context="1"} -
    {intl l="Online products"} - {count type="product" visible="true" backend_context="1"} -
    {intl l="Offline products"} - {count type="product" visible="false" backend_context="1"} -
    {intl l="Orders"} - {count type="order" status="*" backend_context="1"} -
    -
    -
    -
    + {* Do not display shop information block if user none of the required authorizations *} + + {capture name="shop_information_block_content"} + {loop type="auth" name="can_view" role="ADMIN" resource="admin.customer" access="VIEW"} + + {intl l="Customers"} + + {count type="customer" current="false" backend_context="1"} + + + {/loop} + + {loop type="auth" name="can_view" role="ADMIN" resource="admin.category" access="VIEW"} + + {intl l="Categories"} + + {count type="category" visible="*" backend_context="1"} + + + {/loop} + + {loop type="auth" name="can_view" role="ADMIN" resource="admin.product" access="VIEW"} + + {intl l="Products"} + + {count type="product" visible="*" backend_context="1"} + + + + {intl l="Online products"} + + {count type="product" visible="true" backend_context="1"} + + + + {intl l="Offline products"} + + {count type="product" visible="false" backend_context="1"} + + + {/loop} + + {loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"} + + {intl l="Orders"} + + {count type="order" status="*" backend_context="1"} + + + {/loop} + {/capture} + + {if trim($smarty.capture.shop_information_block_content) ne ""} +
    +
    +
    {intl l="Shop Informations"}
    +
    + + + {$smarty.capture.shop_information_block_content nofilter} + +
    +
    +
    +
    + {/if} + + {loop type="auth" name="can_view" role="ADMIN" resource="admin.order" access="VIEW"}
    {intl l="Sales statistics"}
    @@ -221,6 +243,7 @@
    + {/loop}
    @@ -234,11 +257,11 @@ {intl l="Latest version available"} - V1.5.4.2 + {intl l="Loading..."} {intl l="News"} - {intl l="Click here"} + {intl l="Click here"} @@ -396,9 +419,14 @@ jQuery(function($){ }); } - {/literal} + // Get the latest Thelia version + $('#latest-thelia-version').load("{url path='/admin/latest-thelia-version'}", function(response, status, xhr) { + if (status == "error") + $('#latest-thelia-version').text("Unavailable"); + }); + }); From f0e8df81e192d4f8c3958e6ff3a9ed75621ffdd5 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Tue, 15 Apr 2014 18:25:01 +0200 Subject: [PATCH 05/10] Improved profiles management --- templates/backOffice/default/I18n/fr_FR.php | 20 ++++++++---- .../backOffice/default/profile-edit.html | 5 ++- templates/backOffice/default/profiles.html | 32 +++++++++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/templates/backOffice/default/I18n/fr_FR.php b/templates/backOffice/default/I18n/fr_FR.php index 359241e9a..71c60ece5 100755 --- a/templates/backOffice/default/I18n/fr_FR.php +++ b/templates/backOffice/default/I18n/fr_FR.php @@ -45,8 +45,9 @@ return array( 'Additional categories' => 'Rubriques supplémentaires', 'Address' => 'Adresse', 'Administration logs' => 'Journal des logs', - 'Administration profiles' => 'Gestion des profils', + 'Administration profiles' => 'Profils d\'administration', 'Administrators' => 'Administrateurs', + 'Afficher ce profil' => 'View this profile', 'All orders' => 'Toutes les commandes', 'Alpha code 2' => 'Code alpha 2', 'Alpha code 3' => 'Code alpha 3', @@ -74,6 +75,7 @@ return array( 'Browse files' => 'Parcourir les fichiers', 'Browse this category' => 'Parcourir cette catégorie', 'Browse this folder' => 'Parcourir ce dossier', + 'Cache' => 'Cache', 'Can\'t be cumulative' => 'Ne peut pas se cumuler', 'Can\'t load documents, please refresh this page.' => 'Impossible de charger les documents. Rechargez la page', 'Can\'t load images, please refresh this page.' => 'Impossible de charger l\'image. Rechargez la page', @@ -397,6 +399,7 @@ return array( 'Editing mailing template "%name"' => 'En cours de modification du template de mailing "%name"', 'Editing module' => 'Module en cours de modification', 'Editing profile' => 'Modification du profil', + 'Editing profile \'%name\'' => 'Edition du profil \'%name\' ', 'Editing shipping configuration "%name"' => 'En cours de modification de la configuration de livraison "%name"', 'Editing shipping zone "%name"' => 'En cours de modification de la zone de livraison "%name"', 'Editing tax' => 'En cours de modification de la taxe', @@ -428,6 +431,8 @@ return array( 'Enter here the template name in the default language (%title)' => 'Renseignez le nom du template dans la langue par défaut (%title)', 'Enter here the value in the current edit language (%language_name)' => 'Rensignez la valeur dans la langue d\'édition actuelle (%language_name)', 'Enter here the value in the current edit language (%title)' => 'Entrez la valeur dans la langue d\'édition courante (%title)', + 'Enter here the value in the default language (%title)' => 'Indiquez la valeur pour la langue par défaut (%title) ', + 'Enter information in the default language (%title)' => 'Entrez les informations dans la langue par défaut (%title) ', 'Enter new accessory position' => 'Renseigner la nouvelle position pour cet accessoire', 'Enter new attribute position' => 'Modifier la position de la déclinaison', 'Enter new category position' => 'Classement de la catégorie', @@ -462,6 +467,7 @@ return array( 'First orders' => 'Premières commandes', 'FirstName' => 'Prénom', 'Firstname' => 'Prénom', + 'Flush the cache' => 'Vider le cache', 'Folder created on %date_create. Last modification: %date_change' => 'Dossier créé le %date_create. Dernière modification le %date_change', 'Folder title' => 'Titre du dossier', 'Folders' => 'Dossiers', @@ -524,6 +530,7 @@ return array( 'Leave empty to keep current password' => 'Laisser ce champ vide pour ne pas modifier le mot de passe', 'Lire la suite' => 'Lire la suite', 'Loading Thelia lastest news...' => 'Chargement des dernières information Thelia...', + 'Loading...' => 'Chargement...', 'Locale' => 'Paramètre régional', 'Log lines format' => 'Format d\'une ligne de log', 'Log lines header format. You may use the following variables: ' => 'Format d\'une ligne de log. Vous pouvez utiliser ces variables : ', @@ -606,9 +613,9 @@ return array( 'Please select a coupon type' => 'Merci d\'entrer le type de code', 'Please select another condition' => 'Merci de sélectionner une autre condition', 'Please select items to translate' => 'Veuillez sélectionner un élément', - 'Please select the B.O. template to translate' => 'Sélectionnez le template back-office que vous souhaitez traduire', + 'Please select the B.O. template to translate' => 'Sélectionnez le template back-office à traduire', 'Please select the E-mail template to translate' => 'Sélectionnez le template de mail à traduire', - 'Please select the F.O. template to translate' => 'Sélectionnez le template front-office que vous souhaitez traduire', + 'Please select the F.O. template to translate' => 'Sélectionnez le template front-office à traduire', 'Please select the PDF template to translate' => 'Sélectionnez le template PDF à traduire', 'Please select the module to translate' => 'Sélectionnez le module à traduire', 'Please wait, loading' => 'Chargement, veuillez patienter', @@ -697,6 +704,7 @@ return array( 'Save this condition' => 'Enregistrer cette condition', 'Save your modifications' => 'Enregistrer les modifications', 'Search' => 'Recherche', + 'Search for \'%term\'' => 'Recherche de \'%term\'', 'Select a category and click (+) to add it to the additional category list' => 'Sélectionner une rubrique et cliquez sur (+) pour la rajouter dans la liste des rubrique associées', 'Select a category to get its products' => 'Sélectionner une rubrique pour avoir les produits qu\'elle contient', 'Select a category...' => 'Sélectionner une rubrique...', @@ -720,10 +728,10 @@ return array( 'Select here the tax applicable to this product' => 'Sélectionnez ici la taxe applicable sur ce produit', 'Select the E-mail template you want to translate' => 'Sélectionnez le template de mail à traduire', 'Select the PDF template you want to translate' => 'Sélectionnez le template PDF à traduire', - 'Select the back-office template you want to translate' => 'Sélectionnez le template back-office que vous souhaitez traduire', - 'Select the front-office template you want to translate' => 'Sélectionnez le template front-office que vous souhaitez traduire', + 'Select the back-office template you want to translate' => 'Sélectionnez le template back-office à traduire', + 'Select the front-office template you want to translate' => 'Sélectionnez le template front-office à traduire', 'Select the module you want to translate' => 'Sélectionnez le module à traduire', - 'Select which items you want to translate' => 'Sélectionnez l\'élément que vous souhaitez traduire', + 'Select which items you want to translate' => 'Sélectionnez l\'élément à traduire', 'Send a mail to this customer' => 'Contacter ce client par mail', 'Send files' => 'Envoyer des fichiers', 'Sequential number of log line' => 'Sequential number of log line', diff --git a/templates/backOffice/default/profile-edit.html b/templates/backOffice/default/profile-edit.html index 7e4d57a27..7a5bed341 100644 --- a/templates/backOffice/default/profile-edit.html +++ b/templates/backOffice/default/profile-edit.html @@ -8,7 +8,6 @@ {block name="main-content"} {assign oder_tab {$smarty.get.tab|default:$smarty.post.tab|default:'data'}} - {assign asked_country {$smarty.get.country|default:{country ask="default" attr="id"}}}
    @@ -26,8 +25,8 @@
    -
    - {$CODE} +
    +
    {intl l="Editing profile '%name'" name=$TITLE}