diff --git a/VERSIONS b/VERSIONS index aff51a1633586de219da04a72af50fc52b069281..1cf7b265f2aca2ee46162fdfd63c856776383676 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,64 @@ +22/05/2015 - v7.1.33 + + - ticket #24826 : Ajout d'une hauteur minimale dans le contenu des boîtes pour qu'on puisse toujours accéder à la molette de configuration. + + - ticket #25250 : Suppression des containtes SQL 'not null' sur les champs de la table notices_articles + + - ticket #25054 : Correction du filtrage du calendrier lorsque la date n'était pas sélectionnée. + + + +19/05/2015 v7.1.32 + + - dev#15606: Nanook: possibilité de définir le site de l'abonné comme site de retrait par défaut pour les réservations. + La préférence Cosmogramme 'site_retrait_resa' permet désormais ce comportement, positionnée sur 'site de l'abonné'. + + - ticket #24993 : Amélioration du paramétrage de la boîte de navigation par domaine. Seulement un domaine est sélectionnable. Les domaines sélectionnables sont ceux qui on des sous-domaines. + + - ticket #23837 : Augmentation de la taille de tous les VARCHAR de la table exemplaires + + - ticket #18547 : possibilité de définir le site de l'abonné comme site de retrait par défaut pour les réservations Pergame. + + - ticket #22532 : les ressources numériques pouvaient ne pas s'afficher après sauvegarde d'un album + + - ticket #24656 : l'export CSV des formulaires n'est plus dépendant du système de fichiers, ce qui corrige l'impossibilité d'exporter si il existe un fichier "formulaires.csv" avec les mauvais droits d'accès + + - ticket #22632 : corrige l'intégration des articles de périodiques pour Nanook lorsque le numéro de tome est supérieur à 10 caractères + + - ticket #24816 : La position des boîtes est gardée après réattribution d'un identifiant. + + + +12/05/2015 - v7.1.31 + + - ticket #24903 : les urls de génération des vignettes utilisent le format ZF, ce qui corrige un problème de chargement selon l'infrastructure d'installation + + +12/05/2015 v7.0.18 + + - ticket #24569 : Cosmogramme: correction de la sélection du format de fichier de profil de données sur certaines installations + - ticket #24206 : Correction de l'impossibilité d'ajouter de nouvelles boîtes (si utilisation de boîtes dans la bannière). + - ticket #18668 : Evolution du rendu des biographies en provenance de l'API de wikipedia. + +11/05/2015 - v7.1.30 + + - ticket #23802 : Ajout d'un mode de visualisation par arborescence paginée dans la boite sitothèque + - ticket #24664 : correction de l'accès aux articles en tant qu'administrateur bibliothèque dans le mode "liste" + + + +04/05/2015 - v7.1.29 + +- ticket #23459 : lorsqu'on modifie un article en mode liste, le bouton retour ramène à la catégorie de l'article modifié +- ticket #23734 : correction du parcours des réponses web services suite à mise à jour du SIGB Orphée +- ticket #24503 : fixe les thesaurus dont le titre contient des caractères autre que [a-zA-Z0-9] +- ticket #23721 : correction de l'indexation en temps réel des pseudos notices d'articles, sitothèques et paniers +- ticket #23756 : correction des liens de différents bouttons qui posaient problèmes pour les Bokeh installé en mode racine. +- tickets #24489 et #24486 : correction des patchs SQL 233 et 235 qui posaient problèmes lors d'une migration d'une base stable vers master. +- ticket #24497 : correction d'une erreur d'indexation des domaines (Cosmogramme) + + + 27/04/2015 - v7.1.28 - ticket #18297: Mise en conformité RGAA de la liste des résultats de recherche et de la vue notice @@ -9,7 +70,6 @@ 23/04/2015 - v7.1.27 - - ticket #23391 : Correction d'une régression dans le mode de dédoublonnage par identifiant. - ticket #19079 : Correction de la modification des vignettes pour les périodiques. - hotline#22305 : Respect des sauts de ligne dans les avis notice des bibliothécaires. diff --git a/VERSIONS_WIP/dev15606_patron_pickup_library b/VERSIONS_WIP/dev15606_patron_pickup_library deleted file mode 100644 index 05b2ec958e9631eff47eed9aac3eb82dec15d383..0000000000000000000000000000000000000000 --- a/VERSIONS_WIP/dev15606_patron_pickup_library +++ /dev/null @@ -1,2 +0,0 @@ - - dev#15606: Nanook: possibilité de définir le site de l'abonné comme site de retrait par défaut pour les réservations. - La préférence Cosmogramme 'site_retrait_resa' permet désormais ce comportement, positionnée sur 'site de l'abonné'. diff --git a/application/modules/admin/controllers/AccueilController.php b/application/modules/admin/controllers/AccueilController.php index 547bb2c5d789635d43d4bb9fa4fe4b7999f690d2..b4b8830e12b0598918ccab9a06b6f54488ee4fac 100644 --- a/application/modules/admin/controllers/AccueilController.php +++ b/application/modules/admin/controllers/AccueilController.php @@ -104,7 +104,17 @@ class Admin_AccueilController extends Zend_Controller_Action { } + public function preprocessSitoCategories() { + if ((int)$this->_getParam('type_aff',0)!=3) + return; + + if ($categories=explode('-',$this->_getParam('id_categorie'))) + $this->_request->setPost('id_categorie',$categories[0]); + + } public function sitothequeAction() { + $this->preprocessSitoCategories(); + $this->_request->setPost('group_by_categorie','0'); $this->_simpleAction('SITO'); } diff --git a/application/modules/admin/controllers/CatalogueController.php b/application/modules/admin/controllers/CatalogueController.php index 3fbde65595e7f7dac41eef16faa7e954a3878a99..d4b6e8327d7708d48ae2b0bdfe60d3b918f3085e 100644 --- a/application/modules/admin/controllers/CatalogueController.php +++ b/application/modules/admin/controllers/CatalogueController.php @@ -174,6 +174,18 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action { } + public function browsableDomainsAction() { + $this->_helper->viewRenderer->setNoRender(); + $data = []; + $data[] = (new Class_Catalogue())->getBrowsableDomainsJson(); + $JSON = json_encode($data); + + $this->getResponse()->setHeader('Content-Type', 'application/json; charset=utf-8'); + $this->getResponse()->setBody($JSON); + } + + + public function deleteAction() { if (($catalogue = Class_Catalogue::find((int)$this->_getParam('id_catalogue'))) && $catalogue->canBeDeletedOrModifyByUser($this->_user)) { diff --git a/application/modules/admin/controllers/CmsController.php b/application/modules/admin/controllers/CmsController.php index bc29712ad96bd854c0cf3aaece6f7255469f4619..d54f185fcd6da7ac3a15779a265287f1bc25bee1 100644 --- a/application/modules/admin/controllers/CmsController.php +++ b/application/modules/admin/controllers/CmsController.php @@ -67,10 +67,13 @@ class Admin_CmsController extends ZendAfi_Controller_Action { $bibs = $this->_getBibs(); $ids = array_map(function($model) {return $model->getId();}, $bibs); $search = $this->_getParam('title_search', ''); - $id_bib = $this->_getParam('id_bib', ''); + $id_bib = $this->_getParam('id_bib', + $this->identity->isRoleLibraryLimited() + ? $this->_bib->getId() + : null); $id_cat = $this->_getParam('id_cat', 0); - $params = ($id_bib && in_array($id_bib, $ids)) || $id_cat || ($id_bib == '0') || (!$id_bib && !$id_cat && $this->identity->isRoleLibraryLimited()) || ($search) + $params = ($id_bib && in_array($id_bib, $ids)) || $id_cat || ($id_bib == '0') || ($search) ? ['model' => Class_ArticleCategorie::find($id_cat), 'strategy_label' => 'article'] : ['model' => null, @@ -580,9 +583,13 @@ class Admin_CmsController extends ZendAfi_Controller_Action { protected function _getEditUrl($model) { - return parent::_getEditUrl($model) + $this->getRequest()->setParamSources(['_GET']); + $url = parent::_getEditUrl($model) . (($page = $this->_getParam('page')) ? '/page/'.$page : '') + . (($id_cat = $this->_getParam('id_cat')) ? '/id_cat/'.$id_cat : '') . (($title_search = $this->_getParam('title_search')) ? '/title_search/' . $title_search : ''); + $this->getRequest()->setParamSources(['_GET', '_POST']); + return $url; } } diff --git a/application/modules/admin/views/scripts/accueil/sitotheque.phtml b/application/modules/admin/views/scripts/accueil/sitotheque.phtml index 6f3e6e4b36ce42286b67e6be95d80d2b42fa3771..d4a711ec1d21e3728fffd7cba0a6f41dca7bd29b 100644 --- a/application/modules/admin/views/scripts/accueil/sitotheque.phtml +++ b/application/modules/admin/views/scripts/accueil/sitotheque.phtml @@ -1,102 +1,111 @@ -<center> -<h1>Propriétés du module sitothèque</h1><br> -<div class="formTable"> - <form method="post" action="<?php echo $this->url ?>"> - - <fieldset> - <legend>Affichage</legend> - <table cellspacing="2"> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - </table> - </fieldset> - <br> - - <fieldset> - <legend>Généralités</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Titre </td> - <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - </table> - </fieldset> - <br> - - <fieldset> - <legend>Sites à afficher</legend> - <table cellspacing="2" width="100%"> - <tr> - <td class="droite" width="90px">Type </td> - <td class="gauche"> - <?php - $onchange="$('.treeselect').treeselect('toggleVisibility', (this.value == '1'));"; - echo $this->formSelect("type_aff", - $this->preferences["type_aff"], - array("onchange" => $onchange), - array("1" => "Une sélection de catégories ou de sites", - "2" => "Les sites les plus récents")) - ?> - </td> - </tr> - </table> - - <div id="table_selection"> - <?php - echo $this->treeSelect( - $this->preferences["id_items"], - $this->preferences["id_categorie"], - ($this->preferences["type_aff"] == "1"), - BASE_URL.'/admin/bib/allitems?id_bib='.$this->id_bib.'&type=sito', - "form"); - ?> - </div> - - <table cellspacing="2" width="100%"> - - - <tr id='option_display_order'> - <td class="droite" width="90px">Ordre d'affichage </td> - <td class="gauche"> - <?php - echo $this->formRadio("display_order", - $this->preferences["display_order"], - [], - ['Random' => $this->_('Par ordre aléatoire'), - 'Selection' => $this->_('Par ordre de sélection')]); - ?> - </td> - </tr> - - - <tr id='option_nb_aff'> - <td class="droite" width="90px">Nbre à afficher </td> - <td class="gauche"><input type="text" name="nb_aff" size="3" maxlength="3" value="<?php print($this->preferences["nb_aff"]); ?>"></td> - </tr> - - <tr> - <td class="droite" width="90px">Grouper par catégorie </td> - <td class="gauche"> - <?php - echo $this->formCheckbox('group_by_categorie', - null, - array('checked' => $this->preferences["group_by_categorie"])); - ?> - </td> - </tr> - </table> - - </fieldset> - <br /> - - <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> - </form> - - <script type="text/javascript"> - formSelectToggleVisibilityForElement("input[name=display_order]", "#option_nb_aff", "Random"); - </script> - </div> +<?php +Class_ScriptLoader::getInstance() +->addJQueryReady(' +function toggleDisplayTypeDependents() { + var dependents = $(".group_cat, #option_display_order, #option_nb_aff"); + ("3" == $("#type_aff").val()) ? dependents.hide() : dependents.show(); +} + +$("#type_aff").change(function () { + toggleDisplayTypeDependents(); + var value = $("#type_aff").val(); + $(".treeselect").treeselect("toggleVisibility", (value == "1" || value == "3")); +}); + +toggleDisplayTypeDependents(); +formSelectToggleVisibilityForElement("input[name=display_order]", "#option_nb_aff", "Random"); +'); +?> +<center> + <h1>Propriétés du module sitothèque</h1><br> + <div class="formTable"> + <form method="post" action="<?php echo $this->url; ?>"> + + <fieldset> + <legend>Affichage</legend> + <table cellspacing="2"> + <tr> + <td class="droite">Style de boite </td> + <td class="gauche"><?php echo $this->combo_templates; ?></td> + </tr> + </table> + </fieldset> + <br> + + <fieldset> + <legend>Généralités</legend> + <table cellspacing="2"> + <tr> + <td class="droite">Titre </td> + <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences['titre']); ?>"></td> + </tr> + </table> + </fieldset> + <br> + + <fieldset> + <legend>Sites à afficher</legend> + <table cellspacing="2" width="100%"> + <tr> + <td class="droite" width="90px">Type </td> + <td class="gauche"> + <?php + echo $this->formSelect('type_aff', + $this->preferences['type_aff'], + [], + ['1' => 'Une sélection de catégories ou de sites', + '2' => 'Les sites les plus récents', + '3' => 'Affichage hiérarchique par catégorie']) + ?> + </td> + </tr> + </table> + + <div id="table_selection"> + <?php + echo $this->treeSelect($this->preferences['id_items'], + $this->preferences['id_categorie'], + ($this->preferences['type_aff'] != '2'), + BASE_URL . '/admin/bib/allitems?id_bib=' . $this->id_bib . '&type=sito', + "form"); + ?> + </div> + + <table cellspacing="2" width="100%"> + <tr id='option_display_order'> + <td class="droite" width="90px">Ordre d'affichage </td> + <td class="gauche"> + <?php + echo $this->formRadio('display_order', + $this->preferences['display_order'], + [], + ['Random' => $this->_('Par ordre aléatoire'), + 'Selection' => $this->_('Par ordre de sélection')]); + ?> + </td> + </tr> + + <tr id='option_nb_aff'> + <td class="droite" width="90px">Nbre à afficher </td> + <td class="gauche"><input type="text" name="nb_aff" size="3" maxlength="3" value="<?php print($this->preferences['nb_aff']); ?>"></td> + </tr> + + <tr class="group_cat"> + <td class="droite" width="90px">Grouper par catégorie </td> + <td class="gauche"> + <?php + echo $this->formCheckbox('group_by_categorie', + null, + ['checked' => $this->preferences['group_by_categorie']]); + ?> + </td> + </tr> + </table> + + </fieldset> + <br /> + + <?php echo $this->formSubmit('Valider', 'Valider', ['class' => 'bouton']); ?> + </form> + </div> +</center> diff --git a/application/modules/admin/views/scripts/modo/index.phtml b/application/modules/admin/views/scripts/modo/index.phtml index 7e2aa1378c20b779999c506d575193beab0e89f7..a6aa72151ffe0f3b981efd7de143e2656fcb4114 100644 --- a/application/modules/admin/views/scripts/modo/index.phtml +++ b/application/modules/admin/views/scripts/modo/index.phtml @@ -18,14 +18,14 @@ $menus = [["icon" => "article.png", "label" => "Suggestions d'achat", "url" => $this->url(['action' => 'suggestion-achat']), "count" => $modstats['suggestions_achat']['count']] - + ]; if (isset($modstats['formulaires'])) { - $menus[] = + $menus[] = ["icon" => "formulaires_16.png", "label" => "Formulaires", - "url" => $this->url(['action' => 'formulaires']), + "url" => $this->url(['action' => 'formulaires', 'id_article' => null]), "count" => $modstats['formulaires']['count']] ;} ?> @@ -34,4 +34,3 @@ if (isset($modstats['formulaires'])) { <?php if ($this->subview) { ?> <div class="subview"><?php echo $this->subview;?><div class="clear"></div></div> <?php } ?> - diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index fd1d2083da864d0687f7ce9f03b11dcdfcc60856..36bf4fa0ef453bc820fb4a51486d6c33f724d688 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -258,8 +258,9 @@ class CmsController extends Zend_Controller_Action { $preferences = array_merge($module_calendrier->getDefaultValues(), $this->_modulesPreferences($id_module)); + if (!preg_match('/[0-9]{4}-[0-9]{2}/', $date)) { - $date = date('Y-m-d'); + $date = null; } // param pour l'affichage du calendar @@ -267,6 +268,7 @@ class CmsController extends Zend_Controller_Action { if ($month = $this->_getParam('month')) { $param['DATE'] = date('Y') . '-' . sprintf("%02d", $month); } + $param['URL']=''; $param['ID_BIB']=Class_Profil::getCurrentProfil()->getIdSite(); $param['AFFICH_MOIS']=1; diff --git a/application/modules/opac/controllers/DomainsController.php b/application/modules/opac/controllers/DomainsController.php index 89623455126484128b5756bf8a5ff4025ee3f070..cdc9eb5374f4821ee287e7e86b7e94b1776e956e 100644 --- a/application/modules/opac/controllers/DomainsController.php +++ b/application/modules/opac/controllers/DomainsController.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 */ class DomainsController extends ZendAfi_Controller_Action { @@ -41,7 +41,6 @@ class DomainsController extends ZendAfi_Controller_Action { $this->view->current_domain = $catalog; $this->view->id_module = $id_module; - $this->view->current_breadcrumb = $this->_getParam('parents'); } } ?> \ No newline at end of file diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index f17e55d10846c1556bbb9ce6287403f9ea9eef42..ab5e42af6d046d2e6746a5001309908ccb5e5c32 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -282,7 +282,7 @@ class RechercheController extends ZendAfi_Controller_Action { $notices); if (!in_array($id_notice, $ids)) - $id_notice = $notices[0]->getId(); + $id_notice = array_pop($notices)->getId(); } if (!$notice = Class_Notice::find($id_notice)) { @@ -575,12 +575,9 @@ class RechercheController extends ZendAfi_Controller_Action { return; } - $id_bib = (int)$this->_getParam('id_bib'); $id_origine = $this->_getParam('id_origine'); - - if (Class_CosmoVar::isSiteRetraitResaItemLibrary()) - $code_annexe = $this->_getParam('code_annexe'); + $code_annexe = $this->_getParam('code_annexe'); if (Class_CosmoVar::isSiteRetraitResaPatronLibrary()) $code_annexe = $user->getUserIdSite(); diff --git a/application/modules/opac/controllers/SitoController.php b/application/modules/opac/controllers/SitoController.php index 6700be3445c74b537831b58e3cb73316cc7be1c8..6f2b37a070f4db45316709868ca5e430d3a13d7c 100644 --- a/application/modules/opac/controllers/SitoController.php +++ b/application/modules/opac/controllers/SitoController.php @@ -60,6 +60,17 @@ class SitoController extends Zend_Controller_Action { $this->renderScript('sito/viewsitos.phtml'); } + public function viewcategoryAction() { + $this->view->id_category=$this->_getParam('id_cat'); + $search = $this->_getParam('title_search', ''); + $this->view->list = $this->_helper->listViewMode( + ['model' => Class_SitothequeCategorie::find($this->view->id_category), + 'strategy_label' => 'sitotheque', + 'search_value' => $search, + 'id_cat'=>$this->view->id_category, + 'page' => $this->_getParam('page',1)]); + + } public function viewselectionAction() { $id_module = $this->_getParam('id_module'); diff --git a/application/modules/opac/views/scripts/pagination.phtml b/application/modules/opac/views/scripts/pagination.phtml new file mode 100644 index 0000000000000000000000000000000000000000..aa60d29e84bb94ec33efdc50d615f44afade7f5b --- /dev/null +++ b/application/modules/opac/views/scripts/pagination.phtml @@ -0,0 +1,27 @@ +<?php if (1 >= $this->pageCount) return;?> +<?php if ($this->pageCount): ?> +<div class="paginationControl"> +<!-- Previous page link --> +<?php if (isset($this->previous)): ?> + <a href="<?php echo $this->url(['page' => $this->previous]); ?>">< <?php echo $this->_('Précédent'); ?></a> | +<?php else: ?> + <span class="disabled">< <?php echo $this->_('Précédent'); ?></span> | +<?php endif; ?> + +<!-- Numbered page links --> +<?php foreach ($this->pagesInRange as $page): ?> + <?php if ($page != $this->current): ?> + <a href="<?php echo $this->url(['page' => $page]); ?>"><?php echo $page; ?></a> | + <?php else: ?> + <?= $page; ?> | + <?php endif; ?> +<?php endforeach; ?> + +<!-- Next page link --> +<?php if (isset($this->next)): ?> + <a href="<?php echo $this->url(array('page' => $this->next)); ?>"><?php echo $this->_('Suivant'); ?> ></a> +<?php else: ?> + <span class="disabled"><?php echo $this->_('Suivant'); ?> ></span> +<?php endif; ?> +</div> +<?php endif; ?> diff --git a/application/modules/opac/views/scripts/sito/viewcategory.phtml b/application/modules/opac/views/scripts/sito/viewcategory.phtml new file mode 100644 index 0000000000000000000000000000000000000000..95955c14e0d5fa1f2fa261e2edcdaf51d1abfe5f --- /dev/null +++ b/application/modules/opac/views/scripts/sito/viewcategory.phtml @@ -0,0 +1,3 @@ +<?php +echo $this->publicListViewMode($this->list); +?> diff --git a/cosmogramme/cosmozend/application/modules/cosmo/controllers/FacetsController.php b/cosmogramme/cosmozend/application/modules/cosmo/controllers/FacetsController.php index 83069f87c931de222c4cf12c9ba83f55282f1097..5ad208a1136953d84050d0f3d6ddcded430669e6 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/controllers/FacetsController.php +++ b/cosmogramme/cosmozend/application/modules/cosmo/controllers/FacetsController.php @@ -63,7 +63,8 @@ class Cosmo_FacetsController extends Zend_Controller_Action { } if (!$model->getIdThesaurus()) { - $libelle = substr(str_replace(' ' ,'', $this->_getParam('libelle_facette')),0,4); + $libelle = preg_replace('/[^a-zA-Z0-9]/', '', $this->_getParam('libelle_facette')); + $libelle = substr($libelle, 0, 4); $id_thesaurus = $this->generateNewIdThesaurusForLabel($libelle); $model->setIdThesaurus($id_thesaurus); $model->setCode($libelle); diff --git a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DynamicFacetsControllerTest.php b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DynamicFacetsControllerTest.php index c62e5049f61f9447989072fe93f2c506e1c62c55..3bc761728f3eb7e16fd896a662cc8ce38f0d8043 100644 --- a/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DynamicFacetsControllerTest.php +++ b/cosmogramme/cosmozend/tests/application/modules/cosmo/controllers/DynamicFacetsControllerTest.php @@ -187,6 +187,19 @@ class Cosmo_DynamicFacetsControllerValidateTest extends Cosmo_DynamicFacetsContr Class_CodifThesaurus::findFirstBy(['libelle'=>'doc'])->getIdThesaurus()); } + + + /** @test */ + public function withSpecialCharsNewIdThesaurusShouldBeFourLetters() { + $this->postDispatch( + '/cosmo/facets/validate', + ['libelle_facette' => 'Année top 5', + 'rules' => '66$6']); + + + $this->assertEquals('ANNE', + Class_CodifThesaurus::findFirstBy(['libelle'=>'Année top 5'])->getIdThesaurus()); + } } diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index c7b3f3b22d2c245d5ce3b92427d902cbd1bb93c7..c3219fcd2db7d1fba09115ac4047a23fde4f9f91 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -2,7 +2,7 @@ // Constantes error_reporting(E_ERROR | E_PARSE); -define("PATCH_LEVEL","246"); +define("PATCH_LEVEL","253"); define("APPLI","cosmogramme"); define("COSMOPATH", "/var/www/html/vhosts/opac2/www/htdocs"); diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 1d3e20ae11d893d3f05a46abb34cd87d30066000..50732bc61215987984ca032d30ba52a8552a3cda 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -928,8 +928,10 @@ class notice_integration { if($this->notice["statut"]==1) { $this->statut=2; - if($clef_unimarc) $controle=$sql->execute("delete from notices_articles where clef_unimarc='$clef_unimarc'"); - else $controle=$sql->execute("delete from notices_articles where clef_chapeau='$clef_chapeau' and clef_numero='$clef_numero' and clef_article='$clef_article'" ); + if($clef_unimarc) + $controle=$sql->execute("delete from notices_articles where clef_unimarc='$clef_unimarc'"); + else + $controle=$sql->execute("delete from notices_articles where clef_chapeau='$clef_chapeau' and clef_numero='$clef_numero' and clef_article='$clef_article'" ); if(!$controle) { $this->statut=0; @@ -970,7 +972,8 @@ class notice_integration { } else { - $sql->insert("notices_articles",$enreg); + Class_Notice_SerialArticles::newInstance($enreg)->save(); + Class_Notice_SerialArticles::clearCache(); $this->statut=1; } } diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index f0433408223dce835eda4037055a4712868b756a..f8ccc45faedc9a2f07df68de4c38d6705680c0b2 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -126,7 +126,7 @@ class notice_unimarc extends iso2709_record { $notice["clef_oeuvre"] = $this->getClefAlpha(true); $notice["clef_chapeau"] = $this->getClefChapeau(); $notice["titre_princ"] = $this->getTitrePrincipal(); - $notice["tome_alpha"] = $this->getTome(); + $notice["tome_alpha"] = $this->indexation->alphaMaj($this->getTome()); $notice["alpha_titre"] = $this->indexation->codeAlphaTitre($notice["titre_princ"]." ".$notice["tome_alpha"]); $notice["id_commerciale"] = $this->getIdCommerciale($notice["alpha_titre"]); $notice["titres"] = $this->getTitres(); @@ -201,7 +201,7 @@ class notice_unimarc extends iso2709_record { { // type de doc $notice["type_doc"] = 100; - $notice["infos_type_doc"] = array("code"=>100,libelle=>"article de périodique"); + $notice["infos_type_doc"] = ["code"=>100, 'libelle'=>"article de périodique"]; // statut $notice["statut"] = $this->getStatut(); diff --git a/cosmogramme/sql/patch/patch_234.php b/cosmogramme/sql/patch/patch_234.php index 936e261818e8b7009188899ed77bb8e0c0fa844f..748565dc346c40807d2d767bf84738d2e8cec39c 100644 --- a/cosmogramme/sql/patch/patch_234.php +++ b/cosmogramme/sql/patch/patch_234.php @@ -7,7 +7,6 @@ $adapter->query('CREATE TABLE `patch_hash` ( ' . 'key (`value`)' . ') engine=MyISAM default charset=utf8'); - $migration = new Class_Migration_Patchs(); $patch_level = (int)Class_CosmoVar::get('patch_level'); $patches = $migration->getPatchesFilteredBy( @@ -16,3 +15,5 @@ $patches = $migration->getPatchesFilteredBy( }); foreach($patches as $script) $migration->hashScriptAndDo($script, function() { return true; }); + +?> diff --git a/cosmogramme/sql/patch/patch_235.php b/cosmogramme/sql/patch/patch_235.php index 3bd506bd755cfc6b7de46c7115f88717e578de4d..53e615e9a0b41a39a716a13b1154af5d7e5c8d15 100644 --- a/cosmogramme/sql/patch/patch_235.php +++ b/cosmogramme/sql/patch/patch_235.php @@ -1,4 +1,10 @@ <?php -$adapter = Zend_Db_Table::getDefaultAdapter(); -$adapter->query('alter table multimedia_location add column `autohold_for_closing_days` tinyint(3) unsigned DEFAULT "0"'); -?> +$adapter = Zend_Registry::get('sql'); +$default_adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); + +try { + $default_adapter->query("SELECT autohold_for_closing_days FROM multimedia_location LIMIT 1"); +} catch (Exception $e) { + $adapter->query("ALTER IGNORE TABLE `multimedia_location` ADD COLUMN `autohold_for_closing_days` tinyint(3) unsigned DEFAULT 0;"); +} +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_236.php b/cosmogramme/sql/patch/patch_236.php index 4d4aceb1c359bb091adca4d86496d9f8a896b53c..2755cc14d5ba1d7fff9e755ca5e4679b795ef5dd 100644 --- a/cosmogramme/sql/patch/patch_236.php +++ b/cosmogramme/sql/patch/patch_236.php @@ -1,8 +1,8 @@ <?php - $adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); $adapter->query("ALTER TABLE album MODIFY genre varchar(100) NULL default ''"); $adapter->query("ALTER TABLE album MODIFY matiere varchar(100) NULL default ''"); $adapter->query("ALTER TABLE album MODIFY nature_doc varchar(50) NULL default ''"); $adapter->query("ALTER TABLE album MODIFY dewey varchar(100) NULL default ''"); $adapter->query("ALTER TABLE album MODIFY tags text NULL default ''"); +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_246.php b/cosmogramme/sql/patch/patch_246.php index b17419d26ac7abbe8ced3f54fdc4368e3baadde4..a581b111a7cf51a74aa3cd03174432c191a7d5be 100644 --- a/cosmogramme/sql/patch/patch_246.php +++ b/cosmogramme/sql/patch/patch_246.php @@ -1,4 +1,28 @@ <?php -Zend_Db_Table::getDefaultAdapter() - ->query("UPDATE `variables` SET commentaire='Site de retrait à la réservation', liste='0:site de l\'exemplaire\r\n1:proposer le choix\r\n2:site de l\'abonné' WHERE variables.clef='site_retrait_resa' LIMIT 1;"); +$adapter = Zend_Registry::get('sql'); + +$adapter->query("CREATE TABLE IF NOT EXISTS `permission` ( id INT(11) unsigned NOT NULL AUTO_INCREMENT, code varchar(255) NOT NULL, module varchar(255) NOT NULL, type varchar(255) NOT NULL, sorting int(11) NOT NULL, description text NULL, PRIMARY KEY (id), KEY (code), KEY (module), KEY (type), KEY (sorting)) ENGINE = MYISAM, character set=UTF8;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'CATEGORY', 'ARTICLE', 'Droits', 1, 'Créer des sous-catégories et des articles' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'CATEGORY') LIMIT 1;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'ARTICLE', 'ARTICLE', 'Droits', 2, 'Créer des articles' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'ARTICLE') LIMIT 1;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'PENDING', 'ARTICLE', 'Nouveaux statuts autorisés', 1, 'À valider' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'PENDING') LIMIT 1;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'VALIDATED', 'ARTICLE', 'Nouveaux statuts autorisés', 101, 'Validé' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'VALIDATED') LIMIT 1;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'REFUSED', 'ARTICLE', 'Nouveaux statuts autorisés', 102, 'Refusé' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'REFUSED') LIMIT 1;"); + +$adapter->query("insert into `permission` (code, module, type, sorting, description) SELECT 'ARCHIVED', 'ARTICLE', 'Nouveaux statuts autorisés', 103, 'Archivé' from `permission` WHERE NOT EXISTS (SELECT * FROM `permission` WHERE code = 'ARCHIVED') LIMIT 1;"); + +$adapter->query('CREATE TABLE IF NOT EXISTS `user_group_permission` ( id INT(11) unsigned NOT NULL AUTO_INCREMENT, id_group INT(11) unsigned NOT NULL, id_permission INT(11) unsigned NOT NULL, id_model INT(11) unsigned NOT NULL, model_class varchar(255) NOT NULL, PRIMARY KEY (id), KEY(id_group), KEY(id_permission), KEY(id_model), KEY(model_class)) ENGINE = MYISAM, character set=UTF8;'); + +$adapter->query("UPDATE `user_group_categorie` SET `libelle` = 'Général' WHERE `user_group_categorie`.`libelle` = 'Catégorie par défaut' LIMIT 1;"); + +try { + $default_adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); + $default_adapter->query("SELECT id_bib from user_groups LIMIT 1"); +} catch (Exception $e) { + $adapter->query("ALTER TABLE `user_groups` add column `id_bib` INT(11) NOT NULL DEFAULT '0', add key `id_bib` (`id_bib`);"); +} ?> diff --git a/cosmogramme/sql/patch/patch_247.php b/cosmogramme/sql/patch/patch_247.php new file mode 100644 index 0000000000000000000000000000000000000000..2352b8e950f0a253445138f17e5c93208210918b --- /dev/null +++ b/cosmogramme/sql/patch/patch_247.php @@ -0,0 +1,6 @@ +<?php +$format_liste = "0:Unimarc\r\n1:Ascii tabulé\r\n2:Ascii séparé par des points-virgule\r\n3:Ascii séparé par des \"|\"\r\n4:Xml\r\n5:CSV\r\n6:Marc21\r\n"; + +$adapter = Zend_Db_Table::getDefaultAdapter(); +$adapter->query("UPDATE variables SET liste = '$format_liste' WHERE clef = 'import_format'"); +?> diff --git a/cosmogramme/sql/patch/patch_248.php b/cosmogramme/sql/patch/patch_248.php new file mode 100644 index 0000000000000000000000000000000000000000..154af7f1b6ff202c6f46393c7898488082ddc841 --- /dev/null +++ b/cosmogramme/sql/patch/patch_248.php @@ -0,0 +1,4 @@ +<?php +Zend_Db_Table::getDefaultAdapter() + ->query("UPDATE `variables` SET commentaire='Site de retrait à la réservation', liste='0:site de l\'exemplaire\r\n1:proposer le choix\r\n2:site de l\'abonné', verrou='' WHERE variables.clef='site_retrait_resa' LIMIT 1;"); +?> diff --git a/cosmogramme/sql/patch/patch_249.php b/cosmogramme/sql/patch/patch_249.php new file mode 100644 index 0000000000000000000000000000000000000000..f8cd20b5802def13c0911a9c7d1cbc1ef125681c --- /dev/null +++ b/cosmogramme/sql/patch/patch_249.php @@ -0,0 +1,8 @@ +<?php +$adapter = Zend_Registry::get('sql'); +$adapter->query('ALTER TABLE exemplaires MODIFY code_barres VARCHAR(255)'); +$adapter->query('ALTER TABLE exemplaires MODIFY cote VARCHAR(255)'); +$adapter->query('ALTER TABLE exemplaires MODIFY id_origine VARCHAR(255)'); +$adapter->query('ALTER TABLE exemplaires MODIFY annexe VARCHAR(255)'); +$adapter->query('ALTER TABLE exemplaires MODIFY activite VARCHAR(255)'); +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_250.php b/cosmogramme/sql/patch/patch_250.php new file mode 100644 index 0000000000000000000000000000000000000000..db8d4a6fe51cd36febe78c6a5d061c48944f72d5 --- /dev/null +++ b/cosmogramme/sql/patch/patch_250.php @@ -0,0 +1,4 @@ +<?php +$adapter = Zend_Db_Table::getDefaultAdapter(); +$adapter->query("UPDATE variables SET liste = '$format_liste' WHERE clef = 'import_format'"); +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_251.php b/cosmogramme/sql/patch/patch_251.php new file mode 100644 index 0000000000000000000000000000000000000000..ac93016d2c12b4fb8f2e6d7add01612aaaf4a0d1 --- /dev/null +++ b/cosmogramme/sql/patch/patch_251.php @@ -0,0 +1,4 @@ +<?php +Zend_Db_Table::getDefaultAdapter() + ->query('alter table notices modify column tome_alpha varchar(20);'); +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_252.php b/cosmogramme/sql/patch/patch_252.php new file mode 100644 index 0000000000000000000000000000000000000000..f45fa7bfef9f99564d8d59f0f6e0265926e079c5 --- /dev/null +++ b/cosmogramme/sql/patch/patch_252.php @@ -0,0 +1,4 @@ +<?php +$adapter = Zend_Registry::get('sql'); +$adapter->query("UPDATE `variables` SET commentaire='Site de retrait à la réservation', liste='0:site de l\'exemplaire\r\n1:proposer le choix\r\n2:site de l\'abonné', verrou='' WHERE variables.clef='site_retrait_resa' LIMIT 1;"); +?> \ No newline at end of file diff --git a/cosmogramme/sql/patch/patch_253.php b/cosmogramme/sql/patch/patch_253.php new file mode 100644 index 0000000000000000000000000000000000000000..66bd425df7f5cc5442f41a53cbfe9ed2aee825bf --- /dev/null +++ b/cosmogramme/sql/patch/patch_253.php @@ -0,0 +1,10 @@ +<?php +$adapter = Zend_Db_Table::getDefaultAdapter(); +$adapter->query('alter table notices_articles modify clef_chapeau varchar(100) NULL'); +$adapter->query('alter table notices_articles modify clef_numero varchar(20) NULL'); +$adapter->query('alter table notices_articles modify clef_article varchar(20) NULL'); +$adapter->query('alter table notices_articles modify clef_unimarc varchar(15) NULL'); +$adapter->query('alter table notices_articles modify unimarc text NULL'); +$adapter->query('alter table notices_articles modify date_maj varchar(20) NULL'); +$adapter->query('alter table notices_articles modify qualite tinyint(4) NULL'); +?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index af571af70ac066c6a3f48beb1a605aaeb98f5222..f96ce961e6965fed6424da2b657fcb959feb33fa 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -106,6 +106,8 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase { Class_CodifDewey::beVolatile(); Class_CodifPcdm4::beVolatile(); + Class_Notice_SerialArticles::beVolatile(); + $this->fixture('Class_IntBib', ['id' => 1, 'nom' => 'My wonderful library', @@ -2222,4 +2224,75 @@ class NoticeIntegrationNoNoticeTest extends NoticeIntegrationTestCase { public function writeItemShouldNotCrash() { $this->assertNull($this->_notice_integration->ecrireExemplaires(1)); } -} \ No newline at end of file +} + + + + +class NoticeIntegrationSerialTopSanteTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + $profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110); + return $profil->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + + $contents = file_get_contents(dirname(__FILE__)."/unimarc_top_sante.txt"); + + array_map([$this, 'loadNoticeFromString'], + preg_split('/'.chr(30).chr(29).'/', $contents)); + + $this->notice = Class_Notice::find(1); + } + + + /** @test */ + public function mainTitleShouldBeTopSante() { + $this->assertContains('Top Santé n° 295 - Avril 2015', $this->notice->getTitrePrincipal()); + } + + + /** @test */ + public function noticeShouldHaveFiveArticles() { + $this->assertCount(5, $this->notice->getArticlesPeriodique()); + } +} + + + +class NoticeIntegrationAloesSerialIndexpressBellesHistoireTest extends NoticeIntegrationTestCase { + public function getProfilDonnees() { + return Class_IntProfilDonnees::forALOES() + ->setIdProfil(111) + ->getRawAttributes(); + } + + + public function setUp() { + parent::setUp(); + + $contents = file_get_contents(dirname(__FILE__)."/unimarc_petit_doucet.txt"); + + array_map([$this, 'loadNoticeFromString'], + preg_split('/'.chr(30).chr(29).'/', $contents)); + + $this->notice = Class_Notice::find(1); + } + + + /** @test */ + public function mainTitleShouldBeBellesHistoires() { + $this->assertEquals('Belles histoires (Les)', $this->notice->getTitrePrincipal()); + } + + + /** @test */ + public function noArticleShouldHaveBeenSaved() { + $this->assertCount(0, Class_Notice_SerialArticles::findAll()); + } +} + + +?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt b/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt new file mode 100644 index 0000000000000000000000000000000000000000..bc11399aa4c080cf51861de2891951d1f1529767 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_petit_doucet.txt @@ -0,0 +1 @@ +00369nas0 2200097 450 0010008000001000041000082000044000494610036000934620093001299950049002220690665 a20150429a|||| uu y0frey0103 ba| aBelles histoires (Les)h509i01/05/2015 |30627457tBelles histoires (Les) 30690669tLe petit Doucet et les 7 filles de l'ogrefHistoire Âecrite par Arnaud AlmÂeras 30690666aBDYbYf16431346045kA ALM bqJruu00638naa0 2200181 450 0010008000001000041000081010008000491020007000572000113000642150010001773300159001876760006003467000037003527020023003898010028004129020010004409030006004500690669 a20150429a|||| u y0frey0103 ba| afre aFR| aLe petit Doucet et les 7 filles de l'ogrefHistoire Âecrite par Arnaud AlmÂerasgillustrÂee par Sara Ogilvie a42 p. aIl Âetait une fois un petit garÐcon et trÁes gentil... Un jour, ses six frÁeres trÁes moqueurs et trÁes mÂechants dÂecident de le perdre dans la forÃet... aA 1aAlmÂerasbArnaudf1967-....4070 1aOgilviebSara4440 1aFRbBDP YONNEc20150429 aAlbum ab \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/unimarc_top_sante.txt b/cosmogramme/tests/php/classes/unimarc_top_sante.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4815a30ef7551b9da45f1fe3b1385743a57eb0 --- /dev/null +++ b/cosmogramme/tests/php/classes/unimarc_top_sante.txt @@ -0,0 +1 @@ +00756nas2 2200133 450 001000700000073001800007100001300025122004500038200010200083461008600185801001700271992018400288995015000472353014 a3781591102904 a20140620 a 20150430 1 aExclusif ! Avec la méthode "très bien merci !" Objectif tour de taille ! -3 kilos, c'est sûr ! nTop SantéoAbonnementtTop Santév295 - Avril 2015wNormal41x1152-7137016492 2aFrc20150428 uhttp://websvc.pergame.net/afi_opac_services/images/periodiques/numeros/156/thumbs/295.jpegvhttp://websvc.pergame.net/afi_opac_services/images/periodiques/numeros/156/big/295.jpeg aMédiathèque Jim-Dandurandf121049kPem20150428qarpzppocv12[DERN][Dernier numéro][0][0][A consulter sur place][0][0][1][0]644724829900253naa2 2200061 450 0010007000002000140000074610044001473702921 aDossier médecine : Alergies respiratoires, dermato, alimentaires... On peut toutes les guérir ! Les meilleurs conseils et traitements tTop Santév295 - Avril 2015wNormal4100222naa2 2200061 450 0010007000002000109000074610044001163702931 aLes nouvelles techniques anti-stress : Sophrologie, méditation, hypnose + les exos à faire soi-même ! tTop Santév295 - Avril 2015wNormal4100166naa2 2200061 450 0010007000002000053000074610044000603702941 aCellulite : Les crèmes 2015 testées pour vous tTop Santév295 - Avril 2015wNormal4100214naa2 2200061 450 0010007000002000101000074610044001083702951 aHalus valgus : Tous les progrès de la chirurgie du pied + le classement des meilleurs hôpitaux tTop Santév295 - Avril 2015wNormal4100180naa2 2200061 450 0010007000002000067000074610044000743702961 aProgrès : Les dernières innovations en chirurgie esthétique tTop Santév295 - Avril 2015wNormal41 \ No newline at end of file diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php index bd2bbceb6fb2aca8433b0dc508d7d762f1c7b3e8..e99b3633754e6c6a20f18feb87a60ca68bc8ba0b 100644 --- a/library/Class/Catalogue.php +++ b/library/Class/Catalogue.php @@ -642,19 +642,26 @@ class Class_Catalogue extends Storm_Model_Abstract { public function getAllNoticeIdsForDomaine($nb_par_page,$numero_page) { $preferences = $this->toArray(); - $req=$this->getLoader()->getRequetes($preferences, ['id_notice']); + $req = $this->getLoader()->getRequetes($preferences, ['id_notice']); - $start=$nb_par_page*$numero_page; - $requete_ids=str_replace('LIMIT 5000', - "limit ".$nb_par_page*$numero_page.','.$nb_par_page, - $req['req_liste']); + if(!isset($req['req_liste'])) + return []; - $sql = Zend_Registry::get('sql'); + $start= $nb_par_page * $numero_page; + + $requete_ids = str_replace('LIMIT 5000', + "limit ".$nb_par_page*$numero_page.','.$nb_par_page, + $req['req_liste']); + + if(!$requete_ids) + return []; - $ids_rows=$sql->fetchAll($requete_ids); - $ids=[]; + $sql = Zend_Registry::get('sql'); + $ids_rows = $sql->fetchAll($requete_ids); + + $ids = []; foreach($ids_rows as $row) { - $ids[]=$row['id_notice']; + $ids[] = $row['id_notice']; } return $ids; @@ -1113,6 +1120,35 @@ class Class_Catalogue extends Storm_Model_Abstract { } + public function getBrowsableDomainsJson($domains = [], $options = []) { + $domains = $domains ? $domains : Class_Catalogue::getLoader()->findTopCatalogues(); + $browsable_domains = array_filter($domains, function($domain) {return $domain->hasSousDomaines();}); + + $data_domaines=[]; + foreach($browsable_domains as $domaine) { + $data_domaines [] = $domaine->getBrowsableDomainsJson($domaine->getSousDomaines(), $options); + } + + $leaf_domains = array_diff($domains, $browsable_domains); + $data_leaf_domains = []; + foreach($leaf_domains as $domain) { + $data_leaf_domains [] = ['id' => $domain->getId(), + 'label' => $domain->getLibelle(), + 'options' => ['ico' => URL_ADMIN_IMG.'picto/domaines_16.png', + 'multipleSelection' => false]]; + } + + + return ['id' => $this->getId() ? $this->getId() : 'domaines', + 'label' => $this->getLibelle() ? $this->getLibelle() : $this->_('Domaines'), + 'categories' => $data_domaines, + 'items' => $data_leaf_domains, + 'options' => ['ico' => URL_ADMIN_IMG.'picto/domaines_16.png', + 'multipleSelection' => false]]; + + } + + public function hasNoSettings() { $attributs = $this->_attributes; unset($attributs['libelle']); diff --git a/library/Class/CmsUrlTransformer.php b/library/Class/CmsUrlTransformer.php index e7b79d3ac5c74a4cf81f541457a35385ec70236a..8c1b4ff9dc2d24a59da8847664189bc0b66cb571 100644 --- a/library/Class/CmsUrlTransformer.php +++ b/library/Class/CmsUrlTransformer.php @@ -57,6 +57,7 @@ class Class_CmsUrlTransformer { $rel); } + public static function removeHostFromArray($hostname,$basedir, $contents, &$replace_count = null) { if (is_array($contents)) { foreach ($contents as $index => $content) { @@ -65,8 +66,8 @@ class Class_CmsUrlTransformer { } return $contents; } - return static::removeHost($hostname,$basedir, $contents, $replace_count); + return static::removeHost($hostname,$basedir, $contents, $replace_count); } diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index f41de69f42dfdf6d626a5e62ac68dd6bf6e6ecd3..8d9fe7c1a7a0b2e95276bf226b46cb64747bb885 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -56,7 +56,7 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { return self:: newInstance(['libelle' => 'Unimarc Nanok', 'accents' => self::ENCODING_UTF8, - 'rejet_periodiques' => '1', + 'rejet_periodiques' => 0, 'id_article_periodique' => self::SERIAL_FORMAT_PERGAME, 'type_fichier' => self::FT_RECORDS, 'format' => self::FORMAT_UNIMARC, diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 8e9eb634aa06d9d0124d34f9ab5e9c176a1c60db..5a630ad51d1ae319a097b91f5f50aa97f0dd337e 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -583,30 +583,33 @@ class Class_Notice extends Storm_Model_Abstract { // ---------------------------------------------------------------- // Renvoie les articles d'un périodique // ---------------------------------------------------------------- - public function getArticlesPeriodique($id_notice) { + public function getArticlesPeriodique() { // lire dans la base - $notice = fetchEnreg("select clef_chapeau,tome_alpha from notices where id_notice=$id_notice"); - $data = fetchAll("select unimarc from notices_articles where clef_chapeau='" . $notice["clef_chapeau"] . "' and clef_numero='" . $notice["tome_alpha"] . "'"); - if (!$data) return false; - foreach ($data as $enreg) { - if (!$enreg["unimarc"]) continue; - $this->getNoticeUnimarc()->setNotice($enreg["unimarc"], 0); - $article["titre"] = $this->getTitrePrincipal(); - $complement = $this->getComplementTitre(); - if ($complement) - $article["titre"].=" : " . $complement; + $datas = Class_Notice_SerialArticles::findAllBy(['clef_chapeau' => $this->getClefChapeau(), + 'clef_numero' => $this->getTomeAlpha()]); + + $articles = []; + + foreach ($datas as $enreg) { + if (!$enreg->getUnimarc()) continue; + + $this->getNoticeUnimarc()->setNotice($enreg->getUnimarc(), 0); + + $article = ["titre" => $this->getTitrePrincipal()]; + if ($complement = $this->getComplementTitre()) + $article["titre"] .= " : " . $complement; + $auteurs = $this->getAuteursUnimarc(true); - $article["auteur"] = $auteurs[0]; + $article["auteur"] = isset($auteurs[0]) ? $auteurs[0] : ''; $article["pagination"] = $this->getCollation(); $note = $data = $this->get_subfield("300", "a"); - $article["note"] = trim($note[0]); - unset($this->_resume); + $article["note"] = isset($note[0]) ? trim($note[0]) : ''; $article["resume"] = $this->getResume(); $article["matieres"] = $this->getMatieres(); - $ret[] = $article; + $articles[] = $article; } - return $ret; + return $articles; } @@ -907,7 +910,8 @@ class Class_Notice extends Storm_Model_Abstract { // ---------------------------------------------------------------- public function getComplementTitre() { - $titre = $this->get_subfield("200", "e"); + if (!$titre = $this->get_subfield("200", "e")) + return ''; $titre = $this->filtreTitre($titre[0]); return trim($titre); } diff --git a/library/Class/Notice/SerialArticles.php b/library/Class/Notice/SerialArticles.php new file mode 100644 index 0000000000000000000000000000000000000000..ebf55ba7833772c02b7950d7285b31a8fd70ac04 --- /dev/null +++ b/library/Class/Notice/SerialArticles.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class Class_Notice_SerialArticles extends Storm_Model_Abstract { + protected + $_table_name = 'notices_articles', + $_table_primary = 'id_article'; + + + protected $_default_attribute_values = ['clef_chapeau' => '', + 'clef_numero' => '', + 'clef_article' => '', + 'unimarc' => '']; + + + public function validate() { + if (!$this->getClefChapeau()) + $this->addError('Clé chapeau requise'); + + if (!$this->getClefNumero()) + $this->addError('Clé numero requise'); + } +} + +?> \ No newline at end of file diff --git a/library/Class/NoticeDomain.php b/library/Class/NoticeDomain.php index 70514ddd1ad760cd4089048472b1f95a89d3f229..510a2ca8759ca9671927126e89ba2f575cc57d7e 100644 --- a/library/Class/NoticeDomain.php +++ b/library/Class/NoticeDomain.php @@ -103,7 +103,6 @@ class NoticeDomainLoader extends Storm_Model_Loader { $attributs)); foreach ($notices_domains as $notice_domain) { - //Class_NoticeDomain::deleteRecordsFacetteForCart($notice_domain->getDomainId(), $notice_domain->getPanierId()); $notice_domain->delete(); } } @@ -113,13 +112,13 @@ class NoticeDomainLoader extends Storm_Model_Loader { $notices_domains = Class_NoticeDomain::findAllBy(['domain_id' => $domain->getId()]); foreach ($notices_domains as $notice_domain) { - //Class_NoticeDomain::deleteRecordsFacetteForDomain($notice_domain->getDomainId()); $notice_domain->delete(); } } } + class Class_NoticeDomain extends Storm_Model_Abstract { protected $_table_name = 'notice_domain', diff --git a/library/Class/Profil.php b/library/Class/Profil.php index d7b01d0793698dc8d5ab155701b16f30cae9fde0..576b3136dfe66e8c57fbc16dc4ab168f5bbaba64 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -583,10 +583,28 @@ class Class_Profil extends Storm_Model_Abstract { } + /** @return array */ + public function getBannerBoxes() { + $cfg_accueil = $this->getCfgAccueilAsArray(); + $banner_boxes = []; + foreach ($cfg_accueil['modules'] as $id => $module) { + if ($module['division'] == self::DIV_BANNIERE) + $banner_boxes[$id] = $module; + } + + return $banner_boxes; + } + + /** @return array */ public function getLocalModuleAccueilConfig($id_module) { $cfg_accueil = $this->getCfgAccueilAsArray(); - $modules_config = $cfg_accueil['modules']; + + $banner_boxes = []; + if ($this->hasParentProfil()) + $banner_boxes = $this->getParentProfil()->getBannerBoxes(); + + $modules_config = $cfg_accueil['modules'] + $banner_boxes; $module = ['type_module' => null, 'preferences' => []]; if (!array_key_exists($id_module, $modules_config)) @@ -1648,9 +1666,15 @@ class Class_Profil extends Storm_Model_Abstract { protected function changeIdModuleTo($id, $new_id) { $cfg_accueil = $this->getCfgAccueilAsArray(); - $module_cfg = $cfg_accueil['modules'][$id]; - unset($cfg_accueil['modules'][$id]); - $cfg_accueil['modules'][$new_id] = $module_cfg; + $modules = $cfg_accueil['modules']; + $keys = array_keys($modules); + $position = array_search($id, $keys); + + if ($position !== false) { + $keys[$position] = $new_id; + $cfg_accueil['modules'] = array_combine($keys, $modules); + } + $this->setCfgAccueil($cfg_accueil)->save(); return $this; } @@ -1747,7 +1771,7 @@ class Class_Profil extends Storm_Model_Abstract { $moved_module['division'] = $new_div; unset($cfg_accueil['modules'][$id]); - $new_modules = array(); + $new_modules = []; $i = 0; foreach($cfg_accueil['modules'] as $module_id => $module) { $in_new_div = $module['division'] == $new_div; diff --git a/library/Class/Sitotheque.php b/library/Class/Sitotheque.php index 2dae95d5f2915995671a52cb087cc470a8ea8f18..961852f8c51b08db78b23310fb96cd8b50f3f034 100644 --- a/library/Class/Sitotheque.php +++ b/library/Class/Sitotheque.php @@ -36,6 +36,7 @@ class Class_SitothequeModelSite extends BaseItem { class SitothequeLoader extends Storm_Model_Loader { + /** * @param array $id_sites * @param array $id_categories @@ -100,7 +101,8 @@ class SitothequeLoader extends Storm_Model_Loader { class Class_Sitotheque extends Storm_Model_Abstract { - use Trait_Translator, Trait_TreeViewableItem, Trait_HasManyDomaines, Trait_Indexable, Trait_CustomFields; + use Trait_Translator, Trait_TreeViewableItem, Trait_HasManyDomaines, Trait_Indexable, Trait_CustomFields, + Trait_TimeSource; protected $_loader_class = 'SitothequeLoader'; @@ -125,6 +127,7 @@ class Class_Sitotheque extends Storm_Model_Abstract { public function beforeSave() { + $this->setDateMaj($this->getCurrentDateTime()); $this->unindex(); } diff --git a/library/Class/SitothequeCategorie.php b/library/Class/SitothequeCategorie.php index 0fcf189d8fc6e969593f8f4ca69485bddfeeef75..fe11dbf037db8a563e9d5862822f16bf23ab2a52 100644 --- a/library/Class/SitothequeCategorie.php +++ b/library/Class/SitothequeCategorie.php @@ -32,9 +32,11 @@ class Class_SitothequeCategorie extends Storm_Model_Abstract { protected $_has_many = ['sous_categories' => ['model' => 'Class_SitothequeCategorie', 'role' => 'parent_categorie', + 'order' => 'libelle', 'dependents' => 'delete'], 'sitotheques' => ['model' => 'Class_Sitotheque', + 'order' => 'titre', 'role' => 'categorie', 'dependents' => 'delete']]; diff --git a/library/Class/Systeme/PergameService.php b/library/Class/Systeme/PergameService.php index 23446ba759e3b3bece6425de12e981482fd23f5d..6ea5abb3e47f218e1203f72f9732f987e0d537c0 100644 --- a/library/Class/Systeme/PergameService.php +++ b/library/Class/Systeme/PergameService.php @@ -20,7 +20,7 @@ */ class Class_Systeme_PergameService { - use Trait_TimeSource; + use Trait_TimeSource, Trait_Translator; private $user; @@ -113,32 +113,46 @@ class Class_Systeme_PergameService { public function getReservations() { - $data=fetchAll("select * from reservations where IDABON='".$this->user->IDABON."' and ORDREABON=".$this->user->ORDREABON); - if(!$data) return array(); - foreach($data as $enreg) - { - $notice=$this->getNoticeFromTransaction($enreg["SUPPORT"],$enreg["ID_NOTICE_ORIGINE"]); + $data = Class_Reservation::findAllBy(['idabon' => $this->user->getIdabon(), + 'ordreabon' => $this->user->getOrdreabon()]); + if(!$data) + return []; + + foreach($data as $enreg) { + $notice = $this->getNoticeFromTransaction($enreg->getSupport(), + $enreg->getIdNoticeOrigine()); $resa["titre"]=$notice["J"]; - if($notice["A"]) $resa["titre"].=" / ".$notice["A"]; - // rang - $rang=fetchOne("select count(*) from reservations where ID_NOTICE_ORIGINE=".$enreg["ID_NOTICE_ORIGINE"]." and DATE_RESA<'".$enreg["DATE_RESA"]."'"); - $resa["rang"]=$rang+1; - $resa["id_suppr"]=$enreg["ID_RESA"]; + if($notice["A"]) + $resa["titre"].= " / ".$notice["A"]; + + $rang = Class_Reservation::countBy(['where' => "ID_NOTICE_ORIGINE = " . $enreg->getIdNoticeOrigine() . + " and DATE_RESA < '" . $enreg->getDateResa() . "'"]); - // Controle si en pret - $en_pret=fetchOne("select count(*) from prets where ID_NOTICE_ORIGINE=".$enreg["ID_NOTICE_ORIGINE"]." and EN_COURS=1"); - if($en_pret>0) $resa["etat"]="en prêt"; - elseif($resa["rang"]==1) $resa["etat"]="disponible"; - else $resa["etat"]="réservé"; + $resa["rang"] = $rang + 1; + $resa["id_suppr"] = $enreg->getIdResa(); - // empiler - $reservations[]=$resa; + $en_pret = Class_Pret::countBy(['id_notice_origine' => $enreg->getIdNoticeOrigine(), + 'en_cours' => 1]); + + $resa['etat'] = $this->getHoldStatus($en_pret, $resa['rang']); + $reservations[] = $resa; } return $reservations; } + protected function getHoldStatus($numbers_of_loans, $hold_rank) { + if($numbers_of_loans > 0) + return $this->_('en prêt'); + + if( 1 == $hold_rank) + return $this->_('disponible'); + + return $this->_('réservé'); + } + + private function getNoticeFromCodeBarres($id_bib, $code_barres) { $cls_notice = new Class_Notice(); $id_notice = fetchOne("select id_notice from exemplaires where code_barres='$code_barres' and id_bib=$id_bib"); @@ -175,25 +189,31 @@ class Class_Systeme_PergameService { public function reserverExemplairePergame($id_bib, $exemplaire, $code_annexe) { if (!$this->user || !$this->user->ID_USER) - return ['erreur' => 'Vous devez être connecté pour réserver un document']; + return ['erreur' => $this->_('Vous devez être connecté pour réserver un document')]; if(!$this->user->IDABON) - return ['erreur' => 'Vous devez être connecté en tant qu\'abonné pour réserver un document']; + return ['erreur' => $this->_('Vous devez être connecté en tant qu\'abonné pour réserver un document')]; if (!$exemplaire) - return ['erreur' => 'Une erreur s\'est produite lors de la lecture de la notice.']; + return ['erreur' => $this->_('Une erreur s\'est produite lors de la lecture de la notice.')]; + + if(!$id_bib) + $id_bib = 1; + + if(!$code_annexe) + $code_annexe = $id_bib; $notice = $exemplaire->getNotice(); $support = $notice->getFamilleId(); // Controle si deja réservé par l'abonné $ret = null; - $id_abon = $this->user->IDABON; - $ordre_abon = $this->user->ORDREABON; + $id_abon = $this->user->getIdabon(); + $ordre_abon = $this->user->getOrdreabon(); $id_origine = $exemplaire->getIdOrigine(); $resa = Class_Reservation::findFirstBy([ 'id_notice_origine' => $id_origine, - 'id_site' => $id_bib, + 'id_site' => $code_annexe, 'idabon' => $id_abon, 'ordreabon'=> $ordre_abon]); @@ -212,13 +232,10 @@ class Class_Systeme_PergameService { if ($nb >= $regles['Max_par_document']) return ['erreur' => 'La réservation est impossible car le nombre maximum de réservations pour ce document a été atteint (' . $regles["Max_par_document"] . ').']; - if (!$id_bib) - $id_bib = 1; - $time_source = self::getTimeSource(); Class_Reservation::newInstance([ - 'id_site' => $id_bib, + 'id_site' => $code_annexe, 'id_pergame' => 0, 'idabon' => $id_abon, 'ordreabon' => $ordre_abon, @@ -317,7 +334,10 @@ class Class_Systeme_PergameService { public function getReglesReservation($id_bib) { if (!$id_bib) return false; - $bib = Class_IntBib::find($id_bib); + + if(!$bib = Class_IntBib::find($id_bib)) + return false; + $data = $bib->getCommParamsAsArray(); if (!isset($data["Max_par_carte"])) $data["Max_par_carte"] = 3; diff --git a/library/Class/Url.php b/library/Class/Url.php index 6be96b2350add92ae9d303d5ce1590fd93e1f392..63f5efa428707a23f854e66af3e3551e6b58661e 100644 --- a/library/Class/Url.php +++ b/library/Class/Url.php @@ -68,12 +68,15 @@ class Class_Url { public function absoluteUrl($url_array_or_string = [], $name = null, $reset = false, $encode = true) { $url = $this->prepare($url_array_or_string, $name, $reset, $encode); + if (preg_match('/http[s]?:\/\//', $url)) return $url; if ((!static::$_do_not_add_base_url) && BASE_URL && (0 !== strpos($url, BASE_URL))) $url = BASE_URL . ($url[0] == '/' ? $url : '/'.$url); + $url = ($url[0] == '/' ? $url : '/'.$url); + return 'http://' . $_SERVER['SERVER_NAME'] . $url; } diff --git a/library/Class/WebService/AllServices.php b/library/Class/WebService/AllServices.php index a2d5babee2af2bc57abee7611844429c0a6b2304..b11bed6d6e249ef533f2500966c80095f562eab5 100644 --- a/library/Class/WebService/AllServices.php +++ b/library/Class/WebService/AllServices.php @@ -22,6 +22,8 @@ class Class_WebService_AllServices { const RETOUR_SERVICE_OK = 2; + const SVC_API = '2.0'; + private static $_http_client; private $services = [ @@ -151,6 +153,7 @@ class Class_WebService_AllServices { $args = array(); $args['src'] = self::createSecurityKey(); + $args['api'] = self::SVC_API; $args['action'] = $service; return json_decode(self::httpGet($url_service, $args), diff --git a/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php b/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php index 457cdc82b417735f51081c14ab1d5aee5975d4ff..335cded0ae8d836008a4dde42575653bdba9f587 100644 --- a/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.php +++ b/library/Class/WebService/SIGB/Orphee/GetLstDmtResponseReader.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 */ class Class_WebService_SIGB_Orphee_GetLstDmtResponseReader extends Class_WebService_SIGB_AbstractXMLNoticeReader { @@ -26,17 +26,17 @@ class Class_WebService_SIGB_Orphee_GetLstDmtResponseReader extends Class_WebServ const CODE_SITUTATION_CATALOGAGE = 17; protected $_allow_hold_available_items; - + /** * @return Class_WebService_SIGB_Orphee_GetLstDmtResponseReader */ - public static function newInstance($allow_hold_available_items) { + public static function newInstance($allow_hold_available_items=null) { return new self($allow_hold_available_items); } public function __construct($allow_hold_available_items=null) { $this->_allow_hold_available_items = $allow_hold_available_items; - } + } public function startDocuments() { @@ -69,7 +69,7 @@ class Class_WebService_SIGB_Orphee_GetLstDmtResponseReader extends Class_WebServ $this->_current_exemplaire->setDisponibilite(trim($data)); } - + public function endSit($data) { $reservable = ($data==self::CODE_SITUTATION_SORTI || $data==self::CODE_SITUTATION_RESERVE); $this->_current_exemplaire->setReservable($reservable); diff --git a/library/Class/WebService/SIGB/Orphee/Service.php b/library/Class/WebService/SIGB/Orphee/Service.php index b3bb15d4008ae46d2121cf01a5dd9c7ae7edf887..eff4c98be848fe21d726da5c7488bbc9f1288cdd 100644 --- a/library/Class/WebService/SIGB/Orphee/Service.php +++ b/library/Class/WebService/SIGB/Orphee/Service.php @@ -299,13 +299,15 @@ class Class_WebService_SIGB_Orphee_Service extends Class_WebService_SIGB_Abstrac class Class_WebService_SIGB_Orphee_XMLFilter { public static function filter($xml) { $xml = trim($xml); + + // New Orphee version fixes CDATA escaping of XML response (see http://forge.afi-sa.fr/issues/23734 ) + if (0 !== strpos($xml, '<![CDATA')) + return $xml; + $xml = preg_replace('/<!\[CDATA\[+/', '', $xml); $xml = preg_replace('/\]+>+/', '', $xml); return $xml; - if (substr($xml, 0, 9)== '<![CDATA[') - return substr($xml, 9, -3); - } } diff --git a/library/Class/WebService/SIGB/Pergame/Service.php b/library/Class/WebService/SIGB/Pergame/Service.php index fc17cb5494df982fe8e0d94dce370f9b8481f554..b0e927fe225001896b8f263ae0a4da4c8a773b9f 100644 --- a/library/Class/WebService/SIGB/Pergame/Service.php +++ b/library/Class/WebService/SIGB/Pergame/Service.php @@ -64,7 +64,7 @@ class Class_WebService_SIGB_Pergame_Service extends Class_WebService_SIGB_Abstra public function getUserAnnexe($user) { - return null; + return $user->getIdSite(); } diff --git a/library/Class/WebService/Vignette.php b/library/Class/WebService/Vignette.php index 34f61132cecc0c49fcb5227af67b0527459d85f7..abca3011ce1c08f63177a1e1561e16e92140cde3 100644 --- a/library/Class/WebService/Vignette.php +++ b/library/Class/WebService/Vignette.php @@ -63,7 +63,12 @@ class Class_WebService_Vignette extends Class_WebService_Abstract { public static function getAjaxUrl($notice) { $clef_controle = Class_WebService_Vignette::getClefControle(); - return BASE_URL."/recherche/vignette?clef=".$clef_controle."%26id_notice=".$notice->getId(); + return Class_Url::assemble(['controller' => 'recherche', + 'action' => 'vignette', + 'clef' => $clef_controle, + 'id_notice' => $notice->getId()], + null, + true); } //------------------------------------------------------------------------------------------------------ diff --git a/library/Trait/Indexable.php b/library/Trait/Indexable.php index cbd2bf6b39f14159115e6efb15240700df016632..5663aed85ffaed3ac04e4d49af9941939afcdda3 100644 --- a/library/Trait/Indexable.php +++ b/library/Trait/Indexable.php @@ -44,13 +44,18 @@ trait Trait_Indexable { Class_NoticeDomain::deleteBy(['record_alpha_key' => $alpha_key, 'domain_id' => $to_delete]); - foreach(array_diff($domains_ids, $existing_ids) as $domain_id) { + $to_create = array_diff($domains_ids, $existing_ids); + + foreach($to_create as $domain_id) { $notice_domain = Class_NoticeDomain::newInstance(['domain_id' => $domain_id, 'record_alpha_key' => $alpha_key]); - $notice_domain->save(); $notice_domain->updateFacette(); + $notice_domain->save(); } + foreach(Class_NoticeDomain::findAllBy(['record_alpha_key' => $alpha_key]) as $notice_domain) + $notice_domain->updateFacette(); + return $this; } diff --git a/library/Trait/TimeSource.php b/library/Trait/TimeSource.php index e4be4f6aa7de04bc1ef4ab362880a61f444c6a87..93637558e061449d967bfc2440c2778de33e028f 100644 --- a/library/Trait/TimeSource.php +++ b/library/Trait/TimeSource.php @@ -42,6 +42,10 @@ trait Trait_TimeSource { return date('Y-m-d',self::getTimeSource()->time()); } + public static function getCurrentDateTime() { + return date('Y-m-d H:i:s',self::getTimeSource()->time()); + } + /** @return Class_TimeSource */ public static function getTimeSource() { diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode.php index d7a7604b869ca8c3cb2da3aabd3993a6e6247164..eddc062b2fbc73bbaefde9f3c7b994072b1059c9 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode.php @@ -30,7 +30,7 @@ class ZendAfi_Controller_Action_Helper_ListViewMode extends Zend_Controller_Acti $helper_class = 'ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_'.ucfirst($strategy); return $list - ->setStrategy(new $helper_class()) + ->setStrategy(new $helper_class($this)) ->buildList(); } diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/List.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/List.php index a9fb5b50b2746d4b2d9026c7d011894850a49e38..de34816f7ddcd45934fd9ca30a952dd0d6ddc8d6 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode/List.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/List.php @@ -176,6 +176,11 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_List { } + public function countRecursiveItemsFor($model) { + return $this->_strategy->countRecursiveItemsFor($model); + } + + public function getBreadcrumbFor($model) { return $this->_strategy->getBreadcrumbFor($model); } @@ -231,4 +236,11 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_List { public function isSearchEnabled() { return $this->_strategy->isSearchEnabled(); } + + + public function getUrlParams($model) { + return $this->_strategy->getUrlParams($model); + + } + } diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy.php index 7b5b68ccc7eb0f41b218c7676da4ac3730d2f99c..e25945f32b6821046951ac45229bb84cee2695a0 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy.php @@ -27,6 +27,13 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy { protected $_visitor; + protected $_helper; + + + public function __construct($helper) { + $this->_helper = $helper; + } + public function visit($visitor) { $this->_visitor = $visitor; @@ -42,15 +49,20 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy { 'title_search' => '']; } + protected function _shouldCheckParent($start_key,$model) { + return ($start_key && ($this->getRequestParam($start_key,'')==$model->getId())); + } + - public function getBreadcrumbFor($model, $breadcrumb = []) { + public function getBreadcrumbFor($model, $breadcrumb = [],$start_key='') { if(!$model) return $breadcrumb; - if($parent = $model->getParentCategorie()) - $breadcrumb = $this->getBreadcrumbFor($parent, $breadcrumb); + if (!$this->_shouldCheckParent($start_key,$model) && $parent = $model->getParentCategorie()) + $breadcrumb = $this->getBreadcrumbFor($parent, $breadcrumb,$start_key); - $breadcrumb[] = ['url' => array_merge($this->getBreadcrumbUrl(),[$this->getParamKey() => $model->getId()]), + $breadcrumb[] = ['url' => array_merge($this->getBreadcrumbUrl(), + [$this->getParamKey() => $model->getId()]), 'label' => $model->getLibelle(), 'options' => []]; @@ -82,14 +94,15 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy { $params = $this->_visitor->getSearchValue() ? $this->getSearchParams() - : [$this->getParamKey() => $cat_id]; + : new ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_SearchParams([$this->getParamKey() => $cat_id]); - return array_merge($params, $default_params); + $params->addAll($default_params); + return $params; } protected function getSearchParams() { - return ['where' => 'titre like \'%' . trim($this->_visitor->getSearch()) . '%\'']; + return ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_SearchParams::where('titre like \'%' . trim($this->_visitor->getSearch()) . '%\''); } @@ -152,5 +165,20 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy { public function getItemsLabelAttrib() { return ''; } + + + public function getRequestParam($key, $default = null) { + return $this->_helper->getRequest()->getParam($key, $default); + } + + public function countRecursiveItemsFor($model) { + return $this->countItemsFor($model); + } + + public function getUrlParams($model) { + return array_merge($params,$this->getBaseUrl(), + [ $this->getParamKey() => $model->getId()]); + + } } ?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Album.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Album.php index 80b99be0585b8b22f5c8d1f7529c8cddded84256..0c3b399359caa2c1e0235e61f3672dec75355afe 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Album.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Album.php @@ -57,12 +57,12 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Album extends ZendA public function getItems() { - return Class_Album::findAllBy($this->getItemsParams()); + return $this->getItemsParams()->findItemsOfClass('Class_Album'); } public function getCountSearchResult() { - return Class_Album::countBy($this->getSearchParams()); + return $this->getSearchParams()->countItemsOfClass('Class_Album'); } diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Article.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Article.php index 2e72b725c3b125a16c7e402959658bbb27afbc3f..50d203059dc5355f6d2860a69f6bc067c86bbdc6 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Article.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Article.php @@ -85,7 +85,7 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Article extends Zen public function getItems() { - return Class_Article::findAllBy($this->getItemsParams()); + return $this->getItemsParams()->findItemsOfClass('Class_Article'); } @@ -101,7 +101,8 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Article extends Zen $filtred_categories = null; $params = parent::getSearchParams(); - return array_merge($params, ['id_cat' => $this->_filtred_categories_ids]); + $params->offsetSet('id_cat', $this->_filtred_categories_ids); + return $params; } @@ -111,7 +112,7 @@ class ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Article extends Zen public function getCountSearchResult() { - return Class_Article::countBy($this->getSearchParams()); + return $this->getSearchParams()->countItemsOfClass('Class_Article'); } diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/SearchParams.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/SearchParams.php new file mode 100644 index 0000000000000000000000000000000000000000..2c5408c613e2eddc7445cb2ead55a8ac2a860382 --- /dev/null +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/SearchParams.php @@ -0,0 +1,50 @@ +<?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 ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_SearchParams extends Storm_Collection { + public static function where($where) { + return new static(['where' => $where]); + } + + + public function addAll($collection) { + foreach($collection as $key => $value) + $this->offsetSet($key, $value); + return $collection; + } + + + public function getFilteredArrayCopy() { + return array_filter($this->getArrayCopy()); + } + + + public function findItemsOfClass($class_name) { + return $class_name::getLoader()->findAllBy($this->getFilteredArrayCopy()); + } + + + public function countItemsOfClass($class_name) { + return $class_name::getLoader()->countBy($this->getFilteredArrayCopy()); + } +} + +?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Sitotheque.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Sitotheque.php new file mode 100644 index 0000000000000000000000000000000000000000..3f66553621d0bebc319578c5286ab8daabe06c49 --- /dev/null +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Strategy/Sitotheque.php @@ -0,0 +1,162 @@ +<?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 ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_Sitotheque extends ZendAfi_Controller_Action_Helper_ListViewMode_Strategy { + + const ITEMS_PAGINATION = 5; + protected $_filtred_categories, + $_filtred_categories_ids, + $_current_bib; + + public function getBaseUrl() { + return ['module' => 'opac', + 'controller' => 'sito', + 'action' => 'viewcategory']; + } + + + public function getSearchUrl() { + return $this->getBaseUrl() + ['title_search' => '']; + } + + + public function getBreadcrumbUrl() { + return array_merge($this->getStartParams(), + $this->getBaseUrl()); + } + + + public function getParamKey() { + return 'id_cat'; + } + + + public function getUrlParams($model) { + return array_merge($this->getStartParams(), + $this->getBaseUrl(), + [$this->getParamKey() => $model->getId()]); + } + + + protected function getStartParams() { + return ($start_cat = $this->getRequestParam('start_cat')) ? + ['start_cat' => $start_cat] : []; + } + + + public function getCategories() { + $categories = (!$id_cat = $this->_visitor->getParams()['id_cat']) + ? Class_SitothequeCategorie::findAll() + : Class_SitothequeCategorie::findAllBy(['id_cat_mere' => $id_cat]); + + return $categories; + } + + + public function getItems() { + return Class_Sitotheque::findAllBy(array_merge(['order' => 'date_maj desc'], + (array)$this->getItemsParams())); + } + + + public function getCountSearchResult() { + return Class_Article::countBy(parent::getSearchParams()); + } + + + public function getBreadcrumb() { + $breadcrumb = []; + if($this->_visitor->getSearchValue()) + return $breadcrumb; + + return array_merge($breadcrumb, + $this->getBreadcrumbFor($this->_visitor->getModel(), + [], + 'start_cat')); + } + + + protected function _shiftBreadcrumb($breadcrumb = []) { + $start_cat = $this->getRequestParam('start_cat'); + foreach ($breadcrumb as $cat) { + if ($cat['url']['id_cat'] != $start_cat) { + array_shift($breadcrumb); + return $breadcrumb;} + } + + return $breadcrumb; + } + + + public function getDefaultModel() { + return Class_SitothequeCategorie::find($this->_visitor->getParams()['id_cat']); + + } + + + public function countItemsFor($model) { + $id = $model ? $model->getId() : 0; + return Class_Sitotheque::countBy([$this->getParamKey() => $id]); + } + + + public function countRecursiveItemsFor($model) { + if (!$model) + return Class_Sitotheque::count(); + + $ids = array_map(function($cat) {return $cat->getId();}, + $model->getRecursiveSousCategories()); + + $ids[] = $model->getId(); + return Class_Sitotheque::countBy([$this->getParamKey() => $ids]); + } + + + public function getCategoriesCols() { + return [$this->_('Catégories d\'articles')]; + } + + + public function getCategoriesLabelAttrib() { + return 'libelle'; + } + + + public function getCategoriesId() { + return 'sitotheque-category'; + } + + + public function getItemsId() { + return 'sitotheque'; + } + + + public function getItemsCols() { + return [$this->_('Liste des articles')]; + } + + + public function getItemsLabelAttrib() { + return 'titre'; + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/DomainWidget.php b/library/ZendAfi/Form/Configuration/DomainWidget.php index 2381b018b7e2654c4f2e3ee4dc7c24cd7be38a1b..9d7ca88a6f801de326329eb5a5541d7d46162917 100644 --- a/library/ZendAfi/Form/Configuration/DomainWidget.php +++ b/library/ZendAfi/Form/Configuration/DomainWidget.php @@ -58,7 +58,12 @@ class ZendAfi_Form_Configuration_DomainWidget extends ZendAfi_Form { Class_Profil::getCurrentProfil()))->toArray()]) ->addElement('domainSelect', 'root_domain_id', - ['label' => $this->_('Choisissez le domaine de départ')]) + ['label' => $this->_('Choisissez le domaine de départ. Les domaines sélectionnables sont ceux qui ont des sous-domaines.'), + 'multiple_selection' => false, + 'items_selectable' => false, + 'url' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'browsable-domains'])]) ->addElement('select', 'display_mode', ['label' => $this->_('Format'), diff --git a/library/ZendAfi/Form/Decorator/DomainSelect.php b/library/ZendAfi/Form/Decorator/DomainSelect.php index 0f5bcc59a4f7fb6c4ea61553571db6498df9a49c..38cebe3d1147b991f1e7dd848355430a2966a873 100644 --- a/library/ZendAfi/Form/Decorator/DomainSelect.php +++ b/library/ZendAfi/Form/Decorator/DomainSelect.php @@ -23,18 +23,27 @@ class ZendAfi_Form_Decorator_DomainSelect extends Zend_Form_Decorator_Abstract { public function render($content) { - return $this->_element + $url = $this->_element->getUrl() ? $this->_element->getUrl() : $this->_element->getView()->url(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'domaines']); + + $tree_select = $this->_element ->getView() - ->getHelper('TreeSelect') + ->getHelper('TreeSelect'); + + if(false === $this->_element->getMultipleSelection()) + $tree_select->disableMultipleSelection(); + + if(false === $this->_element->getItemsSelectable()) + $tree_select->itemsNotSelectable(); + + return $tree_select ->treeSelect('', $this->_element->getValue(), true, - $this->_element->getView()->url(['module' => 'admin', - 'controller' => 'catalogue', - 'action' => 'domaines']), + $url, 'form', - $this->_element->getName() - ); + $this->_element->getName()); } } ?> diff --git a/library/ZendAfi/Form/Element/DomainSelect.php b/library/ZendAfi/Form/Element/DomainSelect.php index b5914a1b50894c0737d5e894331af5020648941a..d67680eab3cf935773b4537c5c8c21568962afde 100644 --- a/library/ZendAfi/Form/Element/DomainSelect.php +++ b/library/ZendAfi/Form/Element/DomainSelect.php @@ -22,8 +22,12 @@ class ZendAfi_Form_Element_DomainSelect extends Zend_Form_Element { + protected $url, $multiple_selection, $items_selectable; + + public function __construct($spec, $options=null) { parent::__construct($spec, $options); + $decorators = $this->_decorators; $this->_decorators = ['DomainSelect' => new ZendAfi_Form_Decorator_DomainSelect()]; @@ -31,5 +35,21 @@ class ZendAfi_Form_Element_DomainSelect extends Zend_Form_Element { $this->_decorators[$name] = $value; $this->removeDecorator('ViewHelper'); } + + + public function getUrl() { + return $this->url; + } + + + public function getMultipleSelection() { + return $this->multiple_selection; + } + + + public function getItemsSelectable() { + return $this->items_selectable; + } + } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Base.php b/library/ZendAfi/View/Helper/Accueil/Base.php index 9dab4f3b53e64dbf623e04d490ba036f065c708e..d145397e3cee706ecdecedc4a6596e70b63e8863 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -18,10 +18,7 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// OPAC 3 : classe de base pour le gestion des modules de la page D'ACCUEIL -// -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstract { protected static $modules_config; @@ -58,13 +55,6 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac } - public function setPreference($name, $value) { - $this->preferences[$name] = $value; - return $this; - } - - - public function setIdMenu($id_menu) { $this->_id_menu = $id_menu; return $this; @@ -93,11 +83,6 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac } - public function getPreferences() { - return $this->preferences; - } - - public static function getComboTemplates($valeur_select, $profil=null) { if (!$profil) $profil = Class_Profil::getCurrentProfil(); @@ -287,7 +272,12 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac else $html=$html_array["TITRE"].BR.$html_array["CONTENU"]; - return '<div id="boite_'.$this->id_module.'" class="boite '.strtolower($this->type_module).'">'.$html.'</div>'; + return '<div id="' . $this->_getBoxId() . '" class="boite '.strtolower($this->type_module).'">'.$html.'</div>'; + } + + + protected function _getBoxId() { + return 'boite_' . $this->id_module; } diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php index d464440a47955463750f933dd0a592c5dd6702d2..c5457f290d0c7ce8e1f5feea9f9c866751b2d6b8 100644 --- a/library/ZendAfi/View/Helper/Accueil/Sito.php +++ b/library/ZendAfi/View/Helper/Accueil/Sito.php @@ -20,10 +20,20 @@ */ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base { + const ORDER_RANDOM = 'Random'; + const ORDER_SELECTION = 'Selection'; + + const DISPLAY_SELECTION = 1; + const DISPLAY_NOVELTY = 2; + const DISPLAY_HIERARCHY = 3; + + protected $sitotree_helper; + protected function _renderHeadScriptsOn($script_loader) { - if ($this->isGroupByCategorie()) + if ($this->isGroupByCategorie() + && !$this->isHierarchicalDisplay()) Class_ScriptLoader::getInstance() - ->addJQueryReady('$("ul.sitotheque>li>h2>a").click( + ->addJQueryReady('$("#'.$this->_getBoxId() .' ul.sitotheque>li>h2>a").click( function(event){ event.preventDefault(); $(this).closest("li").find("ul").slideToggle(); @@ -32,78 +42,108 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base public function getHtml() { - extract($this->preferences); + $this->sitotree_helper = $this->view->getHelper('SitoTree'); + $contenu = ''; - $nb_aff = $this->preferences['nb_aff']; + $nb_aff = $this->getPreference('nb_aff'); + + $box_title = $this->getPreference('titre') ? + $this->getPreference('titre') : $this->_('Derniers sites ajoutés'); + + if ($this->isHierarchicalDisplay()) { + $this->contenu = $this->sitotree_helper + ->sitoTree($this->getPreference('id_categorie')); + $this->titre = $box_title; + return $this->getHtmlArray(); + } + - if ($this->isTypeAffichageSelection()) { - $sites = Class_Sitotheque::getSitesFromIdsAndCategories( - explode('-', $this->preferences['id_items']), - explode('-', $this->preferences['id_categorie'])); + if ($this->isTypeAffichageSelection()) { + $sites = Class_Sitotheque::getSitesFromIdsAndCategories(explode('-', $this->getPreference('id_items')), + explode('-', $this->getPreference('id_categorie'))); - if ($this->preferences['display_order'] == 'Random') + if (static::ORDER_RANDOM == $this->getPreference('display_order')) shuffle($sites); - if ($this->preferences['display_order'] == 'Selection') + if (static::ORDER_SELECTION == $this->getPreference('display_order')) $nb_aff = count($sites); - $titre = sprintf('<a href="%s" title="%s">%s</a>', - htmlspecialchars(BASE_URL.'/opac/sito/viewselection/id_module/'.$this->id_module), - $this->translate()->_('Sélection de sites'), - $titre); + $this->titre = $this->renderTitleLink($box_title, + $this->_('Sélection de sites'), + $this->view->url(['module' => 'opac', + 'controller' => 'sito', + 'action' => 'viewselection', + 'id_module' => $this->id_module], + null, true)); } if ($this->isTypeAffichagePlusRecents() && $nb_aff > 0) { - $sites = Class_Sitotheque::findAllBy(['limit' => 50]); - shuffle($sites); + $sites = Class_Sitotheque::findAllBy(['order' => 'date_maj desc', + 'limit' => 50]); - if(!$titre) - $titre = $this->translate()->_("Derniers sites ajoutés"); + if (static::ORDER_RANDOM == $this->getPreference('display_order')) + shuffle($sites); - $titre = sprintf('<a href="%s" title="%s">%s</a>', - htmlspecialchars(BASE_URL.'/opac/sito/viewrecent/nb/50'), - $this->translate()->_('Liste des derniers sites ajoutés'), - $titre); + $this->titre = $this->renderTitleLink($box_title, + $this->_('Liste des derniers sites ajoutés'), + $this->view->url(['controller' => 'sito', + 'action' => 'viewrecent', + 'nb' => 50], + null,true)); } - $this->titre = $titre; $this->contenu = $this->renderSitesSlice($sites, $nb_aff); return $this->getHtmlArray(); } + public function renderTitleLink($content, $title, $url) { + return $this->view->tagAnchor($url, $content, ['title' => $this->translate()->_($title)]); + } + + public function isTypeAffichageSelection() { - return $this->preferences['type_aff'] == 1; + return $this->_isDisplayType(static::DISPLAY_SELECTION); } public function isTypeAffichagePlusRecents() { - return $this->preferences['type_aff'] == 2; + return $this->_isDisplayType(static::DISPLAY_NOVELTY); } - public function isGroupByCategorie() { - if (!array_isset('group_by_categorie', $this->preferences)) - return false; + public function isHierarchicalDisplay() { + return $this->_isDisplayType(static::DISPLAY_HIERARCHY); + } - return $this->preferences['group_by_categorie'] == true; + + protected function _isDisplayType($type) { + return $this->getPreference('type_aff') == $type; + } + + + public function isGroupByCategorie() { + return (array_isset('group_by_categorie', $this->preferences) + && true == $this->getPreference('group_by_categorie')); } public function groupSitesByCategorie($sites) { - $categories = array(); + $categories = []; foreach ($sites as $site) { $categorie = $site->getCategorieLibelle(); if (!array_isset($categorie, $categories)) - $categories[$categorie] = array(); - $categories[$categorie] []= $site; + $categories[$categorie] = []; + $categories[$categorie][] = $site; } + return $categories; } - protected function renderSitesSlice($sites,$nb_aff) { - if(!$sites) return ""; + protected function renderSitesSlice($sites, $nb_aff) { + if (!$sites) + return ''; $sites = array_slice($sites, 0, $nb_aff); @@ -111,45 +151,39 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base return $this->renderSites($sites); $categories = $this->groupSitesByCategorie($sites); - $htmls = array(); + $htmls = []; foreach ($categories as $libelle_categorie => $sites) - $htmls []= sprintf('<li><h2><a href="#">%s</a></h2><ul><li>%s</li></ul></li>', - $libelle_categorie, - $this->renderSites($sites)); + $htmls[] = $this->_renderGroup($libelle_categorie, $sites); - return sprintf('<ul class="sitotheque">%s</ul>', - implode('', $htmls)); + return $this->_tag('ul', implode('', $htmls), + ['class' => 'sitotheque']); } - protected function renderSites($sites) { - return implode('', array_map([$this, 'renderSite'], $sites)); + protected function _renderGroup($label, $sites) { + return $this->_tag('li', + $this->_tag('h2', + $this->_tag('a', $label, ['href' => '#'])) + . $this->_tag('ul', + $this->_tag('li', $this->renderSites($sites)))); } - protected function renderSite($site) { - if($this->division == 1) { - $site->setDescription($this->extractHeader($site->getDescription())); - } - - $html = sprintf('<h2><a href="%s" title="%s">', - $site->getUrl(), - $this->translate()->_('Aller sur le site')); - - if ($img_url = $this->getThumbnail($site->getUrl())) - $html.= sprintf('<img src="%s" alt="%s" />',$img_url, $this->translate()->_('vignette du site %s', $site->getTitre())); + protected function renderSites($sites) { + return implode('', array_map([$this, 'renderSiteDiv'], $sites)); + } - $html .= $site->getTitre().'</a></h2>'; - $html .= $site->getDescription(); - return '<div class="sitotheque">'.$html.'</div>'; + protected function renderSiteDiv($site) { + return $this->_tag('div', $this->renderSite($site), + ['class' => 'sitotheque']); } - public function getThumbnail($url) { - if (!isset($this->thumbnails_helper)) - $this->thumbnails_helper = (new ZendAfi_View_Helper_WebThumbnail()) - ->setView($this->view); - return $this->thumbnails_helper->webThumbnail($url); + protected function renderSite($site) { + if ($this->division == 1) + $site->setDescription($this->extractHeader($site->getDescription())); + + return $this->sitotree_helper->renderSite($site); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/ListViewMode.php b/library/ZendAfi/View/Helper/Admin/ListViewMode.php index 4b39f5c405ea83bed44dfd62fc98eb7a6c487798..32f451b8131301990fbd94ebbcccd11b48fe56c3 100644 --- a/library/ZendAfi/View/Helper/Admin/ListViewMode.php +++ b/library/ZendAfi/View/Helper/Admin/ListViewMode.php @@ -37,6 +37,7 @@ class ZendAfi_View_Helper_Admin_ListViewMode extends ZendAfi_View_Helper_BaseHel } + protected function getSearchFormHTML() { if(!$this->_list->isSearchEnabled()) return ''; diff --git a/library/ZendAfi/View/Helper/Article/FormulairesCsvVisitor.php b/library/ZendAfi/View/Helper/Article/FormulairesCsvVisitor.php index 1fd44145f0d1c35d90f283a2ae0f0fab2553548c..10f195ea79052f44a8e535adf20ab0e491c5420e 100644 --- a/library/ZendAfi/View/Helper/Article/FormulairesCsvVisitor.php +++ b/library/ZendAfi/View/Helper/Article/FormulairesCsvVisitor.php @@ -16,30 +16,27 @@ * * 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_Article_FormulairesCsvVisitor extends Zend_View_Helper_Json { public function article_formulairesCsvVisitor($article) { - $filename = PATH_TEMP.'formulaires.csv'; - $fp_csv = fopen($filename, 'w'); + $fp_csv = fopen('php://memory', 'r+'); $formulaires = $article->getFormulaires(); $data_names = Class_Formulaire::mergeDataNames($formulaires); fputcsv($fp_csv, array_merge(['date_creation', 'compte', 'libelle_bib'], $data_names),';'); foreach($formulaires as $formulaire) { - $datas = [$formulaire->getDateCreation(), - $formulaire->getCompte(), + $datas = [$formulaire->getDateCreation(), + $formulaire->getCompte(), $formulaire->getLibelleBib()]; foreach($data_names as $name) $datas[]=$formulaire->getDataNamed($name); fputcsv($fp_csv, $datas,';'); } - - fclose($fp_csv); - - return file_get_contents($filename); + rewind($fp_csv); + return stream_get_contents($fp_csv); } } diff --git a/library/ZendAfi/View/Helper/Biographie.php b/library/ZendAfi/View/Helper/Biographie.php index 54dcb94453b057dfa4b54c055acfa4aa7322486b..2071d1496ceb8e5b87ec21f8c2e5e2f083a35fc8 100644 --- a/library/ZendAfi/View/Helper/Biographie.php +++ b/library/ZendAfi/View/Helper/Biographie.php @@ -59,11 +59,18 @@ class ZendAfi_View_Helper_Biographie extends ZendAfi_View_Helper_BaseHelper { $data['biographie'] = []; } + $source = $this->view->tag('p', $this->view->_('Source'). ' : ' . $data['source']); + $biographie = $data['biographie']; + + if(!is_array($biographie) && preg_match("/<[^<]+>/", $biographie) != 0) + return $source . $biographie; + $auteur = $notice->getAuteurPrincipal(); $content = $this->_renderTitle($auteur, $data['source']); $suite = false; + foreach ($data['biographie'] as $ligne) { $content .= $this->_renderBio($ligne, $suite, $data, $auteur, $notice); $suite = true; diff --git a/library/ZendAfi/View/Helper/Menu/Profil.php b/library/ZendAfi/View/Helper/Menu/Profil.php index c759646e3562a785943f9234ee972309a32b14dc..40e14574e356e4155cd38844144a6bba8e77fc77 100644 --- a/library/ZendAfi/View/Helper/Menu/Profil.php +++ b/library/ZendAfi/View/Helper/Menu/Profil.php @@ -16,14 +16,15 @@ * * 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_Menu_Profil extends ZendAfi_View_Helper_Menu_Entry { public function getBoite($li_class = '') { - return (Class_Profil::getCurrentProfil()->getId() == (int)$this->_preferences['clef_profil']) - ? parent::getBoite(trim($li_class.' selected_profil')) - : parent::getBoite($li_class); + if (isset($this->_preferences['clef_profil']) && + (Class_Profil::getCurrentProfil()->getId() == (int)$this->_preferences['clef_profil'])) + return parent::getBoite(trim($li_class.' selected_profil')); + return parent::getBoite($li_class); } } diff --git a/library/ZendAfi/View/Helper/ModuleAbstract.php b/library/ZendAfi/View/Helper/ModuleAbstract.php index f3419b75f08ce484d2ae98c542c821fe5ac5cc2c..474d3fc75e380dbc790549985410ed156a50d2cd 100644 --- a/library/ZendAfi/View/Helper/ModuleAbstract.php +++ b/library/ZendAfi/View/Helper/ModuleAbstract.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 */ abstract class ZendAfi_View_Helper_ModuleAbstract extends ZendAfi_View_Helper_BaseHelper { @@ -40,6 +40,23 @@ abstract class ZendAfi_View_Helper_ModuleAbstract extends ZendAfi_View_Helper_Ba } + public function getPreference($name, $default=null) { + return array_key_exists($name, $this->preferences) ? + $this->preferences[$name] : $default; + } + + + public function setPreference($name, $value) { + $this->preferences[$name] = $value; + return $this; + } + + + public function getPreferences() { + return $this->preferences; + } + + /** * @return string le contenu au format HTML */ diff --git a/library/ZendAfi/View/Helper/Notice/Abstract.php b/library/ZendAfi/View/Helper/Notice/Abstract.php index c0aab4fb7f3e7913fbe3ddeb54085a03a4ac24af..7ad9ffc1edde11d092a94074e59698f9c561eb5c 100644 --- a/library/ZendAfi/View/Helper/Notice/Abstract.php +++ b/library/ZendAfi/View/Helper/Notice/Abstract.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 */ abstract class ZendAfi_View_Helper_Notice_Abstract extends Zend_View_Helper_HtmlElement { use Trait_Translator; @@ -26,13 +26,14 @@ abstract class ZendAfi_View_Helper_Notice_Abstract extends Zend_View_Helper_Html const ONGLET = 3; - protected function getOnclick($rubrique,$isbn,$id_onglet) { - $_SESSION["onglets"][$rubrique]=$id_onglet; - return sprintf("(this.id,'%s','%s',0,'',%d, '%s')", - is_array($isbn) ? $isbn["isbn"] : $isbn, - $rubrique, + protected function getOnclick($rubrique, $notice, $id_onglet) { + return sprintf("(this.id,'%s','%s',0,'',%d, '%s')", + $notice->getIsbn(), + $rubrique, in_array($rubrique, ['avis', 'exemplaires']) ? 1 : 0, - $this->view->absoluteUrl(['controller' => 'noticeajax', 'action' => $rubrique])); + $this->view->absoluteUrl(['controller' => 'noticeajax', + 'action' => $rubrique, + 'id' => $notice->getId()])); } @@ -41,7 +42,7 @@ abstract class ZendAfi_View_Helper_Notice_Abstract extends Zend_View_Helper_Html $onglets = []; foreach($preferences['onglets'] as $nom => $config) { - if (!in_array((int)$config['aff'], $aff_values)) + if (!in_array((int)$config['aff'], $aff_values)) continue; $onglet = Class_Codification::getInstance()->getOnglet($nom); @@ -53,8 +54,8 @@ abstract class ZendAfi_View_Helper_Notice_Abstract extends Zend_View_Helper_Html if ($onglet->callDisplayMethod($notice)) $onglets[] = $onglet; } - - uasort($onglets, + + uasort($onglets, function($cfg_a, $cfg_b) { return (int)$cfg_a->getOrder() - (int)$cfg_b->getOrder(); }); diff --git a/library/ZendAfi/View/Helper/Notice/Blocs.php b/library/ZendAfi/View/Helper/Notice/Blocs.php index ab2a5a68a36a346d3ada8fe97abb3c9af3014d85..6953e88cb2a98063a3ae71e264a1879ad7c58d99 100644 --- a/library/ZendAfi/View/Helper/Notice/Blocs.php +++ b/library/ZendAfi/View/Helper/Notice/Blocs.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 */ class ZendAfi_View_Helper_Notice_Blocs extends ZendAfi_View_Helper_Notice_Abstract { public function notice_Blocs($notice, $preferences) { @@ -30,12 +30,12 @@ class ZendAfi_View_Helper_Notice_Blocs extends ZendAfi_View_Helper_Notice_Abstra public function getBlocsFromPreferences($preferences, $notice) { - return $this->selectOngletsFromPreferences($preferences, - [self::BLOC_DEPLIE, self::BLOC_FERME], + return $this->selectOngletsFromPreferences($preferences, + [self::BLOC_DEPLIE, self::BLOC_FERME], $notice); } - - + + public function renderBlocsForNotice($blocs, $notice) { $id = $notice->getId(); $isbn = $notice->getIsbn(); @@ -47,19 +47,19 @@ class ZendAfi_View_Helper_Notice_Blocs extends ZendAfi_View_Helper_Notice_Abstra foreach($blocs as $bloc) { $type = $bloc->getType(); $id_bloc="bloc_".$id."_".$i++; - $js ='infos_bloc'.$this->getOnclick($type, $isbn, $id_bloc); + $js ='infos_bloc'.$this->getOnclick($type, $notice, $id_bloc); if ((int)$bloc->getDisplayMode()==1) Class_ScriptLoader::getInstance() ->addJQueryReady('infos_bloc'. str_replace('this.id', '"'.$id_bloc.'"', - $this->getOnclick($type, $isbn, $id_bloc))); + $this->getOnclick($type, $notice, $id_bloc))); Class_ScriptLoader::getInstance() ->addJQueryReady('$("#'.$id_bloc.'").click(function(){'.$js.'})'); // Titre - $html.='<div class="'.$type.' block_info_notice">'; + $html.='<div class="'.$type.' block_info_notice">'; $html.='<div id="'.$id_bloc.'" class="notice_bloc_titre"><img id="I'.$id_bloc.'" src="'.URL_IMG.'bouton/plus_carre.gif" alt="Déplier" /><h2>'.$bloc->getLibelle().'</h2></div>'; $html.='<div id="'.$id_bloc.'_contenu_row"></div>'; $html.= '<div id="'.$id_bloc.'_contenu" class="notice_bloc">'; @@ -69,7 +69,7 @@ class ZendAfi_View_Helper_Notice_Blocs extends ZendAfi_View_Helper_Notice_Abstra $html.='</div>'; $html.='</div>'; } - + return $html; } diff --git a/library/ZendAfi/View/Helper/Notice/Onglets.php b/library/ZendAfi/View/Helper/Notice/Onglets.php index 5349cd6fa88e69498be8aeda77c81eec51fd0e50..8322eac79ef76f428ab06657da5f8e8354455f8a 100644 --- a/library/ZendAfi/View/Helper/Notice/Onglets.php +++ b/library/ZendAfi/View/Helper/Notice/Onglets.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 */ class ZendAfi_View_Helper_Notice_Onglets extends ZendAfi_View_Helper_Notice_Abstract { public function notice_Onglets($notice, $preferences) { @@ -34,12 +34,12 @@ class ZendAfi_View_Helper_Notice_Onglets extends ZendAfi_View_Helper_Notice_Abst public function getOngletsFromPreferences($preferences, $notice) { return $this->selectOngletsFromPreferences($preferences, [self::ONGLET], $notice); } - - + + public function renderOngletsForNotice($onglets, $notice) { $id = $notice->getId(); $isbn = $notice->getIsbn(); - + // Html du set $tag_patience ='<div class="notice_patience" style="text-align:right;width:15px"><img src="'.URL_IMG.'patience.gif" alt="'.$this->_('Chargement en cours').'" /></div>'; $tag_patience.='<div class="notice_patience">'.$this->_translate->_('Veuillez patienter : lecture en cours...').'</div>'; @@ -51,27 +51,26 @@ class ZendAfi_View_Helper_Notice_Onglets extends ZendAfi_View_Helper_Notice_Abst $tabs = array(); foreach($onglets as $onglet) { $id_onglet = sprintf('set%d_onglet_%d', $id, $i++); - $js_onclick = $this->getOnclick($onglet->getType(), $isbn, $id_onglet); + $js_onclick = $this->getOnclick($onglet->getType(), $notice, $id_onglet); - if($i==1) + if($i==1) Class_ScriptLoader::getInstance() ->addJQueryReady("infos_onglet". str_replace("this.id", - "'".$id_onglet."'", + "'".$id_onglet."'", $js_onclick)); $html_onglets.= sprintf('<div id="%s" class="titre_onglet" style="width:%d%%" onclick="infos_onglet%s"><h2>%s</h2></div>', $id_onglet, - // $onglet["largeur"] ? $onglet["largeur"] : 20, 20, $js_onclick, $onglet->getLibelle()); // Boite contenu - $html_contenu.=sprintf('<div class="%s" id="%s_contenu_row">%s</div>', + $html_contenu.=sprintf('<div class="%s" id="%s_contenu_row">%s</div>', $onglet->getType(), - $id_onglet, - sprintf('<div id="%s_contenu" class="onglet">%s</div>', - $id_onglet, + $id_onglet, + sprintf('<div id="%s_contenu" class="onglet">%s</div>', + $id_onglet, $tag_patience)); } @@ -81,8 +80,8 @@ class ZendAfi_View_Helper_Notice_Onglets extends ZendAfi_View_Helper_Notice_Abst '<div>%s</div>'. '</div>'. '<div class="onglets_contenu">%s</div>'. - '</div>', - $html_onglets, + '</div>', + $html_onglets, $html_contenu); } diff --git a/library/ZendAfi/View/Helper/PublicListViewMode.php b/library/ZendAfi/View/Helper/PublicListViewMode.php new file mode 100644 index 0000000000000000000000000000000000000000..313c4964b12308ce48f081f83b42d085845abcae --- /dev/null +++ b/library/ZendAfi/View/Helper/PublicListViewMode.php @@ -0,0 +1,85 @@ +<?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 ZendAfi_View_Helper_PublicListViewMode extends ZendAfi_View_Helper_Admin_ListViewMode { + public function publicListViewMode($list) { + if (!$this->_list = $list) + return ''; + + $html = $this->getSearchFormHTML() + . $this->getBreadcrumbHTML() + . $this->getCategoriesHTML() + . $this->getItemsHTML() + . $this->getItemsPaginatorHTML(); + + return $html; + } + + + protected function getCategoriesHTML() { + if($this->_list->getSearchValue()) + return ''; + + $html = ''; + foreach($this->_list->getCategories() as $category) + $html .= $this->getCategoryHtml($category); + + return $this->_tag('ul', $html, + ['class' => $this->_list->getCategoriesId()]); + } + + + protected function getCategoryHtml($category) { + $label_attrib = $this->_list->getCategoriesLabelAttrib(); + $label = sprintf('%s (%s)', + $category->$label_attrib, + $this->_list->countRecursiveItemsFor($category)); + + return $this + ->_tag('li', + $this->_tag('a', $label, + ['href' => $this->view->url($this->_list->getUrlParams($category), + null, true)])); + } + + + protected function getItemsHTML() { + if(!$this->_list->getModel() && !$this->_list->getSearchValue()) + return ''; + + $html = ''; + foreach ($this->_list->getItems() as $item) + $html .= $this->getItemHtml($item); + + return $html; + } + + + protected function getItemHtml($item) { + if (!$item) + return ''; + + return $this->_tag('div', + $this->view->getHelper('SitoTree')->renderSite($item), + ['class' => 'sitotheque']); + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/RenderAlbum.php b/library/ZendAfi/View/Helper/RenderAlbum.php index d5ae5fa2183a31fa870a6e23847905afffc190ed..c7adb5f83f511c265b469c60027815eaed168dc0 100644 --- a/library/ZendAfi/View/Helper/RenderAlbum.php +++ b/library/ZendAfi/View/Helper/RenderAlbum.php @@ -33,7 +33,6 @@ class ZendAfi_View_Helper_RenderAlbum extends Zend_View_Helper_HtmlElement { public function renderAlbumHelper($album) { - if ($album->isLivreNumerique()) { Class_ScriptLoader::getInstance()->loadBooklet($album->getId(), '#resnum'); return ''; diff --git a/library/ZendAfi/View/Helper/SitoTree.php b/library/ZendAfi/View/Helper/SitoTree.php new file mode 100644 index 0000000000000000000000000000000000000000..ba615d26aa22b2e6b16590ecc8e8892007202a0f --- /dev/null +++ b/library/ZendAfi/View/Helper/SitoTree.php @@ -0,0 +1,91 @@ +<?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 ZendAfi_View_Helper_SitoTree extends ZendAfi_View_Helper_BaseHelper { + protected $titre, $contenu, $preferences, $division; + + public function sitoTree($id_category) { + $category = Class_SitothequeCategorie::find($id_category); + return $this->renderHierarchicalCategories($category); + } + + + protected function renderHierarchicalCategories($category) { + if (!$category) + return $this->_('Aucune catégorie sélectionnée.'); + + $html = ''; + $children = $category->getChildren(); + foreach ($children as $child_category) + $html .= $this->renderHierarchicalCategory($child_category); + + foreach ($category->getItems() as $site) + $html .= $this->_tag('li', $this->renderSite($site)); + + return $this->_tag('ul', $html, ['class' => 'sitotheque']); + } + + + protected function renderHierarchicalCategory($category) { + if (!$category) + return ''; + + return $this->_tag('li', $this->_renderCategory($category)); + } + + + protected function _renderCategory($category) { + return $this->_tag('h2', + $this->_tag('a', $category->getLibelle(), + ['href' => $this->_urlOf($category)])); + } + + + protected function _urlOf($category) { + return $this->view->url(['controller' => 'sito', + 'action' => 'viewcategory', + 'id_cat' => $category->getId(), + 'start_cat' => $category->getId()], + null,true); + } + + + public function renderSite($site) { + return $this->_renderLabelOf($site) . $site->getDescription(); + } + + + protected function _renderLabelOf($site) { + return $this->_tag('h2', + $this->_tag('a', + $this->_renderImageOf($site) . $site->getTitre(), + ['href' => $site->getUrl(), + 'title' => $this->_('Aller sur le site %s', + $site->getTitre())])); + } + + + protected function _renderImageOf($site) { + return ($url = $this->view->webThumbnail($site->getUrl())) ? + $this->view->tagImg($url) : ''; + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagList.php b/library/ZendAfi/View/Helper/TagList.php new file mode 100644 index 0000000000000000000000000000000000000000..34261c8be7ebbb69039f297bdf367e8ad6622402 --- /dev/null +++ b/library/ZendAfi/View/Helper/TagList.php @@ -0,0 +1,65 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +class ZendAfi_View_Helper_TagList extends Zend_View_Helper_HtmlElement { + protected $id_list; + + public function tagList($models, $attribs, $id, $callbacks = []) { + $this->id_list=$id; + return $this->renderModelsAsUlLi($models, $attribs, $callbacks); + } + + + + + public function renderModelsAsUlLi($models, $attribs, $callbacks) { + $rows = ''; + + foreach ($models as $model) { + $rows .= $this->renderModelAsUlLi($model, $attribs,$callbacks); + } + + return $rows; + } + + + public function renderModelAsUlLi($model, $attribs, $callbacks) { + $cols = ''; + + $default_callback = function ($model, $attrib) { + return $this->view->escape($model->callGetterByAttributeName($attrib)); + }; + + foreach ($attribs as $attrib) { + $callback = (array_key_exists($attrib, $callbacks)) ? $callbacks[$attrib] : $default_callback; + $cols .= $this->tag('li', $callback($model, $attrib)); + } + + return $this->tag('ul', $cols,['class' => $this->id_list]); + } + + + /** shortcut to $this->view->tag() */ + protected function tag() { + return call_user_func_array([$this->view, 'tag'], func_get_args()); + } +} + +?> diff --git a/library/ZendAfi/View/Helper/TreeSelect.php b/library/ZendAfi/View/Helper/TreeSelect.php index 88af59209f70ca9a1a72c0d08b7197e68e45b996..aeb683d8c383c243ff61d7b1959c43d57cbee3a1 100644 --- a/library/ZendAfi/View/Helper/TreeSelect.php +++ b/library/ZendAfi/View/Helper/TreeSelect.php @@ -25,6 +25,7 @@ class ZendAfi_View_Helper_TreeSelect extends ZendAfi_View_Helper_BaseHelper { protected $_categories_selectable = true, + $_items_selectable = true, $_multiple_selection = true; function treeSelect($id_items = 0, @@ -60,11 +61,19 @@ class ZendAfi_View_Helper_TreeSelect extends ZendAfi_View_Helper_BaseHelper { return $this; } + + function itemsNotSelectable() { + $this->_items_selectable = false; + return $this; + } + + function disableMultipleSelection() { $this->_multiple_selection = false; return $this; } + function getJSTreeSelect(){ $js_id_items = str_replace('-', ',', $this->id_items); $js_id_categories = str_replace('-', ',', $this->id_categories); @@ -87,6 +96,9 @@ CONTENT; if (!$this->_categories_selectable) $content .= "$(\".treeselect\").treeselect('categoriesNotSelectable');"; + if (!$this->_items_selectable) + $content .= "$(\".treeselect\").treeselect('itemsNotSelectable');"; + if (!$this->_multiple_selection) $content .= "$(\".treeselect\").treeselect('disableMultipleSelection');"; diff --git a/library/startup.php b/library/startup.php index f1b4c9f798ac1b2984b88c53ff48a5c46eddf6dc..d87cc4a1e44a83f3c756978a54aadb631a4277de 100644 --- a/library/startup.php +++ b/library/startup.php @@ -64,7 +64,7 @@ function defineConstant($name, $value) { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','7.1'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.28'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.33'); defineConstant('ROOT_PATH', realpath(dirname(__FILE__).'/..').'/'); diff --git a/library/storm b/library/storm index 51910ea44aede08d3d1607ef9fb4e7b955659339..4463df0eb2a3b40f9fa3ca648838bc2865bb710b 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit 51910ea44aede08d3d1607ef9fb4e7b955659339 +Subproject commit 4463df0eb2a3b40f9fa3ca648838bc2865bb710b diff --git a/public/admin/js/treeselect/treeselect.js b/public/admin/js/treeselect/treeselect.js index 1289bbc5586fa517e108a893ccd44092e6347e49..b42b728d00ed7ebc85020c512b67e195df0773b8 100644 --- a/public/admin/js/treeselect/treeselect.js +++ b/public/admin/js/treeselect/treeselect.js @@ -473,6 +473,12 @@ $('li.ui-treeselect-category>input:first-child').remove(); }, + itemsNotSelectable: function() { + $('li.ui-treeselect-item>input:first-child').remove(); + $('li.ui-treeselect-item').attr('style', 'padding-left: 25px'); + }, + + readSelection: function(callback) { callback( this._getSelectedDataByType('item'), diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 08b27b69aa70f29d9c056baabbe01c134d7090e8..41b5169ed3f3ab785f919c4b218cdda966915e99 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -2950,4 +2950,9 @@ a.loan-export { #fieldset-login_form legend { display: none; +} + + +.boite .contenu { + min-height: 20px; } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/AccueilControllerTest.php b/tests/application/modules/admin/controllers/AccueilControllerTest.php index f82c9f25adb18c56d9c720278b5d8d2b7fa6a58e..25620bc3fa7e73df35f7440d972d2cdaac66d2f1 100644 --- a/tests/application/modules/admin/controllers/AccueilControllerTest.php +++ b/tests/application/modules/admin/controllers/AccueilControllerTest.php @@ -209,6 +209,64 @@ class AccueilControllerConfigCalendrierTest extends Admin_AbstractControllerTest +class AccueilControllerConfigSitothequePostTest extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + Class_Profil::beVolatile(); + Class_Profil::getCurrentProfil() + ->updateModuleConfigAccueil(25, + array('type_module' => 'SITO', + 'division' => 1, + 'id_module' => 25, + 'preferences' => ['id_items' => '12-13'])); + + } + + + /** @test */ + public function selectHierachicalDisplayShouldSaveOnlyFirstCategory() { + $this->postDispatch('/admin/accueil/sitotheque?config=accueil&id_profil=1&type_module=SITO&id_module=25', + [ + 'type_aff' => 3, + 'nb_aff' => 2, + 'group_by_categorie' => true, + 'id_categorie' => '12-17' + ]); + + $this->assertEquals('12',Class_Profil::find(1)->getModuleAccueilConfig(25,'SITO')['preferences']['id_categorie']); + + } + + /** @test */ + public function selectHierachicalDisplayShouldForceGroupByCategoryToFalse() { + $this->postDispatch('/admin/accueil/sitotheque?config=accueil&id_profil=1&type_module=SITO&id_module=25', + [ + 'type_aff' => 3, + 'nb_aff' => 2, + 'group_by_categorie' => true, + 'id_categorie' => '12-17' + ]); + + + $this->assertEquals('0', Class_Profil::find(1)->getModuleAccueilConfig(25,'SITO')['preferences']['group_by_categorie']); + + } + /** @test */ + public function selectHierachicalDisplayWithEmptyCategoriesShouldSaveOnlyFirstCategory() { + $this->postDispatch('/admin/accueil/sitotheque?config=accueil&id_profil=1&type_module=SITO&id_module=25', + [ + 'type_aff' => 3, + 'nb_aff' => 2, + 'group_by_categorie' => 0, + 'id_categorie' => '' + ]); + + $this->assertEquals('',Class_Profil::find(1)->getModuleAccueilConfig(25,'SITO')['preferences']['id_categorie']); + + } + + +} class AccueilControllerConfigSitothequeDefaultsTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); @@ -296,6 +354,11 @@ class AccueilControllerConfigSitothequeWithPreferencesTest extends Admin_Abstrac public function displayOrderSelectionShouldBeChecked() { $this->assertXPath('//input[@type="radio"][@name="display_order"][@checked="checked"][@value="Selection"]'); } + +/** @test */ + public function typeHierarchicCanBeSelected() { + $this->assertXPathContentContains('//select[@id="type_aff"]//option[@value=3]','Affichage hiérarchique par catégorie'); + } } diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 0a728269a982c1418732a7dd32fef50945e0ea70..bfffb46bec4621633fb257c9fb366218c4a6bcce 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -1529,4 +1529,70 @@ class CatalogueControllerPaniersRemovePanierAndUnindexTest extends AbstractContr public function pommeShouldNotContainsFacetH1() { $this->assertNotContains('Q98', Class_Notice::find(1456)->getFacettes()); } +} + + + + + +class CatalogueControllerGetBrowsableDomainsJsonTest extends AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Catalogue', + ['id' => 6, + 'libelle' => 'News', + 'indexer' => true]); + + $this->fixture('Class_Catalogue', + ['id' => 3, + 'libelle' => 'Music', + 'sous_domaines' => [$this->fixture('Class_Catalogue', + ['id' => 8, + 'libelle' => 'Rock', + 'indexer' => true]), + $this->fixture('Class_Catalogue', + ['id' => 42, + 'libelle' => 'Heavy', + 'sous-domaines' => [$this->fixture('Class_Catalogue', + ['id' => 31, + 'libelle' => 'Korn', + 'indexer' => true])], + 'indexer' => true])], + 'indexer' => true]); + + $this->dispatch('admin/catalogue/browsable-domains', true); + } + + + /** @test */ + public function domainMusicShouldBePresent() { + $this->assertContains('Music', $this->_response->getBody()); + } + + + /** @test */ + public function domainHeavyShouldBePresent() { + $this->assertContains('Heavy', $this->_response->getBody()); + } + + + /** @test */ + public function domainNewsShouldBeAnItem() { + $this->assertContains('News', $this->_response->getBody()); + } + + + /** @test */ + public function domainRockShouldBeAnItem() { + $this->assertContains('"items":[{"id":8,"label":"Rock"', $this->_response->getBody()); + } + + + /** @test */ + public function domainKornShouldBeAnItem() { + $this->assertContains('"items":[{"id":31,"label":"Korn"', $this->_response->getBody()); + } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php index 61b4e46ad664b808a5921db173ae2e81f7e1b6ff..ae65e0b082c057226a73ada0d1df549514a73764 100644 --- a/tests/application/modules/admin/controllers/CmsControllerListModeTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerListModeTest.php @@ -63,6 +63,7 @@ class CmsControllerListModeAdminRootTest extends CmsControllerListModeTestCase { + class CmsControllerListModeAdminBibRootTest extends CmsControllerListModeTestCase { public function setUp() { parent::setUp(); @@ -87,12 +88,50 @@ class CmsControllerListModeAdminBibRootTest extends CmsControllerListModeTestCas /** @test */ public function shouldDisplayRootCategory() { $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/id_cat/1")]', - 'Root'); + 'Root', + $this->_response->getBody()); + } +} + + + + +class CmsControllerListModeAdminBibRootWithDefaultPermissionsOnlyTest extends CmsControllerListModeTestCase { + public function setUp() { + parent::setUp(); + Class_UserGroup_Permission::deleteBy([]); + Class_UserGroup_Permission::permit(Class_Permission::createArticleCategory(), + Class_UserGroup::find(22), + $this->annecy); + ZendAfi_Auth::getInstance()->logUser($this->_admin_bib); + $this->dispatch('/admin/cms', true); + } + + + /** @test */ + public function shouldNotDisplayPortal() { + $this->assertNotXPath('//td/a[contains(@href, "cms/index/id_bib/0")]'); + } + + + /** @test */ + public function shouldDisplayLibraryInBreadcrumbAtRoot() { + $this->assertXPathContentContains('//a[contains(@href, "admin/cms")]', + 'Annecy'); + } + + + /** @test */ + public function shouldDisplayRootCategory() { + $this->assertXPathContentContains('//td/a[contains(@href, "cms/index/id_cat/1")]', + 'Root', + $this->_response->getBody()); } } + class CmsControllerListModeAdminBibRootWithoutPermissionsTest extends CmsControllerListModeTestCase { public function setUp() { @@ -156,6 +195,7 @@ class CmsControllerListModeAdminBibSubCategoryTest } + class CmsControllerListModeAdminBibSearchTest extends CmsControllerListModeTestCase { public function setUp() { @@ -217,31 +257,74 @@ class CmsControllerListModeEditWithPaginationTest -class CmsControllerListModeEditPostWithPaginationTest - extends CmsControllerListModeTestCase { +class CmsControllerListModeEditPostTest extends CmsControllerListModeTestCase { + protected $_datas; + public function setUp() { parent::setUp(); - $this->postDispatch('/admin/cms/edit/id/4/page/34/title_search/erik', - ['titre' => 'Erik Truffaz - Ladyland quartet en concert', - 'auteur' => $this->fixture('Class_Users', - ['id' => 1, - 'login' => 'tom', - 'password' => 'pwd']), - 'id_cat' => 34, - 'debut' => '01/03/2011', - 'fin' => '26/03/2011', - 'events_debut' => '02/03/2011 08:35', - 'events_fin' => '05/03/2011 10:42', - 'contenu' => 'Ici: <img src="../../images/bonlieu.jpg" />', - 'description' => 'Affiche: <img src="http://localhost' . BASE_URL . '/images/concert.jpg" />', - 'id_lieu' => 3, - 'domaine_ids' => ['10'], - 'id_items' => ['1']]); - } - - - /** @test */ - public function redirectShouldContainPage34() { - $this->assertRedirectRegex('|/edit/id/4/page/34/title_search/erik|'); - } -} \ No newline at end of file + $this->_datas = ['titre' => 'Erik Truffaz - Ladyland quartet en concert', + 'auteur' => $this->fixture('Class_Users', + ['id' => 1, + 'login' => 'tom', + 'password' => 'pwd']), + 'id_cat' => 34, + 'debut' => '01/03/2011', + 'fin' => '26/03/2011', + 'events_debut' => '02/03/2011 08:35', + 'events_fin' => '05/03/2011 10:42', + 'contenu' => 'Ici: <img src="../../images/bonlieu.jpg" />', + 'description' => 'Affiche: <img src="http://localhost' . BASE_URL . '/images/concert.jpg" />', + 'id_lieu' => 3, + 'domaine_ids' => ['10'], + 'id_items' => ['1']]; + } + + + /** @test */ + public function withPage34AndSearchRedirectShouldContainPage3() { + $this->postDispatch('/admin/cms/edit/id/4/page/3/title_search/erik', $this->_datas); + $this->assertRedirectRegex('|/edit/id/4/page/3/title_search/erik|', $this->getResponseLocation()); + } + + + /** @test */ + public function withIdCat34RedirectShouldContainIdCat() { + $this->postDispatch('/admin/cms/edit/id/4/id_cat/34', $this->_datas); + $this->assertRedirectRegex('|/edit/id/4/id_cat/34|', $this->getResponseLocation()); + } +} + + + +class CmsControllerListModeSearchParamsTest extends Storm_Test_ModelTestCase { + public function setUp() { + parent::setUp(); + $this->_params = ZendAfi_Controller_Action_Helper_ListViewMode_Strategy_SearchParams::where('titre like "%test%"'); + $this->_params->addAll(['id_cat' => 0]); + } + + + /** @test */ + public function findItemsShouldFilterEmptyValues() { + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') + ->whenCalled('findAllBy') + ->with(['where' => 'titre like "%test%"']) + ->answers(['some data']); + + $this->assertEquals(['some data'], $this->_params->findItemsOfClass('Class_Article')); + } + + + /** @test */ + public function countItemsShouldFilterEmptyValues() { + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') + ->whenCalled('countBy') + ->with(['where' => 'titre like "%test%"']) + ->answers(2); + + $this->assertEquals(2, $this->_params->countItemsOfClass('Class_Article')); + + } +} + +?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 4a9c087e4c3b4ebcef78c21d86af09f8e666c210..e796d2c66baa4041790c9e2f29b7dcb663de09fc 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -153,7 +153,8 @@ abstract class CmsControllerTestCase extends Admin_AbstractControllerTestCase { $cat_a_la_une->setSousCategories([$this->cat_evenements]); $this->annecy - ->setArticleCategories([$this->root_category]); + ->setArticleCategories([$this->root_category]) + ->assertSave(); $this->concert = $this->fixture('Class_Article', ['id' => 4, @@ -860,6 +861,13 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer 'date_creation' => '2010-12-25']); + $this->fixture('Class_NoticeDomain', + ['id' => 1, + 'domain_id' => 10, + 'panier_id' => 0, + 'record_alpha_key' => 'ERIKTRUFFAZLADYLANDQUARTETENCONCERT-4-TOM----8']); + + $post_datas= ['titre' => 'Erik Truffaz - Ladyland quartet en concert', 'auteur' => $this->fixture('Class_Users', ['id' => 1, @@ -900,6 +908,12 @@ class CmsControllerArticleConcertEditActionPostTest extends CmsControllerWithPer } + /** @test */ + public function erikTruffazShouldBeLinkedToExpectedDomainByFacet() { + $this->assertContains('Q10', Class_Notice::findFirstBy(['alpha_titre' =>'ERIK TRUFFAZ LADYLAND QUARTET EN CONCERT'])->getFacettes()); + } + + /** @test */ public function articleShouldNotHaveIdItems() { $this->assertTrue(Class_Article::find(4)->isAttributeEmpty('id_items')); @@ -1219,7 +1233,7 @@ class CmsControllerArticleAddActionPostTest extends CmsControllerWithPermissionT /** @test */ function redirectToEditNewArticle() { - $this->assertRedirectTo('/admin/cms/edit/id/5', $this->getResponseLocation()); + $this->assertRedirectTo('/admin/cms/edit/id/5/id_cat/23', $this->getResponseLocation()); } diff --git a/tests/application/modules/admin/controllers/ModoControllerFormulaireTest.php b/tests/application/modules/admin/controllers/ModoControllerFormulaireTest.php index 9cfd0dfe6939f06f2036d1c0362b5eb99bb1a0bc..83ab23fda79e99ce990f73bf0fe9e6bb5aa79611 100644 --- a/tests/application/modules/admin/controllers/ModoControllerFormulaireTest.php +++ b/tests/application/modules/admin/controllers/ModoControllerFormulaireTest.php @@ -21,11 +21,15 @@ require_once 'AdminAbstractControllerTestCase.php'; abstract class ModoControllerFormulaireForArticleTestCase extends Admin_AbstractControllerTestCase { - protected $formulaire_de_bougie; + protected + $formulaire_de_bougie, + $_storm_default_to_volatile = true; public function setUp() { parent::setUp(); + Class_AdminVar::newInstanceWithId('CMS_FORMULAIRES')->setValeur(1); + $zork = $this->fixture('Class_Users', ['id' => 34, 'login' => 'zork', @@ -189,6 +193,12 @@ class ModoControllerFormulaireForArticleListWithListeAllParameterTest extends Mo $this->assertXPathContentContains('//a[contains(@href, "admin/modo/export-csv-formulaire/id_article/12")]', 'Export CSV'); } + + + /** @test */ + public function mainFormulairesMenuShouldNotContainsIdArticleParam() { + $this->assertXPath('//div[@class="menu"]//a[@href="/admin/modo/formulaires/liste/all"]'); + } } @@ -297,6 +307,8 @@ class ModoControllerFormulaireExportCSVForArticlTest extends ModoControllerFormu class ModoControllerFormulaireListTest extends Admin_AbstractControllerTestCase { + protected $_storm_default_to_volatile = true; + public function setUp() { parent::setUp(); $hackaton = $this->fixture('Class_Article', diff --git a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php index 51a1d8fcaf97da0404e7b11171fce4f2fdca4bb7..ae6a55641b268b15fb8f34ef56035bf827e7f900 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php @@ -888,4 +888,43 @@ class Admib_ProfilControllerPageAccueilWithWidgetInBannerPostDispatchTest extend $this->assertFalse(array_key_exists(4, Class_Profil::find(3)->getBoitesDivision(Class_Profil::DIV_BANNIERE))); } } + + + + +class Admin_ProfilControllerPageAccueilWithMenuBoiteEnabledTest extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_Profil', ['id' => 712, 'libelle' => 'Parent profile', + 'cfg_accueil' => 'a:4:{s:7:"modules";a:12:{i:5;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:8:{s:4:"menu";s:3:"1-V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"1";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:2;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:16:{s:5:"titre";s:14:"ne_pas_toucher";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:1:"1";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:1:"0";s:8:"rss_avis";s:1:"0";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:10:"boite_vide";s:11:"style_liste";s:4:"none";s:13:"styles_reload";s:1:"0";s:7:"Valider";s:7:"Valider";s:0:"";s:0:"";}}i:4;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:7;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:1;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:3;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:8;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:9;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:10;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:11;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:12;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:2:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";}}i:6;a:3:{s:11:"type_module";s:5:"LOGIN";s:11:"preferences";a:16:{s:5:"titre";s:18:"Mon compte lecteur";s:14:"titre_connecte";s:0:"";s:11:"identifiant";s:12:"N° de carte";s:19:"identifiant_exemple";s:0:"";s:12:"mot_de_passe";s:19:"Année de naissance";s:20:"mot_de_passe_exemple";s:0:"";s:14:"lien_connexion";s:12:"Se connecter";s:24:"lien_mot_de_passe_oublie";s:25:"» Mot de passe oublié ?";s:17:"lien_creer_compte";s:16:"» S\'enregistrer";s:16:"message_connecte";s:9:"Bienvenue";s:11:"lien_compte";s:10:"Mon compte";s:17:"lien_deconnection";s:15:"Se déconnecter";s:16:"autocomplete_off";s:1:"1";s:15:"profil_redirect";s:0:"";s:22:"profil_logout_redirect";s:0:"";s:5:"boite";s:21:"boite_banniere_droite";}s:8:"division";s:1:"4";}}s:14:"use_parent_css";s:1:"1";s:7:"sitemap";s:1:"1";s:8:"page_css";s:0:"";}']); + + $this->fixture('Class_Profil', ['id' => 713, + 'parent_id' => 712, + 'id_site' => 0, + 'libelle' => 'My page', + 'cfg_accueil' => 'a:4:{s:7:"modules";a:8:{i:2;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:3;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:4:"NEWS";s:11:"preferences";a:13:{s:5:"titre";s:8:"Articles";s:8:"type_aff";s:1:"1";s:12:"id_categorie";s:0:"";s:8:"id_items";s:0:"";s:6:"nb_aff";s:1:"1";s:10:"nb_analyse";s:1:"5";s:13:"display_order";s:9:"Selection";s:19:"display_titles_only";s:0:"";s:8:"rss_avis";s:1:"1";s:14:"op_largeur_img";s:3:"200";s:16:"op_hauteur_boite";s:3:"400";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:1;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:4;a:3:{s:8:"division";s:1:"1";s:11:"type_module";s:7:"KIOSQUE";s:11:"preferences";a:23:{s:5:"titre";s:7:"Kiosque";s:11:"style_liste";s:10:"slide_show";s:10:"nb_notices";s:2:"20";s:8:"only_img";s:1:"1";s:9:"aleatoire";s:1:"1";s:3:"tri";s:1:"1";s:10:"nb_analyse";s:2:"50";s:14:"op_hauteur_img";s:1:"0";s:13:"op_transition";s:0:"";s:14:"op_largeur_img";s:1:"0";s:16:"op_hauteur_boite";s:1:"0";s:11:"op_captions";s:1:"0";s:11:"op_autoplay";s:1:"0";s:10:"op_visible";s:1:"0";s:8:"op_speed";s:1:"0";s:7:"op_auto";s:1:"0";s:9:"op_scroll";s:1:"1";s:8:"rss_avis";s:1:"1";s:12:"id_catalogue";s:1:"0";s:9:"id_panier";s:1:"0";s:15:"profil_redirect";s:0:"";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:8;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:5;a:3:{s:8:"division";s:1:"2";s:11:"type_module";s:13:"MENU_VERTICAL";s:11:"preferences";a:7:{s:4:"menu";s:1:"V";s:14:"afficher_titre";s:1:"1";s:11:"menu_deplie";s:1:"0";s:8:"new_html";s:1:"0";s:5:"boite";s:0:"";s:5:"titre";s:0:"";s:0:"";s:0:"";}}i:10;a:3:{s:8:"division";s:1:"3";s:11:"type_module";s:6:"PANIER";s:11:"preferences";a:3:{s:5:"titre";s:6:"Panier";s:5:"boite";s:0:"";s:0:"";s:0:"";}}i:11;a:3:{s:8:"division";s:1:"4";s:11:"type_module";s:5:"LOGIN";s:11:"preferences";a:17:{s:5:"titre";s:18:"Mon compte lecteur";s:14:"titre_connecte";s:0:"";s:11:"identifiant";s:12:"N° de carte";s:19:"identifiant_exemple";s:0:"";s:12:"mot_de_passe";s:19:"Année de naissance";s:20:"mot_de_passe_exemple";s:0:"";s:14:"lien_connexion";s:12:"Se connecter";s:24:"lien_mot_de_passe_oublie";s:25:"» Mot de passe oublié ?";s:17:"lien_creer_compte";s:16:"» S\'enregistrer";s:16:"message_connecte";s:9:"Bienvenue";s:11:"lien_compte";s:10:"Mon compte";s:17:"lien_deconnection";s:15:"Se déconnecter";s:16:"autocomplete_off";s:1:"1";s:15:"profil_redirect";s:0:"";s:22:"profil_logout_redirect";s:0:"";s:5:"boite";s:21:"boite_banniere_droite";s:0:"";s:0:"";}}}s:14:"use_parent_css";s:1:"1";s:7:"sitemap";s:1:"1";s:8:"page_css";s:0:"";}', + ]); + + + $this->fixture('Class_AdminVar',['id'=>'MENU_BOITE', 'valeur' => 1]); + + $cfg_module = "box1|2|NEWS|titre=Articles/type_aff=1/id_categorie=/id_items=/nb_aff=1/nb_analyse=5/display_order=Selection/display_titles_only=/rss_avis=1/op_largeur_img=200/op_hauteur_boite=400/boite=/=/;box1|3|NEWS|titre=Articles/type_aff=1/id_categorie=/id_items=/nb_aff=1/nb_analyse=5/display_order=Selection/display_titles_only=/rss_avis=1/op_largeur_img=200/op_hauteur_boite=400/boite=/=/;box1|1|KIOSQUE|titre=Kiosque/style_liste=slide_show/nb_notices=20/only_img=1/aleatoire=1/tri=1/nb_analyse=50/op_hauteur_img=0/op_transition=/op_largeur_img=0/op_hauteur_boite=0/op_captions=0/op_autoplay=0/op_visible=0/op_speed=0/op_auto=0/op_scroll=1/rss_avis=1/id_catalogue=0/id_panier=0/profil_redirect=/boite=/=/;box1|4|KIOSQUE|titre=Kiosque/style_liste=slide_show/nb_notices=20/only_img=1/aleatoire=1/tri=1/nb_analyse=50/op_hauteur_img=0/op_transition=/op_largeur_img=0/op_hauteur_boite=0/op_captions=0/op_autoplay=0/op_visible=0/op_speed=0/op_auto=0/op_scroll=1/rss_avis=1/id_catalogue=0/id_panier=0/profil_redirect=/boite=/=/;box2|8|MENU_VERTICAL|menu=V/afficher_titre=1/menu_deplie=0/new_html=0/boite=/titre=/=/;box2|5|MENU_VERTICAL|menu=V/afficher_titre=1/menu_deplie=0/new_html=0/boite=/titre=/=/;box3|10|PANIER|titre=Panier/boite=/=/;box3|new|PANIER|;box4|6|LOGIN|titre=Mon compte lecteur/titre_connecte=/identifiant=N° de carte/identifiant_exemple=/mot_de_passe=Année de naissance/mot_de_passe_exemple=/lien_connexion=Se connecter/lien_mot_de_passe_oublie=» Mot de passe oublié ?/lien_creer_compte=» S'enregistrer/message_connecte=Bienvenue/lien_compte=Mon compte/lien_deconnection=Se déconnecter/autocomplete_off=1/profil_redirect=/profil_logout_redirect=/boite=boite_banniere_droite/"; + + + $this + ->getRequest() + ->setMethod('POST') + ->setPost(array('saveContent' => $cfg_module)); + $this->dispatch('/admin/profil/accueil/id_profil/713'); + } + + + /** @test */ + public function newCartModuleShouldBeAdded() { + $profil = Class_Profil::find(713); + $cfg_accueil = $profil->getCfgAccueilAsArray(); + $this->assertCount(9, $cfg_accueil['modules']); + } +} ?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/SitothequeControllerTest.php b/tests/application/modules/admin/controllers/SitothequeControllerTest.php index b07d08fc6ce1c9ac62a25bb9487bffc8714f5ed0..59dd1f60caabcce03a89cd258bb28a63bee8b6fe 100644 --- a/tests/application/modules/admin/controllers/SitothequeControllerTest.php +++ b/tests/application/modules/admin/controllers/SitothequeControllerTest.php @@ -30,7 +30,7 @@ abstract class SitothequeControllerTestCase extends Admin_AbstractControllerTest Class_Exemplaire::beVolatile(); Class_Notice::beVolatile(); Class_CodifThesaurus::beVolatile(); - + Storm_Model_Loader::defaultToVolatile(); $categorie_informations = $this->fixture('Class_SitothequeCategorie', ['id' => 2, 'libelle' => 'Informations', @@ -59,6 +59,12 @@ abstract class SitothequeControllerTestCase extends Admin_AbstractControllerTest Class_Bib::getPortail()->setSitothequeCategories([]); } + public function tearDown() { + Storm_Model_Loader::defaultToDb(); + parent::tearDown(); + } + + public function setupDomaines() { $this->fixture('Class_Catalogue', ['id' => 10, diff --git a/tests/application/modules/admin/controllers/UploadControllerTest.php b/tests/application/modules/admin/controllers/UploadControllerTest.php index d409deb9f45f21c327d07d76e9938cb14cec1cb2..90866ff569b421ec7c6553ff7bd32f645870be0d 100644 --- a/tests/application/modules/admin/controllers/UploadControllerTest.php +++ b/tests/application/modules/admin/controllers/UploadControllerTest.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'; @@ -121,18 +121,18 @@ class UploadControllerMultipleProcessPostAction extends AbstractControllerTestCa } - /** + /** * @depends withModelShouldCallFileProcessingMethod - * @test + * @test */ public function modelShouldBeSavedAfterAddFile($album) { $this->assertTrue($album->methodHasBeenCalled('save')); } - /** + /** * @depends withModelShouldCallFileProcessingMethod - * @test + * @test */ public function albumDateMajShouldBeNow($album) { $today = new Zend_Date(); @@ -219,13 +219,14 @@ class UploadControllerVignetteNoticeActionPostValidUrlTest extends UploadControl .'&auteur='.urlencode('J.K.Rowling') .'&image='.urlencode('http://upload.wikimedia.org/potter.jpg') .'&src='.Class_WebService_AllServices::createSecurityKey() + .'&api=2.0' .'&action=12') ->answers(json_encode(['vignette' => 'http://cache.org/potter_thumb.jpg', 'image' => 'http://cache.org/potter.jpg', 'statut_recherche' => 2])) ->beStrict(); - $this->postDispatch('/admin/upload/vignette-notice/id/12345', + $this->postDispatch('/admin/upload/vignette-notice/id/12345', ['url_vignette' => 'http://upload.wikimedia.org/potter.jpg'], true); } @@ -244,14 +245,14 @@ class UploadControllerVignetteNoticeActionPostValidUrlTest extends UploadControl /** @test */ public function pageShouldDisplayVignetteTransferee() { - $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); + $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); } /** @test */ public function pageShouldContainsAButtonToCloseWindow() { - $this->assertXPathContentContains('//button[contains(@onclick, "hidePopWin")]', - 'Fermer'); + $this->assertXPathContentContains('//button[contains(@onclick, "hidePopWin")]', + 'Fermer'); } } @@ -278,13 +279,14 @@ class UploadControllerVignetteNoticeActionPostValidUrlForPeriodiqueTest extends .'&numero=1118' .'&clef_chapeau='.urlencode('SCIENCE VIE') .'&src='.Class_WebService_AllServices::createSecurityKey() + .'&api=2.0' .'&action=12') ->answers(json_encode(['vignette' => 'http://cache.org/science_vie_thumb.jpg', 'image' => 'http://cache.org/science_vie.jpg', 'statut_recherche' => 2])) ->beStrict(); - $this->postDispatch('/admin/upload/vignette-notice/id/12345', + $this->postDispatch('/admin/upload/vignette-notice/id/12345', ['url_vignette' => 'http://upload.wikimedia.org/science_vie.jpg'], true); } @@ -292,7 +294,7 @@ class UploadControllerVignetteNoticeActionPostValidUrlForPeriodiqueTest extends /** @test */ public function pageShouldDisplayVignetteTransferee() { - $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); + $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); } } @@ -305,11 +307,11 @@ class UploadControllerVignetteNoticePostServeurCacheErrorTest extends UploadCont Class_WebService_AllServices::setHttpClient($http_client = Storm_Test_ObjectWrapper::mock() ->whenCalled('open_url') - ->answers(json_encode(['statut_recherche' => 'erreur', + ->answers(json_encode(['statut_recherche' => 'erreur', 'erreur' => 'Image indisponible']))); - $this->postDispatch('/admin/upload/vignette-notice/id/12345', + $this->postDispatch('/admin/upload/vignette-notice/id/12345', ['url_vignette' => 'http://upload.wikimedia.org/potter.jpg'], true); } @@ -317,7 +319,7 @@ class UploadControllerVignetteNoticePostServeurCacheErrorTest extends UploadCont /** @test */ public function pageShouldDisplayErrorMessageImageIndisponible() { - $this->assertXPathContentContains('//div[@class="error"]', 'Erreur: Image indisponible'); + $this->assertXPathContentContains('//div[@class="error"]', 'Erreur: Image indisponible'); } @@ -363,27 +365,27 @@ class UploadControllerVignetteNoticeActionInvalidPostTest extends UploadControll } - /** + /** * @dataProvider validUrls - * @test + * @test */ public function pageShouldDisplayErrorIfExtensionNotAllowed($url) { - $this->postDispatch('/admin/upload/vignette-notice/id/12345', + $this->postDispatch('/admin/upload/vignette-notice/id/12345', ['url_vignette' => $url], true); - $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); + $this->assertXPathContentContains('//p', 'La vignette a bien été transférée'); } - /** + /** * @dataProvider invalidUrls - * @test + * @test */ public function pageShouldNotDisplayErrorIfUrlCorrect($url) { - $this->postDispatch('/admin/upload/vignette-notice/id/12345', + $this->postDispatch('/admin/upload/vignette-notice/id/12345', ['url_vignette' => $url], true); - $this->assertXPath('//ul[@class="errors"]'); + $this->assertXPath('//ul[@class="errors"]'); } } @@ -422,12 +424,13 @@ class UploadControllerBiographieNoticeActionPostValidUrlTest extends UploadContr .'?url_auteur='.urlencode('http://fr.wikipedia.org/wiki/J.K_Rowling') .'&clef_oeuvre=HARRY_POTTER' .'&src='.Class_WebService_AllServices::createSecurityKey() + .'&api=2.0' .'&action=13') ->answers(json_encode(['url_auteur' => 'http://fr.wikipedia.org/wiki/J.K_Rowling', 'statut_recherche' => 2])) ->beStrict(); - $this->postDispatch('/admin/upload/biographie-notice/id/12345', + $this->postDispatch('/admin/upload/biographie-notice/id/12345', ['url_auteur' => 'http://fr.wikipedia.org/wiki/J.K_Rowling'], true); } @@ -435,7 +438,7 @@ class UploadControllerBiographieNoticeActionPostValidUrlTest extends UploadContr /** @test */ public function pageShouldDisplayBiographieAJour() { - $this->assertXPathContentContains('//p', 'La nouvelle URL a bien été enregistrée'); + $this->assertXPathContentContains('//p', 'La nouvelle URL a bien été enregistrée'); } } @@ -447,11 +450,11 @@ class UploadControllerBiographieNoticePostServeurCacheErrorTest extends UploadCo Class_WebService_AllServices::setHttpClient($http_client = Storm_Test_ObjectWrapper::mock() ->whenCalled('open_url') - ->answers(json_encode(['statut_recherche' => 'erreur', + ->answers(json_encode(['statut_recherche' => 'erreur', 'message' => 'Biographie non trouvée']))); - $this->postDispatch('/admin/upload/biographie-notice/id/12345', + $this->postDispatch('/admin/upload/biographie-notice/id/12345', ['url_auteur' => 'http://fr.wikipedia.org/wiki/J.K_Rowling'], true); } @@ -459,7 +462,7 @@ class UploadControllerBiographieNoticePostServeurCacheErrorTest extends UploadCo /** @test */ public function pageShouldDisplayErrorMessageBiographieNonTrouvee() { - $this->assertXPathContentContains('//div[@class="error"]', 'Erreur: Biographie non trouvée'); + $this->assertXPathContentContains('//div[@class="error"]', 'Erreur: Biographie non trouvée'); } } diff --git a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php index b49997b1ee78e045b625aa31be8421c5e6b6f65e..a3d3d9700c46aab38bb34688be87556c4187acda 100644 --- a/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerCalendarActionTest.php @@ -18,6 +18,8 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + abstract class CmsControllerCalendarActionTestCase extends AbstractControllerTestCase { protected $_nanook2; @@ -348,33 +350,35 @@ class CmsControllerCalendarActionWithDayTest extends AbstractControllerTestCase } } + + class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { public function setUp() { parent::setUp(); $this->cfg_accueil = [ - 'modules' => [ - '1' => [ - 'division' => '1', - 'type_module' => 'CALENDAR', - 'preferences' => [ - 'titre' => 'Rendez-vous', - 'rss_avis' => false, - 'id_categorie' => '12-2', - 'display_cat_select' => true, - 'enabled_filters' => 'date;place;custom_field_2;zork', - 'display_event_info' => 'none' - ] - ] - ], - 'options' => [] + 'modules' => [ + '1' => [ + 'division' => '1', + 'type_module' => 'CALENDAR', + 'preferences' => [ + 'titre' => 'Rendez-vous', + 'rss_avis' => false, + 'id_categorie' => '12-2', + 'display_cat_select' => true, + 'enabled_filters' => 'date;place;custom_field_2;zork', + 'display_event_info' => 'none' + ] + ] + ], + 'options' => [] ]; $this->fixture('Class_Profil', - ['id' => 3, - 'browser' => 'opac', - 'libelle' => 'Rendez-vous', - 'cfg_accueil' => $this->cfg_accueil]); + ['id' => 3, + 'browser' => 'opac', + 'libelle' => 'Rendez-vous', + 'cfg_accueil' => $this->cfg_accueil]); $this->dispatch('/index/index/id_profil/3'); } @@ -387,4 +391,65 @@ class CmsControllerCalendarActionHeaderTest extends AbstractControllerTestCase { } } -?> \ No newline at end of file + + + +class CmsControllerCalendarActionWithOutDateTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + $time_source = new TimeSourceForTest('2014-09-02 14:14:14'); + ZendAfi_View_Helper_CalendarContent::setTimeSource($time_source); + ZendAfi_View_Helper_Calendar_Table::setTimeSource($time_source); + + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->with(['display_order' => 'EventDebut', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '', + 'id_bib' => 0, + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => true, + 'event_start_after' => '2014-09', + 'event_end_after' => '', + 'limit' => 3]) + ->answers([]) + + ->whenCalled('getArticlesByPreferences') + ->with(['display_order' => 'EventDebut', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '2014-09', + 'id_bib' => 0, + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => true, + 'event_end_after' => '2014-09-02']) + ->answers([$this->fixture('Class_Article', + ['id' => 1, + 'titre' => 'Kitchen', + 'contenu' => 'Cook'])]) + + ->whenCalled('getArticlesByPreferences') + ->with(['display_order' => 'EventDebut', + 'id_categorie' => '', + 'events_only' => true, + 'event_date' => '2014-09', + 'id_bib' => 0, + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => true]) + ->answers([]) + ->beStrict(); + + $this->dispatch('/cms/calendar/render/ajax', true); + } + + + /** @test */ + public function gatArticleByPreferencesShouldBeCallWithEventDAteAfter() { + $this->assertXPathContentContains('//div', 'Kitchen', $this->_response->getBody()); + } +} diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index cb6cad7bf4105712ff2eb2ce7babf4832658dde8..39dfdebdd0819ffafca85ecd116370d92274eec9 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -1603,6 +1603,7 @@ class NoticeAjaxControllerBiographieTest extends NoticeAjaxControllerBiographieT .'?auteur='.urlencode('J.K Rowling') .'&clef_oeuvre=HARRY_POTTER' .'&src='.Class_WebService_AllServices::createSecurityKey() + .'&api=2.0' .'&action=8') ->answers(json_encode(['statut_recherche' => '0', diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 2d11113d0e217d5908b8427df3b7f32883e70d6c..3fdd5ff748e075361df04dc260e2f811c33b34df 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -2443,7 +2443,7 @@ abstract class ProfilOptionControllerHeritedModulesTestCase extends AbstractCont ->setCfgAccueil(['modules' => ['4' => ['division' => '1', 'type_module' => 'NEWS'], '10' => ['division' => '1', - 'type_module' => 'NEWS']]]); + 'type_module' => 'CALENDAR']]]); } } @@ -2471,8 +2471,8 @@ class ProfilOptionControllerWithHeritedBannerTest extends ProfilOptionController /** @test */ - public function profilShouldIncrementCfgIdsAndDeleteOldId() { - $this->assertEquals([10,11], array_keys(Class_Profil::find(2)->getCfgAccueilAsArray()['modules'])); + public function profilShouldIncrementCfgIdsAndDeleteOldIdAndKeepPositions() { + $this->assertEquals([11,10], array_keys(Class_Profil::find(2)->getCfgAccueilAsArray()['modules'])); } } @@ -2505,7 +2505,7 @@ class ProfilOptionControllerWithHeritedPagesTest extends ProfilOptionControllerH /** @test */ - public function profilShouldIncrementCfgIdsAndDeleteOldId() { - $this->assertEquals([10,11], array_keys(Class_Profil::find(2)->getCfgAccueilAsArray()['modules'])); + public function profilShouldIncrementCfgIdsAndDeleteOldIdAndKeepPosition() { + $this->assertEquals([11,10], array_keys(Class_Profil::find(2)->getCfgAccueilAsArray()['modules'])); } } \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/RechercheControllerReservationPergameTest.php b/tests/application/modules/opac/controllers/RechercheControllerReservationPergameTest.php new file mode 100644 index 0000000000000000000000000000000000000000..00cffccd96316d936a639305fcad5c387987426c --- /dev/null +++ b/tests/application/modules/opac/controllers/RechercheControllerReservationPergameTest.php @@ -0,0 +1,106 @@ +<?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 + */ + +abstract class RechercheControllerReservationPergameTestCase extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + public function setUp() { + parent::setUp(); + + $bib_toulon = $this->fixture('Class_Bib', + ['id' => 1]); + + $int_bib_toulon = $this->fixture('Class_IntBib', ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_PERGAME, + 'comm_params' => ['url_serveur' => 'bib-toulon.sud'], + 'id_bib' => 1]); + + $bib_can = $this->fixture('Class_Bib', + ['id' => 2]); + + $int_bib_canne = $this->fixture('Class_IntBib', ['id' => 2, + 'comm_sigb' => Class_IntBib::COM_PERGAME, + 'comm_params' => ['url_serveur' => 'bib-canne.sud'], + 'id_bib' => 2]); + + $jacques = $this->fixture('Class_Users', ['id' => 1, + 'login' => 'jacques', + 'password' => 'secret', + 'idabon' => '1414', + 'ordreabon' => '1', + 'id_site' => 1]); + + + ZendAfi_Auth::getInstance()->logUser($jacques); + + $this->fixture('Class_Notice', ['id' => 31084, + 'titres' => 'TITEUF TITEF FILLES FIL C00 EST NUL']); + + $this->fixture('Class_Exemplaire', ['id' => 1142445, + 'id_notice' => 31084, + 'code_barres' => '0229923321', + 'id_origine' => '00021243', + 'id_int_bib' => 2, + 'id_bib' => 2, + 'code_annexe' => 2]); + } +} + + + +class RechercheControllerReservationPergameWithPickupToItemLibrary extends RechercheControllerReservationPergameTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CosmoVar', ['id' => 'site_retrait_resa', + 'valeur' => 0]); + + $this->dispatch('recherche/reser$vationajax/id_bib/2/id_origine/1142445/code_annexe/2',true); + } + + + /** @test */ + public function holdShouldHaveBeenCreatedWithCanneLibrary() { + $this->assertEquals(2, Class_Reservation::findFirstBy(['id_notice_origine' => '00021243', + 'idabon' => 1414])->getIdSite()); + } +} + + + +class RechercheControllerReservationPergameWithPickupToPatronLibrary extends RechercheControllerReservationPergameTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CosmoVar', ['id' => 'site_retrait_resa', + 'valeur' => 2]); + + $this->dispatch('recherche/reservationajax/id_bib/8/id_origine/1142445/code_annexe/18',true); + } + + + /** @test */ + public function holdShouldHaveBeenCreatedWithJacqueLibraryToulon() { + $this->assertEquals('1', Class_Reservation::findFirstBy(['id_notice_origine' => '00021243', + 'idabon' => 1414])->getIdSite()); + } +} diff --git a/tests/application/modules/opac/controllers/RechercheControllerReservationTest.php b/tests/application/modules/opac/controllers/RechercheControllerReservationTest.php index 21e71c366d95ce5d3c5e94d91ba13534210c96e9..3d4d5c8210b2680cee917443869a92728f42811b 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerReservationTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerReservationTest.php @@ -35,6 +35,8 @@ class RechercheControllerReservationPickupAjaxActionTestWithChosenPickup extends Class_CodifAnnexe::getLoader()->newInstanceWithId(3) ->setLibelle('Cran') ->setCode('CRN'))); + + Class_CosmoVar::newInstanceWithId('site_retrait_resa', ['valeur' => 1]); $this->dispatch('recherche/reservation-pickup-ajax?id_bib=2&id_origine=12&code_annexe=ANN',true); @@ -61,6 +63,53 @@ class RechercheControllerReservationPickupAjaxActionTestWithChosenPickup extends public function layoutShouldBeEmpty() { $this->_xpath->assertNotXPath($this->_json->content, '//div[@id="banniere"]'); } + +} + + +class RechercheControllerReservationPickupAjaxActionTestWithChosenPickupDispatch extends AbstractControllerTestCase { + protected $_json, $_xpath; + + public function setUp() { + parent::setUp(); + + $this->jajm = $this->fixture('Class_Users', + ['id' => 1, + 'login' => 'jajm', + 'password' => 'secret', + 'idabon' => '0000007', + 'int_bib' => $this->fixture('Class_IntBib', + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_NANOOK, + 'comm_params' => ['url_serveur' => 'http://bib.valensol.net']]) + ]); + + $this->nanook = Storm_Test_ObjectWrapper::mock() + ->whenCalled('isConnected')->answers(true) + ->whenCalled('reserverExemplaire')->answers(true); + + + + + Class_WebService_SIGB_Nanook::setService($this->nanook); + + ZendAfi_Auth::getInstance()->logUser($this->jajm); + + Class_CosmoVar::newInstanceWithId('site_retrait_resa', ['valeur' => 1]); + + $this->dispatch('recherche/reservationajax/id/11760/id_int_bib/23/id_bib/23/id_origine/594105/code_annexe/23/render/popup',true); + $this->_json = json_decode($this->_response->getBody()); + $this->_xpath = new Storm_Test_XPath(); + } + + /** @test */ + public function parameterCodeAnnexeShouldBeUsedForReservation() { + $this->assertEquals('23', + $this->nanook->getAttributesForLastCallOn('reserverExemplaire')[2]); + + } + + } @@ -86,7 +135,6 @@ class RechercheControllerReservationPickupAjaxActionTestWithPatronLibraryPickup ->whenCalled('reserverExemplaire')->answers(true) ->whenCalled('getUserAnnexe')->answers('12'); - Class_WebService_SIGB_Nanook::setService($this->nanook); ZendAfi_Auth::getInstance()->logUser($this->jajm); @@ -101,6 +149,8 @@ class RechercheControllerReservationPickupAjaxActionTestWithPatronLibraryPickup Class_CodifAnnexe::getLoader()->newInstanceWithId(3) ->setLibelle('Cran') ->setCode('CRN'))); + + Class_CosmoVar::newInstanceWithId('site_retrait_resa', ['valeur' => 2]); $this->dispatch('recherche/reservation-pickup-ajax?id_bib=2&id_origine=12&code_annexe=ANN',true); @@ -110,7 +160,7 @@ class RechercheControllerReservationPickupAjaxActionTestWithPatronLibraryPickup /** @test */ - public function shouldRenderResaOk() { + public function getUserAnnexeResultShouldBeUsedForReservation() { $this->assertEquals('12', $this->nanook->getAttributesForLastCallOn('reserverExemplaire')[2]); @@ -164,7 +214,7 @@ class RechercheControllerReservationPickupAjaxActionTestWithItemLibraryPickup ex } /** @test */ - public function shouldRenderResaOk() { + public function itemAnnexeShouldBeUsedForReservation() { $this->assertEquals('ANN', $this->nanook->getAttributesForLastCallOn('reserverExemplaire')[2]); diff --git a/tests/application/modules/opac/controllers/SitoControllerTest.php b/tests/application/modules/opac/controllers/SitoControllerTest.php index 0a18cc72cc260791aef4bf42e4744b803ad225c4..655189bcff56fd9b57bd4c7cc2a3139216dce780 100644 --- a/tests/application/modules/opac/controllers/SitoControllerTest.php +++ b/tests/application/modules/opac/controllers/SitoControllerTest.php @@ -19,9 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ abstract class SitoControllerTestCase extends AbstractControllerTestCase { + protected $hackers; public function setUp() { parent::setUp(); - $this->fixture('Class_SitothequeCategorie', + $this->hackers=$this->fixture('Class_SitothequeCategorie', ['id' => 3, 'libelle' => 'Hackers']); @@ -57,6 +58,97 @@ abstract class SitoControllerTestCase extends AbstractControllerTestCase { } +class SitoControllerHierarchicViewTest extends SitoControllerTestCase { + public function setUp() { + parent::setUp(); + $collectif=$this->fixture('Class_SitothequeCategorie', + ['id' => 12, + 'parent_categorie' => $this->hackers, + 'libelle' => 'Collectifs' ]); + + + + $this->fixture('Class_SitothequeCategorie', + ['id' => 19, + 'parent_categorie' => $this->fixture('Class_SitothequeCategorie', + ['id' => 17, + 'parent_categorie' => $collectif, + 'libelle' => 'Associations' ]), + + 'libelle' => 'Libre' ]); + + + $this->fixture('Class_Sitotheque', + ['id' => 280, + 'id_cat' => 19, + 'titre' => 'La quadrature du net', + 'description' => 'Internet et libertés', + 'url' => 'http://laquadrature.net']); + + + $this->fixture('Class_Sitotheque', + ['id' => 282, + 'id_cat' => 17, + 'titre' => 'April', + 'description' => 'Promouvoir le logiciel libre', + 'url' => 'http://april.org']); + + + $this->fixture('Class_Sitotheque', + ['id' => 281, + 'id_cat' => 12, + 'titre' => 'Framasoft', + 'description' => 'Degooglisons internet', + 'url' => 'http://framasoft.org']); + + Class_Profil::getCurrentProfil() + ->setCfgAccueil([ + 'modules' => [ + '1' => [ + 'division' => '2', + 'type_module' => 'SITO', + 'preferences' => [ + 'id_categorie' => '12', + "type_aff" => "3", + 'id_items' => '280-281'] + ] + ], + 'options' => []]); + + $this->dispatch('/sito/viewcategory/id_cat/12/start_cat/12', true); + } + + + /** @test */ + public function LinuxFrShouldNotBeShown() { + $this->assertNotXPath('//div[@class="sitotheque"]//a[@href="http://linuxfr.org"]', + $this->_response->getBody()); + } + + + /** @test */ + public function FramasoftShouldBeShown() { + $this->assertXPath('//div[@class="sitotheque"]//a[@href="http://framasoft.org"]', + $this->_response->getBody()); + } + + + /** @test */ + public function catAssocShouldContains2sites() { + $this->assertXPathContentContains('//div//a[@href="/sito/viewcategory/start_cat/12/id_cat/17"]','Associations (2)', + $this->_response->getBody()); + } + + + /** @test */ + public function breadCrumbShouldStartWithCollectifs() { + $this->assertXPath('//div/a[1][@href="/sito/viewcategory/start_cat/12/id_cat/12"]', + $this->_response->getBody()); + } +} + + + class SitoControllerViewRecentTest extends SitoControllerTestCase { public function setUp() { @@ -79,7 +171,7 @@ class SitoControllerViewSelectionTest extends SitoControllerTestCase { public function setUp() { parent::setUp(); - $this->dispatch('/sito/viewselection/id_module/1', true); + $this->dispatch('/sito/viewselection/id_module/1', true);; } diff --git a/tests/application/modules/telephone/controllers/RechercheControllerTest.php b/tests/application/modules/telephone/controllers/RechercheControllerTest.php index 52b146603a7ddb831933df106ac66a73bb5bcee8..91e018fa23cd124814ebc6f3d79cd5b4da24c831 100644 --- a/tests/application/modules/telephone/controllers/RechercheControllerTest.php +++ b/tests/application/modules/telephone/controllers/RechercheControllerTest.php @@ -255,7 +255,7 @@ class Telephone_RechercheControllerFrbrWithLinksTest extends TelephoneAbstractCo /** @test */ public function tintinPicarosShouldHaveImageFromVignetteAction() { - $this->assertXPath('//li/a/img[contains(@src, "/recherche/vignette?clef=")]'); + $this->assertXPath('//li/a/img[contains(@src, "/recherche/vignette/clef")][contains(@src, "/id_notice/555")]'); } } diff --git a/tests/library/Class/CatalogueTest.php b/tests/library/Class/CatalogueTest.php index 9fa8ad929269d6ccf2399e1d94995d50365e6d05..e741ad77eab6884c12dd79354896a30b9945d479 100644 --- a/tests/library/Class/CatalogueTest.php +++ b/tests/library/Class/CatalogueTest.php @@ -1035,6 +1035,35 @@ class CatalogueGetRequetesWithCatalogueTest extends ModelTestCase { } + /** @test */ + public function requetesShouldBeEmpty() { + $this->assertEquals([], $this->_requetes); + } +} + + + +class CatalogueGetAllNoticeIdsForDomaineTest extends ModelTestCase { + protected $_catalogue; + + + public function setUp() { + parent::setUp(); + $catalogue = $this->fixture('Class_Catalogue', + ['id' => 5, + 'libelle' => 'My catalogue']); + + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Catalogue') + ->whenCalled('getRequetes') + ->answers(['req_liste' => '', + 'req_comptage' => '', + 'req_facettes' => '', + 'req_ids' => '']); + + $this->_requetes = $catalogue->getAllNoticeIdsForDomaine(5, 1); + } + + /** @test */ public function requetesShouldBeEmpty() { $this->assertEquals([], $this->_requetes); diff --git a/tests/library/Class/NoticeTest.php b/tests/library/Class/NoticeTest.php index 76469df673c799dcc25da1082adfba059c2c16d1..b00af223c850c59a135cadb4790b6cd7efd0a2a0 100644 --- a/tests/library/Class/NoticeTest.php +++ b/tests/library/Class/NoticeTest.php @@ -118,7 +118,7 @@ class NoticeVignetteTest extends Storm_Test_ModelTestCase { /** @test */ public function withoutThumbnailFetchUrlVignetteShouldAnswerVignetteActionForAjax() { - $this->assertContains('/recherche/vignette?clef=', + $this->assertContains('/recherche/vignette/clef/', $this->_notice_without_thumbnails->fetchUrlVignette()); $this->assertFalse($this->_http_client->methodHasBeenCalled('open_url')); } diff --git a/tests/library/Class/UrlTest.php b/tests/library/Class/UrlTest.php index 18e4a531bea5bde36bab8053946d05fd5840fa87..f8a58c11be1299fbd3c398c6a548ec1fa59fe486 100644 --- a/tests/library/Class/UrlTest.php +++ b/tests/library/Class/UrlTest.php @@ -56,6 +56,11 @@ class UrlBaseUrlTest extends PHPUnit_Framework_TestCase { Class_Url::baseUrl()); } -} -?> \ No newline at end of file + /** @test */ + public function absoluteUrlShouldReturnCorrectSyntax() { + $this->assertContains('http://' . $_SERVER['SERVER_NAME'] . '/', Class_Url::absolute(['module' => 'admin', + 'controller' => 'cms', + 'action' => 'index'])); + } +} diff --git a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php index ee4dd3ffe4d000dd37b552a35303f07b17453712..9552d3ee30885dc45998c0ec0b225ece30a83d5d 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php +++ b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php @@ -390,5 +390,9 @@ renouvellement --> </documents> </datas> '; } + + public static function xmlGetLstPretsNewOrpheeVersion() { + return '<?xml version="1.0" encoding="utf-8"?><datas><infos><nb_res><![CDATA[11]]></nb_res></infos><documents><document><ntc><![CDATA[472024717]]></ntc><date_ret><![CDATA[13/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[231054]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002310543]]></cb><lib_sup><![CDATA[ Périodique]]></lib_sup><sup><![CDATA[112]]></sup><lib_section><![CDATA[Accueil]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur /><cote /><titre><![CDATA[Cuisine et vins de France]]></titre><editeur><![CDATA[Marie-Claire Album]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[9]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[22/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[354050841]]></ntc><date_ret><![CDATA[13/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[237009]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002370091]]></cb><lib_sup><![CDATA[ Livre]]></lib_sup><sup><![CDATA[108]]></sup><lib_section><![CDATA[Adultes]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Le Carrer, Olivier (1955-....)]]></auteur><cote><![CDATA[133.1 LEC]]></cote><titre><![CDATA[Atlas des lieux maudits]]></titre><editeur><![CDATA[Arthaud]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[2]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[22/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[1300600674]]></ntc><date_ret><![CDATA[13/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[133858]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106001338586]]></cb><lib_sup><![CDATA[ DVD]]></lib_sup><sup><![CDATA[114]]></sup><lib_section><![CDATA[Consultation]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Porte, Gilles]]></auteur><cote><![CDATA[F POR]]></cote><titre><![CDATA[Quand la mer monte]]></titre><editeur><![CDATA[Ognon pictures]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[8]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[22/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[354666415]]></ntc><date_ret><![CDATA[13/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[234221]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002342215]]></cb><lib_sup><![CDATA[ Livre]]></lib_sup><sup><![CDATA[108]]></sup><lib_section><![CDATA[Adultes]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Campbell, James W. P]]></auteur><cote><![CDATA[027 CAM]]></cote><titre><![CDATA[Bibliothèques]]></titre><editeur><![CDATA[Citadelles & Mazenod]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[2]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[01/04/2015]]></date_pret><nprol><![CDATA[1]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[472024717]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[214356]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002143563]]></cb><lib_sup><![CDATA[ Périodique]]></lib_sup><sup><![CDATA[112]]></sup><lib_section><![CDATA[Accueil]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur /><cote /><titre><![CDATA[Cuisine et vins de France]]></titre><editeur><![CDATA[Marie-Claire Album]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[9]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[472024717]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[191095]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106001910954]]></cb><lib_sup><![CDATA[ Périodique]]></lib_sup><sup><![CDATA[112]]></sup><lib_section><![CDATA[Accueil]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur /><cote /><titre><![CDATA[Cuisine et vins de France]]></titre><editeur><![CDATA[Marie-Claire Album]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[9]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[1301002547]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[143359]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106001433593]]></cb><lib_sup><![CDATA[ Livre]]></lib_sup><sup><![CDATA[108]]></sup><lib_section><![CDATA[Consultation]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Dimery, Robert]]></auteur><cote><![CDATA[782 DIM]]></cote><titre><![CDATA[Les 1001 albums qu\'il faut avoir écoutés dans sa vie : rock, hip hop, soul dance, techno ...]]></titre><editeur><![CDATA[Flammarion]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[8]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[1414909049]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[195118]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106001951180]]></cb><lib_sup><![CDATA[ DVD]]></lib_sup><sup><![CDATA[114]]></sup><lib_section><![CDATA[Consultation]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Bonvoisin, Bernie]]></auteur><cote><![CDATA[F BON]]></cote><titre><![CDATA[Les démons de Jésus]]></titre><editeur><![CDATA[Studio Canal vidéo]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[8]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[134321153]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[212098]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002120983]]></cb><lib_sup><![CDATA[ CD]]></lib_sup><sup><![CDATA[110]]></sup><lib_section><![CDATA[Consultation]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Jarrett, Keith]]></auteur><cote><![CDATA[1.3 JAR]]></cote><titre><![CDATA[Hymns, spheres]]></titre><editeur /><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[8]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[1301003693]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[234801]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002348014]]></cb><lib_sup><![CDATA[ Périodique]]></lib_sup><sup><![CDATA[112]]></sup><lib_section><![CDATA[Accueil]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur /><cote /><titre><![CDATA[Sciences humaines]]></titre><editeur><![CDATA[Sciences humaines éditions]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[9]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document><document><ntc><![CDATA[1314912055]]></ntc><date_ret><![CDATA[12/05/2015]]></date_ret><anx_ori><![CDATA[1]]></anx_ori><no><![CDATA[203232]]></no><is_nouv><![CDATA[False]]></is_nouv><cb><![CDATA[00106002032329]]></cb><lib_sup><![CDATA[ Livre]]></lib_sup><sup><![CDATA[108]]></sup><lib_section><![CDATA[Adultes]]></lib_section><lib_uti><![CDATA[prêt normal]]></lib_uti><auteur><![CDATA[Leroux, Léonnard (1977-....)]]></auteur><cote><![CDATA[248.4 LER]]></cote><titre><![CDATA[En chemin vers Compostelle]]></titre><editeur><![CDATA[Presses de la Renaissance]]></editeur><is_retard><![CDATA[False]]></is_retard><is_rsv><![CDATA[False]]></is_rsv><sec><![CDATA[2]]></sec><uti><![CDATA[2]]></uti><date_pret><![CDATA[18/04/2015]]></date_pret><nprol><![CDATA[0]]></nprol><nrel><![CDATA[0]]></nrel></document></documents></datas>'; + } } ?> diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index 0b4794c393963afdbc6c85d41f2cbe61cdffe6b2..be6dcacffd6937119a8a87d1e168cafeb971777b 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -532,6 +532,15 @@ class OrpheeServiceGetLstDmtResponseTest extends PHPUnit_Framework_TestCase { } + /** @test */ + public function withOrpheeNewVersionXmlShouldNotRemoveCDatas() { + $xml = GetLstPretResponse::withResult(OrpheeFixtures::xmlGetLstPretsNewOrpheeVersion())->getXml(); + $prets = Class_WebService_SIGB_Orphee_GetLstPretResponseReader::newInstance() + ->getEmpruntsFromXML($xml); + $this->assertCount(11, $prets); + } + + /** @test */ public function withLivreEspagnolShouldRemoveAllCDATA() { $actual_xml = GetLstDmtResponse::withResult(OrpheeFixtures::xmlGetLstDmtLivreEspagnol())->getXml(); @@ -1201,4 +1210,5 @@ class OrpheeServiceProlongetPretTest extends OrpheeServiceTestCase { } } + ?> diff --git a/tests/library/Class/WebService/VignetteTest.php b/tests/library/Class/WebService/VignetteTest.php index f02d97374647e81453a6e8683f8fac1091ca2982..adda910feaf1cf95863170bda645d5fbe553f799 100644 --- a/tests/library/Class/WebService/VignetteTest.php +++ b/tests/library/Class/WebService/VignetteTest.php @@ -49,6 +49,7 @@ class Class_WebService_VignetteTest extends Storm_Test_ModelTestCase { .'&type_doc=1' .'&numero=' .'&src='.Class_WebService_AllServices::createSecurityKey() + .'&api=2.0' .'&action=10') ->answers(json_encode(['vignette' => 'http://cache.org/potter_thumb.jpg', diff --git a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php index 8026bc4b4cb3ae112966e7c362c9b4b87ee0b204..df66155a0a2f2dac4696e4c13a4e27626ea8516c 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php @@ -21,41 +21,76 @@ require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; abstract class SitoViewHelperTestCase extends ViewHelperTestCase { + protected $_storm_default_to_volatile = true; + protected $html; - protected $_preferences = array(); + protected $_preferences = []; + protected $_belgique; + protected $_france; + protected $_creuse; + public function setUp() { parent::setUp(); - Class_Sitotheque::beVolatile(); - Class_SitothequeCategorie::beVolatile(); - Class_AdminVar::beVolatile(); - Class_AdminVar::newInstanceWithId('BLUGA_API_KEY', ['valeur' => ''])->save(); - - $belgique = Class_SitothequeCategorie::newInstanceWithId(5, ['libelle'=>'Belgique']); - $belgique->save(); - $france = Class_SitothequeCategorie::newInstanceWithId(9,['libelle'=>'France']); - - $france->save(); - $site_fosdem = Class_Sitotheque::newInstanceWithId(12, - ['titre'=>'FOSDEM', - 'description' => 'plein de bières belges', - 'url' => 'http://www.fosdem.org', - 'categorie' => $belgique]); - - $site_fosdem->save(); - $site_rmll = Class_Sitotheque::newInstanceWithId(15, - ['titre'=>'RMLL', - 'description' => 'du vin du vin!', - 'url' => 'http://www.rmll.info', - 'categorie' => $france]); + Class_AdminVar::newInstanceWithId('BLUGA_API_KEY', ['valeur' => ''])->save(); + $this->_belgique = $this->fixture('Class_SitothequeCategorie', + ['id' => 5, 'libelle'=>'Belgique']); + + $this->_france = $this->fixture('Class_SitothequeCategorie', + ['id' => 9, 'libelle'=>'France']); + + $this->_creuse = $this->fixture('Class_SitothequeCategorie', + ['id' => 23, + 'parent_categorie' => $this->_france, + 'libelle' => 'La Creuse']); + + $this->_lozere = $this->fixture('Class_SitothequeCategorie', + ['id' => 32, + 'parent_categorie' => $this->_france, + 'libelle' => 'La Lozere']); + + $this->fixture('Class_SitothequeCategorie', + ['id' => 24, + 'parent_categorie' => $this->_creuse, + 'libelle' => 'Gueret']); + + $this->fixture('Class_SitothequeCategorie', + ['id' => 33, + 'parent_categorie' => $this->_lozere, + 'libelle' => 'Mende']); + + Class_Sitotheque::setTimeSource(new TimeSourceForTest('2014-05-02 14:14:14')); + + $site_fosdem = $this->fixture('Class_Sitotheque', + ['id' => 12, + 'titre'=>'FOSDEM', + 'description' => 'plein de bières belges', + 'url' => 'http://www.fosdem.org', + 'categorie' => $this->_belgique]); + + for ($id = 16; $id < 25; $id++) { + $this->fixture('Class_Sitotheque', + ['id' => $id, + 'titre'=> 'Sito numero '.$id, + 'description' => 'lien dupliques', + 'url' => 'http://www.unlien.info', + 'categorie' => $this->_france]); + } - $site_rmll->save(); + Class_Sitotheque::setTimeSource(new TimeSourceForTest('2014-05-20 16:14:14')); + $this->fixture('Class_Sitotheque', + ['id' => 15, + 'titre'=>'RMLL', + 'description' => 'du vin du vin!', + 'url' => 'http://www.rmll.info', + 'categorie' => $this->_france]); $this->_helper = new ZendAfi_View_Helper_Accueil_Sito(2, ['division' => '1', 'type_module' => 'SITO', 'preferences' => $this->_preferences]); + $this->_helper->setView(new ZendAfi_Controller_Action_Helper_View()); $this->html = $this->_helper->getBoite(); } @@ -83,7 +118,7 @@ class SitoViewHelperSelectItemsBySelectionOrderTest extends SitoViewHelperTestCa public function secondSiteShouldBeRMLL() { $this->assertXPathContentContains($this->html, '//div/div[2]//h2//a', - 'FOSDEM'); + 'RMLL'); } } @@ -97,12 +132,12 @@ class SitoViewHelperSelectItemsByRandomOrderTest extends SitoViewHelperTestCase 'id_categorie' => '', 'nb_aff' => 2, 'display_order' => 'Random']; + /** @test */ public function itemsShouldBeShuffled() { $htmls = []; - for($i=0; $i<10; $i++) { - $htmls []= $this->_helper->getBoite(); - } + for($i=0; $i < 10; $i++) + $htmls[] = $this->_helper->getBoite(); $this->assertEquals(2, count(array_unique($htmls))); } @@ -147,9 +182,10 @@ class SitoViewHelperSelectItemsAndCatsTest extends SitoViewHelperTestCase { class SitoViewHelperLastTest extends SitoViewHelperTestCase { - protected $_preferences = array('titre' => 'Derniers sites', - 'type_aff' => 2, - 'nb_aff' => 2); + protected $_preferences = ['titre' => 'Derniers sites', + 'type_aff' => 2, + 'nb_aff' => 100, + 'display_order' => 'Random']; /** @test */ public function titleShouldBeDerniersSites() { @@ -163,29 +199,29 @@ class SitoViewHelperLastTest extends SitoViewHelperTestCase { public function h2ShouldContainsRmllDotInfo() { $this->assertXPathContentContains($this->html, '//h2//a[contains(@href, "rmll.info")]', - 'RMLL'); + 'RMLL', + $this->html); } + /** @test */ public function itemsShouldBeShuffled() { $htmls = []; - for($i=0; $i<10; $i++) { - $htmls []= $this->_helper->getBoite(); - } + for ($i=0; $i<10; $i++) + $htmls[] = $this->_helper->getBoite(); - $this->assertEquals(2, count(array_unique($htmls))); + $this->assertTrue(1 < count(array_unique($htmls))); } - } class SitoViewHelperGroupByCategorieTest extends SitoViewHelperTestCase { - protected $_preferences = array('titre' => 'Ma sito', - 'type_aff' => 2, - 'nb_aff' => 2, - 'group_by_categorie' => true); + protected $_preferences = ['titre' => 'Ma sito', + 'type_aff' => 2, + 'nb_aff' => 100, + 'group_by_categorie' => true]; /** @test */ @@ -211,4 +247,56 @@ class SitoViewHelperGroupByCategorieTest extends SitoViewHelperTestCase { } } -?> \ No newline at end of file + + +class SitoViewHelperHierarchicalCategoryTest extends SitoViewHelperTestCase { + protected $_preferences = ['titre' => 'My website library', + 'type_aff' => '3', + 'id_items' => '', + 'id_categorie' => '9', + 'nb_aff' => 1, + 'display_order' => 'Selection']; + + + /** @test */ + public function shouldDisplayTwoCategories() { + $this->assertXPathCount($this->html, + '//a[contains(@href, "/sito/viewcategory")]', + 2, + $this->html); + } + + + /** @test */ + public function categoryGueretShouldNotBeDisplayed() { + $this->assertNotXPathContentContains($this->html, + '//ul[@class="sitotheque"]/li//a', + 'Gueret'); + } + + + /** @test */ + public function rmllShouldBeDisplayed() { + $this->assertXPathContentContains($this->html, + '//ul[@class="sitotheque"]//li//a', + 'RMLL'); + + } + + + /** @test */ + public function fosdemShouldNotBeDisplayed() { + $this->assertNotXPathContentContains($this->html, + '//ul[@class="sitotheque"]//li//a', + 'FOSDEM'); + + } + + + /** @test */ + public function urlShouldRedirectToViewPage() { + $this->assertXPathContentContains($this->html, + '//h2//a[contains(@href, "/sito/viewcategory/id_cat/23/start_cat/23")]', + 'La Creuse'); + } +} \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/BiographieTest.php b/tests/library/ZendAfi/View/Helper/BiographieTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0ac5822283f1c5240e0f3ba6bb077bd62d98ab71 --- /dev/null +++ b/tests/library/ZendAfi/View/Helper/BiographieTest.php @@ -0,0 +1,41 @@ +<?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 ZendAfi_View_Helper_BiographieAuthorTest extends ViewHelperTestCase { + public function setUp() { + parent::setUp(); + $view = new ZendAfi_Controller_Action_Helper_View(); + $this->_helper = new ZendAfi_View_Helper_Biographie(); + $this->_helper->setView($view); + $this->_html = $this->_helper->renderBiographie(['source' => 'wiki', + 'biographie' => '<p>A html biographie !</p>'], + $this->fixture('Class_Notice', + ['id' => 1])); + } + + + /** @test */ + public function biographieShouldContainsHtml() { + $this->assertEquals('<p>Source : wiki</p><p>A html biographie !</p>', $this->_html); + } +} +?> \ No newline at end of file