Commit 7d600662 authored by Laurent's avatar Laurent
Browse files

dev #100226 record page displays gallica player in digital resources tab if...

dev #100226 record page displays gallica player in digital resources tab if ark url in subfield 856$u
parent 61482221
Pipeline #8732 passed with stage
in 43 minutes and 3 seconds
'100226' =>
['Label' => $this->_('Enrichissement Gallica'),
'Desc' => $this->_('Si la zone 856$u contient une URL ark Gallica, alors l\'onglet ressource numérique affiche le document correspondant'),
'Image' => '',
'Video' => '',
'Category' => $this->_('Enrichissements'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Enrichissement_Gallica',
'Test' => '',
'Date' => '2019-11-18'],
\ No newline at end of file
- ticket #100226 : Si la zone 856$u contient une URL ark Gallica, alors l'onglet ressource numérique affiche le document correspondant
\ No newline at end of file
......@@ -264,6 +264,9 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
if ($viewer = (new Class_Notice_Numel($this->notice))->getViewer())
return $this->_sendResponseWithScripts($viewer->renderOn($this->view));
if ($viewer = (new Class_Notice_Gallica($this->notice))->getViewer())
return $this->_sendResponseWithScripts($viewer->renderOn($this->view));
$html = $add_album_tag = '';
if (1 == Class_AdminVar::isBibNumEnabled()
......
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Notice_Gallica {
protected $_record;
public function __construct($record) {
$this->_record = $record;
}
public function getGallicaURL() {
$urls = array_filter($this->_record->get_subfield('856', 'u'),
[$this, 'isGallicaUrl']);
return reset($urls);
}
public function isGallicaURL($url) {
return preg_match('/http[s]?:\/\/gallica\.bnf\.fr\/ark\:/', $url);
}
public function shouldRender() {
return !empty($this->getGallicaURL());
}
public function getViewer() {
return $this->shouldRender()
? $this
: null;
}
public function renderOn($view) {
return $view
->tag('div',
$view->tag('iframe',
null,
['src' => $this->getGallicaURL() . '/f1.double.mini',
'class' => 'gallica-player']));
}
}
......@@ -108,6 +108,9 @@ class Class_Onglet {
if ((new Class_Notice_Numel($notice))->shouldRender())
return true;
if ((new Class_Notice_Gallica($notice))->shouldRender())
return true;
return (null !== $notice->getAlbum())
|| 0 < Class_FRBR_Link::countAlbumsFromNotice($notice);
}
......
......@@ -147,7 +147,7 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity {
->setCategory($item->getCategoryLabel())
->setLabel($this->_('%s ( %s )',
$item->getLibelle(),
$child['libelle']));
isset($child['libelle']) ? $child['libelle'] : ''));
}
return $datas;
......
......@@ -355,7 +355,7 @@ class ZendAfi_View_Helper_Admin_FrontNavEntries extends ZendAfi_View_Helper_Base
protected function _myAccount() {
$id = $this->_user->getId();
$name = Class_Users::getNomAff($id);
$name = $this->_user->getNomAff();
$anchors = [$this->_tag('li',
$this->view->tagAnchor(['module' => 'admin',
'controller' => 'users',
......
......@@ -29,8 +29,8 @@ abstract class ZendAfi_View_Helper_Menu_Base extends ZendAfi_View_Helper_BaseHel
if (!array_isset('preferences', $menu))
$menu['preferences'] = [];
$menu['preferences']['picto'] = $menu['picto'] ;
$menu['preferences']['libelle'] = $menu['libelle'];
$menu['preferences']['picto'] = isset($menu['picto']) ? $menu['picto'] : '';
$menu['preferences']['libelle'] = isset($menu['libelle']) ? $menu['libelle'] : '';
$helper = self::getMenuHelper($menu, $id_module);
$helper->setView($view);
......
......@@ -223,7 +223,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires_Section extends ZendAfi_View_Helper
}
public function getContent($exemplaire) {
return Class_Codification::getLibelleFacette("S" . $exemplaire->getSection());
return Class_Codification::getInstance()->getLibelleFacette("S" . $exemplaire->getSection());
}
}
......@@ -493,7 +493,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires_Emplacement extends ZendAfi_View_He
}
public function getContent($exemplaire) {
return Class_Codification::getLibelleFacette("E".$exemplaire->getEmplacement());
return Class_Codification::getInstance()->getLibelleFacette("E".$exemplaire->getEmplacement());
}
}
?>
\ No newline at end of file
......@@ -2292,6 +2292,12 @@ button.vodeclic_link + img {
float: left;
}
iframe.gallica-player {
width: 100%;
height: 500px;
}
.navigation {
border-bottom: 1px dotted grey;
margin:5px 0;
......@@ -3799,4 +3805,4 @@ a[href*="bookmarked-searches/notify"] img {
.visuallyhidden {
position: absolute;
top:-9999px;
}
\ No newline at end of file
}
......@@ -75,7 +75,6 @@
(gtags-mode t)
(setq ag-highlight-search t)
(setq ag-arguments (list "--smart-case"
"--nogroup"
"--column"
"--ignore" "phonetix.txt"
"--ignore" "TAGS"
......
<?php
/**
* Copyright (c) 2012-2019, 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 NoticeAjaxControllerGallicaIn856DollarUTest extends AbstractControllerTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
ZendAfi_Auth::getInstance()->clearIdentity();
}
/** @test */
public function withValidUrlResponseShouldContainGallicaPlayerInIframe() {
$this->fixture('Class_Notice',
['id' => 21,
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '12345')
->zoneWithChildren('856', ['u' => 'http://gallica.bnf.fr/ark:/12148/bpt6k5545753d'])
->render()]);
$this->dispatch('/opac/noticeajax/resnumeriques/id/21');
$this->assertXPath('//div/iframe[@src="http://gallica.bnf.fr/ark:/12148/bpt6k5545753d/f1.double.mini"]');
}
/** @test */
public function withNoUrlResponseShouldNotContainsIframe() {
$this->fixture('Class_Notice',
['id' => 21,
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '12345')
->render()]);
$this->dispatch('/opac/noticeajax/resnumeriques/id/21');
$this->assertNotXPath('//iframe');
}
/** @test */
public function withNoGallicaUrlResponseShouldNotContainsIframe() {
$this->fixture('Class_Notice',
['id' => 21,
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '12345')
->zoneWithChildren('856', ['u' => 'http://tintin.milou.com'])
->render()]);
$this->dispatch('/opac/noticeajax/resnumeriques/id/21');
$this->assertNotXPath('//iframe');
}
/** @test */
public function withGallicaUrlHTTPSInSecondPositionResponseShouldContainsIframe() {
$this->fixture('Class_Notice',
['id' => 21,
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '12345')
->zoneWithChildren('856', ['u' => 'tiguidou tsoi tsoin'])
->zoneWithChildren('856', ['u' => 'https://gallica.bnf.fr/ark:/12148/bpt6k5545753d'])
->render()]);
$this->dispatch('/opac/noticeajax/resnumeriques/id/21');
$this->assertXPath('//div/iframe[@src="https://gallica.bnf.fr/ark:/12148/bpt6k5545753d/f1.double.mini"]');
}
/** @test */
public function ongletHasNumericResourcesForGallicaShouldBeTrue() {
$record = $this->fixture('Class_Notice',
['id' => 21,
'unimarc' => (new Class_NoticeUnimarc_Fluent)
->zoneWithContent('001', '12345')
->zoneWithChildren('856', ['u' => 'http://gallica.bnf.fr/ark:/12148/bpt6k5545753d'])
->render()]);
$this->assertTrue((new Class_Onglet('digital resource', 'resnum'))->hasNumericRessources($record));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment