diff --git a/VERSIONS_WIP/98536 b/VERSIONS_WIP/98536 new file mode 100644 index 0000000000000000000000000000000000000000..bd1b109b3e81e7ff7762602adbbc4aaac76f1aa6 --- /dev/null +++ b/VERSIONS_WIP/98536 @@ -0,0 +1 @@ + - ticket #98536 : si le portail est compatible (HTTPS), affiche un bandeau de présentation MyBibApp côté administration \ No newline at end of file diff --git a/application/modules/admin/controllers/IndexController.php b/application/modules/admin/controllers/IndexController.php index 76800d53dd91298e6409d53781482c558f199cf0..682dc3b1fdcb0044d43c65c47b0662c144cf2855 100644 --- a/application/modules/admin/controllers/IndexController.php +++ b/application/modules/admin/controllers/IndexController.php @@ -29,6 +29,8 @@ class Admin_IndexController extends ZendAfi_Controller_Action { $this->view->user = Class_Users::getIdentity(); + $this->view->is_request_secure = $this->getRequest()->isSecure(); + // Activation - désactivation du site if (null !== ($setSiteOk = $this->_getParam('setsiteok'))) { if ('false' == $setSiteOk) Class_AdminVar::set('SITE_OK', '0'); diff --git a/application/modules/admin/views/scripts/index/index.phtml b/application/modules/admin/views/scripts/index/index.phtml index cfd28a607fa106e28c803b44b3371870e64fa6e3..b7abcae2fc2eb933393a78be4683d85d1e5c92c8 100644 --- a/application/modules/admin/views/scripts/index/index.phtml +++ b/application/modules/admin/views/scripts/index/index.phtml @@ -1,3 +1,8 @@ +<?php +if ($this->is_request_secure) + echo $this->myBibAppTeaser() +?> + <h2 class="toggle_video"> <?php Class_ScriptLoader::getInstance()->addJQueryReady('$(".toggle_video").click(function() {$(this).toggleClass("on");$(this).next().toggle();})'); diff --git a/library/ZendAfi/View/Helper/Admin/MyBibAppTeaser.php b/library/ZendAfi/View/Helper/Admin/MyBibAppTeaser.php new file mode 100644 index 0000000000000000000000000000000000000000..73d031efe41dca185b9e33acdc926f124ef7c719 --- /dev/null +++ b/library/ZendAfi/View/Helper/Admin/MyBibAppTeaser.php @@ -0,0 +1,149 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_Admin_MyBibAppTeaser extends ZendAfi_View_Helper_BaseHelper { + public function myBibAppTeaser() { + Class_ScriptLoader::getInstance()->addInlineStyle($this->_css()); + return $this->_tag('div', + $this->_renderContent(), + ['id' => 'mybibapp_teaser']); + + } + + protected function _css() { + return ' + #mybibapp_teaser { + display: grid; + grid-gap: 10px; + grid-template-columns: repeat(auto-fill, 150px); + } + + #mybibapp_teaser > a { + align-self: end; + } + + #mybibapp_teaser > a:first-child() { + grid-column: 1/3; + grid-row: 1; + } + + #mybibapp_teaser > a:nth-child(2) { + grid-column: 1; + grid-row: 2; + } + + #mybibapp_teaser > a:nth-child(3) { + grid-column: 2; + grid-row: 2; + } + + #mybibapp_teaser > div { + grid-column: 3/-1; + grid-row: 1/3; + } + + #mybibapp_teaser ul { + margin-left:20px; + } + + #mybibapp_teaser li { + list-style: circle; + } + + #mybibapp_teaser div p img { + vertical-align: bottom; + margin-right: 5px + }'; + } + + protected function _iconLink($url, $title, $icon, $width) { + return + $this->_tag('a', + $this->_tag('img', + null, + ['src' => URL_SHARED_IMG . '/mybibapp/' . $icon, + 'width' => $width]), + ['title' => $title, + 'href' => $url, + 'target' => '_blank']); + } + + protected function _renderContent() { + return + $this->_iconLink('https://www.mybibapp.fr', + $this->_('Accéder à la présentation de MyBibApp'), + 'banner_alpha_1024.png', + 300) + . + $this->_iconLink('https://play.google.com/store/apps/details?id=fr.afi_sa.MyBibApp', + $this->_('Télécharger MyBibApp pour Google Android'), + 'mybibapp_android.png', + 150) + . + $this->_iconLink('https://apps.apple.com/fr/app/mybibapp/id1463572666', + $this->_('Télécharger MyBibApp pour Apple iOS'), + 'mybibapp_apple.png', + 150) + . + $this->_tag('div', + $this->_renderDescription()); + } + + + protected function _renderMyBibAppLink() { + return $this->_tag('a', + 'MyBibApp', + ['target' => '_blank', + 'href' => 'https://www.mybibapp.fr']); + } + + + + protected function _renderDescription() { + return + $this->_('%s, application mobile libre et gratuite, permet à vos abonnés d\'accéder aux services de votre réseau :', + $this->_renderMyBibAppLink()) + . + $this->_tag('ul', + implode( + array_map(function($content) { return $this->_tag('li', $content); }, + [ + $this->_('récupération de la liste de ses prêts et réservations'), + $this->_('gestion de plusieurs cartes et comptes (famille, école, ...) au sein d\'une même application'), + $this->_('accéder au site de la médiathèque automatiquement authentifié'), + $this->_('consulter notice et enrichissements (bande-annonce, pré-écoute, ...) d\'un document en scannant son identifiant'), + $this->_('... et plus encore !') + ]))) + . + $this->_tag('p', + $this->_tag('img', null, ['src' => URL_SHARED_IMG . '/buttons/bouton_vert.png']) + . $this->_('Votre portail est compatible !')) + . + $this->_tag('p', + $this->_('Pour référencer votre portail dans %s, ou pour toute information complémentaire, contactez-nous par courriel : ' + . + $this->_tag('a', + 'cial-bib@afi-sa.fr', + ['href' => 'mailto:cial-bib@afi-sa.fr?subject=[MyBibApp] ' . $this->_('Demande d\'informations')]), + $this->_renderMyBibAppLink())); + } +} \ No newline at end of file diff --git a/public/opac/images/mybibapp/banner_alpha_1024.png b/public/opac/images/mybibapp/banner_alpha_1024.png new file mode 100644 index 0000000000000000000000000000000000000000..09b3cefe2429baa3889d57b0fce664d2b6869e17 Binary files /dev/null and b/public/opac/images/mybibapp/banner_alpha_1024.png differ diff --git a/public/opac/images/mybibapp/mybibapp_android.png b/public/opac/images/mybibapp/mybibapp_android.png new file mode 100644 index 0000000000000000000000000000000000000000..c8a14ec0cff44ebe8e89f8392a23dade6abf1684 Binary files /dev/null and b/public/opac/images/mybibapp/mybibapp_android.png differ diff --git a/public/opac/images/mybibapp/mybibapp_apple.png b/public/opac/images/mybibapp/mybibapp_apple.png new file mode 100644 index 0000000000000000000000000000000000000000..4c6fc5a2466d56813e9ed39b5fe4f5c15be8dcc7 Binary files /dev/null and b/public/opac/images/mybibapp/mybibapp_apple.png differ diff --git a/tests/application/modules/admin/controllers/IndexControllerTest.php b/tests/application/modules/admin/controllers/IndexControllerTest.php index 5ec3832afc5018152934563ff01aad82df544b69..0686e77c24c6bc93839d6cead9ef93e8a4fe868b 100644 --- a/tests/application/modules/admin/controllers/IndexControllerTest.php +++ b/tests/application/modules/admin/controllers/IndexControllerTest.php @@ -41,6 +41,23 @@ abstract class Admin_IndexControllerTestCase extends Admin_AbstractControllerTes +class Admin_IndexControllerWithHTTPSTest extends Admin_IndexControllerTestCase { + /** @test */ + public function pageShouldDisplayMyBibAppTeaser() { + $_SERVER['HTTPS'] = 'on'; + $this->dispatch('/admin/index/index', true); + $this->assertXPath('//div[@id="mybibapp_teaser"]'); + } + + + public function tearDown() { + unset($_SERVER['HTTPS']); + parent::tearDown(); + } +} + + + class Admin_IndexControllerTest extends Admin_IndexControllerTestCase { public function setUp() { @@ -60,6 +77,12 @@ class Admin_IndexControllerTest extends Admin_IndexControllerTestCase { } + /** @test */ + public function withoutHTTPSShouldNotDisplayMyBibAppTeaser() { + $this->assertNotXPath('//div[@id="mybibapp_teaser"]'); + } + + /** @test */ public function fileBokeh74ShouldBeLoaded() { $this->assertXPath('//link[contains(@href, "bokeh74/global.css")]');