diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index 7c5d34453727577daf17ddd28d27756b951866be..ca0b78b59834a6e9898e5762bf83435384d75279 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -77,8 +77,8 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { public function indexAction() { $user = ZendAfi_Auth::getInstance()->getIdentity(); - $profils = Class_Profil::getLoader()->findAllByZoneAndBib($this->id_zone, - $this->id_bib); + $profils = Class_Profil::findAllByZoneAndBib($this->id_zone, + $this->id_bib); $profils_by_bib = array(); foreach ($profils as $profil) { @@ -266,6 +266,23 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { } + public function promoteAction() { + if ( !$profile = Class_Profil::find($this->_getParam('id_profil'))) { + $this->_helper->notify($this->_('Une erreur c\'est produite.')); + return $this->_redirectToIndex(); + } + + if ($profile->isPortail()) { + $this->_helper->notify($this->_('Une erreur c\'est produite.')); + return $this->_redirectToIndex(); + } + + (new Class_Profil_Promoter())->promote($profile); + + $this->_redirect('/opac/index/index/id_profil/' . Class_Profil::DEFAULT_PROFIL); + } + + protected function updateAccueil($profil) { $enreg = $this->_parseSaveContentString(); $enreg['use_parent_css'] = $this->_getParam('use_parent_css', $profil->getUseParentCss()); diff --git a/application/modules/admin/controllers/TemplateController.php b/application/modules/admin/controllers/TemplateController.php index eda524395f4983e33cabefc48f1730f117016835..a3df6a80fb8e4398ef6dfd619d9713901400a445 100644 --- a/application/modules/admin/controllers/TemplateController.php +++ b/application/modules/admin/controllers/TemplateController.php @@ -56,12 +56,12 @@ class Admin_TemplateController extends ZendAfi_Controller_Action { return $this->_redirectToIndex(); } - if(!$this->view->id_profile = $template->tryOn($profile)) { + if(!$id_profile = $template->tryOn($profile)) { $this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template')); return $this->_redirectToIndex(); } - $this->_redirect('/opac/index/index/id_profil/' . $this->view->id_profile); + $this->_redirect('/opac/index/index/id_profil/' . $id_profile); } diff --git a/application/modules/admin/views/scripts/profil/_profil_row.phtml b/application/modules/admin/views/scripts/profil/_profil_row.phtml index 9191b3aa4969bae80b23aa0a3ea5f6806178e06e..0f43b4ba536bea5fb24900fd3ab3cd58c3344395 100644 --- a/application/modules/admin/views/scripts/profil/_profil_row.phtml +++ b/application/modules/admin/views/scripts/profil/_profil_row.phtml @@ -1,12 +1,11 @@ <?php - include_once('_profil_drag_drop.phtml'); $this->current_profil = Class_Profil::getCurrentProfil(); + if ($this->profil->hasParentProfil()) $this->profil = $this->profil->getParentProfil(); - if ($this->profil->isTelephone()) { $icone = 'telephone'; $bulle="Interface pour téléphone"; @@ -50,7 +49,7 @@ if ($this->profil->isTelephone()) { $this->boutonIco('picto=' . $action['icon'], 'bulle=' . $action['help'])); } - if ($this->profil->isPortail() == 1) { + if ($this->profil->isPortail()) { $actions[]= ['action' => 'duplicate-config-modules', 'icon' => 'copy_module', 'help' => 'Appliquer la configuration des pages aux autres profils']; echo $this->tagAnchor($this->url(['action' => 'duplicate-config-modules', 'id_profil' => $this->profil->getId()]), @@ -58,11 +57,23 @@ if ($this->profil->isTelephone()) { 'alt' => 'Appliquer la configuration des pages aux autres profils', 'onclick' => 'javascript:if(!confirm(\'Cette action permet d\\\'appliquer le même affichage des notices, résultats de recherches, fil d\\\'arianne et style de page à l\\\'ensemble des profils du site. Attention, cela écrasera la configuration des autres profils. Continuer ?\')) return false;'])); } - else - echo - '<a href="'.BASE_URL.'/admin/profil/delete/id_profil/'.$this->profil->getId(). '">'. - $this->boutonIco("type=del"). - '</a>'; + else { + echo $this->tagAnchor(['module' => 'admin', + 'controller' => 'profil', + 'action' => 'delete', + 'id_profil' => $this->profil->getId()], + $this->boutonIco("type=del")); + + echo $this->renderModelAction($this->profil, + ['url' => ['module' => 'admin', + 'controller' => 'profil', + 'action' => 'promote', + 'id_profil' => $this->profil->getId()], + 'icon' => 'main_profil', + 'label' => $this->_('Devenir le profil principal'), + 'anchorOptions' => ['target' => '_blank', + 'onclick' => $this->confirm($this->_('Etes-vous sur de vouloir rendre le profil %s comme profil principal du site ?', $this->profil->getLibelle()))]]); + } ?> </div> diff --git a/application/modules/admin/views/scripts/profil/accueil.phtml b/application/modules/admin/views/scripts/profil/accueil.phtml index 2b2c1f496226a3e811b34771794854a56e75e132..261743f7ecdabde4b7e4c85e2aca69257cbb4943 100644 --- a/application/modules/admin/views/scripts/profil/accueil.phtml +++ b/application/modules/admin/views/scripts/profil/accueil.phtml @@ -3,4 +3,3 @@ if (!$this->isPopup()) echo $this->partial('profil/_profil_panel.phtml', ['profil' => $this->profil]); echo $this->renderForm($this->form); -?> diff --git a/application/modules/opac/controllers/AuthorController.php b/application/modules/opac/controllers/AuthorController.php index 4a53fbc214d831bb4bd47334e742f8ea740446ea..eeec805d4eb440bdc874edf0c1644cb11ef2bb04 100644 --- a/application/modules/opac/controllers/AuthorController.php +++ b/application/modules/opac/controllers/AuthorController.php @@ -20,25 +20,29 @@ */ class AuthorController extends ZendAfi_Controller_Action { - public function viewAction() { - if (!$author = $this->_findAuthor()) + + protected $_author; + + + public function preDispatch() { + parent::preDispatch(); + if (!$this->_author = $this->view->author = $this->_findAuthor()) throw new Zend_Controller_Action_Exception($this->view->_('Désolé, cette page n\'existe pas'), 404); + } + - $this->_addInspectorGadget($author); - $this->view->author_description = new Class_CodifAuteur_Description($author); + public function viewAction() { + $this->_addInspectorGadget($this->_author); + $this->view->author_description = new Class_CodifAuteur_Description($this->_author); $this->view->titre = $this->view->_('Auteur'); } public function renderYoutubeChannelAction() { session_write_close(); - - if (!$author = $this->_findAuthor()) - return $this->_helper->HTMLAjaxResponse(''); - $items = []; foreach((new Class_WebService_Youtube()) - ->videosOfChannel($author->getYoutubeChannelId()) as $video) { + ->videosOfChannel($this->_author->getYoutubeChannelId()) as $video) { $items[] = $this->view->tag('div', $this->view->tag('iframe', '', ['src' => $video->getEmbedUrl(), 'allow' => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture', @@ -69,4 +73,15 @@ class AuthorController extends ZendAfi_Controller_Action { return null; } + + + public function biographyAction() {} + + public function recordsAction() {} + + public function collaborationsAction() {} + + public function interviewsAction() {} + + public function youtubeChanAction() {} } \ No newline at end of file diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 63b2743e9bac2ca82d7082a0655b90c19b1840df..ccdff7df6cd41bc94fb2a8668363b631a59b42b6 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -110,7 +110,13 @@ class NoticeAjaxController extends ZendAfi_Controller_Action { $exemplaires = (new Class_CommSigb())->getDispoExemplaires($exemplaires); - $this->_sendResponseWithScripts($this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display)); + $html = $this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display); + + if (!empty($html)) + Class_ScriptLoader::getInstance() + ->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); "); + + $this->_sendResponseWithScripts($html); } @@ -277,6 +283,10 @@ class NoticeAjaxController extends ZendAfi_Controller_Action { $html = $add_album_tag . $html; + if (!empty($html)) + Class_ScriptLoader::getInstance() + ->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); "); + $this->_sendResponseWithScripts($html); } @@ -580,6 +590,6 @@ class NoticeAjaxController extends ZendAfi_Controller_Action { ->addJQueryReady("$('.document_author').removeClass('d-none'); $('.document_author').removeClass('disabled'); $('.document_author').removeClass('text-black-50'); "); $author_description = new Class_CodifAuteur_Description($author); - $this->_sendResponseWithScripts($this->view->renderAuthorDescription($author_description)); + $this->_sendResponseWithScripts($this->view->renderAuthor($author_description)); } } \ No newline at end of file diff --git a/application/modules/opac/controllers/RecordController.php b/application/modules/opac/controllers/RecordController.php index 3ff0821983416719aef8a3f0e564375523760aab..6c5a52a7da225cf253c57ba073d1d0fa57900515 100644 --- a/application/modules/opac/controllers/RecordController.php +++ b/application/modules/opac/controllers/RecordController.php @@ -32,6 +32,9 @@ class RecordController extends ZendAfi_Controller_Action { } + public function itemsAction() {} + + public function summaryAction() {} diff --git a/application/modules/opac/views/scripts/author/biography.phtml b/application/modules/opac/views/scripts/author/biography.phtml new file mode 100644 index 0000000000000000000000000000000000000000..03f860a53d59ffd9040d292e23d54769d25fd1dd --- /dev/null +++ b/application/modules/opac/views/scripts/author/biography.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->author_Biography($this->author); diff --git a/application/modules/opac/views/scripts/author/collaborations.phtml b/application/modules/opac/views/scripts/author/collaborations.phtml new file mode 100644 index 0000000000000000000000000000000000000000..a059b6ea92687d6ac6ac0ae3c8e80ce370553323 --- /dev/null +++ b/application/modules/opac/views/scripts/author/collaborations.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->author_Collaborations($this->author); diff --git a/application/modules/opac/views/scripts/author/interviews.phtml b/application/modules/opac/views/scripts/author/interviews.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0b579e216d4fc7da7cc26a6c536e450da69640b4 --- /dev/null +++ b/application/modules/opac/views/scripts/author/interviews.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->author_Interviews($this->author); diff --git a/application/modules/opac/views/scripts/author/records.phtml b/application/modules/opac/views/scripts/author/records.phtml new file mode 100644 index 0000000000000000000000000000000000000000..78908fe1a6be60da307b5114c35b2619434ba86d --- /dev/null +++ b/application/modules/opac/views/scripts/author/records.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->author_Records($this->author); diff --git a/application/modules/opac/views/scripts/author/view.phtml b/application/modules/opac/views/scripts/author/view.phtml index 76e47d2a08a27c3018c4002b8f7a635dbc5a4e2e..9d9fc6550f343686385c7aa8bcbb42e4a08db101 100644 --- a/application/modules/opac/views/scripts/author/view.phtml +++ b/application/modules/opac/views/scripts/author/view.phtml @@ -1,7 +1,2 @@ <?php -$this->openBoite($this->author_description->getLabel()); - echo $this->renderAuthorDescription($this->author_description); - -$this->closeBoite(); -?> diff --git a/application/modules/opac/views/scripts/author/youtube-chan.phtml b/application/modules/opac/views/scripts/author/youtube-chan.phtml new file mode 100644 index 0000000000000000000000000000000000000000..b882f523bfb92a627256b4c8327d64a0aacb8d20 --- /dev/null +++ b/application/modules/opac/views/scripts/author/youtube-chan.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->author_YoutubeChan($this->author); diff --git a/application/modules/opac/views/scripts/record/items.phtml b/application/modules/opac/views/scripts/record/items.phtml new file mode 100644 index 0000000000000000000000000000000000000000..b09d70a4d3abba9838a2ab87ad26874e4026c47b --- /dev/null +++ b/application/modules/opac/views/scripts/record/items.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->renderRecord_Items($this->record); \ No newline at end of file diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php index 9f90bf8ba766ce60a4400be18421574ec79b51b6..172d2ffc843ba6c8eca3c077d1042a8590ef40cf 100644 --- a/library/Class/Catalogue.php +++ b/library/Class/Catalogue.php @@ -326,7 +326,11 @@ class CatalogueLoader extends Storm_Model_Loader { return $this->getRequetesPanier($preferences); $against = $this->selectionFacettesForCatalogueRequestByPreferences($preferences); - if ($catalogue = Class_Catalogue::getLoader()->find($preferences['id_catalogue'])) { + + $catalogue = null; + + if (isset($preferences['id_catalogue']) + && ($catalogue = Class_Catalogue::getLoader()->find($preferences['id_catalogue']))) { $conditions = [$this->facetsClauseFor($catalogue, $against)]; $conditions []= $this->docTypeClauseFor($catalogue); $conditions []= $this->yearClauseFor($catalogue); diff --git a/library/Class/CodifAuteur.php b/library/Class/CodifAuteur.php index 1ae9b079875be577871dffbaaac4971b166f8e47..31304c972c9ece4b97e2cb07ba0f7c763bc67071 100644 --- a/library/Class/CodifAuteur.php +++ b/library/Class/CodifAuteur.php @@ -21,6 +21,11 @@ class CodifAuteurLoader extends Storm_Model_Loader { + + const RECORDS_LOAD_LIMIT = 100; + const AUTHORS_FETCH_BIO_LIMIT = 50; + + public function findWithFullName($author) { if(!$author) return null; @@ -101,6 +106,148 @@ class CodifAuteurLoader extends Storm_Model_Loader { if($new_author = $notice->getAuteurWith($author->getFormes())) $author->setLibelle($new_author)->save(); } + + + public function findAllByPreferences($preferences) { + $preferences['nb_notices'] = static::RECORDS_LOAD_LIMIT; + return Class_CodifAuteur::findAllFromRecordsAndPreferences(Class_Notice::getNoticesFromPreferences($preferences), + $preferences); + } + + + public function findAllFromRecordsAndPreferences($records, $preferences) { + if (!$authors_ids = Class_CodifAuteur::findAllIdsFromRecordsAndPreferences($records, $preferences)) + return []; + + $params = ['id_auteur' => $authors_ids]; + + if ($with_thumbnail = isset($preferences['with_thumbnail']) && $preferences['with_thumbnail']) + $params ['where'] = 'thumbnail_url > \'\''; + + $size = (isset($preferences['size'])) + ? $preferences['size'] + : (isset($preferences['authors_count']) + ? $preferences['authors_count'] + : static::RECORDS_LOAD_LIMIT); + + $order_random = isset($preferences['order']) + && $preferences['order'] == Class_Systeme_ModulesAccueil_Authors::SORT_RANDOM; + + $params ['limit'] = $order_random + ? static::RECORDS_LOAD_LIMIT + : $size; + + $params ['order'] = isset($preferences['order']) + ? $preferences['order'] + : ''; + + if ($order_random) + $params ['order'] = ''; + + $authors = Class_CodifAuteur::findAllBy(array_filter($params)); + + if ($order_random) { + shuffle($authors); + $authors = array_slice($authors, 0, $size); + } + + return $authors; + } + + + public function findAllIdsFromRecordsAndPreferences($records, $preferences) { + if (!isset($preferences['authors_selection_mode']) + || !($mode = $preferences['authors_selection_mode'])) + return Class_CodifAuteur::findAllIdsFromRecords($records); + + if ($mode === Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_MAIN) + return Class_CodifAuteur::findAllMainIdsFromRecords($records); + + if ($mode === Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_RESPONSIBILITIES + && isset($preferences['responsibilities'])) + return Class_CodifAuteur::findAllIdsByResponsibilitiesIdsFromRecords($records, array_filter(explode(';', $preferences['responsibilities']))); + + return Class_CodifAuteur::findAllIdsFromRecords($records); + } + + + public function findAllIdsFromRecords($records) { + $authors_ids = []; + foreach($records as $record) + $authors_ids = array_merge($authors_ids, + Class_Notice_Facette::facetsValuesFromRecordFilteredBy($record, 'isAuthor')); + + return array_filter(array_unique($authors_ids)); + } + + + public function findAllMainIdsFromRecords($records) { + $authors_ids = array_map(function($record) + { + return current(Class_Notice_Facette::facetsValuesFromRecordFilteredBy($record, 'isAuthor')); + }, + $records); + + return array_filter(array_unique($authors_ids)); + } + + + public function findAllIdsByResponsibilitiesIdsFromRecords($records, $responsibilities_ids) { + if (!$responsibilities_ids) + return []; + + $responsibilities = Class_CodifAuteurFonction::findAllBy(['id_fonction' => $responsibilities_ids]); + + $responsibilities_labels = array_filter( + array_map(function($responsibility) + { + return $responsibility->getLibelle(); + }, + $responsibilities)); + + $authors_ids = []; + foreach($records as $record) { + $authors_ids = array_merge($authors_ids, + Class_CodifAuteur::findAllIdsByResponsibilitiesLabelsFromRecord($record, + $responsibilities_labels)); + } + + return array_filter(array_unique($authors_ids)); + } + + + public function findAllIdsByResponsibilitiesLabelsFromRecord($record, $responsibilities_labels) { + $authors = array_filter($record->getAuteursUnimarc(false, true), + function($author) use ($responsibilities_labels) + { + + return in_array($author->getFonction(), $responsibilities_labels); + }); + + return array_map(function($author) + { + return $author->getId(); + }, + $authors); + } + + + public function fetchBiographies($authors) { + array_map(function($author) + { + (new Class_CodifAuteur_Description($author))->fetchBiography(); + }, + $authors); + return $authors; + } + + + public function filterByValidThumbnail($authors) { + return array_filter($authors, function($author) + { + return $author->isThumbnailValid(); + }); + } } diff --git a/library/Class/CodifAuteur/Description.php b/library/Class/CodifAuteur/Description.php index a916cf8659bcdef9aa50eace6e1f50e31c9b2d59..8caa0165607a46f16ae06c7f72dfce2ae15e899b 100644 --- a/library/Class/CodifAuteur/Description.php +++ b/library/Class/CodifAuteur/Description.php @@ -214,7 +214,7 @@ class Class_CodifAuteur_Description { public function fetchBiography() { - $bio = new Class_Entity($this->_fetchBiography($this->_author, + $bio = new Class_Entity($this->_fetchBiography($this->_author, $this->getRecords(), $this->getAssociatedAuthors())); diff --git a/library/Class/Newsletter.php b/library/Class/Newsletter.php index ef4b22bbe152a87335581154f79ceb47cfb308dc..21941cec28f6b2b5f7602b8e42cf0c34c75dc324 100644 --- a/library/Class/Newsletter.php +++ b/library/Class/Newsletter.php @@ -241,7 +241,7 @@ class Class_Newsletter extends Storm_Model_Abstract { protected function _getMailPortail() { - $portail = Class_Profil::find(1); + $portail = Class_Profil::getPortail(); return $portail->getMailSite(); } diff --git a/library/Class/Notice.php b/library/Class/Notice.php index db1ff67bb7fd37488c159b1ff1b6fb634e5119b6..dff85e46d3bb22ae8d187eba7827952f9050f4ca 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -31,7 +31,8 @@ class NoticeLoader extends Storm_Model_Loader { $notices = $this->findAll($requetes["req_liste"]); // Tirage aleatoire - if ($preferences["aleatoire"] == 1) { + if (isset($preferences['aleatoire']) + && $preferences["aleatoire"] == 1) { shuffle($notices); $notices = array_slice($notices, 0, $preferences["nb_notices"]); } diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 7b274ed7d392dfac50ec05b52d51fe0c0f1488d5..d451ff59ff5944a29680e676dcca0b93bce021bf 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -51,8 +51,8 @@ class ProfilLoader extends Storm_Model_Loader { } - public function findAllByZoneAndBib($id_zone=0,$id_bib=0) { - $conditions = array('order' => 'libelle'); + public function findAllByZoneAndBib($id_zone = 0, $id_bib = 0) { + $conditions = ['order' => 'libelle']; $where = ''; if($id_zone and $id_zone !="ALL") { @@ -70,12 +70,12 @@ class ProfilLoader extends Storm_Model_Loader { $conditions["ID_SITE"] = $id_bib; } - return $this->findAllBy($conditions); + return Class_Profil::findAllBy($conditions); } public function getPortail() { - return $this->find(1); + return Class_Profil::find(Class_Profil::DEFAULT_PROFIL); } @@ -1794,7 +1794,13 @@ class Class_Profil extends Storm_Model_Abstract { * @return bool */ public function isPortail() { - return 1 === (int)$this->getId(); + return static::DEFAULT_PROFIL === (int) $this->getId(); + } + + + public function bePortail() { + $this->setId(static::DEFAULT_PROFIL); + return $this; } diff --git a/library/Class/Profil/Promoter.php b/library/Class/Profil/Promoter.php new file mode 100644 index 0000000000000000000000000000000000000000..9195799f51806ab131fc753ee85816ed7032b1f3 --- /dev/null +++ b/library/Class/Profil/Promoter.php @@ -0,0 +1,54 @@ +<?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_Profil_Promoter { + + use Trait_Translator; + + + public function promote($profile) { + if ($profile->isPortail()) + return $this; + + $portal = Class_Profil::getPortail(); + + $this + ->_backup($portal); + + $profile + ->bePortail() + ->setCommentaire($portal->getCommentaire()) + ->save(); + + return $this; + } + + + protected function _backup($portal) { + $portal + ->deepCopy() + ->setLibelle($this->_('Sauvegarde de : %s', $portal->getLibelle())) + ->save(); + + return $this; + } +} diff --git a/library/Class/Systeme/ModulesAccueil.php b/library/Class/Systeme/ModulesAccueil.php index 0a014b7b6758ce896486ff1e987b4b48956bf7ce..3a50c187b60430d8fc2fbe6e22abd47caec26423 100644 --- a/library/Class/Systeme/ModulesAccueil.php +++ b/library/Class/Systeme/ModulesAccueil.php @@ -157,18 +157,17 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { $profil = Class_Profil::getCurrentProfil(); $modules_accueil = Class_Systeme_ModulesAccueil::getInstance(); $modules = $modules_accueil->getModules(); - $groupes = $modules_accueil->getGroupes(); + $groupes = array_keys($modules_accueil->getGroupes()); $hierarchy = []; foreach($modules as $type => $module) { if (!$module->isVisibleForProfil($profil)) continue; - $group_label = $groupes[$module->getGroup()]; - if (!array_key_exists($group_label, $hierarchy)) - $hierarchy[$group_label] = []; + if (!array_key_exists($module->getGroup(), $hierarchy)) + $hierarchy[$module->getGroup()] = []; - $hierarchy[$group_label][$type] = $module->getLibelle(); + $hierarchy[$module->getGroup()][$type] = $module->getLibelle(); } return $hierarchy; diff --git a/library/Class/Systeme/ModulesAccueil/Authors.php b/library/Class/Systeme/ModulesAccueil/Authors.php index 8d8742866b41ad0c255a9714f2e418dc32b7c469..e3c0cc9f75b17f6232f8d526a8fa28326734fb27 100644 --- a/library/Class/Systeme/ModulesAccueil/Authors.php +++ b/library/Class/Systeme/ModulesAccueil/Authors.php @@ -22,6 +22,11 @@ class Class_Systeme_ModulesAccueil_Authors extends Class_Systeme_ModulesAccueil_Null { const CODE = 'AUTHORS', + + SORT_RANDOM = 'random', + SORT_SELECTION = '', + SORT_AUTHOR = 'libelle', + AUTHORS_SELECTION_MODE_ALL = 'all', AUTHORS_SELECTION_MODE_RESPONSIBILITIES = 'responsibilities', AUTHORS_SELECTION_MODE_MAIN = 'main'; @@ -38,6 +43,7 @@ class Class_Systeme_ModulesAccueil_Authors extends Class_Systeme_ModulesAccueil_ $this->_defaultValues = ['titre' => $this->_('Sélection d\'auteurs'), 'op_largeur_img' => 260, 'authors_count' => 10, + 'with_thumbnail' => true, 'authors_selection_mode' => static::AUTHORS_SELECTION_MODE_ALL]; } diff --git a/library/Class/Systeme/ModulesAccueil/MenuVertical.php b/library/Class/Systeme/ModulesAccueil/MenuVertical.php index 4b1b0b8e7bfda1531ad8cf972b4eeb84203c503c..564b71991fe1cd17601d29bb5bf993dbe6234549 100644 --- a/library/Class/Systeme/ModulesAccueil/MenuVertical.php +++ b/library/Class/Systeme/ModulesAccueil/MenuVertical.php @@ -95,7 +95,7 @@ class Class_Systeme_ModulesAccueil_MenuVertical extends Class_Systeme_ModulesAcc public function getMenus() { - $profiles = array_merge([Class_Profil::find(1)], + $profiles = array_merge([Class_Profil::getPortail()], Class_Profil::findTopProfils()); $menus = ['', static::NEW_MENU => $this->_('Créer un nouveau menu')]; diff --git a/library/Class/Template.php b/library/Class/Template.php index 24718cb38c0fdebc7c4bb1234d4b31dda5fef24a..b2cb13e26be123cd9a7bc56a3ee056fbeb99bb0d 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -200,16 +200,6 @@ class Class_Template { } - public function handleFooter() { - return false; - } - - - public function handleSideColumn() { - return true; - } - - public function handleRecordView() { return false; } @@ -268,11 +258,6 @@ class Class_Template { } - public function getTagEditSection($id_section, $view) { - return ''; - } - - public function getSection($id) { if(Class_Profil::DIV_FIRST_SIDE == $id) return new Class_Systeme_Widget_Section_FirstSide; @@ -340,6 +325,11 @@ class Class_Template { } + public function addAdminHelperPath($view) { + return $this; + } + + public function handleMappings($post) { return $post; } diff --git a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php index 30e69d1e7846f532d3cfb2a444acccc92c958338..20260353a2ab37b307002ef3b85b2080ec04d251 100644 --- a/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php +++ b/library/ZendAfi/Controller/Action/Helper/ViewRenderer.php @@ -45,7 +45,6 @@ class ZendAfi_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Acti public function preDispatch() { $this->_initializeHelperPaths(); - $request = $this->getRequest(); $this->view->setModuleControllerActionNames($request->getModuleName(), $request->getControllerName(), @@ -60,8 +59,10 @@ class ZendAfi_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Acti protected function _initializeHelperPaths() { $module = $this->getmodule(); + if (in_array($module, ['admin', 'cosmo'])) { $this->view->addHelperPath('ZendAfi/View/Helper/Admin/', 'ZendAfi_View_Helper_Admin'); + Class_Template::current()->addAdminHelperPath($this->view); return $this; } @@ -74,6 +75,7 @@ class ZendAfi_Controller_Action_Helper_ViewRenderer extends Zend_Controller_Acti $this->view->addHelperPath('ZendAfi/View/Helper/Java', 'ZendAfi_View_Helper_Java'); $this->view->addHelperPath('ZendAfi/View/Helper/Accueil', 'ZendAfi_View_Helper_Accueil'); $this->view->addScriptPath('.' . $profil_path . 'html'); + Class_Template::current()->addAdminHelperPath($this->view); Class_Template::current()->addHelperPath($this->view); return $this; } diff --git a/library/ZendAfi/Controller/Plugin/InspectorGadget.php b/library/ZendAfi/Controller/Plugin/InspectorGadget.php index 77d9ec6b98dbe4f857e09c9559c59464f61e9ddc..d1a0a4bc6d74f0b7cc46b41436ca1822a5529779 100644 --- a/library/ZendAfi/Controller/Plugin/InspectorGadget.php +++ b/library/ZendAfi/Controller/Plugin/InspectorGadget.php @@ -100,6 +100,14 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A return; } + if ($this->_buttons + && false !== strpos($this->_response->getBody(), '<div class="inspector_gadget"></div>')) { + $this->_response->setBody(str_replace('<div class="inspector_gadget"></div>', + '<div class="inspector_gadget">' . $html . '</div>', + $this->_response->getBody())); + return; + } + if ($this->_buttons && false !== strpos($this->_response->getBody(), '<div class="resultats_page">')) { $this->_response->setBody(str_replace('<div class="resultats_page">', diff --git a/library/ZendAfi/View/Helper/Accueil/Authors.php b/library/ZendAfi/View/Helper/Accueil/Authors.php index c8e517641f6517f4a6c8877a77e6888db38d6464..5f451ed6f260e9ddbaa6db79ff586289ea6f0021 100644 --- a/library/ZendAfi/View/Helper/Accueil/Authors.php +++ b/library/ZendAfi/View/Helper/Accueil/Authors.php @@ -32,27 +32,37 @@ class ZendAfi_View_Helper_Accueil_Authors extends ZendAfi_View_Helper_Accueil_Ba public function performAction($action) { - if ($action === 'refresh') - $this->refreshAuthorsWithoutThumbnail(); + if ($action === 'refresh') { + $this->preferences['with_thumbnail'] = false; + Class_CodifAuteur::fetchBiographies(Class_CodifAuteur::findAllByPreferences($this->preferences)); + } } - public function refreshAuthorsWithoutThumbnail() { - $authors = array_slice( - array_filter($this->_findAuthorsFromPreferences(false), - function($author) - { - return !$author->isThumbnailValid(); - }), - 0, - static::AUTHORS_FETCH_BIO_LIMIT); + protected function _renderContent() { + $authors = Class_CodifAuteur::filterByValidThumbnail(Class_CodifAuteur::findAllByPreferences($this->preferences)); + + return $this->_tag('div', + implode('', array_map([$this, '_renderAuthor'], + $authors)), + ['class' => 'authors_wall', + 'style' => 'column-width:' . $this->preferences['op_largeur_img'] . 'px']); + } + - array_map(function($author) - { - (new Class_CodifAuteur_Description($author))->fetchBiography(); - }, - $authors); - return $this; + protected function _renderAuthor($author) { + return $this->_tag('div', + $this->_tag('a', + $this->_tag('img', + null, + ['src' => $author->getThumbnailUrl(), + 'width' => $this->preferences['op_largeur_img'], + 'alt' => $author->getLibelle() . '. ' . $this->_('Source: Wikipedia')]), + ['href' => $this->view->url(['controller' => 'author', + 'action' => 'view', + 'id' => $author->getId()]), + 'title' => $this->_('En savoir plus sur %s', $author->getLibelle())]), + ['class' => 'author']); } @@ -79,137 +89,4 @@ class ZendAfi_View_Helper_Accueil_Authors extends ZendAfi_View_Helper_Accueil_Ba } ]; } - - - protected function _findAuthorsFromPreferences($with_thumbnail_only = true) { - $this->preferences['nb_notices'] = static::RECORDS_LOAD_LIMIT; - $records = Class_Notice::getNoticesFromPreferences($this->preferences); - return $this->_getAuthorsFromRecords($records, $with_thumbnail_only); - } - - - protected function _renderContent() { - $authors = array_filter($this->_findAuthorsFromPreferences(), - function($author) - { - return $author->isThumbnailValid(); - }); - - return $this->_tag('div', - implode('', array_map([$this, '_renderAuthor'], - $authors)), - ['class' => 'authors_wall', - 'style' => 'column-width:' . $this->preferences['op_largeur_img'] . 'px']); - } - - - protected function _getAuthorsFromRecords($records, $with_thumbnail_only) { - if (!$authors_ids = $this->_getAuthorsIdsFromRecords($records)) - return []; - - $params = ['id_auteur' => $authors_ids]; - - if ($with_thumbnail_only) { - $params['where'] = 'thumbnail_url > \'\''; - $params['limit'] = $this->preferences['authors_count']; - } - - return Class_CodifAuteur::findAllBy($params); - } - - - protected function _getAuthorsIdsFromRecords($records) { - if ($this->preferences['authors_selection_mode'] === Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_MAIN) - return $this->_getMainAuthorsFromRecords($records); - - if ($this->preferences['authors_selection_mode'] === Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_RESPONSIBILITIES) { - return $this->_getAuthorsByResponsibilitiesFromRecords($records); - } - - return $this->_getAllAuthorsFromRecords($records); - } - - - protected function _getAuthorsByResponsibilitiesFromRecords($records) { - $responsibilities_labels = $this->_getResponsibilitiesPreferenceLabels(); - - $authors_ids = []; - foreach($records as $record) { - $authors_ids = array_merge($authors_ids, - $this->_getAuthorsByResponsibilities($record, - $responsibilities_labels)); - } - - return array_filter(array_unique($authors_ids)); - } - - - protected function _getResponsibilitiesPreferenceLabels() { - $responsibilities_ids = array_filter(explode(';', - $this->preferences['responsibilities'])); - return array_filter( - array_map(function($responsibility) - { - return $responsibility->getLibelle(); - }, - $responsibilities_ids - ? Class_CodifAuteurFonction::findAllBy(['id_fonction' => $responsibilities_ids]) - : [])); - } - - - protected function _getAuthorsByResponsibilities($record, $responsibilities_labels) { - $authors = array_filter($record->getAuteursUnimarc(false, true), - function($author) use ($responsibilities_labels) - { - - return in_array($author->getFonction(), $responsibilities_labels); - }); - - return array_map(function($author) - { - return $author->getId(); - }, - $authors); - } - - - protected function _getMainAuthorsFromRecords($records) { - $authors_ids = array_map(function($record) - { - return current(Class_Notice_Facette::facetsValuesFromRecordFilteredBy($record, 'isAuthor')); - }, - $records); - - return array_filter(array_unique($authors_ids)); - } - - - protected function _getAllAuthorsFromRecords($records) { - $authors_ids = []; - foreach($records as $record) { - $authors_ids = array_merge($authors_ids, - Class_Notice_Facette::facetsValuesFromRecordFilteredBy($record, 'isAuthor')); - } - - return array_filter(array_unique($authors_ids)); - } - - - protected function _renderAuthor($author) { - return $this->_tag('div', - $this->_tag('a', - $this->_tag('img', - null, - ['src' => $author->getThumbnailUrl(), - 'width' => $this->preferences['op_largeur_img'], - 'alt' => $author->getLibelle() . '. ' . $this->_('Source: Wikipedia')]), - ['href' => $this->view->url(['controller' => 'author', - 'action' => 'view', - 'id' => $author->getId()]), - 'title' => $this->_('En savoir plus sur %s', $author->getLibelle())]), - ['class' => 'author']); - } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Base.php b/library/ZendAfi/View/Helper/Accueil/Base.php index 8d8c9e30d9661bbbf654cd308d62e2dff1314e67..35217781e83c66581ab46094488df362f55ff5b4 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -361,13 +361,9 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac ? $classname : self::getModuleHelperClass($type_module); - if (class_exists($classname)) { - $helper = new $classname($id_module, $module_params); - $helper->setView($view); - return $helper; - } - - return null; + $helper = new $classname($id_module, $module_params); + $helper->setView($view); + return $helper; } diff --git a/library/ZendAfi/View/Helper/Admin/FrontNavEntries.php b/library/ZendAfi/View/Helper/Admin/FrontNavEntries.php index 10cfc72115224b8c35b08d547e535b2942dc221f..a7a200869f825b12a751f20c71208ba47a3794b9 100644 --- a/library/ZendAfi/View/Helper/Admin/FrontNavEntries.php +++ b/library/ZendAfi/View/Helper/Admin/FrontNavEntries.php @@ -273,8 +273,10 @@ class ZendAfi_View_Helper_Admin_FrontNavEntries extends ZendAfi_View_Helper_Base return $this->_toggleAnchor($this->_('Déplacement des boites'), 'block_sorting', - sprintf('opacBlocksSorting(\'%s\',%d); $("div.layout-division>div").sortable("enable");', Class_Url::absolute('/admin/profil/module-sort'), Class_Profil::getCurrentProfil()->getId()), - '$("div.layout-division>div").sortable("disable");'); + sprintf('opacBlocksSorting(\'%s\',%d); $("div.layout-division>div, .section_content_wrapper").sortable(\'enable\');', + Class_Url::absolute('/admin/profil/module-sort'), + Class_Profil::getCurrentProfil()->getId()), + '$("div.layout-division>div, .section_content_wrapper").sortable("disable");'); } diff --git a/library/ZendAfi/View/Helper/LibrariesMap.php b/library/ZendAfi/View/Helper/LibrariesMap.php index 7a2d8cf39830452e713887223879bdf197539074..51329215bfdfa740b0b0c290468baf512f06c240 100644 --- a/library/ZendAfi/View/Helper/LibrariesMap.php +++ b/library/ZendAfi/View/Helper/LibrariesMap.php @@ -27,7 +27,7 @@ class ZendAfi_View_Helper_LibrariesMap extends ZendAfi_View_Helper_BaseHelper { CLOSE = 'close'; public function librariesMap($libraries, $container_selector, $preferences = []) { - if(!$libraries) + if (!$libraries) return ''; $container_id = sprintf('map_%s', md5($container_selector)); @@ -38,6 +38,15 @@ class ZendAfi_View_Helper_LibrariesMap extends ZendAfi_View_Helper_BaseHelper { ->addOPACStyleSheet('../js/openStreetMap/openStreetMap.css') ->addJQueryReady('$("'. $container_selector . '").openStreetMap();'); + $libraries = array_filter($libraries, + function($library) + { + return $library->hasLieu(); + }); + + if (!$libraries) + return ''; + $datas = []; foreach($libraries as $library) $datas[] = ['html' => $this->view->renderLibrary($library, $preferences), diff --git a/library/ZendAfi/View/Helper/ProfileComposition.php b/library/ZendAfi/View/Helper/ProfileComposition.php index 4deb63a05e70ea29015ef20f37e473bf54156e17..da92bbbaa00821d954de6e73ef4254979ef766f4 100644 --- a/library/ZendAfi/View/Helper/ProfileComposition.php +++ b/library/ZendAfi/View/Helper/ProfileComposition.php @@ -48,7 +48,7 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel $blocks[$groupe] = $this->_tag('div', $this->_tag('h5', $libelle) . $this->_tag('ul', - $this->_getAvailableWidgetsFor($libelle), + $this->_getAvailableWidgetsFor($groupe), ['class' => 'source_list'])); return $this->_tag('div', @@ -60,6 +60,7 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel protected function _getAvailableWidgetsFor($group) { $widgets = (new Class_Systeme_ModulesAccueil)->getWidgets(); + if(!isset($widgets[$group])) return ''; @@ -108,16 +109,12 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel protected function _getSideColumn() { - return Class_Template::current()->handleSideColumn() - ? $this->_getDivisionColumn(5, $this->_('Division flottante')) - : ''; + return $this->_getDivisionColumn(5, $this->_('Division flottante')); } protected function _getFooterColumn() { - return Class_Template::current()->handleFooter() - ? $this->_getDivisionColumn(Class_Profil::DIV_FOOTER, $this->_('Division pied de page')) - : ''; + return ''; } @@ -135,8 +132,7 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel return $this->_tag('div', $this->_tag('h5', - $label - . Class_Template::current()->getTagEditSection($column, $this->view)) + $label . $this->_getActions($column)) . $this->_tag('input', null, ['type' => 'hidden', 'name' => 'division' . $column]) . $this->_tag('ul', $this->_getHTMLForDivision($column), @@ -146,6 +142,11 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel } + protected function _getActions($column) { + return ''; + } + + protected function _getHTMLForDivision($division) { $profil = Class_Profil::getCurrentProfil(); $html = ''; @@ -156,10 +157,15 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel $html .= $this->_getItemModule($module['type_module'], Class_Systeme_ModulesAccueil::moduleByCode($module['type_module'])->getLibelle(), $id_module, - $helper->getConfig($id_module, - $module['type_module'], - $division)); + $this->_getWidgetActions($helper, $id_module, $module['type_module'], $division)); return $html; } + + + protected function _getWidgetActions($helper, $id_module, $type_module, $division) { + return $helper->getConfig($id_module, + $type_module, + $division); + } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/RenderAuthorDescription.php b/library/ZendAfi/View/Helper/RenderAuthorDescription.php index b9c0f88c782800eca2b248d3309bd27cc67b23ad..3760d0df442ceaaab123ab76f5c4f807e4b2d60a 100644 --- a/library/ZendAfi/View/Helper/RenderAuthorDescription.php +++ b/library/ZendAfi/View/Helper/RenderAuthorDescription.php @@ -27,15 +27,20 @@ class ZendAfi_View_Helper_RenderAuthorDescription extends ZendAfi_View_Helper_Ba ->addOPACScript('author_sheet.js') ->addJQueryReady('$("div#' . $div_id . '").authorSheet()'); + $html = [$this->view->openBoiteContent($author_description->getLabel()), - return $this->_tag('div', - $this->_renderBiography($author_description) - . $this->_renderAssociatedFacets($author_description) - . $this->_renderCollaborations($author_description) - . $this->_renderYoutube($author_description) - . $this->_renderRecords($author_description), - ['class' => 'author', - 'id' => $div_id]); + $this->_tag('div', + $this->_renderBiography($author_description) + . $this->_renderAssociatedFacets($author_description) + . $this->_renderCollaborations($author_description) + . $this->_renderYoutube($author_description) + . $this->_renderRecords($author_description), + ['class' => 'author', + 'id' => $div_id]), + + $this->view->closeBoiteContent()]; + + return implode($html); } diff --git a/library/ZendAfi/View/Helper/Widget/Section.php b/library/ZendAfi/View/Helper/Widget/Section.php index ba919a5b7c6e3fd2bb0d467a50e06b745b00a6ec..6c4e9d65a84a4b64a5eeee36ce0b9b9b7e09895d 100644 --- a/library/ZendAfi/View/Helper/Widget/Section.php +++ b/library/ZendAfi/View/Helper/Widget/Section.php @@ -94,7 +94,7 @@ class ZendAfi_View_Helper_Widget_Section extends ZendAfi_View_Helper_BaseHelper public function getAdminTools() { return $this->_tag('div', - $this->view->Admin_TagEditSection($this->_section), + $this->view->tagEditSection($this->_section), ['class' => 'section_configuration', 'style' => 'text-align:right']); } diff --git a/library/ZendAfi/View/Helper/Widget/Section/Main.php b/library/ZendAfi/View/Helper/Widget/Section/Main.php index fd7e3bb4abad2f11826dc96cff5853136c6c5a20..0e9e9b42892c5e9b30879f463302b27ad6e0cb85 100644 --- a/library/ZendAfi/View/Helper/Widget/Section/Main.php +++ b/library/ZendAfi/View/Helper/Widget/Section/Main.php @@ -28,7 +28,7 @@ class ZendAfi_View_Helper_Widget_Section_Main extends ZendAfi_View_Helper_Widget null, [function() { - return $this->view->Admin_TagEditSection($this->_section); + return $this->view->tagEditSection($this->_section); }]); } diff --git a/library/digital_resources/Lekiosk/tests/LekioskTest.php b/library/digital_resources/Lekiosk/tests/LekioskTest.php index 7c727e0607e9232b821ab297d678c7017c60aa4b..98eec122587706cc672412ba8219c07b9584815d 100644 --- a/library/digital_resources/Lekiosk/tests/LekioskTest.php +++ b/library/digital_resources/Lekiosk/tests/LekioskTest.php @@ -82,7 +82,7 @@ class LekioskLinkModeLinkTest extends LekioskLinkModeLinkTestCase { /** @test */ public function withEmptyUserMailShouldGetSiteOrProfileMail() { - Class_Profil::find(1)->setMailSite('toto@example.com'); + Class_Profil::getPortail()->setMailSite('toto@example.com'); $expected = 'https://pros.lekiosk.com/login/accesshash?email=bd612092eb8f12afc609f161d641ba9a4ac6b6e45bfae616f4994f9205f50a7d&id=66&AccessHash=4c09021c872852de07b4e5e89a9fc1659a3c293c'; $this->assertEquals($expected, (new Lekiosk_Link(''))->url()); } diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index 867e08589e3b8c624996b4ac017349698e548689..f70c8f43eeceaa1737828ff422f9295665c67934 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -497,6 +497,7 @@ dl.row { margin-top: 0 !important; } +.carousel .button_text, .card-deck .button_text, .card-columns .button_text { display: none !important; @@ -550,10 +551,17 @@ dl.row { right: 0 !important; } - .card-deck > .card, .card-columns > .card { overflow: hidden; } +.ui-sortable-placeholder { + visibility: visible !important; + background-color: var(--front-background-modale); + heigth: 200px; +} +.section_content_wrapper.ui-sortable { + height: 100%; +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/FormCustomizer/Abstract.php b/library/templates/Intonation/Library/FormCustomizer/Abstract.php index 1249beb81da32816786ec2e124a379effe67e7a4..5ce8baf9faf046507ee11d5e140c9d865660d4cc 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Abstract.php +++ b/library/templates/Intonation/Library/FormCustomizer/Abstract.php @@ -101,15 +101,6 @@ class Intonation_Library_FormCustomizer_Abstract { protected function _addResponsiveGroupTo() { $this->_form - ->addElement('select', - $this->_template->withNameSpace('hidden_mode'), - ['label' => $this->_('Visible à partir de la taille'), - 'value' => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, - 'multiOptions' => [Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL => $this->_('très petite ( inférieur à 575px )'), - Intonation_Library_Constants::RESPONSIVE_MODE_SMALL => $this->_('petite ( entre 575px et 767px )'), - Intonation_Library_Constants::RESPONSIVE_MODE_MEDIUM => $this->_('moyenne ( entre 768px et 991px )'), - Intonation_Library_Constants::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '), - Intonation_Library_Constants::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )')]]) ->addElement('select', $this->_template->withNameSpace('width_xsmall'), @@ -225,7 +216,7 @@ class Intonation_Library_FormCustomizer_Abstract { 'offset_large', 'offset_xlarge']), $this->_template->withNameSpace('responsive_group'), - ['legend' => $this->_('Thème %s : responsive', $this->_template->getId()), + ['legend' => $this->_('Adaptabilité'), 'order' => static::FOURTH]); return $this; } @@ -233,6 +224,17 @@ class Intonation_Library_FormCustomizer_Abstract { protected function _addControllerVisibilityGroupTo() { $this->_form + + ->addElement('select', + $this->_template->withNameSpace('hidden_mode'), + ['label' => $this->_('Visible à partir de la taille'), + 'value' => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL, + 'multiOptions' => [Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL => $this->_('très petite ( inférieur à 575px )'), + Intonation_Library_Constants::RESPONSIVE_MODE_SMALL => $this->_('petite ( entre 575px et 767px )'), + Intonation_Library_Constants::RESPONSIVE_MODE_MEDIUM => $this->_('moyenne ( entre 768px et 991px )'), + Intonation_Library_Constants::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '), + Intonation_Library_Constants::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )')]]) + ->addElement('checkbox', $this->_template->withNameSpace('visibility_index'), ['label' => $this->_('Index'), @@ -263,17 +265,20 @@ class Intonation_Library_FormCustomizer_Abstract { ['label' => $this->_('Authentification'), 'value' => 1]); - $this->_form->addDisplayGroup(array_map(function($element) - { - return $this->_template->withNameSpace('visibility_' . $element); - }, ['index', - 'recherche', - 'abonne', - 'cms', - 'blog', - 'auth']), + $elements_list = array_merge([$this->_template->withNameSpace('hidden_mode')], + array_map(function($element) + { + return $this->_template->withNameSpace('visibility_' . $element); + }, ['index', + 'recherche', + 'abonne', + 'cms', + 'blog', + 'auth'])); + + $this->_form->addDisplayGroup($elements_list, $this->_template->withNameSpace('visibility_group'), - ['legend' => $this->_('Thème %s : visibilité', $this->_template->getId()), + ['legend' => $this->_('Visibilité'), 'order' => static::FIFTH]); return $this; @@ -331,7 +336,7 @@ class Intonation_Library_FormCustomizer_Abstract { return $this->_template->withNameSpace($element); },$elements), $this->_template->withNameSpace('group'), - ['legend' => $this->_('Thème %s', $this->_template->getId()), + ['legend' => $this->_('Thème'), 'order' => static::FIRST]); return $this; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Author.php b/library/templates/Intonation/Library/View/Wrapper/Author.php new file mode 100644 index 0000000000000000000000000000000000000000..a73cb9abb8dafe85efe42c61c56d5d5d6c35db63 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author.php @@ -0,0 +1,207 @@ +<?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 Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wrapper_Abstract { + public function getMainTitle() { + return $this->_model->getLibelle(); + } + + + public function getMainLink() { + return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'view', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('En savoir plus'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'read-document', + 'library')), + 'Title' => $this->_('En savoir plus sur %s', $this->_model->getLibelle())]); + } + + + public function getEmbedMedia() { + } + + + public function getHtmlPicture() { + } + + + public function getPicture() { + return $this->_model->getThumbnailUrl(); + } + + + public function getPictureAction() { + } + + + public function getSecondaryTitle() { + } + + + public function getSecondaryLink() { + } + + + public function getSecondaryIco() { + } + + + public function getActions() { + $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'biography', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('Biographie'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'author', + 'library')), + 'Title' => $this->_('Lire la biographie de %s', $this->_model->getLibelle())]), + + new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'collaborations', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('Les collaborateurs'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'team', + 'library')), + 'Title' => $this->_('En savoir plus sur les collaborateurs de %s', $this->_model->getLibelle())]), + + new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'records', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('Les documents'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'related', + 'library')), + 'Title' => $this->_('En savoir plus sur les documents de %s', $this->_model->getLibelle())]), + + new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'interviews', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('Les interviews'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'reviews', + 'library')), + 'Title' => $this->_('Les interviews de %s', $this->_model->getLibelle())]), + + new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', + 'action' => 'youtube-chan', + 'id' => $this->_model->getId()]), + 'Text' => $this->_('La chaine YouTube'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'media', + 'library')), + 'Title' => $this->_('La chaine YouTube de %s', $this->_model->getLibelle())]) + ]; + + if (!Class_Users::isCurrentUserCanAccesBackend()) + return $actions; + + $description = new Class_CodifAuteur_Description($this->_model); + + if (!$records = $description->getRecords()) + return [$actions]; + + $record = array_shift($records); + + $actions_pro = [new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'biography', + 'auteur' => $description->getLabel(), + 'language' => Class_Profil::getCurrentProfil()->getLocale(), + 'id' => $record->getId()], null, true), + + 'Attribs' => ['class' => 'menu_admin_front_anchor'], + 'Image' => Class_Template::current()->getIco($this->_view, + 'refresh', + 'utils'), + 'Text' => $this->_('Modifier …'), + 'Popup' => true, + 'Title' => $this->_('Modifier la biographie de %s', + $this->_model->getLibelle())])]; + + $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), + 'Attribs' => ['class' => 'text-primary'], + 'Title' => $this->_('Voir plus d\'actions pour %s', + $this->_model->getLibelle()), + 'Image' => Class_Template::current()->getIco($this->_view, + 'more', + 'utils')]); + + $actions [] = $this->_view->renderDropdown($this->_view->renderActions($actions_pro), $button, 'dropleft dropup'); + return $actions; + } + + + public function getDescription() { + return + $this->getBadges() + . $this->_view->truncate($this->getFullDescription()); + } + + + public function getFullDescription() { + return ''; + } + + + public function getDescriptionTitle() { + return ''; + } + + + public function getBadges() { + $description = new Class_CodifAuteur_Description($this->_model); + $badges = []; + + foreach ($description->getFacets() as $facet_code => $count) { + $facet_label = Class_Notice_Facette::find($facet_code)->getLibelleFacette(); + $badges [] = ['tag' => 'a', + 'url' => Class_Url::assemble(['controller' => 'recherche', + 'action' => 'simple', + 'code_rebond' => $description->getFacetCode(), + 'facette' => $facet_code]), + 'class' => 'primary', + 'text' => $facet_label, + 'title' => $this->_('Voir les documents de %s correspondants au terme %s', + $description->getLabel(), + $facet_label)]; + } + + return $this->_view->renderBadges($badges); + } + + + public function getDocType() { + } + + + public function getDocTypeLabel() { + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent.php new file mode 100644 index 0000000000000000000000000000000000000000..a80e547bd672d0188f81bafad100d8840b771d7d --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent.php @@ -0,0 +1,48 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent extends Intonation_Library_View_Wrapper_RichContent_Abstract { + + public function getNavigation() { + return null; + } + + + public function getActions() { + return ''; + } + + + public function getRowActions() { + return ''; + } + + + protected function _getSectionsInstances() { + return [new Intonation_Library_View_Wrapper_Author_RichContent_Home, + new Intonation_Library_View_Wrapper_Author_RichContent_Biography, + new Intonation_Library_View_Wrapper_Author_RichContent_Records, + new Intonation_Library_View_Wrapper_Author_RichContent_Collaborations, + new Intonation_Library_View_Wrapper_Author_RichContent_Interviews, + new Intonation_Library_View_Wrapper_Author_RichContent_Youtube]; + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Biography.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Biography.php new file mode 100644 index 0000000000000000000000000000000000000000..ae30ddea57648efeaba1d62a09e2c6183b040622 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Biography.php @@ -0,0 +1,57 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Biography extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return $this->_('Biographie'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->Author_RenderWikipedia(new Class_CodifAuteur_Description($this->_model)); + } + + + public function getClass() { + return 'author_biography'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'biography']; + } + + + public function getNavIco() { + return 'author'; + } + + + public function getNavTitle() { + return $this->_('Biographie de %s', $this->_model->getLibelle()); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Collaborations.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Collaborations.php new file mode 100644 index 0000000000000000000000000000000000000000..3d6e5bf1b35a0ca6ca22023fdd6edae33fdecd34 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Collaborations.php @@ -0,0 +1,57 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Collaborations extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return $this->_('Les collaborateurs'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->Author_RenderCollaborations(new Class_CodifAuteur_Description($this->_model)); + } + + + public function getClass() { + return 'author_collaborations'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'collaborations']; + } + + + public function getNavIco() { + return 'team'; + } + + + public function getNavTitle() { + return $this->_('Les collaborateurs de %s', $this->_model->getLibelle()); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Home.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Home.php new file mode 100644 index 0000000000000000000000000000000000000000..76a411273af16e83fca25175c422fc9cfd9ceee3 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Home.php @@ -0,0 +1,59 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Home extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return ''; + } + + + public function getContent() { + return true; + } + + + public function getClass() { + return 'all_author_data'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'view']; + } + + + public function getNavIco() { + return 'home'; + } + + + public function getNavTitle() { + return $this->_('Toutes les informations de sur l\'auteur'); + } + + + public function handleSection() { + return false; + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Interviews.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Interviews.php new file mode 100644 index 0000000000000000000000000000000000000000..dba3212e8b2b3b2007c43e6398f68d795b4fb36d --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Interviews.php @@ -0,0 +1,57 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Interviews extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return $this->_('Les interviews'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->Author_RenderInterviews(new Class_CodifAuteur_Description($this->_model)); + } + + + public function getClass() { + return 'author_interviews'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'interviews']; + } + + + public function getNavIco() { + return 'reviews'; + } + + + public function getNavTitle() { + return $this->_('Les interviews de %s', $this->_model->getLibelle()); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Records.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Records.php new file mode 100644 index 0000000000000000000000000000000000000000..488c77cada0e9c540306901cfb9911f241cfbf53 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Records.php @@ -0,0 +1,57 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Records extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return $this->_('Les documents'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->Author_RenderRecords(new Class_CodifAuteur_Description($this->_model)); + } + + + public function getClass() { + return 'author_records'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'records']; + } + + + public function getNavIco() { + return 'related'; + } + + + public function getNavTitle() { + return $this->_('Les documents de %s', $this->_model->getLibelle()); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Section.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Section.php new file mode 100644 index 0000000000000000000000000000000000000000..67928b9f7bb6987cea29f42164ae8e79590c37c6 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Section.php @@ -0,0 +1,23 @@ +<?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 + */ + + +abstract class Intonation_Library_View_Wrapper_Author_RichContent_Section extends Intonation_Library_View_Wrapper_RichContent_Section {} diff --git a/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Youtube.php b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Youtube.php new file mode 100644 index 0000000000000000000000000000000000000000..9a3a6d841432bf3ed86c0740a6dd98bbc7ac3e23 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Author/RichContent/Youtube.php @@ -0,0 +1,57 @@ +<?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 Intonation_Library_View_Wrapper_Author_RichContent_Youtube extends Intonation_Library_View_Wrapper_Author_RichContent_Section { + + public function getTitle() { + return $this->_('La chaine YouTube'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->Author_RenderYoutubeChan(new Class_CodifAuteur_Description($this->_model)); + } + + + public function getClass() { + return 'author_youtube_chan'; + } + + + public function getNavUrl() { + return ['controller' => 'author', + 'action' => 'youtube-chan']; + } + + + public function getNavIco() { + return 'media'; + } + + + public function getNavTitle() { + return $this->_('La chaine YouTube de %s', $this->_model->getLibelle()); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/Domain.php b/library/templates/Intonation/Library/View/Wrapper/Domain.php new file mode 100644 index 0000000000000000000000000000000000000000..2b6365191d623f760dca7c1536bd38ca6f36fbdb --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Domain.php @@ -0,0 +1,117 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_Library_View_Wrapper_Domain extends Intonation_Library_View_Wrapper_Abstract { + + public function getMainTitle() { + return $this->_model->getLibelle(); + } + + + public function getSecondaryTitle() { + return ''; + } + + + public function getDocType() { + return ''; + } + + + public function getDocTypeLabel() { + return ''; + } + + + public function getMainLink() { + return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche', + 'action' => 'simple', + 'id_catalogue' => $this->_model->getId()]), + + 'Image' => Class_Template::current()->getIco($this->_view, + 'read-document', + 'library'), + 'Text' => $this->_('Voir les documents'), + 'Title' => $this->_getMainLinkTitle()]); + } + + + protected function _getMainLinkTitle() { + return $this->_('Voir les documents de %s', + $this->getMainTitle()); + } + + + public function getPicture() { + return $this->_model->getUrlImg(); + } + + + public function getPictureAction() { + return ''; + } + + + public function getDescription() { + return ''; + } + + + public function getFullDescription() { + return ''; + } + + + public function getDescriptionTitle() { + return ''; + } + + + public function getSecondaryIco() { + return ''; + } + + + public function getSecondaryLink() { + return null; + } + + + public function getBadges() { + return ''; + } + + + public function getActions() { + return []; + } + + + public function getEmbedMedia() { + return ''; + } + + + public function getHtmlPicture() { + return ''; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Library.php b/library/templates/Intonation/Library/View/Wrapper/Library.php index 2fd586a421f6bfba397734fa5481e202a989fd12..2aee9e12fca67e88c23179fc99997b4acce035be 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library.php @@ -49,16 +49,16 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr return new Intonation_Library_Link(['Url' => $url, 'Image' => Class_Template::current()->getIco($this->_view, - 'library', + 'read-document', 'library'), - 'Text' => $this->_('Plus'), + 'Text' => $this->_('En savoir plus'), 'Title' => $this->_getMainLinkTitle()]); } protected function _getMainLinkTitle() { - return $this->_('En lire plus sur la bibliothèque %s', + return $this->_('En savoir plus sur la bibliothèque %s', $this->_model->getLibelle()); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent.php index 83467c820036afdfd5016d67f2995ecf61f6cf11..8500cbf63084c98ba0e986f2126cf312344f907a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent.php @@ -50,7 +50,7 @@ class Intonation_Library_View_Wrapper_Library_RichContent extends Intonation_Lib new Intonation_Library_View_Wrapper_Library_RichContent_Openings, new Intonation_Library_View_Wrapper_Library_RichContent_Details, new Intonation_Library_View_Wrapper_Library_RichContent_Map, - new Intonation_Library_View_Wrapper_Library_RichContent_Team, - new Intonation_Library_View_Wrapper_Library_RichContent_Agenda]; + new Intonation_Library_View_Wrapper_Library_RichContent_Agenda, + new Intonation_Library_View_Wrapper_Library_RichContent_Team]; } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Agenda.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Agenda.php index 4fa4bbb13a6866c1d2cb9fe5bb19e42fd36b239f..2b398ab403a45675c397e4dbb4c7e8e46bd4ab03 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Agenda.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Agenda.php @@ -31,29 +31,8 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Agenda extends Intonat public function getContent() { - Class_ScriptLoader::getInstance()->addOPACScript('calendrier'); return $this->_view->calendarContent($this->getCalendar(), $this->getPreferences()); - - if (!$articles = Class_Article::findAllBy(['id_lieu' => $this->_model->getIdLieu(), - 'status' => Class_Article::STATUS_VALIDATED, - 'debut not' => 'null', - 'events_fin >' => (new DateTime())->format('Y-m-d'), - 'order' => 'events_debut'])) - return ''; - - $articles = array_map(function($article) - { - return (new Intonation_Library_View_Wrapper_Article) - ->setModel($article) - ->setView($this->_view); - }, $articles); - - $callback = function($wrapped) { - return $this->_view->cardifyHorizontal($wrapped); - }; - - return $this->_view->renderTruncateList(new Storm_Collection($articles), $callback); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php index 753d32c04c2f8a47fc4d7860fd8e8f4b4c873aaa..7a101840f859a0b4d7ddd6d4de88fa3122be6278 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Details.php @@ -67,10 +67,73 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona . $this->_view->tag('p', $pret)); + $count = 0; + foreach($this->_model->getAllCustomFields()->getFieldValues() as $field) { + if ($field->getValue() === '') + continue; + + $count++; + $html [] = $this->_renderBlock($this->_renderOptions($field, $count), + $field->getLabel(), + 'custom' . $count); + } + + $html = array_map(function($content) + { + return $this->_view->div(['class' => 'col-12'], + $content); + }, + $html); + return $this->_view->grid(implode($html)); } + protected function _renderBlock($content, $title, $class_name, $display = true) { + $style = ($display) ? [] : ['style' => 'display:none;']; + return $this->_view->tag('div', + $this->_view->tag('h4', $title) . $this->_view->tag('dl', $content), + array_merge($style, ['class' => $class_name.' library_box'])); + } + + + protected function _renderOptions($field,$count) { + $options = $field->getSelectedOptionsList(); + + if (empty($options)) + return $this->_renderInfo($field->getValue(), + $field->getLabel() ,'custom'.$count); + + $content_options = ''; + foreach (array_filter($options) as $option) { + $cleaned_name = $this->_stripWord($option); + $content_options .= $this->_view->tag('dd', $option, ['class' => $cleaned_name]); + } + + return $content_options; + } + + + protected function _renderInfo($value, $label, $class_name,$display = true) { + $style = ($display) ? [] : ['style' => 'display:none;']; + $style = array_merge($style, ['class' => $class_name]) ; + + return $this->_view->tag('dt', $label, $style) . $this->_view->tag('dd', $value, $style); + } + + + protected function _stripWord($str, $charset ='utf-8') { + $str = htmlentities($str, ENT_NOQUOTES, $charset); + $str = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str); + $str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. 'œ' + $str = preg_replace('#&[^;]+;#', '', $str); // supprime les autres caractères + $str = preg_replace('#[^a-zA-Z0-9\-\._]#', '_', $str); + $str = mb_strtolower($str, $charset); + + return $str; + } + + public function getClass() { return 'library_details'; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Map.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Map.php index 0630d48837099ba81a45e45b6ce6946f63cee9c1..3c95bd283379d0ae06dd679b00011c58b84b367c 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Map.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Map.php @@ -33,11 +33,12 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Map extends Intonation Class_Systeme_ModulesAccueil_Library::FIELD_MAIL]); $id = 'map_' . uniqid(); - return $this->_view->div(['id' => $id], - $this->_view->librariesMap(Class_Bib::filterByCoordinates([$this->_model]), - '#' . $id, - ['osm_layer' => 1, - 'fields' => $fields])); + return ($map = $this->_view->librariesMap(Class_Bib::filterByCoordinates([$this->_model]), + '#' . $id, + ['osm_layer' => 1, + 'fields' => $fields])) + ? $this->_view->div(['id' => $id], $map) + : ''; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 0129058abc3a96d528e9825117a007c2a4f4cb65..b2c767292e4abf21f8f0df36f36052d5dc91ad96 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -123,17 +123,20 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getActions() { - $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'reserver', - 'record_id' => $this->_model->getId()]), - 'Text' => $this->_('Réserver'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'hold', - 'library')), - 'Title' => $this->_('Réserver le document %s', - $this->getMainTitle()), - 'Popup' => true])]; + $actions = []; + + if (!$this->_model->isRessourceNumerique()) + $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', + 'action' => 'reserver', + 'record_id' => $this->_model->getId()]), + 'Text' => $this->_('Réserver'), + 'Image' => (Class_Template::current() + ->getIco($this->_view, + 'hold', + 'library')), + 'Title' => $this->_('Réserver le document %s', + $this->getMainTitle()), + 'Popup' => true]); foreach((new Intonation_Library_UserPatcher)->getDefaultSelections() as $selection) { $selection diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php index 926cbc7ad940729da8b6c389bd0c48345d04e6ca..f3800f0452c58d509992433d7c8ebf5f28d11839 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php @@ -36,7 +36,7 @@ class Intonation_Library_View_Wrapper_Record_RichContent extends Intonation_Libr public function getActions() { - return $this->_view->renderAjax('noticeajax', 'resources', ['id' => $this->_model->getId()]); + return $this->_model->getResume(); } @@ -54,7 +54,7 @@ class Intonation_Library_View_Wrapper_Record_RichContent extends Intonation_Libr protected function _getSectionsInstances() { return [new Intonation_Library_View_Wrapper_Record_RichContent_Home, - new Intonation_Library_View_Wrapper_Record_RichContent_Summary, + new Intonation_Library_View_Wrapper_Record_RichContent_Items, new Intonation_Library_View_Wrapper_Record_RichContent_Details, new Intonation_Library_View_Wrapper_Record_RichContent_Media, new Intonation_Library_View_Wrapper_Record_RichContent_Reviews, diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Items.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Items.php new file mode 100644 index 0000000000000000000000000000000000000000..2a1739629fe2431bd152d41b379c45af7dcbac7d --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Items.php @@ -0,0 +1,60 @@ +<?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 Intonation_Library_View_Wrapper_Record_RichContent_Items extends Intonation_Library_View_Wrapper_Record_RichContent_Section { + + protected $_ajax = true; + + + public function getTitle() { + return $this->_('Exemplaires'); + } + + + public function getContent() { + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->renderAjax('noticeajax', 'resources', ['id' => $this->_model->getId()]); + } + + + public function getClass() { + return 'document_items'; + } + + + public function getNavUrl() { + return ['controller' => 'record', + 'action' => 'items']; + } + + + public function getNavIco() { + return 'hold'; + } + + + public function getNavTitle() { + return $this->_('Les Exemplaires du document'); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php index bf541d639bc59362b42081d6af34b585dc74e149..0acdb3b3f4141a2ee4386064518e64355755d9e2 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php @@ -28,11 +28,20 @@ class Intonation_Library_View_Wrapper_User_RichContent_Selections extends Intona public function getContent() { - return - $this->_view->abonne_Selections($this->_model->getPaniers()) - . $this->_view->bookmarkedSearches(Class_User_BookmarkedSearch::findAllBy(['id_user' => $this->_model->getId(), - 'order' => 'creation_date desc'])) - . $this->_view->renderNewsletters(Class_Newsletter::getPublishedNewsletters()); + $html = [$this->_view->abonne_Selections($this->_model->getPaniers()), + + $this->_view->bookmarkedSearches(Class_User_BookmarkedSearch::findAllBy(['id_user' => $this->_model->getId(), + 'order' => 'creation_date desc'])), + + $this->_view->renderNewsletters(Class_Newsletter::getPublishedNewsletters())]; + + $html = array_map(function($content) + { + return $this->_view->div(['class' => 'col-12 mb-5'], $content); + }, + $html); + + return $this->_view->grid(implode($html)); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php new file mode 100644 index 0000000000000000000000000000000000000000..292039295c8355087a94523ba28f4a58990b80d7 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.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 Intonation_Library_Widget_Carousel_Author_Definition extends Intonation_Library_Widget_Carousel_Definition { + + const + CODE = 'AUTHORS'; + + protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; + + + public function __construct() { + $this->_libelle = $this->_('Boite auteurs'); + $this->_form = 'Intonation_Library_Widget_Carousel_Author_Form'; + $this->_view_helper = 'Intonation_Library_Widget_Carousel_Author_View'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'layout' => static::WALL, + 'rendering' => static::CARD_OVERLAY, + 'rss' => false, + 'embeded_code' => false, + 'link_to_all' => false, + 'order' => Class_Systeme_ModulesAccueil_Authors::SORT_RANDOM, + 'size' => 9, + 'id_panier' => '', + 'id_catalogue' => '', + 'with_thumbnail' => true, + 'authors_selection_mode' => Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_ALL]; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Author/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Author/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..0b0b45e944437ed88fd2cf4b4392a199d767946f --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Author/Form.php @@ -0,0 +1,77 @@ +<?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 Intonation_Library_Widget_Carousel_Author_Form extends Intonation_Library_Widget_Carousel_Form { + + public function init() { + parent::init(); + + Class_ScriptLoader::getInstance() + ->addJQueryReady('radioToggleVisibilityForElement("input[name=\'authors_selection_mode\']", + $("#responsibilities").closest("tr"), + ["responsibilities"]);'); + + $authors_module = new Class_Systeme_ModulesAccueil_Authors(); + + $this + ->addElement('radio', + 'authors_selection_mode', + ['label' => $this->_('Auteurs sélectionnés'), + 'multiOptions' => $authors_module->getAuthorsSelectionModeOptions(), + 'value' => $authors_module->getDefaultAuthorsSelectionMode()]) + + ->addElement('listeSuggestion', + 'responsibilities', + ['label' => $this->_('Responsabilité auteur'), + 'rubrique' => 'responsibility']); + } + + + public function initDisplayGroups() { + parent::initDisplayGroups(); + $this->addToSelectionGroup(['authors_selection_mode', + 'responsibilities']); + } + + public function getOrders() { + return [Class_Systeme_ModulesAccueil_Authors::SORT_RANDOM => $this->_('Aléatoire'), + Class_Systeme_ModulesAccueil_Authors::SORT_AUTHOR => $this->_('Alphabétique sur les auteurs'), + Class_Systeme_ModulesAccueil_Authors::SORT_SELECTION => $this->_('Sélection') + ]; + } + + + public function customPopulate($datas) { + $this->replaceWith('data_sources', + ['domainePanier', + 'data_sources', + []]); + + $element = $this->getElement('data_sources'); + + $element + ->setOptions(['IdItems' => isset($datas['id_panier']) ? $datas['id_panier'] : '', + 'IdCategories' => isset($datas['id_catalogue']) ? $datas['id_catalogue'] : '']); + + return $this; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Author/View.php b/library/templates/Intonation/Library/Widget/Carousel/Author/View.php new file mode 100644 index 0000000000000000000000000000000000000000..f6efb523db6f50baad5962e3165580e3bdb15ebc --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Author/View.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_Library_Widget_Carousel_Author_View extends Intonation_Library_Widget_Carousel_View { + + + protected function _findElements() { + return Class_CodifAuteur::filterByValidThumbnail(Class_CodifAuteur::findAllByPreferences($this->_settings->getPreferences())); + } + + + protected function _getRSSUrl() { + return ''; + } + + + protected function _getLinkToAllParams() { + return ''; + } + + + protected function _getLinkToAllTitle() { + return ''; + } + + + protected function _getWrapper() { + return 'Intonation_Library_View_Wrapper_Author'; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Definition.php index 04e226b64ddf56c5897fd856e54d62973a8c0893..cfb77f522b7063b6f06e2fd40919ea10af02b616 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Definition.php @@ -25,6 +25,7 @@ class Intonation_Library_Widget_Carousel_Definition extends Class_Systeme_Module const WALL = 'wall', CAROUSEL = 'carousel', + HORIZONTAL_LISTING = 'horizontal_list', LISTING = 'list', LISTING_WITH_OPTIONS = 'list_with_options', MULTIPLE_CAROUSEL = 'multiple_carousel', diff --git a/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php new file mode 100644 index 0000000000000000000000000000000000000000..2ec23e5856ef91f057aa53742c0eed606d8e222a --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php @@ -0,0 +1,45 @@ +<?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 Intonation_Library_Widget_Carousel_Domain_Definition extends Intonation_Library_Widget_Carousel_Definition { + + const + CODE = 'DOMAIN_BROWSER'; + + protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; + + + public function __construct() { + $this->_libelle = $this->_('Boite domaines'); + $this->_form = 'Intonation_Library_Widget_Carousel_Domain_Form'; + $this->_view_helper = 'Intonation_Library_Widget_Carousel_Domain_View'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'layout' => static::WALL, + 'rendering' => static::CARD_OVERLAY, + 'rss' => false, + 'embeded_code' => false, + 'link_to_all' => false, + 'order' => Class_CriteresRecherche::SORT_PUBLICATION, + 'size' => 9, + 'root_domain_id' => '']; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Domain/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Domain/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..1022485d58ca63025018060529ef5f423e7a548d --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Domain/Form.php @@ -0,0 +1,44 @@ +<?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 Intonation_Library_Widget_Carousel_Domain_Form extends Intonation_Library_Widget_Carousel_Form { + + + public function customPopulate($datas, $form = null) { + parent::customPopulate($datas); + + return $this->replaceWith('data_sources', + ['domainSelect', + 'root_domain_id', + ['label' => $this->_('Choisissez le domaine de départ. Les domaines sélectionnables sont ceux qui ont des sous-domaines.'), + 'multiple_selection' => false, + 'items_selectable' => false, + 'url' => Class_Url::assemble(['module' => 'admin', + 'controller' => 'catalogue', + 'action' => 'browsable-domains'])]]); + } + + + public function getOrders() { + return ['libelle' => $this->_('Titre')]; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Domain/View.php b/library/templates/Intonation/Library/Widget/Carousel/Domain/View.php new file mode 100644 index 0000000000000000000000000000000000000000..3947c53245389c2fea4c22b0aef0bf96373e4dc4 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Carousel/Domain/View.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_Library_Widget_Carousel_Domain_View extends Intonation_Library_Widget_Carousel_View { + + use Trait_TimeSource; + + + protected function _findElements() { + $root = ($root = Class_Catalogue::find($this->_settings->getRootDomainId())) + ? $root + : Class_Catalogue::getRoot(); + + return Class_Catalogue::findAllBy(['parent_id' => $root->getId(), + 'order' => 'libelle']); + } + + + protected function _getRSSUrl() { + return ''; + } + + + protected function _getLinkToAllParams() { + return []; + } + + + protected function _getLinkToAllTitle() { + return ''; + } + + + protected function _getWrapper() { + return 'Intonation_Library_View_Wrapper_Domain'; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Form.php index 7e29ff86c14523bc588778e18aef11b90ffadb23..242a412f74e8c9ef3259e53ac8b2d067d29a679f 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Form.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Form.php @@ -53,7 +53,7 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration 'embeded_code', ['label' => $this->_('Proposer le code "embeded"')]) - ->addElement('text', + ->addElement('number', 'size', ['label' => $this->_('Nombre de documents à afficher'), 'size' => 2]) @@ -94,16 +94,18 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration public function getLayouts() { return [Intonation_Library_Widget_Carousel_Definition::CAROUSEL => $this->_('Carousel'), Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL => $this->_('Carousel à colonnes'), - Intonation_Library_Widget_Carousel_Definition::LISTING => $this->_('Liste'), - Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS => $this->_('Liste à interactions'), + Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING => $this->_('Liste horizontale'), + Intonation_Library_Widget_Carousel_Definition::LISTING => $this->_('Liste verticale'), + Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS => $this->_('Liste verticale à interactions'), Intonation_Library_Widget_Carousel_Definition::WALL => $this->_('Mur')]; } public function getRenderings() { - return [Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY => $this->_('Média'), - Intonation_Library_Widget_Carousel_Definition::CARD => $this->_('Média suivi par une description'), - Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD => $this->_('Média suivi par une description horizontal'), - Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION => $this->_('Uniquement une description')]; + return [Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION => $this->_('Description'), + Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY => $this->_('Média'), + Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD => $this->_('Média et description à droite'), + Intonation_Library_Widget_Carousel_Definition::CARD => $this->_('Média et description en dessous'), + ]; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Library/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Library/Form.php index b9ed578fcf2111830173345585b7cb30a62e0bf8..e32a51edf55c28a1a2ae5dfa7bbaf017813f6ce2 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Library/Form.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Library/Form.php @@ -33,8 +33,6 @@ class Intonation_Library_Widget_Carousel_Library_Form extends Intonation_Library 'multiOptions' => Class_Bib::findAllLabels(), 'selectedLabel' => $this->_('Bibliothèques affichées'), 'availableLabel' => $this->_('Bibliothèques disponibles')]]); - - return $this; } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php index 30b1d0d1ac7c24e4f1920c4ff89a25912722b028..c16f78ce9fd65face58b6e70325f9323efe05957 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php @@ -24,7 +24,7 @@ class Intonation_Library_Widget_Carousel_Record_Definition extends Intonation_Li const CODE = 'KIOSQUE'; - protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; + protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH; public function __construct() { diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index 7085bf298470c09242fd54246df8b1f24c639cc6..7054e80fdf1d1c5acd720053d2708b490c7effaf 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -139,6 +139,9 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help if (Intonation_Library_Widget_Carousel_Definition::LISTING_WITH_OPTIONS == $layout) return $this->view->renderTruncateList($elements, $content_callback); + if (Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING == $layout) + return $this->view->renderHorizontalList($elements, $content_callback); + return $this->view->renderMultipleCarousel($elements, $content_callback); } diff --git a/library/templates/Intonation/Library/Widget/Free/Definition.php b/library/templates/Intonation/Library/Widget/Free/Definition.php new file mode 100644 index 0000000000000000000000000000000000000000..4a96ccb7e02ed810990e4e2b918bb3e0c3004f6d --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Free/Definition.php @@ -0,0 +1,39 @@ +<?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 Intonation_Library_Widget_Free_Definition extends Class_Systeme_ModulesAccueil_Null { + + const + CODE = 'FREE'; + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_isPhone = false; + + + public function __construct() { + $this->_libelle = $this->_('Boite libre'); + $this->_form = 'Intonation_Library_Widget_Free_Form'; + $this->_view_helper = 'Intonation_Library_Widget_Free_View'; + $this->_defaultValues = ['titre' => $this->_libelle]; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Free/Form.php b/library/templates/Intonation/Library/Widget/Free/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..5a1c9187703aeb088f1f92176c45d949c524dc1f --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Free/Form.php @@ -0,0 +1,46 @@ +<?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 Intonation_Library_Widget_Free_Form extends ZendAfi_Form_Configuration_Widget_Base { + + public function init() { + parent::init(); + + return $this + ->addElement('treeSelect', + 'articles_selector', + ['CategoriesSelectable' => false, + 'MultipleSelection' => false]) + + ->addToSelectionGroup(['articles_selector']); + } + + + public function customPopulate($datas, $form = null) { + parent::customPopulate($datas); + + (new ZendAfi_Form_Configuration_Widget_Articles) + ->customPopulate($datas, $this); + + return $this; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Free/View.php b/library/templates/Intonation/Library/Widget/Free/View.php new file mode 100644 index 0000000000000000000000000000000000000000..ac27f2f909cbd8e50dd56113ee55f2524c0184e9 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Free/View.php @@ -0,0 +1,48 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_Library_Widget_Free_View extends Zendafi_View_Helper_Accueil_Base { + + public function getHtml() { + $this->titre = $this->_settings->getTitre(); + $this->contenu = $this->_getHTML(); + return $this->getHtmlArray(); + } + + + protected function _getHTML() { + $id = isset($this->preferences['id_items']) + ? $this->preferences['id_items'] + : []; + + if (!$id) + return ''; + + if (!$articles = Class_Article::getArticlesByPreferences($this->preferences)) + return ''; + + if (!$article = array_shift($articles)) + return ''; + + return $this->view->article_ReplaceWidgets($article->getFullContent()); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/System/Abstract.php b/library/templates/Intonation/System/Abstract.php index b16f26c317d1c794d74a9915596d1cc58c26db6a..759a3fea2df229afd32aeb978702c7ffb0378499 100644 --- a/library/templates/Intonation/System/Abstract.php +++ b/library/templates/Intonation/System/Abstract.php @@ -158,11 +158,11 @@ abstract class Intonation_System_Abstract { $request = Zend_Controller_Front::getInstance()->getRequest(); $controller = strtolower($request->getControllerName()); - return in_array($controller, $this->getAuthorizedControllers()); + return in_array($controller, $this->_getAuthorizedControllers()); } - public function getAuthorizedControllers() { + protected function _getAuthorizedControllers() { $controllers = []; if($this->isVisibleForIndexController()) @@ -192,6 +192,53 @@ abstract class Intonation_System_Abstract { } + public function isVisibleInControllers() { + return + $this->isVisibleForIndexController() + && $this->isVisibleForSearchController() + && $this->isVisibleForUserController() + && $this->isVisibleForCmsController() + && $this->isVisibleForBlogController() + && $this->isVisibleForAuthController(); + } + + + public function isInvisbleInControllers() { + return + !$this->isVisibleForIndexController() + && !$this->isVisibleForSearchController() + && !$this->isVisibleForUserController() + && !$this->isVisibleForCmsController() + && !$this->isVisibleForBlogController() + && !$this->isVisibleForAuthController(); + } + + + public function getInvisibleControllers() { + $controllers = []; + + if(!$this->isVisibleForIndexController()) + $controllers [] = $this->_('Index'); + + if(!$this->isVisibleForSearchController()) + $controllers [] = $this->_('Résultat de recherche'); + + if(!$this->isVisibleForUserController()) + $controllers [] = $this->_('Espace abonné'); + + if(!$this->isVisibleForCmsController()) + $controllers [] = $this->_('Articles, agenda, bibliothèque'); + + if(!$this->isVisibleForBlogController()) + $controllers [] = $this->_('Avis'); + + if(!$this->isVisibleForAuthController()) + $controllers [] = $this->_('Authentification'); + + return $controllers; + } + + public function isVisibleForIndexController() { $function_name = 'get' . Class_Template::current()->withNameSpace('visibility_index'); return call_user_func([$this, $function_name]); @@ -228,6 +275,26 @@ abstract class Intonation_System_Abstract { } + public function isVisibleFromXL() { + return $this->getIntonationHiddenMode() == Intonation_Library_Constants::RESPONSIVE_MODE_XLARGE; + } + + + public function isVisibleFromL() { + return $this->getIntonationHiddenMode() == Intonation_Library_Constants::RESPONSIVE_MODE_LARGE; + } + + + public function isVisibleFromM() { + return $this->getIntonationHiddenMode() == Intonation_Library_Constants::RESPONSIVE_MODE_MEDIUM; + } + + + public function isVisibleFromS() { + return $this->getIntonationHiddenMode() == Intonation_Library_Constants::RESPONSIVE_MODE_SMALL; + } + + protected function _defaultsSettings() { $map = ['expand_breakpoint' => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, 'hidden_mode' => Intonation_Library_Constants::WIDTH_AUTO, diff --git a/library/templates/Intonation/System/Section.php b/library/templates/Intonation/System/Section.php index 632e5cfa4ba11f1680396056d0bfd5929486e7de..c9ee281bdf4d07559669dcfd30a3c39cff5a04cf 100644 --- a/library/templates/Intonation/System/Section.php +++ b/library/templates/Intonation/System/Section.php @@ -55,7 +55,8 @@ class Intonation_System_Section extends Intonation_System_Abstract { if(is_array($classes)) $classes = trim(implode(' ', $classes)); - return ['class' => implode(' ', + return ['data-division' => $this->getId(), + 'class' => implode(' ', array_filter([$classes, $this->_getOrderClass(), $this->_getResponsiveWidths(), diff --git a/library/templates/Intonation/System/Section/Loader.php b/library/templates/Intonation/System/Section/Loader.php new file mode 100644 index 0000000000000000000000000000000000000000..74ff1a833e460eb513196289e140314b06633417 --- /dev/null +++ b/library/templates/Intonation/System/Section/Loader.php @@ -0,0 +1,44 @@ +<?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 Intonation_System_Section_Loader { + public function load($section_id) { + if ($section_id == Class_Profil::DIV_BANNIERE) + return new Intonation_System_Section_Header; + + if ($section_id == Class_Profil::DIV_FOOTER) + return new Intonation_System_Section_Footer; + + if ($section_id == Class_Profil::DIV_FIRST_SIDE) + return new Intonation_System_Section_FirstSide; + + if ($section_id == Class_Profil::DIV_MAIN) + return new Intonation_System_Section_Main; + if ($section_id == Class_Profil::DIV_SECOND_SIDE) + return new Intonation_System_Section_SecondSide; + + if ($section_id == Class_Profil::DIV_FLOTANTTE) + return new Intonation_System_Section_FloatSide; + + return new Intonation_System_Section; + } +} diff --git a/library/templates/Intonation/Template.php b/library/templates/Intonation/Template.php index b1f74d2e468a4ceccbdf9ea88affcbde32d02f43..45ed82624622452a97cd7ac6098a20541421046e 100644 --- a/library/templates/Intonation/Template.php +++ b/library/templates/Intonation/Template.php @@ -53,16 +53,6 @@ class Intonation_Template extends Class_Template { } - public function handleFooter() { - return true; - } - - - public function handleSideColumn() { - return false; - } - - public function handleRecordView() { return true; } @@ -138,6 +128,8 @@ class Intonation_Template extends Class_Template { Intonation_Library_Widget_Share_Definition::CODE => new Intonation_Library_Widget_Share_Definition, + Intonation_Library_Widget_Free_Definition::CODE => new Intonation_Library_Widget_Free_Definition, + Intonation_Library_Widget_Image_Definition::CODE => new Intonation_Library_Widget_Image_Definition, Intonation_Library_Widget_AdminTools_Definition::CODE => new Intonation_Library_Widget_AdminTools_Definition, @@ -157,6 +149,10 @@ class Intonation_Template extends Class_Template { Intonation_Library_Widget_Carousel_Library_Definition::CODE => new Intonation_Library_Widget_Carousel_Library_Definition, Intonation_Library_Widget_Carousel_Agenda_Definition::CODE => new Intonation_Library_Widget_Carousel_Agenda_Definition, + + Intonation_Library_Widget_Carousel_Author_Definition::CODE => new Intonation_Library_Widget_Carousel_Author_Definition, + + Intonation_Library_Widget_Carousel_Domain_Definition::CODE => new Intonation_Library_Widget_Carousel_Domain_Definition, ]; } @@ -203,15 +199,6 @@ class Intonation_Template extends Class_Template { } - public function getTagEditSection($id_section, $view) { - $section = (new Class_Systeme_Widget_Section) - ->setId($id_section) - ->setProfileId($this->getProfile()->getId()) - ->load(); - return $view->Admin_TagEditSection($section); - } - - public function getSection($id) { if(Class_Profil::DIV_FIRST_SIDE == $id) return new Intonation_System_Section_FirstSide; @@ -241,6 +228,12 @@ class Intonation_Template extends Class_Template { } + public function addAdminHelperPath($view) { + $view->addHelperPath('templates/Intonation/View/Admin', 'Intonation_View_Admin'); + return $this; + } + + public function handleMappings($post) { $post = parent::handleMappings($post); diff --git a/library/templates/Intonation/View/Abonne/LoansList.php b/library/templates/Intonation/View/Abonne/LoansList.php index e00d1c0adf0886fe41f6b4ba7f8d706521f425dc..20969cde31d90e01d0a966c4fe93d4937b05aa68 100644 --- a/library/templates/Intonation/View/Abonne/LoansList.php +++ b/library/templates/Intonation/View/Abonne/LoansList.php @@ -87,6 +87,9 @@ class Intonation_View_Abonne_LoansList extends ZendAfi_View_Helper_BaseHelper { ->setView($this->view); }, $loans->getArrayCopy()); + if (!$loans) + return ''; + $actions = [new Intonation_Library_Link(['Url' => ['controller' => 'abonne', 'action' => 'prolongerPret', 'id_pret' => $this->getRenewableLoans()], diff --git a/library/templates/Intonation/View/Admin/ProfileComposition.php b/library/templates/Intonation/View/Admin/ProfileComposition.php new file mode 100644 index 0000000000000000000000000000000000000000..4f36fbc892b1dbfd5ced621b6c9cfc73615551f4 --- /dev/null +++ b/library/templates/Intonation/View/Admin/ProfileComposition.php @@ -0,0 +1,72 @@ +<?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 Intonation_View_Admin_ProfileComposition extends ZendAfi_View_Helper_ProfileComposition { + + protected function _availableItems() { + $blocks = []; + foreach([Class_Systeme_ModulesAccueil::GROUP_INFO => $this->_('Contenu'), + Class_Systeme_ModulesAccueil::GROUP_RECH => $this->_('Catalogue'), + Class_Systeme_ModulesAccueil::GROUP_SITE => $this->_('Site'), + Class_Systeme_ModulesAccueil::GROUP_ABONNE => $this->_('Utilisateurs')] as $groupe => $libelle) + $blocks[$groupe] = $this->_tag('div', + $this->_tag('h5', $libelle) . + $this->_tag('ul', + $this->_getAvailableWidgetsFor($groupe), + ['class' => 'source_list'])); + + return $this->_tag('div', + $this->_tag('h4', $this->_('Boites disponibles')). + implode($blocks), + ['class' => 'drag_drop_container']); + } + + + protected function _getSideColumn() { + return ''; + } + + + protected function _getFooterColumn() { + return $this->_getDivisionColumn(Class_Profil::DIV_FOOTER, $this->_('Division pied de page')); + } + + + protected function _getActions($column) { + $section = (new Intonation_System_Section_Loader)->load($column); + return $this->view->tagEditSection($section) + . $this->view->tagVisibility($section); + } + + + protected function _getWidgetActions($helper, $id_module, $type_module, $division) { + $widget = (new Intonation_System_Widget) + ->setSettings((new Class_Systeme_Widget_Widget()) + ->setId($id_module) + ->setProfileId(Class_Profil::getCurrentProfil()->getId()) + ->setSection((new Intonation_System_Section_Loader)->load($division)) + ->load()); + + return parent::_getWidgetActions($helper, $id_module, $type_module, $division) + . $this->view->tagVisibility($widget); + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/TagEditSection.php b/library/templates/Intonation/View/Admin/TagEditSection.php similarity index 93% rename from library/ZendAfi/View/Helper/Admin/TagEditSection.php rename to library/templates/Intonation/View/Admin/TagEditSection.php index 1d03fe77183588a185bea4a769a5f17186aa62b0..b7a7c6496a6626eae68cc89bd2509522101b8091 100644 --- a/library/ZendAfi/View/Helper/Admin/TagEditSection.php +++ b/library/templates/Intonation/View/Admin/TagEditSection.php @@ -20,9 +20,9 @@ */ -class ZendAfi_View_Helper_Admin_TagEditSection extends ZendAfi_View_Helper_BaseHelper { +class Intonation_View_Admin_TagEditSection extends ZendAfi_View_Helper_BaseHelper { - public function Admin_TagEditSection($section) { + public function tagEditSection($section) { if (!Class_Users::isCurrentUserAllowedToEditProfile($section->getProfile())) return ''; diff --git a/library/templates/Intonation/View/Admin/TagVisibility.php b/library/templates/Intonation/View/Admin/TagVisibility.php new file mode 100644 index 0000000000000000000000000000000000000000..c79e4a4237cff760aefa8ba5c7ebde47826f3532 --- /dev/null +++ b/library/templates/Intonation/View/Admin/TagVisibility.php @@ -0,0 +1,111 @@ +<?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 Intonation_View_Admin_TagVisibility extends ZendAfi_View_Helper_BaseHelper { + public function tagVisibility($section_or_widget) { + Class_ScriptLoader::getInstance() + ->addFontAwesome(); + + $html = [$this->_getVisibility($section_or_widget), + + $this->_getResponsive($section_or_widget)]; + + return implode($html); + } + + + protected function _getVisibility($section_or_widget) { + $visibility = $this->_getVisibilityStatus($section_or_widget); + + return ($class = $visibility->getClass()) + ? $this->_htmlTag($this->_tag('i', '', ['class' => 'fa fa-eye ' . $class]), + $visibility->getText()) + : ''; + } + + + protected function _getVisibilityStatus($section_or_widget) { + $title = $section_or_widget->getTitle(); + + if ($section_or_widget->isVisibleInControllers()) + return new Class_Entity(['Class' => '']); + + if ($section_or_widget->isInvisbleInControllers()) + return new Class_Entity(['Class' => 'error', + 'Text' => $this->_('Visible dans aucune action.')]); + + return new Class_Entity(['Class' => 'warning', + 'Text' => $this->_('Visible que dans certaines actions.')]); + } + + + protected function _getResponsive($section_or_widget) { + $responsive = $this->_getResponsiveStatus($section_or_widget); + + $icos = []; + foreach($responsive->getIco() as $ico) + $icos [] = $this->_tag('i', + '', + ['class' => 'fa ' . $ico]); + + return $icos + ? $this->_htmlTag(implode($icos), $responsive->getText()) + : ''; + } + + + protected function _htmlTag($ico, $text) { + return + $this->_tag('span', + $ico . $this->_tag('p', $text, ['class' => 'hidden']), + ['class' => 'section_visibility']); + } + + + protected function _getResponsiveStatus($section_or_widget) { + if ($section_or_widget->isVisibleFromXL()) + return new Class_Entity(['Ico' => ['fa-mobile error', + 'fa-tablet error', + 'fa-desktop warning'], + 'Text' => $this->_('Visible à partir de la taille très grande (1200px).')]); + + if ($section_or_widget->isVisibleFromL()) + return new Class_Entity(['Ico' => ['fa-mobile error', + 'fa-tablet error', + 'fa-desktop success'], + 'Text' => $this->_('Visible à partir de la taille grande (991px).')]); + + if ($section_or_widget->isVisibleFromM()) + return new Class_Entity(['Ico' => ['fa-mobile error', + 'fa-tablet warning', + 'fa-desktop success'], + 'Text' => $this->_('Visible à partir de la taille moyenne (768px).')]); + + if ($section_or_widget->isVisibleFromS()) + return new Class_Entity(['Ico' => ['fa-mobile warning', + 'fa-tablet success', + 'fa-desktop success'], + 'Text' => $this->_('Visible à partir de la taille petite (575px).')]); + + return new Class_Entity(['Ico' => []]); + } +} diff --git a/library/templates/Intonation/View/Author/Biography.php b/library/templates/Intonation/View/Author/Biography.php new file mode 100644 index 0000000000000000000000000000000000000000..3d09dd76fc30abda67989be92d1478de93bceda9 --- /dev/null +++ b/library/templates/Intonation/View/Author/Biography.php @@ -0,0 +1,39 @@ +<?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 Intonation_View_Author_Biography extends Intonation_View_RenderAuthorDescription { + public function author_Biography($author) { + $html = $this->renderAuthorDescription(new Class_CodifAuteur_Description($author)); + $this->view->titre = $this->_('%s : Biographie', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('author_biography' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Author/Collaborations.php b/library/templates/Intonation/View/Author/Collaborations.php new file mode 100644 index 0000000000000000000000000000000000000000..03da75ed68e5ca38fd4cfc8f855d5941eb511780 --- /dev/null +++ b/library/templates/Intonation/View/Author/Collaborations.php @@ -0,0 +1,39 @@ +<?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 Intonation_View_Author_Collaborations extends Intonation_View_RenderAuthorDescription { + public function author_Collaborations($author) { + $html = $this->renderAuthorDescription(new Class_CodifAuteur_Description($author)); + $this->view->titre = $this->_('%s : Collaborateurs', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('author_collaborations' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Author/Interviews.php b/library/templates/Intonation/View/Author/Interviews.php new file mode 100644 index 0000000000000000000000000000000000000000..f11f12540880ef94ae43e105d9f2d7b62e5e442b --- /dev/null +++ b/library/templates/Intonation/View/Author/Interviews.php @@ -0,0 +1,39 @@ +<?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 Intonation_View_Author_Interviews extends Intonation_View_RenderAuthorDescription { + public function author_Interviews($author) { + $html = $this->renderAuthorDescription(new Class_CodifAuteur_Description($author)); + $this->view->titre = $this->_('%s : Interviews', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('author_interviews' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Author/Records.php b/library/templates/Intonation/View/Author/Records.php new file mode 100644 index 0000000000000000000000000000000000000000..3fad2c82a2d532e391b482cd0cbd63ecfc91d097 --- /dev/null +++ b/library/templates/Intonation/View/Author/Records.php @@ -0,0 +1,39 @@ +<?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 Intonation_View_Author_Records extends Intonation_View_RenderAuthorDescription { + public function author_Records($author) { + $html = $this->renderAuthorDescription(new Class_CodifAuteur_Description($author)); + $this->view->titre = $this->_('%s : Documents', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('author_records' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Author/RenderWikipedia.php b/library/templates/Intonation/View/Author/RenderWikipedia.php index 5eab828986180e02fef9adaab706dbe7940fab24..60e3aa14d931214ab0adbd3f580dce0e6f157139 100644 --- a/library/templates/Intonation/View/Author/RenderWikipedia.php +++ b/library/templates/Intonation/View/Author/RenderWikipedia.php @@ -66,9 +66,9 @@ class Intonation_View_Author_RenderWikipedia extends ZendAfi_View_Helper_BaseHel Class_ScriptLoader::getInstance()->addJQueryReady('$(".biography_scroll").scrollspy({target: "#' . $nav_id . '"});'); - return $this->view->grid($this->_div(['class' => 'col-4'], + return $this->view->grid($this->_div(['class' => 'd-none d-md-block col-md-4'], $nav) - . $this->_div(['class' => 'col-8'], + . $this->_div(['class' => 'col-12 col-md-8'], $this->_div(['class' => 'biography_scroll'], $edited_bio)) . $this->_div(['class' => 'col-12'], diff --git a/library/templates/Intonation/View/Author/YoutubeChan.php b/library/templates/Intonation/View/Author/YoutubeChan.php new file mode 100644 index 0000000000000000000000000000000000000000..14bc8d7a38e62bb9c8eed27f640443ce02f17400 --- /dev/null +++ b/library/templates/Intonation/View/Author/YoutubeChan.php @@ -0,0 +1,39 @@ +<?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 Intonation_View_Author_YoutubeChan extends Intonation_View_RenderAuthorDescription { + public function author_YoutubeChan($author) { + $html = $this->renderAuthorDescription(new Class_CodifAuteur_Description($author)); + $this->view->titre = $this->_('%s : Chaine YouTube', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('author_youtube_chan' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/BookmarkedSearches.php b/library/templates/Intonation/View/BookmarkedSearches.php index a0fc34fe67ac1a9d4da938d8079f33396b235495..1f11cd504496d6159df022754e47d5f80346ea27 100644 --- a/library/templates/Intonation/View/BookmarkedSearches.php +++ b/library/templates/Intonation/View/BookmarkedSearches.php @@ -34,7 +34,8 @@ class Intonation_View_BookmarkedSearches extends ZendAfi_View_Helper_BaseHelper return $this->view->cardifyHorizontal($wrapped); }; - $html = $this->_tag('h3', $this->_('Mes recherches suivies')); + $html = $this->_tag('h3', + $this->_('Mes recherches suivies')); if (!$searches) return diff --git a/library/templates/Intonation/View/CalendarContent.php b/library/templates/Intonation/View/CalendarContent.php index 1b2ec018128b82bcdb450823a587cecc976fdb2e..3712a7dbc1f271533795371c90a4f4b219601099 100644 --- a/library/templates/Intonation/View/CalendarContent.php +++ b/library/templates/Intonation/View/CalendarContent.php @@ -22,6 +22,8 @@ class Intonation_View_CalendarContent extends ZendAfi_View_Helper_CalendarContent { public function calendarContent($calendar, $settings = []) { + Class_ScriptLoader::getInstance()->addOPACScript('calendrier'); + $this->param = $settings; $this->calendar = $calendar; diff --git a/library/templates/Intonation/View/CardifyWithOverlay.php b/library/templates/Intonation/View/CardifyWithOverlay.php index f0ffcdd14fe16d5835365e323ce5f030526eaa51..c47a2bb3a66878d35652a38f8e1c325068b63049 100644 --- a/library/templates/Intonation/View/CardifyWithOverlay.php +++ b/library/templates/Intonation/View/CardifyWithOverlay.php @@ -56,6 +56,7 @@ class Intonation_View_CardifyWithOverlay extends ZendAfi_View_Helper_BaseHelper $main_link = $element ->getMainLink() ->setText($content) + ->setNoButtonText(true) ->setImage(''); $link = $this->view->tagAction($main_link); diff --git a/library/templates/Intonation/View/Jumbotron.php b/library/templates/Intonation/View/Jumbotron.php index 453eeb341bf86852f4c388b472d7b2e3f325a43d..7a7f24bd0cda581c03110c4799d85800e63b63b1 100644 --- a/library/templates/Intonation/View/Jumbotron.php +++ b/library/templates/Intonation/View/Jumbotron.php @@ -120,10 +120,12 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper { protected function _getRowActions() { + $html = $this->view->div(['class' => 'inspector_gadget'], ''); + if (!$rich_content = $this->_element->getRichContent()) - return; + return $html; - return $rich_content->getRowActions(); + return $rich_content->getRowActions() . $html; } @@ -152,7 +154,7 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper { 'class' => 'nav-link ' . $item->getClass() . ' ' . $item->getActiveClass()]; if ($item->isAjax() || (!$item->getContent())) - $params ['class'] .= ' disabled text-black-50'; + $params ['class'] .= ' text-black-50'; return $this->_tag('li', @@ -176,7 +178,7 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper { }, $sections); - $html = $this->_div(['class' => 'col-md-10 col-xl-9'], implode($html)); + $html = $this->_div(['class' => 'col-10 col-xl-9'], implode($html)); return $this->view->grid($html, [], diff --git a/library/templates/Intonation/View/Notice/Exemplaires.php b/library/templates/Intonation/View/Notice/Exemplaires.php index 158bd15cd915b86b5a38af5900a604f17bba2e23..447108cd5fadd7d9d4804d082bc1eb5b5c6c7af5 100644 --- a/library/templates/Intonation/View/Notice/Exemplaires.php +++ b/library/templates/Intonation/View/Notice/Exemplaires.php @@ -46,6 +46,6 @@ class Intonation_View_Notice_Exemplaires extends ZendAfi_View_Helper_BaseHelper ->setModel($element); }, $exemplaires); - return $this->view->renderTruncateList(new Storm_Collection($elements), $callback); + return $this->view->renderWall(new Storm_Collection($elements), $callback); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderAuthor.php b/library/templates/Intonation/View/RenderAuthor.php new file mode 100644 index 0000000000000000000000000000000000000000..c1bc8c3a707d72df684761972d50ea36a05c5f99 --- /dev/null +++ b/library/templates/Intonation/View/RenderAuthor.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_View_RenderAuthor extends ZendAfi_View_Helper_BaseHelper { + + public function renderAuthor($description) { + $html = [$this->_div(['class' => 'col-3'], + $this->view->Author_RenderThumbnail($description)), + + $this->_div(['class' => 'col-9 pl-3'], + $this->view->Author_RenderFacets($description)), + + $this->_div(['class' => 'col-12 mt-3'], + $this->view->Author_RenderWikipedia($description)), + + $this->_div(['class' => 'col-12 mt-3 text-right'], + $this->view->Author_EditBiographyUrl($description)), + + $this->_div(['class' => 'col-12 mt-3'], + $this->view->Author_RenderRecords($description)), + + $this->_div(['class' => 'col-12 mt-3'], + $this->view->Author_RenderCollaborations($description)), + + $this->_div(['class' => 'col-12 mt-3'], + $this->view->Author_RenderInterviews($description)), + + $this->_div(['class' => 'col-12 mt-3'], + $this->view->Author_RenderYoutubeChan($description)), + ]; + + return $this->view->grid(implode($html), [], ['class' => 'justify-content-between']); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderAuthorDescription.php b/library/templates/Intonation/View/RenderAuthorDescription.php index 4e800557d843bcb23506daaaec35603cc961368e..7da646c6d42653672d7760489c972ddf26f0a39c 100644 --- a/library/templates/Intonation/View/RenderAuthorDescription.php +++ b/library/templates/Intonation/View/RenderAuthorDescription.php @@ -19,34 +19,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Intonation_View_RenderAuthorDescription extends ZendAfi_View_Helper_BaseHelper { - +class Intonation_View_RenderAuthorDescription extends Intonation_View_Jumbotron_Abstract { public function renderAuthorDescription($description) { - $html = [$this->_div(['class' => 'col-3'], - $this->view->Author_RenderThumbnail($description)), - - $this->_div(['class' => 'col-9 pl-3'], - $this->view->Author_RenderFacets($description)), - - $this->_div(['class' => 'col-12 mt-3'], - $this->view->Author_RenderWikipedia($description)), + return $this->_core($description->getAuthor()); + } - $this->_div(['class' => 'col-12 mt-3 text-right'], - $this->view->Author_EditBiographyUrl($description)), - $this->_div(['class' => 'col-12 mt-3'], - $this->view->Author_RenderRecords($description)), + protected function _getWrappedInstance() { + return new Intonation_Library_View_Wrapper_Author; + } - $this->_div(['class' => 'col-12 mt-3'], - $this->view->Author_RenderCollaborations($description)), - $this->_div(['class' => 'col-12 mt-3'], - $this->view->Author_RenderInterviews($description)), + protected function _getRichContentInstance() { + return new Intonation_Library_View_Wrapper_Author_RichContent; + } - $this->_div(['class' => 'col-12 mt-3'], - $this->view->Author_RenderYoutubeChan($description)), - ]; - return $this->view->grid(implode($html), [], ['class' => 'justify-content-between']); + protected function _getPageTitle($wrapped) { + return $this->_('Page auteur %s', $wrapped->getMainTitle()); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderHorizontalList.php b/library/templates/Intonation/View/RenderHorizontalList.php new file mode 100644 index 0000000000000000000000000000000000000000..9d1bf495c51ec23a3c233a0e16202be783e75bca --- /dev/null +++ b/library/templates/Intonation/View/RenderHorizontalList.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_View_RenderHorizontalList extends ZendAfi_View_Helper_BaseHelper { + + public function renderHorizontalList($collection, $callback) { + $html = $collection + ->injectInto('', function($html, $element) use ($callback) + { + return $html . $callback($element); + }); + + return $this->_tag('div', + $html, + ['class' => 'card-deck bg-transparent']); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderNewsletters.php b/library/templates/Intonation/View/RenderNewsletters.php index a04c894f54fc36f0acbbb834fd1ba9c4958c46d0..5a440ed89134f507ff3953a2affeec3287013f6e 100644 --- a/library/templates/Intonation/View/RenderNewsletters.php +++ b/library/templates/Intonation/View/RenderNewsletters.php @@ -22,6 +22,9 @@ class Intonation_View_RenderNewsletters extends ZendAfi_View_Helper_BaseHelper { public function RenderNewsletters($newsletters) { + if (!$newsletters) + return ''; + $newsletters = array_map(function($newsletter) { return (new Intonation_Library_View_Wrapper_Newsletter) diff --git a/library/templates/Intonation/View/RenderRecord/Items.php b/library/templates/Intonation/View/RenderRecord/Items.php new file mode 100644 index 0000000000000000000000000000000000000000..f51478ea9bc943a231a33f4f8fb5465fe59c2a47 --- /dev/null +++ b/library/templates/Intonation/View/RenderRecord/Items.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2018, 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 Intonation_View_RenderRecord_Items extends Intonation_View_RenderRecord { + public function renderRecord_Items($record) { + $html = $this->renderRecord($record); + $this->view->titre = $this->_('%s : Exemplaires', + $this->view->titre); + return $html; + } + + + protected function _showSections($sections) { + foreach($sections as $section) + if ('document_items' == $section->getClass()) + return $section + ->beActive() + ->beVisible(); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderTruncateList.php b/library/templates/Intonation/View/RenderTruncateList.php index 9be1af765eb32b10cc916617bdc2ca1242f495e1..36f4c1f31ec079ed6240e6b8187d2bf042fa6071 100644 --- a/library/templates/Intonation/View/RenderTruncateList.php +++ b/library/templates/Intonation/View/RenderTruncateList.php @@ -56,7 +56,7 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper Class_ScriptLoader::getInstance() ->addSearchInputToContainer('#' . $container_id, '#' . $input_id, - '#' . $container_id . ' div.card *'); + '#' . $container_id . ' div.card *, .dropdown, .dropdown-menu'); Class_ScriptLoader::getInstance() ->addJQueryReady("var container = $('#" . $container_id . "');" diff --git a/library/templates/Intonation/View/TagAction.php b/library/templates/Intonation/View/TagAction.php index fe79cc8260338270c24de3d5efa167b58086d8b2..60922f48ba6f36f4144db11f56f29a5dbe1ea05d 100644 --- a/library/templates/Intonation/View/TagAction.php +++ b/library/templates/Intonation/View/TagAction.php @@ -77,6 +77,9 @@ class Intonation_View_TagAction extends ZendAfi_View_Helper_BaseHelper { if (!$text = $action->getText()) return ''; + if ($action->getNoButtonText()) + return $this->_tag('div', $text, ['class' => ' d-inline-block']); + if (!$img) return $this->_tag('div', $text, ['class' => ' d-inline-block button_text']); diff --git a/library/templates/Intonation/View/TagMedia.php b/library/templates/Intonation/View/TagMedia.php index 463ebf3583357a60d8cfe5ab3d4c75f12793473a..5bb62ea3ebb7956e09e7956a2ce53d8046c2e3c4 100644 --- a/library/templates/Intonation/View/TagMedia.php +++ b/library/templates/Intonation/View/TagMedia.php @@ -23,8 +23,7 @@ class Intonation_View_TagMedia extends ZendAfi_View_Helper_BaseHelper { public function tagMedia($instance, $attribs = [], $img_attribs = []) { if ($html = $instance->getHtmlPicture()) - return $this->_div($attribs, - $html); + return $this->_div($attribs, $html); if (!$media = $this->_getMedia($instance, $attribs, $img_attribs)) return ''; diff --git a/public/admin/css/config_accueil.css b/public/admin/css/config_accueil.css index 725fdaec57a1a331ae4d975ae8498efdef60c3a0..0ed085889f72f2253ac1466f6755b947f383df1f 100644 --- a/public/admin/css/config_accueil.css +++ b/public/admin/css/config_accueil.css @@ -91,16 +91,16 @@ } .profile_composition .placeholder { - background: var(--anchor); + background-color: var(--anchor); height: 1em; } .profile_composition .container_list li { - background: var(--line-highlight); + background-color: var(--line-highlight); } .profile_composition .container_list li * { - background: transparent; + background-color: transparent; } .profile_composition .drag_drop_container + h4, @@ -109,7 +109,41 @@ } .profile_composition .drag_drop_container + h4 { - background: var(--button-background); + background-color: var(--button-background); color: var(--button); border-bottom: 0; } + +.section_visibility { + position: relative; + margin-left: 5px; + cursor: help; +} + +.profile_composition .section_visibility .hidden { + display: none; + width: 100px; + position: absolute; + background-color: var(--widget-background); + border-radius: 5px; + box-shadow: 1px 1px 5px var(--widget-shadow); + box-sizing: border-box; + overflow: hidden; + text-transform: none; + line-height: 1em; + left: -40px; + top: 1.5em; + padding: 5px; + z-index: 101; + font-weight: normal; +} + +.section_visibility:hover .hidden { + display: inline-block; +} + +.section_visibility i { + font-size: 16px !important; + padding: 1px; + margin: 1px; +} \ No newline at end of file diff --git a/public/admin/css/front_nav.css b/public/admin/css/front_nav.css index ae87697ea656cdcb9ddfad017c9cb6027516140e..ee4524aa3196c5c0fea5c3217040eb17b780cf1f 100644 --- a/public/admin/css/front_nav.css +++ b/public/admin/css/front_nav.css @@ -3,6 +3,10 @@ body > .menu_admin_front { position: fixed; top: 0; left: 0; +} + +body > .menu_admin_front, +body .widget.admin_tools { z-index: 102; } @@ -274,4 +278,25 @@ article header .edit_article { .menu_admin_front a:hover { background-color: var(--line-highlight); +} + +body .required:after, +body .error, +body .errors, +body .errors *, +body .error * { + color: var(--error-text); +} + +body .notice { + color: var(--notice-text); +} + +body .success { + font-weight: bold; + color: var(--success-text); +} + +body .warning { + color: var(--warning-text); } \ No newline at end of file diff --git a/public/admin/js/cfg.accueil.js b/public/admin/js/cfg.accueil.js index 7a504fd6e86d50d69009e79a87d11ca096775671..7b54119d832ba5a51e710aa980df89fbbe595786 100644 --- a/public/admin/js/cfg.accueil.js +++ b/public/admin/js/cfg.accueil.js @@ -23,11 +23,11 @@ function opacBlocksSorting(moduleSortUrl, currentProfilId) { opacBlocksSortingInitPositions(); - $('div.layout-division>div').sortable({ + $('div.layout-division>div, .section_content_wrapper').sortable({ cursor: 'move', - connectWith: 'div.layout-division>div', + connectWith: 'div.layout-division>div, .section_content_wrapper', stop: function(event, ui){ - var newDivision = $(ui.item).parents('div.layout-division').attr("data-division"); + var newDivision = $(ui.item).parents('div.layout-division, [data-division]').attr("data-division"); var newPosition = $(ui.item).prevAll('div[data-position]').length; if (newDivision == $(ui.item).attr('data-division') && newPosition == $(ui.item).attr('data-position')) @@ -47,11 +47,13 @@ function opacBlocksSorting(moduleSortUrl, currentProfilId) { function opacBlocksSortingInitPositions() { - var currentPositions = [0, 0, 0]; - $("div.layout-division>div>div").each(function(k, item) { + var currentPositions = [0, 0, 0, 0, 0, 0]; + $("div.layout-division>div>div, .section_content_wrapper > .widget").each(function(k, item) { + if ("barre_nav" == $(item).attr("class")) return; - var division = $(item).parents("div.layout-division").attr("data-division"); + + var division = $(item).parents("div.layout-division, [data-division]").attr("data-division"); $(item).attr("data-position", currentPositions[division-1]); currentPositions[division-1]++; $(item).attr("data-division", division); diff --git a/public/opac/java/search_input/search_input.js b/public/opac/java/search_input/search_input.js index 8c5f3b1191c246a8261bc92645d67f4610c0e045..2f0dbd28dc6ab36b9a8011002e09797fb68f6f44 100644 --- a/public/opac/java/search_input/search_input.js +++ b/public/opac/java/search_input/search_input.js @@ -52,7 +52,11 @@ var onSearchInputChange = function(searchText) { var resetAll = function() { - html.find('*').removeClass(not_found_class).show(); + html + .find('*') + .not(default_fixed_display + options.fixed_display) + .removeClass(not_found_class) + .show(); } if (!searchText || searchText == "" || searchText == '*') @@ -76,7 +80,12 @@ var highlightItems = function(elements) { resetAll(); html.find('*').not(elements).not(default_fixed_display + options.fixed_display).addClass(not_found_class); - html.find(elements).parentsUntil(html).removeClass(not_found_class).show(); + html + .find(elements) + .parentsUntil(html) + .not(default_fixed_display + options.fixed_display) + .removeClass(not_found_class) + .show(); } searchText = accentsTidy(searchText); diff --git a/scripts/profil_to_portail.php b/scripts/profil_to_portail.php index fcfbb9b749b62a3e12408bd934f47276437c588b..cbadc114cabc2aa69195fdcda4cbb570439300a6 100644 --- a/scripts/profil_to_portail.php +++ b/scripts/profil_to_portail.php @@ -1,7 +1,7 @@ <?php require(__DIR__.'/../console.php'); -$portal = Class_Profil::find(1); +$portal = Class_Profil::getPortail(); if (!$new_portal = Class_Profil::find($argv[1])) { echo 'Profil not found. Given id: ' . $argv[1] . "\n"; diff --git a/tests/application/modules/admin/controllers/ModulesnoticeControllerTest.php b/tests/application/modules/admin/controllers/ModulesnoticeControllerTest.php index b01fa547b8d918f479b553dd17b189d05abb7f02..7edd6331bb5f936fdef9a949280aae0b5e5b735d 100644 --- a/tests/application/modules/admin/controllers/ModulesnoticeControllerTest.php +++ b/tests/application/modules/admin/controllers/ModulesnoticeControllerTest.php @@ -112,7 +112,7 @@ class ModulesnoticeControllerExemplairesPostWithErrorsTest extends Admin_Abstrac 'parent_id' => 1, 'libelle' => 'Cran/Accueil']) ->setLibelle(''); - Class_Profil::find(1)->setLargeurSite(1); + Class_Profil::getPortail()->setLargeurSite(1); $this->postDispatch('/admin/modulesnotice/exemplaires/id_profil/2', []); } @@ -144,13 +144,13 @@ class ModulesnoticeControllerExemplairesPostTest extends Admin_AbstractControlle 'libelle' => 'Cran/Accueil']); - $config = Class_Profil::find(1)->getCfgNoticeAsArray(); + $config = Class_Profil::getPortail()->getCfgNoticeAsArray(); $config['exemplaires']['annexe'] = '1'; $config['exemplaires']['bib'] = '0'; $config['exemplaires']['emplacement'] = '0'; $config['exemplaires']['order_by'] = 'b'; $config['exemplaires']['en_pret'] = 'en pret'; - Class_Profil::find(1) + Class_Profil::getPortail() ->setCfgNotice($config) ->assertSave(); @@ -180,7 +180,7 @@ class ModulesnoticeControllerExemplairesPostTest extends Admin_AbstractControlle /** @test */ public function parentProfilOneItemsSettingsShouldHaveOrderByA() { - $this->assertEquals('a', Class_Profil::find(1)->getItemsSettings()['order_by']); + $this->assertEquals('a', Class_Profil::getPortail()->getItemsSettings()['order_by']); } @@ -199,6 +199,6 @@ class ModulesnoticeControllerExemplairesPostTest extends Admin_AbstractControlle /** @test */ public function enPretShouldEqualEmprunte() { $this->assertEquals('emprunté', - Class_Profil::find(1)->getItemsSettings()['en_pret']); + Class_Profil::getPortail()->getItemsSettings()['en_pret']); } } \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/ProfilControllerTest.php b/tests/application/modules/admin/controllers/ProfilControllerTest.php index 6b201a6be244c71fb5cf96010c5c08e59586167d..9c091baf4c966815387f2b94725d58decc0bf348 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerTest.php @@ -1521,7 +1521,7 @@ class Admin_ProfilControllerProfilPortalLoginPagePostTest extends Admin_Abstract /** @test */ public function loginPageShouldBe2() { - $this->assertEquals(2, Class_Profil::find(1)->getLoginPage()); + $this->assertEquals(2, Class_Profil::getPortail()->getLoginPage()); } } @@ -1630,7 +1630,7 @@ class ProfilControllerPostDispatchAccueilProfilTest extends Admin_AbstractContro 'division2' => 'CALENDAR-0;PRETS-0;NEWSLETTERS-0;MULTIMEDIA-0', ]); - $this->_profil = Class_Profil::find(1); + $this->_profil = Class_Profil::getPortail(); } @@ -1681,7 +1681,7 @@ class ProfilControllerPostDispatchReferencementProfilTest extends Admin_Abstract 'ref_tags' => 'master,profile,web' ]); - $this->_profil = Class_Profil::find(1); + $this->_profil = Class_Profil::getPortail(); } @@ -1718,7 +1718,7 @@ class ProfilControllerDispatchReferencementProfilTest extends Admin_AbstractCont $this->dispatch('admin/profil/edit/id_profil/1', true); - $this->_profil = Class_Profil::find(1); + $this->_profil = Class_Profil::getPortail(); } diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php index 3825c8649501ef48b40b7da3e7851526fbd002c1..2837f8c8c0bb0a169d8dd6a740c85b9ba1f6e7ee 100644 --- a/tests/application/modules/opac/controllers/AuthControllerTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerTest.php @@ -1169,7 +1169,7 @@ class AuthControllerBoiteLoginPostTest extends AuthControllerPostSimpleSuccessfu /** @test */ public function responseShouldRedirectToReferrer() { - $this->assertRedirectTo(Class_Profil::find(1)->getUrl()); + $this->assertRedirectTo(Class_Profil::getPortail()->getUrl()); } } diff --git a/tests/application/modules/opac/controllers/BibControllerTest.php b/tests/application/modules/opac/controllers/BibControllerTest.php index 04acf742f59fab1193691b1083411a3de21f900d..9c5b0a0b8c160207ac3770131dbfbeff8fc184a4 100644 --- a/tests/application/modules/opac/controllers/BibControllerTest.php +++ b/tests/application/modules/opac/controllers/BibControllerTest.php @@ -1377,7 +1377,7 @@ class BibControllerBibSelectionUnselectPostDispatch extends BibControllerSelecti class BibControllerBibSelectionWithProfilIdParamTest extends BibControllerSelectionTestCase { public function setUp() { parent::setUp(); - Class_Profil::setCurrentProfil(Class_Profil::find(1)); + Class_Profil::setCurrentProfil(Class_Profil::getPortail()); (new Class_Session_Libraries)->setIds([1, 2]); $this->dispatch('opac/index/index/id_profil/1', true); } @@ -1394,7 +1394,7 @@ class BibControllerBibSelectionWithProfilIdParamTest extends BibControllerSelect class BibControllerBibSelectionWithProfilHasChangedTest extends BibControllerSelectionTestCase { public function setUp() { parent::setUp(); - Class_Profil::setCurrentProfil(Class_Profil::find(1)); + Class_Profil::setCurrentProfil(Class_Profil::getPortail()); (new Class_Session_Libraries)->setIds([1, 2]); $this->dispatch('opac/index/index/id_profil/2', true); } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index 473843de0f7b490b38ccc7d1e18a96949be107b5..479f4f3d55bd0e3e2e00ddd3e8777f555c0c9491 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -1748,7 +1748,7 @@ class CmsControllerDispatchViewSummaryTest extends AbstractControllerTestCase { 'toggle_menu' => 0, 'menu' => 'V']]]]; - $profile = Class_Profil::find(1) + $profile = Class_Profil::getPortail() ->setCfgMenus($cfg_menus) ->setCfgAccueil($cfg_accueil) ->assertSave(); diff --git a/tests/application/modules/opac/controllers/IndexControllerTest.php b/tests/application/modules/opac/controllers/IndexControllerTest.php index d3516064752d2aae8b8c0fca5c3da3c38a312ebe..83bbd165f548da1c73de7117218a535495a3a3b1 100644 --- a/tests/application/modules/opac/controllers/IndexControllerTest.php +++ b/tests/application/modules/opac/controllers/IndexControllerTest.php @@ -106,7 +106,7 @@ class IndexControllerAsAdminWithCssEditorAndNoHeaderCss extends IndexControllerA public function setUp() { parent::setUp(); - Class_Profil::find(1)->setHeaderCss(''); + Class_Profil::getPortail()->setHeaderCss(''); $this->dispatch('/?id_profil=1'); } @@ -190,7 +190,7 @@ class IndexControllerAsAdminWithCSSEditorAndUseParentCssFalseTest extends IndexC parent::setUp(); //@see http://forge.afi-sa.fr/issues/59813 - Class_Profil::find(1) + Class_Profil::getPortail() ->setUseParentCss(false) ->assertSave(); @@ -352,13 +352,13 @@ class IndexControllerAccessLevelWithLoginPageTest extends AbstractControllerTest public function setUp() { parent::setUp(); ZendAfi_Auth::getInstance()->clearIdentity(); - Class_Profil::setCurrentProfil(Class_Profil::find(1)); + Class_Profil::setCurrentProfil(Class_Profil::getPortail()); } /** @test */ public function sameLoginPageShouldNotRedirect() { - Class_Profil::find(1) + Class_Profil::getPortail() ->setAccessLevel(ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB) ->setLoginPage(1) ->assertSave(); @@ -393,7 +393,7 @@ class IndexControllerAccessLevelWithLoginPageTest extends AbstractControllerTest /** @test */ public function noLoginPageShouldNotRedirectToAdmin() { - Class_Profil::find(1) + Class_Profil::getPortail() ->setAccessLevel(ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB) ->setLoginPage(null) ->assertSave(); diff --git a/tests/library/Class/ProfilTest.php b/tests/library/Class/ProfilTest.php index 34e728a48e500780913ac9b5eb63276427ffccc5..1c22f0197c35cae98c0c05dd5ca0fb2dfb0da5d5 100644 --- a/tests/library/Class/ProfilTest.php +++ b/tests/library/Class/ProfilTest.php @@ -1306,7 +1306,7 @@ class ProfilWithPagesCopyTest extends ModelTestCase { $profil->assertSave(); Class_Profil::clearCache(); - $profil = Class_Profil::find(1); + $profil = Class_Profil::getPortail(); $this->_clone = $profil->deepCopy(); $this->_clone->assertSave(); } diff --git a/tests/library/Class/WebService/LastfmTest.php b/tests/library/Class/WebService/LastfmTest.php index 55563792128a83b977557a3a37abdad56b39ad59..8ea9c61f26947360e792fef0c38007042a19c1c0 100644 --- a/tests/library/Class/WebService/LastfmTest.php +++ b/tests/library/Class/WebService/LastfmTest.php @@ -153,7 +153,7 @@ class LastfmGetMorceauxNoTracksIntegrationTest extends ModelTestCase { public function setUp() { parent::setUp(); $this->_last_fm = new Class_WebService_Lastfm(); - $this->_album = $this->_last_fm->getMorceaux('uiaunesrttt', 'auierst'); + $this->_album = $this->_last_fm->getMorceaux('No track', 'Not found'); } diff --git a/tests/library/ZendAfi/View/Helper/Abonne/AbonnementTest.php b/tests/library/ZendAfi/View/Helper/Abonne/AbonnementTest.php index c402e75a86b0ab243add2348ab1595ce6519efb2..991d0de2fc2b2b413fdd7dbd8082e44d49288bbd 100644 --- a/tests/library/ZendAfi/View/Helper/Abonne/AbonnementTest.php +++ b/tests/library/ZendAfi/View/Helper/Abonne/AbonnementTest.php @@ -58,4 +58,4 @@ class View_Helper_Abonne_AbonnementTest extends ViewHelperTestCase { '//div[@class="abonnement"]', 'Votre abonnement est valide'); } -} \ No newline at end of file +} diff --git a/tests/scenarios/AuthorPage/AuthorPageTest.php b/tests/scenarios/AuthorPage/AuthorPageTest.php index 327a3fddd6f5bc1827e61e054450d2408f3856f9..d34b38b123a9677f01c762a4746ca3a0081ce0cd 100644 --- a/tests/scenarios/AuthorPage/AuthorPageTest.php +++ b/tests/scenarios/AuthorPage/AuthorPageTest.php @@ -212,7 +212,7 @@ class AuthorPageViewByIdTest extends AuthorPageTestCase { /** @test */ public function pageTitleShouldBeVictorHugo() { - $this->assertXPath('//title[text()="Auteur - Victor Hugo"]', $this->_response->getBody()); + $this->assertXPath('//title[text()="Auteur - Victor Hugo"]'); } @@ -401,7 +401,7 @@ class AuthorPageViewByNameTest extends AuthorPageTestCase { $this->dispatch('/author/view/named/Victor+Hugo'); - $this->assertXPathContentContains('//h1', 'Victor Hugo', $this->_response->getBody()); + $this->assertXPathContentContains('//h1', 'Victor Hugo'); } diff --git a/tests/scenarios/AuthorPage/AuthorWidgetTest.php b/tests/scenarios/AuthorPage/AuthorWidgetTest.php index 4c09bc448b1777ea90f1b09feac7f93c2b9dbbd4..af7b58786c54126a7948ab0e71d9fff86d7cc91f 100644 --- a/tests/scenarios/AuthorPage/AuthorWidgetTest.php +++ b/tests/scenarios/AuthorPage/AuthorWidgetTest.php @@ -184,7 +184,7 @@ class AuthorWidgetOnPageTest extends AuthorWidgetOnPageTestCase { { $this->assertEquals(3, $preferences['id_panier']); $this->assertEquals(10, $preferences['authors_count']); - $this->assertEquals(500, $preferences['nb_notices']); + $this->assertEquals(100, $preferences['nb_notices']); $this->assertEquals(Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_ALL, $preferences['authors_selection_mode']); return Class_Notice::findAll(); @@ -210,7 +210,8 @@ class AuthorWidgetOnPageTest extends AuthorWidgetOnPageTestCase { /** @test */ public function numberOfAuthorsShouldBeTwo() { $this->assertXPathCount('//div[@class="boite authors"]//div[@class="author"]', - 2); + 2, + $this->_response->getBody()); } @@ -449,7 +450,6 @@ class AuthorWidgetConfigurationWithDomainTest extends AuthorWidgetOnPageTestCase - class AuthorWidgetConfigurationPostTest extends AuthorWidgetOnPageTestCase { protected $_saved_settings; diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index b2592449879475f8277eafc6fabd3355309d7949..c47b908fa19bf7e6663dfea24a0a74950bf0e9bb 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -116,7 +116,7 @@ class TemplatesControllerResetIntonationTest extends TemplatesEnabledTestCase { parent::setUp(); $this->fixture('Class_Template_Settings', ['id' => 1, - 'template' => 'INTONATION']); + 'template' => 'INTONATION']); $this->dispatch('/admin/template/reset/template/INTONATION', true); } @@ -324,6 +324,18 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { '21' => ['division' => 3, 'type_module' => 'CALENDAR', 'preferences' => []], + + '22' => ['division' => 4, + 'type_module' => 'FREE', + 'preferences' => []], + + '23' => ['division' => 4, + 'type_module' => 'AUTHORS', + 'preferences' => []], + + '24' => ['division' => 4, + 'type_module' => 'DOMAIN_BROWSER', + 'preferences' => ['layout' => Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING]], ], 'section' => [ '1' => ['boite' => ['ultra_light_widget']]] @@ -1756,7 +1768,7 @@ class TemplateRenderWidgetTest extends TemplatesIntonationTestCase { } - /** @test */ + /** @test */ public function pageShouldBeHtml5Valid() { ZendAfi_Auth::getInstance()->clearIdentity(); $this->dispatch('/opac/widget/render/widget_id/17/profile_id/72/', true); @@ -1824,7 +1836,7 @@ class TemplatesArticlesWidgetTest extends TemplatesIntonationTestCase { class TemplatesCmsListActionTest extends TemplatesIntonationTestCase { /** @test */ public function dispatchShouldRenderSprechenSieDeutsh() { - $this->fixture('Class_Article', + $this->fixture('Class_Article', ['id' => 6, 'titre' => 'Sprechen Sie Deutsch ?', 'contenu' => '<p>Ich ...</p>']); @@ -2213,12 +2225,6 @@ class TemplatesRecordResumeDispatchTest extends TemplatesIntonationTestCase { } - /** @test */ - public function navLinkToRecordResumeShoulBeActive() { - $this->assertXPath('//ul[contains(@class, "nav-tabs")]//li/a[contains(@href, "record/summary")][contains(@class, "active")]'); - } - - /** @test */ public function pageShouldBeHtml5Valid() { $this->assertHTML5(); @@ -2359,7 +2365,7 @@ class TemplatesDispatchNoticeAjaxTracksTest extends TemplatesIntonationTestCase /** @test */ public function shouldDisplayAudio() { - $this->fixture('Class_TypeDoc', + $this->fixture('Class_TypeDoc', ['id' => 8, 'label' => 'mp3', 'famille_id' => Class_CodifTypeDoc::SONORE @@ -2496,7 +2502,7 @@ class TemplatesRecordDeleteReviewsActionTest extends TemplatesIntonationTestCase ['id' => 2, 'clef_oeuvre' => 'PSYKO', ]); - } + } /** @test */ @@ -2574,6 +2580,23 @@ class TemplatesDispatchRecordAuthorTest extends TemplatesIntonationTestCase { +class TemplatesDispatchRecordItemsTest extends TemplatesIntonationTestCase { + + /** @test */ + public function shouldRenderDescription() { + $record = $this->fixture('Class_Notice', + ['id' => 456, + 'type_doc' => 8, + 'clef_oeuvre' => 'THE BOOK OF SOULS', + 'facettes' => 'G13 M12']); + + $this->dispatch('/record/items/id/456/id_profil/72'); + $this->assertXPath('//div'); + } +} + + + class TemplatesDispatchNoticeajaxAuthorActionTest extends TemplatesIntonationTestCase { /** @test */ @@ -2768,17 +2791,17 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes ->getExemplaire() ->setTitre('Potter') ->setExemplaireOPAC($this->fixture('Class_Exemplaire', - ['id' => 967, - 'code_barres' => 123, - 'id_int_bib' => 1, - 'id_origine' => 1234, - 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PotterItem']]), - 'notice' => $this->fixture('Class_Notice', - ['id' => 889, - 'titre_principal' => 'Potter', - 'type_doc' => Class_TypeDoc::LIVRE, - 'url_image' => 'https://monimage.org', - 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm'])])); + ['id' => 967, + 'code_barres' => 123, + 'id_int_bib' => 1, + 'id_origine' => 1234, + 'zone995' => serialize([['clef' => 'a', 'valeur' => 'PotterItem']]), + 'notice' => $this->fixture('Class_Notice', + ['id' => 889, + 'titre_principal' => 'Potter', + 'type_doc' => Class_TypeDoc::LIVRE, + 'url_image' => 'https://monimage.org', + 'unimarc' => '00577nam0 2200181 450 001001500000010001800015100004100033101000800074200010700082210003000189215001100219461002000230606002900250676000800279700004500287801005600332940000700388frOr1314913787 a9781408812792 a20140320 0103 aEng1 aHarry Potter and the deathly hallowsdHarry Potter et les reliques de la mortfJoanne Kathleen Rowling aLondrescBloomsburyd2010 a831 p. 1tHarry Potterv7 aAnglais (langue)2Rameau a420 1aRowlingbJoanne Kathleenf1965-....4070 aFRbBibliothèque de l\'agglomération de Saint-Omer apm'])])); $potter ->parseExtraAttributes(['Dateretourprevue' => '29/10/1990', @@ -3202,7 +3225,7 @@ class TemplatesIntonationDispatchAbonneAjouterASelectionTest extends TemplatesIn class TemplatesIntonationDispatchAbonneAjouterLeDocumentALaSelectionTest extends TemplatesIntonationAccountTestCase { /** @test */ public function recordId89ShouldHaveBeenHadedToSelection2() { - $this->fixture('Class_Notice', + $this->fixture('Class_Notice', ['id' => 89, 'titre_principal' => 'Neige', 'type_doc' => 2, @@ -3408,7 +3431,7 @@ class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { } - /** @test */ + /** @test */ public function annecyCalendarShouldRenderAgenda() { $this->dispatch('/opac/cms/calendar/id_module/library_1/id_profil/72'); $this->assertXPath('//div', 'L\'agenda'); @@ -3633,4 +3656,233 @@ class TemplatesDispatchProfilAccueilTest extends TemplatesIntonationTestCase { public function formShouldContainsDataDivisions3() { $this->assertXPath('//form//div[@data-divisions="3"]'); } -} \ No newline at end of file + + + /** @test */ + public function aDivisionShouldBeInvisible() { + $this->assertXPath('//h5//span[contains(@class, "section_visibility")]//i[contains(@class, "warning")]'); + } +} + + + +class TemplatesDispatchProfilIndexTest extends TemplatesIntonationTestCase { + /** @test */ + public function linkToPromoteShouldBePresent() { + Class_Profil::getPortail()->setIdSite(1)->save(); + Class_Profil::find(72)->setIdSite(1)->save(); + $this->dispatch('/admin/profil/index'); + $this->assertXPath('//a[contains(@href, "/admin/profil/promote/id_profil/72")]', + $this->_response->getBody()); + } +} + + + +class TemplatesIntonationPromoteProfileTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/profil/promote/id_profil/72'); + } + + + /** @test */ + public function mainProfileShouldUseIntonationTemplate() { + $this->assertEquals('INTONATION', Class_Profil::getPortail()->getTemplate()); + } + + + /** @test */ + public function mainProfileShouldHaveNoComment() { + $this->assertEquals('', Class_Profil::getPortail()->getCommentaire()); + } + + + /** @test */ + public function intonationTestProfileShouldPersist() { + $this->assertNotNull(Class_Profil::find(72)); + } + + + /** @test */ + public function mainProfileShouldHaveBeenBackup() { + $this->assertEquals('Sauvegarde de : portail', Class_Profil::find(73)->getLibelle()); + } +} + + + +class TemplatesDispatchEditFreeWidgetTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/22/id_profil/72', true); + } + + + /** @test */ + public function inputTitreTypeShouldBeText() { + $this->assertXpath('//input[@name="titre"][@type="text"]'); + } +} + + + +class TemplatesDispatchIntonationWithFreeTest extends TemplatesIntonationTestCase { + + /** @test */ + public function facebookImageShouldBePresent() { + $this->dispatch('/opac/index/index/id_profil/72', true); + $this->assertXPathContentContains('//div', 'Boite libre'); + } +} + + + +class TemplatesDispatchEditAuthorWidgetTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/23/id_profil/72', true); + } + + + /** @test */ + public function inputTitreTypeShouldBeText() { + $this->assertXpath('//input[@name="titre"][@type="text"]'); + } +} + + + +class TemplatesDispatchIntonationWithAuthorWidgetTest extends TemplatesIntonationTestCase { + + /** @test */ + public function rahanAuthorShouldBePresent() { + $this->fixture('Class_Notice', + ['id' => 8, + 'type_doc' => Class_TypeDoc::LIVRE, + 'clef_alpha'=>'GAVROCHE_HUGO', + 'titre_principal' => 'Gavroche', + 'facettes' => 'A2408 A3 A666 G4 M6', + 'url_vignette' => 'gavroche.jpg']); + + $this->fixture('Class_CodifAuteur', + ['id' => 2408, + 'libelle' => 'Victor Hugo', + 'thumbnail_url' => 'http://wp/hugo.jpg']); + + $this + ->onLoaderOfModel('Class_Notice') + ->whenCalled('getNoticesFromPreferences') + ->answers(Class_Notice::findAll()); + + $this->dispatch('/opac/index/index/id_profil/72', true); + $this->assertXPathContentContains('//div', 'Victor Hugo'); + } +} + + +abstract class TemplatesIntonationWithAuthorTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $unimarc = (new Class_NoticeUnimarc_Fluent) + ->zoneWithContent('001', '12345') + + ->zoneWithChildren('200', ['f' => 'Iron Maiden']) + + ->zoneWithChildren('461', ['t' => 'The book of souls']); + + $this->fixture('Class_Notice', + ['id' => 456, + 'unimarc' => $unimarc->render(), + 'type_doc' => 8, + 'clef_oeuvre' => 'THE BOOK OF SOULS', + 'facettes' => 'G13 M12']); + + $this->fixture('Class_CodifAuteur', + ['id' => 10, + 'libelle' => 'Iron Maiden', + 'formes' => 'IRONxMAIDEN']); + } +} + + + +class TemplatesDispatchAuthorActionsTest extends TemplatesIntonationWithAuthorTest { + + /** @test */ + public function dispatchViewshouldDisplayAuthor() { + $this->dispatch('/author/view/id/10/id_profil/72'); + $this->assertXPath('//div'); + } + + + /** @test */ + public function dispatchBiograpryShouldDisplayBiography() { + $this->dispatch('/author/biography/id/10/id_profil/72'); + $this->assertXPath('//div'); + } + + + /** @test */ + public function dispatchRecordsShouldRenderBookOfSouls() { + $this->dispatch('/author/records/id/10/id_profil/72'); + $this->assertXPath('//div'); + } + + + /** @test */ + public function dispatchCollaborationsShouldRenderCollaborations() { + $this->dispatch('/author/collaborations/id/10/id_profil/72'); + $this->assertXPath('//div'); + } + + + /** @test */ + public function dispatchInterviewsShouldRenderInterviews() { + $this->dispatch('/author/interviews/id/10/id_profil/72'); + $this->assertXPath('//div'); + } + + + /** @test */ + public function dispatchYoutubeChanShouldRenderYoutubeChan() { + $this->dispatch('/author/youtube-chan/id/10/id_profil/72'); + $this->assertXPath('//div'); + } +} + + + +class TemplatesDispatchDomainWidgetTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/widget/edit-widget/id/24/id_profil/72', true); + } + + + /** @test */ + public function inputTitreTypeShouldBeText() { + $this->assertXpath('//input[@name="titre"][@type="text"]'); + } +} + + + +class TemplatesDispatchIntonationWithDomainWidgetTest extends TemplatesIntonationTestCase { + + /** @test */ + public function facebookImageShouldBePresent() { + $this->fixture('Class_Catalogue', + ['id' => 3, + 'libelle' => 'Jeunesse', + 'parent_id' => 0]); + + $this->dispatch('/opac/index/index/id_profil/72', true); + $this->assertXPathContentContains('//div', 'Boite domaines'); + } +} diff --git a/tests/scenarios/Versionning/VersionningWidgetTest.php b/tests/scenarios/Versionning/VersionningWidgetTest.php index ff120ff75f38c25557bd790cb8af7d335aefe61a..fe6151484b0851e2233831e82a23f6de49ee5dc7 100644 --- a/tests/scenarios/Versionning/VersionningWidgetTest.php +++ b/tests/scenarios/Versionning/VersionningWidgetTest.php @@ -254,7 +254,7 @@ class VersionningWidgetNewsDeleteTest extends VersionningWidgetNewsTestCase { /** @test */ public function widgetShouldBeDeleted() { - $this->assertEmpty(Class_Profil::find(1) + $this->assertEmpty(Class_Profil::getPortail() ->getModuleAccueilConfigByType('NEWS', 1, 3)); } @@ -393,7 +393,7 @@ class VersionningWidgetActivitiesVersionTest extends VersionningWidgetTestCase { "rss_avis" => "1"])); ; - Class_Profil::find(1) + Class_Profil::getPortail() ->updateModuleConfigAccueil(3, ['type_module' => $this->_type_module, 'division' => 1,