diff --git a/VERSIONS b/VERSIONS index babd1cc075fea675a059c1b5558dbe8ee178a528..a2f0a5301dd9d3f52d554ac45510f8149fa98708 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,13 @@ +- ticket #23805: possibilité de ne pas limiter le nombre de facettes affichés par rubrique + +10/07/2015 - v7.2.4 + + - ticket #23606 : amélioration de l'affichage dans la version mobile de Bokeh en évitant de tronquer les contenus. + + - ticket #27346 : correction de la génération des permissions + + + 08/07/2015 - v7.2.3 - ticket #27283 : correction d'une erreur dans l'intégration cosmogramme. diff --git a/VERSION_HOTLINE/23975 b/VERSION_HOTLINE/23975 deleted file mode 100644 index 87623c6ca4499198409a39dd4212b443e467deb8..0000000000000000000000000000000000000000 --- a/VERSION_HOTLINE/23975 +++ /dev/null @@ -1 +0,0 @@ - - ticket #23975 : correction de la prise en compte du paramètre 'nombre de mots' des boîtes de critiques. \ No newline at end of file diff --git a/application/modules/admin/views/scripts/index/adminvar.phtml b/application/modules/admin/views/scripts/index/adminvar.phtml index f902a7f982c565f3a5a6e301279931c013727594..af9ff145c07a2141c1469ec15d897b2c82fe0ab2 100644 --- a/application/modules/admin/views/scripts/index/adminvar.phtml +++ b/application/modules/admin/views/scripts/index/adminvar.phtml @@ -8,17 +8,7 @@ Class_ScriptLoader::getInstance() {'orderable': false, 'targets': 2} ] })") -->loadJQueryUI() -->addJQueryReady('$(document).tooltip({ -items: "[data-tooltip]", -content: function() { - var element = $(this); - var html = element.find("span").html(); - return (html.trim() != "") ? html : "Description non disponible"; -}, -position: { my: "left top+30", at: "left top"}, -hide: {duration: 1000} -})'); +->loadJQueryUI(); ?> <table id="adminvars"> @@ -34,12 +24,15 @@ hide: {duration: 1000} $ligne = 0; foreach($this->vars as $var) { $ligne ++ ; + $edit_url = $this->url(['controller' => 'index', + 'action' => 'adminvaredit', + 'cle' => $var->getClef()]); ?> - <tr class="<?php echo ($ligne & 1) ? "first" : "second";?>" data-tooltip=""> - <td style="vertical-align:top;" ><?php echo $var->getClef();?> - <span style="display:none;"> - <?php echo $var->getDescription();?> - </span> + <tr class="<?php echo ($ligne & 1) ? "first" : "second";?>"> + <td style="vertical-align:top;" > + <?php echo $var->getDescription();?> + <br><sub><a data-popup="true" href="<?php echo $edit_url; ?>"> + <?php echo $var->getClef();?></a></sub> </td> <td> <?php @@ -48,9 +41,7 @@ hide: {duration: 1000} ?> </td> <td style="width:2%;text-align:center"> - <a data-popup="true" href="<?php echo $this->url(['controller' => 'index', - 'action' => 'adminvaredit', - 'cle' => $var->getClef()])?>"><?php echo $this->boutonIco("type=edit");?></a> + <a data-popup="true" href="<?php echo $edit_url; ?>"><?php echo $this->boutonIco("type=edit");?></a> </td> </tr> <?php } ?> diff --git a/application/modules/telephone/views/scripts/abonne/fiche.phtml b/application/modules/telephone/views/scripts/abonne/fiche.phtml index edeb871e1d2402cf4f19c94d93fc062a8e92278a..02dda2517ce3715b8fa35a5489eb440f1223d25d 100644 --- a/application/modules/telephone/views/scripts/abonne/fiche.phtml +++ b/application/modules/telephone/views/scripts/abonne/fiche.phtml @@ -2,104 +2,102 @@ <?php echo $this->partial('abonne/identity.phtml', array('user' => $this->user));?> <?php if ($this->messages) { ?> - <div data-role="navbar" data-iconpos="left"> - <ul> - <?php foreach($this->messages as $message) { ?> - <li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($message);?></a></li> - <?php } ?> - </ul> - </div> +<div data-role="navbar" data-iconpos="left"> + <ul> + <?php foreach($this->messages as $message) { ?> + <li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($message);?></a></li> + <?php } ?> + </ul> +</div> <?php } ?> <?php -if ($this->user->isAbonne()) { - $date_fin = formatDate($this->user->getDateFin(), '1'); - $message = ($this->user->isAbonnementValid()) ? - "Votre abonnement est valide jusqu'au %s." : - "Votre abonnement est terminé depuis le %s."; + if ($this->user->isAbonne()) { +$date_fin = formatDate($this->user->getDateFin(), '1'); +$message = ($this->user->isAbonnementValid()) ? +"Votre abonnement est valide jusqu'au %s." : +"Votre abonnement est terminé depuis le %s."; ?> - <ul data-role="listview"> - <li data-role="list-divider"><?php echo $this->_('Abonnement');?></li> - <li><?php echo $this->_($message, $date_fin);?></li> - </ul> +<ul data-role="listview"> + <li data-role="list-divider"><?php echo $this->_('Abonnement');?></li> + <li><?php echo $this->_($message, $date_fin);?></li> +</ul> <?php } ?> <?php -$fiche_sigb = $this->user->getFicheSigb(); + $fiche_sigb = $this->user->getFicheSigb(); if (array_key_exists("erreur", $fiche_sigb)) { ?> - <div data-role="navbar" data-iconpos="left"> - <ul> - <li><a href="#" data-icon="alert" data-theme="a"><?php echo $this->escape($fiche_sigb["erreur"]);?></a></li> - </ul> - </div> +<div data-role="navbar" data-iconpos="left"> + <ul> + <li><a href="#" data-icon="alert" data-theme="a"><?php echo $this->escape($fiche_sigb["erreur"]);?></a></li> + </ul> +</div> <?php } ?> <?php if (array_key_exists("message", $fiche_sigb)) { ?> - <div data-role="navbar" data-iconpos="left"> - <ul> - <li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($fiche_sigb["message"]);?></a></li> - </ul> - </div> +<div data-role="navbar" data-iconpos="left"> + <ul> + <li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($fiche_sigb["message"]);?></a></li> + </ul> +</div> <?php } ?> <?php -$nb_retards = $this->user->getNbEmpruntsRetard(); + $nb_retards = $this->user->getNbEmpruntsRetard(); $nb_prets = $this->user->getNbEmprunts(); $nb_resas = $this->user->getNbReservations(); ?> <ul data-role="listview" data-split-icon="forward"> - <li data-role="list-divider"><?php echo $this->_('Prêts');?> - <span class="ui-li-count"><?php echo $nb_prets;?></span></li> - <?php if (0 < $nb_prets) { ?> - <?php foreach($this->user->getEmprunts() as $emprunt) { - $class_retard = $emprunt->enRetard() ? 'pret_en_retard"' : '';?> - <li data-icon="false"> - <a <?php echo $emprunt->enRetard() ? 'style="color:red;"' : '';?> - href="<?php echo $this->url(array('controller' => 'recherche', - 'action' => 'viewnotice', - 'id' => $emprunt->getNoticeOPACId()));?>"> - <h3><?php echo $emprunt->getTitre();?></h3> - <p><strong><?php echo $this->escape($emprunt->getAuteur());?></strong></p> - <p><strong><?php echo $this->escape($emprunt->getBibliotheque());?></strong></p> - <p><strong><?php echo $this->_('Retour prévu');?> <?php echo $emprunt->getDateRetour();?></strong></p> - </a> - <?php if ($emprunt->isRenewable()) { ?> - <a href="<?php echo $this->url(array('action' => 'prolongerpret', - 'id_pret' => $emprunt->getId()));?>" - data-theme="c"><?php echo $this->_('Prolonger');?></a> - <?php } ?> - </li> - <?php } ?> - <?php } else { ?> - <li><?php echo $this->_('Vous n\'avez aucun prêt en cours');?></li> - <?php } ?> + <li data-role="list-divider"><?php echo $this->_('Prêts');?> + <span class="ui-li-count"><?php echo $nb_prets;?></span></li> + <?php if (0 < $nb_prets) { ?> + <?php foreach($this->user->getEmprunts() as $emprunt) {?> + <li data-icon="false"<?php echo $emprunt->enRetard() ? ' class="pret_en_retard"' : '';?>> + <a href="<?php echo $this->url(array('controller' => 'recherche', + 'action' => 'viewnotice', + 'id' => $emprunt->getNoticeOPACId()));?>"> + <h3><?php echo $emprunt->getTitre();?></h3> + <p><strong><?php echo $this->escape($emprunt->getAuteur());?></strong></p> + <p><strong><?php echo $this->escape($emprunt->getBibliotheque());?></strong></p> + <p><strong><?php echo $this->_('Retour prévu');?> <?php echo $emprunt->getDateRetour();?></strong></p> + </a> + <?php if ($emprunt->isRenewable()) { ?> + <a href="<?php echo $this->url(array('action' => 'prolongerpret', + 'id_pret' => $emprunt->getId()));?>" + data-theme="c"><?php echo $this->_('Prolonger');?></a> + <?php } ?> + </li> + <?php } ?> + <?php } else { ?> + <li><?php echo $this->_('Vous n\'avez aucun prêt en cours');?></li> + <?php } ?> </ul> <ul data-role="listview" data-split-icon="delete"> - <li data-role="list-divider"><?php echo $this->_('Réservations');?> - <span class="ui-li-count"><?php echo $nb_resas;?></span></li> - <?php if (0 < $nb_resas) { ?> - <?php foreach($this->user->getReservations() as $reservation) { ?> - <li data-icon="false"> - <a href="<?php echo $this->url(array('controller' => 'recherche', - 'action' => 'viewnotice', - 'id' => $reservation->getNoticeOPACId()));?>"> - <h3><?php echo $reservation->getTitre();?></h3> - <p><strong><?php echo $this->escape($reservation->getAuteur());?></strong></p> - <p><strong><?php echo $this->escape($reservation->getBibliotheque());?></strong></p> - <p><?php echo $this->_('Etat') . ' : ' . $this->escape($reservation->getEtat());?>, - <?php echo $this->_('Rang') . ' : ' . $this->escape($reservation->getRang());?></p> - </a> - <a href="<?php echo $this->url(array('action' => 'cancel-hold', - 'id' => $reservation->getId()));?>" - data-rel="dialog" data-theme="c" data-position="notext"> - <?php echo $this->_('Supprimer cette réservation');?></a> - </li> - <?php } ?> - <?php } else { ?> - <li><?php echo $this->_('Vous n\'avez aucune réservation en cours');?></li> - <?php } ?> + <li data-role="list-divider"><?php echo $this->_('Réservations');?> + <span class="ui-li-count"><?php echo $nb_resas;?></span></li> + <?php if (0 < $nb_resas) { ?> + <?php foreach($this->user->getReservations() as $reservation) { ?> + <li data-icon="false"> + <a href="<?php echo $this->url(array('controller' => 'recherche', + 'action' => 'viewnotice', + 'id' => $reservation->getNoticeOPACId()));?>"> + <h3><?php echo $reservation->getTitre();?></h3> + <p><strong><?php echo $this->escape($reservation->getAuteur());?></strong></p> + <p><strong><?php echo $this->escape($reservation->getBibliotheque());?></strong></p> + <p><?php echo $this->_('Etat') . ' : ' . $this->escape($reservation->getEtat());?>, + <?php echo $this->_('Rang') . ' : ' . $this->escape($reservation->getRang());?></p> + </a> + <a href="<?php echo $this->url(array('action' => 'cancel-hold', + 'id' => $reservation->getId()));?>" + data-rel="dialog" data-theme="c" data-position="notext"> + <?php echo $this->_('Supprimer cette réservation');?></a> + </li> + <?php } ?> + <?php } else { ?> + <li><?php echo $this->_('Vous n\'avez aucune réservation en cours');?></li> + <?php } ?> </ul> diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index d9ce7dce764e5040f5ca9351370f3ef1a826c2ec..15b3b4cec766c63d85b246f18663819722df8f37 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -1,7 +1,7 @@ <?php error_reporting(E_ERROR | E_PARSE); -define("PATCH_LEVEL","262"); +define("PATCH_LEVEL","263"); define("APPLI","cosmogramme"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); diff --git a/cosmogramme/sql/patch/patch_263.php b/cosmogramme/sql/patch/patch_263.php new file mode 100644 index 0000000000000000000000000000000000000000..a61ffb9b144ff2a9a69d3ec9eee82951fcb8f836 --- /dev/null +++ b/cosmogramme/sql/patch/patch_263.php @@ -0,0 +1,23 @@ +<?php +/* add default permissions to permission table because patch 242 didn't make the job */ + +$adapter = Zend_Registry::get('sql'); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'CATEGORY' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('CATEGORY', 'ARTICLE', 'Droits', 1, 'Créer des sous-catégories et des articles')"); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'ARTICLE' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('ARTICLE', 'ARTICLE', 'Droits', 2, 'Créer des articles');"); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'PENDING' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('PENDING', 'ARTICLE', 'Nouveaux statuts autorisés', 1, 'À valider');"); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'VALIDATED' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('VALIDATED', 'ARTICLE', 'Nouveaux statuts autorisés', 101, 'Validé');"); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'REFUSED' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('REFUSED', 'ARTICLE', 'Nouveaux statuts autorisés', 102, 'Refusé');"); + +if(!$adapter->query("SELECT * FROM `permission` WHERE code = 'ARCHIVED' LIMIT 1;")) + $adapter->query("insert into `permission` (code, module, type, sorting, description) VALUES ('ARCHIVED', 'ARTICLE', 'Nouveaux statuts autorisés', 103, 'Archivé');"); +?> \ No newline at end of file diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php index 0de57c47932bdc8b660c38108a027026df31cc99..deabef39f31dab7f7b7829a6e5999b962fed8396 100644 --- a/library/Class/AdminVar.php +++ b/library/Class/AdminVar.php @@ -151,6 +151,7 @@ class Class_AdminVarLoader extends Storm_Model_Loader { 'FACETTE_INTERET_LIBELLE' => Class_AdminVar_Meta::newDefault('Libellé de la facette centres d\'intérêt'), 'FACETTE_MATIERE_LIBELLE' => Class_AdminVar_Meta::newDefault('Libellé de la facette matière'), 'FACETTE_TAG_LIBELLE' => Class_AdminVar_Meta::newDefault('Libellé de la facette tag'), + 'UNLEASHED_FACETS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des codes des facettes qui ne sont pas limitées à l\'affichage dans le résultat de recherche<br/>Exemple : T => Type de doc, Y => Annexe, B => Bibliothèque, ... (Voir <a href="http://git.afi-sa.fr/afi/opacce/blob/master/library/Class/Codification.php#L24">la liste complète</a>)')), 'AFFICHER_DISPONIBILITE_SUR_RECHERCHE' => Class_AdminVar_Meta::newOnOff($this->_('Activation de la disponibilite dans le resultat de recherche.')), 'NOM_DOMAINE' => Class_AdminVar_Meta::newDefault($this->_('Nom de domaine principal de l\'OPAC, ex: monopac.macommune.fr')), 'DATE_LAST_FULL_INTEGRATION_USERS' => Class_AdminVar_Meta::newDefault($this->_('Date du dernier import total des abonnés (modifié par cosmogramme)')), diff --git a/library/Class/AdminVar/UnleashedFacets.php b/library/Class/AdminVar/UnleashedFacets.php new file mode 100644 index 0000000000000000000000000000000000000000..289b424f8fb662738bc00e959edbbcde72ea0e51 --- /dev/null +++ b/library/Class/AdminVar/UnleashedFacets.php @@ -0,0 +1,29 @@ +<?php +/** + * Copyright (c) 2012-2014, 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_AdminVar_UnleashedFacets { + public function isUnleashed($code) { + return in_array($code, + explode(';', Class_AdminVar::get('UNLEASHED_FACETS'))); + } +} +?> \ No newline at end of file diff --git a/library/Class/MoteurRecherche/Facettes.php b/library/Class/MoteurRecherche/Facettes.php index e37b022ae0eb26adab71d824a4cb06a059acb787..0f78491692d5db426acf83ba9604832eba444c35 100644 --- a/library/Class/MoteurRecherche/Facettes.php +++ b/library/Class/MoteurRecherche/Facettes.php @@ -104,19 +104,23 @@ class Class_MoteurRecherche_Facettes { $table = ['facettes' => []]; foreach ($rubriques as $rubrique) { - $code_rubrique = $rubrique->getCode(); - if (!array_isset($code_rubrique, $facettes)) {continue;} - - $table["facettes"][$code_rubrique]["titre"] = $rubrique->getLibelle(); - - $nb=0; - foreach($this->_facettes_par_code_rubrique[$code_rubrique] as $facette) { - $nb++; - if($nb > $nb_facettes) break; - - $table["facettes"][$code_rubrique][$nb]["id"] = $cle=$facette->getCle(); - $table["facettes"][$code_rubrique][$nb]["libelle"]= $facette->getLibelleFacette(); - $table["facettes"][$code_rubrique][$nb]["nombre"]= $this->_nb_facettes_par_cle[$cle]; + $rubric_code = $rubrique->getCode(); + if (!array_isset($rubric_code, $facettes)) + continue; + + $rubric_facets = array_values(array_slice($this->_facettes_par_code_rubrique[$rubric_code], + 0, + (new Class_AdminVar_UnleashedFacets)->isUnleashed($rubric_code) + ? count($this->_facettes_par_code_rubrique[$rubric_code]) + : $nb_facettes)); + + $table["facettes"][$rubric_code]["titre"] = $rubrique->getLibelle(); + + foreach($rubric_facets as $k => $facette) { + $nb = $k+1; + $table["facettes"][$rubric_code][$nb]["id"] = $cle=$facette->getCle(); + $table["facettes"][$rubric_code][$nb]["libelle"]= $facette->getLibelleFacette(); + $table["facettes"][$rubric_code][$nb]["nombre"]= $this->_nb_facettes_par_cle[$cle]; } } diff --git a/library/ZendAfi/View/Helper/Admin/HelpLink.php b/library/ZendAfi/View/Helper/Admin/HelpLink.php index c620bd64b7de816dae91310cb4d5922cb5b3a3f8..7e03cb071638e58eedecfd2a008a906cd88c6a78 100644 --- a/library/ZendAfi/View/Helper/Admin/HelpLink.php +++ b/library/ZendAfi/View/Helper/Admin/HelpLink.php @@ -105,8 +105,6 @@ class ZendAfi_View_Helper_Admin_HelpLinkArdans 'index' => ['index' => 4037, 'changelog' => 4488], - 'modules' => ['recherche_resultat' => 3643], - 'bib' => ['index' => 3928]]; } @@ -131,7 +129,8 @@ class ZendAfi_View_Helper_Admin_HelpLinkBokehWiki 'formation' => ['index' => 'Gestion_des_formations' ], 'harvest' => ['jamendo-browse' => 'Jamendo'], 'modo' => ['index' => 'Modération'], - 'modules' => ['recherche_viewnotice' => 'Affichage_d%27une_notice'], + 'modules' => ['recherche_viewnotice' => 'Affichage_d%27une_notice', + 'recherche_resultat' => 'Paramétrer_une_liste_de_résultat'], 'newsletter' => ['index' => 'Lettre_d%27information'], 'profil' => ['index' => 'Configurer_un_profil', 'edit' => 'Configurer_un_profil', diff --git a/library/ZendAfi/View/Helper/Facettes.php b/library/ZendAfi/View/Helper/Facettes.php index b546f6a2ebc1383fdcdd65104817017d821d00c8..6e46eb327af353073e1625d4241a9cdb6aa218a4 100644 --- a/library/ZendAfi/View/Helper/Facettes.php +++ b/library/ZendAfi/View/Helper/Facettes.php @@ -21,14 +21,15 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { protected - $_criteres_recherche, - $_current_facettes, + $_criteres, + $_current, $_preferences; - function facettes($facettes, $preferences, $criteres_recherche) { - if(!$facettes) return; + public function facettes($facets, $preferences, $criteres) { + if (!$facets) + return; - $this->_criteres_recherche = $criteres_recherche; + $this->_criteres = $criteres; $this->_preferences = $preferences; Class_ScriptLoader::getInstance() @@ -39,82 +40,114 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { .'anchor.parent().remove();' .'})'); - $url = array_merge($criteres_recherche->getUrlRetourListe(), + $url = array_merge($criteres->getUrlRetourListe(), ['controller' => 'recherche', 'action' => 'simple', 'page' => null]); - return - '<div class="facette">' - . $this->listeFacettesHTML("T" . $this->_preferences['facettes_codes'], - $facettes, - $url) - . '</div>'; + return $this + ->_tag('div', + $this->listeFacettesHTML('T' . $this->_preferences['facettes_codes'], + $facets, + $url), + ['class' => 'facette']); } - public function listeFacettesHTML($facettes_codes,$facettes,$url) { - $html='<ul>'; - foreach($facettes as $type => $valeurs){ - if($facettes_codes and strpos($facettes_codes,$type) === false) continue; + public function listeFacettesHTML($codes, $facets, $url) { + $html = ''; + foreach($facets as $type => $values) { + if ($codes and false === strpos($codes, $type)) + continue; - $html.='<li class="facette_titre"><b>'.$valeurs["titre"].'</b>'; - $html.=$this->listeFacettesElementHTML($type, array_splice($valeurs, 1), $url); - $html.='</li>'; + $html .= $this + ->_tag('li', + $this->_tag('b', $values['titre']) + . $this->listeFacettesElementHTML($type, array_splice($values, 1), $url), + ['class' => 'facette_titre']); } - return $html.='</ul>'; + + return $this->_tag('ul', $html); } - public function listeFacettesElementHTML($type,$valeurs,$url){ - $facettes_nombre = $this->_preferences['facettes_nombre']; - $first_facets = array_splice($valeurs, 0, $facettes_nombre); - $following_facets = array_splice($valeurs, 0, $facettes_nombre); + public function listeFacettesElementHTML($type, $values, $url) { + $count = (new Class_AdminVar_UnleashedFacets())->isUnleashed($type) + ? count($values) + : $this->_preferences['facettes_nombre']; - $html = '<ul style="list-style-image:url('.URL_IMG.'puce_facette.gif)">'; - foreach($first_facets as $facette) - $html .= $this->renderLIFacette($url, $facette); + $first_facets = array_splice($values, 0, $count); + $following_facets = array_splice($values, 0, $count); - if ($following_facets) { - $html .= '<li class="msg"><a href="#">'.$this->view->_('Afficher plus de facettes...').'</a><ul id="'.$type.'_msg" style="display:none">'; + $html = ''; + foreach($first_facets as $facet) + $html .= $this->renderLIFacette($url, $facet); - foreach($following_facets as $facette) - $html .= $this->renderLIFacette($url, $facette); + if ($following_facets) + $html .= $this->_renderFollowingFacets($type, $following_facets, $url); - $html .= '</ul></li>'; - } + return $this->_tag('ul', $html, + ['style' => 'list-style-image:url(' . URL_IMG . 'puce_facette.gif)']); + } + + + protected function _renderFollowingFacets($type, $facets, $url) { + $html = ''; + foreach($facets as $facet) + $html .= $this->renderLIFacette($url, $facet); + + return $this + ->_tag('li', + $this->_tag('a', $this->_('Afficher plus de facettes...'), + ['href' => '#']) + . $this->_tag('ul', $html, + ['id' => $type . '_msg', + 'style' => 'display:none']), + ['class' => 'msg']); + } - $html.='</ul>'; - return $html; + + public function renderLIFacette($url, $facet) { + $url['facette'] = $facet['id']; + return $this->renderLi($url, $facet); + } + + + protected function renderLi($url, $facet) { + return $this + ->_tag('li', + $this->renderLabel($url, $facet) + . $this->renderCount($facet) + . $this->renderRemove($facet), + ['class' => 'facette' . ($this->isActive($facet['id']) ? 'selected' : '')]); } - public function renderLIFacette($url, $facette) { - $url['facette'] = $facette['id']; - return $this->renderLi($url, $facette); + protected function renderLabel($url, $facet) { + return $this->view->tagAnchor($this->view->url($url, null, true), + $facet['libelle'], + ['class' => 'facette']); } - protected function renderLi($url, $facette) { - return - '<li class="facette'. - $this->isFacetteActive($facette['id']).'">'. - $this->view->tagAnchor($this->view->url($url, null, true), - $facette["libelle"], - ['class' => 'facette']). - '<span>('.$facette["nombre"].')</span>'. - $this->view->tagAnchor($this->view->url($this->_criteres_recherche->getUrlRemoveFacette(new Class_Notice_Facette($facette['id'])),null,true), - $this->view->_('Retirer ').$facette["libelle"], - ['class' => 'remove_facette', - 'style' => 'display:none']). - '</li>'; + protected function renderCount($facet) { + return $this->_tag('span', '(' . $facet['nombre'] . ')'); } + protected function renderRemove($facet) { + $remove_url = $this->view->url($this->_criteres->getUrlRemoveFacette(new Class_Notice_Facette($facet['id'])), + null, true); + + return $this->view->tagAnchor($remove_url, + $this->_('Retirer ') . $facet['libelle'], + ['class' => 'remove_facette', + 'style' => 'display:none']); + } + - protected function isFacetteActive($facette_id) { - $this->_current_facettes = $this->_criteres_recherche->getFacettes(); - return in_array($facette_id,$this->_current_facettes) ? ' selected' : ''; + protected function isActive($id) { + return in_array($id, $this->_criteres->getFacettes()); } } \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index 763933f8090280462056b001e9f9666f9b5ede35..c99b61265168e53081e2ab815c4dce4c8f39cfde 100644 --- a/library/startup.php +++ b/library/startup.php @@ -64,7 +64,7 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.2'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.3'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.4'); defineConstant('ROOT_PATH', realpath(dirname(__FILE__).'/..').'/'); diff --git a/public/admin/css/global.css b/public/admin/css/global.css index 169005624ac3c559b3bbc1419241587842f2797f..6c276f4f7512c5f62057067e6ddb62ab94c7dead 100644 --- a/public/admin/css/global.css +++ b/public/admin/css/global.css @@ -320,7 +320,7 @@ div#permalink { .first, .second {color:#575757;} -.first {background-color:rgba(125,125,125,0.1);} +.first, table.dataTable tbody tr.even {background-color:rgba(125,125,125,0.1);} .main .barre_nav{height:39px; background: transparent url(../images/box/menu/titre_menu.jpg) repeat-x; overflow: hidden;} diff --git a/public/opac/mobile/css/global.css b/public/opac/mobile/css/global.css index 310e5bf5ec305e35f93d46b87c75efe07d0b1b44..f4324894f433454e69280efcc308b2dcbd733d9e 100644 --- a/public/opac/mobile/css/global.css +++ b/public/opac/mobile/css/global.css @@ -44,6 +44,10 @@ body.main } +body * { + white-space: normal !important; /* important is needed to overload JQUERY theme */ +} + /* tags de base */ table, td {padding:0px; margin:0px} @@ -341,6 +345,11 @@ div.bk-widget div.b-counter { } +li.pret_en_retard a { + color: red; +} + + @media only screen and (max-width : 320px) { .boite_accueil { width: 50%; diff --git a/scripts/generate-permissions.php b/scripts/generate-permissions.php index 2ce490e409b357ce5e31dd54693f82b4c7df7ab9..999bc3d80fd8911fd17d6dad6a2510c7e2fa233e 100644 --- a/scripts/generate-permissions.php +++ b/scripts/generate-permissions.php @@ -1,55 +1,72 @@ <?php - require 'console.php'; -echo BASE_URL."\n"; +echo BASE_URL . "\n"; -if (Class_UserGroup_Permission::countBy([])>0) { - echo "Permissions detected, stop script\n"; +if(!Class_Permission::findAll()) { + echo "No permission in DB, stop script\n"; exit; } -$group_category = Class_UserGroupCategorie::newInstance(['libelle' => 'Droits d\'accès aux articles']); - -$group_category->save(); +if (Class_UserGroup_Permission::countBy([])>0) { + echo "Usergroup permissions detected, stop script\n"; + exit; +} +if(!$group_category = Class_UserGroupCategorie::findFirstBy(['libelle' => 'Droits d\'accès aux articles'])) { + $group_category = Class_UserGroupCategorie::newInstance(['libelle' => 'Droits d\'accès aux articles']); + $group_category->save(); +} $all_cms_permissions = Class_Permission::getCmsPermissions(); $redac_permissions = Class_Permission::findAllBy(['module' => 'ARTICLE', 'code' => ['ARTICLE' , 'PENDING', 'CATEGORY' ]]); -function addGroupFor($library, $level, $label, $categ,$permissions) { +$redac_portail = addGroupFor(Class_Bib::getPortail(), ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL, 'Rédacteurs Portail' ,$group_category,$redac_permissions); + +$admin_portail = addGroupFor(Class_Bib::getPortail(), ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL, 'Administrateurs Portail ' ,$group_category,$all_cms_permissions); + +foreach(Class_Bib::findAll() as $library) { + addGroupFor($library, + ZendAfi_Acl_AdminControllerRoles::MODO_BIB, + 'Rédacteurs ' . $library->getLibelle(), + $group_category, + $redac_permissions); + + addGroupFor($library, + ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB, + 'Administrateurs ' . $library->getLibelle(), + $group_category, + $all_cms_permissions); + + allow($redac_permissions, + $redac_portail, + $library); + + allow($all_cms_permissions, + $admin_portail, + $library); +} - $group = Class_UserGroup::newInstance(['libelle' => $label, - 'group_type' => Class_UserGroup::TYPE_DYNAMIC, - 'role_level' => $level, - 'library' => $library, - 'categorie' => $categ]); + +function addGroupFor($library, $level, $label, $categ,$permissions) { + if(!$group = Class_UserGroup::findFirstBy(['libelle' => $label, + 'id_cat' => $categ->getId()])) + $group = Class_UserGroup::newInstance(['libelle' => $label, + 'group_type' => Class_UserGroup::TYPE_DYNAMIC, + 'role_level' => $level, + 'library' => $library, + 'categorie' => $categ]); $group->addRight(Class_UserGroup::RIGHT_USER_ACCES_ARTICLES) ->addRight(Class_UserGroup::RIGHT_USER_PUBLICATION_DIRECTE) ->addRight(Class_UserGroup::RIGHT_USER_FILE_ACCESS) ->save(); + allow($permissions,$group,$library); return $group; } - function allow($permissions,$group,$library) { foreach($permissions as $permission) $permission->permitTo($group, $library); } - - -$redac_portail=addGroupFor(Class_Bib::getPortail(), ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL, 'Rédacteurs Portail' ,$group_category,$redac_permissions); - -$admin_portail=addGroupFor(Class_Bib::getPortail(), ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL, 'Administrateurs Portail ' ,$group_category,$all_cms_permissions); - - -foreach(Class_Bib::findAll() as $library) { - addGroupFor($library, ZendAfi_Acl_AdminControllerRoles::MODO_BIB, 'Rédacteurs ' . $library->getLibelle(),$group_category,$redac_permissions); - addGroupFor($library, ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB, 'Administrateurs ' . $library->getLibelle(),$group_category,$all_cms_permissions); - - allow($redac_permissions,$redac_portail, $library); - allow($all_cms_permissions,$admin_portail, $library); - -} diff --git a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php index 5448e87a659e8aae070815c84cc0434b25b410b9..c0ed2e76e7edea3c712ae6e264f663e81bc07b7e 100644 --- a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php +++ b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php @@ -149,14 +149,15 @@ class AdminIndexControllerAdminVarActionTest extends Admin_AbstractControllerTes /** @test */ public function bibnumShouldDisplayDelImageAndDisabledLabel() { - $base_xpath = '//table[@id="adminvars"]//td[contains(text(), "BIBNUM")]/../td[2]'; + $base_xpath = '//table[@id="adminvars"]//a[contains(text(), "BIBNUM")]/ancestor::tr[1]/td[2]'; $this->assertXPath($base_xpath . '/img[contains(@src, "del.gif")]'); $this->assertXPathContentContains($base_xpath, 'Désactivé'); } + /** @test */ public function cacheActifShouldDisplayCocheVerteImageAndEnabledLabel() { - $base_xpath = '//table[@id="adminvars"]//td[contains(text(), "CACHE_ACTIF")]/../td[2]'; + $base_xpath = '//table[@id="adminvars"]//a[contains(text(), "CACHE_ACTIF")]/ancestor::tr[1]/td[2]'; $this->assertXPathContentContains($base_xpath, 'Activé'); $this->assertXPath($base_xpath . '/img[contains(@src, "coche_verte.gif")]'); } diff --git a/tests/application/modules/telephone/controllers/AbonneControllerTest.php b/tests/application/modules/telephone/controllers/AbonneControllerTest.php index 2ce78cd7388b7d470d5b9aae1fe88b68bd0ca5e6..b03c288f7a109a52ee015470e96249e7a8b5913d 100644 --- a/tests/application/modules/telephone/controllers/AbonneControllerTest.php +++ b/tests/application/modules/telephone/controllers/AbonneControllerTest.php @@ -43,8 +43,19 @@ abstract class AbonneControllerTelephoneTestCase extends TelephoneAbstractContro ->setDateRetour('24/45/6789') ->setNoticeOPAC(Class_Notice::getLoader()->newInstanceWithId(46)); + $poire = Class_WebService_SIGB_Emprunt::newInstanceWithEmptyExemplaire() + ->setId(128) + ->setTitre('Poire du jardin') + ->setAuteur('Elisabeth') + ->setBibliotheque('Cran-Gevrier') + ->setDateRetour('30/01/12') + ->setNoticeOPAC(Class_Notice::getLoader()->newInstanceWithId(47)); + + $emprunteur = Class_WebService_SIGB_Emprunteur::newInstance() - ->empruntsAddAll(array($potter, $alice)) + ->empruntsAddAll([$potter, + $alice, + $poire]) ->reservationsAddAll(array(Class_WebService_SIGB_Reservation::newInstanceWithEmptyExemplaire() ->setTitre('Star Wars') @@ -90,9 +101,15 @@ class AbonneControllerTelephoneFicheTest extends AbonneControllerTelephoneTestCa } + /** @test */ + public function loanShouldBeFlaggedAsLate() { + $this->assertXPath('//li[@class="pret_en_retard"]/a'); + } + + /** @test */ public function pageShouldDisplayLoanCount() { - $this->assertXPathContentContains('//span[@class="ui-li-count"]', '2', + $this->assertXPathContentContains('//span[@class="ui-li-count"]', '3', $this->_response->getBody()); } diff --git a/tests/library/Class/MoteurRecherche/MoteurRechercheFacettesTest.php b/tests/library/Class/MoteurRecherche/MoteurRechercheFacettesTest.php index b0a41ecf88ebe092dd9c97a0aba2a88ecbdbeb4c..298fdadb4f60aa5bdc7b55400ca5a0ec4cb4428d 100644 --- a/tests/library/Class/MoteurRecherche/MoteurRechercheFacettesTest.php +++ b/tests/library/Class/MoteurRecherche/MoteurRechercheFacettesTest.php @@ -19,11 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class MoteurRechercheFacettesTest extends Storm_Test_ModelTestCase { - protected $_requete; +class MoteurRechercheFacettesTest extends ModelTestCase { + protected + $_requete, + $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); + $this->fixture('Class_CodifLangue', + ['id' => 'fre', + 'libelle' => 'français']); + Class_CosmoVar::newInstanceWithId('types_docs', ['liste' => '0:non identifié\r\n1:livres\r\n2:périodiques']); @@ -165,7 +172,7 @@ class MoteurRechercheFacettesTest extends Storm_Test_ModelTestCase { /** @test */ - public function numberOfFacettesAutorShouldBeFivePlusFive() { + public function numberOfFacettesAuthorShouldBeFivePlusFive() { // title + facets + show more facets $this->assertEquals(1 + 5 + 5, count($this->facettes['facettes']['A'])); } @@ -210,6 +217,22 @@ class MoteurRechercheFacettesTest extends Storm_Test_ModelTestCase { 'facettes_actif' => 1 ])); } + + + /** @test */ + public function whenAuthorsUnleashedNumberOfFacetsShouldBe813() { + Class_AdminVar::set('UNLEASHED_FACETS', 'A'); + $this->facettes = $this->moteur_recherche->getFacettes($this->_requete, + ['facettes_nombre' => 5, + 'tags_actif' => 1, + 'tags_codes'=> 'MDPZAHTES1', + 'tags_nombre' => 30, + 'facettes_codes'=>'MFSABZLYHTHEMHTES1V', + 'facettes_actif' => 1 + ]); + $this->assertEquals(1 + 813, count($this->facettes['facettes']['A'])); + + } } diff --git a/tests/library/ZendAfi/View/Helper/Admin/AdminHelpLinkTest.php b/tests/library/ZendAfi/View/Helper/Admin/AdminHelpLinkTest.php index a6572690933655cdcf4240e1a6494256e5e1d290..e2de64ae9cf4eb7ee28facff31fda307f7feccff 100644 --- a/tests/library/ZendAfi/View/Helper/Admin/AdminHelpLinkTest.php +++ b/tests/library/ZendAfi/View/Helper/Admin/AdminHelpLinkTest.php @@ -140,6 +140,6 @@ class AdminHelpLinkHelperTest extends ViewHelperTestCase { /** @test */ public function helpForModuleRechercheResultatSouldReturnFiche3643() { $this->setControllerAction('modules', 'recherche'); - $this->assertHelpLink(3643, 'recherche_resultat'); + $this->assertWikiLink('Paramétrer_une_liste_de_résultat', 'recherche_resultat'); } } \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/FacettesTest.php b/tests/library/ZendAfi/View/Helper/FacettesTest.php index a25239c6fb73386b50ce3ba01dd23927be3cd2fc..e2269d352c03f5debf60562a1395cba23b92822d 100644 --- a/tests/library/ZendAfi/View/Helper/FacettesTest.php +++ b/tests/library/ZendAfi/View/Helper/FacettesTest.php @@ -19,57 +19,77 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_View_Helper_FacettesTest extends ViewHelperTestCase { - protected $_html; +abstract class ZendAfi_View_Helper_FacettesTestCase extends ViewHelperTestCase { + protected + $_html, + $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); + $this->_helper = new ZendAfi_View_Helper_Facettes(); $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); - $this->_html = $this->_helper->facettes(['M' => [ 'titre' => 'Matière', - 1 => ['id' => 'M6567', - 'libelle' => 'Pommes : albums', - 'nombre' => 22]], - 'HGENR' => [ 'titre' => 'Genre', - 1 => ['id' => 'HGENR0001', - 'libelle' => 'Electron libre', - 'nombre' => 1]], - 'Y' => [ 'titre' => 'Annexe', - 1 => ['id' => 'YMDE', - 'libelle' => 'Maison environnement', - 'nombre' => 1]], - 'A' => ['titre' => 'Author', - 1 => ['id' => 'A4656', - 'libelle' => 'Caradog Prichard', - 'nombre' => 58], - 2 => ['id' => 'A4657', - 'libelle' => 'Louis-Jean Calvet', - 'nombre' => 40], - 3 => ['id' => 'A6752', - 'libelle' => 'Maurice Henry', - 'nombre' => 21], - 4 => ['id' => 'A63246', - 'libelle' => 'François Chattot', - 'nombre' => 12], - 5 => ['id' => 'A12309', - 'libelle' => 'Olivier Richard', - 'nombre' => 10], - 6 => ['id' => 'A446', - 'libelle' => 'Clare Brown', - 'nombre' => 7], - 7 => ['id' => 'A800', - 'libelle' => 'Karine Delobbe', - 'nombre' => 7], - 8 => ['id' => 'A12168', - 'libelle' => 'Mehdi Lallaoui', - 'nombre' => 6], - 9 => ['id' => 'A9875', - 'libelle' => 'Régine Azria', - 'nombre' => 5] ]], - - ['facettes_codes' => 'YMHGENRA', - 'facettes_nombre' => 2], - new Class_CriteresRecherche(['expressionRecherche' => '*'])); + $this->_prepareFixtures(); + + $this->_html = $this->_helper + ->facettes(['M' => [ 'titre' => 'Matière', + 1 => ['id' => 'M6567', + 'libelle' => 'Pommes : albums', + 'nombre' => 22]], + 'HGENR' => [ 'titre' => 'Genre', + 1 => ['id' => 'HGENR0001', + 'libelle' => 'Electron libre', + 'nombre' => 1]], + 'Y' => [ 'titre' => 'Annexe', + 1 => ['id' => 'YMDE', + 'libelle' => 'Maison environnement', + 'nombre' => 1]], + 'A' => ['titre' => 'Author', + 1 => ['id' => 'A4656', + 'libelle' => 'Caradog Prichard', + 'nombre' => 58], + 2 => ['id' => 'A4657', + 'libelle' => 'Louis-Jean Calvet', + 'nombre' => 40], + 3 => ['id' => 'A6752', + 'libelle' => 'Maurice Henry', + 'nombre' => 21], + 4 => ['id' => 'A63246', + 'libelle' => 'François Chattot', + 'nombre' => 12], + 5 => ['id' => 'A12309', + 'libelle' => 'Olivier Richard', + 'nombre' => 10], + 6 => ['id' => 'A446', + 'libelle' => 'Clare Brown', + 'nombre' => 7], + 7 => ['id' => 'A800', + 'libelle' => 'Karine Delobbe', + 'nombre' => 7], + 8 => ['id' => 'A12168', + 'libelle' => 'Mehdi Lallaoui', + 'nombre' => 6], + 9 => ['id' => 'A9875', + 'libelle' => 'Régine Azria', + 'nombre' => 5]]], + + ['facettes_codes' => 'YMHGENRA', + 'facettes_nombre' => 2], + + new Class_CriteresRecherche(['expressionRecherche' => '*'])); + } + + + protected function _prepareFixtures() { + } +} + + + +class ZendAfi_View_Helper_FacettesRestrainedTest extends ZendAfi_View_Helper_FacettesTestCase { + + protected function _prepareFixtures() { + $this->fixture('Class_AdminVar', ['id' => 'UNLEASHED_FACETS', 'valeur' => '']); } @@ -120,14 +140,27 @@ class ZendAfi_View_Helper_FacettesTest extends ViewHelperTestCase { } -/** @test */ + /** @test */ public function linkForFacetElectroLibreShouldBePresent() { $this->assertXPathContentContains($this->_html, '//a[@class="facette"][contains(@href, "/recherche/simple/facette/HGENR0001")]', 'Electron libre'); } +} -} -?> \ No newline at end of file +class ZendAfi_View_Helper_FacettesUnleashedTest + extends ZendAfi_View_Helper_FacettesTestCase { + + protected function _prepareFixtures() { + Class_AdminVar::set('UNLEASHED_FACETS', 'A'); + } + + + /** @test */ + public function linkForFacetOlivierRichardShouldNotBePresent() { + $this->assertXPath($this->_html, + '//a[@class="facette"][contains(@href, "/recherche/simple/facette/A12309")]'); + } +} \ No newline at end of file