diff --git a/VERSIONS_WIP/60900 b/VERSIONS_WIP/60900 new file mode 100644 index 0000000000000000000000000000000000000000..bfe33da7f233c9fc4e92e449393882b92a094395 --- /dev/null +++ b/VERSIONS_WIP/60900 @@ -0,0 +1,2 @@ + - ticket #60900 : Administration : ajout d'un menu dans l'interface publique pour regrouper les actions et outils de l'administration. + \ No newline at end of file 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/application/modules/admin/controllers/UsersController.php b/application/modules/admin/controllers/UsersController.php index 68c14a124260e639f5b0d245d72e25747cb8aa8b..c5a5e7ee206e3c5cccf72f69345b37e28fd97518 100644 --- a/application/modules/admin/controllers/UsersController.php +++ b/application/modules/admin/controllers/UsersController.php @@ -49,4 +49,17 @@ class Admin_UsersController extends ZendAfi_Controller_Action { $this->_redirectToReferer(); } + + + public function settingsAction() { + $viewRenderer = $this->getHelper('ViewRenderer'); + $viewRenderer->setNoRender(); + + if(!$user = Class_Users::getIdentity()) + return; + + $settings = Class_User_Settings::newWith($user); + $settings->set($this->_getParam('key'), $this->_getParam('value')); + $user->save(); + } } diff --git a/application/modules/admin/controllers/WidgetController.php b/application/modules/admin/controllers/WidgetController.php index e3270a2b0767cc806d924cb4778a17b79bab1be0..c62b606c721273d8c418e4fe67fb0077731c9bd7 100644 --- a/application/modules/admin/controllers/WidgetController.php +++ b/application/modules/admin/controllers/WidgetController.php @@ -24,7 +24,7 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { public function preDispatch() { parent::preDispatch(); - if(!Class_Users::isCurrentUserAllowedToEditProfile($this->_getParam('id_profil', 1))) + if(!Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::find($this->_getParam('id_profil', 1)))) $this->_redirectClose($this->_getReferer()); } diff --git a/application/modules/opac/controllers/IndexController.php b/application/modules/opac/controllers/IndexController.php index 3570d1299d59f802c145d43d5f3b4db1aa38d1b9..d62260b1f5c5610078eceb4d4903231e07db7d7e 100644 --- a/application/modules/opac/controllers/IndexController.php +++ b/application/modules/opac/controllers/IndexController.php @@ -21,11 +21,23 @@ class IndexController extends ZendAfi_Controller_Action { public function indexAction() { - // Mettre le layout $viewRenderer = $this->getHelper('ViewRenderer'); - $viewRenderer->setLayoutScript('portail.phtml'); - - if (array_keys($this->getRequest()->getParams()) == ['controller', 'action', 'module', 'current_module', 'q']) { + $viewRenderer->setLayoutScript('module.phtml'); + + $this->view->getModuleContent = function() + { + $html = ''; + if ((new Class_UserAgent())->isMobile() + && Class_Profil::isAPhoneProfilEnabled()) + $html = sprintf('<div class="back_to_phone">%s</div>', + $this->view->tagAnchor($this->view->url(['module' => 'telephone'], null, true), + $this->_('Afficher le site en mode mobile'))); + + return $html . $this->view->partial('accueil.phtml', + ['profil' => Class_Profil::getCurrentProfil()]); + }; + + if(array_keys($this->getRequest()->getParams()) == ['controller', 'action', 'module', 'current_module', 'q']) { $this->_redirect('recherche?'.http_build_query(['q' => $this->_getParam('q')])); } } diff --git a/application/modules/opac/views/scripts/footer.phtml b/application/modules/opac/views/scripts/footer.phtml index bcf310e7d3136b36b4c8108061c70cc8fdc59fcc..5f4921dbd2ce7a3611ed7da494f41cace83ea174 100644 --- a/application/modules/opac/views/scripts/footer.phtml +++ b/application/modules/opac/views/scripts/footer.phtml @@ -1,42 +1,44 @@ <?php $profil = Class_Profil::getCurrentProfil();?> - <div class="footer" style="overflow:hidden;clear:both;width:<?php echo $profil->getWidthSite() ?>"> - <table style="boder-spacing:0; border-collapse:collapse; width:100%"> - <tr> - <td style="padding-left:15px;"> - <?php - echo $this->tagAnchor($this->url(['module'=>'admin'], null, true), - $this->_('Accès pro.'), - ['title' => $this->_('Accéder à l\'espace professionnel')]); - ?> - </td> +<div class="footer" style="overflow:hidden;clear:both;width:<?php echo $profil->getWidthSite() ?>"> + <table style="boder-spacing:0; border-collapse:collapse; width:100%"> + <tr> + <td style="padding-left:15px;"> <?php - // Combo des profils pour les admins - if(Class_Users::getLoader()->isCurrentUserCanAccesBackend()) { - echo '<td style="text-align:center; white-space: nowrap">'; - echo $this->tagAnchor(['module' => 'admin', - 'controller' => 'profil', - 'action' => 'accueil', - 'id_profil' => $profil->getId()], - - $this->tagImg(URL_ADMIN_IMG.'ico/edit.gif', - ['alt' => $this->_("Paramétrer cette page"), - 'title' => $this->_("Paramétrer cette page")]), - ['class' => 'edit_profil', - 'title' => $this->_('Paramétrer la page "%s"', - $profil->getLibelle())]); - - echo $this->ComboProfils("ALL","ALL", $profil->getId(),true); - echo '</td>'; - } + echo $this->tagAnchor($this->url(['module'=>'admin'], null, true), + $this->_('Accès pro.'), + ['title' => $this->_('Accéder à l\'espace professionnel')]); ?> - <td style="text-align:right;padding-right:10px"> - <div class="credit"> - <?php echo $this->tagCredits() ?> - </div> - </td> - </tr> - </table> - </div> + </td> + <?php + // Combo des profils pour les admins + if(Class_Users::getLoader()->isCurrentUserCanAccesBackend()) { + echo '<td style="text-align:center; white-space: nowrap">'; + echo $this->tagAnchor(['module' => 'admin', + 'controller' => 'profil', + 'action' => 'accueil', + 'id_profil' => $profil->getId()], + + $this->tagImg(URL_ADMIN_IMG.'ico/edit.gif', + ['alt' => $this->_("Paramétrer cette page"), + 'title' => $this->_("Paramétrer cette page")]), + ['class' => 'edit_profil', + 'title' => $this->_('Paramétrer la page "%s"', + $profil->getLibelle())]); + $this->getHelper('ComboProfils') + ->setTagId('select_clef_profil') + ->setTagName('clef_profil'); + echo $this->ComboProfils("ALL","ALL", $profil->getId(),true); + echo '</td>'; + } + ?> + <td style="text-align:right;padding-right:10px"> + <div class="credit"> + <?php echo $this->tagCredits() ?> + </div> + </td> + </tr> + </table> +</div> </div> <?php echo Class_AdminVar::get('JS_STAT'); ?> </body> diff --git a/application/modules/opac/views/scripts/module.phtml b/application/modules/opac/views/scripts/module.phtml index 6503a2e423148756fcac7425bb88689b8f75e339..e72b92d0611112a4a37dedb11266935830fbc9a3 100644 --- a/application/modules/opac/views/scripts/module.phtml +++ b/application/modules/opac/views/scripts/module.phtml @@ -1,9 +1,15 @@ <?php ob_start(); echo '<body '.$this->bodyParam.'>'; -echo $this->partial('contenu.phtml', - ['profil' => $this->profil, - 'actionContent' => $this->fonctionsAdmin().$this->render($this->actionScript)]); +echo $this->Admin_FrontNav(); + +$content_html = (isset($this->getModuleContent)) + ? call_user_func($this->getModuleContent) + : $this->partial('contenu.phtml', + ['profil' => $this->profil, + 'actionContent' => $this->fonctionsAdmin() . $this->render($this->actionScript)]); + +echo $content_html; echo $this->partial('footer.phtml', ['portail_cfg_site' => $this->profil->getCfgSiteAsArray()]); diff --git a/application/modules/opac/views/scripts/portail.phtml b/application/modules/opac/views/scripts/portail.phtml deleted file mode 100644 index 27c6e6dc9b16613fb2bf9b54331801b6d583e27d..0000000000000000000000000000000000000000 --- a/application/modules/opac/views/scripts/portail.phtml +++ /dev/null @@ -1,21 +0,0 @@ -<?php -ob_start(); -echo '<body '.$this->bodyParam.'>'; -if ((new Class_UserAgent())->isMobile() && Class_Profil::isAPhoneProfilEnabled()) - echo sprintf('<div class="back_to_phone">%s</div>', - $this->tagAnchor($this->url(['module' => 'telephone'], null, true), - $this->_('Afficher le site en mode mobile'))); -echo $this->partial('accueil.phtml', - ['profil' => $this->profil]); - -echo $this->partial('footer.phtml', - ['portail_cfg_site' => $this->profil->getCfgSiteAsArray()]); - -$html = ob_get_contents(); -ob_end_clean(); - -echo $this->partial('head.phtml', - array_merge($this->profil->getCfgSiteAsArray(), - ['titre' => $this->getTitre()])); -echo $html; -?> diff --git a/library/Class/Admin/Skin.php b/library/Class/Admin/Skin.php index b4bb2640302a62ee0e748931eece6917ecafbfb5..97622f7a3eda0c05c993460b1838647954ee8a43 100644 --- a/library/Class/Admin/Skin.php +++ b/library/Class/Admin/Skin.php @@ -145,6 +145,11 @@ class Class_Admin_Skin { } + public function renderAdminFrontNavCssOn($script_loader) { + return $this->_renderCssOn($script_loader, 'front_nav.css'); + } + + public function renderJQueryCssOn($script_loader) { return $this->_renderCssOn($script_loader, 'jquery.css'); } diff --git a/library/Class/Users.php b/library/Class/Users.php index 409db473e1279c5de5a39b329defca59a7bcb11b..b08e0300f38ba7d29062d9ab462e9502b44035b2 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -170,8 +170,8 @@ class UsersLoader extends Storm_Model_Loader { } - public function isCurrentUserAllowedToEditProfile($profile_id) { - if(!$profile = Class_Profil::find($profile_id)) + public function isCurrentUserAllowedToEditProfile($profile) { + if(!$profile) return false; if(!$user = $this->getIdentity()) @@ -1145,7 +1145,7 @@ class Class_Users extends Storm_Model_Abstract { public function getNomAff($id_user = null, $complet = false) { if ($id_user != null) { - if (null === $user = $this->getLoader()->find($id_user)) + if (null === $user = Class_Users::find($id_user)) return ''; } else { $user = $this; diff --git a/library/ZendAfi/Acl/AdminControllerGroup.php b/library/ZendAfi/Acl/AdminControllerGroup.php index be6f7932a420da00c6a0c822103954460ac78e3b..6cefa60633a5cc2ae85bdada17cc27b263eb561b 100644 --- a/library/ZendAfi/Acl/AdminControllerGroup.php +++ b/library/ZendAfi/Acl/AdminControllerGroup.php @@ -38,7 +38,8 @@ class ZendAfi_Acl_AdminControllerGroup { 'oai' => Class_UserGroup::RIGHT_USER_BIB_NUM, 'frbr-link' => Class_UserGroup::RIGHT_USER_NOTICES_LIEES, 'users' => Class_UserGroup::RIGHT_USER_SIGB_USER_READ, - 'users/change-admin-skin' => null + 'users/change-admin-skin' => null, + 'users/settings' => null ], $_activated = []; diff --git a/library/ZendAfi/Acl/AdminControllerRoles.php b/library/ZendAfi/Acl/AdminControllerRoles.php index 9b35dc27fe54b8cce40acea1ffaf4e3a336f866c..6913a8aa1dda39ff7f898ab70e8cf11cd2697c9d 100644 --- a/library/ZendAfi/Acl/AdminControllerRoles.php +++ b/library/ZendAfi/Acl/AdminControllerRoles.php @@ -71,6 +71,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->add(new Zend_Acl_Resource('ouvertures')); $this->add(new Zend_Acl_Resource('users')); $this->add(new Zend_Acl_Resource('users/change-admin-skin')); + $this->add(new Zend_Acl_Resource('users/settings')); $this->add(new Zend_Acl_Resource('usergroup')); $this->add(new Zend_Acl_Resource('activity')); $this->add(new Zend_Acl_Resource('newsletter')); @@ -88,6 +89,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->add(new Zend_Acl_Resource('frbr-link')); $this->add(new Zend_Acl_Resource('print')); $this->add(new Zend_Acl_Resource('external-agendas')); + $this->add(new Zend_Acl_Resource('systeme')); //Roles $this->addRole(new Zend_Acl_Role('invite')); @@ -119,6 +121,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->allow('modo_bib','redmine'); $this->allow('modo_bib','widget'); $this->allow('modo_bib','users/change-admin-skin'); + $this->allow('modo_bib','users/settings'); $this->allow('admin_bib','rss'); $this->allow('admin_bib','catalogue'); @@ -155,6 +158,7 @@ class ZendAfi_Acl_AdminControllerRoles extends Zend_Acl { $this->deny('modo_portail','bib'); $this->deny('modo_portail','users'); $this->deny('modo_portail','usergroup'); + $this->deny('modo_portail','systeme'); $this->allow('modo_portail'); $this->allow('admin_portail'); diff --git a/library/ZendAfi/Controller/Plugin/XHProfile.php b/library/ZendAfi/Controller/Plugin/XHProfile.php index 495b098324d6e6fcb115b4cf4a0d8ff91b6cae01..6bfec72eceeae6b41ad12e58253ffef898db806c 100644 --- a/library/ZendAfi/Controller/Plugin/XHProfile.php +++ b/library/ZendAfi/Controller/Plugin/XHProfile.php @@ -37,10 +37,9 @@ class ZendAfi_Controller_Plugin_XHProfile extends Zend_Controller_Plugin_Abstrac $view=new ZendAfi_Controller_Action_Helper_View(); Class_ScriptLoader::getInstance() - ->addJQueryReady('$("<button>Profile</button>") + ->addJQueryReady('if($("a.hx_prof").length) return false; $("<li><a class=\"hx_prof\" href=\"#\">Profile XHProf</a></li>") .attr("onclick", "window.open(\''.$view->url(["xhprof" => 1]).'\', \'_blank\')") - .attr("style", "position:absolute;top:0;right:0") - .appendTo(\'body\')'); + .appendTo(\'body .menu_admin_front .dev_tools\')'); } if (!$request->getParam('xhprof', false)) diff --git a/library/ZendAfi/Form/Decorator/ComboProfils.php b/library/ZendAfi/Form/Decorator/ComboProfils.php index 867ed6fb27f304125fa68e002a7c8e00fc459463..b671adfd6c004e94d686bb61051e0691f798bf28 100644 --- a/library/ZendAfi/Form/Decorator/ComboProfils.php +++ b/library/ZendAfi/Form/Decorator/ComboProfils.php @@ -34,7 +34,8 @@ class ZendAfi_Form_Decorator_ComboProfils extends Zend_Form_Decorator_Abstract { $combo = $this->_element->getView() ->comboProfils($this->_element->getProfil(), $this->_element->profil_filter, - $this->_element->getValue()); + $this->_element->getValue(), + $this->_element->autoload); return $content . $combo; } } diff --git a/library/ZendAfi/Form/Element/ComboProfils.php b/library/ZendAfi/Form/Element/ComboProfils.php index 5ce5312db95b14870e61c79360055857560135c1..0010141a20aa955e885d140d228df502245b76bc 100644 --- a/library/ZendAfi/Form/Element/ComboProfils.php +++ b/library/ZendAfi/Form/Element/ComboProfils.php @@ -21,6 +21,8 @@ class ZendAfi_Form_Element_ComboProfils extends Zend_Form_Element { + protected $autoload = false; + public function __construct($spec, $options = null) { parent::__construct($spec, $options); $decorators = $this->_decorators; diff --git a/library/ZendAfi/View/Helper/Accueil/Kiosque.php b/library/ZendAfi/View/Helper/Accueil/Kiosque.php index 84d936ae977585884a7ab2e14d1309bc0f46563d..52beda3fe2fe52f936eebf58f948fb6cff2ab826 100644 --- a/library/ZendAfi/View/Helper/Accueil/Kiosque.php +++ b/library/ZendAfi/View/Helper/Accueil/Kiosque.php @@ -69,10 +69,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba $this->contenu = (in_array($this->preferences['style_liste'], ['mur', 'vignettes', 'chrono'])) ? $this->getKiosqueHtml() : $this->getKiosqueIFrame(); - $this->contenu = - $this->getAddEditLinks() - .$this->getChangeKiosqueData() - .$this->contenu; + $this->contenu = $this->getChangeKiosqueData() . $this->contenu; return $this->getHtmlArray(); } @@ -130,12 +127,15 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba ],null,true); return - '<div class="change_kiosque_data">'. - $this->view->tagAnchor($change_kiosque_selection_url, - $this->view->tagImg(URL_ADMIN_IMG.'picto/domaines_16.png', - ['title' => $this->view->_('Modifier la source de données du kiosque')]), - ['data-popup'=>'true']). - '</div>'; + $this->_tag('div', + $this->getAddEditLinks() . + $this->view->tagAnchor($change_kiosque_selection_url, + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('icons', + 'domains'), + ['title' => $this->view->_('Modifier la source de données du kiosque')]), + ['data-popup'=>'true']), + ['class' => 'change_kiosque_data configuration_module']); } diff --git a/library/ZendAfi/View/Helper/Admin/Button.php b/library/ZendAfi/View/Helper/Admin/Button.php index db08a1632bf5aa2660e323d4b19edc791c16ad70..36a1f80ce700e3ad56c2f9d7132d7d192fb46aec 100644 --- a/library/ZendAfi/View/Helper/Admin/Button.php +++ b/library/ZendAfi/View/Helper/Admin/Button.php @@ -21,6 +21,11 @@ class ZendAfi_View_Helper_Admin_Button extends ZendAfi_View_Helper_Button { + public function Admin_Button($button) { + return $this->button($button); + } + + public function button($button) { if(!$button) return ''; diff --git a/library/ZendAfi/View/Helper/Admin/FrontNav.php b/library/ZendAfi/View/Helper/Admin/FrontNav.php new file mode 100644 index 0000000000000000000000000000000000000000..7fd31ea02be22c16b7e610a87290d00e0a223cba --- /dev/null +++ b/library/ZendAfi/View/Helper/Admin/FrontNav.php @@ -0,0 +1,267 @@ +<?php +/** + * Copyright (c) 2012-2017, 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_View_Helper_Admin_FrontNav extends ZendAfi_View_Helper_BaseHelper { + + public function Admin_FrontNav() { + if(!Class_Users::isCurrentUserCanAccesBackend()) + return ''; + + Class_Admin_Skin::current()->renderAdminFrontNavCssOn(Class_ScriptLoader::getInstance()); + + $html = [$this->view->Admin_Button((new Class_Entity()) + ->setText($this->_('Administration')) + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', + 'configuration'))) + ->setAttribs(['onclick' => '$(\'.menu_admin_front\').toggleClass(\'hidden\');return false;'])), + $this->_tag('div', + $this->_tag('ul', implode($this->_getEntries())))]; + + return $this->_tag('div', + implode($html), + ['class' => 'menu_admin_front hidden']); + } + + + protected function _getEntries() { + $entries = [$this->_myAccount(), + $this->_adminLinks(), + $this->_adminActions(), + $this->_devTools()]; + + return $this->_lify($entries); + } + + + protected function _lify($entries) { + return array_map(function($entry) + { + return $this->_tag('li', $entry); + }, $entries); + } + + + protected function _myAccount() { + $id = Class_Users::getIdentity()->getId(); + return $this->_tag('div', + $this->view->tagAnchor(['module' => 'admin', + 'controller' => 'users', + 'action' => 'edit', + 'id' => $id], + $this->_('Utilisateur courant : %s', Class_Users::getNomAff($id)), + ['title' => $this->_('Accéder à la page de modification de mon compte administrateur'), + 'data-popup' => 'true']), + ['class' => 'admin_menu_title']); + } + + + protected function _adminActions() { + $actions = [$this->view->tagAnchor(Class_Url::absolute('/admin/index/clearcache/'), + $this->_('Vider le cache') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'delete')), + ['title' => $this->_('Vider le cache de Bokeh')]), + + $this->_toggleAnchor($this->_('Afficher les icones d\'administration'), + 'show_admin_icons', + '$("#site_web_wrapper").attr("data-show_admin_icons", "true");', + '$("#site_web_wrapper").attr("data-show_admin_icons", "false");')]; + + if($this->_isAllowed('profil', 'module-sort') && Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::getCurrentProfil())) + $actions[] = $this->_moduleSort(); + + if($this->_isAllowed('systeme', 'index')) + $actions[] = $this->_toggleAnchor($this->_('Editeur CSS'), + 'css_editor', + 'showCSSEditor();$("#amber").show();', + 'smalltalk.AFICssEditor._close();$("#amber").hide();'); + + return $this->_tag('div', $this->_changeProfile(), ['class' => 'admin_menu_title']) . + $this->_tag('ul', implode($this->_lify($actions))); + } + + + protected function _changeProfile() { + $form = (new ZendAfi_Form) + ->addElement('comboProfils', + 'admin_menu_change_profile', + ['label' => $this->_('Outils pour la page :'), + 'autoload' => true]) + ->addUniqDisplayGroup('group') + ->populate(['admin_menu_change_profile' => Class_Profil::getCurrentProfil()->getId()]); + + return $this->view->renderForm($form->setAction('/')); + } + + + protected function _toggleAnchor($label, $key, $js_on, $js_off) { + $toggleFy = function($function_name, $img) use ($label, $key) { + return $this->view->tagAnchor('#', + $label . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + $img)), + ['class' => $function_name, + 'title' => $this->_('Activer ou désactiver : %s', $label), + 'onclick' => $function_name . '();return true;']); + }; + + $admin = Class_Users::getIdentity(); + $settings = Class_User_Settings::newWith($admin); + + $activate_function = 'activate_' . $key; + $deactivate_function = 'deactivate_' . $key; + + $url = Class_Url::absolute(sprintf('/admin/users/settings/key/%s/value/', $key)); + + $this->_injectJsFunction($activate_function, $deactivate_function, $js_on, $js_off, $url); + + if($settings->get($key)) + Class_ScriptLoader::getInstance() + ->addJQueryReady($activate_function . '();'); + + return $toggleFy($activate_function, 'toggle_off') . $toggleFy($deactivate_function, 'toggle_on'); + } + + + protected function _injectJsFunction($activate_function, $deactivate_function, $js_on, $js_off, $url) { + $js_default_function = '%s = function() {%s; $(\'.%s\').hide(); $(\'.%s\').show();$.ajax(\'%s\');};'; + + $js_activate = sprintf($js_default_function, + $activate_function, + $js_on, + $activate_function, + $deactivate_function, + $url . 1); + + $js_deactivate = sprintf($js_default_function, + $deactivate_function, + $js_off, + $deactivate_function, + $activate_function, + $url . 0); + + Class_ScriptLoader::getInstance() + ->addInlineScript($js_activate . $js_deactivate); + + return $this; + } + + + + protected function _adminLinks() { + $links = [$this->view->tagAnchor(Class_Url::absolute('/admin'), + $this->_('Accueil') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('icons', + 'home')), + ['title' => $this->_('Accéder à l\'interface d\'administration')])]; + + if($this->_isAllowed('cms', 'index')) + $links[] = $this->view->tagAnchor(Class_Url::absolute('/admin/cms/'), + $this->_('Articles') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('icons', + 'articles')), + ['title' => $this->_('Accéder aux articles dans l\'interface d\'administration')]); + + if($this->_isAllowed('catalogue', 'index')) + $links[] = $this->view->tagAnchor(Class_Url::absolute('/admin/catalogue/'), + $this->_('Domaines') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('icons', + 'domains')), + ['title' => $this->_('Accéder aux domaines dans l\'interface d\'administration')]); + + if($this->_isAllowed('profil', 'accueil') && Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::getCurrentProfil())) + $links[] = $this->view->tagAnchor($this->view->url(['module' => 'admin', + 'controller' => 'profil', + 'action' => 'accueil', + 'id_profil' => Class_Profil::getCurrentProfil()->getId()], + null, + true), + $this->_('Configuration de la page courante') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'edit'), + ['style' => 'height: 18px;']), + ['title' => $this->_('Configurer la page courante dans l\'interface d\'administration')]); + + return $this->_tag('div', $this->_('Console d\'administration'), ['class' => 'admin_menu_title']) . + $this->_tag('ul', implode($this->_lify($links))); + } + + + protected function _devTools() { + $tools = []; + + if($this->_isAllowed('systeme', 'index')) + $tools[] = $this->view->tagAnchor('#', + $this->_('Synchronisation du CSS avec GIT') . + $this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('icons', + 'batches'), + ['style' => 'height: 18px;']), + ['title' => $this->_('Faire une demande de mise à jour de la charte graphique'), + 'onclick' => sprintf('$.ajax(\'%s\'); $(this).find(\'img\').attr(\'src\', \'%s\'); $(this).find(\'img\').attr(\'style\', \'height: 18px; filter: invert(0);\');return true;', + Class_Url::absolute('/admin/index/update-skin/git/pull'), + URL_ADMIN_IMG . 'loading.gif')]); + + if(Class_Users::isCurrentUserSuperAdmin()) + $tools = array_merge($tools, [$this->_toggleAnchor($this->_('Amber IDE'), + 'amber_ide', + 'showAmberIDE();$("#amber").show();', + '$("#amber").hide();'), + + $this->_toggleAnchor($this->_('ZF Debug'), + 'zf_debug', + '$(".activate_zf_debug").show();', + '$(".deactivate_zf_debug").hide();')]); + if(!$tools) + return ''; + + return $this->_tag('div', $this->_('Développement'), ['class' => 'admin_menu_title']) + . $this->_tag('ul', implode($this->_lify($tools)), ['class' => 'dev_tools']); + } + + + protected function _isAllowed($controller, $action) { + return (new ZendAfi_Acl_AdminControllerGroup)->isAllowed(Class_Users::getIdentity(), + $controller, + $action); + } + + + protected function _moduleSort() { + Class_ScriptLoader::getInstance() + ->addAdminScript('cfg.accueil') + ->addInlineScript('window.activateOpacBlocksSorting = window.deactiveOpacBlocksSorting = function() {};'); + + return $this->_toggleAnchor($this->_('Déplacement des boites'), + 'block_sorting', + sprintf('opacBlocksSorting(\'%s\',%d); $("div.layout-division>div").sortable("enable");', Class_Url::absolute('/admin/profil/module-sort'), Class_Profil::getCurrentProfil()->getId()), + '$("div.layout-division>div").sortable("disable");'); + + } +} \ No newline at end of file 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/library/ZendAfi/View/Helper/Portail.php b/library/ZendAfi/View/Helper/Portail.php index 84db737f910247dd04e8e66761a0e65fcb4c2e6d..184446f9d786b52765791af0b4d1f40c0674f2b1 100644 --- a/library/ZendAfi/View/Helper/Portail.php +++ b/library/ZendAfi/View/Helper/Portail.php @@ -16,13 +16,10 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class ZendAfi_View_Helper_Portail extends ZendAfi_View_Helper_BaseHelper { public function portail($cfg_accueil,$division_demandee = false) { - - $this->loadAdminUI(); - $ret = ['', '', '', @@ -34,7 +31,7 @@ class ZendAfi_View_Helper_Portail extends ZendAfi_View_Helper_BaseHelper { foreach ($cfg_accueil["modules"] as $id_module => $module) { if ($id_module === null) continue; - + $helper = ZendAfi_View_Helper_Accueil_Base::getModuleHelperFromParams($id_module, $module, $this->view); if (!$helper) continue; @@ -49,27 +46,4 @@ class ZendAfi_View_Helper_Portail extends ZendAfi_View_Helper_BaseHelper { return $ret; } - - - public function loadAdminUI() { - $request = Zend_Controller_Front::getInstance()->getRequest(); - if (($user = Class_Users::getLoader()->getIdentity()) - && $user->isAdmin() - && 'index' == $request->getControllerName() - && 'index' == $request->getActionName() - && 'opac' == $request->getModuleName()) { - Class_ScriptLoader::getInstance() - ->addAdminScript('cfg.accueil') - ->addJQueryReady('window.activateOpacBlocksSorting = function() { - opacBlocksSorting("'. - $this->view->url(['module' => 'admin', - 'controller' => 'profil', - 'action' => 'module-sort'], - null, true) .'","'. - Class_Profil::getCurrentProfil()->getId() .'");}'); - - } - } - - } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagEditMenu.php b/library/ZendAfi/View/Helper/TagEditMenu.php index 77c51d43b4457c79185d0935c408dd53c5199248..24bf50c3cc47ace3271e06afd127250cd1ed6d55 100644 --- a/library/ZendAfi/View/Helper/TagEditMenu.php +++ b/library/ZendAfi/View/Helper/TagEditMenu.php @@ -22,7 +22,7 @@ class ZendAfi_View_Helper_TagEditMenu extends ZendAfi_View_Helper_BaseHelper { public function tagEditMenu($menu_id, $profile_id, $parent_id = null, $params = []) { - if (!Class_Users::isCurrentUserAllowedToEditProfile($profile_id)) + if (!Class_Users::isCurrentUserAllowedToEditProfile(Class_Profil::find($profile_id))) return ''; $menu = new Class_Systeme_Widget_Menu(); diff --git a/public/admin/js/cfg.accueil.js b/public/admin/js/cfg.accueil.js index 6e9a897acf47023c32841b6ef15dea5463361f62..7a504fd6e86d50d69009e79a87d11ca096775671 100644 --- a/public/admin/js/cfg.accueil.js +++ b/public/admin/js/cfg.accueil.js @@ -21,8 +21,8 @@ function opacBlocksSorting(moduleSortUrl, currentProfilId) { - opacBlocksSortingInitPositions(); - + opacBlocksSortingInitPositions(); + $('div.layout-division>div').sortable({ cursor: 'move', connectWith: 'div.layout-division>div', diff --git a/public/admin/js/global.js b/public/admin/js/global.js index 73060bc86da94d7679edd016884ccb24549de5ea..64384af5a9443a123b1e91d864a91a908a12496f 100644 --- a/public/admin/js/global.js +++ b/public/admin/js/global.js @@ -268,15 +268,32 @@ if (initializeNoticeMurAnimation == undefined) { } -function deactiveOpacBlocksSorting() { - $('div.layout-division>div').sortable("disable"); +function showCSSEditor() { + amberReadyDo(function() { + smalltalk.AFICssEditor._open(); + }); +} + +function showAmberIDE() { + amberReadyDo(function() { + smalltalk.Browser._open(); + }); } -function reactiveOpacBlocksSorting() { - $('div.layout-division>div').sortable("enable"); + +function amberReadyDo(callback_function) { + setTimeout(function() { + if(('undefined' == typeof smalltalk) + || ('undefined' == typeof smalltalk.AFICssEditor) + || ('undefined' == typeof smalltalk.Browser)) + return amberReadyDo(callback_function); + + return callback_function(); + }, 500); } + function hideMenuAdmin() { $('#menuAdmin').css('display','none'); } @@ -287,7 +304,6 @@ function showMenuAdmin() { } - function toggleMenuAdmin(anchor) { if(!$('#menuAdmin').length) return; @@ -312,6 +328,7 @@ function toggleMenuAdmin(anchor) { hideMenuAdmin(); } + if(typeof setFlagMaj != 'function'){ window.setFlagMaj = function(bMode){}; } diff --git a/public/admin/skins/bokeh72/config.json b/public/admin/skins/bokeh72/config.json index 6def64722fc901a59dfa242e25be6e8ff96232a6..0d451092ec23821fae0d2ad0839dbc4030f998d5 100644 --- a/public/admin/skins/bokeh72/config.json +++ b/public/admin/skins/bokeh72/config.json @@ -129,7 +129,9 @@ "sort": "../../images/ico/sort.gif", "cancel": "../../images/ico/del.gif", "computers": "../../images/picto/postes_16.png", - "batch": "../../images/picto/batch_16.png" + "batch": "../../images/picto/batch_16.png", + "toggle_off": "icons/menu/toggle_off.png", + "toggle_on": "icons/menu/toggle_on.png" }, "buttons": diff --git a/public/admin/skins/bokeh72/front_nav.css b/public/admin/skins/bokeh72/front_nav.css new file mode 100644 index 0000000000000000000000000000000000000000..b94e5da522bef98fac2455a38339bb2986ad5aaf --- /dev/null +++ b/public/admin/skins/bokeh72/front_nav.css @@ -0,0 +1,151 @@ +.menu_admin_front * { + box-sizing: content-box; + font-family: arial, sans-serif; +} + +.menu_admin_front .form select, +.menu_admin_front > div { + background-color: var(--widget-background); +} + +.menu_admin_front .admin_menu_title, +.menu_admin_front .form select, +.menu_admin_front label { + color: var(--main-text); +} + +.menu_admin_front a { + color: var(--anchor); +} + +.menu_admin_front .form select { + border: 1px solid var(--border-highlight); +} + +.menu_admin_front > div { + box-shadow: 1px 1px 5px var(--widget-shadow); +} + +.menu_admin_front { + position: fixed; + top: 0; + left: 0; + z-index: 102; +} + +.menu_admin_front > button, +.menu_admin_front > div { + transition: all 0.4s; +} + +.menu_admin_front > div { + overflow: hidden; + width: 300px; +} + +.menu_admin_front.hidden > div { + margin-left: -300px; +} + +.menu_admin_front > button { + margin: 0; + white-space: nowrap; +} + +.menu_admin_front:not(.hidden) > button > img { + transform: rotate(45deg); +} + +.menu_admin_front .admin_menu_title, +.menu_admin_front form tr, +.menu_admin_front a { + display: block; + line-height: 2em; +} + +.menu_admin_front a img { + float: right; + vertical-align: middle; + padding-right: 1.5em; +} + +.menu_admin_front ul, +.menu_admin_front li { + margin: 0 0 0 0.2em; + padding: 0 0 0 0.2em; + list-style: none; +} + +.menu_admin_front [class*="deactivate"] { + display: none; +} + +.menu_admin_front fieldset { + padding: 0; + margin: 0; +} + +.menu_admin_front .form td { + display: inline-block; + text-align: left !important; +} + +.menu_admin_front .form td + td { + text-align: right !important; + width: 120px; + overflow: hidden; + float: right; + margin-right: 1em; + vertical-align: middle; +} + +.menu_admin_front form + .boutons { + display: none; +} + +.menu_admin_front .form { + text-align: left; +} + +.menu_admin_front .form * { + display: block; +} + +.menu_admin_front .form select { + display: inline; + height: 2em; + width: 115px; +} + +#site_web_wrapper[data-show_admin_icons="true"] a[href*="/admin"] { + display: inline-block !important; +} + + +#site_web_wrapper[data-show_admin_icons="true"] .configuration_module { + display: block !important; +} + +#site_web_wrapper .footer select[onchange], +#site_web_wrapper .footer a[href*="/admin"], +#site_web_wrapper .admin_tools_lock, +#site_web_wrapper .configuration_module, +#site_web_wrapper a[href*="/admin"] { + display: none !important; + opacity: 1 !important; +} + +.menu_admin_front a:hover, +.menu_admin_front a:focus { + text-decoration: underline; +} + +.menu_admin_front a img { + height: 18px; +} + +.menu_admin_front .admin_menu_title { + font-size: 1.17em; + margin: 1em 0 1em 0; + font-weight: bold; +} \ No newline at end of file diff --git a/public/admin/skins/bokeh72/icons/menu/toggle_off.png b/public/admin/skins/bokeh72/icons/menu/toggle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f2131b7d309d2bee9bebbc6631263d4129d98a Binary files /dev/null and b/public/admin/skins/bokeh72/icons/menu/toggle_off.png differ diff --git a/public/admin/skins/bokeh72/icons/menu/toggle_on.png b/public/admin/skins/bokeh72/icons/menu/toggle_on.png new file mode 100644 index 0000000000000000000000000000000000000000..2312c9c2fefd15ad6f439ed6f562d7b9f508505f Binary files /dev/null and b/public/admin/skins/bokeh72/icons/menu/toggle_on.png differ diff --git a/public/admin/skins/bokeh74/config.json b/public/admin/skins/bokeh74/config.json index dd261d49812b938a54510f0bf0a8f351105dd67b..b1515f64ad4343412349e32acb785ca21d60d091 100644 --- a/public/admin/skins/bokeh74/config.json +++ b/public/admin/skins/bokeh74/config.json @@ -134,7 +134,10 @@ "cancel": "icons/actions/cancel_24.png", "computers": "icons/menu/postes_24.png", "batch": "icons/actions/batch_16.png", - "rollback": "icons/actions/rollback_24.png" + "rollback": "icons/actions/rollback_24.png", + "toggle_off": "icons/actions/toggle_off.png", + "toggle_on": "icons/actions/toggle_on.png", + "reload": "icons/actions/reload-arrow.png" }, "buttons": diff --git a/public/admin/skins/bokeh74/front_nav.css b/public/admin/skins/bokeh74/front_nav.css new file mode 100644 index 0000000000000000000000000000000000000000..fbf76e4a6e21638c2808fbb8c65ef49737bfa213 --- /dev/null +++ b/public/admin/skins/bokeh74/front_nav.css @@ -0,0 +1,163 @@ +.menu_admin_front * { + box-sizing: content-box; + font-family: arial, sans-serif; +} + +.menu_admin_front .form select, +.menu_admin_front > div { + background-color: var(--widget-background); +} + +.menu_admin_front .admin_menu_title, +.menu_admin_front .form select, +.menu_admin_front label { + color: var(--main-text); +} + +.menu_admin_front a { + color: var(--anchor); +} + +.menu_admin_front .form select { + border: 1px solid var(--border-highlight); +} + +.menu_admin_front > div { + box-shadow: 1px 1px 5px var(--widget-shadow); +} + +.menu_admin_front { + font-size: 12px; + position: fixed; + top: 0; + left: 0; + z-index: 102; +} + +.menu_admin_front > button, +.menu_admin_front > div { + transition: all 0.4s; +} + +.menu_admin_front > div { + overflow: hidden; + width: 300px; +} + +.menu_admin_front.hidden > div { + margin-left: -300px; +} + +.menu_admin_front > button { + margin: 0; + white-space: nowrap; +} + +.menu_admin_front:not(.hidden) > button > img { + transform: rotate(45deg); +} + +.menu_admin_front .amdin_menu_title, +.menu_admin_front form tr, +.menu_admin_front a { + display: block; + line-height: 2em; +} + +.menu_admin_front a img { + float: right; + vertical-align: middle; + padding-right: 1.5em; +} + +.menu_admin_front ul, +.menu_admin_front li { + margin: 0 0 0 0.2em; + padding: 0 0 0 0.2em; + list-style: none; +} + +.menu_admin_front [class*="deactivate"] { + display: none; +} + +.menu_admin_front fieldset { + padding: 0; + margin: 0; +} + +.menu_admin_front .form td { + display: inline-block; + text-align: left !important; +} + +.menu_admin_front .form td + td { + text-align: right !important; + width: 120px; + overflow: hidden; + float: right; + margin-right: 1em; + vertical-align: middle; +} + +.menu_admin_front form + .boutons { + display: none; +} + +.menu_admin_front .form { + text-align: left; +} + +.menu_admin_front .form * { + display: block; +} + +.menu_admin_front .form select { + display: inline; + height: 2em; + width: 115px; +} + +#site_web_wrapper[data-show_admin_icons="true"] a[href*="/admin"] { + display: inline-block !important; +} + +.menu_admin_front a img { + height: 18px; +} + +.menu_admin_front a[href$="/admin"] img { + filter: invert(1); +} + +#site_web_wrapper[data-show_admin_icons="true"] .configuration_module { + display: block !important; +} + +#site_web_wrapper .footer select[onchange], +#site_web_wrapper .footer a[href*="/admin"], +#site_web_wrapper .admin_tools_lock, +#site_web_wrapper .configuration_module, +#site_web_wrapper a[href*="/admin"] { + display: none !important; + opacity: 1 !important; +} + +.menu_admin_front a:hover, +.menu_admin_front a:focus { + text-decoration: underline; +} + +.menu_admin_front > div { + padding-bottom: 1em; +} + +.menu_admin_front .admin_menu_title { + font-size: 1.17em; + margin: 1em 0 1em 0; + font-weight: bold; +} + +.menu_admin_front .admin_menu_title label { + font-weight: bold; +} \ No newline at end of file diff --git a/public/admin/skins/bokeh74/icons/actions/reload-arrow.png b/public/admin/skins/bokeh74/icons/actions/reload-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..c81e93abe8482f48b53d8d890f09f713b6c17559 Binary files /dev/null and b/public/admin/skins/bokeh74/icons/actions/reload-arrow.png differ diff --git a/public/admin/skins/bokeh74/icons/actions/toggle_off.png b/public/admin/skins/bokeh74/icons/actions/toggle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f2131b7d309d2bee9bebbc6631263d4129d98a Binary files /dev/null and b/public/admin/skins/bokeh74/icons/actions/toggle_off.png differ diff --git a/public/admin/skins/bokeh74/icons/actions/toggle_on.png b/public/admin/skins/bokeh74/icons/actions/toggle_on.png new file mode 100644 index 0000000000000000000000000000000000000000..2312c9c2fefd15ad6f439ed6f562d7b9f508505f Binary files /dev/null and b/public/admin/skins/bokeh74/icons/actions/toggle_on.png differ diff --git a/public/admin/skins/retro/config.json b/public/admin/skins/retro/config.json index 994908fa4890a3fec0cfe658d8c34b5335941445..87a390ad862d874d9482a2c7c9c157603f8498f9 100644 --- a/public/admin/skins/retro/config.json +++ b/public/admin/skins/retro/config.json @@ -133,7 +133,9 @@ "sort": "icons/actions/sort_16.png", "cancel": "icons/actions/cancel_24.png", "computers": "icons/menu/postes_24.png", - "batch": "icons/actions/batch_16.png" + "batch": "icons/actions/batch_16.png", + "toggle_off": "icons/actions/toggle_off.png", + "toggle_on": "icons/actions/toggle_on.png" }, "buttons": diff --git a/public/admin/skins/retro/front_nav.css b/public/admin/skins/retro/front_nav.css new file mode 100644 index 0000000000000000000000000000000000000000..73d4d29e7335df472a7b3460f98b08abfd68d1d5 --- /dev/null +++ b/public/admin/skins/retro/front_nav.css @@ -0,0 +1,168 @@ +@font-face{ + font-family:minecraft; + src:url(Minecraft.ttf) format("truetype"); +} + +.menu_admin_front * { + box-sizing: content-box; + font-family:minecraft, sans-serif; + font-size: 16px; +} + +.menu_admin_front > div > ul { + background-image:url(sand.png); +} + +.menu_admin_front > div > ul > li { + background: rgba(255, 255, 255, 0.5) url(top.png) repeat-x; +} + +.menu_admin_front > div > ul > li { + border: 6px outset #B18C18; +} + +.menu_admin_front > div > ul > li { + margin-top: 1em; +} + +.menu_admin_front .admin_menu_title, +.menu_admin_front .form select, +.menu_admin_front label { + color: var(--main-text); +} + +.menu_admin_front a { + color: var(--anchor); +} + +.menu_admin_front .form select { + border: 1px solid var(--border-highlight); +} + +.menu_admin_front > div { + box-shadow: 1px 1px 5px var(--widget-shadow); +} + +.menu_admin_front { + position: fixed; + top: 0; + left: 0; + z-index: 102; +} + +.menu_admin_front > button, +.menu_admin_front > div { + transition: all 0.4s; +} + +.menu_admin_front > div { + overflow: hidden; + width: 300px; +} + +.menu_admin_front.hidden > div { + margin-left: -300px; +} + +.menu_admin_front > button { + margin: 0; + white-space: nowrap; +} + +.menu_admin_front:not(.hidden) > button > img { + transform: rotate(45deg); +} + +.menu_admin_front .admin_menu_title, +.menu_admin_front form tr, +.menu_admin_front a { + display: block; + line-height: 2em; +} + +.menu_admin_front a img { + float: right; + vertical-align: middle; + padding-right: 1.5em; +} + +.menu_admin_front ul, +.menu_admin_front li { + margin: 0; + padding: 0 0.2em 0 0.2em; + list-style: none; +} + +.menu_admin_front [class*="deactivate"] { + display: none; +} + +.menu_admin_front fieldset { + padding: 0; + margin: 0; +} + +.menu_admin_front .form td { + display: inline-block; + text-align: left !important; +} + +.menu_admin_front .form td + td { + text-align: right !important; + width: 150px; + overflow: hidden; + float: right; + margin-right: 1.5em; + vertical-align: middle; +} + +.menu_admin_front form + .boutons { + display: none; +} + +.menu_admin_front .form { + text-align: left; +} + +.menu_admin_front .form * { + display: block; +} + +.menu_admin_front .form select { + height: 2em; + width: 149px; +} + +#site_web_wrapper[data-show_admin_icons="true"] a[href*="/admin"] { + display: inline-block !important; +} + + +#site_web_wrapper[data-show_admin_icons="true"] .configuration_module { + display: block !important; +} + +#site_web_wrapper .footer select[onchange], +#site_web_wrapper .footer a[href*="/admin"], +#site_web_wrapper .admin_tools_lock, +#site_web_wrapper .configuration_module, +#site_web_wrapper a[href*="/admin"] { + display: none !important; + opacity: 1 !important; +} + +.menu_admin_front a:hover, +.menu_admin_front a:focus { + text-decoration: underline; +} + +.menu_admin_front a[href$="/admin"] img { + height: 18px; + filter: invert(1); +} + +.menu_admin_front .admin_menu_title { + font-size: 1.17em; + margin: 1em 0 1em 0; + font-weight: bold; +} \ No newline at end of file diff --git a/public/admin/skins/retro/icons/actions/toggle_off.png b/public/admin/skins/retro/icons/actions/toggle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f2131b7d309d2bee9bebbc6631263d4129d98a Binary files /dev/null and b/public/admin/skins/retro/icons/actions/toggle_off.png differ diff --git a/public/admin/skins/retro/icons/actions/toggle_on.png b/public/admin/skins/retro/icons/actions/toggle_on.png new file mode 100644 index 0000000000000000000000000000000000000000..2312c9c2fefd15ad6f439ed6f562d7b9f508505f Binary files /dev/null and b/public/admin/skins/retro/icons/actions/toggle_on.png differ diff --git a/public/opac/css/global.css b/public/opac/css/global.css index c4fe095a4b64fa6229ca63cbd0232d9c18fc62e1..adcd75febd82d31fdc5122a9756b19c218ff323d 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -1076,8 +1076,9 @@ article, } -.boite.kiosque .change_kiosque_data { - display: inline; +.boite.kiosque .change_kiosque_data.configuration_module { + float: left; + left: 2em; } @@ -1567,7 +1568,7 @@ body.abonne_multimedia-hold-view .actions a { right: 0px; top: 0px; cursor: pointer; - z-index: 101; + z-index: 10; } diff --git a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php index 4bf8da8d32762deaeadd4d91c31fe80b9fa68869..4c4b1b67d03351f024f3e606c3a76cd57496e8b0 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerSettingsTest.php @@ -287,3 +287,26 @@ class AbonneControllerWithLibrariesAndNoDomainsBookmarkableTest extends Abstract $this->assertXPathContentContains('//div//a', 'Gérer mes favoris', $this->_response->getBody()); } } + + + +class AbonneControllerSettingsAdminSettingsTest extends AbonneControllerSettingsTestCase { + public function setUp() { + parent::setUp(); + $this->_user->beAdminPortail(); + } + + + /** @test */ + public function userShowAdminIconsShouldBeEnabled() { + $this->dispatch('/admin/users/settings/key/show_admin_icons/value/1', true); + $this->assertEquals(1, Class_User_Settings::newWith($this->_user)->get('show_admin_icons')); + } + + + /** @test */ + public function userShowAdminIconsShouldBeDisabled() { + $this->dispatch('/admin/users/settings/key/show_admin_icons/value/0', true); + $this->assertEquals(0, Class_User_Settings::newWith($this->_user)->get('show_admin_icons')); + } +} \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/FormulaireContactTest.php b/tests/application/modules/opac/controllers/FormulaireContactTest.php index de7969656c38fd3fc58ddf331f931a66bb09ce70..f83eefe9f8aa9fd48aefe030b2cf38dc89d91265 100644 --- a/tests/application/modules/opac/controllers/FormulaireContactTest.php +++ b/tests/application/modules/opac/controllers/FormulaireContactTest.php @@ -556,4 +556,18 @@ class FormulaireContactActionWithBibSelectorSettingNotValidPostTest $this->assertXPathContentContains('//ul[@class="errors"]/li', 'Veuillez sélectionner une bibliothèque'); } } -?> \ No newline at end of file + + + +class FormulaireContactAsAdminTest extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/index/formulairecontact', true); + } + + + /** @test */ + public function menuAdminFrontShouldBeVisible() { + $this->assertXPath('//body/div[@class="menu_admin_front hidden"]'); + } +} \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index 9c47de6bf92d1d2225f9c28d231bb3c0ffde1dab..0366244faafba7c6f95b46d305674daaa24a237f 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -25,7 +25,7 @@ class IndexControllerSetupDomainTest extends AbstractControllerTestCase { /** @test */ public function accessingIndexShouldSetupNomDomain() { - $this->dispatch('/'); + $this->dispatch('/', true); $this->assertEquals('localhost' . Class_Url::baseUrl(), Class_AdminVar::get('NOM_DOMAINE')); } @@ -37,7 +37,7 @@ class IndexControllerSetupDomainTest extends AbstractControllerTestCase { ['id' => 'NOM_DOMAINE', 'clef' => 'NOM_DOMAINE', 'valeur' => 'bokeh-library-protal.org']); - $this->dispatch('/'); + $this->dispatch('/', true); $this->assertEquals('http://bokeh-library-protal.org', Class_Url::siteUrl()); } @@ -45,13 +45,12 @@ class IndexControllerSetupDomainTest extends AbstractControllerTestCase { /** @test */ public function setLocalhostAsForbidenUrlNomDomainShouldNotBeSet() { Class_Url::setForbidenUrls(['localhost']); - $this->dispatch('/'); + $this->dispatch('/', true); $this->assertEquals('', Class_AdminVar::get('NOM_DOMAINE')); } } - 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"]'); + } } @@ -654,7 +666,7 @@ class IndexControllerHeartBeatTest extends Admin_AbstractControllerTestCase { /** @test */ public function indexAsAdminShouldContainsClearCacheButton() { $this->dispatch('/opac/index/index', true); - $this->assertXPathContentContains('//script', '<button class="clear_cache"'); + $this->assertXPathContentContains('//a[contains(@href, "/admin/index/clearcache")]', 'Vider le cache'); } @@ -692,4 +704,169 @@ 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, + 'settings' => Class_User_Settings::serializeSettings(['show_admin_icons' => '1']), + 'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_BIB]); + + ZendAfi_Auth::getInstance()->logUser($joe); + $this->dispatch('/'); + } + + + /** @test */ + public function menuAdminFrontShouldBePresent() { + $this->assertXpathCount(1, '//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 linkToAdminHomeShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Accueil'); + } + + + /** @test */ + public function changeProfileSelectorShouldBeInMenu() { + $this->assertXPathCount(1, '//body/div[contains(@class, "menu_admin_front")]//form//select[@name="admin_menu_change_profile"]'); + } + + + /** @test */ + public function linkToShowAdminIconsShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Afficher les icones d\'administration'); + } + + + /** @test */ + public function scriptToShowAdminIconsShouldBePresent() { + $this->assertXPathContentContains('//script', 'activate_show_admin_icons()'); + } + + + /** @test */ + public function moveWidgetsShouldNotBePresent() { + $this->assertNotXPathContentContains('//body/div//ul/li/ul/li/a', 'Déplacement des boites'); + } +} + + + + +class IndexControllerWithAdminPortalLoggedTest 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, + 'settings' => Class_User_Settings::serializeSettings(['show_admin_icons' => '1']), + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]); + + ZendAfi_Auth::getInstance()->logUser($joe); + $this->dispatch('/'); + } + + + /** @test */ + public function linkToToggleWidgetMoveShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Déplacement des boites'); + } + + + /** @test */ + public function linkToOpenCSSShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Editeur CSS'); + } + + + /** @test */ + public function linkToEditProfileShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Configuration de la page courante'); + } + + + /** @test */ + public function linkToAskForSkinUpdateShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Synchronisation du CSS avec GIT'); + } + + + /** @test */ + public function scriptCssEditorShouldNotBePresent() { + $this->assertNotXPathContentContains('//script', 'activate_show_css_editor()'); + } +} + + + + +class IndexControllerWithSuperAdminLoggedTest 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, + 'settings' => Class_User_Settings::serializeSettings(['show_admin_icons' => '1', + 'amber_ide' => 1]), + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN]); + + ZendAfi_Auth::getInstance()->logUser($joe); + $this->dispatch('/', true); + } + + + /** @test */ + public function linkToOpenAmberIdeShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'Amber IDE'); + } + + + /** @test */ + public function linkToOpenZFDebugShouldBeInMenu() { + $this->assertXPathContentContains('//body/div//ul/li/ul/li/a', 'ZF Debug'); + } + + + /** @test */ + public function scriptToShowAmberIdeShouldBePresent() { + $this->assertXPathContentContains('//script', 'showAmberIDE()'); + } } \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index b37428ce1634664a4c6b1f1bfab4be8321b120df..bb890e28dca29a835f7f5fc316753574bb20ae5b 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -2307,7 +2307,7 @@ class ProfilOptionsControllerWithMenuVerticalWidgetAndNewHtmlTest extends Abstra ->setCfgMenus($cfg_menu) ->setCfgAccueil($cfg_accueil); - $this->dispatch('/opac'); + $this->dispatch('/opac', true); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php index 592faa5c96cdc9f1bd38e96bfa75350c0b418f7f..a8c69d0746da0dae16f5a25104118c42de312ebf 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php @@ -324,7 +324,7 @@ class ZendAfi_View_Helper_Accueil_KiosqueRequetesAsRedacteurTest extends ZendAfi /** @test **/ public function boiteKiosqueWithAdminLoggedShouldContainsLinkToChange() { - $this->assertXPath($this->_html, '//div[@class="boite kiosque"]//div[@class="change_kiosque_data"]/a[contains(@href,"admin/modules/kiosque-change-data")]'); + $this->assertXPath($this->_html, '//div[@class="boite kiosque"]//div[@class="change_kiosque_data configuration_module"]/a[contains(@href,"admin/modules/kiosque-change-data")]'); }