Commit d0ffb036 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#99489_magasin_de_themes_bases_sur_bootstrap' into 'master'

on bootstrap

See merge request !3441
parents 6befbd10 06fc3505
Pipeline #9736 passed with stage
in 43 minutes and 44 seconds
......@@ -1157,7 +1157,7 @@ class AbonneController extends ZendAfi_Controller_Action {
if ($this->_request->isPost() && !$this->_getParam('library_ids')) {
$this->_helper->notify($this->_('Au moins une bibliothèque favorite doit être sélectionnée!'));
return;
return $this->_redirectToReferer();
}
if ($this->_request->isPost()) {
......
......@@ -271,6 +271,22 @@ class CmsController extends ZendAfi_Controller_Action {
}
public function renderAction() {
if ((!$article = Class_Article::find((int)$this->_getParam('id')))
|| (!$article->isFrontVisible())) {
throw new Zend_Controller_Action_Exception($this->view->_('Désolé, cette page n\'existe pas'), 404);
return;
}
$callback = function() use ($article) {
Class_ScriptLoader::getInstance()->addCmsMeta($article);
return $this->view->renderArticle($article);
};
return $this->_helper->ajax($callback);
}
protected function _initCalendarAndPreferences() {
$id_module = $this->_getParam('id_module');
......
......@@ -490,6 +490,12 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
public function resourcesAction() {
if ($this->notice->isRss())
return $this->_forward('render-items', 'rss', 'opac', ['id' => $this->notice->getRssId()]);
if ($this->notice->isArticleCms())
return $this->_forward('render', 'cms', 'opac', ['id' => $this->notice->getArticleId()]);
$this->notice->isRessourceNumerique()
? $this->_forward('digital-resources')
: $this->_forward('items-resources');
......
......@@ -1883,6 +1883,20 @@ class Class_Notice extends Storm_Model_Abstract {
}
public function getArticleId() {
return ($article = Class_Article::findFirstBy(['id_notice' => $this->getId()]))
? $article->getId()
: 0;
}
public function getRssId() {
return ($rss = Class_Rss::findFirstBy(['id_notice' => $this->getId()]))
? $rss->getId()
: 0;
}
public function getFileContentFirstWords() {
return substr($this->getFileContent(), 0, 180) . '…';
}
......
......@@ -46,12 +46,10 @@ class ZendAfi_View_Helper_Article_RenderFullContent extends ZendAfi_View_Helper_
public function renderPrintLink($article) {
return $this->view->tag('div',
$this->view->tagPrintLink((new Class_Entity())
->setModels([$article])
->setStrategy('Article_List')),
['class' => 'print']);
return $this->view->tag('div',
$this->view->tagPrintLink((new Class_Entity())
->setModels([$article])
->setStrategy('Article_List')),
['class' => 'print']);
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -42,11 +42,16 @@ class ZendAfi_View_Helper_ModeleFusion_Link extends ZendAfi_View_Helper_BaseHel
},
$models));
return $this->view->tagAnchor($this->view->url(['action' => $instance->getAction(),
'ids' => $ids,
'subject' => $instance->getSubject(),
'strategy' => $instance->getStrategy(),
'modele_fusion' => $model_fusion->getId()]),
$url = ['action' => $instance->getAction(),
'ids' => $ids,
'subject' => $instance->getSubject(),
'strategy' => $instance->getStrategy(),
'modele_fusion' => $model_fusion->getId()];
if ($controller = $instance->getController())
$url ['controller'] = $controller;
return $this->view->tagAnchor($this->view->url($url),
$instance->getLink(),
$instance->getAttribs());
}
......@@ -57,5 +62,4 @@ class ZendAfi_View_Helper_ModeleFusion_Link extends ZendAfi_View_Helper_BaseHel
return implode(';',$data);
return $data;
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_TagPrintLink extends ZendAfi_View_Helper_ModeleFusion_Link {
public function tagPrintLink($instance) {
$link = ($instance->getStrategy() == 'Article_List')
......@@ -27,7 +26,6 @@ class ZendAfi_View_Helper_TagPrintLink extends ZendAfi_View_Helper_ModeleFusion
['alt' => $this->_("Imprimer")])
: $this->_('Imprimer');
$instance
->setAction('print')
->setLink($link)
......@@ -36,5 +34,4 @@ class ZendAfi_View_Helper_TagPrintLink extends ZendAfi_View_Helper_ModeleFusion
return $this->ModeleFusion_Link($instance);
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -434,6 +434,11 @@ label[data-name=note] ~ div label.multi-element-label + br {
text-align: center;
flex: 100%;
max-width: 100%;
max-height: 100%;
}
.modal_image img {
width: auto !important;
}
.blockquote-footer {
......@@ -512,6 +517,10 @@ header.col {
margin:0 0 0 0.05rem;
}
.h_1em {
height: 1em;
}
.fs_1em {
font-size: 1em;
}
......@@ -544,6 +553,8 @@ dl.row {
display: inline-flex;
}
.button_text_d_none > div > a > .button_text,
.button_text_d_none > a > .button_text,
.button_text_d_none > .dropdown > a > .button_text {
display: none !important;
......@@ -753,6 +764,10 @@ form.form input[type="checkbox"] {
margin-left: 0;
}
form.form .dropdown-menu input[type="checkbox"] {
margin-left: -1.25rem;
}
input[id^="select_record"] {
position: unset;
margin-left: 0;
......
......@@ -175,6 +175,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'read-review' => 'class far fa-comment-dots',
'team' => 'class fas fa-users',
'agenda' => 'class fas fa-calendar-alt',
'ical' => 'class far fa-calendar-plus',
],
......@@ -209,6 +210,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'print' => 'class fas fa-print',
'facebook' => 'class fab fa-facebook-f',
'twitter' => 'class fab fa-twitter',
'permalink' => 'class fas fa-link',
'tag' => 'class fas fa-tag',
'star' => 'class fas fa-star',
......
......@@ -58,6 +58,7 @@ class Intonation_Library_Trailers {
return [];
return [(new Intonation_Library_Trailer(['Source' => $data['source'],
'Model' => $this->_model,
'Url' => $url]))];
}
}
......@@ -183,10 +183,32 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
public function getActions() {
if (!Class_Users::isCurrentUserCanAccesBackend())
return [];
$actions = [];
$actions_pro = [new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin',
if ($this->_model->hasEventsDebut())
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac',
'controller' => 'cms',
'action' => 'ical',
'id' => $this->_model->getId()], null, true),
'Image' => Class_Template::current()->getIco($this->_view,
'ical',
'library'),
'Text' => $this->_('ICAL'),
'Attribs' => ['target' => '_blank'],
'Title' => $this->_('Ajouter l\'événement %s dans mon calendrier',
$this->_model->getLibelle())]);
$actions [] = $this->_view->div(['class' => 'print'],
$this->_view->tagPrintLink((new Class_Entity())
->setController('cms')
->setModels([$this->_model])
->setStrategy('Article_List')));
$actions [] = $this->_view->reseauxSociaux($this->_model);
if (Class_Users::isCurrentUserCanAccesBackend())
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin',
'controller' => 'cms',
'action' => 'edit',
'id' => $this->_model->getId()], null, true),
......@@ -198,7 +220,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
'Text' => $this->_('Modifier …'),
'Popup' => true,
'Title' => $this->_('Modifier l\'article %s',
$this->_model->getLibelle())])];
$this->_model->getLibelle())]);
$button = new Intonation_Library_Link(['Text' => $this->_('Plus'),
'Attribs' => ['class' => 'more_action'],
......@@ -208,7 +230,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
'more',
'utils')]);
return [$this->_view->renderDropdown($this->_view->renderActions($actions_pro), $button, 'dropleft dropup')];
return [$this->_view->renderDropdown($this->_view->renderActions($actions), $button, 'dropleft dropup')];
}
......
......@@ -133,10 +133,40 @@ class Intonation_Library_View_Wrapper_Pro extends Intonation_Library_View_Wrappe
->setTitle($this->_('Lire les %d articles du professionnel',
$number_of_articles)));
if ($bookmarked_domains = $this->_model->getBookmarkedDomains())
$badges = $this->_addBookmarkedDomainsToBadges($bookmarked_domains,
$badges);
return $this->_view->renderBadges($badges);
}
protected function _addBookmarkedDomainsToBadges($bookmarked_domains, $badges) {
$default_image = Class_Template::current()
->getIco($this->_view,
'list',
'utils');
foreach ($bookmarked_domains as $bookmarked_domain) {
$image = ($url_img = $bookmarked_domain->getUrlImg())
? $this->_view->tagImg($url_img, ['class' => 'h_1em mr-1'])
: $default_image;
$badges [] = ((new Intonation_Library_Badge)
->setTag('a')
->setUrl($this->_view->url(['controller' => 'recherche',
'action' => 'simple',
'id_catalogue' => $bookmarked_domain->getId()]))
->setClass('primary')
->setImage($image)
->setText($bookmarked_domain->getLibelle())
->setTitle($this->_('Voir les documents rangés dans %s',
$bookmarked_domain->getLibelle())));
}
return $badges;
}
public function getActions() {
return [];
}
......
......@@ -124,6 +124,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati
protected function _renderSettingsForm() {
$form = ZendAfi_Form_User_Settings::forUser($this->_model);
$form->setAction($this->_view->url(['controller' => 'abonne',
'action' => 'manage-settings']));
if (!$form->getElements())
return '';
......
......@@ -45,19 +45,8 @@ class Intonation_View_CardifyFullDescription extends Intonation_View_CardHelper
implode($content),
['class' => 'card-body']);
$links = [];
if ($link = $element->getMainLink())
$links [] = $this->view->tagAction($link);
foreach($element->getActions() as $action)
$links [] = is_string($action)
? $action
: $this->view->tagAction($action);
if (!empty($links))
$html [] = $this->_tag('div',
implode($links),
['class' => 'card-footer d-flex flex-column flex-md-row justify-content-between']);
$html [] = $this->view->renderActionsInRow(array_merge([$element->getMainLink()],
$element->getActions()));
return $this->view->div(['class' => 'card'],
implode($html));
......
......@@ -86,7 +86,7 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper {
protected function _thumbnail() {
$image = $this->_element->getPicture();
return
$this->view->div([],
$this->view->div(['onclick' => '$(this).toggleClass(\'modal_image\');'],
$this->view->div(['class' => 'position-absolute'],
$this->view->tagAction($this->_element->getPictureAction()))
. $this->view->tagImg($image,
......
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Intonation_View_Permalink extends ZendAfi_View_Helper_BaseHelper {
public function permalink($url) {
$image = Class_Template::current()->getIco($this->view,
'permalink',
'utils');
return $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_('Lien …'),
'Image' => $image,
'Title' => $this->view->_('Voir le lien permanent suivant: %s', $url),
'Class' => 'permalink py-1 my-1',
'attribs' => ['data-url' => $url,
'data-helptext' => $this->view->_('Copiez le lien suivant'),
'onclick' => 'popupPermalink(this);']]));
}
}
\ No newline at end of file
<?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_RenderActionsInRow extends ZendAfi_View_Helper_BaseHelper {
public function renderActionsInRow($actions) {
$links = [];
foreach($actions as $action)
$links [] = is_string($action)
? $action
: $this->view->tagAction($action);
return empty($links)
? ''
: $this->_tag('div',
implode($links),
['class' => 'card-footer d-flex flex-column flex-md-row justify-content-between']);
}
}
......@@ -23,9 +23,11 @@
class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper {
public function renderArticle($article) {
$body_content = [$this->view->tagEditArticle($article),
$wrapper = (new Intonation_Library_View_Wrapper_Article)
->setModel($article)
->setView($this->view);
$this->_tag('h2',
$body_content = [$this->_tag('h2',
$article->getTitre(),
['class' => 'card-title']),
......@@ -34,7 +36,7 @@ class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper {
['title' => $this->_('Auteur de l\'article "%s".', $article->getAuthorName()),
'class' => 'card-subtitle text-muted']),
$this->_badges($article),
$this->_badges($wrapper),
$this->_tag('p',
$this->view->article_ReplaceWidgets($article->getFullContent()),
......@@ -45,17 +47,16 @@ class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper {
implode($body_content),
['class' => 'card-body']);
$footer = $this->view->renderActionsInRow($wrapper->getActions());
return $this->_tag('div',
$body,
$body
. $footer,
['class' => 'card card_article']);
}
protected function _badges($article) {
$wrapper = (new Intonation_Library_View_Wrapper_Article)
->setModel($article)
->setView($this->view);
protected function _badges($wrapper) {
return $wrapper->getBadges();
}
}
\ No newline at end of file
......@@ -27,10 +27,31 @@ class Intonation_View_RenderTrailers extends ZendAfi_View_Helper_BaseHelper {
$html = [];
foreach ($trailers as $trailer)
$html [] = $this->view->renderEmbed($trailer->getSource(),
$trailer->getUrl());
foreach ($trailers as $trailer) {
$html [] = $this->_renderEdit($trailer)
. $this->view->renderEmbed($trailer->getSource(),
$trailer->getUrl());
}
return implode($html);
}
protected function _renderEdit($trailer) {
if (!Class_Users::isCurrentUserCanAccesBackend())
return '';
$url = $this->view->url(['module' => 'admin',
'controller' => 'records',
'action' => 'trailer',
'id' => $trailer->getModel()->getId()]);
return $this->view
->Admin_Button((new Class_Entity())
->setText($this->_('Modifier la bande-annonce'))
->setUrl($url)
->setAttribs(['data-popup' => 'true'])
->setImage(Class_Admin_Skin::current()
->renderButtonIconOn('configuration', $this->view)));
}
}
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Intonation_View_ReseauxSociaux extends ZendAfi_View_Helper_ReseauxSociaux {
public function shareLinkImgHtml($clef, $url_table) {
$title = $this->_('Partager %s sur %s', $url_table['titre'], $clef);
$image = Class_Template::current()->getIco($this->view,
$clef,
'utils');
$script = sprintf('$.getScript(\'%s\')',
$this->_escapeJsAttrib($this->getScriptFromController($url_table)));
return $this->view->tagAction(new Intonation_Library_Link(['Text' => $clef,
'Image' => $image,
'Title' => $title,
'Class' => 'reseau-social-img py-1 my-1 d-block',
'attribs' => ['onclick' => $script]]));
}
}
\ No newline at end of file
......@@ -79,7 +79,7 @@ class Intonation_View_TagListeCoches extends ZendAfi_View_Helper_TagListeCoches
&& $this->_coche[$clef])
$attribs['checked'] = 'checked';
return $this->view->div(['class' => 'ml-4 p-1'], $this->_tag('input', null, $attribs) . $libelle);
return $this->view->div(['class' => 'ml-5 p-1'], $this->_tag('input', null, $attribs) . $libelle);
}
......
<?php
/**
* Copyright (c) 2012-2014, 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_TagPrintLink extends ZendAfi_View_Helper_ModeleFusion_Link {
public function tagPrintLink($instance) {
$image = Class_Template::current()->getIco($this->view,
'print',
'utils');
$text = $this->view->div(['class' => 'd-none d-md-inline text-left button_text'],
$this->_('Aperçu …'));
$instance
->setAction('print')
->setLink($image . $text)
->setAttribs(['title' => $this->_('Aperçu avant impression'),
'target' => '_blank']);
return $this->ModeleFusion_Link($instance);
}
}
\ No newline at end of file
......@@ -561,4 +561,93 @@ class PolygoneTemplateSuggestionsNanookTest extends PolygoneTemplateTestCase {
public function francisShouldHaveWrotePurpleForTheWinSuggest() {
$this->assertXPathContentContains('//main//div', 'Purple for the win suggéré par francis francis');
}
}
\ No newline at end of file
}
class PolygoneTemplateArticleRecordTest extends PolygoneTemplateTestCase {
protected $_record_id;
public function setUp() {
parent::setUp();
$article = $this->fixture('Class_Article',
['id' => 3,
'titre' => 'Article Bokeh',
'contenu' => 'Un super article à traduire !',
'tags' => 'test;bokeh;libre;git']);
$article->index();
$this->_record_id = $article->getIdNotice();
$this->dispatch('/opac/noticeajax/resources/id/' . $this->_record_id);
}
/** @test */
public function articleNoticeajaxResourcesShouldRenderRenderItems() {
$this->assertXPathContentContains('//div', 'Un super article');
}
/** @test */
public function shareOnFacebook() {
$this->assertXPathContentContains('//a', 'facebook');
}
/** @test */
public function shareOnTwitter() {
$this->assertXPathContentContains('//a', 'twitter');
}
/** @test */
public function printLink() {
$this->assertXPathContentContains('//a', 'Aper');
}
}
class PolygoneTemplateLibraryTeamTest extends PolygoneTemplateTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_Bib',
['id' => 22,
'libelle' => 'My Lib']);
$henry = $this->fixture('Class_Users',
['id' => 23,
'nom' => 'henry',
'login' => 'henry',
'password' => '123',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL]);
$this->fixture('Class_Catalogue',
['id' => 3,
'libelle' => 'Dès',
'indexer' => 1,
'url_img' => 'henry_des.png']);
(new Class_User_Settings($henry))->setBookmarkedDomains([3,7])->save();
$this->dispatch('/opac/bib/equipe/id/22');
}
/** @test */
public function henryShouldHaveDesAsTagDomain() {
$this->assertXPathContentContains('//a[contains(@class, "badge")]', 'Dès');
}
/** @test */
public function desDomainTagShoulHaveHenryDesPngAsImage() {
$this->assertXPath('//a[contains(@class, "badge")]//img[contains(@src, "henry_des.png")][contains(@class, "h_1em mr-1")]');
}
}
......@@ -1609,7 +1609,7 @@ class TemplatesDispatchIntonationWithShareTest extends TemplatesIntonationTestCa