Skip to content
Snippets Groups Projects
Commit 13bb60bb authored by Laurent's avatar Laurent
Browse files

dev #65756 Omeka : prepare album render and extract iiif manifest uri

parent 521ec0b5
3 merge requests!2409Master,!2406Dev#65756 s91 afficher le media ou le player omeka dans bokeh base de demo et projets a venir,!2402Dev#65756 s91 afficher le media ou le player omeka dans bokeh base de demo et projets a venir
Pipeline #2834 failed with stage
in 21 minutes and 31 seconds
......@@ -56,7 +56,7 @@ class Class_WebService_OAI extends Class_WebService_Abstract {
public function __construct() {
$this->parser = new Class_WebService_OAI_DublinCoreParser_ForRessourceNumerique();
$this->parser = new Class_WebService_OAI_DublinCoreParser_ForRessourceNumerique();
}
......
......@@ -42,7 +42,8 @@ class Class_WebService_OAI_DublinCoreParser extends Class_WebService_OAI_ParserA
public function newRecord($attributes) {
return $this->_record = ['id_oai' => '',
return $this->_record = ['record_id',
'id_oai' => '',
'titre' => '',
'date' => '',
'auteur' => [],
......
......@@ -45,12 +45,12 @@ class Omeka_Config extends Class_DigitalResource_Config {
public function isEnabled() {
return (new ZendAfi_Validate_Url())->isValid($this->getOAIUrl());
return (new ZendAfi_Validate_Url())->isValid($this->getRootUrl());
}
public function getOAIUrl() {
return $this->getAdminVar('OAI_URL');
public function getRootUrl() {
return $this->getAdminVar('ROOT_URL');
}
......@@ -60,8 +60,10 @@ class Omeka_Config extends Class_DigitalResource_Config {
public function newOAIClient() {
$parser_class = $this->withNameSpace('Service_Parser');
return (new Class_WebService_OAI())
->setOAIHandler($this->getOAIUrl())
->setOAIHandler($this->getRootUrl() . '/oai-pmh-repository/request')
->setParser(new $parser_class)
->setNumericResourceClass($this->withNameSpace('Service_Resource'));
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Omeka_Service_Parser extends Class_WebService_OAI_DublinCoreParser_ForRessourceNumerique {
public function endIdentifier($data) {
$this->_record['id_oai'] = $data;
}
public function enddc_identifier($data) {}
}
?>
\ No newline at end of file
......@@ -38,12 +38,23 @@ class Omeka_Service_Resource extends Class_WebService_BibNumerique_RessourceNume
$responsibility));
}
public function getBaseUrl() {
return Omeka_Config::getInstance()->getRootUrl();
}
protected function getTypeDoc() {
return Omeka_Config::getInstance()->getDocType();
}
public function fillAlbum($album) {
/* $album->beCyberlibris()
->setDescription($this->getDescription())
->setEditeur($this->getEditeur());*/
public function getRessourceCategorieLibelle() {
return Omeka_Config::getInstance()->getDocTypeLabel();
}
public function fillAlbum($album) {
$album->setTypeDocId($this->getTypeDoc());
return $album;
}
......
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Omeka_View_Helper_Album extends ZendAfi_View_Helper_TagRessourceNumerique {
protected $_album;
public function album($album) {
$this->_album = $album;
return $this->view->tag('div',
'',
['data-uri' => $this->_manifestURI($album)]);
}
protected function _manifestURI($album) {
return $album->getUrlOrigine() . '/iiif/' . $album->getIdOrigine() . '/manifest';
}
protected function hasRightAccesRessourcesNumeriques($user) {
return true;
}
}
\ No newline at end of file
......@@ -23,8 +23,8 @@ class OmekaFixtures {
use Storm_Test_THelpers;
public function prepare() {
Class_AdminVar::set('Omeka_OAI_URL',
'http://omeka-demo.biblibre.com/oai-pmh-repository/request');
Class_AdminVar::set('Omeka_ROOT_URL',
'http://omeka-demo.biblibre.com');
$http_client = $this->mock()
->whenCalled('open_url')
......@@ -33,9 +33,9 @@ class OmekaFixtures {
Omeka_Service::setDefaultHttpClient($http_client);
return new Omeka_Service(
new Omeka_Config(
new Class_DigitalResource_Wrapper(Class_DigitalResource::getInstance(),
'Omeka')));
new Omeka_Config(
new Class_DigitalResource_Wrapper(Class_DigitalResource::getInstance(),
'Omeka')));
}
}
......@@ -73,7 +73,42 @@ class OmekaHarvestedTest extends AbstractControllerTestCase {
/** @test */
public function alpesRecordAuthorResponsibilityShouldBeTextAuthor() {
$this->assertEquals('Auteur du texte',
Class_Album::find(8)->getAuthors()[0]->getResponsibility());
$this->_alpes_record->getAlbum()->getAuthors()[0]->getResponsibility());
}
/** @test */
public function alpesRecordAlbumCategoryShouldBeOmeka() {
$this->assertEquals('Ressource numérique Omeka', Class_Album::find(8)->getCategoryLabel());
}
/** @test */
public function alpesRecordDocTypeShouldBeOmeka() {
$this->assertEquals('Ressource numérique Omeka',
$this->_alpes_record->getTypeDocLabel());
}
/** @test */
public function alpesRecordIdOriginShouldBe668() {
$this->assertEquals('668',
$this->_alpes_record->getAlbum()->getIdOrigine());
}
/** @test */
public function alpesRecordUrlOriginShouldBeOmekaDotDemoDotBiblibreDotCom() {
$this->assertEquals('http://omeka-demo.biblibre.com',
$this->_alpes_record->getAlbum()->getUrlOrigine());
}
/** @test */
public function alpersRecordPreviewShouldUseUniversalIIIFPlayer() {
$this->dispatch('/noticeajax/resnumeriques/id/1', true);
$this->assertXPath('//div[@data-uri="http://omeka-demo.biblibre.com/iiif/668/manifest"]');
}
}
?>
\ 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