diff --git a/library/digital_resources/EntrepotNumeriqueMelun/View/Helper/Album.php b/library/digital_resources/EntrepotNumeriqueMelun/View/Helper/Album.php index 4b6e6611e15f7efd2c11637dc2bdab4f07ddda12..7a408d68a4ac27e16626e83c83503a38f63ae2f0 100644 --- a/library/digital_resources/EntrepotNumeriqueMelun/View/Helper/Album.php +++ b/library/digital_resources/EntrepotNumeriqueMelun/View/Helper/Album.php @@ -20,4 +20,27 @@ */ -class EntrepotNumeriqueMelun_View_Helper_Album extends Class_DigitalResource_AlbumViewHelper {} \ No newline at end of file +class EntrepotNumeriqueMelun_View_Helper_Album extends Class_DigitalResource_AlbumViewHelper { + public function album($album) { + if (!$album) + return ''; + + if (!$viewer = $album->getExternalUri()) + return ''; + + $class = $this->_config->getName(). '_viewer'; + + Class_ScriptLoader::getInstance() + ->addInlineStyle(sprintf('iframe.%s { height: %dpx; width: %dpx }', + $class, + 900, + 600)); + + return + $this->_tagAnchor($viewer, $viewer, ['target' => '_blank']) + . $this->_tag('iframe', + null, + ['src' => $viewer, + 'class' => $class]); + } +} \ No newline at end of file diff --git a/library/digital_resources/EntrepotNumeriqueMelun/tests/EntrepotNumeriqueMelunTest.php b/library/digital_resources/EntrepotNumeriqueMelun/tests/EntrepotNumeriqueMelunTest.php index d31ccb4beb15f98b6e4736b5856b164c023d406c..3eaa695d21a01ebce3409157dcd58b508f7a063e 100644 --- a/library/digital_resources/EntrepotNumeriqueMelun/tests/EntrepotNumeriqueMelunTest.php +++ b/library/digital_resources/EntrepotNumeriqueMelun/tests/EntrepotNumeriqueMelunTest.php @@ -205,4 +205,15 @@ class EntrepotNumeriqueMelunHarvestTests extends EntrepotNumeriqueMelunActivated public function origineDocTypeShouldBeTexteManuscrit() { $this->assertEquals('texte manuscrit', $this->_album->getNote('915$a')); } + + + /** @test */ + public function dispatchResnumeriquesOnIndexedAlbumShouldRenderViewer() { + $this->_album->index(); + $id = $this->_album->getNotice()->getId(); + $this->dispatch('/opac/noticeajax/resnumeriques/id/' . $id, true); + $this->assertXPath('//iframe[@src="http://melun.preprod-osiros.decalog.net//viewer.php?docId=100"]'); + + $this->assertXPathContentContains('//style', 'height: 900px', $this->_response->getBody()); + } } \ No newline at end of file