diff --git a/VERSIONS b/VERSIONS index efcc1a6471d99a03254b29f3e87311ab27024a6b..a939df291d5f1dfbe9e8ff3e774ef48d7953dff8 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,22 @@ +17/02/2014 - V6.34 + + +- Interface administrateur: + - Résultat de recherche: + - Les résultats CVS peuvent être positionnés au dessus / au dessous de la liste ou au dessus / dessous des facettes + - Le parmétrage du nombre de nombre de résultats CVS par page est pris en compte + + - Menu horizontal: + - Les paramètres des boîtes d'articles placé dans le menu horizontal sont pris en compte + + - Resources numeriques: + - correction de la redirection de Music Me + + + + + + 10/02/2014 - V6.33 @@ -37,9 +56,6 @@ - SIGB Dynix: - Ajout du lien vers la notice de l'OPAC dans le mail de réservation d'exemplaires -- Cosmogramme: - - SIGB Koha: intégration des articles de périodiques - diff --git a/application/modules/admin/controllers/CmsController.php b/application/modules/admin/controllers/CmsController.php index 78355c89f1a9beb288fdfa0db5b939f870c2fba9..0009001091471b5c590ed71bebf9dde39bb2bb82 100644 --- a/application/modules/admin/controllers/CmsController.php +++ b/application/modules/admin/controllers/CmsController.php @@ -26,30 +26,24 @@ class Admin_CmsController extends ZendAfi_Controller_Action { protected $_article_old_status = null; public function init() { - $identity = Class_Users::getLoader()->getIdentity(); + $identity = Class_Users::getIdentity(); - if (ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB >= $identity->getRoleLevel()) { - $this->_bib = $identity->getBib(); - - } else { - $this->_bib = Class_Bib::getLoader()->getPortail(); - } + $this->_bib = (ZendAfi_Acl_AdminControllerRoles::ADMIN_BIB >= $identity->getRoleLevel()) ? + $identity->getBib() : + $this->_bib = Class_Bib::getPortail(); } public function indexAction() { - $identity = Class_Users::getLoader()->getIdentity(); + $identity = Class_Users::getIdentity(); if (0 != $this->_bib->getId()) { $bibs = [$this->_bib]; - } else { - $bibs = Class_Bib::getLoader()->findAllBy(['order' => 'libelle']); + $bibs = Class_Bib::findAllBy(['order' => 'libelle']); array_unshift($bibs, $this->_bib); } - - $add_link_label = $this->view->tagImg(URL_ADMIN_IMG . 'ico/add_cat.gif') . $this->view->_(' Ajouter une catégorie'); @@ -66,7 +60,7 @@ class Admin_CmsController extends ZendAfi_Controller_Action { ['id_bib' => $bib->getId()])), $add_link_label)]; }, - + $bibs); $this->view->categories = $categories; @@ -77,17 +71,15 @@ class Admin_CmsController extends ZendAfi_Controller_Action { $this->view->titre = $this->view->_('Mise à jour des articles'); $this->view->headScript()->appendScript('var treeViewSelectedCategory = ' - . (int)$this->_getParam('id_cat') . ';'); + . (int)$this->_getParam('id_cat') . ';'); $this->view->headScript()->appendFile(URL_ADMIN_JS . 'tree-view.js'); } public function cataddAction() { - $category = Class_ArticleCategorie::getLoader() - ->newInstance() - ->setLibelle(''); - $parent = Class_ArticleCategorie::getLoader()->find((int)$this->_getParam('id')); + $category = Class_ArticleCategorie::newInstance()->setLibelle(''); + $parent = Class_ArticleCategorie::find((int)$this->_getParam('id')); if (null !== $parent) { $category->setParentCategorie($parent); @@ -119,9 +111,8 @@ class Admin_CmsController extends ZendAfi_Controller_Action { return; } - if (null === $category->getBib()) { + if (null === $category->getBib()) $category->setBib($this->_bib); - } $this->view->category = $category; $this->view->combo_cat = $this->view->comboParentCategorie($category); @@ -229,15 +220,17 @@ class Admin_CmsController extends ZendAfi_Controller_Action { public function newseditAction() { - $article = Class_Article::getLoader()->find((int)$this->_getParam('id')); + if (!$article = Class_Article::find((int)$this->_getParam('id'))) { + $this->_redirect('admin/cms'); + return; + } + $this->_article_old_status = $article->getStatus(); - if (null === ($article->getCategorie()->getBib())) { + if (null === ($article->getCategorie()->getBib())) $article->getCategorie()->setBib($this->_bib); - } - if ($lang = $this->_getParam('lang')) { + if ($lang = $this->_getParam('lang')) $article = $article->getOrCreateTraductionLangue($lang); - } if ($this->_isArticleSaved($article)) { $this->_notifyArticleChanged($article); @@ -254,10 +247,11 @@ class Admin_CmsController extends ZendAfi_Controller_Action { if ($article->isTraduction()) { $this->view->titre = 'Traduire un article'; $this->render('traductionform'); - } else { - $this->view->titre = 'Modifier un article'; - $this->render('newsform'); + return; } + + $this->view->titre = 'Modifier un article'; + $this->render('newsform'); } diff --git a/application/modules/admin/controllers/IndexController.php b/application/modules/admin/controllers/IndexController.php index e7a819669dbf42d34900ba93cde4cba7759a2143..ccc4443205b779045ac9716867b75735ec5f1720 100644 --- a/application/modules/admin/controllers/IndexController.php +++ b/application/modules/admin/controllers/IndexController.php @@ -149,7 +149,7 @@ class Admin_IndexController extends Zend_Controller_Action { 'ID_READ_SPEAKER' => 'Numéro de client Read Speaker <a target="_blank" href="http://webreader.readspeaker.com">http://webreader.readspeaker.com</a>', 'BLUGA_API_KEY' => 'Clé API Bluga Webthumb <a target="_blank" href="http://webthumb.bluga.net/home">http://webthumb.bluga.net/home</a>', 'AIDE_FICHE_ABONNE' => "Texte d'aide affiché dans la fiche abonné", - 'INTERDIRE_ENREG_UTIL' => "Ne pas autoriser l'enregistrement d'utilisateurs depuis la boite de connexion", + 'INTERDIRE_ENREG_UTIL' => "Supprime l'affichage du lien d'enregistrement dans les différents formulaires de connexion et interdit l'enregistrement d'utilisateurs", 'LANGUES' => "Liste des codes langue utilisées en plus du français séparées par des ;. Exemple: en;ro;es", 'WORKFLOW' => 'Activer ou désactiver la gestion des validations des articles<br />1 = Activé, Autre valeur = désactivé', 'BIBNUM' => 'Activer ou désactiver la bibliothèque numérique<br />1 = Activé, Autre valeur = désactivé', diff --git a/application/modules/admin/controllers/ModulesController.php b/application/modules/admin/controllers/ModulesController.php index 7a57ec743c300493912ccea8f60973f4dba12522..7c78419060befcece36b0e7b33a58c3b66a1bcb1 100644 --- a/application/modules/admin/controllers/ModulesController.php +++ b/application/modules/admin/controllers/ModulesController.php @@ -48,7 +48,8 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { public function preDispatch() { parent::preDispatch(); - if($this->_request->getActionName()!='kiosque-change-data') + if($this->_request->getActionName()!='kiosque-change-data' && + $this->_request->getActionName()!='search-result') Zend_Layout::startMvc(); } @@ -208,7 +209,13 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { // Proprietés recherche //------------------------------------------------------------------------------------------------------ function rechercheAction() { - + + $erreur=''; + $enreg=''; + if($this->_getParam('action1')=="resultat") { + return $this->_forward('search-result'); + } + if($this->_getParam('action1')==='viewnotice') $this->view->type_doc=$this->_getParam('action2'); $this->view->titre="Recherche"; @@ -216,20 +223,14 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { // Retour du formulaire if($this->_request->isPost()) { - // Controles de saisie ->resultat - if($this->_getParam('action1')=="resultat") - { - $ret=$this->getPostListe(); - if($ret != "ok") $erreur=$ret; - } - // Controles de saisie ->viewnotice - elseif($this->_getParam('action1')=="viewnotice") $enreg=$this->getPostNotice(); - - if($erreur) $this->retourErreur($erreur); - else - { - if(!$enreg) $enreg=$_POST; - if($this->_getParam('action1')=="resultat") unset($_SESSION["recherche"]["resultat"]); + if($this->_getParam('action1')=="viewnotice") + $enreg=$this->getPostNotice(); + + if($erreur) + $this->retourErreur($erreur); + else{ + if(!$enreg) + $enreg=$_POST; $this->updateEtRetour($enreg); } } @@ -242,12 +243,32 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $this->render->renderScript('modules/recherche_'.$this->_getParam('action1').'.phtml'); } + + public function searchResultAction() { + $post_values = $this->_request->getPost(); + + $form = + ZendAfi_Form_Configuration_SearchResult::newConfigurationWith( + array_merge(Class_Profil::getCurrentProfil()->getConfigurationOf('recherche', + 'resultat', + 'simple'), + $post_values + )); + if ($this->_request->isPost() && $form->isValid($post_values)) { + return $this->updateEtRetour($post_values); + } + + $this->view->form= $form; + + } + //------------------------------------------------------------------------------------------------------ // Controle de saisie pour la liste résultat de recherches et catalogues //------------------------------------------------------------------------------------------------------ protected function getPostListe() { - extract($_POST); + $erreur = 'ok'; + $liste_nb_par_page=(int)$liste_nb_par_page; $facettes_nombre=(int)$facettes_nombre; $tags_nombre=(int)$tags_nombre; @@ -259,8 +280,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { elseif($tags_actif == 1 and $tags_nombre < 5 or $tags_nombre > 1000) $erreur="Le nombre de tags doit être compris entre 5 et 1000"; elseif($tags_actif == 1 and !trim($tags_codes)) $erreur="Indiquez au moins 1 type de tag à afficher"; - if($erreur) return $erreur; - else return "ok"; + return $erreur; } @@ -322,7 +342,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $champ=substr($clef,($pos+1)); if($champ == "ordre") {$valeur=(int)$valeur; if($valeur < 1 or $valeur > 100) $valeur="1";} if($champ == "largeur") {$valeur=(int)$valeur; if($valeur < 5 or $valeur > 50) $valeur="0";} - if($clef == "champs_codes") $enreg["entete"]=$valeur; + if($clef == "liste_codes") $enreg["entete"]=$valeur; else $enreg["onglets"][$type][$champ]=$valeur; } return $enreg; @@ -356,8 +376,6 @@ class Admin_ModulesController extends ZendAfi_Controller_Action { $this->view->preferences=$_POST; } - - public function kiosqueChangeDataAction() { $this->id_module = $this->_getParam('id_module'); diff --git a/application/modules/admin/views/scripts/accueil/tags.phtml b/application/modules/admin/views/scripts/accueil/tags.phtml index 8601af7298cbf6e212a5f109b7d3b7e30578be12..fb9aed47d77564527fa95cfe247508dffb710bdc 100644 --- a/application/modules/admin/views/scripts/accueil/tags.phtml +++ b/application/modules/admin/views/scripts/accueil/tags.phtml @@ -47,7 +47,7 @@ echo $this->tagSelectionChamps("libelles"); <?php $data=$this->tagSelectionChamps("type_tags",$this->preferences["type_tags"]); echo $data["codes_dispo"]; echo '<td class="gauche">'; - echo $data["champ_code"].$data["champ_libelle"].$data["bloc_saisie"]; + echo $data["liste_codes"].$data["champ_libelle"].$data["bloc_saisie"]; ?> </td> </tr> diff --git a/application/modules/admin/views/scripts/cms/_newsform_head.phtml b/application/modules/admin/views/scripts/cms/_newsform_head.phtml index 451b2852ba4d3d42b8f0cf1d8e04acbd6d9cc10d..c3ad970a25449f17feef258c721035c00dcda6a0 100644 --- a/application/modules/admin/views/scripts/cms/_newsform_head.phtml +++ b/application/modules/admin/views/scripts/cms/_newsform_head.phtml @@ -2,20 +2,21 @@ <?php if (!$this->article->isNew()) { - $article_url = $this->url(array('module' => 'opac', - 'controller' => 'cms', - 'action' => 'articleview', - 'render' => null, - 'id' => $this->article->getId())); - echo $this->tagPreview($article_url, "Visualisation de l'article: ".$this->article->getTitre()); - echo $this->permalink($article_url); + $article_url = $this->url(['module' => 'opac', + 'controller' => 'cms', + 'action' => 'articleview', + 'id' => $this->article->getId()], + null, true); + echo $this->tagPreview($article_url, "Visualisation de l'article: " . $this->article->getTitre()); + echo $this->permalink($this->absoluteUrl($article_url)); } echo $this->partial('cms/_traduction_navigator.phtml', - array('article' => $this->article)); -if ($this->article->hasDateMaj()) { + ['article' => $this->article]); + +if ($this->article->hasDateMaj()) { echo sprintf('<br/><br/>%s : %s', - $this->_("Dernière modification"), + $this->_('Dernière modification'), $this->humanDate($this->article->getDateMaj())); } ?> diff --git a/application/modules/admin/views/scripts/index/index.phtml b/application/modules/admin/views/scripts/index/index.phtml index f1d6cf65701a5ac0e9ff8097fcd4d06b6a166b85..5f242345276aa583986ca1d2c29252af20e4f3bd 100644 --- a/application/modules/admin/views/scripts/index/index.phtml +++ b/application/modules/admin/views/scripts/index/index.phtml @@ -1,5 +1,7 @@ -<h2><?php echo $this->traduire('Version');?> :</h2> -<?php echo $this->ligneInfos("Numéro de version", VERSION_PERGAME . $this->helpLink('changelog'));?> +<h2><?php echo $this->traduire('Version');?> : + <a href='http://git.afi-sa.fr/afi/opacce/blob/master/VERSIONS'><?php echo VERSION_PERGAME ?></a> +</h2> + <h2><?php echo $this->traduire('Paramètres du site');?> :</h2> <?php diff --git a/application/modules/admin/views/scripts/modules/recherche_resultat.phtml b/application/modules/admin/views/scripts/modules/recherche_resultat.phtml index 1dfcc5f63d91199d0c80cd042d6367798c464ce4..4570c35b7dee3a32322c6f6a90eea3c236be30c0 100644 --- a/application/modules/admin/views/scripts/modules/recherche_resultat.phtml +++ b/application/modules/admin/views/scripts/modules/recherche_resultat.phtml @@ -8,167 +8,16 @@ echo $this->tagSelectionChamps("libelles"); <center> <h1>Propriétés de la liste : <?php echo $this->titre ?></h1> <div class="formTable"> - <?php if($this->erreur) echo '<p class="erreur">'.$this->erreur.'</p>'; ?> - <form method="post" action="<?php echo $this->url ?>"> - <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="55" value="<?php print($this->preferences["titre"]); ?>"></td> - </tr> - - <tr> - <td class="droite">Style de boite </td> - <td class="gauche"><?php echo $this->combo_templates ?></td> - </tr> - - <tr> - <td class="droite"><?php echo $this->_('Lien "Suggérer un achat"').' ' ?></td> - <td class="gauche"><?php echo $this->formCheckbox('suggestion_achat', - $this->preferences['suggestion_achat'], - ['checked' => $this->preferences['suggestion_achat'] > 0 ? 'checked' : '' ], - [1, 0]) ?></td> - </tr> - </table> - </fieldset> - - <fieldset> - <legend>Liste</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Format </td> - <td class="gauche"> - <?php echo $this->formSelect("liste_format", - $this->preferences["liste_format"],"", - Class_Systeme_ModulesAppli::getAvailableListeNoticeFormat()); ?> - </td> - </tr> - <tr> - <td class="droite">Nombre de notices par page </td> - <td class="gauche"><input type="text" name="liste_nb_par_page" id="liste_nb_par_page" size="5" value="<?php echo $this->preferences["liste_nb_par_page"] ?>"></td> - </tr> - <tr> - <td class="droite" valign="top">Champs à afficher </td> - <?php - $data=$this->tagSelectionChamps("liste",$this->preferences["liste_codes"]); echo $data["codes_dispo"]; - echo '<td class="gauche">'; - echo $data["champ_code"].$data["champ_libelle"].$data["bloc_saisie"]; - ?> - </td> - </tr> - <tr> - <td class="droite">Zones de titre (séparées par ;) </td> - <td class="gauche"><input type="text" placeholder="exemple: 200$e;464$t" value="<?php echo $this->preferences['zones_titre'] ?>" name="zones_titre" id="zones_titre" size="50"></td> - </tr> - </table> - </fieldset> + <?php if($this->erreur) echo '<p class="erreur">'.$this->erreur.'</p>'; + $form = + ZendAfi_Form_Configuration_SearchResult::newConfigurationWith( + Class_Profil::getCurrentProfil()->getConfigurationOf('recherche', + 'resultat', + 'simple')); + $form->setAction($this->url()); + $form->isValid($this->preferences +); + echo $this->renderForm($form); + ?> </div> - <div style="width:90%"><br> - <fieldset> - <legend>Facettes</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Affichage </td> - <td class="gauche"><?php echo $this->formSelect("facettes_actif",$this->preferences["facettes_actif"],"",array("0" => "Ne pas afficher","1"=>"Afficher les facettes")) ?></td> - </tr> - <tr> - <td class="droite">Nombre d'éléments par facette </td> - <td class="gauche"><input type="text" name="facettes_nombre" id="facettes_nombre" size="5" value="<?php echo $this->preferences["facettes_nombre"] ?>"></td> - </tr> - <tr> - <td class="droite" valign="top">Facettes à afficher </td> - <?php - $data=$this->tagSelectionChamps("facettes",$this->preferences["facettes_codes"]); echo $data["codes_dispo"]; - echo '<td class="gauche">'; - echo $data["champ_code"].$data["champ_libelle"].$data["bloc_saisie"]; - ?> - </td> - </tr> - <tr> - <td class="droite">Message au dessus de la boite </td> - <td class="gauche"><input type="text" name="facettes_message" id="facettes_message" size="50" maxlength="50" value="<?php echo $this->preferences["facettes_message"] ?>"></td> - </tr> - </table> - </fieldset> - </div> - <div style="width:90%"><br> - <fieldset> - <legend>Nuages de tags</legend> - <table cellspacing="2"> - <tr> - <td class="droite">Affichage </td> - <td class="gauche"><?php echo $this->formSelect("tags_actif",$this->preferences["tags_actif"],"",array("0" => "Ne pas afficher les tags","1"=>"Afficher les tags")) ?></td> - </tr> - <tr> - <td class="droite">Position </td> - <td class="gauche"><?php echo $this->formSelect("tags_position",$this->preferences["tags_position"],"",array("2" => "A côté de la liste","1"=>"Sous la liste")) ?></td> - </tr> - <tr> - <td class="droite">Mode de calcul des tranches </td> - <td class="gauche"><?php echo $this->formSelect("tags_calcul",$this->preferences["tags_calcul"],"",array("0" => "Par répartition","1"=>"Par écart à la moyenne","2" => "Par écart à la moyenne pondéré")) ?></td> - </tr> - <tr> - <td class="droite">Nombre de tags à afficher </td> - <td class="gauche"><input type="text" name="tags_nombre" id="tags_nombre" size="5" value="<?php echo $this->preferences["tags_nombre"] ?>"></td> - </tr> - <tr> - <td class="droite" valign="top">Types de tags </td> - <?php - $data=$this->tagSelectionChamps("tags",$this->preferences["tags_codes"]); echo $data["codes_dispo"]; - echo '<td class="gauche">'; - echo $data["champ_code"].$data["champ_libelle"].$data["bloc_saisie"]; - ?> - </td> - </tr> - <tr> - <td class="droite">Message au dessus de la boite </td> - <td class="gauche"><input type="text" name="tags_message" id="tags_message" size="50" maxlength="50" value="<?php echo $this->preferences["tags_message"] ?>"></td> - </tr> - </table> - </fieldset> - - </div> - - <?php if (Class_AdminVar::isCVSEnabled()) { ?> - <div style="width:90%"><br> - <fieldset> - <legend>Résultats CVS</legend> - <table cellspacing="2"> - <tr> - </tr> - <tr> - <td class="droite">Titre de la boite </td> - <td class="gauche"><input type="text" name="cvs_resultat_titre" id="cvs_resultat_titre" size="50" maxlength="50" value="<?php echo $this->preferences["cvs_resultat_titre"] ?>"></td> - </tr> - - <tr> - <td class="droite">Titre résulat recherche </td> - <td class="gauche"><input type="text" name="cvs_autres_resultats" id="cvs_autres_resultats" size="50" maxlength="50" value="<?php echo $this->preferences["cvs_autres_resultats"] ?>"></td> - </tr> - - - <tr> - <td class="droite">Nombre de résultats à afficher</td> - <td class="gauche"><input type="text" name="cvs_nb_result" id="cvs_nb_result" size="5" value="<?php echo $this->preferences["cvs_nb_result"] ?>"></td> - </tr> - <tr> - <td class="droite">Message utilisateur déconnecté</td> - <td class="gauche"><input type="text" name="cvs_msg_deco" id="cvs_msg_deco" size="50" maxlength="50" value="<?php echo $this->preferences["cvs_msg_deco"] ?>"></td> - </tr> - - - <tr> - <td class="droite">Message utilisateur sans droit d'accès</td> - <td class="gauche"><input type="text" name="cvs_msg_droit" id="cvs_msg_droit" size="50" maxlength="50" value="<?php echo $this->preferences["cvs_msg_droit"] ?>"></td> - </tr> - - - - </table> - </fieldset> - </div> - - <?php } ?> - - <?php echo $this->render('modules/_fin.phtml');?> +</center> diff --git a/application/modules/admin/views/scripts/modules/recherche_viewnotice.phtml b/application/modules/admin/views/scripts/modules/recherche_viewnotice.phtml index 527f499ef51df6b513070c6fb4e88891f9e25d1e..e22824b414395d11eb11ec666a5b04b5872a0fc9 100644 --- a/application/modules/admin/views/scripts/modules/recherche_viewnotice.phtml +++ b/application/modules/admin/views/scripts/modules/recherche_viewnotice.phtml @@ -27,7 +27,7 @@ echo $this->tagSelectionChamps("libelles").NL; <?php $data=$this->tagSelectionChamps("champs",$this->preferences["entete"]); echo $data["codes_dispo"]; echo '<td class="gauche">'; - echo $data["champ_code"].$data["champ_libelle"].$data["bloc_saisie"]; + echo $data["liste_codes"].$data["champ_libelle"].$data["bloc_saisie"]; ?> </td> </tr> diff --git a/application/modules/admin/views/scripts/modules/search-result.phtml b/application/modules/admin/views/scripts/modules/search-result.phtml new file mode 100644 index 0000000000000000000000000000000000000000..eb69c312acdb0bfbc15803303d622e94858ac4d0 --- /dev/null +++ b/application/modules/admin/views/scripts/modules/search-result.phtml @@ -0,0 +1,13 @@ +<?php +echo '<script src="'.URL_ADMIN_JS.'drag_and_drop.js'.'" type="text/javascript"> </script>'; +echo '<script src="'.URL_ADMIN_JS.'selection_champs.js'.'" type="text/javascript"> </script>'; +echo '<link rel="stylesheet" type="text/css" media="screen" href="'.URL_ADMIN_CSS.'drag_and_drop.css" />'; +echo $this->tagSelectionChamps("libelles"); + +?> +<center> + <h1>Propriétés de la liste : <?php echo $this->titre ?></h1> + <div class="formTable"> + <?php echo $this->renderForm($this->form); ?> + </div> +</center> diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index f0553189462ac14be97f809b6ef8a68bd936c73a..53c1857d8b3d1c0583386755ee021b59207bc8c4 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -110,9 +110,14 @@ class AuthController extends ZendAfi_Controller_Action { function popupLoginAction() { - $prefBoite = Class_Profil::getCurrentProfil()->getCfgModulesPreferences('auth','login'); - $prefBanniere = Class_Profil::getCurrentProfil()->getModuleAccueilPreferencesByType('LOGIN'); - $this->view->preferences = $prefBanniere ? $prefBanniere :( $prefBoite ? $prefBoite :[]); + $page_settings = Class_Profil::getCurrentProfil()->getCfgModulesPreferences('auth','login'); + $widget_settings = Class_Profil::getCurrentProfil()->getModuleAccueilPreferencesByType('LOGIN'); + $this->view->preferences = + $widget_settings + ? $widget_settings + :( $page_settings + ? $page_settings + : []); //$this->view->preferences = $this->view->redirect = $this->_getParam('redirect'); diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 9ba7df93eaad65a803801f9a0c49a40437032807..2545801bdf04cd7281f75c63bace2eade41dbddc 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -230,7 +230,8 @@ class CmsController extends Zend_Controller_Action { public function articleviewselectionAction() { $preferences = $this->_modulesPreferences( (int)$this->_getParam('id_module'), - (int)$this->_getParam('id_profil')); + (int)$this->_getParam('id_profil'), + $this->_getParam('id_menu')); $preferences['nb_aff'] = 30; if (!array_isset('display_order', $preferences) || ('Random' == $preferences['display_order'])) $preferences['display_order'] = 'DateCreationDesc'; @@ -329,11 +330,14 @@ class CmsController extends Zend_Controller_Action { * @param int $id_profil * @return array */ - private function _modulesPreferences($id_module, $id_profil = null) { + private function _modulesPreferences($id_module, $id_profil = null, $id_menu = null) { $profil = ($id_profil) ? Class_Profil::getLoader()->find($id_profil) : Class_Profil::getCurrentProfil(); + if ($id_menu === 'H') + return $profil->getMenuHorizontal()->getMenuPrefencesByIdModule($id_module); + return $profil->getModuleAccueilPreferences($id_module); } diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index d670579769601a77515cfb8095b8352044e42acd..7d4a5ef6e042b8b7fdc9d2695f6c10cdab9fd6d7 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -477,30 +477,30 @@ class NoticeAjaxController extends Zend_Controller_Action { $criteres_recherche->setParams($this->_request->getParams()); $query=$this->view->tagCVSCriteresRecherche($criteres_recherche); - $cvs = Class_CVSLink::forUser($user); $notices = $cvs->searchNotices($query,$criteres_recherche->getPage(),$this->preferences['cvs_nb_result']); - $nb_notices = $cvs->getTotalNotices(); + $nb_total_cvs_records = $cvs->getTotalNotices(); $helper = $this->view->getHelper('ListeCVSNotices'); $html = "<script>"; - if ($nb_notices) - $html .= "$('.cvs_boite:hidden').slideDown('slow');"; + if ($nb_total_cvs_records) + $html .= "$('.cvs_container:hidden').slideDown('slow');"; $html .= "$(document).ready(function(){ - $('#cvs_resultat .pager a').click(function(){ + $('#cvs_result .pager a').click(function(e){ + e.preventDefault(); var url = $(this).attr('href'); - $('#cvs_resultat').load(url); + $('#cvs_result').load(url); return false; }); $('a[href*=\"modules/cvs\"]').attr('target', '_blank'); -});</script><div id='cvs_resultat'>"; +});</script><div id='cvs_result'>"; $html .= $helper->listeCVSNotices($notices, - $nb_notices, + $nb_total_cvs_records, $criteres_recherche->getPage(), $this->preferences); - $html .= $this->view->pager($cvs->getTotalNotices(), + $html .= $this->view->pager($nb_total_cvs_records, $this->preferences['cvs_nb_result'], $criteres_recherche->getPage(), $this->view->url(['controller' => 'noticeajax', diff --git a/application/modules/opac/controllers/RechercheController.php b/application/modules/opac/controllers/RechercheController.php index d059a3eb5dd84b2bcfd0beb5645429435db0420f..5102ef96c538e392fc84e2d49bbb46189e874f35 100644 --- a/application/modules/opac/controllers/RechercheController.php +++ b/application/modules/opac/controllers/RechercheController.php @@ -101,12 +101,14 @@ class RechercheController extends ZendAfi_Controller_Action { protected function showCSVSearchResults($criteres_recherche) { + $preferences = Class_Profil::getCurrentProfil()->getSearchResultSettings(); $user = Class_Users::getLoader()->getIdentity(); $this->view->accessCVS=false; - if ($user && $user->hasRightAccesCVS()) { + if (($user && $user->hasRightAccesCVS()) && !$preferences['cvs_display_position']==0) { $this->view->accessCVS=true; + Class_ScriptLoader::getInstance() - ->addJQueryReady("$('<div></div>').load('".$this->view->url($criteres_recherche->getCVSUrlCriteresWithFacettes(),null,true)."').appendTo($('.cvs_boite'))"); + ->addJQueryReady("$('<div></div>').load('".$this->view->url($criteres_recherche->getCVSUrlCriteresWithFacettes(),null,true)."').appendTo($('.cvs_container'))"); } } diff --git a/application/modules/opac/views/scripts/abonne/tagnotice.phtml b/application/modules/opac/views/scripts/abonne/tagnotice.phtml index d637e20fc629a4af7747e0e22ae4f25913dfcfef..6938f59d4ea3d9507594053ebc14c66b6429cebb 100644 --- a/application/modules/opac/views/scripts/abonne/tagnotice.phtml +++ b/application/modules/opac/views/scripts/abonne/tagnotice.phtml @@ -1,34 +1,34 @@ <center> - <h1><?php echo $this->_('Proposer des tags pour cette notice') ?></h1> - <div class="formTable"> - <?php if($this->message) echo '<p class="erreur">'.$this->message.'</p>'; else echo BR?> - <form name="form" id="form" action="<?php echo $this->view(['module'=>'opac', -'controller'=>'abonne', -'action'=>'tagnotice', -'id_notice'=>$this->id]); ?>" method="post"> - <fieldset> - <legend><?php echo $this->_('Vos propositions') ?></legend> - <table cellspacing="2"> + <h1><?php echo $this->_('Proposer des tags pour cette notice') ?></h1> + <div class="formTable"> + <?php if($this->message) echo '<p class="erreur">'.$this->message.'</p>'; else echo BR?> + <form name="form" id="form" action="<?php echo $this->url(['module'=>'opac', + 'controller'=>'abonne', + 'action'=>'tagnotice', + 'id_notice'=>$this->id]); ?>" method="post"> + <fieldset> + <legend><?php echo $this->_('Vos propositions') ?></legend> + <table cellspacing="2"> - <tr style="height:40px"> - <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> - <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag1" /> - <input type="hidden" value="<?php echo $this->id; ?>" name="id" /> - </td> - </tr> - <tr style="height:40px"> - <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> - <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag2" /></td> - </tr> - <tr style="height:40px"> - <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> - <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag3" /></td> - </tr> + <tr style="height:40px"> + <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> + <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag1" /> + <input type="hidden" value="<?php echo $this->id; ?>" name="id" /> + </td> + </tr> + <tr style="height:40px"> + <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> + <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag2" /></td> + </tr> + <tr style="height:40px"> + <td class="droite"><?php echo $this->traduire("Votre Tag"); ?></td> + <td class="gauche"><input type="text" size="40" maxlength="50" name="abonneTag3" /></td> + </tr> - </table> - </fieldset> - <?php echo $this->formSubmit("", $this->_("Valider"),array("class" => "bouton")) ?> - </form> - </div> + </table> + </fieldset> + <?php echo $this->formSubmit("", $this->_("Valider"),array("class" => "bouton")) ?> + </form> + </div> </center> <br /><br /> diff --git a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml index 0a81328f233ceb8f0d4a30521a002e922982e65a..73b9b5e7d2abad4195c59fef8cdd6a81023e0074 100644 --- a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml +++ b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml @@ -65,20 +65,9 @@ $this->closeBoite(); if (!isset($tags)) $tags=[]; -?> -<?php if ($this->accessCVS) { ?> - <div style="width:100%;display:none" class="cvs_boite"> - <?php - $this->openBoite($preferences['cvs_resultat_titre']); - $this->closeBoite(); - ?> - </div> - <?php - $this->openBoite($preferences['cvs_autres_resultats']); - $this->closeBoite(); - } ?> + <?php $html_liste_notices = $this->listeNotices($this->liste, $nombre, @@ -105,22 +94,40 @@ if (!isset($tags)) $tags=[]; ?> + <div style="width:100%" class="conteneur_simple"> + + <?php + $html_result='<div class="resultat_recherche">'. + (!$preferences['cvs_autres_resultats'] == '' + ? '<h1>'.$preferences['cvs_autres_resultats'].'</h1>' + : ''). + $html_liste_notices.$html_pager. + '</div>'; + ?> + <?php + $html_filters = ''; if ($hasFacettes || $hasTags) { - echo '<div class="filtre_recherche">'; - if ($hasTags && (1 == $tagsPosition)) echo $html_nuage_tags; - if ($hasFacettes) echo $html_facettes; - if ($hasTags && (2 == $tagsPosition)) echo $html_nuage_tags; - echo '</div>'; + $html_filters .= '<div class="filtre_recherche">'; + if ($hasTags && (1 == $tagsPosition)) $html_filters.= $html_nuage_tags; + if ($hasFacettes) $html_filters.= $html_facettes; + if ($hasTags && (2 == $tagsPosition)) $html_filters.= $html_nuage_tags; + $html_filters.= '</div>'; } ?> - <div class="resultat_recherche"> - <?php - echo $html_liste_notices; - echo $html_pager; - ?> - </div> + <?php + $html_cvs=''; + if ($this->accessCVS) + $html_cvs .= '<div class="cvs_container position_'.$preferences['cvs_display_position'].'" style="display:none">'. + '<h1>'.$preferences['cvs_resultat_titre'].'</h1>'. + '</div>'; + + ?> +<?php +echo $this->Search_Result($preferences, $html_result, $html_filters, $html_cvs); +?> + <div class="clear"></div> </div> diff --git a/application/modules/telephone/controllers/AuthController.php b/application/modules/telephone/controllers/AuthController.php index c42a1e76aec167340dc05be7d9e872ccd18e45a6..403e32575f1848ae38ce676239f36410896230a0 100644 --- a/application/modules/telephone/controllers/AuthController.php +++ b/application/modules/telephone/controllers/AuthController.php @@ -70,15 +70,19 @@ class Telephone_AuthController extends AuthController { protected function _getFormLogin() { + $settings = array_merge(['indentifiant_exemple' => $this->view->_('N° de carte'), + 'mot_de_passe_exemple' => $this->view->_('Mot de passe ou date de naissance')], + Class_Profil::getPortail()->getModuleAccueilPreferencesByType('LOGIN')); + $form = new ZendAfi_Form_Mobile_Login(); $form->setAction($this->view->url()); $form->getElement('username') - ->setAttrib('placeholder', $this->view->_('N° de carte')) + ->setAttrib('placeholder', $settings['identifiant_exemple']) ->setAttrib('data-mini', 'true'); $form->getElement('password') - ->setAttrib('placeholder', $this->view->_('Mot de passe ou date de naissance')) + ->setAttrib('placeholder', $settings['mot_de_passe_exemple']) ->setAttrib('data-mini', 'true'); $form->getElement('login') diff --git a/cosmogramme/php/classes/classe_parseur.php b/cosmogramme/php/classes/classe_parseur.php index 9ca796cfc0227dcdb93439894b42599b80ff0e15..e4839a9bb55eba1668d9a32250ed4132b03c8335 100644 --- a/cosmogramme/php/classes/classe_parseur.php +++ b/cosmogramme/php/classes/classe_parseur.php @@ -175,7 +175,7 @@ class parseur // ---------------------------------------------------------------- private function nextAscii($hFic,$separateur) { - $ret["data"]=fGets($hFic); + $ret["data"] = trim(fGets($hFic)); if($separateur != chr(9)) $ret["data"]=str_replace($separateur,chr(9),$ret["data"]); if(feof($hFic)) $ret["statut"]="eof"; else $ret["statut"]="ok"; diff --git a/library/Class/CasTicket.php b/library/Class/CasTicket.php index 47f68c4e696e042b268797d30c5febf9a454d763..19e1bf9da615b9e679265890dfa7dc32fbdc7730 100644 --- a/library/Class/CasTicket.php +++ b/library/Class/CasTicket.php @@ -21,9 +21,14 @@ class Class_CasTicket { public function getTicketForCurrentUser() { if ($user = Class_Users::getIdentity()) - return md5(Zend_Session::getId() . $user->getId()); + return $this->getTicketForUser($user); return null; - } + } + + + public function getTicketForUser($user) { + return md5(Zend_Session::getId() . $user->getId()); + } public function save() { diff --git a/library/Class/MusicMeLink.php b/library/Class/MusicMeLink.php index c7096d87c7a9825f1554d0c854db03a1dd2d41c1..685000285d2d5a7d79ed82973e84673c518af216 100644 --- a/library/Class/MusicMeLink.php +++ b/library/Class/MusicMeLink.php @@ -49,7 +49,7 @@ class Class_MusicMeLink extends Class_WebService_Abstract { $iduser = strtolower($this->_user->getLogin()); $formatted_date=date('YmdHi',$this->getCurrentTime()); $params = ['iduser' => $iduser, - 'ticket' => $this->getTicket(), + 'ticket' => (new Class_CasTicket())->getTicketForUser($this->_user), 'MediaLibraryID' => $bib_id ]; $params['service'] = $this->baseUrl().'?'.http_build_query(array_filter($params)); diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 7b6278dcca90c5b9d6fa4970aa97fa2eba683f0d..72d1b4e23a48c0d9eaf978cfb00e0e712125499e 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -785,7 +785,7 @@ class Class_Notice extends Storm_Model_Abstract { public function getChamp856b() { $data = $this->get_subfield(856, "b"); - return $data[0]; + return isset($data[0]) ? $data[0] : ''; } diff --git a/library/Class/NumilogLink.php b/library/Class/NumilogLink.php index 96c301ed1019da9e619c1759f9ac4c5c1e4c0633..d0aa94a958c9530c44c7cbda9a5a95d8d7e4c6b4 100644 --- a/library/Class/NumilogLink.php +++ b/library/Class/NumilogLink.php @@ -58,7 +58,7 @@ class Class_NumilogLink extends Class_WebService_Abstract { function url(){ if ($this->_user) - return $this->getBaseUrl().'?ticket='.$this->getTicket(); + return $this->getBaseUrl().'?ticket='.(new Class_CasTicket())->getTicketForUser($this->_user); else return $this->getBaseUrl(); } diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 2ae541c25016cb69884f9a52766b49f4302f5142..5ddb12ae60de71a4ce6565ce43d32bdbf3fd028e 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -1649,6 +1649,24 @@ class Class_Profil extends Storm_Model_Abstract { return explode(';', $zones); } + + public function getSearchResultSettings() { + return $this->getConfigurationOf('recherche', 'resultat' , 'simple'); + } + + + public function getConfigurationOf($module,$action, $action2) { + $cfg = $this->getCfgModulesAsArray(); + $default_cfg = (new Class_Systeme_ModulesAppli())->getValeursParDefaut($module, $action); + return + isset($cfg[$module]) + ? (isset($cfg[$module][$action.$action2]) + ? $cfg[$module][$action.$action2] + : $default_cfg) + : $default_cfg; + } + + public function getBrowser() { $browser = $this->_get('browser'); if (!$browser) @@ -1748,7 +1766,7 @@ class Class_Profil extends Storm_Model_Abstract { return key_exists('id_module',$current_value['preferences']) ? $current_value['preferences']['id_module'] : $current_key; } } - return false; + return null; } @@ -1759,7 +1777,7 @@ class Class_Profil extends Storm_Model_Abstract { return $current_key; } } - return false; + return null; } } diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index 5b2a0e9564803fc4fdde56e49c16336e0a158eb6..f890b661c00c3dd3e1aea9dfbe3422f79201368c 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -18,9 +18,7 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// OPAC3 : Pseudo MVC pour pouvoir déclarer les scripts à être chargés dans le head -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + class Class_ScriptLoader { const @@ -256,6 +254,14 @@ class Class_ScriptLoader { } + /** + * @return ScriptLoader + */ + public function addThemeScript($script) { + return $this->addScript(BASE_URL . Class_Profil::getCurrentProfil()->getPathTheme() . 'js/' . $script); + } + + /** * @return ScriptLoader */ diff --git a/library/Class/Systeme/ModulesAppli.php b/library/Class/Systeme/ModulesAppli.php index ef8e2d5b4469fadeb01b27427f279e4f8c574c00..59ba74accfdd6dbfaaea7b982801b3839304f789 100644 --- a/library/Class/Systeme/ModulesAppli.php +++ b/library/Class/Systeme/ModulesAppli.php @@ -229,8 +229,8 @@ class Class_Systeme_ModulesAppli extends Class_Systeme_ModulesAbstract { * @param type string * @return array */ - private function getDefautRecherche($action) { - $ret = array(); + function getDefautRecherche($action) { + $ret = []; switch ((string)$action) { case "simple": @@ -268,6 +268,7 @@ class Class_Systeme_ModulesAppli extends Class_Systeme_ModulesAbstract { $ret["tags_calcul"] = 3; // Méthode de calcul pour les tranches (0=répartition 1=ecart/moyenne 2=ecart/moyenne pondéré) $ret["tags_position"] = 2; // Position 2=sous les facettes 1=sous la liste $ret["tags_message"] = "Elargir la recherche..."; // Message au dessus de la boite + $ret["cvs_display_position"] = 3; //Affichage des ressources CVS $ret["cvs_resultat_titre"] = "Ressources numériques"; // titre résultat de recherche CVS $ret["cvs_autres_resultats"] = "Documents"; // titre résultat de recherche CVS $ret["cvs_msg_deco"] = "Vous devez etre connecté"; diff --git a/library/Class/WebService/Abstract.php b/library/Class/WebService/Abstract.php index 39733fe99fb32e31c88aefcd3246e6a16c9f1f94..8d4d329d15394a0349a12cfc70f207de2013bce6 100644 --- a/library/Class/WebService/Abstract.php +++ b/library/Class/WebService/Abstract.php @@ -50,11 +50,6 @@ abstract class Class_WebService_Abstract { function getMessage() { return $this->_message; } - - function getTicket() { - return md5(Zend_Session::getId()); - } - } ?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/SearchResult.php b/library/ZendAfi/Form/Configuration/SearchResult.php new file mode 100644 index 0000000000000000000000000000000000000000..dcd1d927f973665460059073436d0a66e7535d8d --- /dev/null +++ b/library/ZendAfi/Form/Configuration/SearchResult.php @@ -0,0 +1,258 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + + +class ZendAfi_Form_Configuration_SearchResult extends ZendAfi_Form { + + protected $_text_size = 40; + protected $_num_size = 4; + + + public static function newConfigurationWith($conf) { + $form = new self(); + $form + ->populate($conf) + ->addSelectedFieldFor('liste_codes', $conf['liste_codes']) + ->addSelectedFieldFor('tags_codes', $conf['tags_codes']) + ->addSelectedFieldFor('facettes_codes', $conf['facettes_codes']) + ->addDisplayGroup(['titre', + 'boite', + 'suggestion_achat'], + 'Generalites', + ['legend' => $form->_('Généralités')]) + ->addDisplayGroup(['liste_format', + 'liste_nb_par_page', + 'liste_codes', + 'zones_titre'], + 'liste', + ['legend' => $form->_('Liste')]) + ->addDisplayGroup(['facettes_actif', + 'facettes_nombre', + 'facettes_codes', + 'facettes_message'], + 'facettes', + ['legend' => $form->_('Facettes')]) + ->addDisplayGroup(['tags_actif', + 'tags_position', + 'tags_calcul', + 'tags_nombre', + 'tags_codes' , + 'tags_message'], + 'tags', + ['legend' => $form->_('Nuage de tags')]) + ->addCvsGroup() + ->addDisplayGroup(['submit'], + 'submit', + ['legend' => '']); + + return $form; + } + + + public function init() { + parent::init(); + + $this + ->setAttrib('id', + 'configuration_searchResult') + ->addElement('text', + 'titre', + ['label' => $this->_('Titre'), + 'size' => $this->_text_size]) + ->addElement('select', + 'boite', + ['label' => $this->_('Style de boite'), + 'multiOptions' => ZendAfi_View_Helper_Accueil_Base::getAllWidgetStyles()]) + ->addElement('checkbox', + 'suggestion_achat', + ['label' => $this->_('Lien "Suggérer un achat"')]) + + ->addElement('select', + 'liste_format', + ['label' => $this->_('Format'), + 'multiOptions' => Class_Systeme_ModulesAppli::getAvailableListeNoticeFormat()]) + ->addElement('text', + 'liste_nb_par_page', + ['label' => $this->_('Nombre de notices par page'), + 'size' => $this->_num_size, + 'validators' => [ + ['name' => 'Between', + 'value' => true, + 'options' => [ + 'min' => 3, + 'max' => 50, + 'messages' => 'Le nombre de notices par page doit être compris entre 3 et 50']] + + ]]) + + ->addElement('codeList', + 'liste_codes', + ['label' => $this->_('Champs à afficher'), + 'field' => 'liste', + 'values' => '', + 'required' => true, + 'validators' => [ + ['name' => 'notEmpty', + 'value' => false, + 'options' => [ 'messages' => 'Indiquez au moins 1 champ à afficher pour la liste']] + + ]]) + ->addElement('text' , + 'zones_titre', + ['label' => $this->_('Zones de titre(séparées par ;)'), + 'size' => $this->_text_size]) + + ->addElement('select', + 'facettes_actif', + ['label' => $this->_('Affichage'), + 'multiOptions' => ['0' => $this->_('Ne pas afficher'), + '1' => $this->_('Afficher les facettes')]]) + ->addElement('text', + 'facettes_nombre', + ['label' => $this->_("Nombre d'éléments par facette"), + 'size' => $this->_num_size, + 'validators' => [ + ['name' => 'Between', + 'value' => true, + 'options' => [ + 'min' => 2, + 'max' => 10, + 'messages' => 'Le nombre de facettes doit être compris entre 2 et 10'] + + ]]]) + + ->addElement('codeList', + 'facettes_codes', + ['label' => $this->_('Facettes à afficher'), + 'field' => 'facettes', + 'values' => '', + 'required' => true, + 'validators' => [ + ['name' => 'notEmpty', + 'value' => false, + 'options' => [ 'messages' => 'Indiquez au moins 1 facette à afficher'] + ]]]) + ->addElement('text', + 'facettes_message', + ['label' => $this->_('Message au dessus de la boite'), + 'size' => $this->_text_size]) + ->addElement('select' , + 'tags_actif', + ['label' => $this->_('Affichage'), + 'multiOptions' => ['0' => 'Ne pas afficher les tags', + '1'=>'Afficher les tags']]) + ->addElement('select' , + 'tags_position', + ['label' => $this->_('Position'), + 'multiOptions' => ['2' => 'A côté de la liste', + '1'=>'Sous la liste']]) + ->addElement('select' , + 'tags_calcul', + ['label' => $this->_('Mode de calcul des tranches'), + 'multiOptions' => ['0' => 'Par répartition', + '1'=>'Par écart à la moyenne', + '2' => 'Par écart à la moyenne pondéré']]) + ->addElement('text', + 'tags_nombre', + ['label' => $this->_('Nombre de tags à afficher'), + 'size' => $this->_num_size, + 'validators' => [ + ['name' => 'Between', + 'value' => true, + 'options' => [ + 'min' => 5, + 'max' => 1000, + 'messages' =>'Le nombre de tags doit être compris entre 5 et 1000'] + + ]]]) + ->addElement('codeList', + 'tags_codes', + ['label' => $this->_('Types de tags'), + 'field' => 'tags', + 'values' => '', + 'required' => true, + 'validators' => [ + ['name' => 'notEmpty', + 'value' => false, + 'options' => [ 'messages' => $this->_('Indiquez au moins 1 type de tag à afficher')]] + + ]]) + ->addElement('text', + 'tags_message', + ['label' => $this->_('Message au dessus de la boite'), + 'size' => $this->_text_size]) + ->addElement('select' , + 'cvs_display_position', + ['label' => $this->_('Affichage'), + 'multiOptions' => ['0' => $this->_('Ne pas afficher'), + '1' => $this->_('Afficher au dessus des facettes'), + '2' => $this->_('Afficher au dessous des facettes'), + '3' => $this->_('Afficher au dessus des résultats'), + '4' => $this->_('Afficher au dessous des résultats')]]) + ->addElement('text', + 'cvs_resultat_titre', + ['label' => $this->_('Titre de la boîte'), + 'size' => $this->_text_size]) + ->addElement('text', + 'cvs_autres_resultats', + ['label' => $this->_('Titre résultat recherche'), + 'size' => $this->_text_size]) + ->addElement('text', + 'cvs_nb_result', + ['label' => $this->_('Nombre de résultats à afficher'), + 'size' => $this->_num_size]) + ->addElement('text', + 'cvs_msg_deco', + ['label' => $this->_('Message utilisateur déconnecté'), + 'size' => $this->_text_size]) + ->addElement('text', + 'cvs_msg_droit', + ['label' => $this->_("Message utilisateur sans droit d'accès"), + 'size' => $this->_text_size]) + ->addElement('submit', + 'submit', + ['label' => $this->_('Valider')]); + } + + + public function addSelectedFieldFor($element, $values) { + + $this->$element->setValues($values); + return $this; + } + + + public function addCvsGroup() { + if(Class_AdminVar::isCVSEnabled()) + $this->addDisplayGroup(['cvs_display_position', + 'cvs_resultat_titre', + 'cvs_autres_resultats', + 'cvs_nb_result', + 'cvs_msg_deco', + 'cvs_msg_droit'], + 'cvs', + ['legend' => $this->_('Résultats CVS')]); + return $this; + } + +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Decorator/CodeList.php b/library/ZendAfi/Form/Decorator/CodeList.php new file mode 100644 index 0000000000000000000000000000000000000000..d9512b19caa1863805ea5bf3d82e85a53a7ac34f --- /dev/null +++ b/library/ZendAfi/Form/Decorator/CodeList.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +class ZendAfi_Form_Decorator_CodeList extends Zend_Form_Decorator_Abstract { + /** + * @param string $content + * @return string + */ + public function render($content) { + $data = $this->_element->getView()->tagSelectionChamps($this->_element->getField(), $this->_element->getValues()); + return $data['codes_dispo'].$data["liste_codes"].$data["champ_libelle"].$data["bloc_saisie"]; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Element/CodeList.php b/library/ZendAfi/Form/Element/CodeList.php new file mode 100644 index 0000000000000000000000000000000000000000..494523507df76b79ff2fc968341c8defa243b889 --- /dev/null +++ b/library/ZendAfi/Form/Element/CodeList.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class ZendAfi_Form_Element_CodeList extends Zend_Form_Element { + protected + $_field ='', + $_values=''; + + public function __construct($spec, $options=null) { + parent::__construct($spec, $options); + $decorators = $this->_decorators; + $this->_decorators = ['CodeList' => new ZendAfi_Form_Decorator_CodeList()]; + + foreach ($decorators as $name => $value) + $this->_decorators[$name] = $value; + $this->removeDecorator('ViewHelper'); + + } + + + public function setField($field) { + $this->_field = $field; + return $this; + } + + + public function getField() { + return $this->_field; + } + + + public function getValues() { + return $this->_values; + } + + + public function setValues($values) { + return $this->_values = $values; + } + + + public function getValue() { + return $this->_values; + } + + + + +} + +?> diff --git a/library/ZendAfi/Form/Mobile/Login.php b/library/ZendAfi/Form/Mobile/Login.php index d831a46fdf73c5556a7c5ff49105b1803cf5727d..01369d0a85b2f8b9147d6d547ad1324e405bf213 100644 --- a/library/ZendAfi/Form/Mobile/Login.php +++ b/library/ZendAfi/Form/Mobile/Login.php @@ -24,15 +24,22 @@ class ZendAfi_Form_Mobile_Login extends ZendAfi_Form { parent::init(); $this ->setMethod(Zend_Form::METHOD_POST) - ->setAttrib('autocomplete', 'off') - ->setDecorators(array('FormElements', 'Form')) - ->addElement('text', 'username', array( - 'required' => true, - 'allowEmpty' => false)) - ->addElement('password', 'password', array( - 'required' => true, - 'allowEmpty' => false)) - ->setElementDecorators(array('ViewHelper', 'Label')) - ->addElement('submit', 'login', array('decorators' => array('ViewHelper'))); + ->setAttrib('autocomplete', + 'off') + ->setDecorators(['FormElements', + 'Form']) + ->addElement('text', + 'username', + ['required' => true, + 'allowEmpty' => false]) + ->addElement('password', + 'password', + ['required' => true, + 'allowEmpty' => false]) + ->setElementDecorators(['ViewHelper', + 'Label']) + ->addElement('submit', + 'login', + ['decorators' => ['ViewHelper']]); } } \ 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 bd2c13520f96c5f3b576e8fbeaa1e78e423b1f43..7d9670bfe0ec5c362c656de652849595debf0342 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -99,9 +99,28 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac } - //------------------------------------------------------------------------------------------------------ - // Rend le combo des templates de boites - //------------------------------------------------------------------------------------------------------ + public static function getAllWidgetStyles() { + $profil = Class_Profil::getCurrentProfil(); + $path_boites = $profil->getPathBoites(); + + $dir = opendir($path_boites); + + $template = []; + // Recup des templates + while (false !== ($file = readdir($dir))) { + if(substr($file,-5) != ".html") continue; + $clef=str_replace(".html","",$file); + $template[$clef] = str_replace("_"," ",$clef); + } + closedir($dir); + asort($template); + + return array_merge(["" => self::translate()->_("Boite par défaut de la division")], + $template); + + } + + public static function getComboTemplates($valeur_select, $profil=null) { if (!$profil) $profil = Class_Profil::getCurrentProfil(); diff --git a/library/ZendAfi/View/Helper/Accueil/News.php b/library/ZendAfi/View/Helper/Accueil/News.php index ac1b7313a1a4f8a47c43e9698267a2073a37f9d9..925433e6626ab2e2e67822ad658ee913eabf76a7 100644 --- a/library/ZendAfi/View/Helper/Accueil/News.php +++ b/library/ZendAfi/View/Helper/Accueil/News.php @@ -96,7 +96,8 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base return sprintf('<a href="%s">%s</a>', $this->view->url(['controller' => 'cms', 'action' => 'articleviewselection', - 'id_module' => $this->id_module]), + 'id_module' => $this->id_module, + 'id_menu' => $this->_id_menu]), $this->preferences['titre']); } diff --git a/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php b/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php index a9f6e9638b4646453e1868acae7818bb63e1e52f..476ab3aa7b77a072e11901c21aee53c7c961e8fa 100644 --- a/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php +++ b/library/ZendAfi/View/Helper/Admin/TagSelectionChamps.php @@ -25,22 +25,31 @@ class ZendAfi_View_Helper_Admin_TagSelectionChamps extends ZendAfi_View_Helper_BaseHelper { - public function TagSelectionChamps($rubrique,$valeurs="") - { - if($rubrique == "libelles") return $this->getInitLibelles(); - if($rubrique == "liste") $champs="JTANECR9"; + public function TagSelectionChamps($rubrique,$valeurs='') { + $ret=[]; + $champs=''; + + if($rubrique == "libelles") + return $this->getInitLibelles(); + if($rubrique == "liste") + $champs="JTANECR9"; if($rubrique == "facettes") { $champs="AFMDPLGSBYZ"; $champs.=Class_CodifThesaurus::getFacettesIndex(); } - if($rubrique == "tags") $champs="AFMDPZ"; - if($rubrique == "champs") $champs="TJAMDPLGSBECNR9"; - if($rubrique == "type_tags") $champs="AMDPZY"; - if($rubrique == "champs_tags") $champs="AMDPZY"; + + if($rubrique == "tags") + $champs="AFMDPZ"; + if($rubrique == "champs") + $champs="TJAMDPLGSBECNR9"; + if($rubrique == "type_tags") + $champs="AMDPZY"; + if($rubrique == "champs_tags") + $champs="AMDPZY"; // Champs code et libelle $ret["codes_dispo"]='<script>codes_champ["'.$rubrique.'"]="'.$champs.'";</script>'; - $ret["champ_code"]='<input id="'.$rubrique.'_codes" type="hidden" name="'.$rubrique.'_codes" value="'.$valeurs.'">'; + $ret["liste_codes"]='<input id="'.$rubrique.'_codes" type="hidden" name="'.$rubrique.'_codes" value="'.$valeurs.'">'; $libelles = ''; $rubriques_selectionnees=Class_Notice_RubriqueFacette::parseRubriquesFromPreferenceField($valeurs); @@ -97,9 +106,7 @@ class ZendAfi_View_Helper_Admin_TagSelectionChamps extends ZendAfi_View_Helper_B return $ret; } -//------------------------------------------------------------------------------------------------------ -// Envoie le javascript pour l'initialisation des libellés -//------------------------------------------------------------------------------------------------------ + private function getInitLibelles() { $js='<script>'; @@ -110,4 +117,5 @@ class ZendAfi_View_Helper_Admin_TagSelectionChamps extends ZendAfi_View_Helper_B return $js; } -} \ No newline at end of file +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Album/PlayRessourceUrl.php b/library/ZendAfi/View/Helper/Album/PlayRessourceUrl.php index ce9a0735f4fd3c08c26a014de4fb0642f334050e..680bdd4a0592b56eee29fcabf82d9512df6e2103 100644 --- a/library/ZendAfi/View/Helper/Album/PlayRessourceUrl.php +++ b/library/ZendAfi/View/Helper/Album/PlayRessourceUrl.php @@ -25,7 +25,7 @@ class ZendAfi_View_Helper_Album_PlayRessourceUrl extends Zend_View_Helper_Abstr if (!$extension && $ressource->hasUrl()) return $this->view->absoluteUrl($ressource->getOriginalUrl()); - return $this->view->absoluteUrl('bib-numerique/play-ressource/id/'.$ressource->getId(),null,true).'.'.$extension; + return $this->view->absoluteUrl('/bib-numerique/play-ressource/id/'.$ressource->getId(),null,true).'.'.$extension; } } diff --git a/library/ZendAfi/View/Helper/ListeCVSNotices.php b/library/ZendAfi/View/Helper/ListeCVSNotices.php index 8eb3d0e8642ba2fc4750ded1f14d52c0de98c380..de91b937672f7ec91218868c12f14577aaec852f 100644 --- a/library/ZendAfi/View/Helper/ListeCVSNotices.php +++ b/library/ZendAfi/View/Helper/ListeCVSNotices.php @@ -18,42 +18,19 @@ * along with AFI-OPAC 2.0; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -////////////////////////////////////////////////////////////////////////////////////////// -// OPAC3 : Liste de notices -// formats : 1=liste normale -// 2=liste accordéon -// 3=liste vignette -// 4=Liste images mur -////////////////////////////////////////////////////////////////////////////////////////// + + class ZendAfi_View_Helper_ListeCVSNotices extends ZendAfi_View_Helper_ListeNotices { - /** - * @param array $notices - * @param int $nombre_resultats - * @param int $page - * @param array $preferences - * @return string - */ + public function listeCVSNotices($notices,$nombre_resultats,$page,$preferences) { - $html = '<div class="liste_notices_cvs" >'; - $html .= $this->displayTriRecherche($page,$nombre_resultats, null); - if(!$nombre_resultats) return $html; - $html = $this->displayList($html,$notices,$preferences); - return ($html.'</div>'); + return + !$nombre_resultats + ? '<span>'. + $this->view->_('Aucun document trouvé'). + '</span>' + : '<div class="cvs_record_list">'. + $this->displayList('',$notices,$preferences). + '</div>'; } - - public function displayTriRecherche($page, $nombre_resultats, $criteres_recherche){ - $html='<div class="resultats_cvs_page"><div><span>'; - if(!$nombre_resultats) $html.= $this->view->_('Aucun document trouvé'); - if($nombre_resultats == 1) $html.=$this->view->_('1 document trouvée'); - if($nombre_resultats > 1) $html.=sprintf($nombre_resultats.' %s',$this->view->_('documents trouvés')); - $html.='</span></div></div>'; - - return $html; - } - - public function getUrlNotice($notice){ - return $this->view->url(['controller' => 'modules', 'action' => 'cvs', 'docid'=> $notice->getId()], null, true); - } - } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Permalink.php b/library/ZendAfi/View/Helper/Permalink.php index f52f168a29da8f2f1aa0bea21070649f52551de8..5f709cc8e057c03983ad697bef9af48d74ea4264 100644 --- a/library/ZendAfi/View/Helper/Permalink.php +++ b/library/ZendAfi/View/Helper/Permalink.php @@ -20,12 +20,11 @@ */ class ZendAfi_View_Helper_Permalink extends ZendAfi_View_Helper_BaseHelper { public function permalink($url) { - $icone_permalink= 'reseaux/permalink.png'; - $path_icone_permalink = PATH_SKIN.'images/'.$icone_permalink; + $icone_permalink = 'reseaux/permalink.png'; + $path_icone_permalink = PATH_SKIN . 'images/' . $icone_permalink; $url_icone_permalink = file_exists($path_icone_permalink) - ? URL_IMG.$icone_permalink - : URL_ADMIN_IMG.'reseaux/permalink.gif'; - + ? URL_IMG . $icone_permalink + : URL_ADMIN_IMG . 'reseaux/permalink.gif'; $lien_permanent = $this->translate()->_('Lien permanent'); $html = $this->view->tagImgHover($url_icone_permalink, @@ -34,13 +33,13 @@ class ZendAfi_View_Helper_Permalink extends ZendAfi_View_Helper_BaseHelper { 'alt' => $lien_permanent, 'onclick' => '$(this).next().children().first().toggle()']); - $html.= '<div><div style="display:none;">'; - $html.= '<div>' . $this->translate()->_('Lien permanent') . '</div>'; - $html.= '<div>' . + $html .= '<div><div style="display:none;">'; + $html .= '<div>' . $lien_permanent . '</div>'; + $html .= '<div>' . '<a href="#" onclick="$(this).parent().parent().hide(); return false">» ' . $this->translate()->_('fermer cette fenêtre') . '</a>'. '</div>'; - $html.='<input type="text" value="'.$url.'"/>'; - $html.='</div></div>'; + $html .='<input type="text" value="' . $url . '"/>'; + $html .='</div></div>'; return $html; } diff --git a/library/ZendAfi/View/Helper/Search/Result.php b/library/ZendAfi/View/Helper/Search/Result.php new file mode 100644 index 0000000000000000000000000000000000000000..079f1b5e21221e0496299f03f7d24e3ca1397860 --- /dev/null +++ b/library/ZendAfi/View/Helper/Search/Result.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +////////////////////////////////////////////////////////////////////////////////////////// +// OPAC3 : Liste de notices +// formats : 1=liste normale +// 2=liste accordéon +// 3=liste vignette +// 4=Liste images mur +////////////////////////////////////////////////////////////////////////////////////////// + +class ZendAfi_View_Helper_Search_Result extends ZendAfi_View_Helper_BaseHelper { + /** + * @param array $notices + * @param int $nombre_resultats + * @param int $page + * @param array $preferences + * @param string $url + * @param string $tri + * @return string + */ + public function Search_Result($settings, $html_result, $html_filters, $html_cvs) { + $html = + $html_filters. + $html_result. + $html_cvs; + + if($settings['cvs_display_position']=='1') + $html= + $html_result. + $html_cvs. + $html_filters; + + if($settings['cvs_display_position']=='2' || $settings['cvs_display_position']=='4') + $html= + $html_result. + $html_filters. + $html_cvs; + + if($settings['cvs_display_position']=='3') + $html= + $html_cvs. + $html_result. + $html_filters; + + return $html; + + } +} \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index 8d75bd8dd3a36d2c2fb11c7f5babc287cb008326..45a501c73d53caceb4b73228b56e299c6b1800f3 100644 --- a/library/startup.php +++ b/library/startup.php @@ -56,7 +56,7 @@ function defineConstant($name, $value) { function setupConstants() { - defineConstant('VERSION_PERGAME','V-06.32 [r'.array_at(1, explode(' ', '$Revision$ ')).']'); + defineConstant('VERSION_PERGAME','6.33 [r'.array_at(1, explode(' ', '$Revision$ ')).']'); defineConstant('ROOT_PATH', './'); defineConstant('ZEND_FRAMEWORK_PATH', ROOT_PATH . 'library/storm/zf/library/'); diff --git a/library/storm b/library/storm index 5f32b4d00d6d5f4dcd22dc27e0b260a50e44076f..3d16665ea71f4c40689f1f596589af1a9b936a94 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit 5f32b4d00d6d5f4dcd22dc27e0b260a50e44076f +Subproject commit 3d16665ea71f4c40689f1f596589af1a9b936a94 diff --git a/public/admin/css/global.css b/public/admin/css/global.css index 6ae7f4e669b85e32bb18762f2f532bc4cd81e0d8..a6af4eaaaf5d24a445c446c99ffa3108d826a1b7 100644 --- a/public/admin/css/global.css +++ b/public/admin/css/global.css @@ -93,7 +93,7 @@ option {font-weight:normal; color:#666;} .form input[type='url'], .form input[type='text'] {border:1px solid #C8C8C8;} .form legend{font-weight:bold;font-size:10pt;} -.form label {float:left; font-size:10pt;margin:0pt 0pt 0pt 10px;padding:2px;text-align:left;font-weight:bold;} +.form label {float:left; font-size:10pt;margin:0pt 0pt 0pt 10px;padding:2px;text-align:left;font-weight:bold;min-width:220px;} .form select {border:1px solid #C8C8C8;padding:2px;color:#000000;font-family:"Verdana";font-size: 8pt;color:#575757} .form option {color:#000000;} .form textarea {border:1px solid #C8C8C8;padding:2px;width:100%;font-family: "Verdana";font-size: 8pt;} diff --git a/public/opac/css/global.css b/public/opac/css/global.css index a34ff488ba498df5d6e2ef10c3e25725b0e77fbe..85268e90f69ce3ef734bd2d696d9e9404bc300e9 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -2645,4 +2645,25 @@ a.readspeaker { .barre_nav span + span:before { padding:0px 5px; content:">"; -} \ No newline at end of file +} + + +.cvs_container.position_0 { + display:none!important; +} + +.cvs_container.position_1, +.cvs_container.position_2 { + float:right; + clear:right; + display:block; + width:40%!important; +} + +.cvs_container.position_3, +.cvs_container.position_4 { + float:left; + clear:left; + display:block; + width:100%!important; +} diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 8bf5bed67583608f86d0511ed37f8bd2df2d49c8..5fa1e44a7146e58187047e0e2190065c3c9db196 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -229,7 +229,7 @@ class CmsControllerArticleEditWithoutLanguesTest extends CmsControllerTestCase { /** @test */ - function traductionsSelectorShouldNotBeVisible() { + public function traductionsSelectorShouldNotBeVisible() { $this->assertNotXPath('//div[@class="traduction_navigator"]'); } } @@ -252,6 +252,7 @@ class CmsControllerArticleConcertAsAdminPortailEditActionTest extends CmsControl $this->dispatch('/admin/cms/newsedit/id/4', true); } + /** @test */ public function articleShouldcontainsAuteurTomEtJerry() { $this->assertXPathContentContains('//td','Tom et Jerry'); @@ -638,8 +639,8 @@ class CmsControllerArticleConcertEditActionTest extends CmsControllerTestCase { /** @test */ - function permalinkShouldContainsArticleUrl() { - $this->assertXPath('//div//input[contains(@value, "cms/articleview/id/4")]'); + public function permalinkShouldContainsArticleAbsoluteUrl() { + $this->assertXPath('//div//input[contains(@value, "cms/articleview/id/4")][contains(@value, "http://")]'); } diff --git a/tests/application/modules/admin/controllers/ModulesControllerTest.php b/tests/application/modules/admin/controllers/ModulesControllerTest.php index 70ddfb960e2dc7f7bc9d34d3ce5b87b0c1e06d9c..6530b78b047c8005faa0ec148120aaf171973abc 100644 --- a/tests/application/modules/admin/controllers/ModulesControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesControllerTest.php @@ -143,17 +143,31 @@ class ModulesControllerRechercheSaisieTest extends Admin_AbstractControllerTestC -class ModulesControllerConfigRechercheResultatWithPreferencesWithSuggestionAchatEnabledTest extends Admin_AbstractControllerTestCase { +class ModulesControllerConfigRechercheResultatWithPreferencesWithPreferencesTest extends Admin_AbstractControllerTestCase { public function setUp() { parent::setUp(); + + RessourcesNumeriquesFixtures::disableCVS(); + + $default_search_conf = (new Class_Systeme_ModulesAppli())->getDefautRecherche('resultat'); Class_Profil::getCurrentProfil() - ->setCfgModules(['recherche' => ['resultatsimple' => ['suggestion_achat' => 1, - 'zones_titre' => '200$e;200$f']]]); + ->setCfgModules( + ['recherche' => ['resultatsimple' => + array_merge($default_search_conf, + ['suggestion_achat' => 1, + 'zones_titre' => '200$e;200$f'])]]); + $this->dispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=resultat&action2=simple', true); } + /** @test **/ + public function fieldSetResultatCVSShouldBeDisplay() { + $this->assertNotXPathContentContains('//fieldset//legend', 'Résultats CVS'); + } + + /** @test */ public function checkboxSuggestionAchatShouldBeChecked() { $this->assertXPath('//input[@type="checkbox"][@name="suggestion_achat"][@checked="checked"]'); @@ -167,8 +181,29 @@ class ModulesControllerConfigRechercheResultatWithPreferencesTest extends Admin_ public function setUp() { parent::setUp(); Class_Profil::getCurrentProfil() - ->setCfgModules(['recherche' => ['resultatsimple' => ['suggestion_achat' => 0, - 'zones_titre' => '200$e;200$f']]]); + ->setCfgModules( + ['recherche' => ['resultatsimple' => ['suggestion_achat' => 0, + 'zones_titre' => '200$e;200$f', + 'titre' => 'ok', + 'liste_format' => 1, + 'liste_nb_par_page' => 50, + 'liste_codes' => 'TAENR', + 'facettes_actif' => '1', + 'facettes_nombre' => '6', + 'facettes_codes' => 'SAMDL', + 'facettes_message' => 'Affiner le résultat...', + 'tags_actif' => '1', + 'tags_position' => '2', + 'tags_calcul' => '0', + 'tags_nombre' => '30', + 'tags_codes' => 'AMDPZ', + 'tags_message' => 'Elargir la recherche...', + 'cvs_display_position' => '0', + 'cvs_resultat_titre' => 'Ressources numériques CVS', + 'cvs_autres_resultats' => 'Autres documents', + 'cvs_nb_result' => '5', + 'cvs_msg_deco' => 'Vous devez etre connecté', + 'cvs_msg_droit' => 'Merci de contacter la médiathèque pour obtenir un accès.']]]); $this->dispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=resultat&action2=simple', true); } @@ -212,7 +247,7 @@ class ModulesControllerConfigRechercheResultatWithPreferencesTest extends Admin_ /** @test */ public function champTitreShouldBeAvailableForDisplayModeTable() { - $this->assertXPathContentContains('//div[@code="J"]', 'Titre'); + $this->assertXPathContentContains('//div[@code="J"]', 'Titre', $this->_response->getBody()); } @@ -361,4 +396,180 @@ class ModulesControllerChangeKiosqueSelectionPostSaveNullPanierTest extends Modu $this->assertEquals(0, $this->saved_preferences['id_panier']); } } -?> + + + +class ModulesControllerRechercheWithCVSActivateTest extends Admin_AbstractControllerTestCase { + + public function setup() { + parent::setup(); + RessourcesNumeriquesFixtures::activateCVS(); + + $this->dispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=resultat&action2=simple', true); + } + + + /** @test **/ + public function fieldSetResultatCVSShouldBeDisplay() { + $this->assertXPathContentContains('//fieldset//legend', 'Résultats CVS'); + } + + + /** @test **/ + public function selectCvsDisplayPositionShouldVisible() { + $this->assertXPath('//select[@name="cvs_display_position"]'); + } + + + /** @test **/ + public function byDefaultSelectCvsDisplayPositionShouldHaveTopOfListeSelected() { + $this->assertXPath('//select[@name="cvs_display_position"]//option[@value="3"][@selected="selected"]'); + } +} + + + +class ModulesControllerRechercheWithCVSActivatePostTest extends Admin_AbstractControllerTestCase { + + public function setup() { + parent::setup(); + RessourcesNumeriquesFixtures::activateCVS(); + + $this->postDispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=resultat&action2=simple', + [ 'titre' => 'ok', + 'suggestion_achat' => 0, + 'liste_format' => 1, + 'liste_nb_par_page' => 50, + 'liste_codes' => 'TAR', + 'zones_titre' => '200$e;200$h;200$i', + 'facettes_actif' => '1', + 'facettes_nombre' => '6', + 'facettes_codes' => 'SAMDL', + 'facettes_message' => 'Affiner le résultat...', + 'tags_actif' => '1', + 'tags_position' => '2', + 'tags_calcul' => '0', + 'tags_nombre' => '30', + 'tags_codes' => 'AMDPZ', + 'tags_message' => 'Elargir la recherche...', + 'cvs_display_position' => '0', + 'cvs_resultat_titre' => 'Ressources numériques CVS', + 'cvs_autres_resultats' => 'Autres documents', + 'cvs_nb_result' => '5', + 'cvs_msg_deco' => 'Vous devez etre connecté', + 'cvs_msg_droit' => 'Merci de contacter la médiathèque pour obtenir un accès.', + 'erreur' => false]); + + $this->saved_preferences = Class_Profil::getCurrentProfil()->getCfgModulesAsArray()['recherche']['resultatsimple']; + } + + + /** @test **/ + public function listeCodesShouldBeTar() { + $this->assertEquals('TAR', $this->saved_preferences['liste_codes']); + } + + + /** @test */ + public function listNbByPageShouldBe50() { + $this->assertEquals(50, $this->saved_preferences['liste_nb_par_page']); + } + + + /** @test */ + public function facettesNombreShouldBe6() { + $this->assertEquals(6, $this->saved_preferences['facettes_nombre']); + } + + + /** @test **/ + public function titleShouldBe0() { + $this->assertEquals(0, $this->saved_preferences['suggestion_achat']); + } + + + /** @test **/ + public function listeSuggestionShouldBeOk() { + $this->assertEquals('ok', $this->saved_preferences['titre']); + } + + + + /** @test */ + public function afterSaveCvsDisplayPositionShouldBe0() { + $this->assertEquals(0, $this->saved_preferences['cvs_display_position']); + } + +} + + + +class ModulesControllerSearchPostValidationTest extends Admin_AbstractControllerTestCase { + + public function setup() { + parent::setup(); + } + + + public function expectedError() { + $default_search_conf = + (new Class_Systeme_ModulesAppli())->getDefautRecherche('resultat'); + + return + [ + [array_merge($default_search_conf, + ['liste_nb_par_page' => 1]), + 'Le nombre de notices par page doit être compris entre 3 et 50'], + + [array_merge($default_search_conf, + ['liste_nb_par_page' => 51]), + 'Le nombre de notices par page doit être compris entre 3 et 50'], + + [array_merge($default_search_conf, + ['liste_codes' => '']), + 'Indiquez au moins 1 champ à afficher pour la liste'], + + [array_merge($default_search_conf, + ['facettes_actif' => 1, + 'facettes_nombre' => 0]), + 'Le nombre de facettes doit être compris entre 2 et 10'], + + [array_merge($default_search_conf, + ['facettes_actif' => 1, + 'facettes_nombre' => 15]), + 'Le nombre de facettes doit être compris entre 2 et 10'], + + [array_merge($default_search_conf, + ['facettes_actif' => '1', + 'facettes_codes' => '']), + 'Indiquez au moins 1 facette à afficher'], + + [array_merge($default_search_conf, + ['tags_actif' => '1', + 'tags_nombre' => 4]), + 'Le nombre de tags doit être compris entre 5 et 1000'], + + [array_merge($default_search_conf, + ['tags_actif' => '1', + 'tags_nombre' => 1001]), + 'Le nombre de tags doit être compris entre 5 et 1000'], + + [array_merge($default_search_conf, + ['tags_actif' => '1', + 'tags_codes' => '']), + 'Indiquez au moins 1 type de tag à afficher'] + + ]; + } + + + /** + * @dataProvider expectedError + * @test **/ + public function validationTest($default_search_conf, $error) { + $this->postDispatch('/admin/modules/recherche?config=site&type_module=recherche&id_profil=2&action1=resultat&action2=simple', $default_search_conf); + $this->assertXPathContentContains('//div[@class="formTable"]', $error, $this->_response->getBody()); + } +} + +?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/AbonneControllerTagNoticeTest.php b/tests/application/modules/opac/controllers/AbonneControllerTagNoticeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0231ad7727f5f540d67e24341370bf7c869f6d8d --- /dev/null +++ b/tests/application/modules/opac/controllers/AbonneControllerTagNoticeTest.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +require_once 'AbstractControllerTestCase.php'; + +class AbonneControllerTagNoticeTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + $this->fixture('Class_Notice', + ['id' => 23]); + + + $this->dispatch('/abonne/tagnotice/id_notice/23', true); + } + + /** @test */ + public function controllerAndActionShouldBeAbonneTagnotice() { + $this->assertController('abonne'); + $this->assertAction('tagnotice'); + } +} + +?> diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index 7a7f0591de9fe5cfb5f57b37d56e7e82389bdeee..19015ecd177b63d88856236b385b29534b5b329f 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -405,6 +405,35 @@ class AuthControllerNobodyLoggedAndNoRegistrationTest extends AuthControllerNobo +class AuthControllerNobodyLoggedAndNoRegistrationOnLoginPageTest extends AuthControllerNobodyLoggedTestCase { + + public function setUp() { + parent::setUp(); + $interdire_enregistrement = new Class_AdminVar(); + $interdire_enregistrement + ->setId('INTERDIRE_ENREG_UTIL') + ->setValeur(1); + Class_AdminVar::getLoader()->cacheInstance($interdire_enregistrement); + + + $this->dispatch('/opac/auth/login'); + } + + + /** @test **/ + public function linkRegisterShouldNotBeDisplayInLoggingBox() { + $this->assertNotXPath('//div[@id="boite_login"]//a[contains(@href, "auth/register")]'); + } + + + /** @test **/ + public function linkRegisterShouldNotBeDisplayInPageAuthLogin() { + $this->assertNotXPath('//div[@id="fieldset-login_form"]//a[contains(@href, "auth/register")]'); + } +} + + + class AuthControllerNobodyLoggedAndNoRegistrationAllowedAjaxLoginTest extends AuthControllerNobodyLoggedTestCase { protected @@ -820,7 +849,7 @@ class AuthControllerPostSuccessfulFromMusicMeCASClientTest extends AuthControlle /** @test */ public function responseShouldRedirectToMusicMeCasClientWithTicketAndBibId() { - $ticket=md5(Zend_Session::getId()); + $ticket=md5(Zend_Session::getId(). '2'); $this->assertRedirectTo('http://musicmeurl/?iduser=foo&ticket='.$ticket.'&MediaLibraryID=888&service=http%3A%2F%2Fmusicmeurl%2F%3Fiduser%3Dfoo%26ticket%3D'.$ticket.'%26MediaLibraryID%3D888'); } diff --git a/tests/application/modules/opac/controllers/CasServerControllerTest.php b/tests/application/modules/opac/controllers/CasServerControllerTest.php index a2d141efe3c4847c2135e7173ac1e93c713225b2..e0b6fb69c6adea0d92f39183d5dc8b262529424c 100644 --- a/tests/application/modules/opac/controllers/CasServerControllerTest.php +++ b/tests/application/modules/opac/controllers/CasServerControllerTest.php @@ -66,14 +66,10 @@ class CasServerControllerMusicMeValidateActionTest extends AbstractControllerTes public function setUp() { parent::setUp(); - $user = new StdClass(); - $user->ID_USER=300; - $user->PRENOM='Tom'; - $user->NOM = 'Ate'; - Class_Users::newInstanceWithId(300, - ['nom' => 'Ate', - 'prenom' => 'Tom']); - Zend_Registry::get('cache')->save('300', md5(Zend_Session::getId().'300')); + $tom = Class_Users::newInstanceWithId(300, + ['nom' => 'Ate', + 'prenom' => 'Tom']); + ZendAfi_Auth::getInstance()->logUser($tom); } @@ -84,18 +80,17 @@ class CasServerControllerMusicMeValidateActionTest extends AbstractControllerTes } - /** @test */ - public function requestMusicMeWithExpiredTicketShouldRespondInvalidTicketFailureXML() { - $this->dispatch('/opac/cas-server/validate-musicme?MediaLibraryID=STmarchepo&ticket=28282'); - // $this->assertContains('<AccountExpired>true',$this->_response->getBody()); - } - - /** @test */ public function requestMusicMeWithValidTicketShouldRespondValidXML() { $this->dispatch('/opac/cas-server/validate-musicme?ticket='.md5(Zend_Session::getId().'300').'&MediaLibraryID=http://test.com'); $this->assertContains('<ID>300</ID>',$this->_response->getBody()); + } + + /** @test */ + public function musicmeUrlShouldContainsTicket0a1b2c3d() { + $expected_ticket = md5(Zend_Session::getId().'300'); + $this->assertContains('ticket='.$expected_ticket.'&', Class_MusicMeLink::forUser(Class_Users::find(300))->url()); } } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index 1b150fc2c36301e71cf832ef4cc24e94c7b06000..0d002829b447c7cfd9d88524c92e28c81daba982 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -1171,6 +1171,59 @@ class CmsControllerArticleViewSelectionTest extends CmsControllerListTestCase { +class CmsControllerArticleViewSelectionFromHorizontalMenuBoxTest extends AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + + + $cfg_menus = ['H' => ['libelle' => 'Menu horizontal', + 'picto' => 'vide.gif', + 'menus' => [['type_menu' => 'MENU', + 'libelle' => 'Pratique', + 'picto' => 'bookmark.png', + 'preferences' => [], + 'sous_menus' => [ + ['type_menu' => 'NEWS', + 'libelle' => 'Nouvelles', + 'picto' => 'vide.gif', + 'preferences' => ['titre' => 'Nouvelles', + 'id_items' => 2, + 'display_order' => 'Selection']] + ] + ]] + ]]; + + $this->fixture('Class_Profil', + ['id' => 3, + 'libelle' => 'Concerts', + 'cfg_menus' => $cfg_menus])->beCurrentProfil(); + + $article = $this->fixture('Class_Article', + ['id' => 2, + 'titre' => 'Ibrahim Maalouf', + 'contenu' => 'En concert !']); + + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->with(['titre' => 'Nouvelles', + 'id_items' => 2, + 'display_order' => 'Selection', + 'nb_aff' => 30]) + ->answers([$article]); + + $this->dispatch('/cms/articleviewselection/id_module/1/id_menu/H', true); + } + + + /** @test */ + public function pageShouldRenderArticleIbrahimMaalouf() { + $this->assertXPathContentContains('//div', 'Ibrahim Maalouf'); + } +} + + + + class CmsControllerArticleViewPreferencesBySelectionTest extends CmsControllerListTestCase { protected function _dispatchHook() { $this->dispatch('/cms/articleviewpreferences?id_items=1-3&display_order=Selection'); diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index 8dfbea9dd41c1d366b16e22dfdb9db1ff839de28..2dd2533aaf06edd1ebaf6f4bf20085dfa89f02bf 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -964,79 +964,110 @@ class NoticeAjaxControllerNoticeWithAvisAvisTest extends NoticeAjaxControllerNot } - - -abstract class NoticeAjaxControllerCvsSearchTest extends AbstractControllerTestCase { - public function setUp() { - parent::setUp(); - $logged_user=Class_Users::newInstanceWithId(15,['login'=>'polo'])->beAbonneSIGB(); - $this->group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia', - 'rights_token' => Class_UserGroup::RIGHT_ACCES_ARTEVOD]); +abstract class NoticeAjaxControllerCvsSearchtest extends AbstractControllerTestCase { + public function setup() { + parent::setup(); + RessourcesNumeriquesFixtures::activateCVS(); + $group_cvs = $this->fixture('Class_UserGroup', ['id' => 20 , + 'libelle' => 'CVS acces', + 'rights_token' => Class_UserGroup::RIGHT_ACCES_ARTEVOD]); + $polo= $this->fixture('Class_Users', ['id' => 15, + 'login' => 'polo', + 'password' => '456', + 'pseudo' => 'polo']) + ->beAbonneSIGB() + ->setUserGroups([$group_cvs]); - $logged_user->beAbonneSIGB() - ->setUserGroups([$this->group_multimedia]); - ZendAfi_Auth::getInstance()->logUser($logged_user); - - $preferences = [ - 'cvs_nb_result' => '5']; + ZendAfi_Auth::getInstance()->logUser($polo); + } +} - $this->mock_cvs = Storm_Test_ObjectWrapper::mock(); +class NoticeAjaxControllerCvsSearchWithNoRecordTest extends NoticeAjaxControllerCvsSearchtest { + public function setUp() { + parent::setUp(); + + $mock_cvs = Storm_Test_ObjectWrapper::mock(); - RessourcesNumeriquesFixtures::activateCVS(); Storm_Test_ObjectWrapper::mock() ->whenCalled('forUser') ->answers($this->mock_cvs); - $this->mock_cvs + $mock_cvs ->whenCalled('searchNotices') ->answers([]); - Class_Profil::getCurrentProfil()->setCfgModules(['recherche' => ['resultat' => $preferences]]); + + Class_Profil::getCurrentProfil()->setCfgModules(['recherche' => ['resultat' => []]]); $this->dispatch('/opac/noticeajax/cvs-search/expressionRecherche/Cuisson/page/2', true); } /** @test */ - public function withNoResultShouldReturnAucunDocument() { - $this->assertContains('Aucun document trouvé',$this->_response->getBody()); + public function resultShouldReturnEmptyMessage() { + $this->assertXPathContentContains('//div[@id="cvs_result"]/span','Aucun document trouv',$this->_response->getBody()); } } -abstract class NoticeAjaxControllerCvsWithNoticesSearchTest extends AbstractControllerTestCase { +class NoticeAjaxControllerCvsWithRecordsSearchTest extends NoticeAjaxControllerCvsSearchtest { + protected $_cvs; + protected $_http_client; + public function setUp() { parent::setUp(); - $logged_user=Class_Users::newInstanceWithId(15,['login'=>'polo'])->beAbonneSIGB(); - $this->group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia', - 'rights_token' => Class_UserGroup::RIGHT_ACCES_ARTEVOD]); + + Class_Profil::getCurrentProfil() + ->setCfgModules(['recherche' => + ['resultatsimple' => [ 'cvs_display_position' => '1', + 'liste_format' => 3, + 'cvs_nb_result' => 2]]]); + + RessourcesNumeriquesFixtures::activateCVS(); + $record = $this->fixture('Class_Notice',['id'=> 10, + 'titre_principal' => 'Le photographe', + 'auteur_principal' => 'Guibert']); + $this->_cvs = Class_CVSLink::forUser($record); + $this->_http_client = Storm_Test_ObjectWrapper::mock(); + + Class_CVSLink::setTimeSource((new TimeSourceForTest)->setTime(1369640315)); + Class_CVSLink::setDefaultHttpClient($this->_http_client); + Class_Xml::setDefaultHttpClient($this->_http_client); + RessourcesNumeriquesFixtures::activateCVS(); - $logged_user->beAbonneSIGB() - ->setUserGroups([$this->group_multimedia]); - ZendAfi_Auth::getInstance()->logUser($logged_user); + $this->_http_client + ->whenCalled('postData') + ->answers($this->_returnedXML()) + ; - $preferences = [ - 'cvs_nb_result' => '5']; - RessourcesNumeriquesFixtures::activateCVS(); + $this->dispatch('/opac/noticeajax/cvs-search/expressionRecherche/Cuisson/page/1', true); + } - $this->mock_cvs = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_CVSLink'); - $this->mock_cvs - ->whenCalled('searchNotices') - ->answers([Class_Notice::newInstanceWithId('10')]); - $this->mock_cvs - ->whenCalled('forUser') - ->answers($this->mock_cvs); - - Class_Profil::getCurrentProfil()->setCfgModules(['recherche' => ['resultat' => $preferences]]); - $this->dispatch('/opac/noticeajax/cvs-search/expressionRecherche/Cuisson/page/2', true); + protected function _returnedXML() { + $xml = file_get_contents(realpath(dirname(__FILE__)). '/../../../../fixtures/cvs_search_ecole.xml'); + return $xml; } /** @test */ - public function withesultShouldReturnAucunDocument() { - $this->assertContains('Aucun document trouvé',$this->_response->getBody()); + public function simpleContentShouldContainsCVSDiv() { + $this->assertXPath('//div[@id="cvs_result"]//div[@class="cvs_record_list"]', $this->_response->getBody()); + } + + + /** @test **/ + public function resultFormatShouldBeVignetteMode() { + $this->assertXPath('//div[@class="liste_vignettes"]'); + } + + + /** @test **/ + public function cvsSearchRequestShouldHaveNbParPage2() { + $xml= base64_decode(strtr($this->_http_client->getAttributesForLastCallOn('postData')[1]['xml'], '-_', '+/')); + $xpath = new Storm_Test_XPathXML(); + $xpath->assertXPath($xml,'//nombre_par_page[contains(text(),2)]'); } } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 8a005f4b2045f429feacf15a62147d61bcf062d2..b7aefbb01c682982915be5cde91b0f2168131dc1 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -75,7 +75,12 @@ abstract class ProfilOptionsControllerWithProfilAdulteTestCase extends AbstractC ['type_menu' => 'PROFIL', 'libelle' => 'Profil jeunesse', 'preferences' => ['clef_profil' => 230], - 'picto' => 'vide.gif' ] + 'picto' => 'vide.gif' ], + + ['type_menu' => Class_Systeme_ModulesMenu::MODULE_ACCUEIL_PREFIX.'NEWS', + 'libelle' => 'Nouvelles', + 'picto' => 'vide.gif', + 'preferences' => ['titre' => 'Nouvelles']], ]], @@ -395,7 +400,14 @@ class ProfilOptionsControllerViewProfilAdulteTest extends ProfilOptionsControlle /** @test */ public function menuHorizontalBoiteCritiquesShouldContainsIdMenuInTitleLink() { $this->assertXPathContentContains('//div[@id="menu_horizontal"]//div[@class="boite critiques"]//a[contains(@href, "blog/viewcritiques?id_module=2&id_menu=H")]', - 'Coup de coeur', + 'Coup de coeur'); + } + + + /** @test */ + public function menuHorizontalBoiteNewsShouldContainsIdMenuInTitleLink() { + $this->assertXPathContentContains('//div[@id="menu_horizontal"]//div[@class="boite news"]//a[contains(@href, "cms/articleviewselection/id_module/5/id_menu/H")]', + 'Nouvelles', $this->_response->getBody()); } @@ -506,7 +518,7 @@ class ProfilOptionsControllerViewProfilAdulteAsAdminTest extends ProfilOptionsCo /** @test */ public function menuHorizontalCalendrierConfigShouldContainsConfigTypeMenu() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite calendar"]//img[contains(@onclick, "menus/calendrier?config=menu&id_profil=22&id_module=10&type_menu=MODULE_ACCUEIL_CALENDAR&preferences=nb_events%3D5")]'); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite calendar"]//img[contains(@onclick, "menus/calendrier?config=menu&id_profil=22&id_module=11&type_menu=MODULE_ACCUEIL_CALENDAR&preferences=nb_events%3D5")]'); } @@ -518,7 +530,7 @@ class ProfilOptionsControllerViewProfilAdulteAsAdminTest extends ProfilOptionsCo /** @test */ public function menuHorizontalKiosqueConfigShouldContainsConfigTypeMenu() { - $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite kiosque"]//img[contains(@onclick, "menus/kiosque?config=menu&id_profil=22&id_module=11&type_menu=MODULE_ACCUEIL_KIOSQUE&preferences=id_panier%3D1%7Cstyle_liste%3Dmur")]',$this->_response->getBody()); + $this->assertXPath('//div[@id="menu_horizontal"]//li[@class="menu boite"]//div[@class="boite kiosque"]//img[contains(@onclick, "menus/kiosque?config=menu&id_profil=22&id_module=12&type_menu=MODULE_ACCUEIL_KIOSQUE&preferences=id_panier%3D1%7Cstyle_liste%3Dmur")]',$this->_response->getBody()); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php index 51e9f67118e7d32d0bec4b44d266d0f5ff5aab29..cee33ca145cd2c891b7c144a257bbfbe987c7667 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php @@ -116,7 +116,7 @@ class RechercheControllerAlbumAudioRecordViewNoticeTest extends RechercheControl /** @test */ public function noticeFirstMorceauUrlEcouteShouldBeMoonchildDotMP3() { - $this->assertContains('bib-numerique/play-ressource/id/1.mp3', + $this->assertContains('/bib-numerique/play-ressource/id/1.mp3', $this->_notice->getMorceaux()['morceaux'][1][1]['url_ecoute']); } @@ -147,7 +147,7 @@ class RechercheControllerAlbumAudioRecordViewMorceauxTest extends RechercheContr /** @test */ public function moonchildPlayerShouldBePresent() { - $this->assertXPath('//audio/source[contains(@src, "bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); + $this->assertXPath('//audio/source[contains(@src, "/bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); } @@ -210,7 +210,7 @@ class RechercheControllerAlbumAudioRecordViewRessourcesNumeriquesTest extends Re /** @test */ public function moonchildPlayerShouldBePresent() { - $this->assertXPath('//ol//li//audio/source[contains(@src, "bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); + $this->assertXPath('//ol//li//audio/source[contains(@src, "/bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); } @@ -265,7 +265,7 @@ class RechercheControllerAlbumAudioRecordAsTelephoneViewRessourcesNumeriquesTest /** @test */ public function moonchildPlayerShouldBePresent() { - $this->assertXPath('//ol//li//audio/source[contains(@src, "bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); + $this->assertXPath('//ol//li//audio/source[contains(@src, "/bib-numerique/play-ressource/id/1.mp3")]', $this->_response->getBody()); } diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index 559d604af2be609cb0c21326ba7a572cf1dd77bf..9997b2c763cdab9d1833416aa7419aab75f8e1fa 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -1772,4 +1772,119 @@ class RechercheControllerViewNoticeWichIsInMyPanier extends AbstractControllerTe } } + + + +class RechercheControllerSimpleActionWithCvsActivatedTest extends RechercheControllerSimpleActionTestCase { + + protected $_cvs; + + public function setUp() { + parent::setUp(); + + Class_Profil::getCurrentProfil() + ->setCfgModules(['recherche' => + ['resultatsimple' => [ 'cvs_autres_resultats' => 'Results from opac', + 'cvs_resultat_titre' => 'CVS Ressources', + 'cvs_nb_result' => '5', + 'cvs_display_position' => '1']]]); + + RessourcesNumeriquesFixtures::activateCVS(); + $group_cvs = $this->fixture('Class_UserGroup', ['id' => 20 , + 'libelle' => 'CVS acces', + 'rights_token' => Class_UserGroup::RIGHT_ACCES_CVS]); + + $polo = $this->fixture('Class_Users', ['id' => 15, + 'login' => 'polo', + 'password' => '456', + 'pseudo' => 'polo', + 'date_fin' => '2025-04-26']) + ->beAbonneSIGB() + ->setUserGroups([$group_cvs]); + + ZendAfi_Auth::getInstance()->logUser($polo); + $record = $this->fixture('Class_Notice',['id'=> 10, + 'titre_principal' => 'Le photographe', + 'auteur_principal' => 'Guibert']); + $this->_cvs = Class_CVSLink::forUser($record); + $http_client = Storm_Test_ObjectWrapper::mock(); + + Class_CVSLink::setDefaultHttpClient($http_client); + Class_Xml::setDefaultHttpClient($http_client); + RessourcesNumeriquesFixtures::activateCVS(); + + $http_client + ->whenCalled('postData') + ->answers($this->_returnedXML()); + + $this->dispatch('/recherche/simple/expressionRecherche/pomme/tri/alpha_auteur',true); + + } + + protected function _returnedXML() { + $xml = file_get_contents(realpath(dirname(__FILE__)). '/../../../../fixtures/cvs_search_ecole.xml'); + return $xml; + } + + + /** @test **/ + public function titleResultFromOpacShouldBeDiplay() { + $this->assertXPathContentContains('//h1','Results from opac'); + } + + + /** @test */ + public function simpleContentShouldContainsCVSDiv() { + $this->assertXPath('//div[@class="conteneur_simple"]//div[contains(@class,"cvs_container")]', $this->_response->getBody()); + } + + + /** @test **/ + public function cvsBoiteShouldHaveTitreCVSRessources() { + $this->assertXPathContentContains('//div[@class="conteneur_simple"]//div[contains(@class,"cvs_container")]//h1', 'CVS Ressources', $this->_response->getBody()); + } + + /** @test **/ + public function cvsBoiteClassShouldHavePosition1() { + $this->assertXPath('//div[@class="conteneur_simple"]//div[@class="cvs_container position_1"]', $this->_response->getBody()); + } +} + + + +class RechercheControllerSimpleActionWithCvsActivatedAndPreferencesHiddenTest extends RechercheControllerSimpleActionTestCase { + public function setUp() { + parent::setUp(); + + Class_Profil::getCurrentProfil() + ->setCfgModules(['recherche' => + ['resultatsimple' => [ 'cvs_display_position' => '0']]]); + $zork = $this->fixture('Class_Users', + ['id' => 4, + 'login' => 'zork_sigb', + 'role_level' => 2, + 'idabon' => '98475', + 'id_site' => 2, + 'password' => 'xzy']); + $group_multimedia = Class_UserGroup::newInstanceWithId('20', ['libelle' => 'Multimedia', + 'rights_token' => Class_UserGroup::RIGHT_ACCES_CVS]); + + + $zork->beAbonneSIGB() + ->setUserGroups([$this->group_multimedia]) + ->save(); + ZendAfi_Auth::getInstance()->logUser($zork); + RessourcesNumeriquesFixtures::activateCVS(); + + $this->dispatch('/recherche/simple/expressionRecherche/pomme/tri/alpha_auteur',true); + + } + + + /** @test */ + public function simpleContentShouldNotContainsCVSDiv() { + $this->assertNotXPath('//div[@class="conteneur_simple"]//div[contains(@class,"cvs_container")]', $this->_response->getBody()); + } + +} ?> diff --git a/tests/application/modules/telephone/controllers/AuthControllerTest.php b/tests/application/modules/telephone/controllers/AuthControllerTest.php index c283e9d81c2408da98c17937efcfc62fff2f8a2c..e0a3d5ceba0a1ad5310bbbdc237b71ebb9e2adff 100644 --- a/tests/application/modules/telephone/controllers/AuthControllerTest.php +++ b/tests/application/modules/telephone/controllers/AuthControllerTest.php @@ -92,9 +92,22 @@ class AuthControllerTelephoneLoginTest extends AuthControllerTelephoneWithoutCom class AuthControllerTelephoneLoginReservationTest extends AuthControllerTelephoneWithoutCommSIGBTestCase { public function setUp() { parent::setUp(); - Class_Profil::getCurrentProfil() - ->setCfgAccueil(array()); - + + $this->fixture('Class_Profil', [ + 'id' => 1, + 'cfg_accueil' => [ + 'modules' => [ + '1' => ['division' => '4', + 'type_module' => 'RECH_SIMPLE', + 'preferences' => ['recherche_avancee' => "on", + 'select_doc' => 'on', + 'select_annexe' => 'on']], + + '2' => ['division' => '4', + 'type_module' => 'LOGIN', + 'preferences' => ['identifiant_exemple' => 'identity', + 'mot_de_passe_exemple' => 'password']]]]]); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Users') ->whenCalled('hasIdentity') ->answers(false); @@ -113,6 +126,19 @@ class AuthControllerTelephoneLoginReservationTest extends AuthControllerTelephon public function pageShouldContainsPassInput() { $this->assertXPath('//form//input[@name="password"]'); } + + + /** @test */ + public function pageShouldContainsPlaceHollderIdentity() { + $this->assertXPath('//form//input[@placeholder="identity"]',$this->_response->getBody()); + } + + + /** @test */ + public function pageShouldContainsPlaceHollderPasswordIdentity() { + $this->assertXPath('//form//input[@placeholder="password"]', $this->_response->getBody()); + } + } diff --git a/tests/library/Class/MusicMeLinkTest.php b/tests/library/Class/MusicMeLinkTest.php index 48263971272701da647a75d14ecd8f0762c1d17c..b9cd713887c52c8513beb6659cb44ac9e2e940b8 100644 --- a/tests/library/Class/MusicMeLinkTest.php +++ b/tests/library/Class/MusicMeLinkTest.php @@ -49,12 +49,6 @@ abstract class MusicMeLinkTestCase extends Storm_Test_ModelTestCase { class MusicMeLinkWithAbonTest extends MusicMeLinkTestCase { - - public function setUp() { - parent::setUp(); - - } - /** @test */ public function urlWithLogginShouldBeMusicmeSSO() { $this->assertEquals('http://musicmeurl/', @@ -63,7 +57,7 @@ class MusicMeLinkWithAbonTest extends MusicMeLinkTestCase { /** @test */ public function musicMeUrlShouldExtractUrlFromResponse() { - $ticket=md5( Zend_Session::getId()); + $ticket=md5( Zend_Session::getId() . '4'); $this->assertEquals('http://musicmeurl/?iduser=34&ticket='.$ticket. '&MediaLibraryID=888&service=http%3A%2F%2Fmusicmeurl%2F%3Fiduser%3D34%26ticket%3D'.$ticket.'%26MediaLibraryID%3D888', $this->_musicme->url()); diff --git a/tests/library/Class/NumilogLinkTest.php b/tests/library/Class/NumilogLinkTest.php index 1065c25948c95553c74757cad8715be73e825bf6..f1246be667f95822275ebe6c35db66d8a1144bcf 100644 --- a/tests/library/Class/NumilogLinkTest.php +++ b/tests/library/Class/NumilogLinkTest.php @@ -63,7 +63,7 @@ abstract class NumilogLinkTestCase extends Storm_Test_ModelTestCase { /** @test */ public function numilogUrlShouldReturnUrlWithTicket() { - $this->assertEquals('http://urlnumilog/action?ticket='.md5( Zend_Session::getId()), + $this->assertEquals('http://urlnumilog/action?ticket='.md5( Zend_Session::getId() . '4'), $this->_numilog->url()); }