diff --git a/application/modules/admin/controllers/SitoController.php b/application/modules/admin/controllers/SitoController.php index 21bb76910ce6f60bac410ccfc41752d6cfc08e75..d8f5831db9936a50816d98e7e9e280e248e0aa61 100644 --- a/application/modules/admin/controllers/SitoController.php +++ b/application/modules/admin/controllers/SitoController.php @@ -75,10 +75,10 @@ class Admin_SitoController extends ZendAfi_Controller_Action { $album = Class_Album::newInstance(['type_doc_id' => Class_TypeDoc::WEBSITE, 'categorie' => $category]); - $album->setTitre($dom->queryXpath('//head/title')->current()->textContent); + $album->setTitre(trim($dom->queryXpath('//head/title')->current()->textContent)); - $description_node = $dom->queryXpath('//head/meta[@name="description"]')->current(); - $album->setDescription($description_node->getAttribute('content')); + if ($description_node = $dom->queryXpath('//head/meta[@name="description"]')->current()) + $album->setDescription($description_node->getAttribute('content')); $resource = Class_AlbumRessource::newInstance(['url' => $url, 'titre' => $album->getTitre()]); @@ -87,10 +87,11 @@ class Admin_SitoController extends ZendAfi_Controller_Action { $thumbnailer = (new Class_WebService_WebSiteThumbnail()); $poster_name = $thumbnailer->fileNameFromUrl($url); - $poster_path = $resource->getThumbnailPath(); + $poster_path = $resource->getPosterPath(); $resource->getFolderManager()->ensure($poster_path); $thumbnailer->getThumbnailer()->fetchUrlToFile($url, $poster_path . $poster_name); $resource->setPoster($poster_name); + $resource->createThumbnail(); return $album; } diff --git a/library/ZendAfi/View/Helper/TagWebSite.php b/library/ZendAfi/View/Helper/TagWebSite.php index e509f487337634f472c9c9735103455a4a495944..8ffbd21eb90311907c8fdd17fd8947379ba47416 100644 --- a/library/ZendAfi/View/Helper/TagWebSite.php +++ b/library/ZendAfi/View/Helper/TagWebSite.php @@ -53,7 +53,7 @@ class ZendAfi_View_Helper_TagWebSite extends ZendAfi_View_Helper_BaseHelper { '', ['src' => $site->getPosterUrl(), 'title' => $this->_('Ouvrir le site dans un nouvel onglet'), - 'style' => 'width:100%']); + 'style' => 'max-width: 100%']); } } diff --git a/tests/application/modules/admin/controllers/SitothequeControllerTest.php b/tests/application/modules/admin/controllers/SitothequeControllerTest.php index 2d144df706f490b75cebad537fdc8d5ef578288e..fc77994e1b02692ea350a802c122628f6fef4a20 100644 --- a/tests/application/modules/admin/controllers/SitothequeControllerTest.php +++ b/tests/application/modules/admin/controllers/SitothequeControllerTest.php @@ -607,7 +607,7 @@ class SitothequeControllerDeleteCategorieInformationsTest extends SitothequeCont -class SitothequeControllerImportFromUrlTest extends AbstractControllerTestCase { +class SitothequeControllerImportCnedFromUrlTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true, $_cned; @@ -635,7 +635,7 @@ class SitothequeControllerImportFromUrlTest extends AbstractControllerTestCase { /** @test */ - public function albumCategorieShouldBeWebsite() { + public function albumCategorieShouldBeSitotheque() { $this->assertEquals('Sites web', $this->_cned->getCategorie()->getLibelle()); } @@ -666,4 +666,27 @@ class SitothequeControllerImportFromUrlTest extends AbstractControllerTestCase { } + +class SitothequeControllerImportEnssibFromUrlTest extends AbstractControllerTestCase { + protected + $_storm_default_to_volatile = true, + $_enssib; + + public function setUp() { + parent::setUp(); + $this->postDispatch('/admin/sito/create', + ['url' => 'http://www.enssib.fr']); + + $this->_enssib = Class_Album::find(1); + } + + + /** @test */ + public function titleShouldBeEnssib() { + $this->assertEquals('Accueil | Enssib', + $this->_enssib->getTitre()); + } +} + + ?> \ No newline at end of file