From 61581cee0cdf987d033d0dd0da0b4b0d14c5c795 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Tue, 11 Jun 2013 09:49:08 +0000 Subject: [PATCH] =?UTF-8?q?Vid=C3=A9os=20INA:=20adaptation=20du=20player?= =?UTF-8?q?=20=C3=A0=20la=20taille=20du=20bloc=20o=C3=B9=20il=20est=20ins?= =?UTF-8?q?=C3=A9r=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opac/controllers/NoticeajaxController.php | 45 ++++++++++++------- library/Class/NoticeHtml.php | 5 +-- public/opac/js/recherche.js | 8 ++-- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index cd927944a9a..bea61741177 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -326,27 +326,40 @@ class NoticeAjaxController extends Zend_Controller_Action { public function videosAction() { + $width = $this->_getParam('width', 500) - 8; //8px du skin de l'INA sur lequel on n'a pas la main + $height = (int)($width * 4/5); + if ($num_video = $this->_getParam("num_video", 0)) { $num_video = $num_video-1; $html.=$_SESSION["video_interview"][$num_video]["player"]; + $this->_sendResponse('<style>*{margin:0;padding:0}</style>'.$html); + return; } - else - { - unset($_SESSION["video_interview"]); - $notice=$this->notice->getNotice($this->id_notice,"JA"); - if(!trim($notice["A"])) - $html=$this->notice_html->getNonTrouve($this->view->_("Cette notice n'a pas d'auteur."),true); - else if($this->service_afi > "") - { - $args=array("titre"=>$notice["J"],"auteur" => $notice["A"]); - $data=Class_WebService_AllServices::runServiceAfiInterviews($args); - $source=$data["source"]; - $videos=$data["videos"]; - $_SESSION["video_interview"]=$videos; - $html=$this->notice_html->getInterviews($source,$videos); - } - else $html= $html=$this->notice_html->getNonTrouve($this->view->_("Service non disponible"),true); + + unset($_SESSION["video_interview"]); + $notice=$this->notice->getNotice($this->id_notice,"JA"); + if(!trim($notice["A"])) { + $html=$this->notice_html->getNonTrouve($this->view->_("Cette notice n'a pas d'auteur."),true); + $this->_sendResponse($html); + return; + } + + + if($this->service_afi > "") { + $args = ['titre' => $notice['J'], + 'auteur' => $notice['A'], + 'width' => $width, + 'height' => $height]; + $data = Class_WebService_AllServices::runServiceAfiInterviews($args); + $source = $data["source"]; + $videos = $data["videos"]; + $_SESSION["video_interview"]=$videos; + $html=$this->notice_html->getInterviews($source, $videos, $width, $height); + $this->_sendResponse($html); + return; } + + $html = $this->notice_html->getNonTrouve($this->view->_("Service non disponible"),true); $this->_sendResponse($html); } diff --git a/library/Class/NoticeHtml.php b/library/Class/NoticeHtml.php index 74b55e5d729..0c4ae100fe0 100644 --- a/library/Class/NoticeHtml.php +++ b/library/Class/NoticeHtml.php @@ -388,8 +388,7 @@ class Class_NoticeHtml { //------------------------------------------------------------------------------------------------------ // Interviews //------------------------------------------------------------------------------------------------------ - public function getInterviews($source,$videos) - { + public function getInterviews($source, $videos, $width, $height) { if(!$videos) return $html.$this->getNonTrouve($this->_translate->_("Aucune vidéo n'a été trouvée."),true); @@ -418,7 +417,7 @@ class Class_NoticeHtml { $source); $html.='<tr><td align="left" colspan="2">'.$video["contenu"].'</td></tr>'; $html.='<tr><td colspan="2"><div align="center" style="margin-bottom:10px">'; - $html.='<iframe id="interview_'.$num.'" style="display:'.$display.'" height="400" frameborder="0" width="500" scrolling="no" src="'.$src.'"></iframe>'; + $html.='<iframe id="interview_'.$num.'" style="display:'.$display.'" height="'.$height.'" frameborder="0" width="'.$width.'" scrolling="no" src="'.$src.'"></iframe>'; $html.='</div></td></tr>'; } $html.='</table>'; diff --git a/public/opac/js/recherche.js b/public/opac/js/recherche.js index e2e4eb8fc85..b17319b163b 100644 --- a/public/opac/js/recherche.js +++ b/public/opac/js/recherche.js @@ -80,8 +80,7 @@ if (undefined == window.blocNoticeAfterLoad) window.blocNoticeAfterLoad = function (info, isbn, target) {}; -function infos_bloc(sIdBloc,sIsbn,sType,sCherche,nNiveau,nPage, sUrl) -{ +function infos_bloc(sIdBloc,sIsbn,sType,sCherche,nNiveau,nPage, sUrl) { if(sIdBloc.substr(0,1) == "I" ) sIdBloc=sIdBloc.substr(1,sIdBloc.length); oImg=document.getElementById("I" + sIdBloc); oContenu=document.getElementById(sIdBloc + "_contenu"); @@ -108,8 +107,11 @@ function infos_bloc(sIdBloc,sIsbn,sType,sCherche,nNiveau,nPage, sUrl) if(sCherche) sUrl = sUrl + '&cherche=' + sCherche; var bloc = $('#'+sIdBloc + '_contenu'); + var width = bloc.width(); + sUrl = sUrl + '&width='+width; + bloc - .css('max-width', bloc.parent().width()+'px') + .css('max-width', width+'px') .load(sUrl, function() { blocNoticeAfterLoad(sType, sIsbn, bloc); }); } -- GitLab