diff --git a/application/modules/telephone/controllers/RechercheController.php b/application/modules/telephone/controllers/RechercheController.php index dc1aa742ca34b57175da251de42ed0fd7d040478..a236a8331c5f1e673776ab0bdc1fc5c8598d2104 100644 --- a/application/modules/telephone/controllers/RechercheController.php +++ b/application/modules/telephone/controllers/RechercheController.php @@ -50,6 +50,11 @@ class Telephone_RechercheController extends RechercheController { 'attribs' => ['data-ajax' => 'false']]; } + if ($notice->isAudioRecord()) { + $actions[$this->_('Ecouter l\'album')] = ['action' => 'ressourcesnumeriques', + 'attribs' => ['data-ajax' => 'false']]; + } + $this->view->notice = $notice; $this->view->actions = $actions; } diff --git a/library/Class/Notice.php b/library/Class/Notice.php index f953e52bd86598334b2e159c379c9c2ce2cc5ecc..7b6278dcca90c5b9d6fa4970aa97fa2eba683f0d 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -421,6 +421,10 @@ class Class_Notice extends Storm_Model_Abstract { return ($this->getTypeDoc() == Class_TypeDoc::ARTICLE); } + public function isAudioRecord() { + return ($this->getTypeDoc() == Class_TypeDoc::AUDIO_RECORD); + } + public function getArticleCms() { if (!$this->isArticleCms()) diff --git a/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php b/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php index ee5109a39658ef3775b05dda17c4edfa96d6a43a..7b4fcc03411a0f50ff074fa1c26dc3a2d0eb74e3 100644 --- a/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php +++ b/library/ZendAfi/View/Helper/Telephone/RenderAlbum.php @@ -36,7 +36,6 @@ class ZendAfi_View_Helper_Telephone_RenderAlbum extends ZendAfi_View_Helper_Rend if ($album->isDiaporama() && $album->hasOnlyImages()) return $this->view->tagSlideshow($album); - if ($album->isGallica()) return $this->view->gallicaPlayer($album); @@ -46,6 +45,9 @@ class ZendAfi_View_Helper_Telephone_RenderAlbum extends ZendAfi_View_Helper_Rend if (defined('DEVELOPMENT') && $album->isEPUB()) return $this->view->monocleReader($album); + if ($album->isAudioRecord()) + return $this->view->tagAlbumTrackList($album); + return $this->view->tagAlbumMediaList($album); } } diff --git a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php index 44ce3b8b1fd04b91925cea12e39c51c13567d1b9..733154168c6f786ad77e796e8dc22d005367c9a2 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerAlbumAudioRecordTest.php @@ -207,6 +207,52 @@ class RechercheControllerAlbumAudioRecordViewRessourcesNumeriquesTest extends Re $this->dispatch('/opac/noticeajax/resnumeriques/id_notice/'.$this->_notice->getId(), true); } + + /** @test */ + public function moonchildPlayerShouldBePresent() { + $this->assertXPath('//ol//li//audio/source[contains(@src, "moonchild.mp3")]', $this->_response->getBody()); + } + + + /** @test */ + public function titreShouldContainsMoonchild() { + $this->assertXPathContentContains('//ol//li', 'Moonchild'); + } + + + /** @test **/ + public function liShouldBeFileNameUnknown() { + $this->assertXPathContentContains('//ol//li', 'unknown.mp3'); + } + +} + + +class RechercheControllerAlbumAudioRecordViewRessourceInTelephoneModeTest extends RechercheControllerAlbumAudioRecordTestCase { + public function setup() { + parent::setup(); + Class_Profil::getCurrentProfil()->beTelephone(); + $this->dispatch('/opac/recherche/viewnotice/id/1', true); + } + + + /** @test */ + public function pageShouldContainsLinkToOpenRessourcesNumeriques() { + $this->assertXPathContentContains('//a[contains(@href,"recherche/ressourcesnumeriques/id/1")]','Ecouter l\'album',$this->_response->getBody()); + } + +} + + + +class RechercheControllerAlbumAudioRecordAsTelephoneViewRessourcesNumeriquesTest extends RechercheControllerAlbumAudioRecordTestCase { + public function setUp() { + parent::setUp(); + Class_Profil::getCurrentProfil()->beTelephone(); + $this->dispatch('/recherche/ressourcesnumeriques/id/1', true); + } + + /** @test */ public function moonchildPlayerShouldBePresent() { $this->assertXPath('//ol//li//audio/source[contains(@src, "moonchild.mp3")]', $this->_response->getBody()); @@ -218,8 +264,9 @@ class RechercheControllerAlbumAudioRecordViewRessourcesNumeriquesTest extends Re $this->assertXPathContentContains('//ol//li', 'Moonchild'); } + /** @test **/ - public function liShouldBeFileNameunknown() { + public function liShouldBeFileNameUnknown() { $this->assertXPathContentContains('//ol//li', 'unknown.mp3'); } }