diff --git a/FEATURES/65075 b/FEATURES/65075 new file mode 100644 index 0000000000000000000000000000000000000000..2445c7d341f8edf98534d7e8c9c73bec73db402f --- /dev/null +++ b/FEATURES/65075 @@ -0,0 +1,10 @@ + '65075' => + ['Label' => $this->_('Nouvelles fonctionnalités dans Bokeh'), + 'Desc' => '', + 'Image' => '', + 'Video' => '', + 'Category' => '', + 'Right' => function($feature_description, $user) {return true;}, + 'Wiki' => '', + 'Test' => '', + 'Date' => '2017-09-22'], \ No newline at end of file diff --git a/VERSIONS_WIP/65075 b/VERSIONS_WIP/65075 new file mode 100644 index 0000000000000000000000000000000000000000..1060b16d8269ce0a2b1c31af7e7bc9e7e347c747 --- /dev/null +++ b/VERSIONS_WIP/65075 @@ -0,0 +1,2 @@ + - ticket #65075 : Administration : ajout du suivi personnel des nouvelles fonctionnalités dans Bokeh. + \ No newline at end of file diff --git a/application/modules/admin/controllers/FeatureController.php b/application/modules/admin/controllers/FeatureController.php new file mode 100644 index 0000000000000000000000000000000000000000..d6521065e8265d2a44963dacee86758f33b8c851 --- /dev/null +++ b/application/modules/admin/controllers/FeatureController.php @@ -0,0 +1,74 @@ +<?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 Admin_FeatureController extends ZendAfi_Controller_Action { + public function indexAction() { + $this->view->titre = $this->_('Les fonctionnalités du logiciel Bokeh'); + $user = Class_Users::getIdentity(); + $this->view->new_features = (new Class_Feature)->findNewFor($user); + $this->view->checked_features = (new Class_Feature)->findCheckedBy($user); + } + + + public function hideAction() { + $feature_id = $this->_getParam('id'); + + if(!$feature = (new Class_Feature)->find($feature_id)) { + $this->_helper->notify($this->_('Nouveauté inconnue')); + return $this->_redirectToIndex(); + } + + if(!(new Class_User_Settings(Class_Users::getIdentity())) + ->addCheckedFeature($feature_id) + ->save()) { + $this->_helper->notify($this->_('Problème de sauvegarde. La fonctionnalité "%s" est toujours une nouveauté pour vous', + $feature->getLabel())); + return $this->_redirectToIndex(); + } + + $this->_helper->notify($this->_('"%s" n\'est plus une nouveauté pour vous.', + $feature->getLabel())); + $this->_redirectToIndex(); + } + + + public function showAction() { + $feature_id = $this->_getParam('id'); + + if(!$feature = (new Class_Feature)->find($feature_id)) { + $this->_helper->notify($this->_('Nouveauté inconnue')); + return $this->_redirectToIndex(); + } + + if(!(new Class_User_Settings(Class_Users::getIdentity())) + ->removeCheckedFeature($feature_id) + ->save()) { + $this->_helper->notify($this->_('Problème de sauvegarde. La fonctionnalité "%s" n\'est toujours pas une nouveauté pour vous', + $feature->getLabel())); + return $this->_redirectToIndex(); + } + + $this->_helper->notify($this->_('"%s" est une nouveauté pour vous.', + $feature->getLabel())); + $this->_redirectToIndex(); + } +} \ No newline at end of file diff --git a/application/modules/admin/views/scripts/feature/index.phtml b/application/modules/admin/views/scripts/feature/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..748a54af926fd7dc56a8a536d31d5380969d8e90 --- /dev/null +++ b/application/modules/admin/views/scripts/feature/index.phtml @@ -0,0 +1,87 @@ +<?php +$description = (new Class_TableDescription('features')) + ->addColumn($this->_('Libellé'), function($feature) + { + return $feature->getLabel(); + }) + + ->addColumn($this->_('Description'), function($feature) + { + return $feature->getDesc(); + }) + + ->addColumn($this->_('Date de nouveauté'), function($feature) + { + return Class_Date::humanDate($feature->getDate(), 'dd MMMM yyyy'); + }) + + ->addColumn($this->_('Categorie'), function($feature) + { + return $feature->getCategory(); + }) + + ->addRowAction(function($feature) + { + return $this->tagAnchor($feature->getWiki(), + $this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'help')), + ['target' => '_blank', + 'title' => $this->_('Documentation')]); + }) + + ->addRowAction(function($feature) + { + if(!$feature->getTest()) + return ''; + return $this->tagPreview(Class_Url::relative($feature->getTest()), + $this->_('Essayer')); + }) + + ->addRowAction(function($feature) + { + $hide = $this->tagAnchor(['module' => 'admin', + 'controller' => 'feature', + 'action' => 'hide', + 'id' => $feature->getId()], + $this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'hide')), + ['title' => $this->_('Archiver')]); + + $show = $this->tagAnchor(['module' => 'admin', + 'controller' => 'feature', + 'action' => 'show', + 'id' => $feature->getId()], + $this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'show')), + ['title' => $this->_('Marquer comme nouveauté')]); + + return $feature->isNewFor(Class_Users::getIdentity()) + ? $hide + : $show; + }) + ; + +$html = + $this->tag('h2', $this->_('Nouveautés : %d' , count($this->new_features))) + . $this->tag('div', $this->renderTable($description, + $this->new_features, + ['sorter' => true])); + +$description->setId('checked-features'); + +$html .= + $this->tag('h2', $this->_('Archivées : %d', count($this->checked_features))) + . $this->tag('div',$this->renderTable($description, + $this->checked_features, + ['sorter' => true])); + +echo $this->tag('div', $html, ['id' => 'features_list']); + +$script_loader = Class_ScriptLoader::getInstance() + ->addSearchInputToContent($this->_('Chercher')) + ->addJQueryReady('$(\'#features_list\').accordion({heightStyle: \'content\'});'); + +(new Class_Admin_Skin)->renderJQueryCssOn($script_loader); \ No newline at end of file diff --git a/library/Class/Feature.php b/library/Class/Feature.php new file mode 100644 index 0000000000000000000000000000000000000000..bfadd212c88d0033ada0884c40721428401bedf4 --- /dev/null +++ b/library/Class/Feature.php @@ -0,0 +1,116 @@ +<?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 Class_Feature { + + use + Trait_Translator, + Trait_StaticFileSystem; + + protected static $_features; + + + public function hasNew() { + return 0 < $this->countNew(); + } + + + public function countNew() { + return count($this->findAll()); + } + + + public function findAll() { + return $this->_getFeatures(); + } + + + public function findCheckedBy($user) { + return (new Class_User_Settings($user))->getCheckedFeatures(); + } + + + public function findNewFor($user) { + return array_udiff($this->findAll(), + $this->findCheckedBy($user), + function($a, $b) + { + $first = $a->getId(); + $second = $b->getId(); + + if($first == $second) + return 0; + + return $first < $second + ? -1 + : 1; + }); + } + + + public function hasNewFor($user) { + return !empty($this->findNewFor($user)); + } + + + public function countNewFor($user) { + return count($this->findNewFor($user)); + } + + + public function findAllBy($ids) { + if(!$ids) + return []; + + return array_values(array_map([$this, 'find'], $ids)); + } + + + public function find($id) { + $user = Class_Users::getIdentity(); + $feature = (new Storm_Collection($this->findAll())) + ->select(function($model) use ($id, $user) + { + return $id == $model->getId() && $model->isAvailableFor($user); + }); + + if($feature->isEmpty()) + return null; + + return $feature->first(); + } + + + protected function _getFeatures() { + if(static::$_features) + return static::$_features; + + $features = (new Class_Feature_List)->getFeatures(); + return static::$_features = array_map([$this, '_createInstances'], array_keys($features), $features); + } + + + protected function _createInstances($id, $feature) { + return (new Class_Feature_Description) + ->setId($id) + ->updateAttributes($feature); + } +} diff --git a/library/Class/Feature/Description.php b/library/Class/Feature/Description.php new file mode 100644 index 0000000000000000000000000000000000000000..ed608369f39103c43f2665db2bfa44b07d0b7d85 --- /dev/null +++ b/library/Class/Feature/Description.php @@ -0,0 +1,38 @@ +<?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 Class_Feature_Description extends Class_Entity { + public function isNewFor($user) { + return !in_array($this, (new Class_Feature)->findCheckedBy($user)); + } + + + public function isAvailableFor($user) { + if(!$user) + return false; + + if(!$this->getRight()) + return true; + + return call_user_func_array($this->getRight(), [$this, $user]); + } +} \ No newline at end of file diff --git a/library/Class/Feature/List.php b/library/Class/Feature/List.php new file mode 100644 index 0000000000000000000000000000000000000000..941f987f4bc5cdce33fcbbd3e0087108da570b62 --- /dev/null +++ b/library/Class/Feature/List.php @@ -0,0 +1,55 @@ +<?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 Class_Feature_List { + use Trait_Translator; + + public function getFeatures() { + return [ + + '65075' => + ['Label' => $this->_('Nouvelles fonctionnalités'), + 'Desc' => $this->_('Bienvenue dans votre votre liste des nouvelles fonctionnalités'), + 'Image' => '', + 'Video' => '', + 'Category' => $this->_('Administration'), + 'Right' => function($feature_description, $user) {return true;}, + 'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Nouvelles_fonctionnalit%C3%A9s', + 'Test' => '', + 'Date' => '2017-09-22'], + + '61314' => + ['Label' => $this->_('Explorateur de fichiers'), + 'Desc' => $this->_('Gérer les fichiers dont vous avez besoin pour enrichir vos contenus'), + 'Image' => '', + 'Video' => '', + 'Category' => $this->_('Administration'), + 'Right' => function($feature, $user) { + return $user->canAccessBackend(); + }, + 'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Explorateur_de_fichiers', + 'Test' => '/admin/file-manager/full_screen/1/display_mode_browser/wall?browser=userfiles/image', + 'Date' => '2017-09-22'], + + ]; + } +} \ No newline at end of file diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index e1c1c57c05f607a5ca01bd65add06dc7515b9a00..a84ce07447cb828ba3e1e7f5bbf3dbc8178c3808 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -813,7 +813,7 @@ class Class_ScriptLoader { return $this->_addSearchInput('.main > .modules', 'input_content_menu', $label, - 'table, thead, th , .form, .form *, center, center *, br, .bouton, a *, a, img, h1, h3, h3 + div , .error, h3 + div *, .soustitre, .soustitre *, tr *, #progressbar, #progressbar *, button'); + 'table, thead, th ,table th,table thead *, .form, .form *, center, center *, br, .bouton, a *, a, img, h1, h3, h3 + div , .error, h3 + div *, h2, h2 + *, div > h2, .soustitre, .soustitre *, tr *, #progressbar, #progressbar *, button'); } diff --git a/library/Class/TableDescription.php b/library/Class/TableDescription.php index 9ac6c5a296deae8ce89aa3d07e523b0135048a5e..50b69f6e39e46d90e6bd1abb3d653067f096a3bc 100644 --- a/library/Class/TableDescription.php +++ b/library/Class/TableDescription.php @@ -41,6 +41,12 @@ class Class_TableDescription { } + public function setId($id) { + $this->_id = $id; + return $this; + } + + public function columnsCollect($callback) { return $this->_columns->collect($callback); } diff --git a/library/Class/User/Settings.php b/library/Class/User/Settings.php index 747a2ed287a722650d434a42d1d73ec4a42c359c..908c4ff318363ef4e0b8342d85d47a7cb8a51504 100644 --- a/library/Class/User/Settings.php +++ b/library/Class/User/Settings.php @@ -25,7 +25,8 @@ class Class_User_Settings { BOOKMARKED_LIBRARIES = 'library_ids', REDMINE_LIBRARY = 'redmine_library', ADMIN_SKIN = 'admin_skin', - ADMIN_SKIN_COLOR = 'admin_skin_color'; + ADMIN_SKIN_COLOR = 'admin_skin_color', + CHECKED_FEATURE = 'checked_features'; protected $_user, $_user_settings; @@ -183,6 +184,37 @@ class Class_User_Settings { } + public function getCheckedFeatures() { + if(!$ids = $this->get(static::CHECKED_FEATURE)) + return []; + + $ids = $this->_getStormIds($ids); + + return (new Class_Feature)->findAllBy($ids); + } + + + public function addCheckedFeature($id) { + $checked_features = $this->_getCheckedFeatures($id); + $this->set(static::CHECKED_FEATURE, implode('-', $checked_features)); + return $this->_user; + } + + + public function removeCheckedFeature($id) { + $checked_features = array_diff($this->_getCheckedFeatures($id), [$id]); + $this->set(static::CHECKED_FEATURE, implode('-', $checked_features)); + return $this->_user; + } + + + protected function _getCheckedFeatures($id) { + $checked_features = explode('-', $this->get(static::CHECKED_FEATURE)); + return array_values(array_unique(array_merge($checked_features, + [$id]))); + } + + public function addLibraryToBookmarks($id) { if (!static::isBookmarkLibraryReady()) return $this->_user; diff --git a/library/Trait/StaticFileSystem.php b/library/Trait/StaticFileSystem.php index a411140cd776c4a3383c8a18c3f2be4e2632e5b5..759e5795be6926460ff457cd321ca8cbc7c90b0b 100644 --- a/library/Trait/StaticFileSystem.php +++ b/library/Trait/StaticFileSystem.php @@ -16,7 +16,7 @@ * * 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 */ @@ -33,5 +33,4 @@ trait Trait_StaticFileSystem { return self::$_file_system; return new Class_Testing_FileSystem(); } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/Nav.php b/library/ZendAfi/View/Helper/Admin/Nav.php index f64b46023351be345ef2d4f72726e13b80456f8c..be38700b50c0645221608267650066f9bacb7d5d 100644 --- a/library/ZendAfi/View/Helper/Admin/Nav.php +++ b/library/ZendAfi/View/Helper/Admin/Nav.php @@ -25,6 +25,7 @@ class ZendAfi_View_Helper_Admin_Nav extends ZendAfi_View_Helper_BaseHelper { public function Admin_Nav() { $this->_current_skin = Class_Admin_Skin::current(); + $identity = Class_Users::getIdentity(); $redmine = Class_AdminVar::isRedmineEnabled() ? ['icon' => 'redmine', @@ -35,7 +36,8 @@ class ZendAfi_View_Helper_Admin_Nav extends ZendAfi_View_Helper_BaseHelper { 'action' => 'index'], null, true)] : []; - $identity = Class_Users::getIdentity(); + $feature = new Class_Feature; + $menus = [ ['icon' => 'home', 'label' => $this->_('Accueil'), @@ -56,6 +58,13 @@ class ZendAfi_View_Helper_Admin_Nav extends ZendAfi_View_Helper_BaseHelper { $redmine, + ['icon' => '', + 'label' => $this->_('Fonctionnalités'), + 'count' => $feature->countNewFor($identity), + 'url' => $this->view->url(['module' => 'admin', + 'controller' => 'feature', + 'action' => 'index'], null, true)], + ['icon' => 'logout', 'label' => $this->translate()->_('Se déconnecter'), 'url' => $this->view->url(['module' => 'admin', diff --git a/library/ZendAfi/View/Helper/RenderTable.php b/library/ZendAfi/View/Helper/RenderTable.php index a877c0febab2df59063e691d370af9ca8de51cc6..e5693da8dea3649bf9197ea1b37f2823035374fa 100644 --- a/library/ZendAfi/View/Helper/RenderTable.php +++ b/library/ZendAfi/View/Helper/RenderTable.php @@ -27,6 +27,9 @@ class ZendAfi_View_Helper_RenderTable extends ZendAfi_View_Helper_BaseHelper { * @param options Array */ public function renderTable($description, $grouped_models, $options = []) { + if(!$grouped_models) + return ''; + $grouped_models = (is_array($grouped_models) || is_a($grouped_models, 'ArrayObject')) ? new Class_TableDescription_Models($grouped_models) : $grouped_models; diff --git a/public/admin/css/front_nav.css b/public/admin/css/front_nav.css index ed4ae78ac438ed741465b234e4269a381e2ab055..c5143b5c4ac2850e855fdc601e8b83a5d660ab99 100644 --- a/public/admin/css/front_nav.css +++ b/public/admin/css/front_nav.css @@ -1,3 +1,7 @@ +.menu_admin_front a, +.menu_admin_front a:visited { + text-decoration: none; +} .menu_admin_front * { box-sizing: content-box; diff --git a/public/admin/skins/bokeh74/jquery.css b/public/admin/skins/bokeh74/jquery.css index 8225cfd2499f3e73a07bffd2121aa3932ca5c3d1..8f300d7762b2e7d0ea5ae7148c7e463d4f851792 100644 --- a/public/admin/skins/bokeh74/jquery.css +++ b/public/admin/skins/bokeh74/jquery.css @@ -161,3 +161,30 @@ body .ui-progressbar .ui-progressbar-value { body .ui-progressbar { height: 1em; } + +body .ui-accordion .ui-accordion-header { + padding: 1ex 1em 1ex 2em; + margin: 0.5ex 0; +} + +body .ui-accordion .ui-accordion-header a { + color: inherit; + background: none; +} + +body .ui-accordion .ui-accordion-header { + color: var(--button); + background-color: var(--button-background); +} + +body .ui-accordion .ui-accordion-header:hover, +body .ui-accordion .ui-accordion-header.ui-state-active { + color: var(--button-highlight); + background-color: var(--button-background-highlight); +} + +body .ui-accordion .ui-accordion-content { + padding: 1ex 1em; + margin: 0; + background-color: var(--main-background); +} diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 1c0db0c547c9386e16aa1eb55ebff604370b3a06..f2707a75dce5370dfab494f39fa6e734b650e72d 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -427,20 +427,15 @@ a.link_rss { /* Boîte deux colonnes */ -div.conteneur2colonnes { - width: 100%; -} - -div.conteneur2colonnes>div { +div.conteneur2colonnes > div { + display: inline-block; + margin: 0; + padding: 0; + vertical-align: top; width: 50%; overflow: hidden; } - -div.conteneur2colonnes>div:first-child { - float: left; -} - div.conteneur2colonnes>div>div { margin:5px; } @@ -2068,7 +2063,7 @@ div.suggestion-achat-liste dl{ margin-top:5px; } -.vignette_lien_reserver a { +#site_web_wrapper .vignette_lien_reserver a { display: block; background: url(../../admin/images/picto/clock_16.png) no-repeat center center; min-height: 16px; diff --git a/public/opac/java/search_input/search_input.js b/public/opac/java/search_input/search_input.js index d359045af535a78e88c446871073fb7e3f889c55..3bec72fb4c23d680e64a883127417d9505ed5ea6 100644 --- a/public/opac/java/search_input/search_input.js +++ b/public/opac/java/search_input/search_input.js @@ -22,7 +22,7 @@ $.fn.search_input = function(options) { if ($('head').find('link[href*="search_input.css"]').length < 1) { $('head').append('<link media="screen" href="' - + baseUrl + '/public/opac/java/search_input/search_input.css" rel="stylesheet" type="text/css"></link>'); + + baseUrl + '/public/opac/java/search_input/search_input.css" rel="stylesheet" type="text/css"></link>'); } var default_option_id = 'default_search_input_id'; @@ -31,8 +31,8 @@ if(undefined == options) options = {id : default_input_id, - label : default_input_label, - fixed_display : ''}; + label : default_input_label, + fixed_display : ''}; if(undefined == options.id) options.id = default_input_id; @@ -52,11 +52,11 @@ var onSearchInputChange = function(searchText) { var resetAll = function() { - html.find('*').removeClass(not_found_class); + html.find('*').removeClass(not_found_class); } if (searchText == "" || searchText == '*') { - return resetAll(); + return resetAll(); } var accentsTidy = function(s){ @@ -75,9 +75,9 @@ }; var highlightItems = function(elements) { - resetAll(); - html.find('*').not(elements).not(default_fixed_display + options.fixed_display).addClass(not_found_class); - html.find(elements).parentsUntil(html).removeClass(not_found_class); + resetAll(); + html.find('*').not(elements).not(default_fixed_display + options.fixed_display).addClass(not_found_class); + html.find(elements).parentsUntil(html).removeClass(not_found_class).show(); } searchText = accentsTidy(searchText); @@ -87,19 +87,19 @@ var reg_exps = []; $.each(searchText, function(index, term) { - var reg = new RegExp('\\b' + term, 'gi'); - reg_exps.push(reg); + var reg = new RegExp('\\b' + term, 'gi'); + reg_exps.push(reg); }); var matches = html.find('*').contents().filter(function() { - if(this.nodeType != 3) - return false; + if(this.nodeType != 3) + return false; - for(var index in reg_exps) + for(var index in reg_exps) if(!reg_exps[index].test(accentsTidy(this.nodeValue))) - return false; + return false; - return true; + return true; }); highlightItems(matches); @@ -107,15 +107,15 @@ var search_input = html.prepend("<div class='search_input'>" + - "<form>" + - "<label for='" + options.id + "'>" + options.label + "</label>" + - "<input type='text' name='search_input' id='" + options.id +"'></input>" + - "</form>" + - "</div>") - .find('input') - .keyup(function(event){ - onSearchInputChange($(this).val()); - }) - .end(); + "<form>" + + "<label for='" + options.id + "'>" + options.label + "</label>" + + "<input type='text' name='search_input' id='" + options.id +"'></input>" + + "</form>" + + "</div>") + .find('input') + .keyup(function(event){ + onSearchInputChange($(this).val()); + }) + .end(); } } (jQuery)); diff --git a/public/opac/js/widget_templates/widget_templates.css b/public/opac/js/widget_templates/widget_templates.css index d25a8741850f9306d59c13c4d628c4520118881f..ed2b344bbe3bac1604846a9f56cab4b59d95558a 100644 --- a/public/opac/js/widget_templates/widget_templates.css +++ b/public/opac/js/widget_templates/widget_templates.css @@ -1,22 +1,3 @@ -.widget_templates.ui-accordion .ui-accordion-header { - padding: 1em 2em; - margin-bottom: 2px; - font-weight: bold; -} - -.widget_templates.ui-accordion .ui-accordion-header, -.widget_templates a h4 { - color: var(--button); - background-color: var(--button-background); -} - -.widget_templates.ui-accordion .ui-accordion-header:hover, -.widget_templates.ui-accordion .ui-accordion-header.ui-state-active, -.widget_templates a:hover h4 { - color: var(--button-highlight); - background-color: var(--button-background-highlight); -} - .widget_templates a { display: inline-block; transition: all .2s ease-in-out; @@ -26,12 +7,10 @@ margin: 0.5%; } - .widget_templates a { width: 32%; } - .widget_templates a img { width: 100%; } @@ -43,9 +22,16 @@ padding: 1em; border-radius: 5px 5px 0 0; white-space: nowrap; + color: var(--button); + background-color: var(--button-background); } .widget_templates a:hover { box-shadow: 0px 0px 15px var(--widget-shadow); transform: scale(1.02); } + +.widget_templates a:hover h4 { + color: var(--button-highlight); + background-color: var(--button-background-highlight); +} diff --git a/tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php b/tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php index e60beae32a62411c2aeb3c68863fdcb46b6b71b3..f30bfe8617bfc4b218b409ad68b3b7c803672296 100644 --- a/tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php +++ b/tests/application/modules/admin/controllers/AdminAbstractControllerTestCase.php @@ -16,7 +16,7 @@ * * 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 */ require_once 'AbstractControllerTestCase.php'; diff --git a/tests/application/modules/admin/controllers/FeatureControllerTest.php b/tests/application/modules/admin/controllers/FeatureControllerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9696510297d009448eaf4d507685278156fbc474 --- /dev/null +++ b/tests/application/modules/admin/controllers/FeatureControllerTest.php @@ -0,0 +1,147 @@ +<?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 FeatureControllerIndexDispatchTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/feature/index', true); + } + + + /** @test */ + public function fileManagerShouldBeANewFeature() { + $this->assertXPathContentContains('//table[@id="features"]//td', 'Explorateur de fichier'); + } + + + /** @test */ + public function fileManagerCategoryShouldBeAdministration() { + $this->assertXPathContentContains('//table[@id="features"]//td', 'Administration'); + } + + + /** @test */ + public function tryFileManagerLinkShouldBePresent() { + $this->assertXPath('//td//a[contains(@href, "/admin/file-manager/")]'); + } + + + /** @test */ + public function fileManagerWikiLinkShouldBePresent() { + $this->assertXPath('//td//a[contains(@href, "/wiki")]'); + } + + + /** @test */ + public function fileManagerHideShouldBePresent() { + $this->assertXPath('//td//a[contains(@href, "/admin/feature/hide/id/61314")]'); + } +} + + + + +class FeatureControllerHideDispatchTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + ZendAfi_Auth::getInstance() + ->logUser($this->fixture('Class_Users', + ['id' => 6, + 'login' => 'sysadm', + 'password' => 123, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN])); + + $this->dispatch('/admin/feature/hide/id/61314', true); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function shouldNotifyFeatureHidden() { + $this->assertFlashMessengerContentContains('n\'est plus une nouveauté pour vous'); + } + + + /** @test */ + public function userCheckedFeatureShouldContains61314() { + $this->assertEquals(61314, (new Class_Feature)->findCheckedBy(Class_Users::getIdentity())[0]->getId()); + } +} + + + + + +class FeatureControllerShowDispatchTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + ZendAfi_Auth::getInstance() + ->logUser($this->fixture('Class_Users', + ['id' => 6, + 'login' => 'sysadm', + 'password' => 123, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN])); + + (new Class_User_Settings(Class_Users::getIdentity())) + ->addCheckedFeature(61314) + ->save(); + + $this->dispatch('/admin/feature/show/id/61314', true); + } + + + /** @test */ + public function shouldRedirect() { + $this->assertRedirect(); + } + + + /** @test */ + public function shouldNotifyFeatureIsNew() { + $this->assertFlashMessengerContentContains('est une nouveauté pour vous'); + } + + + /** @test */ + public function userCheckedFeatureShouldNotContains61314() { + $this->assertEmpty((new Class_Feature)->findCheckedBy(Class_Users::getIdentity())); + } + + + /** @test */ + public function featureShouldAppearAsNewForUser() { + $this->assertNotNull((new Class_Feature)->findNewFor(Class_Users::getIdentity())[0]->getId()); + } +} \ No newline at end of file