Commit 8cf70968 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #64573 wip on bootstrap

parent cd00c3fc
Pipeline #7223 passed with stage
in 36 minutes and 57 seconds
......@@ -67,7 +67,14 @@ class Admin_TemplateController extends ZendAfi_Controller_Action {
public function resetAction() {
$template = Class_Template::current()->resetSettings();
$this->_helper->notify($this->_('Modèle "%s" réinitialisé', $template->getId()));
$this->_helper->notify($this->_('Thème %s réinitialisé', $template->getId()));
return $this->_redirectClose($this->_getReferer());
}
public function updateAction() {
$template = Class_Template::current()->updateSettings();
$this->_helper->notify($this->_('Thème %s mis à jour', $template->getId()));
return $this->_redirectClose($this->_getReferer());
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@ class AbonneController extends ZendAfi_Controller_Action {
return;
$this->_user = $this->view->user = Class_Users::getIdentity();
Class_Template::current()->upgradeUser($this->_user);
$this->clearEmprunteurCache();
......@@ -1463,6 +1464,27 @@ class AbonneController extends ZendAfi_Controller_Action {
}
public function selectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
}
public function ajouterALaSelectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
$this->view->criteria =
(new Class_CriteresRecherche())
->setParams(array_merge($this->_request->getParams(),
['tri' => Class_CriteresRecherche::SORT_PUBLICATION]));
}
public function mesAvisAction() {
}
......
<?php
echo $this->abonne_AddRecordsToSelection($this->user, $this->selection, $this->criteria);
<?php
echo $this->abonne_SelectionBoard($this->selection);
......@@ -55,7 +55,8 @@
class NewsletterLoader extends Storm_Model_Loader {
public function getPublishedNewsletters() {
return Class_Newsletter::findAllBy(['draft' => 0]);
return Class_Newsletter::findAllBy(['draft' => 0,
'order' => 'titre']);
}
}
......
......@@ -39,7 +39,7 @@ class Class_Notice_Field extends Class_Entity {
public function getUrlForLink() {
return ($params = $this->getUrlParams())
? Class_Url::relative($params)
? Class_Url::relative($params, null, false)
: $this->getUrl();
}
......
......@@ -498,6 +498,11 @@ class Class_PanierNotice extends Storm_Model_Abstract {
}
public function contains($record) {
return $this->isNoticeInPanier($record);
}
public function fixLostUserId() {
if ( !$this->getIdabon())
return;
......@@ -511,4 +516,12 @@ class Class_PanierNotice extends Storm_Model_Abstract {
public function asWhere() {
return sprintf('clef_alpha in("%s")', implode('","', $this->getClesNotices()));
}
public function isMine() {
if (!$user = Class_Users::getIdentity())
return false;
return $user == $this->getUser();
}
}
\ No newline at end of file
......@@ -98,6 +98,11 @@ class Class_Template {
}
public function getUpdateUrl() {
return Class_Url::relative(sprintf('/admin/template/update/template/%s', $this->getId()));
}
public function getControlKey() {
if ($this->_control_key)
return $this->_control_key;
......@@ -308,6 +313,12 @@ class Class_Template {
}
public function updateSettings() {
$this->getSettings()->updateSettings();
return $this;
}
public function addHelperPath($view) {
return $this;
}
......@@ -368,4 +379,9 @@ class Class_Template {
return $this->_icons_cache[$cache_key] = $mapping[$key];
}
public function upgradeUser($user) {
return $this;
}
}
\ No newline at end of file
......@@ -103,4 +103,9 @@ class Class_Template_Settings extends Storm_Model_Abstract {
$settings = $this->getSettingsInstance();
return $this->_hydrating_mapping = $settings->getIntonationHydratingMapping();
}
public function updateSettings() {
return $this;
}
}
\ No newline at end of file
......@@ -25,18 +25,23 @@ class ZendAfi_Controller_Plugin_Manager_Template extends ZendAfi_Controller_Plug
return [
['url' => $model->getTryUrl(),
'icon' => 'view',
'label' => $this->_('Essayer le modèle "%s"', $model->getTitle()),
'label' => $this->_('Essayer le thème %s', $model->getTitle()),
'anchorOptions' => ['target' => '_blank']],
['url' => $model->getEditUrl(),
'icon' => 'edit',
'label' => $this->_('Paramétrer le modèle "%s"', $model->getTitle()),
'label' => $this->_('Paramétrer le thème %s', $model->getTitle()),
'anchorOptions' => ['data-popup' => true]],
['url' => $model->getResetUrl(),
'icon' => 'reload',
'label' => $this->_('Réinitialiser le modèle "%s"', $model->getTitle()),
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir réinitialiser le modèle "%s" ?', $model->getTitle()))]
'label' => $this->_('Réinitialiser le thème %s', $model->getTitle()),
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir réinitialiser le thème %s ?', $model->getTitle()))],
['url' => $model->getUpdateUrl(),
'icon' => 'batch',
'label' => $this->_('Mettre à jour le thème %s', $model->getTitle()),
'anchorOptions' => $this->_confirm($this->_('Etes-vous sur de vouloir mettre à jour le thème %s ?', $model->getTitle()))]
];
}
......
......@@ -25,11 +25,14 @@ class ZendAfi_View_Helper_Abonne_NamesOrLogin extends Zend_View_Helper_HtmlEleme
if(!$user)
return '';
$html = $html ? $this->view->tag('span', $html): '';
$html = $html
? $this->view->tag('span', $html)
: '';
return ($user->hasPseudo()
? $this->userPseudo($user)
: $this->userNames($user))
.$html;
? $this->userPseudo($user)
: $this->userNames($user))
. $html;
}
protected function userPseudo($user) {
......@@ -38,8 +41,10 @@ class ZendAfi_View_Helper_Abonne_NamesOrLogin extends Zend_View_Helper_HtmlEleme
protected function userNames($user) {
return $this->view->escape($user->getPrenom()). $this->view->tag('span', $this->view->escape($user->getNom()), ['data-name' => 'last-name']);
return sprintf('%s %s',
$this->view->escape($user->getPrenom()),
$this->view->tag('span',
$this->view->escape($user->getNom()),
['data-name' => 'last-name']));
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -367,11 +367,7 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac
public static function getWidget($id, $cfg, $view) {
if(!$instance = static::getModuleHelperFromParams($id, $cfg, $view))
return null;
$instance->getHtml();
return $instance;
return static::getModuleHelperFromParams($id, $cfg, $view);
}
......
......@@ -414,7 +414,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
}
.badge {
white-space: normal;
text-transform: lowercase;
}
main.col,
......@@ -446,6 +446,35 @@ header.col {
display: none;
}
.card .card-columns {
.img-thumbnail .card-columns {
column-gap: 0.05rem;
column-count: 3;
}
.card .card-columns .card {
margin-bottom: 0.05rem;
}
.fs_1em {
font-size: 1em;
}
.card .card-columns .card-img-overlay h3,
.card .card-columns .card-img-overlay h4,
.card .card-columns .card-img-overlay {
font-size: 0.875em;
padding: 0;
}
.no_wrap {
white-space: nowrap;
}
dl.row {
margin: 0;
}
.card-img-overlay .card-link > * {
display: inline-block;
white-space: normal;
}
\ No newline at end of file
......@@ -61,6 +61,8 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'mb-n1',
'mb-n2',
'align-items-center',
'align-items-start',
'align-items-end',
],
'hydrating_mapping' => ['div id site_web_wrapper' => 'container align-self-center',
......@@ -74,12 +76,12 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'div class boutons' => 'row justify-content-around my-3',
'label' => 'col-12 col-sm-5 col-form-label col-form-label-sm pr-1',
'label class multi-element-label' => 'col-form-label col-form-label-sm',
'input' => 'mb-2 form-control',
'input' => 'form-control form-control-sm',
'input data-spambots true' => '',
'input type checkbox' => 'form-check-input form-check-input-sm mr-1',
'input type submit' => 'btn btn-sm btn-primary',
'textarea' => 'form-control',
'select' => 'form-control form-control custom-select',
'textarea' => 'form-control form-control-sm',
'select' => 'form-control form-control-sm custom-select custom-select-sm',
'button' => 'btn btn-secondary',
'button class btn' => '',
'button class accessibility' => 'btn btn-light',
......@@ -102,7 +104,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'a' => 'btn-link',
'a class active' => '',
'a class nav-link' => '',
'a class card-link' => '',
'a class card-link' => 'no_wrap',
'a class list-group-item' => '',
'a class account-loans' => 'btn btn-sm list-group-item-info',
'ul' => 'list-unstyled',
......@@ -138,6 +140,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'hold' => 'class fas fa-thumbtack',
'loan' => 'class fas fa-book',
'late-loan' => 'class fas fa-book',
'extend-loan' => 'class fas fa-calendar-plus',
'home' => 'class fas fa-home',
'related' => 'class fas fa-clone',
'description' => 'class fas fa-info',
......@@ -165,11 +168,14 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'clean' => 'class fas fa-eraser',
'open' => 'class far fa-caret-square-down',
'add' => 'class fas fa-plus-square',
'delete' => 'class fas fa-minus',
'edit' => 'class fas fa-edit',
'rename' => 'class fas fa-edit',
'rss' => 'class fas fa-rss',
'embed' => 'class fas fa-code',
'export' => 'class fas fa-file-export',
'tag' => 'class fas fa-tag',
'star' => 'class fas fa-star',
......@@ -228,4 +234,34 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
}, array_keys($this->_default_settings)),
$this->_default_settings);
}
public function updateSettings() {
$local_settings = $this->_settings->getSettingsInstance()->toArray();
$defaults_settings = $this->_getDefaultSettings();
foreach ($defaults_settings as $key => $default) {
$data = isset($local_settings[$key])
? $local_settings[$key]
: $default;
$local_settings[$key] = is_array($default)
? $this->_mergeData($default, $data)
: $data;
}
$this->_settings->setSettings(serialize($local_settings));
$this->_settings->save();
return $this;
}
protected function _mergeData($default, $data) {
$merged = array_merge($default, $data);
if (count(array_filter(array_keys($default), 'is_string')))
return $merged;
return array_values(array_unique($merged));
}
}
\ No newline at end of file
......@@ -20,34 +20,44 @@
*/
class Intonation_View_Paniers extends ZendAfi_View_Helper_BaseHelper {
public function paniers($paniers, $panier_courant = null) {
$paniers_pro = Class_Users::getIdentity()->hasRightAccessDomaines()
? $this->view->tagAnchor($this->view->url(['controller' => 'panier',
'action' => 'domain'], null ,true),
$this->_('Voir les sélections rangées dans les domaines'),
['class' => 'mr-3',
'title' => $this->_('Voir les sélections rangés dans les domaines')]) .
$this->view->tagAnchor($this->view->url(['controller' => 'panier',
'action' => 'pro'], null ,true),
$this->_('Voir les sélections des professionnels'),
['title' => $this->_('Voir les sélections des professionnels')])
: '';
$html [] = $this->view->div([],
$paniers_pro) . BR;
$html [] = $this->view->tagAnchor($this->view->url(['controller' => 'panier',
'action' => 'add'], null ,true),
$this->_('Créer une nouvelle sélection'),
['data-popup' => 'true',
'class' => 'my-3',
'title' => $this->_('Créer une nouvelle sélection')]);
$html [] = $this->view->user_Selections($paniers);
return implode($html);
class Intonation_Library_UserPatcher {
use Trait_Translator;
protected $_user;
public function setUser($user) {
$this->_user = $user;
return $this;
}
public function patch() {
foreach($this->_getDefaultSelections() as $label)
if (!Class_PanierNotice::findFirstBy(['libelle' => $label,
'id_user' => $this->_user->getId()]))
$this->_addSelectionToUser($label);
return $this;
}
protected function _addSelectionToUser($label) {
Class_PanierNotice::newInstance(['libelle' => $label,
'id_user' => $this->_user->getId()])
->save();
}
protected function _getDefaultSelections() {
return [$this->_('Mes préférés'),
$this->_('Déjà lu'),
$this->_('À lire')];
}
public function isSelectionDefault($selection) {
return in_array($selection->getLibelle(), $this->_getDefaultSelections());
}
}
\ No newline at end of file
}
......@@ -198,6 +198,9 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp
'action' => 'prolongerPret',
'id_pret' => $this->_model->getId()]),
'Text' => $this->_('Prolonger'),
'Image' => Class_Template::current()->getIco($this->_view,
'extend-loan',
'library'),
'Title' => $this->_('Prolonger l\'emprunt %s',
$this->_model->getTitre())])];
}
......
......@@ -26,6 +26,15 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View
}
public function getContentForJSSearch() {
$content = parent::getContentForJSSearch();
if ($this->_model->hasRecipient(Class_Users::getIdentity()))
return sprintf($content, $this->_('inscrit'));
return $content;
}
public function getMainLink() {
$params = $this->_model->hasRecipient(Class_Users::getIdentity())
? ['Url' => $this->_view->url(['controller' => 'abonne',
......
......@@ -47,7 +47,10 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
['controller' => 'recherche',
'action' => 'viewnotice',
'id' => $this->_model->getId()]),
'Text' => $this->_('Voir le document'),
'Image' => Class_Template::current()->getIco($this->_view,
'read-document',
'library'),
'Text' => $this->_('Voir'),
'Title' => $this->_('Voir le document "%s" de "%s" de type "%s"',
$this->getMainTitle(),
$this->getSecondaryTitle(),
......
<?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_RecordInSelection extends Intonation_Library_View_Wrapper_Record {
protected $_selection;
public function setSelection($selection) {
$this->_selection = $selection;
return $this;
}
public function getActions() {
return [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'supprimer-de-selection',
'selection' => $this->_selection->getId(),
'id' => $this->_model->getId()]),
'Text' => $this->_('Supprimer'),
'Title' => $this->_('Supprimer le document %s de la sélection %s',
$this->_model->getTitrePrincipal(' '),
$this->_selection->getLibelle()),
'Image' => Class_Template::current()->getIco($this->_view,
'delete',
'utils')])];
}
}
\ No newline at end of file
<?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_RecordToSelect extends Intonation_Library_View_Wrapper_Record {
protected $_selection;
public function setSelection($selection) {
$this->_selection = $selection;
return $this;
}
public function getDescription() {
return '';
}
public function getMainLink() {
return new Intonation_Library_Link(['Text' => $this->_('Ajouter'),
'Attribs' => ['onclick' => '$(this).closest(\'.card\').slideUp();return true;',
'style' => 'cursor: pointer;'],
'Title' => $this->_('Ajouter le document %s à la sélection %s',
$this->getMainTitle(),
$this->_selection->getLibelle())]);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment