From e5c6708fa331724ba9b911081d95cf1412fc41e6 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Thu, 12 Nov 2015 18:33:36 +0100 Subject: [PATCH] rel #32494: fix links dont work on iframes --- library/ZendAfi/View/Helper/RenderAlbum.php | 15 ++++--- library/ZendAfi/View/Helper/TagWebSite.php | 46 +++++++++++---------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/library/ZendAfi/View/Helper/RenderAlbum.php b/library/ZendAfi/View/Helper/RenderAlbum.php index 9f60f1a69ff..c96b359367d 100644 --- a/library/ZendAfi/View/Helper/RenderAlbum.php +++ b/library/ZendAfi/View/Helper/RenderAlbum.php @@ -19,16 +19,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_View_Helper_RenderAlbum extends Zend_View_Helper_HtmlElement { +class ZendAfi_View_Helper_RenderAlbum extends ZendAfi_View_Helper_BaseHelper { public function renderAlbum($album) { if (!$album) return ''; - $actions = '<div class="actions">' - . $this->view->tagEditAlbumMedia($album) - . $this->view->tagEditAlbum($album) - . '</div>'; - return $actions . sprintf('<div id="resnum">%s</div>', $this->renderAlbumHelper($album)); + $actions = $this->_tag('div', + $this->view->tagEditAlbumMedia($album) + . $this->view->tagEditAlbum($album), + ['class' => 'actions']); + + return $actions + . $this->_tag('div', $this->renderAlbumHelper($album), + ['id' => 'resnum']); } diff --git a/library/ZendAfi/View/Helper/TagWebSite.php b/library/ZendAfi/View/Helper/TagWebSite.php index 8ffbd21eb90..79353735a1f 100644 --- a/library/ZendAfi/View/Helper/TagWebSite.php +++ b/library/ZendAfi/View/Helper/TagWebSite.php @@ -31,30 +31,34 @@ class ZendAfi_View_Helper_TagWebSite extends ZendAfi_View_Helper_BaseHelper { public function renderSite($site) { return $this->_tag('section', - $this->_tag('h3', $site->getTitre()). - $this->_tag('p', $site->getDescription()). - $this->_tag('a', - $this->_('Ouvrir le site dans un nouvel onglet') - . $this->_previewSite($site), - ['href' => $site->getUrl(), - 'target' => '_blank'])); + $this->_tag('h3', $site->getTitre()) + . $this->_tag('p', $site->getDescription()) + . $this->_renderLink($site)); + } + + + protected function _renderLink($site) { + $label = $this->_('Ouvrir le site dans un nouvel onglet'); + $options = ['href' => $site->getUrl(), + 'target' => '_blank', + 'title' => $label]; + + if (!$preview = $this->_previewSite($site)) { + $preview = $label; + unset($options['title']); + } + + return $this->_tag('a', $preview, $options); } protected function _previewSite($site) { - if (!$poster = $site->getPoster()) - return $this->_tag('iframe', - '', - ['src' => $site->getUrl(), - 'style' => 'transform: scale(0.5); width:100%', - 'onclick' => 'window.open($(this).src)']); - - return $this->_tag('img', - '', - ['src' => $site->getPosterUrl(), - 'title' => $this->_('Ouvrir le site dans un nouvel onglet'), - 'style' => 'max-width: 100%']); + return ($poster = $site->getPoster()) + ? $this->_tag('img', null, + ['src' => $site->getPosterUrl(), + 'alt' => '', + 'style' => 'max-width: 100%']) + + : ''; } } - -?> \ No newline at end of file -- GitLab