diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index ab2ebd00a724aa6513cfa0cb748347121f305989..aa708869a838edc1248e3dd1efb9a901f53ac287 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -441,7 +441,7 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { public function moduleSortAction() { $this->getHelper('ViewRenderer')->setNoRender(); - if (!$profil = Class_Profil::getLoader()->find($this->_getParam('profil'))) + if (!$profil = Class_Profil::find($this->_getParam('profil'))) return; $profil->moveModuleOldDivPosNewDivPos($this->_getParam('fromDivision'), diff --git a/library/ZendAfi/View/Helper/Admin/FrontNav.php b/library/ZendAfi/View/Helper/Admin/FrontNav.php index 25528ae50462392988e37c3e26de47bc998560f9..4e9db5c0ad37b96fc15533320ce736bac8866d28 100644 --- a/library/ZendAfi/View/Helper/Admin/FrontNav.php +++ b/library/ZendAfi/View/Helper/Admin/FrontNav.php @@ -49,6 +49,11 @@ class ZendAfi_View_Helper_Admin_FrontNav extends ZendAfi_View_Helper_BaseHelper $this->_adminActions(), $this->_adminLinks()]; + return $this->_lify($entries); + } + + + protected function _lify($entries) { return array_map(function($entry) { return $this->_tag('li', $entry); @@ -72,7 +77,17 @@ class ZendAfi_View_Helper_Admin_FrontNav extends ZendAfi_View_Helper_BaseHelper protected function _adminActions() { - return ''; + $clear_cache_url = $this->view->absoluteUrl(['module' => 'admin', + 'controller' => 'index', + 'action' => 'clearcache']); + + $actions = [ $this->view->tagAnchor($clear_cache_url, + $this->_("Vider le cache de Bokeh")), + $this->view->tagAnchor('#', + $this->_('Activer déplacement des boites'), + ['onclick' => 'window.reactiveOpacBlocksSorting();return true;'])]; + + return $this->_tag('ul', implode($this->_lify($actions))); } diff --git a/library/ZendAfi/View/Helper/AdminTools.php b/library/ZendAfi/View/Helper/AdminTools.php index fcfd6717d3584a021e4288f03b36836b7bfaea4f..b4bdddbe5dc755fc6037f552fe818a8250404c51 100644 --- a/library/ZendAfi/View/Helper/AdminTools.php +++ b/library/ZendAfi/View/Helper/AdminTools.php @@ -33,18 +33,7 @@ class ZendAfi_View_Helper_AdminTools extends ZendAfi_View_Helper_BaseHelper { 'class' => 'admin_tools_lock', 'onclick' => 'toggleMenuAdmin($(this));']); - $clear_cache_url = $this->view->absoluteUrl(['module' => 'admin', - 'controller' => 'index', - 'action' => 'clearcache']); - - $clear_cache = $this->_tag('button', - $this->_("Vider le cache de Bokeh"), - ['class' => 'clear_cache', - 'onclick' => sprintf('document.location.href = "%s"', $clear_cache_url), - 'style' => 'display: none']); - Class_ScriptLoader::getInstance() - ->addJQueryBackEnd(sprintf('$("#select_clef_profil").parent().prepend(\'%s\')', $lock)) - ->addJQueryBackEnd(sprintf('$("body").append(\'%s\')', $clear_cache)); + ->addJQueryBackEnd(sprintf('$("#select_clef_profil").parent().prepend(\'%s\')', $lock)); } } diff --git a/public/admin/skins/bokeh74/front_nav.css b/public/admin/skins/bokeh74/front_nav.css index 537ec4a3a2c97b184e33441b339675c4b4b9ed5a..1cc293c29c6930e65d643289b13e4cba7a530c82 100644 --- a/public/admin/skins/bokeh74/front_nav.css +++ b/public/admin/skins/bokeh74/front_nav.css @@ -18,11 +18,11 @@ } .menu_admin_front.hidden > div { - width: 0; + margin-left: -300px; } .menu_admin_front > button { - position: absolute; + margin: 0; white-space: nowrap; } diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index 9c47de6bf92d1d2225f9c28d231bb3c0ffde1dab..7821b2ef5e9fd75b66e9f69af5eb2c37d252c9ab 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -51,7 +51,6 @@ class IndexControllerSetupDomainTest extends AbstractControllerTestCase { } - class IndexControllerAsInviteTest extends AbstractControllerTestCase { protected function _loginHook($account) { $account->ROLE_LEVEL = ZendAfi_Acl_AdminControllerRoles::INVITE; @@ -78,6 +77,13 @@ class IndexControllerAsInviteTest extends AbstractControllerTestCase { $this->dispatch('/?id_profil=1'); $this->assertNotXPath('//a[contains(@href, "admin/profil/accueil/id_profil/1")]'); } + + + /** @test */ + public function menuAdminFrontShouldBeVisible() { + $this->dispatch('/'); + $this->assertNotXPath('//body/div[@class="menu_admin_front hidden"]'); + } } @@ -128,6 +134,12 @@ class IndexControllerAsAdminWithCssEditorAndNoHeaderCss extends IndexControllerA public function comboProfilCurrentProfilShouldBeOne() { $this->assertXPath('//div[@class="footer"]//select[@id="select_clef_profil"]//option[@value="1"][@selected="selected"]'); } + + + /** @test */ + public function menuAdminFrontShouldBeVisible() { + $this->assertXPath('//body/div[@class="menu_admin_front hidden"]'); + } } @@ -692,4 +704,48 @@ class IndexControllerStatusTest extends AbstractControllerTestCase { public function dateCreationShouldBeSet() { $this->assertNotNull($this->_json['headers']['creation_datetime'], $this->_json); } +} + + + +class IndexControllerWithBibAdminLoggedTest extends AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $joe = $this->fixture('Class_Users', + ['id' => 23, + 'login' => 'Joe', + 'password' => 'unsupermotdepasse', + 'id_site' => 1, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_BIB]); + ZendAfi_Auth::getInstance()->logUser($joe); + $this->dispatch('/'); + } + + + /** @test */ + public function menuAdminFrontShouldBeVisible() { + $this->assertXPath('//body/div[@class="menu_admin_front hidden"]'); + } + + + /** @test */ + public function frontNavCssShouldBeLoaded() { + $this->assertXPath('//link[contains(@href, "front_nav.css")]'); + } + + + /** @test */ + public function linkToClearCacheShouldBeInMenu() { + $this->assertXPath('//body/div//a[contains(@href, "/admin/index/clearcache")]'); + } + + + /** @test */ + public function linkToToggleWidgetMoveShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Activer déplacement des boites'); + } } \ No newline at end of file