Skip to content
Snippets Groups Projects
Commit e5c6708f authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

rel #32494: fix links dont work on iframes

parent cd8e8c60
6 merge requests!1553Master,!1502Master,!1501Stable,!1289Master,!1286Dev#32494 sitotheque utiliser l interface album pour creer une sitotheque,!1269Dev#32494 sitotheque utiliser l interface album pour creer une sitotheque
......@@ -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']);
}
......
......@@ -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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment