diff --git a/VERSIONS b/VERSIONS index 5f78ffb0f6eab06bba65fde4e056c20fa932cfa8..c02777f0ce0d8d44a4b5e9b468e3ccdd4ee52345 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,27 @@ +22/04/2021 - v8.0.116 + + - ticket #125654 : Correction de l'affichage du sélecteur de style de boite des boites contenus dans les articles. + Ajout d'informations de contexte dans les attributs de la balise body. + On retrouve le theme utilisé par le profil dans l'attribut class ainsi que dans un nouveau attribut data-template. + Pour faciliter la personnalisation, les classes qui composent le body ont maintenant leur équivalent en attribut data : data-module, data-controller, data-action, data-profile-id. + + - ticket #126321 : Magasin de thèmes : Amélioration du lecteur audio des albums. + + - ticket #132102 : Magasin de thèmes : Dans le thème Chili, le lien de réservation sur les documents propose directement le choix de retrait sans passer par l'étape de choix d'un exemplaire. + + - ticket #122671 : Magasin de thèmes : Correction de la superposition des derniers éléments de la liste du mode mur du résultat de recherche sur les téléphones. + + - ticket #115415 : Magasin de thèmes : Correction de la modération des bandes annonces dans l'onglet média des documents. + + - ticket #133169 : Lettres d'information : Correction de la commande d'envoi des lettres d'information. + + - ticket #116296 : Administration : Amélioration de la gestion des champs personnalisés. + Il est maintenant possible de nettoyer la liste des valeurs qui ont étés saisies. + Le lien est accessible via un nouveau bouton œil ajouté dans les actions des champs personnalisés. + + - ticket #133049 : Administration : Ajout du lien vers l'enquête de satisfaction Bokeh et Nanook 2021. + + 19/04/2021 - v8.0.115 - ticket #125413 : Magasin de thèmes : Correction des liens vers les fiches bibliotèques ayant des profils dédiés. diff --git a/application/modules/admin/controllers/CustomFieldsController.php b/application/modules/admin/controllers/CustomFieldsController.php index 6973ceea4875cb96ba4fe2d9def7ef3063208911..7ee7c5a583071148451202a536e5ffac18f1cbc0 100644 --- a/application/modules/admin/controllers/CustomFieldsController.php +++ b/application/modules/admin/controllers/CustomFieldsController.php @@ -96,5 +96,25 @@ class Admin_CustomFieldsController extends ZendAfi_Controller_Action { $this->view->form = $form; } -} -?> + + + public function cleanAction() { + if ( ! $this->view->custom_field = $field = Class_CustomField::find($this->_getParam('id', 0))) + return $this->_redirect('/admin/custom-fields'); + + $this->view->titre = $this->view->_('Nettoyer le champ personnalisé %s', + strtolower($field->getLabel())); + + $this->view->custom_field_values = $field->getValues(); + } + + + public function deleteValueAction() { + if ( ! $value = Class_CustomField_Value::find($this->_getParam('id', 0))) + return $this->_redirect('/admin/custom-fields'); + + $this->_helper->notify($this->_('La valeur ID %s a bien été supprimée', $value->getId())); + $value->delete(); + $this->_redirectClose($this->_getReferer()); + } +} \ No newline at end of file diff --git a/application/modules/admin/controllers/RecordsController.php b/application/modules/admin/controllers/RecordsController.php index c15d7ff8fa7d501987b0a7c2a646f9f89a12bc09..e931bf1393a4445dd7e4eb8bc5abd1bc8a77355c 100644 --- a/application/modules/admin/controllers/RecordsController.php +++ b/application/modules/admin/controllers/RecordsController.php @@ -164,7 +164,7 @@ class Admin_RecordsController extends ZendAfi_Controller_Action { $this->_helper->notify((new Class_WebService_AllServices()) ->disableTrailerForRecord($this->_getParam('id'))); - $this->_redirectToReferer(); + $this->_redirectClose($this->_getReferer()); } @@ -172,6 +172,6 @@ class Admin_RecordsController extends ZendAfi_Controller_Action { $this->_helper->notify((new Class_WebService_AllServices()) ->enableTrailerForRecord($this->_getParam('id'))); - $this->_redirectToReferer(); + $this->_redirectClose($this->_getReferer()); } } diff --git a/application/modules/admin/views/scripts/custom-fields/clean.phtml b/application/modules/admin/views/scripts/custom-fields/clean.phtml new file mode 100644 index 0000000000000000000000000000000000000000..e1304006e5e8726f629c5ea0829174ce0d77537b --- /dev/null +++ b/application/modules/admin/views/scripts/custom-fields/clean.phtml @@ -0,0 +1,7 @@ +<?php +$output = $this->custom_field_values + ? $this->renderTable((new Class_TableDescription_CustomFieldsValues('custom_fiels_values'))->setView($this), + $this->custom_field_values) + : $this->tagWarning($this->_('Aucune valeur')); + +echo $output; \ No newline at end of file diff --git a/application/modules/admin/views/scripts/index/index.phtml b/application/modules/admin/views/scripts/index/index.phtml index a7af2fdd66a2ae73097127d2712df2189eacd6e7..5743bd39f834943de9a984cdcb9a6ba2a7a439ab 100644 --- a/application/modules/admin/views/scripts/index/index.phtml +++ b/application/modules/admin/views/scripts/index/index.phtml @@ -4,6 +4,18 @@ if ($this->is_request_secure) echo $this->myBibAppTeaser(); ?> +<?php +echo $this->tag('h2', + $this->_('Enquête de satisfaction')); +$form_link = Class_IntBib::isSingleNanook() + ? $this->tagAnchor('https://docs.google.com/forms/d/e/1FAIpQLSdKGlvMUMxTwCYH6TvbYZwGaQmLZcoGXXSk8T9u3IcMkdMqsg/viewform', + $this->_('AFI : Enquête de satisfaction 2021 SIGB AFI-Nanook et portail Bokeh')) + : $this->tagAnchor('https://docs.google.com/forms/d/e/1FAIpQLSdKPUl7RUHXId-JyUmFCY5jRTkarXA-PVtjBG9LKFFKkQnksQ/viewform', + $this->_('AFI : Enquête de satisfaction 2021 portail Bokeh')); + +echo $this->tag('div', $form_link); +?> + <h2 class="toggle_video"> <?php @@ -11,9 +23,9 @@ if ($this->is_request_secure) echo $this->_('Démonstrations vidéos'); ?> </h2> -<div><iframe width="750" height="450" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLL40cYmJt-b9YSCI0rvnxl8xjptuvgiZC" allowfullscreen></iframe></div> + <div><iframe width="750" height="450" src="https://www.youtube-nocookie.com/embed/videoseries?list=PLL40cYmJt-b9YSCI0rvnxl8xjptuvgiZC" allowfullscreen></iframe></div> -<h2><?php echo $this->_('Paramètres du site');?> :</h2> + <h2><?php echo $this->_('Paramètres du site');?> :</h2> <?php $lien = $edit_domain_name = ''; if ($this->user->isAdmin()) { @@ -31,6 +43,9 @@ if ($this->user->isAdmin()) { echo $this->ligneInfos($this->_('Etat du site'), $this->etat_site . $lien) . $this->ligneInfos($this->_('Nom du domaine'), Class_AdminVar::getNomDomaine() . $edit_domain_name); + +if (Class_Users::isCurrentUserSuperAdmin()) + echo $this->ligneInfos($this->_('Base de donnée'), array_at('dbname', Zend_Db_Table::getDefaultAdapter()->getConfig())); ?> <h2><?php echo $this->_('Données en attente de modération');?> : @@ -39,9 +54,9 @@ echo $this->ligneInfos($this->_('Etat du site'), $this->etat_site . $lien) 'controller' => 'rss', 'action' => 'moderations')); ?>"><img src="<?php echo URL_ADMIN_IMG;?>/rss.gif" alt="RSS"/></a> - </h2> + </h2> <?php - $moderer = new Class_Moderer(); + $moderer = new Class_Moderer(); $modstats = $moderer->getModerationStats(); foreach ($modstats as $stat) { $nombre = ($stat['count']) ? $stat['count'] : 'aucun'; diff --git a/ckeditor/skins/moono/dialog.css b/ckeditor/skins/moono/dialog.css index df87f34e26994ffcd04ecaf2123b9bdca47e86bc..c40de36ae450313977c64b2e8a0f1f3ee7fb27d1 100644 --- a/ckeditor/skins/moono/dialog.css +++ b/ckeditor/skins/moono/dialog.css @@ -4,7 +4,7 @@ For licensing, see LICENSE.md or http://ckeditor.com/license */ .cke_dialog{visibility:visible}.cke_dialog_body{z-index:1;background:#eaeaea;border:1px solid #b2b2b2;border-bottom-color:#999;border-radius:3px;box-shadow:0 0 3px rgba(0,0,0,.15)}.cke_dialog strong{font-weight:bold}.cke_dialog_title{font-weight:bold;font-size:13px;cursor:move;position:relative;color:#474747;text-shadow:0 1px 0 rgba(255,255,255,.75);border-bottom:1px solid #999;padding:6px 10px;border-radius:2px 2px 0 0;box-shadow:0 1px 0 #fff inset;background:#cfd1cf;background-image:linear-gradient(to bottom,#f5f5f5,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#f5f5f5',endColorstr='#cfd1cf')}.cke_dialog_spinner{border-radius:50%;width:12px;height:12px;overflow:hidden;text-indent:-9999em;border-top:2px solid rgba(102,102,102,0.2);border-right:2px solid rgba(102,102,102,0.2);border-bottom:2px solid rgba(102,102,102,0.2);border-left:2px solid rgba(102,102,102,1);-webkit-animation:dialog_spinner 1s infinite linear;animation:dialog_spinner 1s infinite linear}.cke_browser_ie8 .cke_dialog_spinner,.cke_browser_ie9 .cke_dialog_spinner{background:url(images/spinner.gif) center top no-repeat;width:16px;height:16px;border:0}@-webkit-keyframes dialog_spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes dialog_spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cke_dialog_contents{background-color:#fff;overflow:auto;padding:15px 10px 5px 10px;margin-top:30px;border-top:1px solid #bfbfbf;border-radius:0 0 3px 3px}.cke_dialog_contents_body{overflow:auto;padding:17px 10px 5px 10px;margin-top:22px}.cke_dialog_footer{text-align:right;position:relative;border:0;outline:1px solid #bfbfbf;box-shadow:0 1px 0 #fff inset;border-radius:0 0 2px 2px;background:#cfd1cf;background-image:linear-gradient(to bottom,#ebebeb,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#ebebeb',endColorstr='#cfd1cf')}.cke_rtl .cke_dialog_footer{text-align:left}.cke_hc .cke_dialog_footer{outline:0;border-top:1px solid #fff}.cke_dialog .cke_resizer{margin-top:22px}.cke_dialog .cke_resizer_rtl{margin-left:5px}.cke_dialog .cke_resizer_ltr{margin-right:5px}.cke_dialog_tabs{height:24px;display:inline-block;margin:5px 0 0;position:absolute;z-index:2;left:10px}.cke_rtl .cke_dialog_tabs{right:10px}a.cke_dialog_tab{height:16px;padding:4px 8px;margin-right:3px;display:inline-block;cursor:pointer;line-height:16px;outline:0;color:#595959;border:1px solid #bfbfbf;border-radius:3px 3px 0 0;background:#d4d4d4;background-image:linear-gradient(to bottom,#fafafa,#ededed);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#fafafa',endColorstr='#ededed')}.cke_rtl a.cke_dialog_tab{margin-right:0;margin-left:3px}a.cke_dialog_tab:hover,a.cke_dialog_tab:focus{background:#ebebeb;background:linear-gradient(to bottom,#ebebeb 0,#dfdfdf 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb',endColorstr='#dfdfdf',GradientType=0)}a.cke_dialog_tab_selected{background:#fff;color:#383838;border-bottom-color:#fff;cursor:default;filter:none}a.cke_dialog_tab_selected:hover,a.cke_dialog_tab_selected:focus,{background:#ededed;background:linear-gradient(to bottom,#ededed 0,#fff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed',endColorstr='#ffffff',GradientType=0)}.cke_hc a.cke_dialog_tab:hover,.cke_hc a.cke_dialog_tab:focus,.cke_hc a.cke_dialog_tab_selected{border:3px solid;padding:2px 6px}a.cke_dialog_tab_disabled{color:#bababa;cursor:default}.cke_single_page .cke_dialog_tabs{display:none}.cke_single_page .cke_dialog_contents{padding-top:5px;margin-top:0;border-top:0}a.cke_dialog_close_button{background-image:url(images/close.png);background-repeat:no-repeat;background-position:50%;position:absolute;cursor:pointer;text-align:center;height:20px;width:20px;top:4px;z-index:5;opacity:.8;filter:alpha(opacity = 80)}.cke_dialog_close_button:hover{opacity:1;filter:alpha(opacity = 100)}.cke_hidpi .cke_dialog_close_button{background-image:url(images/hidpi/close.png);background-size:16px}.cke_dialog_close_button span{display:none}.cke_hc .cke_dialog_close_button span{display:inline;cursor:pointer;font-weight:bold;position:relative;top:3px}.cke_ltr .cke_dialog_close_button{right:5px}.cke_rtl .cke_dialog_close_button{left:6px}.cke_dialog_close_button{top:4px}div.cke_disabled .cke_dialog_ui_labeled_content div *{background-color:#ddd;cursor:default}.cke_dialog_ui_vbox table,.cke_dialog_ui_hbox table{margin:auto}.cke_dialog_ui_vbox_child{padding:5px 0}.cke_dialog_ui_hbox{width:100%}.cke_dialog_ui_hbox_first,.cke_dialog_ui_hbox_child,.cke_dialog_ui_hbox_last{vertical-align:top}.cke_ltr .cke_dialog_ui_hbox_first,.cke_ltr .cke_dialog_ui_hbox_child{padding-right:10px}.cke_rtl .cke_dialog_ui_hbox_first,.cke_rtl .cke_dialog_ui_hbox_child{padding-left:10px}.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first,.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child{padding-right:5px}.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first,.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child{padding-left:5px;padding-right:0}.cke_hc div.cke_dialog_ui_input_text,.cke_hc div.cke_dialog_ui_input_password,.cke_hc div.cke_dialog_ui_input_textarea,.cke_hc div.cke_dialog_ui_input_select,.cke_hc div.cke_dialog_ui_input_file{border:1px solid}textarea.cke_dialog_ui_input_textarea{overflow:auto;resize:none}input.cke_dialog_ui_input_text,input.cke_dialog_ui_input_password,textarea.cke_dialog_ui_input_textarea{background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:4px 6px;outline:0;width:100%;*width:95%;box-sizing:border-box;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}input.cke_dialog_ui_input_text:hover,input.cke_dialog_ui_input_password:hover,textarea.cke_dialog_ui_input_textarea:hover{border:1px solid #aeb3b9;border-top-color:#a0a6ad}input.cke_dialog_ui_input_text:focus,input.cke_dialog_ui_input_password:focus,textarea.cke_dialog_ui_input_textarea:focus,select.cke_dialog_ui_input_select:focus{outline:0;border:1px solid #139ff7;border-top-color:#1392e9}a.cke_dialog_ui_button{display:inline-block;*display:inline;*zoom:1;padding:4px 0;margin:0;text-align:center;color:#333;vertical-align:middle;cursor:pointer;border:1px solid #b6b6b6;border-bottom-color:#999;border-radius:3px;box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;background:#e4e4e4;background-image:linear-gradient(to bottom,#fff,#e4e4e4);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#ffffff',endColorstr='#e4e4e4')}span.cke_dialog_ui_button{padding:0 10px}a.cke_dialog_ui_button:hover{border-color:#9e9e9e;background:#ccc;background-image:linear-gradient(to bottom,#f2f2f2,#ccc);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#f2f2f2',endColorstr='#cccccc')}a.cke_dialog_ui_button:focus,a.cke_dialog_ui_button:active{border-color:#969696;outline:0;box-shadow:0 0 6px rgba(0,0,0,.4) inset}.cke_hc a.cke_dialog_ui_button:hover,.cke_hc a.cke_dialog_ui_button:focus,.cke_hc a.cke_dialog_ui_button:active{border:3px solid;padding-top:1px;padding-bottom:1px}.cke_hc a.cke_dialog_ui_button:hover span,.cke_hc a.cke_dialog_ui_button:focus span,.cke_hc a.cke_dialog_ui_button:active span{padding-left:10px;padding-right:10px}.cke_dialog_footer_buttons a.cke_dialog_ui_button span{color:inherit;font-size:12px;font-weight:bold;line-height:18px;padding:0 12px}a.cke_dialog_ui_button_ok{color:#fff;text-shadow:0 -1px 0 #55830c;border-color:#62a60a #62a60a #4d9200;background:#69b10b;background-image:linear-gradient(to bottom,#9ad717,#69b10b);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#9ad717',endColorstr='#69b10b')}a.cke_dialog_ui_button_ok:hover{border-color:#5b9909 #5b9909 #478500;background:#88be14;background:linear-gradient(to bottom,#88be14 0,#5d9c0a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#88be14',endColorstr='#5d9c0a',GradientType=0)}a.cke_dialog_ui_button_ok.cke_disabled{border-color:#7d9f51;background:#8dad62;background-image:-webkit-gradient(linear,0 0,0 100%,from(#b3d271),to(#8dad62));background-image:-webkit-linear-gradient(top,#b3d271,#8dad62);background-image:-o-linear-gradient(top,#b3d271,#8dad62);background-image:linear-gradient(to bottom,#b3d271,#8dad62);background-image:-moz-linear-gradient(top,#b3d271,#8dad62);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0,startColorstr='#B3D271',endColorstr='#8DAD62')}a.cke_dialog_ui_button_ok.cke_disabled span{color:#e0e8d1}a.cke_dialog_ui_button span{text-shadow:0 1px 0 #fff}a.cke_dialog_ui_button_ok span{text-shadow:0 -1px 0 #55830c}span.cke_dialog_ui_button{cursor:pointer}a.cke_dialog_ui_button_ok:focus,a.cke_dialog_ui_button_ok:active,a.cke_dialog_ui_button_cancel:focus,a.cke_dialog_ui_button_cancel:active{border-width:2px;padding:3px 0}a.cke_dialog_ui_button_ok:focus,a.cke_dialog_ui_button_ok:active{border-color:#568c0a}a.cke_dialog_ui_button_ok.cke_disabled:focus,a.cke_dialog_ui_button_ok.cke_disabled:active{border-color:#6f8c49}a.cke_dialog_ui_button_ok:focus span,a.cke_dialog_ui_button_ok:active span,a.cke_dialog_ui_button_cancel:focus span,a.cke_dialog_ui_button_cancel:active span{padding:0 11px}.cke_dialog_footer_buttons{display:inline-table;margin:5px;width:auto;position:relative;vertical-align:middle}div.cke_dialog_ui_input_select{display:table}select.cke_dialog_ui_input_select{height:25px;line-height:25px;background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:3px 3px 3px 6px;outline:0;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}.cke_dialog_ui_input_file{width:100%;height:25px}.cke_hc .cke_dialog_ui_labeled_content input:focus,.cke_hc .cke_dialog_ui_labeled_content select:focus,.cke_hc .cke_dialog_ui_labeled_content textarea:focus{outline:1px dotted}.cke_dialog .cke_dark_background{background-color:#dedede}.cke_dialog .cke_light_background{background-color:#ebebeb}.cke_dialog .cke_centered{text-align:center}.cke_dialog a.cke_btn_reset{float:right;background:url(images/refresh.png) top left no-repeat;width:16px;height:16px;border:1px none;font-size:1px}.cke_hidpi .cke_dialog a.cke_btn_reset{background-size:16px;background-image:url(images/hidpi/refresh.png)}.cke_rtl .cke_dialog a.cke_btn_reset{float:left}.cke_dialog a.cke_btn_locked,.cke_dialog a.cke_btn_unlocked{float:left;width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.cke_dialog a.cke_btn_locked .cke_icon{display:none}.cke_rtl .cke_dialog a.cke_btn_locked,.cke_rtl .cke_dialog a.cke_btn_unlocked{float:right}.cke_dialog a.cke_btn_locked{background-image:url(images/lock.png)}.cke_dialog a.cke_btn_unlocked{background-image:url(images/lock-open.png)}.cke_hidpi .cke_dialog a.cke_btn_unlocked,.cke_hidpi .cke_dialog a.cke_btn_locked{background-size:16px}.cke_hidpi .cke_dialog a.cke_btn_locked{background-image:url(images/hidpi/lock.png)}.cke_hidpi .cke_dialog a.cke_btn_unlocked{background-image:url(images/hidpi/lock-open.png)}.cke_dialog .cke_btn_over{border:outset 1px;cursor:pointer}.cke_dialog .ImagePreviewBox{border:2px ridge black;overflow:scroll;height:200px;width:300px;padding:2px;background-color:white}.cke_dialog .ImagePreviewBox table td{white-space:normal}.cke_dialog .ImagePreviewLoader{position:absolute;white-space:normal;overflow:hidden;height:160px;width:230px;margin:2px;padding:2px;opacity:.9;filter:alpha(opacity = 90);background-color:#e4e4e4}.cke_dialog .FlashPreviewBox{white-space:normal;border:2px ridge black;overflow:auto;height:160px;width:390px;padding:2px;background-color:white}.cke_dialog .cke_pastetext{width:346px;height:170px}.cke_dialog .cke_pastetext textarea{width:340px;height:170px;resize:none}.cke_dialog iframe.cke_pasteframe{width:346px;height:130px;background-color:white;border:1px solid #aeb3b9;border-radius:3px}.cke_dialog .cke_hand{cursor:pointer}.cke_disabled{color:#a0a0a0}.cke_dialog_body .cke_label{display:none}.cke_dialog_body label{display:inline;margin-bottom:auto;cursor:default}.cke_dialog_body label.cke_required{font-weight:bold}a.cke_smile{overflow:hidden;display:block;text-align:center;padding:.3em 0}a.cke_smile img{vertical-align:middle}a.cke_specialchar{cursor:inherit;display:block;height:1.25em;padding:.2em .3em;text-align:center}a.cke_smile,a.cke_specialchar{border:1px solid transparent}a.cke_smile:hover,a.cke_smile:focus,a.cke_smile:active,a.cke_specialchar:hover,a.cke_specialchar:focus,a.cke_specialchar:active{background:#fff;outline:0}a.cke_smile:hover,a.cke_specialchar:hover{border-color:#888}a.cke_smile:focus,a.cke_smile:active,a.cke_specialchar:focus,a.cke_specialchar:active{border-color:#139ff7}.cke_dialog_contents a.colorChooser{display:block;margin-top:6px;margin-left:10px;width:80px}.cke_rtl .cke_dialog_contents a.colorChooser{margin-right:10px}.cke_dialog_ui_checkbox_input:focus,.cke_dialog_ui_radio_input:focus,.cke_btn_over{outline:1px dotted #696969}.cke_iframe_shim{display:block;position:absolute;top:0;left:0;z-index:-1;filter:alpha(opacity = 0);width:100%;height:100%} -.cke_dialog #fieldset-style_group td.gauche { +body:not(.template_HISTORIC) .cke_dialog #fieldset-style_group td.gauche { display: grid; grid-gap: 1em; grid-template-columns: repeat( 2, auto); diff --git a/library/Class/Batch/SendNewsletters.php b/library/Class/Batch/SendNewsletters.php index d20de23df186ef0af68fc4fa096ecb866c2830ad..ed5c346497e4b7e28756b6e1ce3ec156d63385a7 100644 --- a/library/Class/Batch/SendNewsletters.php +++ b/library/Class/Batch/SendNewsletters.php @@ -55,7 +55,7 @@ class Class_Batch_SendNewsletters extends Class_Batch_Abstract { public function run() { - $shell = '/usr/bin/php -f ' + $shell = 'php -f ' . realpath(dirname(__FILE__)) . '/../../../scripts/sendNewsletter.php ' . $this->getExecParams() . ' > /dev/null & echo $!'; diff --git a/library/Class/CustomField/Value.php b/library/Class/CustomField/Value.php index c0371f84b7c2f3d2e3a722b601a1c0b1eb49d78f..43d307dc4da1565542e742a2261435c76a4b450e 100644 --- a/library/Class/CustomField/Value.php +++ b/library/Class/CustomField/Value.php @@ -129,4 +129,28 @@ class Class_CustomField_Value extends Storm_Model_Abstract { return [$this->getValue()]; } + + + public function getModelInstance() { + if ( !$field = $this->getField()) + return null; + + $loader = call_user_func([Class_CustomField_Model::CLASS_PREFIX . $field->getModel(), 'getLoader']); + + return $loader->find($this->getModelId()); + } + + + public function isOutDated() { + if ( ! $values = $this->getValueAsArray()) + return false; + + if (! $options = $this->getOptionsListAsArray()) + return true; + + foreach ( $values as $value) + return ! in_array($value, $options); + + return false; + } } diff --git a/library/Class/TableDescription/CustomFieldsValues.php b/library/Class/TableDescription/CustomFieldsValues.php new file mode 100644 index 0000000000000000000000000000000000000000..43f035cc046c5f5e9ac0182ea89aa44134f9197c --- /dev/null +++ b/library/Class/TableDescription/CustomFieldsValues.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_TableDescription_CustomFieldsValues extends Class_TableDescription { + + + protected $_view; + + + public function init() { + $this + ->addColumn($this->_('ID'), function($custom_field_value) + { + return $custom_field_value->getModelInstance() + ? $custom_field_value->getId() + : $this->_view->tagError($custom_field_value->getId()); + }) + + ->addColumn($this->_('model_id'), function($custom_field_value) + { + return $custom_field_value->getModelInstance() + ? $custom_field_value->getModelId() + : $this->_view->tagError($this->_('%s (cette ID n\'existe plus)', $custom_field_value->getModelId())); + }) + + ->addColumn($this->_('Objet'), + function($custom_field_value) { return $custom_field_value->getModelInstance();}) + + ->addColumn($this->_('value'),function($custom_field_value) + { $value = $custom_field_value->getValue(); + return ($custom_field_value->isOutDated() + ? $this->_view->tagError($this->_('%s (cette valeur n\'existe plus)',$value)) + : $value); + }) + + ->addRowAction(function($custom_field_value) + { + return $this->_view->tagAnchor($this->_view->url(['module' => 'admin', + 'controller' => 'custom-fields', + 'action' => 'delete-value', + 'id' => $custom_field_value->getId()], + null, + true), + $this->_view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'delete')), + ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer cette ligne ?')", + 'popup' => true, + 'title' => $this->_('Supprimer cette ligne')]); + }) + + ->addRowAction(function($custom_field_value) + { + return null; + return ($instance = $custom_field_value->getModelInstance()) + ? $this->_view->renderModelActions($instance) + : null; + }); + } + + + public function setView($view) { + $this->_view = $view; + return $this; + } +} diff --git a/library/Class/WebService/AllServices.php b/library/Class/WebService/AllServices.php index dfacdf30677ffeeed1440653631e5f657b4ee6e3..00b8e06b9dc40257ee7c4e4ad2e0c8d6f442f134 100644 --- a/library/Class/WebService/AllServices.php +++ b/library/Class/WebService/AllServices.php @@ -338,4 +338,10 @@ class Class_WebService_AllServices { ? $message : $result['message']; } + + + public static function isTrailerDisabled($data) { + return isset($data[static::DISABLE_TRAILER]) + && ($data[static::DISABLE_TRAILER] == static::TRAILER_DISABLED); + } } \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/View.php b/library/ZendAfi/Controller/Action/Helper/View.php index 9b0351fefccd8e3a21de98c11edd0ce4191f3464..f1abd12c50726576167f3dd2b7a35f3ad1e3d19b 100644 --- a/library/ZendAfi/Controller/Action/Helper/View.php +++ b/library/ZendAfi/Controller/Action/Helper/View.php @@ -47,17 +47,25 @@ class ZendAfi_Controller_Action_Helper_View extends Zend_View { public function setModuleControllerActionNames($module, $controller, $action) { - $classes = sprintf('%s %s_%s profil_%d', + $template = Class_Template::current()->getId(); + $profile_id = Class_Profil::getCurrentProfil()->getId(); + + $classes = sprintf('%s %s_%s profil_%d template_%s', $module, $controller, $action, - Class_Profil::getCurrentProfil()->getId()); + $profile_id, + $template); $logged = ($current_user = Class_Users::getIdentity()) ? 'true' : 'false'; $this->body_attribs = ['class' => $classes, - 'data-logged' => $logged]; - + 'data-logged' => $logged, + 'data-profile-id' => $profile_id, + 'data-template' => $template, + 'data-module' => $module, + 'data-controller' => $controller, + 'data-action' => $action]; $this->bodyParam = sprintf('class="%s" data-logged="%s"', $classes, diff --git a/library/ZendAfi/Controller/Plugin/Manager/CustomField.php b/library/ZendAfi/Controller/Plugin/Manager/CustomField.php index 57a4ec8e5ae345a1815f517363b0c2c2f9f10639..2bab68a8cf4547ba0a447f80d1aa2da93fcc1fe1 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/CustomField.php +++ b/library/ZendAfi/Controller/Plugin/Manager/CustomField.php @@ -61,6 +61,10 @@ class ZendAfi_Controller_Plugin_Manager_CustomField extends ZendAfi_Controller_P 'icon' => 'edit', 'label' => $this->_('Modifier')], + ['url' => '/admin/custom-fields/clean/id/%s', + 'icon' => 'view', + 'label' => $this->_('Nettoyer')], + ['url' => '/admin/custom-fields/delete/id/%s', 'icon' => 'delete', 'label' => $this->_('Supprimer'), diff --git a/library/startup.php b/library/startup.php index e88b5d1d518dad8c4e9a5ae97c720ba2fabc4144..1bdbcbb160b017e7ed0c6beb89b6cd0c212e7672 100644 --- a/library/startup.php +++ b/library/startup.php @@ -84,7 +84,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','8.0'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.115'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.116'); defineConstant('BOKEH_REMOTE_FILES', 'https://git.afi-sa.net/afi/opacce/'); diff --git a/library/templates/Chili/Assets/css/chili.css b/library/templates/Chili/Assets/css/chili.css index fd6e5050f1f75fb39c843e9f7d2ebcf99d2ce816..4601fe305e3176bbae9ae6c4022293df62abcfc8 100644 --- a/library/templates/Chili/Assets/css/chili.css +++ b/library/templates/Chili/Assets/css/chili.css @@ -1175,15 +1175,6 @@ span.close_facets_dropdown::before { color: var(--chili-red-t); } -a.audio_track { - cursor: pointer; -} - -a.audio_track.playing .fa-music::before, -a.audio_track:hover .fa-music::before { - content: "\f144"; -} - header .boite.menu.chili_fixed_top.d-none { display: block !important; } diff --git a/library/templates/Chili/Library/Wrapper/Record.php b/library/templates/Chili/Library/Wrapper/Record.php index cd423350df0386706a134b8fc1ae36319dcb0f4b..e037398da53eb08592a05f2b6057f0a74dbdbe0c 100644 --- a/library/templates/Chili/Library/Wrapper/Record.php +++ b/library/templates/Chili/Library/Wrapper/Record.php @@ -57,4 +57,12 @@ class Chili_Library_Wrapper_Record extends Intonation_Library_View_Wrapper_Recor return $badges; } + + + protected function _addHoldLink($actions) { + $actions [] = (new Intonation_Library_Record($this->_model)) + ->getFirstItemHoldLink($this->_view); + + return $actions; + } } diff --git a/library/templates/Chili/View/RenderTracks.php b/library/templates/Chili/View/RenderTracks.php deleted file mode 100644 index ede48884a0922b7128c769b0f821046321e429f8..0000000000000000000000000000000000000000 --- a/library/templates/Chili/View/RenderTracks.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. - * - * BOKEH is free software; you can redistribute it and/or modify - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by - * the Free Software Foundation. - * - * There are special exceptions to the terms and conditions of the AGPL as it - * is applied to this software (see README file). - * - * BOKEH is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE - * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -class Chili_View_RenderTracks extends Intonation_View_RenderTracks { - - public function renderTracks($tracks) { - if ($tracks->isEmpty()) - return ''; - - $html = [$this->_renderAudioTracks($tracks->select('isAudio')), - $this->_renderYoutubeTracks($tracks->select('isYoutube'))]; - - $html = array_filter($html); - - $html = array_map(function($content) - { - return $this->_div(['class' => 'col-12'], - $content); - }, - $html); - - return $this->view->grid($html); - } - - - protected function _renderAudioTracks($tracks) { - if ($tracks->isEmpty()) - return ''; - - $html = [$this->_div(['class' => 'col-12'], - $this->view->renderList($tracks, function($track) - {return $this->_audioTrack($track);})), - - $this->_div(['class' => 'col-12'], - $this->_renderPlayer())]; - - return $this->view->grid($html, ['class' => 'audio_tracks']); - } - - - protected function _renderYoutubeTracks($tracks) { - if ($tracks->isEmpty()) - return ''; - - $html = $this->_div(['class' => 'col-12'], - $this->view->renderList($tracks, function($track) - {return $this->_youtubeTrack($track);})); - - return $this->view->grid($html, ['class' => 'youtube_tracks']); - } - - - protected function _audioTrack($track) { - $html = [$this->view->templateIco('track', 'utils'), - - $this->_tag('span', $track->getTitle(),['class' => 'track_title']), - - $this->_tag('span', $track->getSource(),['class' => 'track_source'])]; - - return $this->_tag('a', - implode($html), - ['class' => 'audio_track card-title', - 'data-track-url' => $track->getUrl(), - 'onclick' => ' $(\'.audio_player\').attr(\'src\',$(this).attr(\'data-track-url\')); $(\'.audio_player\').trigger(\'play\');$(this).closest(\'.list-group\').find(\'.playing\').removeClass(\'playing\');$(this).addClass(\'playing\');' - ]); - } - - - protected function _renderPlayer() { - return $this->_tag('audio', - '', - ['class' => 'audio_player', - 'src' => '', - 'onplaying' => "$('audio, video').not($(this)).trigger('pause');", - 'controls' => 'true']); - } - - - protected function _youtubeTrack($track) { - $html = [$this->view->templateIco('youtube', 'utils'), - - $this->_tag('span', - $track->getTitle(), - ['class' => 'track_title']), - - $this->_tag('span', - $track->getSource(), - ['class' => 'track_source'])]; - - $html = [$this->_div(['class' => 'col-12'], - implode($html)), - $this->_div(['class' => 'col-12'], - $this->view->renderEmbed($track->getSource(), $track->getUrl()))]; - - return $this->view->grid($html); - } -} \ No newline at end of file diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index db900d60ff5746b632000244c517a0a4293d0afb..e6d426b621ea71eb33737053afe7fd65973390ad 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -738,6 +738,7 @@ dl.row { .masonry-brick { visibility: hidden; + overflow: hidden; } .card-img-top > .masonry, @@ -964,3 +965,16 @@ address { text-align: center; font-size: 16px; } + +a.audio_track { + cursor: pointer; +} + +a.audio_track.playing .fa-music::before, +a.audio_track:hover .fa-music::before { + content: "\f144"; +} + +.audio_tracks .list-group-item { + padding: 0; +} diff --git a/library/templates/Intonation/Library/Record.php b/library/templates/Intonation/Library/Record.php index 4ec19c1fa8ce952bd4f36b599e467e89346fcc23..366bf93f3faf96b291868c5801c75999db582306 100644 --- a/library/templates/Intonation/Library/Record.php +++ b/library/templates/Intonation/Library/Record.php @@ -21,34 +21,57 @@ class Intonation_Library_Record { + + use Trait_Translator; + + protected static + $_items_by_records = [], + $_same_work_by_records = []; + + protected $_record, - $_items; + $_record_id; + public function __construct($record) { $this->_record = $record; + $this->_record_id = $record->getId(); if (!$this->_record->isFirstItemTypeSerialArticle()) return; - if ($item = $this->_record->getFirstExemplaire()) + if ($item = $this->_record->getFirstExemplaire()) { $this->_record = $item->getPMBSerialRecord(); + $this->_record_id = $this->_record->getId(); + } + } + + + public static function reset() { + static::$_items_by_records = []; + static::$_same_work_by_records = []; } public function getItemsFromSIGB() { - if (!$this->_items) - $this->_items = (new Intonation_Library_Record_Items($this->_record))->getItemsFromSIGB(); + if ( isset(static::$_items_by_records[$this->_record_id])) + return static::$_items_by_records[$this->_record_id]; - return $this->_items; + return static::$_items_by_records[$this->_record_id] = + (new Intonation_Library_Record_Items($this->_record))->getItemsFromSIGB(); } public function getSameWorkItemsFromSIGB() { + if ( isset(static::$_same_work_by_records[$this->_record_id])) + return static::$_same_work_by_records[$this->_record_id]; + $records = Class_Notice::findAllBy(['clef_oeuvre' => $this->_record->getClefOeuvre(), 'id_notice not' => $this->_record->getId()]); - return (new Intonation_Library_Record_Items($records))->getItemsFromSIGB(); + return static::$_same_work_by_records[$this->_record_id] = + (new Intonation_Library_Record_Items($records))->getItemsFromSIGB(); } @@ -63,4 +86,41 @@ class Intonation_Library_Record { return $items[0]->getExternalUrl(); } + + + public function getFirstItemHoldLink($view) { + if ( ! $items = $this->getItemsFromSIGB()) + return $this->_nullLink($view); + + if ( ! $first_item = $this->_getFirstHoldableItem($items)) + return $this->_nullLink($view); + + return new Intonation_Library_Link(['Url' => $first_item->getHoldLink(), + 'Class' => 'record_hold_link', + 'Text' => $this->_('Réserver'), + 'Image' => $view->templateIco('hold', + 'library'), + 'Title' => $this->_('Réserver le document %s', + $this->_record->getTitreEtSousTitre(' ')), + 'Popup' => true]); + } + + + protected function _nullLink($view) { + return new Intonation_Library_Link(['Text' => $this->_('Non réservable'), + 'Class' => 'record_hold_link no_holdable_item', + 'Image' => $view->templateIco('hold', + 'library'), + 'Title' => $this->_('La réservation du document %s est impossible. Il n\'y a pas d\'exemplaire réservable', + $this->_record->getTitreEtSousTitre(' '))]); + } + + + protected function _getFirstHoldableItem($items) { + return (new Storm_Collection($items)) + ->detect( function($item) + { + return $item->getHoldLink(); + } ); + } } diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 1bd2842491d5fce2b0dde7e8f118401b67cbee50..1d15b4c12b160341fe6a6fac8602689240db74aa 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -140,6 +140,8 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'a class active' => '', 'a class card-link' => '', 'a class list-group-item' => '', + 'div class list-group-item' => 'bg-transparent px-0 mb-3', + 'div class list-group' => ' bg-transparent no_border', 'a class badge_tag' => 'text-left badge', 'address class badge_tag' => 'text-left badge-secondary badge no_truncate', 'a class badge_mail' => 'no_truncate badge-primary text-light', diff --git a/library/templates/Intonation/Library/Trailers.php b/library/templates/Intonation/Library/Trailers.php index 740b2b5831385fa64e70204f3ec120f705db3364..8dd4f19ad148a02307917f045604047e1dac9498 100644 --- a/library/templates/Intonation/Library/Trailers.php +++ b/library/templates/Intonation/Library/Trailers.php @@ -45,11 +45,16 @@ class Intonation_Library_Trailers { 'type_doc' => $this->_model->getFamilleId()]; $trailer_service = (new Class_WebService_AllServices); + $data = $trailer_service->runServiceAfi($trailer_service::SVC_GET_TRAILER, $args); if ( empty($data) ) return []; + if (Class_WebService_AllServices::isTrailerDisabled($data)) + return [new Intonation_Library_Trailer(['Model' => $this->_model, + 'Disabled' => true])]; + if ( !isset($data['player']) || (!$html = $data['player'])) return []; @@ -60,12 +65,8 @@ class Intonation_Library_Trailers { if ( !$url = $match[1]) return []; - $disabled = isset($data[Class_WebService_AllServices::DISABLE_TRAILER]) - && ($data[Class_WebService_AllServices::DISABLE_TRAILER] == Class_WebService_AllServices::TRAILER_DISABLED); - return [(new Intonation_Library_Trailer(['Source' => $data['source'], 'Model' => $this->_model, - 'Url' => $url, - 'Disabled' => $disabled]))]; + 'Url' => $url]))]; } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 79fd42d18a82ed138827c45f86a77096083f95d6..1c62268377c611e8510419a79c99c73b83165bae 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -58,9 +58,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra (new Class_Notice_Permalink)->absoluteForRecordOrArticle($this->_model)); return new Intonation_Library_Link(['Url' => $url, - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library'), + 'Image' => $this->getIco('read-document', 'library'), 'Text' => $this->_('Voir'), 'Title' => $this->_('Voir le document %s de %s de type %s', $this->getMainTitle(), @@ -82,7 +80,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'id' => $this->_model->getId()]), 'Popup' => 'true', 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => Class_Template::current()->getIco($this->_view, 'edit', 'utils'), + 'Image' => $this->getIco('edit', 'utils'), 'Identifier' => 'record_change_thumbnail', 'Title' => $this->_('Modifier la vignette de %s', $this->_model->getTitrePrincipal(' '))]); @@ -153,10 +151,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'action' => 'simple', 'facette' => Class_CodifTypeDoc::CODE_FACETTE. $this->_model->getTypeDoc(), 'page' => null])) - ->setImage((Class_Template::current() - ->getIco($this->_view, - $this->_model->getTypeDocLabel(), - 'doc_types'))) + ->setImage(($this->getIco($this->_model->getTypeDocLabel(), 'doc_types'))) ->setText($this->_model->getTypeDocLabel()) ->setTitle($this->_('Affiner le résultat de recherche avec le type de document %s du document %s', $this->_model->getTypeDocLabel(), @@ -170,10 +165,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra ->setTag('a') ->setClass('record_novelty') ->setImage(($this->_model->isNouveaute() - ? (Class_Template::current() - ->getIco($this->_view, - 'novelty', - 'library')) + ? ($this->getIco('novelty', 'library')) : '')) ->setUrl($this->_view->url(['controller' => 'recherche', 'action' => 'simple', @@ -204,10 +196,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'annee_debut' => $this->_model->getAnnee(), 'page' => null])) ->setImage(($this->_model->getAnnee() - ? (Class_Template::current() - ->getIco($this->_view, - 'date-edition', - 'library')) + ? $this->getIco('date-edition', 'library') : '')) ->setText($this->_model->getAnnee()) ->setTitle($this->_('Affiner le résultat avec la date d\'édition du document %s : %d', @@ -240,9 +229,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $badges [] = ((new Intonation_Library_Badge) ->setTag('a') ->setClass('record_facets record_facet_' . strtolower($codif->getNomChamp($facet->getFacetCode()))) - ->setImage(Class_Template::current()->getIco($this->_view, - 'tag', - 'utils')) + ->setImage($this->getIco('tag', 'utils')) ->setText($facet->getLabel()) ->setTitle($facet->getTitle()) ->setUrl($facet->getUrlForLink())); @@ -287,17 +274,17 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra return $badges; $readed_in_serie = array_uintersect($readed_records_in_series, - $same_serie_records, - function($record_1, $record_2) - { - if ($record_1->getId() == $record_2->getId()) - return 0; + $same_serie_records, + function($record_1, $record_2) + { + if ($record_1->getId() == $record_2->getId()) + return 0; - if ($record_1->getId() > $record_2->getId()) - return 1; + if ($record_1->getId() > $record_2->getId()) + return 1; - return -1; - }); + return -1; + }); if ( ! $readed_in_serie) return $badges; @@ -307,9 +294,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $badges [] = (new Intonation_Library_Badge) ->setClass('badge-white record_serie') - ->setImage(Class_Template::current()->getIco($this->_view, - 'readed', - 'library')) + ->setImage($this->getIco('readed', 'library')) ->setText($this->_('%d sur %d', $total_readed_in_serie, $total_to_read)) @@ -400,9 +385,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'facette' => $match->getLibrary()->getFacetCode(), 'page' => null])) ->setClass('badge_bookmarked_library') - ->setImage(Class_Template::current()->getIco($this->_view, - 'library', - 'library')) + ->setImage($this->getIco('library', 'library')) ->setText($label) ->setTitle($this->_('Affiner le résultat avec le site %s', $label))); } @@ -435,74 +418,71 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra protected function _getNiceAction($actions) { - if ($this->_model->isRessourceNumerique()) - return []; - - if ((new Class_Notice_Sso($this->_model))->isValid()) { - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac', - 'controller' => 'modules', - 'action' => 'sso', - 'id' => $this->_model->getId()], - null, - true), - 'Text' => $this->_('Consulter en ligne'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'play', - 'utils')), - 'Identifier' => 'view_online_resource', - 'Title' => $this->_('Consulter le document %s en ligne', - $this->getMainTitle())]); - return $actions; - } - - if ( ! $items = $this->_model->getExemplaires()) - return $actions; - - if ( ! $first_item = reset($items)) - return $actions; - - if ($url = $first_item->getUrl()) { - $actions [] = new Intonation_Library_Link(['Url' => $url, - 'Text' => $this->_('Description en ligne'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'play', - 'utils')), - 'Title' => $this->_('Description de %s en ligne', - $this->getMainTitle()), - 'Identifier' => 'view_online_resource_description']); - return $actions; - } - - if ($bundle = $first_item->getBundle()) { - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->urlNotice($bundle), - 'Text' => $this->_('Fait partie du lot %s', - $bundle->getTitrePrincipal()), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'list', - 'utils')), - 'Title' => $this->_('Le document %s fait partie du lot %s', - $bundle->getTitrePrincipal()), - 'Identifier' => 'view_record_bundle']); - return $actions; - } - - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'reserver', - 'record_id' => $this->_model->getId()]), - 'Text' => $this->_('Réserver'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'hold', - 'library')), - 'Title' => $this->_('Réserver le document %s', + if ($this->_model->isRessourceNumerique()) + return []; + + if ((new Class_Notice_Sso($this->_model))->isValid()) { + $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac', + 'controller' => 'modules', + 'action' => 'sso', + 'id' => $this->_model->getId()], + null, + true), + 'Text' => $this->_('Consulter en ligne'), + 'Image' => $this->getIco('play', 'utils'), + 'Identifier' => 'view_online_resource', + 'Title' => $this->_('Consulter le document %s en ligne', + $this->getMainTitle())]); + return $actions; + } + + if ( ! $items = $this->_model->getExemplaires()) + return $actions; + + if ( ! $first_item = reset($items)) + return $actions; + + if ($url = $first_item->getUrl()) { + $actions [] = new Intonation_Library_Link(['Url' => $url, + 'Text' => $this->_('Description en ligne'), + 'Image' => $this->getIco('play', 'utils'), + 'Title' => $this->_('Description de %s en ligne', $this->getMainTitle()), - 'Identifier' => 'hold_record', - 'Popup' => true]); + 'Identifier' => 'view_online_resource_description']); + return $actions; + } + if ($bundle = $first_item->getBundle()) { + $actions [] = new Intonation_Library_Link(['Url' => $this->_view->urlNotice($bundle), + 'Text' => $this->_('Fait partie du lot %s', + $bundle->getTitrePrincipal()), + 'Image' => ($this->getIco('list', 'utils')), + 'Title' => $this->_('Le document %s fait partie du lot %s', + $bundle->getTitrePrincipal()), + 'Identifier' => 'view_record_bundle']); return $actions; + } + + $actions = $this->_addHoldLink($actions); + + return $actions; + } + + + protected function _addHoldLink($actions) { + $actions [] = + new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', + 'action' => 'reserver', + 'record_id' => $this->_model->getId()]), + 'Class' => 'record_hold_link', + 'Text' => $this->_('Réserver'), + 'Image' => $this->getIco('hold', 'library'), + 'Title' => $this->_('Réserver le document %s', + $this->getMainTitle()), + 'Identifier' => 'hold_record', + 'Popup' => true]); + + return $actions; } @@ -518,9 +498,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'Title' => $this->_('Voir plus d\'actions pour le document %s', $this->_model->getTitrePrincipal(' ')), 'Identifier' => 'view_more_record_actions', - 'Image' => Class_Template::current()->getIco($this->_view, - 'more', - 'utils')]); + 'Image' => $this->getIco('more', 'utils')]); return $this->_view->renderDropdown($this->_view->renderActions($actions), $button, 'dropleft dropup'); } @@ -530,9 +508,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'panier', 'action' => 'add-record-ajax', 'id_notice' => $this->_model->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'add', - 'utils'), + 'Image' => $this->getIco('add', 'utils'), 'Text' => $this->_('Ajouter …'), 'Popup' => 'true', 'Identifier' => 'add_record_to_selection', @@ -552,9 +528,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'controller' => 'album', 'action' => 'link_album_to', 'id_notice' => $this->_model->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'media', - 'library'), + 'Image' => $this->getIco('media', 'library'), 'Text' => $this->_('Créer …'), 'Attribs' => ['class' => 'menu_admin_front_anchor'], 'Popup' => 'true', @@ -575,9 +549,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'action' => 'print', 'id' => $this->_model->getId()]), 'Text' => $this->_('Imprimer'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'print', - 'utils'), + 'Image' => $this->getIco('print', 'utils'), 'Title' => $this->_('Imprimer %s', $this->_model->getTitrePrincipal(' ')), 'Attribs' => ['target' => '_blank'], 'Identifier' => 'print_record']) @@ -590,9 +562,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra if ($picture_action = $this->getPictureAction()) $actions [] = $picture_action - ->setImage(Class_Template::current()->getIco($this->_view, - 'image', - 'utils')) + ->setImage($this->getIco('image', 'utils')) ->setText($this->_('Modifier …')); if (Class_Users::isCurrentUserCanAccesBackend()) @@ -600,9 +570,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'controller' => 'records', 'action' => 'reset-thumbnail']), 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => Class_Template::current()->getIco($this->_view, - 'refresh', - 'utils'), + 'Image' => $this->getIco('refresh', 'utils'), 'Identifier' => 'reset_record_thumbnail', 'Text' => $this->_('Générer …'), 'Title' => $this->_('Supprimer et re-générer la vignette de %s', diff --git a/library/templates/Intonation/View/AlbumAudioJsPlayer.php b/library/templates/Intonation/View/AlbumAudioJsPlayer.php new file mode 100644 index 0000000000000000000000000000000000000000..f57f0027b42cacb8374578f67d7df36f92ee3b5f --- /dev/null +++ b/library/templates/Intonation/View/AlbumAudioJsPlayer.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Intonation_View_AlbumAudioJsPlayer extends ZendAfi_View_Helper_BaseHelper { + public function albumAudioJsPlayer($album) { + $tracks = (new Storm_Model_Collection($album->getAudioTracks())) + ->collect(function($track) + { + return + (new Intonation_Library_Track) + ->setTitle($track->findTitle()) + ->setSource($track->getLicense()) + ->setUrl($track->getPlayRessourceUrl()); + }); + + return $this->view->grid($this->view->div(['class' => 'col-12'], + $this->view->renderTracks($tracks))); + } +} diff --git a/library/templates/Intonation/View/RenderList.php b/library/templates/Intonation/View/RenderList.php index 570656ddf9e870c8010e1627c7fba3832c25b7bc..f7b5fee89e058f2932367f3945642bb25f6a816b 100644 --- a/library/templates/Intonation/View/RenderList.php +++ b/library/templates/Intonation/View/RenderList.php @@ -36,11 +36,11 @@ class Intonation_View_RenderList extends ZendAfi_View_Helper_BaseHelper { { return $html . $this->_tag('div', $callback($element), - ['class' => 'list-group-item bg-transparent px-0 mb-3']); + ['class' => 'list-group-item']); }); return $this->_tag('div', $html, - ['class' => 'list-group bg-transparent no_border']); + ['class' => 'list-group']); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderRecord/RenderItems.php b/library/templates/Intonation/View/RenderRecord/RenderItems.php index 8d46894491445a44f1aa61a6b9fab58c38bab65e..7ed41452b02d116af7e5ad6addb17598c8aa1ae4 100644 --- a/library/templates/Intonation/View/RenderRecord/RenderItems.php +++ b/library/templates/Intonation/View/RenderRecord/RenderItems.php @@ -25,7 +25,6 @@ class Intonation_View_RenderRecord_RenderItems extends ZendAfi_View_Helper_BaseH if (!$items) return ''; - $html = [ $this->_hookForMoreHtml($items) ]; $html []= $this->_renderOsmMap($items, $same_work); diff --git a/library/templates/Intonation/View/RenderTracks.php b/library/templates/Intonation/View/RenderTracks.php index 73854ca2bd21aece980d26db3b4a83f05737930c..ae549c091b50502bcabadd14aac068b7360e2757 100644 --- a/library/templates/Intonation/View/RenderTracks.php +++ b/library/templates/Intonation/View/RenderTracks.php @@ -22,61 +22,94 @@ class Intonation_View_RenderTracks extends ZendAfi_View_Helper_BaseHelper { public function renderTracks($tracks) { - return $tracks->isEmpty() - ? '' - : $this->_renderCollection($tracks, function($track) {return $this->_wrapTrack($track);}); - } + if ($tracks->isEmpty()) + return ''; + + $html = [$this->_renderAudioTracks($tracks->select('isAudio')), + $this->_renderYoutubeTracks($tracks->select('isYoutube'))]; + + $html = array_filter($html); + $html = array_map(function($content) + { + return $this->_div(['class' => 'col-12'], + $content); + }, + $html); - protected function _renderCollection($tracks, $callback) { - return $this->view->renderCarousel($tracks, $callback); + return $this->view->grid($html); } - protected function _wrapTrack($track) { - $html = [$this->_div(['class' => 'card-title'], - $this->_tag('h3', - $this->view->templateIco('track', 'utils') - . $track->getTitle())), - $this->_div(['class' => 'text-center'], - $this->_getPlayer($track))]; + protected function _renderAudioTracks($tracks) { + if ($tracks->isEmpty()) + return ''; - return - $this->_div(['class' => 'card bg-info text-white shadow'], - $this->_div(['class' => 'card-body'], - implode($html))); - } + $html = [$this->_div(['class' => 'col-12'], + $this->view->renderList($tracks, function($track) + {return $this->_audioTrack($track);})), + $this->_div(['class' => 'col-12'], + $this->_renderPlayer())]; - protected function _getPlayer($track) { - $url = $track->getUrl(); - return $track->isYoutube() - ? $this->_youtubeTrack($track) - : $this->_audioTrack($track); + return $this->view->grid($html, ['class' => 'audio_tracks']); } - protected function _youtubeTrack($track) { - return $this->view->renderEmbed($track->getSource(), $track->getUrl()); + protected function _renderYoutubeTracks($tracks) { + if ($tracks->isEmpty()) + return ''; + + $html = $this->_div(['class' => 'col-12'], + $this->view->renderList($tracks, function($track) + {return $this->_youtubeTrack($track);})); + + return $this->view->grid($html, ['class' => 'youtube_tracks']); } protected function _audioTrack($track) { + $html = [$this->view->templateIco('track', 'utils'), + + $this->_tag('span', $track->getTitle(),['class' => 'track_title']), + + $this->_tag('span', $track->getSource(),['class' => 'track_source'])]; + + return $this->_tag('a', + implode($html), + ['class' => 'audio_track card-title', + 'data-track-url' => $track->getUrl(), + 'onclick' => ' $(\'.audio_player\').attr(\'src\',$(this).attr(\'data-track-url\')); $(\'.audio_player\').trigger(\'play\');$(this).closest(\'.list-group\').find(\'.playing\').removeClass(\'playing\');$(this).addClass(\'playing\');' + ]); + } + + + protected function _renderPlayer() { return $this->_tag('audio', '', - ['class' => '', - 'src' => $track->getUrl(), - 'preload' => 'auto', + ['class' => 'audio_player', + 'src' => '', 'onplaying' => "$('audio, video').not($(this)).trigger('pause');", - 'controls' => 'true']) - - . $this->_tag('p', - $track->getSource(), - ['class' => 'blockquote-footer text-right']); + 'controls' => 'true']); } - protected function _isYoutube($track) { - return $track->isYoutube(); + protected function _youtubeTrack($track) { + $html = [$this->view->templateIco('youtube', 'utils'), + + $this->_tag('span', + $track->getTitle(), + ['class' => 'track_title']), + + $this->_tag('span', + $track->getSource(), + ['class' => 'track_source'])]; + + $html = [$this->_div(['class' => 'col-12'], + implode($html)), + $this->_div(['class' => 'col-12'], + $this->view->renderEmbed($track->getSource(), $track->getUrl()))]; + + return $this->view->grid($html); } -} +} \ No newline at end of file diff --git a/tests/application/modules/AbstractControllerTestCase.php b/tests/application/modules/AbstractControllerTestCase.php index c7dbd393ab261254a944bcf9e0c46c07a416cb91..40081f85a0b31b495662abcdf29747cf9d1ba076 100644 --- a/tests/application/modules/AbstractControllerTestCase.php +++ b/tests/application/modules/AbstractControllerTestCase.php @@ -208,6 +208,7 @@ abstract class AbstractControllerTestCase extends Zend_Test_PHPUnit_ControllerTe Class_Systeme_Widget_Abstract::reset(); Class_Codification::reset(); ZendAfi_Acl_AdminControllerRoles::reset(); + Intonation_Library_Record::reset(); } diff --git a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php index d1c068457a6005cca23e856ccd309b42d81f1cdb..a7e03381c109d53b2a34fafed4056d090da33ad2 100644 --- a/tests/application/modules/admin/controllers/AdminIndexControllerTest.php +++ b/tests/application/modules/admin/controllers/AdminIndexControllerTest.php @@ -332,7 +332,7 @@ class AdminIndexControllerAdminVarEditCKEditorActionTest extends Admin_AbstractC public function editPageShouldContainsTitlePNBLoanMessage() { $this->fixture('Class_AdminVar', ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', - 'valeur' => '']); + 'valeur' => '']); $this->dispatch('/admin/index/adminvaredit/cle/DILICOM_PNB_LOAN_WARNING_MESSAGE'); $this->assertQueryContentContains('h1', @@ -344,7 +344,7 @@ class AdminIndexControllerAdminVarEditCKEditorActionTest extends Admin_AbstractC public function postEnrichTextShouldNotRemoveTags() { $this->fixture('Class_AdminVar', ['id' => 'DILICOM_PNB_LOAN_WARNING_MESSAGE', - 'valeur' => '']); + 'valeur' => '']); $this ->getRequest() ->setMethod('POST') @@ -935,3 +935,50 @@ class AdminIndexControllerAdminVarEditHTTPSTest } + + + + +class AdminIndexControllerWithFormLinkTest extends Admin_AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $super_admin = $this->fixture('Class_Users', + ['id' => 34, + 'role_level' => ZendAfi_Acl_AdminControllerRoles::SUPER_ADMIN, + 'login' => 'bokeh', + 'password' => 'vvvvvv']); + + ZendAfi_Auth::getInstance()->logUser($super_admin); + } + + + /** @test */ + public function shouldRenderOnlyBokehFormLink() { + $this->dispatch('admin/index'); + $this->assertXPathContentContains('//div/a[@href="https://docs.google.com/forms/d/e/1FAIpQLSdKPUl7RUHXId-JyUmFCY5jRTkarXA-PVtjBG9LKFFKkQnksQ/viewform"]', 'AFI : Enquête de satisfaction 2021 portail Bokeh'); + } + + + /** @test */ + public function shouldRenderNanookBokehFormLink() { + $this->fixture('Class_IntBib', + ['id' => 78, + 'sigb' => Class_IntBib::SIGB_NANOOK, + 'comm_sigb' => Class_IntBib::COM_NANOOK, + 'comm_params' => 'a:1:{s:11:"url_serveur";s:53:"http://nanookws.afi-sa.net/afi_NanookWs/ilsdi/meylan/";}']); + + $this->dispatch('admin/index'); + $this->assertXPathContentContains('//div/a[@href="https://docs.google.com/forms/d/e/1FAIpQLSdKGlvMUMxTwCYH6TvbYZwGaQmLZcoGXXSk8T9u3IcMkdMqsg/viewform"]', 'AFI : Enquête de satisfaction 2021 SIGB AFI-Nanook et portail Bokeh'); + } + + + /** @test */ + public function withSuperAdminLoggedDbNameShouldBePresent() { + $this->dispatch('admin/index'); + $this->assertXPathContentContains('//div[@class = "ligne_info "]', 'Base de donnée'); + } +} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/CustomFieldsControllerTest.php b/tests/application/modules/admin/controllers/CustomFieldsControllerTest.php index fcfaca9e94367e6eee8565e6c60e2a49e9072196..82d8c2e43900a2e5d9faaa67c4731ab10d8c1628 100644 --- a/tests/application/modules/admin/controllers/CustomFieldsControllerTest.php +++ b/tests/application/modules/admin/controllers/CustomFieldsControllerTest.php @@ -203,6 +203,12 @@ class CustomFieldsControllerIndexTest extends CustomFieldControllerTestCase { public function downLinkShouldBePresent() { $this->assertXPath('//li//a[contains(@href, "admin/custom-fields/down/id/1")]'); } + + + /** @test */ + public function cleanLinkShouldBePresent() { + $this->assertXPath('//li//a[contains(@href, "admin/custom-fields/clean/id/1")]'); + } } @@ -760,4 +766,54 @@ class CustomFieldsControllerValuesForInexistingActivityTest extends CustomFieldC $this->assertRedirectTo('/admin/activity/edit/id/232', $this->getResponseLocation()); } } -?> + + + + + +class CustomFieldsControllerCleanTest extends CustomFieldControllerTestCase { + public function setup() { + parent::setup(); + $this->dispatch('admin/custom-fields/clean/id/3'); + } + + + /** @test */ + public function userGroupIdOneShouldBeInTable() { + $this->assertXPathContentContains('//table//td', 'Class_UserGroup(id=1)'); + } + + + /** @test */ + public function userGroupIdOneDeleteLinkShouldBePresent() { + $this->assertXPath('//table//td//a[@href="/admin/custom-fields/delete-value/id/23"]'); + } + + + /** @test */ + public function rueDuParadisShouldBeAnError() { + $this->assertXPathContentContains('//table//td//p[@class="error"]','11 rue Paradis (cette valeur n\'existe plus)'); + } +} + + + + +class CustomFieldsControllerDeleteValueTest extends CustomFieldControllerTestCase { + public function setup() { + parent::setup(); + $this->dispatch('/admin/custom-fields/delete-value/id/23'); + } + + + /** @test */ + public function customFieldValue23ShouldHaveBeenDeleted() { + $this->assertNull(Class_CustomField_Value::find(23)); + } + + + /** @test */ + public function shouldRedircet() { + $this->assertRedirect(); + } +} \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/NewsletterControllerTest.php b/tests/application/modules/admin/controllers/NewsletterControllerTest.php index e6b82973e5573f77bb2313de437e137221947434..8a32e20597899aeb557c8470f9445c6ec2e5c384 100644 --- a/tests/application/modules/admin/controllers/NewsletterControllerTest.php +++ b/tests/application/modules/admin/controllers/NewsletterControllerTest.php @@ -767,8 +767,9 @@ class Admin_NewsletterControllerSendActionTest /** @test */ - public function shouldHaveCalledCommand() { - $this->assertTrue($this->_command->methodHasBeenCalled('exec')); + public function commandshouldHaveBeenCalledStartingWithPhp() { + $shell = $this->_command->getFirstAttributeForMethodCallAt('exec', 0); + $this->assertEquals(1, preg_match('/^php -f /', $shell)); } @@ -851,7 +852,7 @@ class Admin_NewsletterControllerSendActionWithCommandFailureTest extends Admin_N /** @test */ public function dispatchShouldHaveError() { - $this->assertContains('Unable to run /usr/bin/php -f', + $this->assertContains('Unable to run php -f', $this->_dispatch->getErrorMessage()); } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 01f749a69cb719e76ba668421e0245e066e380f9..c77e2a42e0a17633870e444eba7bf7db575c4216 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -1308,7 +1308,7 @@ class ProfilOptionsControllerProfilJeunesseViewPageJeuxTest extends ProfilOption /** @test */ public function bodyClassShouldBeIndexIndexProfil12() { - $this->assertXPath('//body[@class="opac index_index profil_12"]'); + $this->assertXPath('//body[@class="opac index_index profil_12 template_HISTORIC"]'); } diff --git a/tests/scenarios/Templates/ChiliItemsTest.php b/tests/scenarios/Templates/ChiliItemsTest.php index 8c6a038ca8c12bee1d0aa1af49df23343fb36cd1..d16d87588bdbfc7a2aab9e15c885838e4ad47c67 100644 --- a/tests/scenarios/Templates/ChiliItemsTest.php +++ b/tests/scenarios/Templates/ChiliItemsTest.php @@ -152,7 +152,6 @@ class ChiliItemsWithKohaTest extends AbstractControllerTestCase { /** @test */ public function badgeItemHoldRankingShouldContainsAlready3Holds() { $this->assertXPathContentContains('//span[@class="badge_tag item_hold_rank badge-warning text-left badge"]//span', - utf8_encode('Déjà 3 réservations'), - $this->_response->getBody()); + utf8_encode('Déjà 3 réservations')); } } diff --git a/tests/scenarios/Templates/ChiliSearchTest.php b/tests/scenarios/Templates/ChiliSearchTest.php new file mode 100644 index 0000000000000000000000000000000000000000..991e07241084d3a31ba3045dc7d28a7399662933 --- /dev/null +++ b/tests/scenarios/Templates/ChiliSearchTest.php @@ -0,0 +1,148 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +require_once 'tests/fixtures/KohaFixtures.php'; + +class ChiliSearchHoldLinkTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 3, + 'template' => 'CHILI']); + + $this->fixture('Class_Notice', + ['id' => 2, + ]); + + $this->fixture('Class_Exemplaire', + ['id' => 1, + 'id_notice' => 2, + 'id_origine' => '12', + 'code_barres' => '1249036', + 'id_int_bib' => 1, + 'id_bib' => 1 + ]); + + $this->fixture('Class_IntBib', + ['id' => 1, + 'comm_sigb' => Class_IntBib::COM_KOHA, + 'comm_params' => ['url_serveur' => 'https://monsuperkoha.org'] + ]); + + $this->fixture('Class_Bib', + ['id' => 1, + 'libelle' => 'Montmin', + ]); + + $mock_web_client = + $this->mock() + + ->whenCalled('open_url') + ->with('https://monsuperkoha.org?service=GetRecords&id=12') + ->answers(KohaFixtures::xmlGetRecord2046()) + + ->beStrict(); + + $service = Class_WebService_SIGB_Koha::getService(['url_serveur' => 'https://monsuperkoha.org', + 'id_bib' => 1, + 'type' => Class_IntBib::COM_KOHA]); + $service->setWebClient($mock_web_client); + + Zend_Registry::set('sql', + $this->mock() + ->whenCalled('fetchAll') + ->answers([[2, '']])); + + $this->dispatch('/recherche/simple'); + } + + + /** @test */ + public function linkToReserverRecord2ShouldBePickupLocationItem1() { + $this->assertXPathContentContains('//a[@href = "/recherche/reservation-pickup-ajax/id_notice/2/id_int_bib/1/id_bib/1/copy_id/1"][contains(@class, "record_hold_link")]', 'Réserver'); + } + + + /** @test */ + public function pageShouldBeHTML5Valid() { + $this->assertHTML5(); + } +} + + + + +class ChiliSearchHoldLinkNoSIGBTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 3, + 'template' => 'CHILI']); + + $this->fixture('Class_Notice', + ['id' => 2, + ]); + + $this->fixture('Class_Exemplaire', + ['id' => 1, + 'id_notice' => 2, + 'id_origine' => '12', + 'code_barres' => '1249036', + 'id_int_bib' => 1, + 'id_bib' => 1 + ]); + + $this->fixture('Class_IntBib', + ['id' => 1, + ]); + + $this->fixture('Class_Bib', + ['id' => 1, + 'libelle' => 'Montmin', + 'interdire_resa' => 1, + ]); + + Zend_Registry::set('sql', + $this->mock() + ->whenCalled('fetchAll') + ->answers([[2, '']])); + + $this->dispatch('/recherche/simple'); + } + + + /** @test */ + public function linkToReserverRecord2ShouldHaveClassNoHoldableItom() { + $this->assertXPathContentContains('//a[@class = "card-link record_hold_link no_holdable_item"]', 'Non réservable'); + } + + + /** @test */ + public function pageShouldBeHTML5Valid() { + $this->assertHTML5(); + } +} diff --git a/tests/scenarios/Templates/PolygoneTemplateTest.php b/tests/scenarios/Templates/PolygoneTemplateTest.php index c929858557b07f71fd65a2b58038a74c22da8666..63750f783022cecb858060066988d9da57ce015c 100644 --- a/tests/scenarios/Templates/PolygoneTemplateTest.php +++ b/tests/scenarios/Templates/PolygoneTemplateTest.php @@ -112,6 +112,43 @@ class PolygoneTemplateProfilePatcherTest extends PolygoneTemplateTestCase { public function pageShouldContainsScrollSearchInit() { $this->assertXPathContentContains('//script', '$(".scroll_search").scroll_search();'); } + + + + /** @test */ + public function bodyShouldHaveClassTemplatePOLYGONE() { + $this->assertXPath('//body[contains(@class, "template_POLYGONE")]'); + } + + + /** @test */ + public function bodyShouldHaveDataTemplatePOLYGONE() { + $this->assertXPath('//body[@data-template="POLYGONE"]'); + } + + + /** @test */ + public function bodyShouldHaveDataProfileIdOne() { + $this->assertXPath('//body[@data-profile-id="24"]'); + } + + + /** @test */ + public function bodyShouldHaveDataModuleOpac() { + $this->assertXPath('//body[@data-module="opac"]'); + } + + + /** @test */ + public function bodyShouldHaveDataControllerIndex() { + $this->assertXPath('//body[@data-controller="index"]'); + } + + + /** @test */ + public function bodyShouldHaveDataActionIndex() { + $this->assertXPath('//body[@data-action="index"]'); + } } diff --git a/tests/scenarios/Templates/TemplatesAdminIndexTest.php b/tests/scenarios/Templates/TemplatesAdminIndexTest.php index e8033f457c4b9ae9b952fe667dbe70cd31cd4b25..4a68f50da5b4fc4299ae59ddd5a6080abe6e16b0 100644 --- a/tests/scenarios/Templates/TemplatesAdminIndexTest.php +++ b/tests/scenarios/Templates/TemplatesAdminIndexTest.php @@ -66,4 +66,10 @@ class TemplatesAdminIndexDispatchTest public function applyIntonationShouldBePresent() { $this->assertXPath('//table//a[contains(@href,"/admin/template/apply/template/INTONATION")]'); } + + + /** @test */ + public function bodyShouldHaveClassTemplateHistoric() { + $this->assertXPath('//body[contains(@class, "template_HISTORIC")]'); + } } diff --git a/tests/scenarios/Templates/TemplateDigitalResourcesTest.php b/tests/scenarios/Templates/TemplatesDigitalResourcesTest.php similarity index 69% rename from tests/scenarios/Templates/TemplateDigitalResourcesTest.php rename to tests/scenarios/Templates/TemplatesDigitalResourcesTest.php index 47c6fd05e1226e063ac25a18ac705f0877203fe8..e8b6855543eb89d7176cb2510e498a3ac40f2daf 100644 --- a/tests/scenarios/Templates/TemplateDigitalResourcesTest.php +++ b/tests/scenarios/Templates/TemplatesDigitalResourcesTest.php @@ -22,7 +22,7 @@ require_once 'tests/fixtures/DilicomFixtures.php'; -class TemplateDigitalResourcesDispatchTest extends AbstractControllerTestCase { +class TemplatesDigitalResourcesDispatchTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -71,7 +71,7 @@ class TemplateDigitalResourcesDispatchTest extends AbstractControllerTestCase { -class TemplateDigitalResourcesMediaAndTrailerDispatchTest extends AbstractControllerTestCase { +class TemplatesDigitalResourcesMediaAndTrailerDispatchTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -138,7 +138,7 @@ class TemplateDigitalResourcesMediaAndTrailerDispatchTest extends AbstractContro -abstract class TemplateDigitalResourcesDilicomTestCase extends AbstractControllerTestCase { +abstract class TemplatesDigitalResourcesDilicomTestCase extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -182,7 +182,7 @@ abstract class TemplateDigitalResourcesDilicomTestCase extends AbstractControlle -class TemplateDigitalResourcesLoanBookAjaxTest extends TemplateDigitalResourcesDilicomTestCase { +class TemplatesDigitalResourcesLoanBookAjaxTest extends TemplatesDigitalResourcesDilicomTestCase { public function setUp() { parent::setUp(); @@ -205,7 +205,7 @@ class TemplateDigitalResourcesLoanBookAjaxTest extends TemplateDigitalResourcesD -class TemplateDigitalResourcesDilicomItemTest extends TemplateDigitalResourcesDilicomTestCase { +class TemplatesDigitalResourcesDilicomItemTest extends TemplatesDigitalResourcesDilicomTestCase { public function setUp() { parent::setUp(); @@ -241,7 +241,7 @@ class TemplateDigitalResourcesDilicomItemTest extends TemplateDigitalResourcesDi /** @see http://forge.afi-sa.fr/issues/115415 */ -class TemplateDigitalResourcesWrongIndexationTest extends AbstractControllerTestCase { +class TemplatesDigitalResourcesWrongIndexationTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -303,7 +303,7 @@ class TemplateDigitalResourcesWrongIndexationTest extends AbstractControllerTest -abstract class TemplateDigitalResourcesTrailerAdministrationTestCase extends AbstractControllerTestCase { +abstract class TemplatesDigitalResourcesTrailerAdministrationTestCase extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; @@ -342,7 +342,7 @@ abstract class TemplateDigitalResourcesTrailerAdministrationTestCase extends Abs -class TemplateDigitalResourcesTrailerEnabledAdministrationTest extends TemplateDigitalResourcesTrailerAdministrationTestCase { +class TemplatesDigitalResourcesTrailerEnabledAdministrationTest extends TemplatesDigitalResourcesTrailerAdministrationTestCase { protected $_is_trailer_disabled = 0; @@ -368,7 +368,7 @@ class TemplateDigitalResourcesTrailerEnabledAdministrationTest extends TemplateD -class TemplateDigitalResourcesTrailerDisabledAdministrationTest extends TemplateDigitalResourcesTrailerAdministrationTestCase { +class TemplatesDigitalResourcesTrailerDisabledAdministrationTest extends TemplatesDigitalResourcesTrailerAdministrationTestCase { protected $_is_trailer_disabled = 1; @@ -389,4 +389,128 @@ class TemplateDigitalResourcesTrailerDisabledAdministrationTest extends Template public function trailerShouldNotBeRender() { $this->assertNotXPath('//iframe[@src="https://www.super-trailers.org/?media=18397590"]'); } -} \ No newline at end of file +} + + + + +class TemplatesDigitalResourcesAudioRecordTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 9]); + + $this->fixture('Class_CodifTypeDoc', + ['id' => Class_TypeDoc::AUDIO_RECORD, + 'famille_id' => Class_CodifTypeDoc::SONORE]); + + $album = $this->fixture('Class_Album', + ['id' => 4, + 'type_doc_id' => Class_TypeDoc::AUDIO_RECORD, + 'titre' => 'Seventh Son of a Seventh Son', + 'status' => Class_Album::STATUS_VALIDATED]); + + $album + ->setDistributor('Geffen Records') + ->addRessource($this->fixture('Class_AlbumRessource', + ['id' => 1, + 'titre' => 'Moonchild', + 'fichier' => 'moonchild.mp3'])) + ->addRessource($this->fixture('Class_AlbumRessource', + ['id' => 2, + 'titre' => 'Infinite Dreams', + 'fichier' => 'infinite_dreams.mp3'])) + ->addRessource($this->fixture('Class_AlbumRessource', + ['id' => 3, + 'fichier' => 'unknown.mp3'])) + ->addRessource($this->fixture('Class_AlbumRessource', + ['id' => 4, + 'fichier' => '502_05_the_prophecy.mp3'])); + $album->assertSave(); + + $album->index(); + + $this->dispatch('/noticeajax/media/id/1'); + } + + + /** @test */ + public function audioJsShouldNotBeLoaded() { + $this->assertNotXpathContentContains('//script', 'audiojs/audiojs'); + } + + + /** @test */ + public function audioHTMLElementShouldBePresent() { + $this->assertXPath('//audio[@class="audio_player"]'); + } + + + /** @test */ + public function theProphecyShouldHaveLinkToPlayRessource() { + $this->assertXPathContentContains('//div[@class="list-group-item bg-transparent px-0 mb-3"]//a[@class="audio_track card-title text-secondary"][contains(@data-track-url,"bib-numerique/play-ressource/id/4.mp3")]/span[@class="track_title"]', 'The prophecy'); + } +} + + + + +class TemplatesDigitalResourcesTrailerEmptyPlayerAdministrationTest extends AbstractControllerTestCase { + + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + + $this->_buildTemplateProfil(['id' => 5, + 'template' => 'CHILI']); + + $this->fixture('Class_Notice', + ['id' => 34, + 'titre_principal' => 'Psycho', + 'type_doc' => Class_TypeDoc::DISQUE, + ]) + ->setAuteurPrincipal('M.'); + + $this->fixture('Class_CodifAuteur', + ['id' => 324, + 'libelle' => 'M']); + + Class_CosmoVar::set('url_services', 'https://cache-server.org'); + + $mock_web = $this->mock() + + ->whenCalled('open_url') + ->answers(json_encode(['source' => '', + 'disable_trailer' => 1, + 'player' => ''])); + + Class_WebService_AllServices::setHttpClient($mock_web); + + $this->dispatch('/noticeajax/media/id/34'); + } + + + /** @test */ + public function linkToEditTrailerShouldNotBePresent() { + $this->assertNotXPath('//button[@data-url = "/admin/records/trailer/id/34"]'); + } + + + /** @test */ + public function linkToEnableTrailerShouldBePresent() { + $this->assertXPath('//button[@data-url = "/admin/records/enable-trailer/id/34"]'); + } + + + /** @test */ + public function trailerShouldNotBeRender() { + $this->assertNotXPath('//iframe'); + } +} diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index c10aee0f8dadd1226fa60d0964e53886624f089c..bab5f825e246959f097f6c96be22071725a708dc 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -1557,8 +1557,14 @@ class TemplatesNoticeajaxMediaDispatchTest extends TemplatesIntonationTestCase { /** @test */ - public function shouldRenderCarouselWithAudio() { - $this->assertXPath('//div[contains(@class, "carousel")]//audio'); + public function shouldRenderListGroupItemWithDataTrackUrl() { + $this->assertXPath('//div[contains(@class, "list-group-item")]//a[@data-track-url]'); + } + + + /** @test */ + public function shouldContainsOneAudio() { + $this->assertXPathCount('//audio', 1); } }