From 6491074143075e0bb683b3adfa2a672e5aca09d4 Mon Sep 17 00:00:00 2001 From: Patrick Barroca <pbarroca@afi-sa.fr> Date: Wed, 17 Oct 2018 14:53:52 +0200 Subject: [PATCH] hotline #80642 : remove Lekiosk resources preview --- VERSIONS_HOTLINE/80642 | 1 + .../Lekiosk/View/Helper/Album.php | 50 +++++++------------ .../Lekiosk/tests/LekioskTest.php | 18 +------ 3 files changed, 19 insertions(+), 50 deletions(-) create mode 100644 VERSIONS_HOTLINE/80642 diff --git a/VERSIONS_HOTLINE/80642 b/VERSIONS_HOTLINE/80642 new file mode 100644 index 00000000000..3852cc8f526 --- /dev/null +++ b/VERSIONS_HOTLINE/80642 @@ -0,0 +1 @@ + - ticket #80642 : Lekiosk : à la demande expresse de ce fournisseur, suppression de la prévisualisation dans la vue d'une notice Lekiosk \ No newline at end of file diff --git a/library/digital_resources/Lekiosk/View/Helper/Album.php b/library/digital_resources/Lekiosk/View/Helper/Album.php index 39fc9a6016b..c551ddd3e73 100644 --- a/library/digital_resources/Lekiosk/View/Helper/Album.php +++ b/library/digital_resources/Lekiosk/View/Helper/Album.php @@ -26,21 +26,27 @@ class Lekiosk_View_Helper_Album extends ZendAfi_View_Helper_TagRessourceNumeriqu $this->_album = $album; $this->_config = Lekiosk_Config::getInstance(); - return $this->_tag('p', $this->_renderSSOLink()) . $this->_renderPreview(); + $link = $this->canAccessRessourceNumerique() + ? $this->_renderAccessLink() + : $this->_renderNoAccessLink(); + + return $this->_tag('p', $link); } - protected function _renderSSOLink() { - if (!$this->canAccessRessourceNumerique()) - return $this->view - ->tagAnchor($this->view->url(['module' => 'opac', - 'controller' => 'modules', - 'action' => 'lekiosk', - 'album_id' => $this->_album->getId()], - null, true), - $this->_('Vous devez être connecté sous un compte avec abonnement valide pour lire le magazine'), - ['class' => 'bouton']); + protected function _renderNoAccessLink() { + return $this->view + ->tagAnchor($this->view->url(['module' => 'opac', + 'controller' => 'modules', + 'action' => 'lekiosk', + 'album_id' => $this->_album->getId()], + null, true), + $this->_('Vous devez être connecté sous un compte avec abonnement valide pour lire le magazine'), + ['class' => 'bouton']); + } + + protected function _renderAccessLink() { return $this->view ->tagAnchor($this->_config->getSsoUrl(Class_Users::getIdentity(), $this->_album), $this->_('Lire le magazine %s sur le site LeKiosk', @@ -50,28 +56,6 @@ class Lekiosk_View_Helper_Album extends ZendAfi_View_Helper_TagRessourceNumeriqu } - protected function _renderPreview() { - return $this->_tag('div', - $this->_tag('iframe', - '', - ['src' => sprintf('https://www2.lekiosk.com/fr/reader/%s/%s', - $this->_album->getIdOrigine(), - $this->_getIdFromCoverUrl()), - 'width' => '100%', - 'height' => '860px', - 'style' => 'margin-top: -60px']), - ['style' => 'overflow: hidden; height: 800px; margin-top: 2em']); - } - - - protected function _getIdFromCoverUrl() { - preg_match('|.*/Publications/([0-9]+)/([0-9]+)/Images.*|', - $this->_album->getPoster(), - $matches); - return $matches[2]; - } - - protected function hasRightAccesRessourcesNumeriques($user) { return $this->_config->hasRightAccess($user); } diff --git a/library/digital_resources/Lekiosk/tests/LekioskTest.php b/library/digital_resources/Lekiosk/tests/LekioskTest.php index 60fbb092d78..bda3e4be0fa 100644 --- a/library/digital_resources/Lekiosk/tests/LekioskTest.php +++ b/library/digital_resources/Lekiosk/tests/LekioskTest.php @@ -15,7 +15,7 @@ * 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 +* along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -409,14 +409,6 @@ class LekioskRenderAlbumFromRecordTest extends LekioskServiceTestCase { } - /** @test */ - public function iframeSrcForPreviewShouldBeReader851749_1962566() { - $this->_dispatchAlbum(); - $this->assertXPath('//iframe[@src="https://www2.lekiosk.com/fr/reader/851749/1962566"]', - $this->_response->getBody()); - } - - /** @test */ public function withoutRightsShouldDisplayErrorMessage() { ZendAfi_Auth::getInstance()->clearIdentity(); @@ -647,14 +639,6 @@ class LekioskServiceHttpHarvestingNoticeAjaxTest extends LekioskServiceHttpHarve } - /** @test */ - public function iframeSrcForPreviewShouldBeReader851749_1962566() { - $this->_dispatchAlbum(); - $this->assertXPath('//iframe[@src="https://www2.lekiosk.com/fr/reader/851749/2052615"]', - $this->_response->getBody()); - } - - /** @test */ public function withoutRightsShouldDisplayErrorMessage() { ZendAfi_Auth::getInstance()->clearIdentity(); -- GitLab