diff --git a/VERSIONS_HOTLINE/59093 b/VERSIONS_HOTLINE/59093 new file mode 100644 index 0000000000000000000000000000000000000000..4155f40c1319e5a45f1c067583150268a8ea09a6 --- /dev/null +++ b/VERSIONS_HOTLINE/59093 @@ -0,0 +1,2 @@ + - ticket #59093 : Administration : correction de la suppression de boite dans la banniere depuis l'interface d'administration. + \ No newline at end of file diff --git a/VERSIONS_HOTLINE/64143 b/VERSIONS_HOTLINE/64143 new file mode 100644 index 0000000000000000000000000000000000000000..ccc1f97805455c02528add948b591c5931da62ef --- /dev/null +++ b/VERSIONS_HOTLINE/64143 @@ -0,0 +1,2 @@ + - ticket #64143 : Administration : amélioration de la génération du cache des fichiers de CSS et JS. + \ No newline at end of file diff --git a/VERSIONS_HOTLINE/64151 b/VERSIONS_HOTLINE/64151 new file mode 100644 index 0000000000000000000000000000000000000000..6709a5c8f7e2a20bc54943b35a43f013cdd13be0 --- /dev/null +++ b/VERSIONS_HOTLINE/64151 @@ -0,0 +1,2 @@ + - ticket #64151 : Administration : le tri dans le tableau des utilsateur porte sur tout le résultat. + \ No newline at end of file diff --git a/VERSIONS_HOTLINE/64183 b/VERSIONS_HOTLINE/64183 new file mode 100644 index 0000000000000000000000000000000000000000..3c836a1d7241d6ac265cc39e561d4a912f1a749a --- /dev/null +++ b/VERSIONS_HOTLINE/64183 @@ -0,0 +1,2 @@ + - ticket #64183 : Administration : correction du paramétrage de l'action auth/login. + \ No newline at end of file diff --git a/application/modules/admin/controllers/IndexController.php b/application/modules/admin/controllers/IndexController.php index 097e911876aa724308ad579c30e6cd7ea2830ad0..e1ff46101d805ceef360ecab3298cbee535cae8f 100644 --- a/application/modules/admin/controllers/IndexController.php +++ b/application/modules/admin/controllers/IndexController.php @@ -127,8 +127,9 @@ class Admin_IndexController extends ZendAfi_Controller_Action { public function clearcacheAction() { (new Storm_Cache())->clean(); - Class_AdminVar::set('CACHE_DATE', (new Class_TimeSource())->dateFormat('Y-m-d H:i:s')); - Class_ScriptLoader::getInstance()->resetCacheHash(); + $scriptloader = Class_ScriptLoader::getInstance(); + Class_AdminVar::set('CACHE_DATE', $scriptloader->getDate()); + $scriptloader->resetCacheHash(); $this->_helper->notify($this->_('Le cache de Bokeh a été vidé')); $this->_redirectToReferer(); } diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index 00d1fad5bc0c657f1333ab6be70d55945e6bb2a7..d5c5755113c3d5622fe417bd754d6c690ec2b25e 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -101,10 +101,9 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { public function authLoginAction() { - $form = ZendAfi_Form_Configuration_Login::newWith($this->preferences); + $form = ZendAfi_Form_Configuration_Widget_Base::newWith($this->preferences); $form->setAction($this->view->url(['controller' => 'modules', - 'action' => 'auth-login', - 'render' => 'popup'])); + 'action' => 'auth-login'])); if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) { $datas = $form->getValues(); diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index 019ce45b76c9bb3a4447983cfd138c2ebc080e6c..a237994c51688428b9f3984736c8365056a7422e 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -299,9 +299,10 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { $profil->updateModuleConfigAccueil($id_module, $module_config); } - if(!$profil->hasParentProfil()) { + if(!$profil->hasParentProfil()) $enreg = $this->setBannerWidget($profil, $enreg); - } + + $this->purgeBannerWidget($profil, $enreg); if($profil->setCfgAccueil($enreg)->save()) { $this->_helper->notify($this->view->_('Page ' . $profil->getLibelle() . ' sauvegardée')); @@ -313,6 +314,25 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { } + protected function purgeBannerWidget($profil, $enreg) { + if(!$parent_profil = $profil->getParentProfil()) + return; + + $local_banner_widgets = array_keys($parent_profil->getBannerBoxes()); + + $temp_profil = (new Class_Profil())->setCfgAccueil($enreg); + $enreg_banner_widgets = array_keys($temp_profil->getBannerBoxes()); + + if(!$to_delete = array_diff($local_banner_widgets, $enreg_banner_widgets)) + return ; + + foreach($to_delete as $id) + $parent_profil->removeBoiteFromDiv($id, Class_Profil::DIV_BANNIERE); + + return $parent_profil->save(); + } + + protected function setBannerWidget($profil, $enreg) { $required_widgets = $this->getSearchAndLoginWidget($profil->getBoitesDivision(Class_Profil::DIV_BANNIERE)); foreach( $required_widgets as $id => $module) { diff --git a/application/modules/admin/views/scripts/modules/auth-login.phtml b/application/modules/admin/views/scripts/modules/auth-login.phtml index a77ca805bea2b10e567e9f4184a61fd9b389811a..ac7363359759fdc81ec27a1c761cdf8d81e268d8 100644 --- a/application/modules/admin/views/scripts/modules/auth-login.phtml +++ b/application/modules/admin/views/scripts/modules/auth-login.phtml @@ -1,4 +1,2 @@ -<center> - <h1><?php echo $this->_('Propriétés du module : %s', $this->titre_module); ?></h1> - <?php echo $this->renderForm($this->form); ?> -</center> +<?php +echo $this->renderForm($this->form); diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index 2ce013d371acf4f33e3344c530a5ccb17fb065c9..92a1901fe6ded261762db6c079d979ba24111d42 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -21,7 +21,9 @@ class Class_ScriptLoader { - use Trait_Translator; + use + Trait_Translator, + Trait_TimeSource; const MODE_JQUERY_READY = 0, @@ -731,7 +733,7 @@ class Class_ScriptLoader { public function resetCacheHash() { - return $this->_version_pergame_hash = md5(BOKEH_MAJOR_VERSION . Class_AdminVar::get('CACHE_DATE')); + return $this->_version_pergame_hash = md5(BOKEH_MAJOR_VERSION . BOKEH_RELEASE_NUMBER . Class_AdminVar::get('CACHE_DATE')); } @@ -846,4 +848,9 @@ class Class_ScriptLoader { return $this; } + + + public function getDate() { + return date('Y-m-d H:i:s', static::getTimeSource()->time()); + } } diff --git a/library/Class/User/SearchCriteria.php b/library/Class/User/SearchCriteria.php index b842b2b980730b5b7b7b3c0dac032a56eaf37e2c..b389c1f1b4db157376b2985e39d70eb3a703e488 100644 --- a/library/Class/User/SearchCriteria.php +++ b/library/Class/User/SearchCriteria.php @@ -34,7 +34,8 @@ class Class_User_SearchCriteria { new Class_User_SearchCriteriaValidSubscription($params), new Class_User_SearchCriteria_NumberOfReviews($params), new Class_User_SearchCriteria_NumberOfBaskets($params), - new Class_User_SearchCriteriaSearchFor($params)]; + new Class_User_SearchCriteriaSearchFor($params), + new Class_User_SearchCriteriaOrder($params)]; } @@ -234,3 +235,23 @@ class Class_User_SearchCriteriaSearchFor extends Class_User_SearchCriteria_Abstr $visitor->addWhereParam(implode(' OR ', $table_or)); } } + + + + +class Class_User_SearchCriteriaOrder extends Class_User_SearchCriteria_Abstract { + protected + $_name = 'order', + $_value = 'nom asc'; + + + public function __construct($params) { + parent::__construct($params); + if(isset($params['search_order']) && $params['search_order']) + $this->_value = $params['search_order']; + } + + public function acceptSearchVisitor($visitor) { + $visitor->addParam('order', $this->_value); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/UserSearch.php b/library/ZendAfi/Controller/Action/Helper/UserSearch.php index 21a763384f7b7c8f19d1716607bee150b64b268f..3a53269d72f3a5c893573a0b9ecba36a0f3e5f56 100644 --- a/library/ZendAfi/Controller/Action/Helper/UserSearch.php +++ b/library/ZendAfi/Controller/Action/Helper/UserSearch.php @@ -31,7 +31,8 @@ class ZendAfi_Controller_Action_Helper_UserSearch extends Zend_Controller_Action $this->view->total = $criteria->count(); $this->view->form = $this->_prepareForm($action_params, $criteria); $this->view->params = array_merge($this->view->form->getValues(), - ['page' => $this->view->page]); + ['page' => $this->view->page, + 'search_order' => $this->_getParam('search_order', 'nom asc')]); } diff --git a/library/ZendAfi/Form/Configuration/LoginWidget.php b/library/ZendAfi/Form/Configuration/LoginWidget.php deleted file mode 100644 index 6f552f8802a86e8e472dc26a9259f030cd4379c1..0000000000000000000000000000000000000000 --- a/library/ZendAfi/Form/Configuration/LoginWidget.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. - * - * BOKEH is free software; you can redistribute it and/or modify - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by - * the Free Software Foundation. - * - * There are special exceptions to the terms and conditions of the AGPL as it - * is applied to this software (see README file). - * - * BOKEH is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE - * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - - -class ZendAfi_Form_Configuration_LoginWidget extends ZendAfi_Form_Configuration_BaseLogin { - public function init() { - parent::init(); - - $this - ->setMethod('post') - ->addUniqDisplayGroup('login_widget_fieldset', - ['legend' => $this->_('Propriétés de la boite de connexion')]); - } -} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/SearchUsers.php b/library/ZendAfi/View/Helper/Admin/SearchUsers.php index 3bcc022348a3d7ae0adbed1c6635c068860d0705..af5fe1de698a38e3fc73a04b800c33b7bcac5dd3 100644 --- a/library/ZendAfi/View/Helper/Admin/SearchUsers.php +++ b/library/ZendAfi/View/Helper/Admin/SearchUsers.php @@ -41,17 +41,17 @@ class ZendAfi_View_Helper_Admin_SearchUsers extends ZendAfi_View_Helper_BaseHelp ->setText($this->_('Rechercher')) ->setImage($this->view->tagImg(Class_Admin_Skin::current() ->getIconUrl('actions', - 'loupe'), + 'loupe'), ['style' => 'filter: invert();'])) ->setAttribs(['onclick' => "var form=$(this).parents('form'); if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').prevAll('form');if (!form.size()) form=$(this).parents('.boutons, .admin-buttons').nextAll('form');form.submit(); return false;", 'type' => 'submit', 'class' => 'search', 'title' => $this->_('Lancer la recherche')]))]) . - $this->view->tag('p', $this->view->_plural($this->total, - 'Auncun utilisateur trouvé', - '%d utilisateur trouvé', - '%d utilisateurs trouvés', - $this->total)) . + $this->_tag('p', $this->view->_plural($this->total, + 'Auncun utilisateur trouvé', + '%d utilisateur trouvé', + '%d utilisateurs trouvés', + $this->total)) . $this->_getUsersTable(); } @@ -69,6 +69,17 @@ class ZendAfi_View_Helper_Admin_SearchUsers extends ZendAfi_View_Helper_BaseHelp protected function _getTable() { + $description = $this + ->_addColumnsTo(new Class_TableDescription('users_table')) + ->addRowAction($this->actions); + return $this->view->renderTable($description, + (new Class_TableDescription_Models($this->users)), + ['sorter' => false, + 'pager' => false]); + } + + + protected function _addColumnsTo($description) { $acl = new ZendAfi_Acl_AdminControllerRoles(); $role_renderer = function($model) use($acl){ @@ -79,22 +90,30 @@ class ZendAfi_View_Helper_Admin_SearchUsers extends ZendAfi_View_Helper_BaseHelp return $model->getLibelleBib(); }; - return $this->view->tagModelTable($this->users, - [$this->view->_('Identifiant'), - $this->view->_('Nom'), - $this->view->_('Prenom'), - $this->view->_('Role'), - $this->view->_('Bibliothèque')], - ['login', - 'nom', - 'prenom', - 'role_level', - 'library'], - [ $this->actions ], - null, - null, - ['role_level' => $role_renderer, - 'library' => $library_renderer]); + return $description + ->addColumn($this->_orderAnchor('login', $this->_('Identifiant')), 'login') + ->addColumn($this->_orderAnchor('nom', $this->_('Nom')), 'nom') + ->addColumn($this->_orderAnchor('prenom', $this->_('Prenom')), 'prenom') + ->addColumn($this->_orderAnchor('role_level', $this->_('Role')), $role_renderer) + ->addColumn($this->_('Bibliothèque'), $library_renderer); + } + + + protected function _orderAnchor($key, $label) { + $order = $this->params['search_order']; + $order_param = $key; + + if((0 === strpos($order, $key)) && (false === strpos($order, 'desc'))) + $order_param .= ' desc'; + + $data_order = (0 === strpos($order, $key)) + ? str_replace(' ', '_', 'order_' . $order_param) + : ''; + + return $this->view->tagAnchor(array_merge(array_filter($this->params), + ['search_order' => $order_param, + 'page' => null]), + $label, + ['data-order' => $data_order]); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/AjaxRedirect.php b/library/ZendAfi/View/Helper/AjaxRedirect.php index 4e130b5c3d337a164e794a046deed8182cebcecf..7f4dafcda9c3dd461db6b1e22ac72749d4cadb1b 100644 --- a/library/ZendAfi/View/Helper/AjaxRedirect.php +++ b/library/ZendAfi/View/Helper/AjaxRedirect.php @@ -22,11 +22,12 @@ class ZendAfi_View_Helper_AjaxRedirect extends ZendAfi_View_Helper_BaseHelper { public function ajaxRedirect() { - Class_Admin_Skin::current() - ->renderJQueryCssOn(Class_ScriptLoader::getInstance()); + $script_loader = Class_ScriptLoader::getInstance(); + Class_Admin_Skin::current()->renderJQueryCssOn($script_loader); return - $this->_tag('div', + $script_loader->html() + . $this->_tag('div', $this->_tag('p', $this->_('Veuillez patienter ...')) . $this->view->tagLoadingImg(), diff --git a/library/ZendAfi/View/Helper/FonctionsAdmin.php b/library/ZendAfi/View/Helper/FonctionsAdmin.php index b5fba366173c0ea7b41a8543e721515a0fb57d80..01d131763eb2510a9508306ab92a5c182e451be2 100644 --- a/library/ZendAfi/View/Helper/FonctionsAdmin.php +++ b/library/ZendAfi/View/Helper/FonctionsAdmin.php @@ -98,14 +98,14 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper if (!(new Class_Systeme_ModulesAppli())->getModule($controller, $action)) return []; - return ['module' => 'admin', - 'controller' => 'modules', - 'action' => $controller, - 'config' => 'site', - 'type_module' => $controller, - 'id_profil' => $this->id_profil, - 'action1' => $action, - 'action2' => $action2]; + return array_filter(['module' => 'admin', + 'controller' => 'modules', + 'action' => $controller, + 'config' => 'site', + 'type_module' => $controller, + 'id_profil' => $this->id_profil, + 'action1' => $action, + 'action2' => $action2]); } diff --git a/tests/application/modules/admin/controllers/IndexControllerTest.php b/tests/application/modules/admin/controllers/IndexControllerTest.php index bbfdbb458a7d5a02172ea68d21e947074b6f76c2..8951deba852f3f799e3994f7bc88f33ece228b04 100644 --- a/tests/application/modules/admin/controllers/IndexControllerTest.php +++ b/tests/application/modules/admin/controllers/IndexControllerTest.php @@ -268,7 +268,16 @@ class Admin_IndexControllerClearCacheActionTest extends Admin_IndexControllerTes public function setUp() { parent::setUp(); Storm_Cache::beVolatile(); - $this->_cache_version = Class_ScriptLoader::getInstance()->getCacheHash(); + + $this->fixture('Class_AdminVar', + ['id' => 'CACHE_DATE', + 'valeur' => '2017-08-30 10:00:00']); + + $scriptloadder = Class_ScriptLoader::getInstance(); + $scriptloadder->setTimeSource(new TimeSourceForTest('2017-08-31 11:00:00')); + + $this->_cache_version = $scriptloadder->getCacheHash(); + $this->dispatch('/admin/index/clearcache', true); } @@ -283,6 +292,13 @@ class Admin_IndexControllerClearCacheActionTest extends Admin_IndexControllerTes public function cacheVersionShouldHaveChange() { $this->assertNotEquals($this->_cache_version, Class_ScriptLoader::getInstance()->getCacheHash()); } + + + /** @test */ + public function cacheVersionShouldContainsMajorAndMinorVersionAndTime() { + $this->assertEquals(md5(BOKEH_MAJOR_VERSION . BOKEH_RELEASE_NUMBER . Class_AdminVar::get('CACHE_DATE')), + Class_ScriptLoader::getInstance()->getCacheHash()); + } } diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 6eb02519d5b6955c06f6805505d887998eff843e..3fe7224b7090b654238529ae3af4e8cca5d33513 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -370,6 +370,24 @@ class ModulesControllerVariousConfigTest extends Admin_AbstractControllerTestCas +class ModulesControllerAuthLoginConfigTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $this->dispatch('admin/modules/auth/config/site/type_module/auth/id_profil/1/action1/login'); + } + + /** @test */ + public function modulesAuthBoiteLoginShouldNotFail() { + $this->assertAction('auth-login'); + } +} + + + + + class ModulesControllerRegisterConfigTest extends Admin_AbstractControllerTestCase { protected $_storm_default_to_volatile = true; diff --git a/tests/application/modules/admin/controllers/NewsletterControllerTest.php b/tests/application/modules/admin/controllers/NewsletterControllerTest.php index 97964a0e22ead600a0266bcbfbdd77109b5c6689..49a1c0510a3375dffa473bcdb30506a36a7de9f5 100644 --- a/tests/application/modules/admin/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/admin/controllers/NewsletterControllerTest.php @@ -1151,7 +1151,8 @@ class Admin_NewsletterControllerEditSubcsribersSearchAllSubscriptionTest $this->onLoaderOfModel('Class_Users') ->whenCalled('findAllBy') - ->with(['limitPage' => [1, 20]]) + ->with(['order' => 'nom asc', + 'limitPage' => [1, 20]]) ->answers([$this->_laurent, $this->_pat, $this->_ghislo]) ->whenCalled('findAllBy') @@ -1221,6 +1222,7 @@ class Admin_NewsletterControllerEditSubcsribersSearchSubscribedTest $this->onLoaderOfModel('Class_Users') ->whenCalled('findAllBy') ->with(['where' => '(id_user in (566,444)) AND (mail not in ("g@serv.eur.fr"))', + 'order' => 'nom asc', 'limitPage' => [1, 20]]) ->answers([$this->_laurent]) @@ -1293,6 +1295,7 @@ class Admin_NewsletterControllerEditSubcsribersSearchNotSubscribedTest $this->onLoaderOfModel('Class_Users') ->whenCalled('findAllBy') ->with(['where' => '(id_user not in (566,444))', + 'order' => 'nom asc', 'limitPage' => [1, 20]]) ->answers([$this->_pat]) @@ -1352,6 +1355,7 @@ class Admin_NewsletterControllerEditSubcsribersSearchUnsubscribedTest $this->onLoaderOfModel('Class_Users') ->whenCalled('findAllBy') ->with(['where' => '(id_user in (566,444)) AND (mail in ("g@serv.eur.fr"))', + 'order' => 'nom asc', 'limitPage' => [1, 20]]) ->answers([$this->_ghislo]) diff --git a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php index 7b65acd4b6ad1975fba64df7fe28217b171bd9ad..9931104ce771449a219e74114e4eb3a183a90482 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php @@ -562,7 +562,7 @@ abstract class Admin_ProfilControllerPageAccueilWithWidgetInBannerTestCase exten -class Admib_ProfilControllerPageAccueilWithWidgetInBannerDispatchTest extends Admin_ProfilControllerPageAccueilWithWidgetInBannerTestCase { +class Admin_ProfilControllerPageAccueilWithWidgetInBannerDispatchTest extends Admin_ProfilControllerPageAccueilWithWidgetInBannerTestCase { public function setUp() { parent::setUp(); @@ -612,7 +612,7 @@ class Admib_ProfilControllerPageAccueilWithWidgetInBannerPostDispatchTest extend -class Admin642_ProfilControllerPageAccueilWithMenuBoiteEnabledTest extends Admin_AbstractControllerTestCase { +class Admin_ProfilControllerPageAccueilWithMenuBoiteEnabledTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -680,3 +680,40 @@ class Admin_ProfilControllerPageAccueilRegression45558Test extends Admin_ProfilC Class_Profil::find(23)->getModulePref(1)); } } + + + + + + +class Admin_ProfilControllerPageAccueilClearBannerFromChildTest extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Profil', ['id' => 712, 'libelle' => 'Parent profile', + 'cfg_accueil' => 'a:4:{s:7:"modules";a:12:{i:5;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:8:{s:4:"menu";s:3:"1-V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"1";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:2;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:16:{s:5:"titre";s:14:"ne_pas_toucher";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:1:"1";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:10:"boite_vide";s:11:"style_liste";s:4:"none";s:13:"styles_reload";s:1:"0";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:4;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:7;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:1;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:3;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:8;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:9;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:10;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:11;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:12;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:2:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";}}i:6;a:3:{s:11:"type_module";s:5:"LOGIN";s:11:"preferences";a:16:{s:5:"titre";s:18:"Mon compte lecteur";s:14:"titre_connecte";s:0:"";s:11:"identifiant";s:12:"N° de carte";s:19:"identifiant_exemple";s:0:"";s:12:"mot_de_passe";s:19:"Année de naissance";s:20:"mot_de_passe_exemple";s:0:"";s:14:"lien_connexion";s:12:"Se connecter";s:24:"lien_mot_de_passe_oublie";s:25:"» Mot de passe oublié ?";s:17:"lien_creer_compte";s:16:"» S\'enregistrer";s:16:"message_connecte";s:9:"Bienvenue";s:11:"lien_compte";s:10:"Mon compte";s:17:"lien_deconnection";s:15:"Se déconnecter";s:16:"autocomplete_off";s:1:"1";s:15:"profil_redirect";s:0:"";s:22:"profil_logout_redirect";s:0:"";s:5:"boite";s:21:"boite_banniere_droite";}s:8:"division";s:1:"4";}}s:14:"use_parent_css";s:1:"1";s:7:"sitemap";s:1:"1";s:8:"page_css";s:0:"";}']); + + $this->fixture('Class_Profil', ['id' => 713, + 'parent_id' => 712, + 'id_site' => 0, + 'libelle' => 'My page', + 'cfg_accueil' => 'a:4:{s:7:"modules";a:8:{i:2;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:3;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:1;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:4;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:8;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:5;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:10;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:11;a:3:{s:8:"division";s:1:"4";s:11:"type_module";s:5:"LOGIN";s:11:"preferences";a:17:{s:5:"titre";s:18:"Mon compte lecteur";s:14:"titre_connecte";s:0:"";s:11:"identifiant";s:12:"N° de carte";s:19:"identifiant_exemple";s:0:"";s:12:"mot_de_passe";s:19:"Année de naissance";s:20:"mot_de_passe_exemple";s:0:"";s:14:"lien_connexion";s:12:"Se connecter";s:24:"lien_mot_de_passe_oublie";s:25:"» Mot de passe oublié ?";s:17:"lien_creer_compte";s:16:"» S\'enregistrer";s:16:"message_connecte";s:9:"Bienvenue";s:11:"lien_compte";s:10:"Mon compte";s:17:"lien_deconnection";s:15:"Se déconnecter";s:16:"autocomplete_off";s:1:"1";s:15:"profil_redirect";s:0:"";s:22:"profil_logout_redirect";s:0:"";s:5:"boite";s:21:"boite_banniere_droite";s:0:"";s:0:"";}}}s:14:"use_parent_css";s:1:"1";s:7:"sitemap";s:1:"1";s:8:"page_css";s:0:"";}', + ]); + + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); + + $cfg_module = "box3|new|PANIER|;box4|6|LOGIN|titre=Mon compte lecteur---titre_connecte=---identifiant=N° de carte---identifiant_exemple=---mot_de_passe=Année de naissance---mot_de_passe_exemple=---lien_connexion=Se connecter---lien_mot_de_passe_oublie=» Mot de passe oublié ?---lien_creer_compte=» S'enregistrer---message_connecte=Bienvenue---lien_compte=Mon compte---lien_deconnection=Se déconnecter---autocomplete_off=1---profil_redirect=---profil_logout_redirect=---boite=boite_banniere_droite---"; + + $this->postDispatch('/admin/profil/accueil/id_profil/713', ['libelle' => 'test', + 'division1' => 'NEWS-2;NEWS-3;KIOSQUE-1;KIOSQUE-4;', + 'division2' => 'MENU_VERTICAL-5;CALENDAR-0', + 'division3' => 'PANIER-10;PANIER-0', + 'division4' => '']); + } + + + /** @test */ + public function profile712BannerShouldBeEmpty() { + $this->assertEmpty(Class_Profil::find(712)->getBannerBoxes()); + } +} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index 0ad2040a3572ffca1023a96ba226cc52a0dd662c..c975f0a3aebe0052822e3eec1896d0fc24413846 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -1054,7 +1054,8 @@ class Admin_ProfilControllerPostAccueilPageMusiqueTest extends Admin_ProfilContr ['libelle' => 'Bonne Musique', 'rewrite_url' => 'music', 'division1' => 'KIOSQUE-0', - 'division2' => 'CRITIQUES-0']); + 'division2' => 'CRITIQUES-0', + 'division4' => 'RECH_SIMPLE-1']); } @@ -1084,9 +1085,9 @@ class Admin_ProfilControllerPostAccueilPageMusiqueTest extends Admin_ProfilContr /** @test */ - public function cfgAccueilShouldHaveModulesSizeOfTwo() { + public function cfgAccueilShouldHaveModulesSizeOfThree() { $cfg = $this->page_musique->getCfgAccueilAsArray(); - $this->assertEquals(2, count($cfg['modules'])); + $this->assertEquals(3, count($cfg['modules'])); } diff --git a/tests/application/modules/admin/controllers/UsersControllerTest.php b/tests/application/modules/admin/controllers/UsersControllerTest.php index 81e908ab64e7393a081b51609f51fff9037890a2..d65c549915a9d87fd3ad6c7bd0f66db2d544243d 100644 --- a/tests/application/modules/admin/controllers/UsersControllerTest.php +++ b/tests/application/modules/admin/controllers/UsersControllerTest.php @@ -121,12 +121,14 @@ class UsersControllerIndexTest extends UsersControllerWithMarcusTestCase { ->whenCalled('findAllBy') ->with(['role_level' => 2, + 'order' => 'nom asc', 'where' => '(STR_TO_DATE(date_fin, \'%Y-%m-%d\') >= CURDATE()) AND (id_user in (2233,987398)) AND (login LIKE "%francis%" OR nom LIKE "%francis%" OR prenom LIKE "%francis%" OR pseudo LIKE "%francis%" OR mail LIKE "%francis%" OR idabon LIKE "%francis%") AND (role_level <= 7)', 'limitPage' => [1, 20]]) ->answers([$francis]) ->whenCalled('countBy') ->with(['role_level' => 2, + 'order' => 'nom asc', 'where' => '(STR_TO_DATE(date_fin, \'%Y-%m-%d\') >= CURDATE()) AND (id_user in (2233,987398)) AND (login LIKE "%francis%" OR nom LIKE "%francis%" OR prenom LIKE "%francis%" OR pseudo LIKE "%francis%" OR mail LIKE "%francis%" OR idabon LIKE "%francis%") AND (role_level <= 7)']) ->answers(55) @@ -731,14 +733,14 @@ class UsersControllerReferentIndexTest extends UsersControllerWithMarcusTestCase $this->user_loader = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Users'); $this->user_loader->whenCalled('getIdentity') - ->answers($user=Class_Users::newInstanceWithId(2) + ->answers($user = Class_Users::newInstanceWithId(2) ->setLogin('referent') ->setRoleLevel(ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL) ->setPseudo('referent')); $this->addUserToRightsReferent($user); - $this->dispatch('/admin/users', true); + $this->dispatch('/admin/users/index/order/prenom+desc', true); } @@ -1106,22 +1108,29 @@ class UsersControllerWithAdminPortalTest extends Admin_AbstractControllerTestCas $this->onLoaderOfModel('Class_Users') ->whenCalled('findAllBy') ->with(['where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')', + 'order' => 'prenom desc', 'limitPage' => [1, 20]]) ->answers([Class_Users::find(2)]) ->whenCalled('countBy') - ->with(['where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')']) + ->with(['order' => 'prenom desc', + 'where' => '(role_level <= ' . ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL . ')']) ->answers(1) ; - $this->dispatch('/admin/users/index', true); + $this->dispatch('/admin/users/index/search_order/prenom+desc', true); + } + + + /** @test */ + public function tableHeaderShouldContainsLinkToOrderByLastNameAsc() { + $this->assertXPath('//th//a[contains(@href, "/search_order/prenom/")]'); } /** @test */ public function superAdminEditLinkShouldNotBePresentInIndex() { - $this->assertNotXPath('//a[contains(@href, "/users/edit/id/1")]', - $this->_response->getBody()); + $this->assertNotXPath('//a[contains(@href, "/users/edit/id/1")]'); } @@ -1134,13 +1143,13 @@ class UsersControllerWithAdminPortalTest extends Admin_AbstractControllerTestCas /** @test */ public function linkToShowTimReviewShouldBePresent() { - $this->assertXPath('//a[contains(@href, "/blog/viewauteur/id/2")]'); + $this->assertXPath('//a[contains(@href, "/blog/viewauteur/")][contains(@href, "/id/2")]'); } /** @test */ public function linkToShowTimPanierShouldBePresent() { - $this->assertXPath('//a[contains(@href, "/panier/viewauteur/id/2")]'); + $this->assertXPath('//a[contains(@href, "/panier/viewauteur/")][contains(@href, "/id/2")]'); } @@ -1160,4 +1169,10 @@ class UsersControllerWithAdminPortalTest extends Admin_AbstractControllerTestCas public function linkToShowTumPanierShouldNotBePresent() { $this->assertNotXPath('//a[contains(@href, "/panier/viewauteur/id/3")]'); } + + + /** @test */ + public function tableHeadShouldContainsLinksWithOrderNameAsc() { + $this->assertXPath('//th/a[contains(@href, "/search_order/nom/")]'); + } } diff --git a/tests/library/Class/ScriptLoaderTest.php b/tests/library/Class/ScriptLoaderTest.php index ff8c656f0b2975477d056f6a4172681ac87bf7e1..8683dc97a21dc848478d2b4216f65196e6711818 100644 --- a/tests/library/Class/ScriptLoaderTest.php +++ b/tests/library/Class/ScriptLoaderTest.php @@ -207,13 +207,16 @@ class ScriptLoaderVersionHashTest extends PHPUnit_Framework_TestCase { public function setUp() { Class_ScriptLoader::resetInstance(); + $scriptloadder = Class_ScriptLoader::getInstance(); + $scriptloadder->setTimeSource(new TimeSourceForTest('2017-08-31 11:00:00')); + $this->_html = Class_ScriptLoader::getInstance() ->addStyleSheet('public/css/nuages.css') ->addStyleSheet('normal.css?param=value') ->addScript('opac/cycle.min') ->html(); - $this->_versionHash = md5(BOKEH_MAJOR_VERSION); + $this->_versionHash = $scriptloadder->getCacheHash(); } diff --git a/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php b/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php index 1e7cecf5cf0fd52a96f6bb66d04f54bc382649e5..7c0c0e8a929feae4e630d3d6a14fe40bf040ad2f 100644 --- a/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php +++ b/tests/library/ZendAfi/Controller/Action/Helper/ArticleListViewModeTest.php @@ -49,18 +49,21 @@ class ArticleListViewModeTest extends ModelTestCase { ->whenCalled('findAllBy') ->with(['role_level' => [0, 1, 2, 3, 4, 5, 6, 7], + 'order' => 'nom asc', 'where' => '(login LIKE "%news%" OR nom LIKE "%news%" OR prenom LIKE "%news%" OR pseudo LIKE "%news%" OR mail LIKE "%news%" OR idabon LIKE "%news%")', 'limitPage' => [1, 20]]) ->answers([]) ->whenCalled('findAllBy') ->with(['role_level' => [0, 1, 2, 3, 4, 5, 6, 7], + 'order' => 'nom asc', 'where' => '(login LIKE "%top%" OR nom LIKE "%top%" OR prenom LIKE "%top%" OR pseudo LIKE "%top%" OR mail LIKE "%top%" OR idabon LIKE "%top%")', 'limitPage' => [1, 20]]) ->answers([]) ->whenCalled('findAllBy') ->with(['role_level' => [0, 1, 2, 3, 4, 5, 6, 7], + 'order' => 'nom asc', 'where' => '(login LIKE "%redac%" OR nom LIKE "%redac%" OR prenom LIKE "%redac%" OR pseudo LIKE "%redac%" OR mail LIKE "%redac%" OR idabon LIKE "%redac%")', 'limitPage' => [1, 20]]) ->answers([$user])