diff --git a/VERSIONS_HOTLINE/121711 b/VERSIONS_HOTLINE/121711 new file mode 100644 index 0000000000000000000000000000000000000000..cddcb6e458518aef8545060e4cde430760fe5937 --- /dev/null +++ b/VERSIONS_HOTLINE/121711 @@ -0,0 +1 @@ + - ticket #121711 : Boite Kiosque : Correction des urls des iframes (erreur HTTP 414) \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Kiosque.php b/library/ZendAfi/View/Helper/Accueil/Kiosque.php index 691c6832e88e3a5326b998fa31271c11b3be422a..89e05a11f1085c87c246191d3ca1bf4eb78952ac 100644 --- a/library/ZendAfi/View/Helper/Accueil/Kiosque.php +++ b/library/ZendAfi/View/Helper/Accueil/Kiosque.php @@ -232,9 +232,7 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba $iframe = $this->view->getHelper('IframeContainer'); $iframe->iframeContainer('100%', $hauteur, - array_merge(['controller' => $controler, - 'action' => $action], - $this->preferences), + ['controller' => $controler, 'action' => $action], $this->preferences); $embed_button = $this->view->tag('span', '<>', ['class' => 'embedcode-button']); diff --git a/library/ZendAfi/View/Helper/IframeContainer.php b/library/ZendAfi/View/Helper/IframeContainer.php index c54576baf1bb68af063a9530d8d60c460263a26d..5dd6f39732bc2e8efb4ba8aa67f29d6e5582b792 100644 --- a/library/ZendAfi/View/Helper/IframeContainer.php +++ b/library/ZendAfi/View/Helper/IframeContainer.php @@ -26,39 +26,36 @@ class ZendAfi_View_Helper_IframeContainer extends ZendAfi_View_Helper_BaseHelper protected $_url; - public function iframeContainer($largeur, $hauteur, $url_array, $preferences = []) { - if ($preferences) { - unset($preferences['preferences']); - foreach($preferences as $clef => $valeur) - $this->_src_args[$clef] = urlencode($valeur); - } - unset($url_array['preferences']); - $this->_url = $this->view->url($url_array, null, true); - + public function iframeContainer($largeur, $hauteur, $url_array, $preferences=[]) { $this->_params = ['height' => $hauteur, 'style' => 'border: 0px; overflow:hidden', 'width' => $largeur, - 'scrolling' => 'no', - 'title' => (isset($preferences['titre'])) ? $preferences['titre'] : 'iframe fu' ]; + 'scrolling' => 'no']; + + $this->_params['title'] = isset($preferences['titre']) + ? $preferences['titre'] + : 'iframe fu'; + + unset($url_array['preferences']); + $url = $this->view->absoluteUrl($url_array, null, true); + if ($args = $this->_argsFrom($preferences)) + $url .= '?' . http_build_query($args); + $this->_params['src'] = $url; + return $this->getHtml(); } - public function setCacheKey($key) { - $this->_src_args['cachekey'] = $key; + protected function _argsFrom($preferences) { + if (!$preferences) + return []; + + unset($preferences['preferences']); + return $preferences; } public function getHtml() { - $src = $this->view->absoluteUrl($this->_url); - if ($this->_src_args) - $src .= '?'.http_build_query($this->_src_args, '', '&'); - $this->_params['src'] = $src; - - $iframe_attributes = ''; - foreach($this->_params as $name => $value) - $iframe_attributes .= " $name='$value' "; - - return sprintf("<iframe %s> </iframe>", $iframe_attributes); + return $this->_tag('iframe', ' ', $this->_params); } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/ZoneControllerTest.php b/tests/application/modules/admin/controllers/ZoneControllerTest.php index ab8727b47a8ec210b536702aea3772142c0401b3..a6dd5f49d7176b93e2ba53e0431e48dcd417eb60 100644 --- a/tests/application/modules/admin/controllers/ZoneControllerTest.php +++ b/tests/application/modules/admin/controllers/ZoneControllerTest.php @@ -248,7 +248,7 @@ class ZoneControllerEditAnnecyTest extends ZoneControllerTestCase { /** @test */ public function iframeTagUploadShouldHaveFilenameBassinAnnecy() { - $this->assertXPath('//iframe[contains(@src, "filename=bassin%2Bannecy.jpg&")]'); + $this->assertXPath('//iframe[contains(@src, "filename=bassin+annecy.jpg&")]'); } } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index 6cd875302c985c684ef07e37dc42fe739926c5c0..51d1f79d63344343b63ad97b6daccfa4a4a8edeb 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -2043,7 +2043,7 @@ class CmsControllerWithArticleWithCubeKioskTest extends CmsControllerWithArticle /** @test */ public function pageShouldContainsIFrameForCubeKiosque() { - $this->assertXPath( '//iframe[contains(@src, "style_liste/cube")][contains(@src, "id_catalogue/5")]'); + $this->assertXPath( '//iframe[contains(@src, "style_liste=cube")][contains(@src, "id_catalogue=5")]'); } diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index c765327b5792dc527caa91cde1e296bf0ae9ddd6..65afb9a4bd6d3a8705dd78ebc4a4d56e242b2f4c 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -2858,7 +2858,7 @@ class NoticeAjaxControllerWithKiosqueInResumeTest extends AbstractControllerTest /** @test */ public function pageShouldContainsIFrame() { $this->dispatch('/noticeajax/detail/id/1', true); - $this->assertXPath( '//iframe[contains(@src, "style_liste/jcarousel")]'); + $this->assertXPath( '//iframe[contains(@src, "style_liste=jcarousel")]'); } diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index e5c86a7f4667693be889bf37c9511b18cd882c93..536b4bd457d6e44dc6ee01a5920070543046485f 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -1177,7 +1177,7 @@ class ProfilOptionsControllerPageJeuxViewModuleCritiquesTest extends ProfilOptio /** @test */ public function iframeKiosqueUrlShouldHaveIdModuleSeven() { - $this->assertXPath('//iframe[contains(@src, "/id_module/7/id_profil/12/vue/cube")][contains(@title, "kiosque")]'); + $this->assertXPath('//iframe[contains(@src, "id_module=7&id_profil=12&vue=cube")][contains(@title, "kiosque")]'); } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php index e320db96f6ac192b737342dbf66e925780a896ce..867eba5f404bbee83855a906df3c189bc098c497 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/KiosqueTest.php @@ -581,7 +581,7 @@ class ZendAfi_View_Helper_Accueil_KiosqueProfileRedirectTest extends ViewHelperT } - protected function getPreferencesWith($display_mode, $id_profil) { + protected function getPreferencesWith($display_mode, $id_profil='142') { $result = $this->getPreferences(); $result['preferences'] = ['style_liste' => $display_mode, 'profil_redirect' => $id_profil]; @@ -590,17 +590,31 @@ class ZendAfi_View_Helper_Accueil_KiosqueProfileRedirectTest extends ViewHelperT public function datas() { + $iframe_xpath = '//iframe' + . '[contains(@src, "id_profil=142")]' + . '[contains(@src, "id_module=2-3")]' + . '[not(contains(@src, "id_module/2-3"))]'; // see #121711 + return - [[$this->getPreferencesWith('mur','142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], - [$this->getPreferencesWith('vignettes', '142'), '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], - [$this->getPreferencesWith('chrono', '142'), '//script[contains(., "id_profil\\/142")][contains(., "id_module\\/2-3")]'], - [$this->getPreferencesWith('slide_show', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")][contains(@title, "Boite kiosque")]'], - [$this->getPreferencesWith('protoflow', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], - [$this->getPreferencesWith('cube', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], - [$this->getPreferencesWith('diaporama', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], - [$this->getPreferencesWith('jcarousel', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], - [$this->getPreferencesWith('mycarousel_horizontal', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]'], - [$this->getPreferencesWith('mycarousel_vertical', '142'), '//iframe[contains(@src, "id_profil/142")][contains(@src, "id_module/2-3")]']]; + [[$this->getPreferencesWith('mur'), + '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], + + [$this->getPreferencesWith('vignettes'), + '//a[contains(@href, "id_profil/142")][contains(@href, "id_module/2-3")]'], + + [$this->getPreferencesWith('chrono'), + '//script[contains(., "id_profil\\/142")][contains(., "id_module\\/2-3")]'], + + [$this->getPreferencesWith('slide_show'), + $iframe_xpath + . '[contains(@title, "Boite kiosque")]'], + + [$this->getPreferencesWith('protoflow'), $iframe_xpath], + [$this->getPreferencesWith('cube'), $iframe_xpath], + [$this->getPreferencesWith('diaporama'), $iframe_xpath], + [$this->getPreferencesWith('jcarousel'), $iframe_xpath], + [$this->getPreferencesWith('mycarousel_horizontal'), $iframe_xpath], + [$this->getPreferencesWith('mycarousel_vertical'), $iframe_xpath]]; }