Commit 61fc1bc0 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

wip on theme store

parent d09d74c6
Pipeline #9465 passed with stage
in 41 minutes and 51 seconds
...@@ -995,7 +995,12 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -995,7 +995,12 @@ class AbonneController extends ZendAfi_Controller_Action {
} }
$this->_helper->notify($this->_('Suggestion d\'achat enregistrée')); $this->_helper->notify($this->_('Suggestion d\'achat enregistrée'));
return $this->_redirect(Class_Url::absolute($this->view->url(['action' => 'suggestion-achat'])));
$action = Class_Template::current()->isLegacy()
? 'suggestion-achat'
: 'suggestions';
return $this->_redirect(Class_Url::absolute($this->view->url(['action' => $action])));
} }
...@@ -1508,15 +1513,23 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -1508,15 +1513,23 @@ class AbonneController extends ZendAfi_Controller_Action {
} }
$allowed_paths = explode(';', Class_AdminVar::getValueOrDefault('USER_PROFILE_IMAGES')); $allowed_paths = explode(';', Class_AdminVar::getValueOrDefault('USER_PROFILE_IMAGES'));
if (!in_array($image->getPath(), $allowed_paths)) { $allowed_images = [];
$this->_helper->notify($this->_('Une erreur c\'est produite. Votre image de profil n\'a pas été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
(new Class_User_Settings($this->_user))->setProfileImage($image->getPath()); foreach ($allowed_paths as $path)
$this->_user->save(); if ($image_var = Class_FileManager::find($path))
$allowed_images [] = $image_var;
foreach ($allowed_images as $allowed_image) {
if ($image->getId() == $allowed_image->getId()) {
(new Class_User_Settings($this->_user))->setProfileImage($image->getPath());
$this->_user->save();
$this->_helper->notify($this->_('Votre image de profil a bien été modifiée.')); $this->_helper->notify($this->_('Votre image de profil a bien été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
}
$this->_helper->notify($this->_('Une erreur c\'est produite. Votre image de profil n\'a pas été modifiée.'));
return $this->_redirectClose($this->_getReferer()); return $this->_redirectClose($this->_getReferer());
} }
...@@ -1529,6 +1542,10 @@ class AbonneController extends ZendAfi_Controller_Action { ...@@ -1529,6 +1542,10 @@ class AbonneController extends ZendAfi_Controller_Action {
} }
public function suggestionsAction() {
}
public function selectionAction() { public function selectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) { if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) {
return $this->_redirectClose($this->_getReferer()); return $this->_redirectClose($this->_getReferer());
......
...@@ -1020,6 +1020,12 @@ class RechercheController extends ZendAfi_Controller_Action { ...@@ -1020,6 +1020,12 @@ class RechercheController extends ZendAfi_Controller_Action {
} }
public function clearLastSearchSessionAction() {
$this->_helper->getHelper('viewRenderer')->setNoRender();
Zend_Registry::get('session')->last_search = null;
}
protected function newCriteresRecherches($params) { protected function newCriteresRecherches($params) {
$criteres = (new Class_CriteresRecherche()) $criteres = (new Class_CriteresRecherche())
->setParams($params); ->setParams($params);
......
...@@ -284,4 +284,12 @@ class RssController extends ZendAfi_Controller_Action { ...@@ -284,4 +284,12 @@ class RssController extends ZendAfi_Controller_Action {
$notice->getAnnee(), $notice->getAnnee(),
$this->view->absoluteUrl($notice->fetchUrlLocalVignette())); $this->view->absoluteUrl($notice->fetchUrlLocalVignette()));
} }
public function renderItemsAction() {
if (!$this->view->rss = Class_Rss::find($this->_getParam('id', null)))
return $this->getHelper('ViewRenderer')->setNoRender();
$this->getHelper('ViewRenderer')->setLayoutScript('subModal.phtml');
}
} }
<?php <?php
$this->openBoite($this->_('Suggérer un achat')); echo $this->abonne_NewSuggestion($this->form, $this->preferences, $this->records);
$send_form_button = '';
if ($this->records) {
echo $this->tag('p', $this->_('Les documents suivants sont dans le catalogue.'));
echo $this->tag('p', $this->_('Votre suggestion en fait-elle partie ?'));
echo $this->button(new Class_Entity(['Text' => $this->_('Oui'),
'Url' => $this->url(['action' => 'suggestion-achat']),
'Attribs' => ['title' => $this->_('Annuler et revenir à la liste des suggestions.')]]));
$send_form_button = new Class_Entity(['Text' => $this->_('Non'),
'Attribs' => ['title' => $this->_('Envoyer la suggestion'),
'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]);
echo $this->button($send_form_button);
$send_form_button->setText($this->_('Envoyer'));
echo $this->ListeNotices_Mur($this->records);
$submit = $this->form->getElement('submit');
$submit
->setLabel($this->_('Relancer la recherche'))
->setAttribs(['title' => $this->_('Relance la recherche ou envoie la suggestion en cas de recherche infructueuse')]);
}
if (trim($this->preferences['help-text']))
echo $this->tag('div',
$this->preferences['help-text'],
['class' => 'help-text']);
echo $this->renderForm($this->form);
if ($send_form_button)
echo $this->button($send_form_button);
$this->closeBoite();
?>
<?php
echo $this->abonne_SuggestionsBoard($this->user);
<?php
echo $this->rss_RenderItems($this->rss);
...@@ -41,13 +41,29 @@ class Class_RssModelFlux extends BaseItem { ...@@ -41,13 +41,29 @@ class Class_RssModelFlux extends BaseItem {
} }
class RssLoader extends Storm_Model_Loader { class RssLoader extends Storm_Model_Loader {
public function getRssFrom($categories, $ids) {
$rss = [];
foreach($categories as $category)
$rss = array_merge($rss, Class_Rss::findAllBy(['id_cat' => $category,
'order' => 'titre']));
foreach($ids as $id)
$rss [] = Class_Rss::find($id);
return array_filter($rss);
}
/** /**
* @param array $id_feeds * @param array $id_feeds
* @param array $id_categories * @param array $id_categories
* @return array * @return array
*/ */
public function getFluxFromIdsAndCategories($id_feeds, $id_categories) { public function getFluxFromIdsAndCategories($id_feeds, $id_categories) {
$feeds = array(); $feeds = [];
foreach ($id_feeds as $id_feed) { foreach ($id_feeds as $id_feed) {
if ($id_feed) if ($id_feed)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software * along with BOKEH; 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
*/ */
/** /**
...@@ -45,6 +45,11 @@ class Class_RssItem { ...@@ -45,6 +45,11 @@ class Class_RssItem {
} }
public function getPubDate() {
return trim($this->_wrapped_item->pubDate());
}
public function getDate() { public function getDate() {
$date = ''; $date = '';
if ($item_date = trim($this->_wrapped_item->pubDate())) { if ($item_date = trim($this->_wrapped_item->pubDate())) {
......
...@@ -52,6 +52,23 @@ class Class_SuggestionAchat extends Storm_Model_Abstract { ...@@ -52,6 +52,23 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
} }
public function getStatus() {
return '';
}
public function getResponse() {
return '';
}
public function getLibrary() {
return ($library = Class_Bib::findFirstBy(['id_site' => $this->getBibId()]))
? $library->getLibelle()
: '';
}
public function validate() { public function validate() {
$this $this
->validateTitleOrComment() ->validateTitleOrComment()
...@@ -136,7 +153,6 @@ class Class_SuggestionAchat extends Storm_Model_Abstract { ...@@ -136,7 +153,6 @@ class Class_SuggestionAchat extends Storm_Model_Abstract {
} }
public function getIdabon() { public function getIdabon() {
if ($this->hasUser() && $this->getUser()->isAbonne()) if ($this->hasUser() && $this->getUser()->isAbonne())
return $this->getUser()->getIdabon(); return $this->getUser()->getIdabon();
......
...@@ -19,7 +19,11 @@ ...@@ -19,7 +19,11 @@
* 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 Class_Systeme_ModulesAccueil_Rss extends Class_Systeme_ModulesAccueil_Null { class Class_Systeme_ModulesAccueil_Rss extends Class_Systeme_ModulesAccueil_Null {
const CODE = 'RSS'; const
CODE = 'RSS',
ORDER_SELECTION = 'selection',
ORDER_RANDOM = 'random',
ORDER_ALPHA = 'titre';
protected protected
$_group = Class_Systeme_ModulesAccueil::GROUP_INFO, $_group = Class_Systeme_ModulesAccueil::GROUP_INFO,
......
...@@ -49,6 +49,11 @@ class Class_User_Cards extends Storm_Model_Collection { ...@@ -49,6 +49,11 @@ class Class_User_Cards extends Storm_Model_Collection {
} }
public function getSuggestions() {
return $this->_decorateOperationFrom(function($card) { return new Storm_Collection($card->getSuggestionAchat()); });
}
public function countWaitingToBePulled() { public function countWaitingToBePulled() {
return $this->injectInto(0, return $this->injectInto(0,
function($count, $card) function($count, $card)
......
...@@ -64,6 +64,7 @@ class Class_WebService_SIGB_Koha_RestfulService ...@@ -64,6 +64,7 @@ class Class_WebService_SIGB_Koha_RestfulService
trim($json))); trim($json)));
return (new Class_WebService_SIGB_Koha_SuggestionsReader()) return (new Class_WebService_SIGB_Koha_SuggestionsReader())
->setUser($user)
->parse($json); ->parse($json);
} }
......
...@@ -23,6 +23,15 @@ ...@@ -23,6 +23,15 @@
class Class_WebService_SIGB_Koha_SuggestionsReader { class Class_WebService_SIGB_Koha_SuggestionsReader {
use Trait_Translator; use Trait_Translator;
protected $_user;
public function setUser($user) {
$this->_user = $user;
return $this;
}
public function parse($json) { public function parse($json) {
return ($datas = json_decode($json)) ? return ($datas = json_decode($json)) ?
array_map([$this, '_parseOne'], $datas) : []; array_map([$this, '_parseOne'], $datas) : [];
...@@ -31,6 +40,7 @@ class Class_WebService_SIGB_Koha_SuggestionsReader { ...@@ -31,6 +40,7 @@ class Class_WebService_SIGB_Koha_SuggestionsReader {
protected function _parseOne($data) { protected function _parseOne($data) {
return (new Class_WebService_SIGB_Suggestion()) return (new Class_WebService_SIGB_Suggestion())
->setUser($this->_user)
->setTitle(trim($data->title)) ->setTitle(trim($data->title))
->setAuthor(trim($data->author)) ->setAuthor(trim($data->author))
->setPublicationYear($this->_publicationYearFor($data)) ->setPublicationYear($this->_publicationYearFor($data))
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIGB_AbstractILSDIPatronInfoReader{ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIGB_AbstractILSDIPatronInfoReader{
protected protected
$_user,
$_suggests = [], $_suggests = [],
$_item_priorities = [], $_item_priorities = [],
$_current_suggest; $_current_suggest;
...@@ -32,6 +33,12 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG ...@@ -32,6 +33,12 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
} }
public function setUser($user) {
$this->_user = $user;
return $this;
}
public function startHold($attributes) { public function startHold($attributes) {
parent::startHold($attributes); parent::startHold($attributes);
$this->_item_priorities = []; $this->_item_priorities = [];
...@@ -195,7 +202,8 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG ...@@ -195,7 +202,8 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG
public function startSuggest() { public function startSuggest() {
$this->_current_suggest = new Class_WebService_SIGB_Nanook_Suggestion(); $this->_current_suggest = (new Class_WebService_SIGB_Nanook_Suggestion)
->setUser($this->_user);
} }
......
...@@ -333,9 +333,10 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac ...@@ -333,9 +333,10 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
public function suggestionsOf($user) { public function suggestionsOf($user) {
return $this->getSuggestionsFromilsdiPatronInfo(['patronId' => $user->getIdSigb()], return
Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance()); $this->getSuggestionsFromilsdiPatronInfo(['patronId' => $user->getIdSigb()],
Class_WebService_SIGB_Nanook_PatronInfoReader::newInstance()
->setUser($user));
} }
......
...@@ -28,6 +28,7 @@ class Class_WebService_SIGB_Nanook_Suggestion extends Class_WebService_SIGB_Sugg ...@@ -28,6 +28,7 @@ class Class_WebService_SIGB_Nanook_Suggestion extends Class_WebService_SIGB_Sugg
$this->_attribs = array_merge($this->_attribs, ['url' => '']); $this->_attribs = array_merge($this->_attribs, ['url' => '']);
} }
public function acceptVisitor($visitor) { public function acceptVisitor($visitor) {
$visitor $visitor
->visitField($this->_('Isbn/Ean'), $this->getIsbn()) ->visitField($this->_('Isbn/Ean'), $this->getIsbn())
......
...@@ -86,4 +86,24 @@ class Class_WebService_SIGB_Suggestion extends Class_Entity { ...@@ -86,4 +86,24 @@ class Class_WebService_SIGB_Suggestion extends Class_Entity {
public function getAuteur() { public function getAuteur() {
return $this->getAuthor(); return $this->getAuthor();
} }
public function getTypeDoc() {
return null;
}
public function getDateCreation() {
return $this->getDate();
}
public function getCommentaire() {
return $this->getNote();
}
public function getDescriptionUrl() {
return $this->getUrl();
}
} }
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2020, 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 ZendAfi_View_Helper_Abonne_NewSuggestion extends ZendAfi_View_Helper_BaseHelper {
public function abonne_NewSuggestion($form, $preferences, $records = []) {
$html = [$this->view->openBoiteContent($this->_('Suggérer un achat'))];
$send_form_button = '';
if ($records) {
$html [] = $this->view->tag('p', $this->_('Les documents suivants sont dans le catalogue.'));
$html [] = $this->view->tag('p', $this->_('Votre suggestion en fait-elle partie ?'));
$html [] = $this->view->button(new Class_Entity(['Text' => $this->_('Oui'),
'Url' => $this->view->url(['action' => 'suggestion-achat']),
'Attribs' => ['title' => $this->_('Annuler et revenir à la liste des suggestions.')]]));
$send_form_button = new Class_Entity(['Text' => $this->_('Non'),
'Attribs' => ['title' => $this->_('Envoyer la suggestion'),
'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]);
$html [] = $this->view->button($send_form_button);
$send_form_button->setText($this->_('Envoyer'));
$html [] = $this->view->ListeNotices_Mur($records);
$submit = $form->getElement('submit');
$submit
->setLabel($this->_('Relancer la recherche'))
->setAttribs(['title' => $this->_('Relance la recherche ou envoie la suggestion en cas de recherche infructueuse')]);
}
if (trim($preferences['help-text']))
$html [] = $this->view->tag('div',
$preferences['help-text'],
['class' => 'help-text']);
$html [] = $this->view->renderForm($form);
if ($send_form_button)
$html [] = $this->view->button($send_form_button);
$html [] = $this->view->closeBoiteContent();
return implode($html);
}
}
\ No newline at end of file
...@@ -418,8 +418,7 @@ label[data-name=note] ~ div label.multi-element-label + br { ...@@ -418,8 +418,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
} }
.jumbotron .nav-link div { .jumbotron .nav-link div {
font-size: 11px; font-size: 10px;
max-width: 100px;
} }
.modal_image { .modal_image {
...@@ -738,4 +737,8 @@ dl.row { ...@@ -738,4 +737,8 @@ dl.row {
.menu_admin_front a[class*="deactivate"][style*="inline"] { .menu_admin_front a[class*="deactivate"][style*="inline"] {
display: block !important; display: block !important;
}
.description dd a + a {
display: block;
} }
\ No newline at end of file
...@@ -68,26 +68,34 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ...@@ -68,26 +68,34 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
public function getDescription() { public function getDescription() {
$html = [$this->getBadges()];
if (!$this->_model->getNoticeOPAC()) if (!$this->_model->getNoticeOPAC())
return ''; return implode($html);
$wrapper = (new Intonation_Library_View_Wrapper_Record) $wrapper = (new Intonation_Library_View_Wrapper_Record)
->setView($this->_view) ->setView($this->_view)
->setModel($this->_model->getNoticeOPAC()); ->setModel($this->_model->getNoticeOPAC());
return $wrapper->getDescription(); $html [] = $wrapper->getDescription();
return implode($html);
} }
public function getFullDescription() { public function getFullDescription() {
$html = [$this->getBadges()];
if (!$this->_model->getNoticeOPAC()) if (!$this->_model->getNoticeOPAC())
return ''; return implode($html);