Commit 640e57d2 authored by Patrick Barroca's avatar Patrick Barroca 🐧

Merge remote-tracking branch 'refs/remotes/origin/hotline' into origin-master

Conflicts:
	cosmogramme/sql/patch/patch_370.php
	tests/db/UpgradeDBTest.php
parents 6c3b84a3 b731f978
06/05/2019 - v8.0.13
- ticket #87884 : Vue notice : Ajout d'un message d'erreur lorsque le chargement d'un bloc ou d'un onglet échoue.
- ticket #87795 : Newsletter : Affichage des articles dans l'ordre de selection.
- ticket #90727 : SIGB Koha : Correction du rattachement automatique d'un abonné à une bibliothèque lors de son inscription par Bokeh.
- ticket #83325 : PNB Dilicom : si un document a atteint la limit d'emprunts simultanés, n'interdit pas à un abonné qui a un emprunt en cours de le télécharger de nouveau
- ticket #91613 : Editeur CSS : force l'invalidation du cache navigateur pour voir les dernières modifications
30/04/2019 - v8.0.12
- ticket #88956 : Affichage notices Arte VOD : correction d'affichage du réalisateur.
......
- ticket #88956 : Arte VOD : ajout d'un script de mise à jour des auteurs
\ No newline at end of file
- ticket #90657 : Administration : L'accès à l'explorateur de fichiers est désormais gérée par la permission de groupe "Explorateur de Fichier: accès en ecriture sur les répertoires de dépot de fichier"
\ No newline at end of file
- ticket #90675 : Résultat de recherche : Amélioration du messages d'erreur lorsque la transformation XSLT produit un résultat vide
\ No newline at end of file
- ticket #90710 : SIGB Nanook : Correction de la prise en compte de la sécurisation des mots de passe
\ No newline at end of file
- ticket #91081 : Inspecteur Gadget : Les appels au serveur de cache AFI s'affiche par le bouton "Appels webservices"
\ No newline at end of file
- ticket #91398 : MAJ API Skilleos
\ No newline at end of file
- ticket #91864 : Newsletter : correction de la sélection d'article qui ajoutait automatiquement tous les articles lorsque la sélection était vide
\ No newline at end of file
......@@ -59,7 +59,8 @@ self["@cssUrl"]=smalltalk.send(linkTag,"_attr_",["data-url"]);
if(($receiver = self["@cssUrl"]) == nil || $receiver == undefined){
$1=self["@cssUrl"];
} else {
$1=smalltalk.send(smalltalk.send(self["@cssUrl"],"__comma",["?"]),"__comma",[smalltalk.send(smalltalk.send((smalltalk.Date || Date),"_now",[]),"_asMilliseconds",[])]);
self["@cssUrl"]=smalltalk.send(smalltalk.send(self["@cssUrl"],"__comma",["?dt="]),"__comma",[smalltalk.send(smalltalk.send((smalltalk.Date || Date),"_now",[]),"_asMilliseconds",[])]);
$1=self["@cssUrl"];
};
return $1;
}
......
......@@ -75,12 +75,13 @@ self["@cssUrl"]=smalltalk.send(linkTag,"_attr_",["data-url"]);
if(($receiver = self["@cssUrl"]) == nil || $receiver == undefined){
$1=self["@cssUrl"];
} else {
$1=smalltalk.send(smalltalk.send(self["@cssUrl"],"__comma",["?"]),"__comma",[smalltalk.send(smalltalk.send((smalltalk.Date || Date),"_now",[]),"_asMilliseconds",[])]);
self["@cssUrl"]=smalltalk.send(smalltalk.send(self["@cssUrl"],"__comma",["?dt="]),"__comma",[smalltalk.send(smalltalk.send((smalltalk.Date || Date),"_now",[]),"_asMilliseconds",[])]);
$1=self["@cssUrl"];
};
return $1;
},
args: [],
source: "cssUrl\x0a\x09|linkTag|\x0a\x09linkTag := (window jQuery: '#profil_css').\x0a cssUrl := linkTag attr: 'data-url'.\x09\x0a ^ cssUrl ifNotNil: [cssUrl, '?', Date now asMilliseconds ] ",
source: "cssUrl\x0a\x09|linkTag|\x0a\x09linkTag := (window jQuery: '#profil_css').\x0a cssUrl := linkTag attr: 'data-url'.\x09\x0a ^ cssUrl ifNotNil: [cssUrl := cssUrl, '?dt=', Date now asMilliseconds ] ",
messageSends: ["jQuery:", "attr:", "ifNotNil:", ",", "asMilliseconds", "now"],
referencedClasses: ["Date"]
}),
......
......@@ -17,7 +17,7 @@ cssUrl
|linkTag|
linkTag := (window jQuery: '#profil_css').
cssUrl := linkTag attr: 'data-url'.
^ cssUrl ifNotNil: [cssUrl, '?', Date now asMilliseconds ]
^ cssUrl ifNotNil: [cssUrl := cssUrl, '?dt=', Date now asMilliseconds ]
!
label
......
......@@ -143,15 +143,29 @@ class AuthController extends ZendAfi_Controller_Action {
}
$user = Class_Users::getIdentity();
$user->getFicheSIGB(); // init sigb infos
$user
->setPassword($this->_request->getPost('secure_password'))
->save();
$user->setPassword($this->_request->getPost('secure_password'));
$this->getHelper('notify')->bePopup();
$this->_helper->notify($this->_('Votre compte est sécurisé. Vous pouvez maintenant vous connecter avec votre courriel et votre nouveau mot de passe.'));
try {
if ($user->save()) {
$patron = $user->getEmprunteur();
$patron->setPassword($this->_request->getPost('secure_password'));
$patron->ensureService($user)->save();
$this->getHelper('notify')->bePopup();
$this->_helper->notify($this->_('Votre compte est sécurisé. Vous pouvez maintenant vous connecter avec votre courriel et votre nouveau mot de passe.'));
$this->_redirect('/');
}
$form->addDecorator('Errors');
foreach($user->getErrors() as $error)
$form->addError($error);
} catch(Exception $e) {
$form->addError($e->getMessage());
$form->addDecorator('Errors');
}
$this->_redirect('/');
return $this->renderScript('auth/secure-password.phtml');
}
......
......@@ -12,4 +12,8 @@
<li><?php echo $this->_('les cookies permettent d\'identifier les services et rubriques que l\'utilisateur a visités.');?></li>
</ul>
<h3><?php echo $this->_('Durée de conservation des cookies ?');?></h3>
<p><?php echo $this->_('Les cookies déposés par Bokeh ont une durée de vie maximale de 12 mois et 2 semaines.');?>
<?php echo $this->ga_warning; ?>
<?php
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query(
'create table `rendez_vous_user_notification` ('
. '`id` int(11) unsigned not null auto_increment,'
. '`rendez_vous_id` int(11) unsigned not null,'
. '`user_id` int(11) not null,'
. '`created_at` datetime null,'
. '`type` varchar(255) not null,'
. '`status` varchar(255) null,'
. '`error` text null,'
. 'primary key (id),'
. 'key `rendez_vous_id` (`rendez_vous_id`),'
. 'key `user_id` (`user_id`),'
. 'key `status` (`status`),'
. 'key `type`(`type`),'
. 'key `created_at` (`created_at`)'
. ') engine=MyISAM default charset=utf8'
);
} catch(Exception $e) {}
(new Class_Migration_ArteVODAuthorsOrder())->updateAuthorsForAllAlbums();
<?php
(new Class_Migration_FileManagerWriteAccess())->run();
<?php
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query(
'create table `rendez_vous_user_notification` ('
. '`id` int(11) unsigned not null auto_increment,'
. '`rendez_vous_id` int(11) unsigned not null,'
. '`user_id` int(11) not null,'
. '`created_at` datetime null,'
. '`type` varchar(255) not null,'
. '`status` varchar(255) null,'
. '`error` text null,'
. 'primary key (id),'
. 'key `rendez_vous_id` (`rendez_vous_id`),'
. 'key `user_id` (`user_id`),'
. 'key `status` (`status`),'
. 'key `type`(`type`),'
. 'key `created_at` (`created_at`)'
. ') engine=MyISAM default charset=utf8'
);
} catch(Exception $e) {}
<?php
/**
* Copyright (c) 2012-2019, 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 Class_Migration_ArteVODAuthorsOrder {
public function updateAuthors($album) {
$old_authors = new Storm_Collection($album->getAuthors());
$album->getMarc()->clearZone('701');
$this->addAuthorsTo($old_authors, function($author)
{
return $author->getResponsibility()=='300';
}, $album);
$this->addAuthorsTo($old_authors, function($author)
{
return $author->getResponsibility()!='300';
}, $album);
$album->index();
}
public function updateAuthorsForAllAlbums($closure=null) {
foreach(Class_Album::findAllBy(['type_doc_id' => Class_TypeDoc::ARTEVOD]) as $album) {
$this->updateAuthors($album);
if ($closure)
$closure($album);
}
}
protected function addAuthorsTo($authors, $closure, $album) {
$authors->select($closure)
->eachDo(function ($author) use ($album)
{
$album->addAuthor($author);
}) ;
}
}
<?php
/**
* Copyright (c) 2012-2019, 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 Class_Migration_FileManagerWriteAccess {
public function run() {
foreach(Class_UserGroup::findAll() as $group)
$this->_runOne($group);
}
protected function _runOne($group) {
if (array_intersect(
[Class_UserGroup::RIGHT_USER_DOMAINES_TOTAL_ACCESS,
Class_UserGroup::RIGHT_USER_DOMAINES_SUPPRESSION_LIMIT,
Class_UserGroup::RIGHT_USER_ACCES_ARTICLES],
$group->getRights()))
$group->addRight(Class_UserGroup::RIGHT_USER_FILE_ACCESS)->save();
}
}
......@@ -225,19 +225,11 @@ class Class_Newsletter extends Storm_Model_Abstract {
public function getArticles() {
$articles = [];
foreach (Class_ArticleCategorie::findAllBy(['id_cat' => $this->_idsFrom($this->getArticlesCategoriesIds())]) as $categorie)
$articles = array_merge($articles,
$categorie->getArticles());
return array_merge($articles,
Class_Article::findAllBy(['id_article' => $this->_idsFrom($this->getArticlesIds())]));
}
protected function _idsFrom($selection) {
return explode('-', $selection);
return $this->hasArticlesIds() || $this->hasArticlesCategoriesIds()
? Class_Article::getArticlesByPreferences(['id_items' => $this->getArticlesIds(),
'id_categorie' => $this->getArticlesCategoriesIds(),
'display_order' => 'Selection'])
: [];
}
......
......@@ -23,7 +23,19 @@
class Class_Notice_Thumbnail_ProviderCacheServer
extends Class_Notice_Thumbnail_ProviderAbstract {
protected static $_is_tracking_seen = true;
protected static $_seen = [];
/** @category testing */
public static function doNotTrackSeen() {
static::$_is_tracking_seen = false;
}
public function updateNotice() {
if ($this->_shouldIgnore())
return $this;
if (!$urls = $this->_getUrls())
return $this->noWebThumbRecord();
......@@ -36,6 +48,18 @@ class Class_Notice_Thumbnail_ProviderCacheServer
}
protected function _shouldIgnore() {
if (!static::$_is_tracking_seen)
return false;
if (in_array($this->_record->getId(), static::$_seen))
return true;
static::$_seen[] = $this->_record->getId();
return false;
}
protected function _getUrls() {
$record = $this->_record;
$numero = $record->isPeriodique() ? $record->getTomeAlpha() : '';
......
......@@ -73,10 +73,18 @@ class Class_User_ILSSubscription {
$date = new DateTime($this->getTimeSource()->dateYmd());
$date->modify('+1 year');
if ($this->_isLibrarySendData())
$this->_user->setIdIntBib($this->_user->getIdSite());
return $this->_user->setDateFin($date->format('Y-m-d'));
}
protected function _isLibrarySendData() {
return $this->_user->hasBib() && $this->_user->getBib()->isSIGBSendData();
}
public function registerNotificationsOn($notifiable) {
if(($user = Class_Users::getIdentity()) && $this->_user->getId() == $user->getId())
return $this->registerNotificationsForMeOn($notifiable);
......
......@@ -212,7 +212,7 @@ class Class_UserGroup extends Storm_Model_Abstract {
self::RIGHT_ACCES_PNB_DILICOM => $t->_('Bibliothèque numérique: autoriser le prêt numérique Dilicom'),
self::RIGHT_USER_DOMAINES_SUPPRESSION_LIMIT => $t->_('Domaines: accès, modification et suppression limitée au créateur'),
self::RIGHT_USER_DOMAINES_TOTAL_ACCESS => $t->_('Domaines: accès total en modification et suppression'),
self::RIGHT_USER_FILE_ACCESS => $t->_('Articles: accès sur les répertoires images et file'),
self::RIGHT_USER_FILE_ACCESS => $t->_('Explorateur de fichiers: accès en ecriture sur les répertoires de dépot de fichier'),
self::RIGHT_USER_SITOTHEQUE => $t->_('Sitothèque: accès sitothèque'),
self::RIGHT_USER_MODO => $t->_('Modération: accès modération'),
self::RIGHT_USER_INSCRIPTIONS => $t->_('Modération: accès demandes d\'inscriptions'),
......
......@@ -939,6 +939,11 @@ class Class_Users extends Storm_Model_Abstract {
}
public function hasRightFileManagerAccess() {
return $this->isAdmin() || $this->hasRightToAccess(Class_UserGroup::RIGHT_USER_FILE_ACCESS);
}
/**
* @return bool
*/
......@@ -1932,4 +1937,9 @@ class Class_Users extends Storm_Model_Abstract {
return false;
}
public function isAllowedToAccess($controller, $action) {
return (new ZendAfi_Acl_AdminControllerGroup)->isAllowed($this, $controller, $action);
}
}
......@@ -184,26 +184,11 @@ class Class_WebService_AllServices {
$response = json_decode(self::httpGet($url_service, $args), true);
static::_addInspectorGadget($url_service, $args, $response);
return $response;
}
protected static function _addInspectorGadget($url, $args, $response) {
if (!$ig = Zend_Controller_Front::getInstance()
if ($ig = Zend_Controller_Front::getInstance()
->getPlugin('ZendAfi_Controller_Plugin_InspectorGadget'))
return;
if(!$ig->isEnabled())
return;
$ig->log();
$ig->addButton(new Class_Entity(['Label' => 'Serveur de cache',
'Content' => 'URL : ' . $url
. BR
. 'args : ' . implode(BR, $args)
. BR
. 'response : ' . implode(BR, $response)]));
return $response;
}
......
......@@ -176,14 +176,14 @@ class Class_WebService_BibNumerique_Dilicom_Hub extends Class_WebService_Abstrac
public function isAlbumLoanableBy($album, $user) {
$loanable = $this->_isAlbumLoanable($album);
if ($error = $loanable->returnMessage)
return $loanable;
$currently_loaned_by_user = $this->_isAlbumCurrentlyLoanedByUser($album, $user);
if (!$currently_loaned_by_user->returnMessage)
return $currently_loaned_by_user;
$loanable = $this->_isAlbumLoanable($album);
if ($error = $loanable->returnMessage)
return $loanable;
return $this->_isAlbumLoanableByUser($album, $user);
}
......
......@@ -44,6 +44,14 @@ class ZendAfi_Acl_AdminControllerGroup {
'users/settings' => null,
'usergroup-agenda' => Class_UserGroup::RIGHT_USER_RENDEZ_VOUS,
'rendez-vous' => Class_UserGroup::RIGHT_USER_RENDEZ_VOUS,
'file-manager/create' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/copy' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/import' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/resize' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/rename' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/delete' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager/drop' => Class_UserGroup::RIGHT_USER_FILE_ACCESS,
'file-manager' => null,
],
$_activated = [];
......
......@@ -192,9 +192,11 @@ create: function(event, ui) { if (ui.panel.hasClass(\'ig-accordion\')) ui.panel.
public function log() {
if (!$httpClient = Class_HttpClientFactory::getInstance()->getLastHttpClient()) {
if (!$this->isEnabled())
return $this;
if (!$httpClient = Class_HttpClientFactory::getInstance()->getLastHttpClient())
return $this;
}
$response_code = $response_body = null;
if ($response = $httpClient->getLastResponse()) {
......@@ -246,10 +248,10 @@ create: function(event, ui) { if (ui.panel.hasClass(\'ig-accordion\')) ui.panel.
if (!$this->isEnabled())
return $this;
if(!$instance)
if (!$instance)
return $this;
$this->_buttons []= $instance;
$this->_buttons[]= $instance;
return $this;
}
}
......@@ -23,12 +23,12 @@
class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_Plugin_Manager_Manager {
public function getActions($model) {
return [['url' => $this->_getBrowseUrl($model),
return [
['url' => $this->_getBrowseUrl($model),
'icon' => '',
'caption' => function($model)
{
return $this->_view->thumbnail($model) . $model->getName();
},
'caption' => function($model) {
return $this->_view->thumbnail($model) . $model->getName();
},
'label' => $this->_('Voir le contenu de "%s"', $model->getPath()),
'anchorOptions' => array_filter(['title' => $this->_('Voir le contenu de "%s"', $model->getId()),
'data-path' => $model->getPath(),
......@@ -53,7 +53,9 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
'caption' => function($model) {
return $this->_view->tag('i', '', ['class' => 'fa icon-folder-plus']) . $this->_view->tag('span', $this->_('Créer'));
},
'condition' => 'isDir',
'condition' => function ($model) {
return $model->isDir() && $this->_isallowedaction($model,'create');
},
'label' => $this->_('Créer un nouveau dossier dans "%s".', $model->getPath()),
'anchorOptions' => array_filter(['title' => $this->_('Ajouter un nouveau dossier dans "%s".', $model->getPath()),
'data-popup' => 'true',
......@@ -65,7 +67,9 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
'caption' => function($model) {
return $this->_view->tag('i', '', ['class' => 'fa fa-upload']) . $this->_view->tag('span', $this->_('Téléverser'));
},
'condition' => 'isDir',
'condition' => function ($model) {
return $model->isDir() && $this->_isallowedaction($model,'import');
},
'label' => $this->_('Téléverser un nouveau fichier dans le dossier "%s".', $model->getPath()),
'anchorOptions' => array_filter(['title' => $this->_('Téléverser un nouveau fichier dans le dossier "%s".', $model->getPath()),
'data-popup' => 'true',
......@@ -77,7 +81,9 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
'caption' => function($model) {
return $this->_view->tag('i', '', ['class' => 'fa fa-compress']) . $this->_view->tag('span', $this->_('Redimensionner'));
},
'condition' => 'isResizable',
'condition' => function($model) {
return $model->isResizable() && $this->_isallowedaction($model, 'resize');
},
'label' => $this->_('Redimensionner le fichier "%s".', $model->getPath()),
'anchorOptions' => array_filter(['title' => $this->_('Redimensionner le fichier "%s".', $model->getPath()),
'data-popup' => 'true',
......@@ -90,6 +96,7 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
return $this->_view->tag('i', '', ['class' => 'fa fa-pencil-square-o']) . $this->_view->tag('span', $this->_('Renommer'));
},
'label' => $this->_('Renommer "%s"', $model->getName()),
'condition' => function($model){ return $this->_isallowedaction($model,'rename'); },
'anchorOptions' => array_filter(['title' => $this->_('Renommer "%s"', $model->getName()),
'data-popup' => 'true',
'class' => $model->isWritable() ? null : 'disabled'])],
......@@ -101,6 +108,7 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
return $this->_view->tag('i', '', ['class' => 'fa fa-trash']) . $this->_view->tag('span', $this->_('Supprimer'));
},
'label' => $this->_('Supprimer "%s"', $model->getName()),
'condition' => function($model) { return $this->_isallowedaction($model,'delete'); },
'anchorOptions' => array_filter(['title' => $this->_('Supprimer "%s"', $model->getName()),
'data-popup' => 'true',
'class' => $model->isWritable() ? null : 'disabled'])],
......@@ -128,6 +136,11 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P
}
protected function _isallowedaction($model, $action) {
return Class_Users::getIdentity()->isAllowedToAccess('file-manager', $action);
}
protected function _getBrowseUrl($model) {
return $this->_view->url([$model->getBrowserParam() => $model->getPath(),
'search_' . $model->getBrowserParam() => null,
......
......@@ -34,7 +34,11 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp
->addOPACStyleSheet('file-manager/style.css')
->addOPACPluginScript('file-manager/file-manager.js')
->addOPACPluginStyleSheet('file-manager/file-manager.css')
->addJqueryReady('$("div.file-manager").fileManager();initializePopups();');
->addJqueryReady('$("div.file-manager").fileManager({dragndrop: '
. ($user->hasRightFileManagerAccess()
? 'true'
: 'false' )
. '});initializePopups();');
$html = implode([$this->_renderTools($settings),
$this->_renderManager($settings)]);
......@@ -46,7 +50,8 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp
['class' => implode(' ', array_filter(['file-manager',
$settings->getFullScreen() ? 'fullscreen': ''])),
'data-drop-url' => $this->view->url(['action' => 'drop',
'render' => 'popup'])]);
'render' => 'popup'])
]);
}
......
......@@ -38,30 +38,33 @@ class ZendAfi_View_Helper_Notice_Xsl extends ZendAfi_View_Helper_BaseHelper {
$xslt = $xsl->importStylesheet($xsl_file->getRealpath());
$response = $xsl->transformToXml($marc_xml);
if(($errors = $xsl->getErrors()) || (!$response))
return $this->_tag('p', $this->_('La transformation du %s en HTML par le fichier %s n\'a pas fonctionné.',
$this->view->tagAnchor(Class_Url::absolute($marc_xml),
$this->_('marc-xml'),
['target' => 'blank']),
$this->view->tagAnchor(Class_Url::absolute($xsl_file->getPath()),
$this->_('xsl'),
['target' => 'blank'])),
['class' => 'error'])
if(($errors = $xsl->getErrors()))
return $this->_errorMessage($this->_('n\'a pas fonctionné.'), $marc_xml, $xsl_file)
. $this->_renderXsltErrors($errors);
if (!$response)
return $this->_errorMessage($this->_('a produit un résultat vide.'), $marc_xml, $xsl_file);
$xsl->unlink($marc_xml);
return $response;
}
protected function _renderXsltErrors($errors) {
$no_error_message = $this->_tag('p', $this->_('Aucune erreur levée par XSLTProcessor'));
if(!$errors)
return $no_error_message;
if(empty($errors))
return $no_error_message;
protected function _errorMessage($message, $marc_xml, $xsl_file) {
return $this->_tag('p', $this->_('La transformation du %s en HTML par le fichier %s %s',
$this->view->tagAnchor(Class_Url::absolute($marc_xml),
$this->_('marc-xml'),
['target' => 'blank']),
$this->view->tagAnchor(Class_Url::absolute($xsl_file->getPath()),
$this->_('xsl'),
['target' => 'blank']),
$message),
['class' => 'error']);
}
protected function _renderXsltErrors($errors) {
$html = [];
foreach ($errors as $error)
$html [] = $this->_tag('li', $this->_('Erreur levée par Libxml: %s', $error->message));
......
......@@ -23,8 +23,8 @@
class Skilleos_Service extends Class_DigitalResource_Service {
public static
$REST_URL = 'http://moncompte.skilleos.com/rest/api/trainings',
$TOKEN_URL = 'http://moncompte.skilleos.com/oauth/v2/token';
$REST_URL = 'https://moncompte.skilleos.com/rest/api/trainings',
$TOKEN_URL = 'https://moncompte.skilleos.com/oauth/v2/token';
protected
$_parser,
......@@ -73,7 +73,7 @@ class Skilleos_Service extends Class_DigitalResource_Service {
public function httpGetCatalogue() {
return $this->httpGet(static::$REST_URL,
return $this->httpGet(static::$REST_URL.'/'.$this->_config->getAdminVar('BIB_ID').'.json',
['headers' => [ 'Authorization' => 'Bearer ' . $this->getToken()]]);
}
......
......@@ -28,24 +28,34 @@ class Skilleos_Service_Parser extends Class_WebService_BibNumerique_RessourceNum
->setDescription($json->introduction.$json->description.$json->contenu_and_objectif);
$this->_lessons = [];
$this->_posters[] = isset($json->picture) ? $json->picture->url : $json->ressource->url;
$this->_posters[] = $json->picture->url;
$this->addAuthor($json->teacher->name);
foreach ($json->lessons as $lesson) {
$current=new Class_AlbumRessource();
$current->setTitre($lesson->lesson->name);
$this->_lessons[]=$current;
foreach ($json->sections as $section) {
$this->_lessons[] = $this->_buildResourceFromSection($section);
}
$this->setRessources($this->_lessons);
return $this->import();
}
protected function _buildResourceFromSection($section) {
$description="";
foreach ($section->lessons as $lesson) {
$description .= $lesson->name."\n";
}
return (new Class_AlbumRessource())