Commit 3a81a574 authored by Laurent's avatar Laurent
Browse files

hotline #15563 Slideshow

Add height parameter to album in diaporama mode to specify default
heights for public rendering
parent 1ed0ebc1
- ticket #15563: Bibliothèque numérique, affichage en diaporama: ajout d'un paramètre pour spécifier la hauteur de boîte par défaut sur l'affichage public
04/08/2014 - v6.49.0
- ticket #12992: Champs personnalisés
......
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
protected $_default_preferences = array(
......@@ -41,7 +41,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
if (null == $preferences)
$this->_preferences = $this->_default_preferences;
else
$this->_preferences = array_merge($this->_default_preferences,
$this->_preferences = array_merge($this->_default_preferences,
$preferences);
return $this;
}
......@@ -57,9 +57,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
if (!$album)
return '';
if (!is_array($preferences))
$preferences = [];
return $this
->setAlbum($album)
->setPreferences($preferences)
->setPreferences(array_merge(['op_hauteur_boite' => $album->getOpHauteurBoite()],
$preferences))
->renderSlideShowScripts()
->renderAlbumMedias();
}
......@@ -84,7 +88,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
* @return ZendAfi_View_Helper_Accueil_BibNumerique
*/
public function renderSlideShowScriptsOn($script_loader, $selector, $options=null) {
$cycle_options = array('pause' => 1,
$cycle_options = array('pause' => 1,
'fx' => 'fade',
'animIn' => array('opacity' => 1),
'animOut' => array('opacity' => 0),
......@@ -106,13 +110,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
var container = $(\'%1$s\').parent();
container.addClass(\'slideshow\');
container.prepend(\'<div class="controls"><a href="#"></a><a href="#"></a></div>\');
container.find(\'.controls a:first-child\').click(
function(event){
event.preventDefault();
container.find(\'.controls a:first-child\').click(
function(event){
event.preventDefault();
$(\'%1$s\').cycle(\'prev\') } );
container.find(\'.controls a + a\').click(
function(event){
event.preventDefault();
event.preventDefault();
$(\'%1$s\').cycle(\'next\') } );
container.find(\'.controls a\').css(\'top\', (container.parent().height()/3)+\'px\')',
$selector,
......@@ -133,7 +137,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
'<h2></h2>'.
'<div class="medias">%s</div>'.
'<p></p>'.
'</div>',
'</div>',
$this->_album->getId(),
$this->_renderAllMedias($medias));
return $html;
......@@ -145,7 +149,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
*/
protected function _renderAllMedias($medias) {
$html = '';
foreach ($medias as $media)
foreach ($medias as $media)
$html .= $this->_renderMedia($media);
return $html;
}
......@@ -169,18 +173,18 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
null,
true);
$content = $this->view->tagImg($url_media,
array('style' => sprintf('width: %spx',
$content = $this->view->tagImg($url_media,
array('style' => sprintf('width: %spx',
$this->_preferences['op_largeur_img']),
'title' => htmlspecialchars($media->getTitre()),
'alt' => htmlspecialchars($media->getDescription())));
$datas = array('titre' => $media->getTitre(),
'content' => $content,
$datas = array('titre' => $media->getTitre(),
'content' => $content,
'description' => $media->getDescription());
if ($media->hasLinkTo()) {
foreach ($datas as $idx => $data)
$datas[$idx] = sprintf('<a href="%s">%s</a>',
$datas[$idx] = sprintf('<a href="%s">%s</a>',
$media->getLinkTo(),
$data);
} else {
......@@ -194,13 +198,13 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement {
$content);
}
$content = sprintf('<h2>%s</h2>'.
'%s'.
'<p>%s</p>',
$datas['titre'],
$datas['content'],
$datas['content'],
$datas['description']);
return sprintf('<div>%s</div>', $content);
......
......@@ -908,6 +908,12 @@ form#import_ead dl {
}
#resnum .slideshow {
background-color: black;
overflow: hidden;
}
.tree.thumbwall{
padding-left: 25px;
}
......
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'AbstractControllerTestCase.php';
......@@ -45,22 +45,23 @@ abstract class AbstractBibNumeriqueControllerAlbumActionPremierVolumeTestCase ex
public function setUp() {
parent::setUp();
$this->_album = $this->fixture('Class_Album',
$this->_album = $this->fixture('Class_Album',
['id' => 999,
'titre' => 'Premier volume',
'description' => "On ne peut que reconnaitre le talent de l'artiste !",
'thumbnail_width' => 200,
'thumbnail_left_page_crop_right' => 10,
'thumbnail_right_page_crop_top' => 5,
'op_hauteur_boite' => 500,
'id_origine' => 'DC23',
'pdf' => 'volume1.pdf',
'notice' => $this->fixture('Class_Notice', ['id' => 123])]);
$this->_album
->beDiaporama()
->setCategorie($this->fixture('Class_AlbumCategorie',
['id' => 2,
->setCategorie($this->fixture('Class_AlbumCategorie',
['id' => 2,
'libelle' => 'Les enluminures',
'parent_categorie' => $this->fixture('Class_AlbumCategorie',
['id' => 3,
......@@ -77,7 +78,7 @@ abstract class AbstractBibNumeriqueControllerAlbumActionPremierVolumeTestCase ex
'image' => $im,
'folio' => '1R3',
'album' => $this->_album]),
$this->fixture('Class_AlbumRessource', ['id' => 2,
'fichier' => '2.jpg',
'album' => $this->_album,
......@@ -184,7 +185,7 @@ class BibNumeriqueControllerAlbumPremierVolumeTestToJSON extends AbstractBibNume
/** @test */
function secondRessourceTitreShouldBeProcedureDeNumerisation() {
$this->assertEquals('Procedure de numerisation', $this->json->album->ressources[1]->titre);
}
......@@ -363,7 +364,7 @@ class BibNumeriqueControllerBookletTest extends AbstractBibNumeriqueControllerAl
/** @test */
function pageShouldContainsCodeToOpenBooklet() {
$this->assertXPathContentContains('//script',
$this->assertXPathContentContains('//script',
"smalltalk.BibNumAlbum._load_in_scriptsRoot_('/bib-numerique/album/id/999.json', '#booklet_999', '" . BASE_URL . "/amber/afi/souvigny/')",
$this->_response->getBody());
}
......@@ -376,7 +377,7 @@ class BibNumeriqueControllerViewAlbumActionPremierVolumeTest extends AbstractBib
public function setUp() {
parent::setUp();
Class_Profil::getCurrentProfil()->setSkin('original');
$this->dispatch('/opac/bib-numerique/view-album/id/999');
$this->dispatch('/opac/bib-numerique/view-album/id/999', true);
}
......@@ -404,6 +405,12 @@ class BibNumeriqueControllerViewAlbumActionPremierVolumeTest extends AbstractBib
}
/** @test */
public function hauteurBoiteShouldBeSetTo500() {
$this->assertXPathContentContains('//script', '"height":"500"');
}
/** @test */
public function viewerScriptShouldBePresent() {
$this->assertXPath('//script[contains(@src, "prettyPhoto.js")]');
......@@ -443,7 +450,7 @@ class BibNumeriqueControllerViewCategorieActionTest extends AbstractControllerTe
class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_AlbumCategorie::getLoader()
->newInstanceWithId(2)
->setLibelle('Les enluminures')
......@@ -455,7 +462,7 @@ class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends Abstra
->setTitre('Premier volume')
->setFichier('999.jpg')
->setDescription('On ne peut que reconnaitre le talent de l\'artiste !')));
$this->dispatch('/opac/bib-numerique/view-categorie/id/2');
}
......@@ -490,7 +497,7 @@ class BibNumeriqueControllerViewCategorieActionLesEnluminuresTest extends Abstra
abstract class BibNumeriqueControllerBibleDeSouvignyTestCase extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
Class_AlbumCategorie::getLoader()
->newInstanceWithId(3)
->setLibelle('La bible de souvigny')
......@@ -540,7 +547,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo
parent::setUp();
$this->_xpath = new Storm_Test_XPathXML();
$album = Class_Album::newInstanceWithId(999)
->beDiaporama()
->setTitre('Plein de medias')
......@@ -565,7 +572,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo
->setTitre('Emilie jolie')
->setOrdre(1)
->setPoster('mimi_jolie.png'),
Class_AlbumRessource::newInstanceWithId(4)
->setFichier('dark_night.mp4')
->setTitre('Batman Dark Knight')
......@@ -596,11 +603,11 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo
->setTitre('Iron Maiden: "Moonchild" live')
->setOrdre(6)
->setPoster('moonchild.jpg'),
Class_AlbumRessource::newInstanceWithId(9)
->setFichier('the_prophecy.mp3')
->setOrdre(7)]);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie')
->whenCalled('findAllBy')
->answers([])
......@@ -618,7 +625,7 @@ abstract class BibNumeriqueControllerAlbumMultiMediasTestCase extends AbstractCo
->with(['cat_id'=>'33'])
->answers([$album]);
}
}
......@@ -632,7 +639,7 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl
$this->dispatch('/opac/bib-numerique/album-xspf-playlist/id/999.xspf', true);
}
/** @test */
public function headerShouldContainsContentTypeXspf() {
$this->assertHeaderContains('Content-Type', 'application/xspf+xml');
......@@ -643,7 +650,7 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl
public function headerShouldContainsContentDispositionAttachment() {
$this->assertHeaderContains('Content-Disposition', 'attachment');
}
/** @test */
public function xmlVersionShouldOneDotZero() {
......@@ -659,39 +666,39 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl
/** @test */
public function firstTrackTitleShouldBeMimiJolie() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
'Emilie jolie');
}
/** @test */
public function firstTrackImageShouldBeMimiJolieDotPng() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:image',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:image',
'http://localhost' . BASE_URL . '/userfiles/album/999/thumbs/media/mimi_jolie.png');
}
/** @test */
public function firstTrackLocationShouldBeMimiJolieDotMp3() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
'http://localhost' . BASE_URL . '/bib-numerique/play-ressource/id/6.mp3');
}
/** @test */
public function secondTrackTitleShouldBeBatmanDarkKnight() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
'Batman Dark Knight');
}
/** @test */
public function thirdTrackLocationShouldBeTotaleClipsDotCom() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
'http://localhost' . BASE_URL . '/bib-numerique/play-ressource/id/5.mp4');
}
......@@ -699,16 +706,16 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl
/** @test */
public function fourthTrackLocationShouldBeUrlEncoded() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
'play-ressource/id/2.mp3');
}
/** @test */
public function seventhTrackTitleShouldBeTheProphecy() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:title',
'The prophecy');
}
......@@ -716,8 +723,8 @@ class BibNumeriqueControllerAlbumMultiMediasXSPFTest extends BibNumeriqueControl
/** @test */
public function vimeoTrackLocationShouldBeOriginalUrl() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//xspf:playlist/xspf:trackList/xspf:track/xspf:location',
'https://vimeo.com/43395780');
}
}
......@@ -755,7 +762,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll
/** @test */
public function titleShouldBePleinDeMedias() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//channel/title',
'Plein de medias');
}
......@@ -763,7 +770,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll
/** @test */
public function itunesImageShouldBeNoticeThumbnail() {
$this->_xpath->assertXPath($this->_response->getBody(),
$this->_xpath->assertXPath($this->_response->getBody(),
'//channel/itunes:image[@href="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/ido/A888"]');
}
......@@ -792,7 +799,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll
}
/** @test */
public function pubDateShouldBeFri17Feb2012() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
......@@ -902,13 +909,13 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu
}
/**
* @test
/**
* @test
* @depends forRessourceFiveShouldRedirectToTotaleClipsDotCom
*/
public function forRessourceFiveAnalyticsTrackerShouldHaveReceivedPlayEvent($client) {
$this->assertEquals(['bib-numerique',
'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/5.mp3/ido/A888/folio/5"',
$this->assertEquals(['bib-numerique',
'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/5.mp3/ido/A888/folio/5"',
5],
$client->getAttributesForLastCallOn('trackEvent'));
}
......@@ -921,13 +928,13 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu
}
/**
* @test
/**
* @test
*/
public function forRessourceMoonchildAnalyticsTrackerShouldEscapeQuotes() {
$this->dispatch('/opac/bib-numerique/play-ressource/id/8.mp3', true);
$this->assertEquals(['bib-numerique',
'lecture',
$this->assertEquals(['bib-numerique',
'lecture',
'"titre: Iron Maiden: \"Moonchild\" live","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 6","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/8.mp3/ido/A888/folio/moonchild"',
8],
$this->_web_analytics_client->getAttributesForLastCallOn('trackEvent'));
......@@ -938,7 +945,7 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu
class BibNumeriqueControllerFullScreenEpubTest extends BibNumeriqueControllerAlbumMultiMediasTestCase {
protected
protected
$_path_epub_temp;
public function setUp() {
......
Markdown is supported
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