diff --git a/FEATURES/71694 b/FEATURES/71694 new file mode 100644 index 0000000000000000000000000000000000000000..c69227f426896dca8fc7178280529304b0124caf --- /dev/null +++ b/FEATURES/71694 @@ -0,0 +1,10 @@ + '71694' => + ['Label' => $this->_('[EXPLO] Connecteur les Yeux du doc "Les Yeux du doc"'), + 'Desc' => '', + 'Image' => '', + 'Video' => '', + 'Category' => '', + 'Right' => function($feature_description, $user) {return true;}, + 'Wiki' => '', + 'Test' => '', + 'Date' => '2018-03-29'], \ No newline at end of file diff --git a/VERSIONS_WIP/71694 b/VERSIONS_WIP/71694 new file mode 100644 index 0000000000000000000000000000000000000000..9f04d35f4887220aeb55f28ab4fd90e687e957f8 --- /dev/null +++ b/VERSIONS_WIP/71694 @@ -0,0 +1 @@ + - ticket #71694 : [EXPLO] Connecteur les Yeux du doc "Les Yeux du doc" \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/Batch.php b/library/digital_resources/LesYeuxDoc/Batch.php new file mode 100644 index 0000000000000000000000000000000000000000..a364e1741a9985be2d6cbe50284dd635d03f9d9e --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/Batch.php @@ -0,0 +1,23 @@ +<?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 LesYeuxDoc_Batch extends Class_DigitalResource_Batch {} diff --git a/library/digital_resources/LesYeuxDoc/Config.php b/library/digital_resources/LesYeuxDoc/Config.php new file mode 100644 index 0000000000000000000000000000000000000000..8a5e1949e57dc9dbf770663e7b95b8605fb1e50c --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/Config.php @@ -0,0 +1,86 @@ +<?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 LesYeuxDoc_Config extends Class_DigitalResource_Config { + public function getConfig() { + return ['Introduction' => $this->_('Une plateforme de vidéo à la demande conçue spécifiquement pour les bibliothèques'), + 'AdminVars' => ['SSO_URL' => Class_AdminVar_Meta::newDefault($this->_('URL SSO de la plateforme LesYeuxDoc')) + ->bePrivate(), + 'SSO_KEY' => Class_AdminVar_Meta::newDefault($this->_('Clef unique SSO fournit par la plateforme LesYeuxDoc')) + ->bePrivate(), + 'CATALOG_URL' => Class_AdminVar_Meta::newDefault($this->_('Url du catalogue de la plateforme LesYeuxDoc')) + ->bePrivate()], + + 'PermissionLabel' => $this->_('Bibliothèque numérique: accéder à la ressource LesYeuxDoc'), + + 'NotAllowedMessage' => $this->_('Votre compte n\'est pas authorisé à accéder à cette ressource.'), + + 'SsoAction' => true, + 'MenuLabel' => $this->_('Lien vers LesYeuxDoc'), + 'ModuleMenu' => $this->withNameSpace('ModuleMenu'), + + 'Service' => $this->withNameSpace('Service'), + 'Batch' => $this->withNameSpace('Batch'), + 'DocTypeLabel' => $this->_('Vidéo (LesYeuxDoc)'), + + 'HelpLink' => 'http://wiki.bokeh-library-portal.org/index.php/LesYeuxDoc', + 'Url' => 'https://lesyeuxdoc.fr', + 'Icon' => 'https://www.lesyeuxdoc.fr/dist/img/yeuxdoc.svg']; + } + + + public function isEnabled() { + return $this->getAdminVar('SSO_URL'); + } + + + public function getSsoUrl($user) { + if (!$id_abon = $user->getIdabon()) + $id_abon = $user->getId(); + + $hash = Class_Hash::sha256WithKey($this->getAdminVar('SSO_KEY')); + + $params = ['sso_id' => 'afi', + 'id' => $id_abon, + 'id_encrypted' => $hash->encrypt($id_abon), + 'd' => $hash->encrypt(date('dmY', $this->getCurrentTime())), + 'prenom' => $user->getPrenom(), + 'nom' => $user->getNom(), + 'email' => $user->getMail(), + 'dnaiss' => $user->getNaissance(), + 'datout' => $user->getDateFin(), + 'return_url' => 'https://www.lesyeuxdoc.fr']; + + return $this->getAdminVar('SSO_URL') + . '?' + . http_build_query($params); + } + + + public function getHarvestUrl($page = 1) { + $artevod = new Class_WebService_BibNumerique_ArteVOD; + return $this->getAdminVar('CATALOG_URL') + . '?' + . http_build_query(['page_nb' => $page, + 'page_size' => 10]); + } +} \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/ModuleMenu.php b/library/digital_resources/LesYeuxDoc/ModuleMenu.php new file mode 100644 index 0000000000000000000000000000000000000000..ca8864abad53006a964c98c94556fd720ffb4e81 --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/ModuleMenu.php @@ -0,0 +1,23 @@ +<?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 LesYeuxDoc_ModuleMenu extends Class_DigitalResource_ModuleMenu {} \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/Service.php b/library/digital_resources/LesYeuxDoc/Service.php new file mode 100644 index 0000000000000000000000000000000000000000..d872afc9ca530212e0bacdec32f760f79a649980 --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/Service.php @@ -0,0 +1,74 @@ +<?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 LesYeuxDoc_Service extends Class_WebService_BibNumerique_ArteVOD { + protected $_config; + + public static function getInstance() { + return Class_DigitalResource_Config::getInstanceFor(static::class)->getServiceInstance(); + } + + + public function __construct($config) { + $this->_config = $config; + } + + + protected function getDocType() { + return $this->_config->getDocType(); + } + + + protected function getUrlOrigine() { + return $this->_config->getOAIUrl(); + } + + + public function isEnabled() { + return $this->_config->isEnabled(); + } + + + public function getName() { + return $this->_config->getName(); + } + + + protected function loadPage($page_number = 1) { + $url = $this->_config->getHarvestUrl($page_number); + + $content = $this->open_authenticated_url($url); + if ('' == $content) { + $this->getLogger()->error('Erreur de communication'); + return; + } + + $this->getLogger()->info('Réponse reçue'); + $reader = $this->getFilmsReader()->parse($content); + return $reader; + } + + + public function getFilmsReader() { + return new LesYeuxDoc_Service_FilmsReader; + } +} \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/Service/Film.php b/library/digital_resources/LesYeuxDoc/Service/Film.php new file mode 100644 index 0000000000000000000000000000000000000000..db58f3af6577cde500e6e45c85cf4a4583d9ded9 --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/Service/Film.php @@ -0,0 +1,48 @@ +<?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 LesYeuxDoc_Service_Film extends Class_WebService_BibNumerique_ArteVOD_Film { + public function fillAlbum($album) { + $album->setTypeDocId(LesYeuxDoc_Config::getInstance()->getDocType()); + $album->setDuration($this->duration.' mn') + ->setTags($this->getTags()); + + foreach ($this->getActors() as $actor) + $album->addAuthor(trim($actor['familyName'] . ' ' . $actor['givenName']), + '005'); + foreach ($this->_directors as $director) + $album->addAuthor(trim($director['familyName'] . ' ' . $director['givenName']), + '300'); + + return $album; + } + + + public function getRessourceCategorieLibelle() { + return LesYeuxDoc_Config::getInstance()->getDocTypeLabel(); + } + + + public function getBaseUrl() { + return LesYeuxDoc_Config::getInstance()->getAdminVar('CATALOG_URL'); + } +} \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/Service/FilmsReader.php b/library/digital_resources/LesYeuxDoc/Service/FilmsReader.php new file mode 100644 index 0000000000000000000000000000000000000000..3f5361497832d5f4aa874c9487b9c192f2513dbe --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/Service/FilmsReader.php @@ -0,0 +1,32 @@ +<?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 LesYeuxDoc_Service_FilmsReader extends Class_WebService_BibNumerique_ArteVOD_FilmsReader { + public function startFilm() { + $this->_current_film = new LesYeuxDoc_Service_Films; + } + + + public function parseFilm($movie) { + return new LesYeuxDoc_Service_Film($movie); + } +} \ No newline at end of file diff --git a/library/digital_resources/LesYeuxDoc/controllers/IndexController.php b/library/digital_resources/LesYeuxDoc/controllers/IndexController.php new file mode 100644 index 0000000000000000000000000000000000000000..94acb5624fe96e0628713351cfa3b3a5b014b555 --- /dev/null +++ b/library/digital_resources/LesYeuxDoc/controllers/IndexController.php @@ -0,0 +1,23 @@ +<?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 LesYeuxDoc_Plugin_IndexController extends Class_DigitalResource_Controller {} \ No newline at end of file